Grid power quality enhancement using an ANFIS optimized PI controller for DG

Grid frequency variation causes phase angle deviation in current with respect to voltage. This is sensed at the phase-locked loop in the controller. In past studies the effect of grid frequency variation is neglected while designing the controller for power quality restoration. When modern grids are connected to large numbers of non-linear loads and various types of distributed generation (DG), it results in continuous variation in grid frequency. Thus it is necessary to consider the grid frequency variation for effective power quality restoration. However, tuning of conventional PI controller gains considering frequency variation is very difficult. Thus it is necessary to develop an adaptive intelligent nonlinear controller to tackle the effects of frequency variation, voltage distortion and non-linear load simultaneously. This paper presents the importance of considering the effects of the frequency variation, grid voltage distortion and non-linear load, while designing and deploying a controller for power quality restoration. The proposed controller supplies power to local load as well as transferring surplus power to the grid from DG along with the additional benefit of improving grid power quality. A DG with an ANFIS optimized PI current controller for power quality enhancement is proposed. The method is economical as it requires no additional hardware. Results are compared with PI, PI-RC and fuzzy current controllers to validate the effectiveness of the proposed controller.


Introduction
The growing global energy crisis, environmental pollution and depletion of fossil fuels have led to greatly increased use of alternate renewable energy sources. As a result, renewable energy sources in the form of DGs are integrated in large numbers into power systems [1]. There are many advantages of DG systems over traditional power generation using fossil fuels, such as clean electric power generation, low cost, high efficiency, and small size. In a grid synchronized mode, a DG system is typically operated to dispatch the extracted power from renewable energy sources to the utility grid. To fully utilize the advantages of a DG system, it can supply power to the local loads and the available power surplus is then transferred to the grid [2]. In both cases without and with the local load configurations, the DG system needs to supply high-quality grid current with a THD less than 5%, as recommended in the IEEE519 Standard [3].
Various strategies for current control have been introduced to produce high-quality grid current, such as PI, predictive, hysteresis, proportional-resonant (PR) and artificial intelligence-based controllers. Hysteresis control offers rapid response and is simple, though it creates disturbances with variable and high frequency switching, which results in complex design of the output filter and high current ripple [4]. Another viable solution for grid-connected DG current regulation is predictive control. However, a strong controller function depends on system parameters [5], and thus quality of the grid current is affected by the system uncertainties. The effective solution used to achieve high-quality grid current is a PI controller in the αβ and dq frames. However, such a current controller is effective only when the voltage of the grid is sinusoidal and balanced. However, in modern power systems, most loads are controlled by AC/DC converters acting as nonlinear loads. Thus the grid voltage at the PCC is usually distorted or unbalanced, and consequently the performance of the DG controller in supplying high-quality grid current to the power system can deteriorate [6].
In [6], a novel compensation approach is introduced for THD reduction by controlling DG current under grid voltage distortion, where the grid voltage harmonics are extracted using the Cauchy-Schwarz theory of inequality. However, the quality of grid current heavily depends on the accuracy of harmonic analysis of the grid voltage, so less accurate harmonic analysis makes it difficult to maintain the quality of grid current. Moreover, this method operates only off-line, as the required calculation time is very large.
In [7] and [8], a resonant controller using several selective harmonic compensators is developed in which multiple resonant controllers are used to eliminate the 5th and 7th components of the grid voltage harmonics by tuning the controller at the multiple 6th harmonics. Improved quality of grid current can then be achieved by the multiple resonant controllers. However, because only one specific harmonic component is regulated by a single resonant controller, many resonant controllers would be required to compensate high order harmonics. This increases the control system complexity. A control scheme is adopted with the simplified technique of repetitive control, where a bank of resonant controllers, called repetitive controllers (RC), compensate higher order harmonics with simple delays to improve the grid current quality [9].
The presence of nonlinear local load and grid voltage distortion has a major impact on the quality of supply DG current [10]. To address this problem, a feed-forward loop with measurement of local load current is adopted in [10] and [11]. However, its main drawback is that it requires additional current sensors for measuring the local load current. Furthermore, none of the methods simultaneously tackle the impact of the local nonlinear load, grid voltage distortion, and grid frequency variation.
Under dynamically changing operating conditions and continuous variations in system parameters, it is difficult to obtain satisfactory results by use of a conventional PI controller. An option for dynamic response improvement in any system is self-tuning, although it is time-consuming and not easy to realize a controller with self-tuning PI gains. The use of intelligent techniques such as neural networks, fuzzy logic and the ANFIS system are some of the alternatives. For vague and non-linear systems, the simple rule-based fuzzy logic control (FLC) can be used, while FLC can be made adaptive by the ANFIS which is a combination of artificial neural networks (ANN) and FLC [12]. An advanced space vector pulse width modulation (SVPWM) based predictive current (PC) controller for switching pulse control in an inverter is introduced in [5]. A comparative study of different DG current controllers for power quality improvement is proposed. Applications of ANN and Fuzzy in various research areas have been carried out in [13]- [14] where increased accuracy and functionality are achieved.
In a traditional PI controller, the gains are calculated assuming the grid frequency is constant, whereas in practice this is not true. Thus, the traditional PI controller fails to compensate for power quality issues when frequency variation exists along with grid voltage distortion and non-linear loads. The aforementioned limitations are addressed in this paper, and the novelty of the proposed work is to simultaneously tackle the impact of the local nonlinear load, grid voltage distortion and grid frequency variation, and to compensate for power quality issues by optimally tuning the PI controller with the help of intelligent techniques like Fuzzy, ANFIS, etc. Different case studies are carried out with traditional PI controllers and the proposed intelligent PI controllers, and the results are compared to show the effectiveness of adopting intelligent techniques for tuning PI controller parameters.

Analysis of distributed generation-fuel cell
In a fuel cell, chemical energy from a hydrogen and oxygen electro-chemical reaction is converted directly into electrical energy. The by-products are water and a small amount of carbon dioxide (only when CO and CH 4 are used other than pure hydrogen). The fuel cell is considered as a promising technology to meet energy demands, and is well suited for distributed generation because of its modularity, scalability, high efficiency and no harmful emission. The most commonly used fuel cell is a PEM fuel cell, because it can operate at a low temperature of 20-100 °C. Figure 1 shows the schematic diagram of a PEM fuel cell, and the equations representing the hydrogen and oxygen electro-chemical reaction are [15]: (1)  Figure 2 shows the model of a fuel-cell, which is a modified version of the proposed approach in [16]. The cell output voltage V is given by [17]: (6) V r = r ohm i fc and the output voltage of multiple cells in series is given by: where E oc is the generated voltage, V act is the activation losses (initial reaction kinetics losses), and V r is the diffusion and resistive losses (losses due to charge transport). T d is the settling time delay of the cell, i fc is the fuel cell current output, and i 0 is the exchange current. A is the Tafel slope, R = 8.3145 J/(molK), F = 96,485 As/mol, z is the number of moving electrons, α is the coefficient of charge transfer, T is the operating temperature and N is the number of cells in series. Figure 3 shows a typical DG connected to a distribution system. The system consists of a 3-phase VSI with dispatchable DG source (i DG ) and an LC output filter. These supply local load (i L ) and the available power surplus is transferred to the utility grid (i g ). The DG current transferred to the local load and to the grid must be sinusoidal, balanced, and THD at PCC must be less than 5%. However, satisfying these requirements is not easy because of nonlinear local loads and distortions in the grid voltage. Figure 4 shows the Thevenin equivalent of the DG system connected to the grid. To assess the impact of grid voltage distortion and local nonlinear load on the performance of DG, the DG-VSI configuration is modeled as V i , while R f and L f are the equivalent resistance and inductance, respectively. To simplify the evaluation of the effect of grid voltage distortion, the local nonlinear load is not considered here. From Fig. 4a, there is: v ih , current harmonics h =1 i gh are induced into the grid current. If DG cannot compensate for inverter voltage harmonics h =1 v ih and grid voltage harmonics h =1 v gh , it will result in non-sinusoidal grid current i g . Thus, the current controller needs to handle inverter voltage harmonics h =1 v ih and grid voltage harmonics h =1 v gh .

Evaluating effect of nonlinear load
To evaluate the effect of local load, the DG grid with a local load is shown in Fig. 4d, where i l is represented as the consumed local load current, i DG as the generated current and i g as the grid current. From Fig. 4d it is seen that: Considering nonlinear load, the load current contains the fundamental component i L1 and harmonic components i Lh , as: Substituting (13) in (12) yields: From (14), it can be seen that to supply sinusoidal grid current i g , DG current i DG must compensate h =1 i Lh for the load current harmonics. Traditional current controllers such as PI or PR are ineffective, because of lack of capability for selective harmonic component regulation. Therefore, to generate the specific harmonic components, design of a low-cost and effective current controller is necessary.

Effect of frequency variation
Since the frequency in the grid varies continuously, any change in frequency reference will significantly affect the controller performance and output current could be out of phase. System impedance is decreased because of the decrease in system frequency, and this results in increased current distortion.

Proposed control scheme
The proposed advanced current control strategy simultaneously addresses the effects of local nonlinear load, grid voltage distortion and frequency variation. The DG current control strategy is developed in the dq reference frame as shown in Fig. 5. The three main parts of the control scheme proposed include a DG current controller, current reference generation and a phaselocked loop (PLL). As shown in Fig. 5, the control strategy operates without grid voltage harmonic analysis and local load current measurement, and thus it does not require additional hardware.

Current reference generation
As shown in Fig. 4, the current references for the current controller are generated as [11]: where i * gd and i * gq are the d-and q-axis components of the reference grid current, respectively. v gd represents the instantaneous d-axis grid voltage component. P * and Q * are the reference active and reactive power, respectively. Under ideal conditions the grid voltage is purely sinusoidal so v gd has a constant value. However, the magnitude of v gd varies if the grid voltage is distorted. This can result in variation of reference current i * gd and i * gq . To overcome (15) i this problem, the average value of v gd is estimated by a low-pass filter, and (15) is modified as: where v gd0 is the average value of v gd obtained through the LPF.

PI-RC current controller
The proposed DG current controller strategy developed in the dq reference frame includes PI and RC controllers. The simplified control strategy can be achieved as large (16)  numbers of harmonic components can be compensated by one single RC with a simple delay function. With the PI and RC controller combination, the current controller dynamic response is greatly enhanced over that of the traditional RC. Therefore, with reduced numbers of sensors, the control method proposed can be adopted easily without extra hardware installation into the existing DG control system. In the discrete time domain, PI and RC controller open-loop transfer functions are given respectively as: where K p is the proportional gain and K i is the integral gain of the PI controller. Q(z) is a filter transfer function, z k is the phase lead term, K r is the RC gain, while z −N/6 is the time delay unit. N/6 is the number of sample delay given in (18) of the RC, and N = f sample /f s , where f sample and f s are the sample frequency and fundamental system frequency, respectively. However, traditional RC has severe drawbacks as it suffers from a long delay of N samples resulting in a very slow dynamic response. The delay problem of traditional RC can be removed by considering only (6n ± 1)th harmonics because they are the dominant components in three-phase systems, where (n = 1, 2, 3, …). Thus, compared to the traditional RC, time delay is reduced by a factor of six to N/6. Figure 6 shows the schematic diagram of the fuzzy controller for DG current control. FLC makes decisions using data sets of different types for reasoning. FLC is chosen over conventional PID and PI controllers as system parameter variation is very insensitive in FLC while FLC execution is very smooth and simple.

Fuzzy current controller
In the case of the Mamdani fuzzy model, an essential requirement is expert knowledge. It is more human-like with intuitive skill, although it causes significant computational burden and requires an interface procedure. The Sugeno technique has successful computation with versatile design, appealing to various control issues of nonlinear dynamic systems. The FLC scheme is divided into 3 main blocks, i.e., functional decision-making, fuzzification and defuzzification.
The fuzzification purpose is to control change in the error ΔE, convert the input-output signal crisply and error E into fuzzified signals recognized by fuzzy sets with different levels of membership functions. The linguistic variables of error rate are shown in Fig. 6a, linguistic variables of error are in Fig. 6b, and linguistic variables of output in Fig. 6c, with a triangular membership function as positive small (PS), positive big (PB), positive medium (PM), negative small (NS), negative big (NB), negative medium (NM) and zero (ZE). The membership functions of the decision-making output are either linear or constant in the Sugeno strategy.
Defuzzification represents the output of linguistic labels which are used to control the output to what it needs to be. A crisp solution is changed from fuzzification. The most widely recognized strategy is Sugeno's weaver.
In the decision-making process, there is a rule-based link between input (error and rate of change in error of current) and output signals. Table 1 shows the rule base used in the FL controller.
In the proposed method, the network voltage of each phase is tracked by the PLL and a reference signal with magnitude unity locked to grid frequency is generated for each phase. The proposed FLC has two inputs measured in real time at each sampling time, i.e., the error rate and error. The error and error rate for phase A is defined as: The fuzzified signal input is represented by membership functions in notations of a fuzzy set. The linguistic variables produced by rules defined by 'if … then …' and control signals are obtained by defuzzification to generate gating pulses by the SVPWM. The process of defuzzification solution results in the form: where the crisp value of the output is denoted by U, µ(y i ) is the membership associated grade, and y i represents the controller normalized output for the ith interval. Figure 7 shows the ANFIS optimized PI current controller for DG current control. From the PI current controller initial data, the ANFIS optimized PI current controller architecture is generated using the ANFIS editor. This architecture has 1:3:3:3:3:1 structure, so contains one input and one output, and by an error propagation algorithm it is further tuned online. The square node is an adaptive node and its parameters are changed during training, while the parameters presented in the circle nodes are fixed. Node functions of each layer in the ANFIS structure are described as follows.  where j = 1,2,3. • Layer-4: Parameters in this layer are called consequent parameters represented by a square. They give the output of each node. Corresponding node equations are:

ANFIS optimized PI current controller
where w j is the layer-3 output, O 4 j is the jth node layer-4 output, and p j and t j are determined during training. They are sets of consequent parameters. • Layer-5: Parameters in this layer are labeled ∑ represented by a circle. They are used for summation. This layer sums up all incoming signals to calculates the output y. Corresponding node equations are: Similarly, node functions of each layer of the ANFIS structure are also obtained for the q-component.

Simulation results
There are some assumptions made for fuel cell operation, i.e., properties of fed hydrogen and oxygen into the PEMFC stack are ideal, PEMFC anode and cathode temperature is stable and equal to the temperature of the stack, PEMFC pressure drop is negligible and cell resistance is constant.
In Fig. 8, the voltage and current characteristics of the fuel cell output are shown. A nominal rated current of 133.3A and voltage of 45 V are generated from the combination of 65 PEMFC stack models resulting in a power output of 133.3*45 ≈ 6 kW. The output voltage of the PEMFC is given to the DC-DC boost converter to match the required voltage of the DC bus.
The harmonics contained in the distorted grid voltage in the simulation are: 5th = 3%, 7th = 3%, 11th = 1%, 13th = 1%, resulting in a THD of 4.82%. Thus the distorted grid voltage THD complies with the IEEE519 limits. The optimized gains of different controllers are calculated as explained in previous sections and are tabulated in Table 2.
To analyze the effectiveness of the proposed ANFIS-PI optimized DG current controller, it is compared with PI, PIRC and Fuzzy DG current controllers for compensating w j ve 1 r j + w j t j power quality issues in various case studies, and the results are listed in Table 3. The case studies considered are: • Case 1: Grid supplying sinusoidal voltage to linear load. • Case 2: Grid supplying sinusoidal voltage to nonlinear load. • Case 3: Grid supplying distorted voltage to nonlinear load. • Case 4: Grid supplying distorted voltage with frequency variation of 50 Hz to 49 Hz to nonlinear load.
Case 1: As shown in Fig. 9, where the grid voltage V g is sinusoidal, DG supplies i l to linear local load and also transfers surplus power to grid. Under such operating conditions, the THD of the grid current i g at PCC is 1.57% which is well within the IEEE519 limits.
Case 2: As shown in Figs. 10, 11, 12 and 13, where grid voltage V g is sinusoidal, DG supplies nonlinear local load current i l and also transfers surplus power to the grid. Under such operating conditions, 54.74% of THD is introduced in the grid current because of the nonlinear load. DG with the PI current controller compensates harmonics by reducing THD of the grid current i g at PCC to 11.9% but it fails to meet the limits of IEEE519 as shown in Fig. 10 and Table 3.
However, DG current controllers of PI-RC, Fuzzy and ANFIS-PI optimized controller as seen in Figs. 11, 12 and 13, are able to compensate harmonics by reducing the THD of the grid current i g at PCC to 1.76%, 1.35% and 1.35%, respectively, which are all well within the IEEE519 limits.
Case 3: As shown in Figs. 14, 15, 16 and 17, where the grid voltage V g is non-sinusoidal, i.e., distorted grid voltage with a THD of 4.82%, DG supplies i l to nonlinear local load and also transfers surplus power to grid. Under   such operating conditions, 54.74% of THD is introduced by the nonlinear load with an additional 4.82% of THD from the distorted grid voltage. DG with the PI current controller compensates harmonics by reducing the THD of the grid current i g at PCC to 18.6% but it fails to meet the IEEE519 limits, as shown in Fig. 14 and Table 3. However, PI-RC, Fuzzy and ANFIS-PI optimized controller as seen in Figs. 15, 16 and 17 are able to compensate harmonics by reducing the THD of the grid current i g at PCC to 1.85%, 1.35% and 1.35%, respectively, which are well within the IEEE519 limits.
Case 4: As shown in Figs. 18, 19, 20 and 21, the effect of grid frequency variation from 50 to 49 Hz is introduced along with the non-sinusoidal grid voltage V g with a THD of 24.91%. DG supplies nonlinear local load current i L and also transfers surplus power to the grid. Under such operating conditions, 61.35% of the THD is introduced by the nonlinear load with 24.91% introduced by      However, the proposed ANFIS-PI optimized DG controller shown in Fig. 21 is able to compensate harmonics by reducing the THD of the grid current i g at PCC to 4.5% which is now within the IEEE519 limits. For all four     case studies, the results obtained from each type of controller tabulated in Table 3 are also represented using a bar graph in Fig. 22.

Conclusion
An advanced DG current control strategy is developed to supply power to local load and transfer surplus power to the grid along with the additional benefit of improving the grid power quality. This paper demonstrates the importance of considering the effect of grid frequency variation while designing and deploying the controller for power quality restoration, and the need for adaptive intelligent controllers to compensate power quality issue. The proposed intelligent current controller eliminates the effect of grid frequency variation, voltage distortion and nonlinear loads simultaneously. The results show that the ANFIS-PI optimized DG current controller has better harmonic compensating capability by limiting harmonics well within the limits defined in the IEEE519 standards, whereas other controllers fail to compensate sufficiently the THD to meet the limits. Thus, this work conveys the effectiveness of adapting intelligent techniques for tuning PI (conventional) controllers to tackle multiple power quality problems simultaneously. The proposed method is economical as it does not require any additional hardware installation for measuring local load current for feedback control. Thus, it can be easily coupled with existing control schemes.