1. Introduction
Currently, the main priority of modern power system infrastructure is to reduce the use of fossil fuels and energy resources due to related issues. Saving electrical energy is also a crucial factor [
1]. Therefore, generating electricity using renewable energy sources is preferred as it is beneficial for the environment. To meet the everincreasing global energy needs, there is a need for more significant adoption of alternative green energy based on renewable resources. Currently, wind and solar energies are the dominant sources of renewable electricity production worldwide [
2].
After the 1960s, the power grid underwent a significant transformation known as the second generation. This expansion involved the implementation of larger units capable of handling ultrahighvoltage transmission and the interconnection of largescale power grids. Unfortunately, the emergence of nonlinear, unbalanced, and impact loads has had adverse effects on the grid [
3]. As we move forward, one of the biggest challenges we face is ensuring energy sustainability in light of the rapidly increasing demand for energy and the global decline of fossil fuel reserves expected within the next few decades.
Power quality is a crucial aspect in the context of renewable energy resources and their frequent connection to distribution systems [
4]. When energyconsuming loads, especially nonlinear loads, are connected to the electrical network, they can cause voltage and current distortion, which can affect other devices connected to the same network. To address this issue, both classical and modern filtering systems are employed to eliminate harmonics. Researchers are continuously working on innovative solutions to tackle this problem.
The Integration of wind energy into an existing power system poses technical challenges, which require careful consideration of voltage regulation, stability, and power quality problems [
5].
Among the advanced techniques of current filtering, we find the active filter. The SAPF, also called pure active filter, responds to global specifications and constitutes the optimal solution for filtering harmonics because it is viable and economical for industrial companies with low to medium kVA loads where the system engineering effort represents a large part of the overall cost [
6,
7]. This system can dampen the propagation of harmonics in a distribution feeder or between two distribution feeders; it can also compensate the reactive power in the electrical grid [
8].
In this article, we introduce a novel control strategy that utilizes fuzzy FOPI adapted by GA. This intelligent control system combines two other smart controls, namely fractional fuzzy PI (fuzzy FOPI) and GA, with the goal of regulating the inverse harmonic currents produced by a DC storage system.
Why use this combination? The fractionalorder PI controller (PI
$\lambda $) includes an integrator of order
$\lambda \in {\Re}^{+}$. Studies have shown that this type of controller performs well compared to the conventional PI [
9]. Furthermore, the addition of fuzzy logic to optimize the FOPI has been proven to improve results for various types of systems. This is because it provides additional flexibility to the design, as demonstrated in numerous studies [
10,
11,
12].
Genetic algorithms (GA) are a specific type of evolutionary algorithm. They are based on principles from evolutionary biology, including inheritance, mutation, natural selection, and crossover. These principles were first established by Darwin’s theory of evolution [
13].
The main role of GA is to adjust the normalization gains in the fuzzy FOPI controller input (error and error variation), optimize the speech universe and thus the membership functions for (Kp, Ki and
$\lambda $) [
11]. All the processes of this calculation are based on evolutionary algorithms whether in GA or fuzzy FOPI, so this work is very modern and considered as a scientific research contribution. The results obtained are compared with the results of the classical PI regulator.
2. System composition and modeling
In
Figure 1; the overall system contains an electrical network which is supplied by a nonlinear load, this mechanism is connected in parallel by a wind chain which has the objective of supplying the active filtering system.
In this example, we take advantage of the existence of a twolevel inverter not only to ripple the currents and voltages but also to provide the reverse harmonic currents to eliminate the distortion of the electrical currents caused by the nonlinear load.
2.1. Real and Imaginary Instantaneous Powers Theory
The Real and Imaginary Instantaneous Powers theory determines the harmonic distortion from the calculation of the instantaneous power in a threephase system, with the aim of applying it to the control of active power filters. It first applies an algebraic transformation (Clarke’s transformation) of the voltages and load of the threephase system currently in the coordinate’s
a
b
c to the coordinates
$\alpha $
$\beta $ by and then we can from them calculate the
p and
q by the relations [
14,
15]:
where
p is the instantaneous real power.
q is the instantaneous imaginary power. By observing the formulations of
p and
q, it is possible to put them in the following form in Equation
2:
Finally, it is possible to calculate the reference currents, in the
$\alpha $–
$\beta $ coordinates by applying equations
4. The reference currents are then translated into the
a
b
c coordinates through the following inverse Clarke transform:
To compensate for current harmonics generated by nonlinear loads, the reference signal of the shunt APF must include the values of
$\tilde{p}$ and
$\tilde{q}$. The diagram in
Figure 2 illustrates the different steps for obtaining the harmonic components of the current of a nonlinear load.
3. Meta heuristics controllers
3.1. Fuzzy PI fractional controller and structure
The fuzzy PI Fractional is combines fuzzy logic with fractional order PI (FOPI) control to improve the system’s performance. The fractional order calculus provide more flexibility in designing the controller to meet specific system requirements. The transfer function for the FOPI controller can be expressed as shown in Equation
6 [
16]:
The Fuzzy FOPI controller is characterized by five unknown parameters, namely $Kp$,$Ki$, $\lambda $, A, and B.
$Kp$ and
$Ki$ represents successively the proportional and the integral gain,
$\lambda $ represents the fractionalorder integral.
A and
B are the error gain and error rate gain, respectively. The structure of a Fuzzy FOPI controller is depicted in
Figure 3.
The fuzzy FOPI structure utilized in this study takes in two inputs: the error and its derivative (e, $\Delta e$ ). It generates three outputs, namely $Kp$,$Ki$, and $\lambda $. Fuzzy logic is an AIbased command that we have implemented in this research through a fuzzy FOPI algorithm. We can obtain output values from this algorithm and easily modify universes of speech and fuzzy rules in the algorithm script. Adding the fractional order $\lambda $ enhances the effectiveness of fuzzy FOPI command. However, selecting universes of discourse for the inputs (e, $\Delta e$) and outputs ($Kp$,$Ki$, and $\lambda $) is the most challenging aspect of this process.
To address this issue, we proposed an evolutionary control solution utilizing genetic algorithms. This approach contributes to optimization and represents a valuable research contribution.
3.2. Optimization algorithm using GA
To optimize both the FOPI and fuzzyFOPI controllers, we use an intelligent metaheuristic technique called the Genetic Algorithm. This technique is based on biological concepts of natural selection and reproduction, and is used in computing to find solutions to search problems. The Genetic Algorithm was invented by John Holland in 1960, and was further developed by his colleagues and students at the University of Michigan [
17].
Outline of the basic Genetic Algorithm is given as follows:
Algorithm: Genetic algorithm (GA) 

 (1)
Start: Generate random population of N chromosomes (suitable solutions for the problem).
 (2)
Fitness: Evaluate the fitness (or cost function) f(x) of each chromosome x in the population.
 (3)

New population: Create a new population by repeating the following steps until the new population is complete.
Selection: Select two parent chromosomes from a population according to their fitness (the better fitness, the bigger chance to be selected).
Crossover: With a crossover probability cross over the parents to form new offspring (children). If no crossover was performed, offspring is the exact copy of parents.
Mutation: With a mutation probability, mutate new offspring at each locus (position in chromosome).
Accepting: Place new offspring in the new population.
 (4)
Replace: Use new generated population for a further run of the algorithm.
 (5)
Test: If the end condition is satisfied, stop, and return the best solution in current population.
 (6)
Loop: go to step 2.


3.3. GAFuzzy FOPI
The combination between the two fuzzy commands FOPI and the GA is described in
Figure 4. The global objective of GA is to adjust the normalization gains A and B and consequently to optimize the output’s parameters of the fuzzy FOPI. The GA is we help also to determine the universes of discourse for that the objective function is minimal.
4. Optimization problem
The Integral Time Absolute Errors (
$ITAE$) fitness function as shown in Equation
7 is used to evaluate the performance of the system’s output response. The
$ITAE$ index presents very good performance compared to other performance indices
$IAE$,
$ISE$, and
$ITSE$ [
18,
19].
where
${t}_{sim}$ is total simulation time and the typical ranges of the optimized parameters are given by:
${A}_{min}\le A\le {A}_{max}$
${B}_{min}\le B\le {B}_{max}$
$K{p}_{min}\le Kp\le K{p}_{max}$
$K{i}_{min}\le Ki\le K{i}_{max}$
The harmonic currents transfer functions are presented in the following equations:
The setting of the PI controller parameters $Kp$,$Ki$, and $\lambda $ is based on finding the point of optimization by the GA over an interval [0 0 0] to [300 300 1]. The sampling period ${t}_{sim}$ is 0.001s.
5. Result calculus, simulation and discussion
In this section, we will go over the calculation details and simulation results for the GAFOPI and GAfuzzy FOPI system and tune parameters controller. The simulation was conducted using MATLAB Simulink, while the software for the genetic algorithm and fuzzy FOPI was written in MATLAB.
The optimization process involves two steps. Firstly, we initiate the GA to explore the optimization points of the FOPI controller for the parameters (
$Kp$,
$Ki$, and
$\lambda $). After 50 calculation iterations, we will obtain the following results:
Table 1 shows the results parameters of regulators GAFOPI.
We will use the error values and their variations, which were calculated by the GA, in a fuzzy FOPI algorithm. Upon completion of the calculation process, we will receive the results of the fuzzy rule along with the values of the parameters ($Kp$,$Ki$, and $\lambda $) for the fuzzy regulator FOPI.
Table 2.
This is a table caption. Tables should be placed in the main text near to the first time they are cited.
Table 2.
This is a table caption. Tables should be placed in the main text near to the first time they are cited.
Fuzzy rules 
 (1)
If (error is negative) or (error variation is negative) then (Kp is PS)(Ki is PM)(lamda is PB) (1).
 (2)
If (error is negative) or (error variation is zeros) then (Kp is PS)(Ki is PM)(lamda is PB) (1).
 (3)
If (error is negative) or (error variation is positive) then (Kp is PS)(Ki is PL)(lamda is PB) (1).
 (4)
If (error is zeros) or (error variation is negative) then (Kp is PMS)(Ki is PL)(lamda is PB) (1).
 (5)
If (error is zeros) or (error variation is zeros) then (Kp is PM)(Ki is PL)(lamda is PB) (1).
 (6)
If (error is zeros) or (error variation is positive) then (Kp is PM)(Ki is PL)(lamda is PB) (1).
 (7)
If (error is pozitive) or (error variation is negative) then (Kp is PM)(Ki is PB)(lamda is PB) (1).
 (8)
If (error is pozitive) or (error variation is zeros) then (Kp is PM)(Ki is PB)(lamda is PB) (1).
 (9)
If (error is pozitive) or (error variation is positive) then (Kp is Pl)(Ki is PB)(lamda is PB) (1).

The following
Table 3 presents these results.
These figures show the membership functions for the inputs and outputs of the GAfuzzy FOPI regulator, which were obtained by using fuzzy FOPI algorithms. The membership is represented using trapezoidal and triangular fuzzy types.
Figure 5.
(a),(b) Inputs MFs of FLC.
Figure 5.
(a),(b) Inputs MFs of FLC.
Figure 6.
(c),(d),(e) outputs MFs for FLC.
Figure 6.
(c),(d),(e) outputs MFs for FLC.
This section focuses on simulating various controllers, including GAfuzzy FOPI, GAFOPI, and traditional PI controller, to evaluate their effectiveness. MATLAB Simulink is used to implement the redundant dynamic model, controller, and desired trajectory. These controllers are utilized to regulate the reverse harmonic currents injected into the electrical network, addressing the issue of current distortion.
Figure 7 displays the waveform of the currents before the insertion of the active filter.
The
Figure 8,
Figure 9 and
Figure 10 represent respectively the regulation of inverse harmonic currents using: classical PI, GAFOPI, GAfuzzy FOPI regulators.
Based on the previous figures, it is evident that the two controllers GAFOPI and GAfuzzy FOPI are very efficient compared to the classic PI; in view of which is the best; the occurrence of this superiority is illustrated in the figures of the harmonic analysis; the THD in
Figure 11 when we used GAFOPI is: 2.13 and in
Figure 12 is: 2.11 when we used GAfuzzy FOPI.
We conclude that the active filter acts very well on the quality of energy in the electrical network (show
Figure 13) and especially that we use the GAfuzzy FOPI.
6. Conclusions
In this article, a fuzzy FOPI controller has been developed and optimized by GA to regulate inverse harmonic currents that are injected into the electrical network via an active filtering system. The main objective of this regulation is to eliminate current distortion in the electrical network. In order to achieve good regulation, it is important to use a highly efficient control system. Therefore, the combination of fuzzy FOPI and GA controllers has been found to be more effective than classic PI and even GAoptimized FOPI controllers. The efficiency of the GAfuzzy FOPI controller has been demonstrated through the optimization of normalization gains, speech universe, and output parameters of the fuzzy FOPI regulator. This optimization was achieved by adjusting the fuzzy rules and MFs. The study concludes that the GAfuzzy FOPI controller is more robust and efficient than conventional controllers when it comes to trajectory tracking problems.
Acknowledgments
This research was conducted at the Laboratory of Exegetical and Computer Engineering (L2GEGI) at the University of Tiaret  Algeria.
Conflicts of Interest
The authors declare no conflict of interest.
Abbreviations
The following abbreviations are used in this manuscript:
SAPF 
Shunt Active Power Filter 
MFs 
Membership Functions 
References
 Bajaj, Mohit 1, Aggarwal, Surbhi 2, Singh, Amit Kumar 3, Power quality concerns with integration of RESs into the smart power grid and associated mitigation techniques. 9th power India international conference (PIICON) 2020, IEEE, 1–6.
 Merabet Boulouiha, Houari 1, Khodja, Mohamed 2, Rahiel, Djelloul 3, Allali, Ahmed 4, Kaddour, Fouad 5, Denai Mouloud 6, Power quality enhancement in electricity grids with wind energy using multicell converters and energy storage. Journal of Renewable and Sustainable Energy 2019, 1, Vol–11.
 Zhang, Jingyue 1, Research on power quality problems based on smart grid and new energy generation. book:AIP Conference Proceedings.
 Rao, Sivakavi Naga Venkata Bramareswara 1, Kumar, Yellapragada Venkata Pavan 2, Pradeep, Darsy John 3, Reddy, Challa Pradeep 4, Flah, Aymen, Kraiem, Habib 5, AlAsad, Jawad F 6,Power quality improvement in renewableenergybased microgrid clusters using fuzzy space vector PWM controlled inverter, Journal of SustainabilityMDPI 2022, 8, 4663, Vol 14. 4663.
 Mundackal, JohnsonAbraham 1, Varghese, Alan C 2, Sreekala, P, Reshmi, V 3, Grid power quality improvement and battery energy storage in wind energy systems, 2013 Annual International Conference on Emerging Research Areas and 2013 International Conference on Microelectronics, Communications and Renewable Energy 2013, 10, 1–6, IEEE. 10.
 Chaoui, Abdelmadjid 1, Gaubert, JeanPaul 2, Krim, Fateh 3, Rambault, Laurent 4, On the design of shunt active filter for improving power quality, IEEE International Symposium on Industrial Electronics 2008, 31–37, IEEE. 31–37.
 Ravinder, Kumar 1, Bansal, Hari Om 2, Investigations on shunt active power filter in a PVwindFC based hybrid renewable energy system to improve power quality using hardwareintheloop testing platform, Electric Power Systems Research 2019, 105957, vol177, Elsevier journal. Elsevier journal.
 Tey, LH 1, So, PL 2, Chu, YC 3, Improvement of power quality using adaptive shunt active filter, IEEE transactions on power delivery 2005, 1558–1568, 2, IEEE. 2.
 Jesus, Isabel S 1, Barbosa, Ramiro S 2, Genetic optimization of fuzzy fractional PD+ I controllers, Isa Transactions, 2015, 220–230, 2, vol57, Elsevier journal. vol57.
 Swethamarai, P 1, Lakshmi, P 2, Gokul Prassad, S 3, Whaleoptimized fuzzyfractional order controllerbased automobile suspension model, Isa Transactions, 2022, 1110–1130, 7, vol54, Engineering Optimization. Engineering Optimization.
 2022; 1. [CrossRef]
 Ali, Moetasem 1, Kotb, Hossam 2, AboRas, M Kareem 3, Abbasy, H Nabil 4, Frequency regulation of hybrid multiarea power system using wild horse optimizer based new combined Fuzzy FractionalOrder PI and TID controllers, Alexandria Engineering Journal, 2022, 12187–12210, 12,vol61, Elsevier. 12.
 Sarir, Noureddine 1, Morsli, Sebaa 2 Allaoui, Tayeb 3, Denai, Mouloud 3, Optimal fractionalorder pi control design for a variable speed PMSGbased wind turbine, Journal Europèen des Systèmes Automatisés, 2021.
 Buyuk, Mehmet 1, Inci, Mustafa 2, Tan, Adnan 3, Tumay, Mehmet 4, Improved instantaneous power theory based current harmonic extraction for unbalanced electrical grid conditions, Electric Power Systems Research, 2021, 106014,vol177, Elsevier. vol177.
 Eskandarian, Nasser 1, Beromi, Yousef Alinejad 2, Farhangi, Shahrokh 3, Improvement of dynamic behavior of shunt active power filter using fuzzy instantaneous power theory, Journal of power Electronics, 2014, 1303–1313,6, vol14. 6.
 Mohamed Naji Muftah 1, Ahmad Athif Mohd Faudzi 2, Shafishuhaza Sahlan 3, Shahrol Mohamaddan 4, Fuzzy Fractional Order PID Tuned via PSO for a Pneumatic Actuator with Ball Beam (PABB) System; Fractal Fract journal, fractalfract journal, 2023, 7(6),416, doi.org/10.3390/fractalfract7060416.
 2017; 1. [CrossRef]
 Nie, Yonghui 1, Zhang, Yidan 2, Zhao, Yan 3, Fang, Binbin 4, Zhang, Lili 5, Widearea optimal damping control for power systems based on the ITAE criterion, International Journal of Electrical Power and Energy Systems, 2019, 192–200, vol106, Elsevier. vol106.
 Rao, C Sankar 1, Santosh, Simi 2, others 3, Tuning optimal PID controllers for open loop unstable first order plus time delay systems by minimizing ITAE criterion, IFACPapersOnLine, 2020, 123–128, vol53, 1, Elsevier. vol53.

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. 
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).