This work presents an approach for the harmonic components estimation problem present in electrical power systems by making use of evolutionary algorithms. The referential data were obtained by the ATP (Alternative Transients Program) software. Compact and simple genetic algorithms were applied to estimate the parameters of non-linear function to generate a waveform as similar as possible to the one provided by the ATP software. The results yielded by the aforementioned evolutionary algorithms were then compared with one another in a number of scenarios, using the values obtained by the waveform of reference generated by the ATP software. The comparisons were used to seek evidence of which algorithm solved the problem in a setting with limited availability of computational resources. Based on the generated results, it has been found that compact genetic algorithm satisfactorily solves the proposed problem and it is the most indicated method, when less computational effort is required.
- compact genetic algorithm
- electrical power systems
- simple genetic algorithm
Ideally, electric power systems (EPS) should operate as voltage and current waveforms the closest to a sinusoidal waveform as possible, with constant magnitude and frequency. However, this situation doesn't always happen, which implies the occurrence of disturbances in the power quality (PQ) . Problems with the PQ are associated with any disturbance in the voltage, current, or frequency deviation that results in failure or defective operation of a consumer's equipment . Studies related to the PQ are becoming increasingly important due to the characteristics of the charges and EPS, which are more sensitive to the disturbances.
Among the many disturbances in the PQ, there is a class called harmonic distortion. Harmonic distortions are periodic distortions as voltage and current waveforms, characterized by the presence of frequencies that are integer multiples of the nominal frequency of the system and often associated to continuous operation of charges with non-linear characteristics . With technological development and the development of power electronics, these disturbances became more and more relevant due to sensitive equipment in the EPS that requires electric energy of better quality . Some of the problems caused by harmonic distortions are overheating of devices, activation of safety devices , resonance, high voltage between neutral and ground, low performance of devices and equipment, and interruption of production processes .
Among the methods to remedy the problems caused by harmonics are active power filters. With the identification of the harmonic components that may pollute the waveform of the voltage or current of a system, such filters can be used to properly correct the problem. AC controllers, generally present in homes or even in commercial environments are typical sources of distortions caused by harmonics . In , a study was made to identify, with the help of artificial neural networks, the first six harmonic components of a circuit compound by a semiconductor switch (TRIAC), a sinusoidal voltage source, trip circuit, and of incandescent bulbs.
It should be stressed that non-linear charges, increasingly present in EPS, are the most sensitive to the disturbances and are also the ones that cause the greatest harmonic distortions in the EPS . Therefore, the presence of the harmonics in the EPS tends to become more frequent and increases the economic losses caused by low PQ. For these reasons, many researches would like to seek methods that improve the precision and speed of the algorithms applied in the estimation of the harmonic components. Among the many techniques used, particularly noticeable are the methods based on Discrete Fourier Transform (DFT) , Fast Fourier Transform (FFT) , the Least-Squares adjustment (LS) , Wavelet Transform , and Kalman Filter . The mentioned methods can be affected by the continuous current component (CCC) , however, methods based on computational intelligence such as Artificial Neural Networks (ANN) [13, 14], Particle Swarm Optimization (PSO) , and Genetic Algorithms  are weakly influenced by the CCC  and show good results for estimating harmonic components.
Considering that the proposal of using evolutionary algorithms (EA) for estimating harmonic components show good results, this work investigated the applicability and efficiency of compact genetic algorithm (CGA) . For validation purposes, a comparison between CGA and SGA (simple genetic algorithm) [18, 19] was performed. Both algorithms were used to estimate the RMS values and the phase angles of the harmonic components of voltage electric signals. By using CGA, it is possible to get the benefits of the use of EA for estimating harmonic components with an algorithm of simple implementation that requires few computing resources .
This article was divided into six (6) additional sections, in addition to the introduction. In the second section there is a description of the problem, in which the mathematical models used are presented. The third section addresses the algorithms used, giving emphasis on descriptions related to SGA and CGA. The fourth section addresses the methodology used to get the harmonic components through two different mathematical models. In the fifth section are the results obtained through the algorithms used. In the sixth section are the discussions about the results. The seventh section presents the conclusions obtained.
2. Problem description
A waveform can be mathematically represented through Fourier series, in which it is possible to express a waveform in terms of its continuous, fundamental, and harmonic components. Each harmonic component of the waveform has its own amplitude, a phase angle, and a frequency, which has to be an integer multiple of the fundamental frequency . Thus, a waveform as a function of time can be descripted by Eq. (1) [15, 21] in which
In order to perform the estimation of the parameters, the waveform is discretized in
In this section the simple genetic algorithm (SGA) and the compact genetic algorithm (CGA) are described.
3.1. Simple genetic algorithm
GAs are algorithms meant for search and global optimization, based on Darwin's theory of evolution and genetics. When GAs are used, it is assumed that in a certain population, the best individuals have greater chances of survival and of generating increasingly fit individuals , guaranteeing that the population evolves and finds a solution for a problem.
As presented in the pseudocode in Figure 1, SGA has the following steps: initialization of the population, evaluation, selection, crossover, and mutation.
The first step is the initialization of the population. In the population evaluation step, all individuals are evaluated through the use of an evaluation function. In the selection process, an
3.2. Compact genetic algorithm
The determination itself of the necessary parameters for the functioning of the SGA, such as the crossover and mutation rates, becomes a problem of optimization inside another problem of optimization. Predicting the movement of the populations is considerably difficult  and because of that, new types of algorithms have been developed, such as the estimation of distribution algorithms (EDA) , which we can cite the CGA as one of the simplest EDA models.
CGA has a similar effectiveness as the SGA, but it consumes less computational resources as it represents the population with a vector of probability , which means it represents the proportion of the presence of each gene in the population. Thus, because it does not have a physical representation of the population (only the vector of probability), nor the crossover step, nor the mutation step , the CGA happens to be a simpler algorithm to be implemented compared to the SGA. Figure 2 shows the pseudocode of CGA considering a tournament size equal to 2 to be the selection mechanism.
The CGA has as its first step the initialization of the vector of probability, in which for each position it is attributed the value of 0.5, or 50% of the probability of generating 1 for that position of the individual. The second step consists of generating two individuals, taking into account the vector of probability. In the third step, the verification of the individual with the best evaluation grade is performed. Based on the comparison between the best and the worst individual, an update is performed on the vector of probability in the fifth step. While the vector of probability doesn't converge, the algorithm keeps executing from the second stage and when it converges, the algorithm stops the execution. The final solution is the vector of probability.
In order to estimate the harmonic components, CGA and the SGA were used, both using the mathematical model to estimate the previously presented harmonic components and considering the first seven components of the Fourier series. The algorithm estimates 30 parameters, among which 28 are dedicated to the amplitude of their sins, co-sins, and phase angles, and the other two parameters are for the continuous component of the signal and for the time constant. In order to represent the parameters of the Fourier series, 8 bits were used for each parameter, as it was verified it was enough to represent the values with good precision. An individual generated is represented as shown in Figure 3.
The same representation of the individuals was used in the SGA and the CGA. The SGA was implemented with a 75% crossover rate. As there is no mutation step in the CGA, in order to perform a fairer comparison, the SGA was considered as not having a mutation step for observing its evolutionary process without this operator. The crossover rate was considered equal to 75% because no improvement was obtained or economy (saving) of computational resources.
The data used in the tests are voltage values obtained through a simulation of a power electric system using ATP software . The evaluation of the individuals was performed through a comparison between the original signal and the signal generated from the estimated parameters.
Dummy Text Figure 4 shows the comparison between the waveform of a measured signal and the waveform obtained from the estimated parameters.
It is possible to observe that the smaller the error between the measured and the estimated waveforms, the better the estimation of the parameters. Therefore, the goal is to minimize the value of the evaluation function adopted that considers the errors between the signals as in Eq. (4),
When using the binary representation of the individuals of the population, CGA adopts a stopping criterion based on the probability of each bit of the individual being 1. So, if in all positions of the vector of probability the possibility of being 1 is less than 5% or more than 95% the algorithm should stop. It was adopted the same criterion for SGA. Considering that SGA deals with the population instead of a vector of probability, which means that when the percentage of bits that equal 1 reaches 5% or 95% for the same locus of all individuals of the population, SGA should stop. It should be pointed out that the tournament method  was the type of selection used.
All tests were performed with four different voltage waveforms, with population varying from 100 to 10000 and with the tournament size varying between 2, 8, and 32. For each configuration, the average of the evaluations of the whole population corresponds to the mean error. Each configuration was executed 10 times for each of the 4 waveforms, with the purpose of obtaining the average of the mean errors, the smallest error in the 10 executions, the number of evaluations, and the standard deviation. The mean error values, the number of evaluations, and the standard deviation were obtained from the average of the 4 waveforms. The number of evaluations for the SGA was calculated as being the average of the number of generations of the 10 executions multiplied by the size of the population. For the CGA, on the other hand, it was calculated as being the size of the tournament multiplied by the average of the number of generations in the 10 executions.
The algorithms applied for the estimation of harmonics were tested by means of the voltage values obtained through simulations performed with ATP software. The results obtained were compared considering the different configurations used in the algorithms.
5.1. Estimation of the harmonic components using the proposed methodologies
In this section, the waveform of one of the situations used is going to be presented, and this waveform is going to be compared to the waveforms generated through the harmonics estimated with different algorithm configurations.
Figure 5 presents the waveforms generated with the estimated harmonics using both SGA and CGA. In this test, the parameters in SGA and CGA were adopted as the tournament size (k) is equal to 2 and the population size is equal to 100 individuals. As it can be observed in Figure 6 with the configuration used for the GAs, CGA showed a better answer for estimating the harmonics, as with CGA's estimation of a waveform closer to the original one simulated through ATP was generated.
Figures 6 to 9 present the parameters of reference used to obtain four different voltage waveforms. In these tables it also presented a comparison between the results obtained with CGA and SGA. Also, they show the answer gotten by DFT and PSO as presented in .
It should be said that the results showed in Figures 6 to 9 for the CGA were obtained considering a population size of 100 individuals and a tournament size of 2. But the results showed in both tables for SGA were obtained considering a population size of 2000 individuals and a tournament size of 8. It should also be pointed out that the values presented are always close to the reference ones. It was observed that in some situations the estimation performed by DFT and PSO, with 30 particles, were more precise than the one obtained using the other algorithms.
In the following sections the results obtained are discussed in a more general way, as well as some quality criteria of the solutions found.
5.2. Observation of the mean error
5.3. Observation of the number of evaluations
Figures 13, 14, and 15 show graphs of the number of evaluations in the number of individuals given the tournament size of 2, 8, and 32. Through the number of evaluations of the objective function, it is possible to evaluate the convergence time of algorithms adopted. This analysis is very important for determining their feasibility in the real world.
5.4. Observation of the standard deviation
Figures 16, 17, and 18 show graphs of the standard deviation in the number of individuals given the tournament size of 2, 8, and 32. The standard deviation offers a way of evaluating how much the objective function is varying for all samples under analysis. A tournament size of 2 (Figure 16) SGA will show the smallest value for the standard deviation among all configurations analyzed. A tournament size of 8 CGA shows the smallest standard deviation.
After the presentation of the results and tests performed, a few conclusions deserve to be highlighted. Initially, concerning the mean error with tournament size of 8, it is observed that CGA obtains better results than SGA.
Figure 10, with tournament size of 2 CGA to a smaller number of individuals, has a lower mean error than SGA. With the increasing number of individuals SGA tends to get a smaller mean error.
In Figures 11 and 12 the mean error observed with CGA tends to be smaller than with SGA. An increase in the selective pressure influenced the convergence of SGA in a negative way. On the other hand, Figures 13, 14, and 15 show that CGA tends to present a number of evaluates higher than SGA with the same population size for each size tournament adopted.
Concerning the standard deviation, it was observed that in fact SGA is more sensitive to the selective pressure than CGA. As with a smaller number of individuals, CGA stabilizes its standard deviation while SGA needs a greater population to achieve a similar standard deviation. As a consequence, CGA gets to its global optimum value faster than SGA.
Considering the above observations, it is possible to affirm that the use of CGA carries in computational resources for obtaining good quality answers because for the same population size, it provides the best quality solutions (with minor mistakes and standard deviation smaller) than the SGA, even requiring a larger number of reviews to converge. To present solutions with the same quality as the CGA, the SGA needs to work with larger populations and consequently will require a greater number of evaluations of the objective function to obtain a solution with the same quality as the CGA. It is possible to perceive both by the results presented in Figures 6 to 9, and the graphics performance analysis of Figures 6 to 14 that the CGA with the tournament size equal to 2 and with a population of 100 individuals can provide estimates of harmonics with good accuracy. For SGA to provide solutions with the same level of accuracy requires a population of 2,000 individuals.
With the results found, it was verified that both algorithms present adequate solutions for the problem presented, as long as a model and convenient parameters are adopted. It is important to highlight that when a population size of 100 and a tournament size of 2 individuals are used, CGA manages to achieve a lower error than SGA with the same configuration.
The study presented showed graphs of the mean error, smallest error, number of evaluations, and standard deviation. Also, graphs comparing a waveform of reference with waveforms obtained when using CGA and SGA were presented. For the CGA, using a tournament size of 2 and population size of 100, the waveform obtained was closer to the waveform of reference than for the SGA with tournament size of 8 and population size of 500. It was also noted that for a population size of 100 and tournament size of 2, the number of evaluations of both CGA and SGA were very close. As showed in this work, CGA showed good results as that of SGA. However, by using less computational resources there is the possibility, in future works, to take advantage of the strong parallelism in the genetic algorithm to implement it in an embedded system.
The authors acknowledge the support received from UESPI, UFPI, CNPq and FAPEPI.