Performance Enhancement of Grid-Connected Renewable Energy Systems Using UPFC

: No one denies the importance of renewable energy sources in modern power systems in terms of sustainability and environmental conservation. However, due to their reliance on environmental change, they are unreliable systems. This paper uses a Uniﬁed Power Flow Controller (UPFC) to enhance the reliability and performance of grid-tied renewable energy systems. This system consists of two renewable sources, namely photovoltaic cells (PV) and wind turbines (WTs). The UPFC was selected for its unique advantage in both active and reactive power control. The UPFC is controlled with an optimized Fractional Order Proportional–Integral–Derivative (FOPID) controller. The parameters of this controller were tuned using an Atomic Search Optimization (ASO) algorithm. Simulation results conﬁrm the efﬁciency of the suggested controller in supporting the reliability and performance of the hybrid power system during some disturbance events including voltage sag, swell, and unbalanced loading. In addition, power quality can be improved through reducing the total harmonic distortion. It is worth mentioning that two maximum point tracking techniques had been included for the PV and WT systems separately. MATLAB/SIMULINK 2021a software was used to model the system.


Introduction
The trend was to use nuclear energy as a substitute for fossil fuels.This is due to the hazards and negative environmental effects of using conventional energy sources, as well as the increase in energy consumption brought on by technological growth [1,2].However, there are disposal issues for nuclear energy.Generating energy from renewable energy sources has become an effective and applicable solution for pursuing power generation [3].The greatest focus was directed to using the power generated from the sun and wind due to their availability [4].In recent research, researchers tend to use hybrid renewable systems that consist of solar and wind energies in the grid.This connection is aimed at meeting the load demands to support reliability [5].Connecting renewable energy sources to the grid negatively affects the system balance, dependability, and quality.This is due to the harmonics injected into the system using some power electronic switches, unpredictable generated power from both the PV and wind systems, and their dependence on climate conditions [6,7].Due to all of these consequences, transmission and distribution networks Energies 2023, 16, 4362 2 of 22 have developed, and some flexible alternating current transmission systems (FACTS) are currently incorporated into hybrid power systems [8,9].The principle of operation of FACTS devices is to allow the exchange of power between them and the network [10].This exchange supports the hybrid system operation during disturbances and climate changes [11].Many FACTS devices can be connected in a series, shunted, or combined to the network.Series FACTS devices can aid in the system functioning through changing the active power, balancing the voltage, and working to control the transmission line reactance.From these series, devices include thyristor controller series capacitors (TCSCs), static synchronous series compensators (SSSCs), and dynamic voltage restorers (DVRs) [11][12][13][14].Shunt FACTS devices can inject/absorb reactive power to the system to support the system voltage.There are many shunt FACTS devices, such as Static VAr compensators (SVCs) and static synchronous compensators (STATCOMs).The devices that combine the series and shunt compensators can incorporate the benefits of these two types of compensators.From them, the most used combined series-shunt FACTS device is the unified power flow controller (UPFC).
The main contribution of this paper is using the Fractional Order Proportional-Integral-Derivative (FOPID) controller of the UPFC to enhance the effectiveness of an on-grid renewable hybrid system.The proposed controller regulates the power flow between the UPFC and the system to alleviate the disturbances applied to the system and consequently improve the system's performance.An Atomic Search Optimization (ASO) algorithm is used to tune the parameters of the controller and to examine the expected methodology.An ASO-based FOPID controller is analyzed in the HRES interconnected system under unbalanced load, sagging, and swelling conditions.

Literature Review
Numerous studies have been conducted to examine various methods for controlling hybrid renewable energy systems.These studies presented FACTS devices along with different control methodologies to mitigate the harmonics and other disturbances.
Adetokun, B.B et al., (2021) [15] reviewed the uses of FACTS devices, especially STATCOM and SVC, and compared their performance on the stability of renewable systems such as PV and WT.They discovered that STATCOM is expensive, but it supports voltage more effectively than SVC.Jamil, E. [16] compared the performance of the PV/WT hybrid system in three cases: standalone mode, grid-connected mode, and grid-connected with STATCOM.The results showed that the best performance of the system is in the case of the STATCOM connection, as it regulates the voltage and the results of the total harmonic distortion (THD) in voltages and currents.However, they did not deeply investigate the controller used for STATCOM.A STATCOM to improve the performance of a hybrid wind/PV system during severe failures due to some environmental changes using an optimized PI controller was studied in [17].This optimized controller for STATCOM is used to control the flow of reactive power between the STATCOM and the hybrid system.The PI controller parameters were optimized using a Whale Optimization Algorithm (WOA).Another application of STATCOM was presented to mitigate the ferroresonance in wind energy systems [18].In this study, PI controllers were provided for driving the STATCOM.The controller parameters were tuned using a modified flower pollination algorithm.However, despite the improvement achieved in these studies during the incorporation of renewable systems to the grid using STATCOM, harmonic distortions were not taken into account.
Unconventional methods to improve the fault-tolerance capability of DFIG-WT include regulating the DC link voltage using two types of shunt FACTS devices.These devices are connected in shunt to the DC link of the DFIG.The first one is a superconducting coil with a FOPI controller whose parameters are tuned through a gray wolf optimizer (GWO) [16].The second one is a super-magnetic energy storage unit with a fuzzy controller [19,20].Despite the fact that the performance of the DFIG-WT system was enhanced when these two Energies 2023, 16, 4362 3 of 22 devices were used, the price of the coil and the super-magnetic storage unit dramatically increased the cost.
Through reducing harmonics and supporting the voltage under various disturbances, these shunt FACTS devices enhanced the performance of hybrid systems.However, unlike series devices, these devices are unable to alter the line reactance or support the transmission line capacity.
The series FACTS devices were used in hybrid power systems.For example, DVR for hybrid power systems was discussed in [21] to alleviate the misfire and fire-through faults within the power electronic switches.This study used PI controllers that were optimized using the benchmark optimization technique, particle swarm optimization.SSSC was investigated in [22] to improve the power system stability.Three types of FACTS devices, namely SSSC, TCSC, and STATCOM, were applied to a Hybrid Renewable Energy System (HRES) consisting of a 200 MW wind-turbine-based DFIG and a 120 MW PV power plant using PI controllers [21].The system performance was compared when applying these three devices.The comparison indicated that the performance of SSSC with the PI controller is more reliable and effective.
These discussions have shown that the shunt and series types of FACTS each have unique properties and capabilities.Combining them is a good option to get the benefits of both of them together.
Goud, B.S. et al., (2020) [23] used a unified power quality conditioner which is a combination of series and shunt FACTS devices to solve the PQ problem in Hybrid Renewable Energy Systems (HRESs).They implement a Fractional Order Proportional Integral Derivative (FOPID) to improve system performance with GWO.The results showed a clear improvement in the system's performance in terms of efficiency and effectiveness.Naidu, R.P.K. et al., (2020) [24] presented another combination: a distributed power flow controller using a FOPID controller to improve performance and alleviate the quality problems in HRESs.Reddy, C. et al., (2021) [25] discussed the optimum power quality enhancement of an HRES consisting of a PV/wind/battery.The UPFC was used with a FOPID controller based on the ASO technique, which resulted in voltage regulation, loss reduction, and total harmonic distortion, thus raising the quality of the system.Bhargava, A. et al., (2019) [26] modeled and examined the UPFC in a HRES and found its efficacy in removing the harmonics resulting from connecting two different power sources with the network, as well as its ability to control the flow of real and reactive power.Goud, B.S. et al., (2021) [27] presented the PV/WT hybrid model and used the distributed power flow controller to reduce quality problems when connecting to the network while controlling it through the FOPID unit and comparing it with the PI while working to reach the parameters through experimenting with twelve ways.He found the BW was more effective than the others.With the FOPID controller, it is more accurate.Although UPFC implementation in HRESs resulted in performance gains, the effects of climate change and maximum power point tracking were not taken into account.Fan Lin et al., (2023) [28] concluded in "Recent advances in intra-hour solar forecasting: A review of ground-based sky image methods" that one critical factor that affects intra-hour solar power output is cloud movement in the sky.
The purpose of this work was to support the efficiency of a grid-linked HRES made up of PV/WT using UPFC.DFIG, which is the most common generator utilized in wind applications, was the generator employed in this study [29].The paper presents a design of a FOPI controller for the UPFC.These controller parameters were tuned using ASO.The designed controller for the UPFC succeeds at reducing the total harmonics, improving the power quality, and supporting the voltage during some abnormal events.In addition, two MPPT techniques for the PV and WT systems are discussed.

Proposed System
The proposed on-grid HRES system consists of a wind-turbine-based DFIG and a PV plant with the application of the MPPT technique, which is shown in Figure 1.The HRES was designed to compensate for the quality problem due to disturbances and voltage fluctuations.MPPT was applied to the PV/wind hybrid system, which connected to the electrical grid to obtain the maximum power of the system through the incremental conductance method.The DC-DC boost converter was used to connect to the DC bus, and the inverter was used to connect with the grid on the AC bus.The quality of the system decreased due to the use of electronic switches and transformers, and the error rate increased as a result of environmental factors, so it was decided to turn to one of the power compensation devices and quality problems.UPFC, which is based on compensating the active and reactive power through series and parallel compensators, is used in this study.The UPFC shall be controlled to determine its performance through adjusting the required compensation values.Therefore, to control its performance, the FOPID controller was chosen to obtain the optimal values for the FOPID factors; then, for maximum compensation, the ASO algorithm was used to assist the UPFC.

Proposed System
The proposed on-grid HRES system consists of a wind-turbine-based DFIG and a PV plant with the application of the MPPT technique, which is shown in Figure 1.The HRES was designed to compensate for the quality problem due to disturbances and voltage fluctuations.MPPT was applied to the PV/wind hybrid system, which connected to the electrical grid to obtain the maximum power of the system through the incremental conductance method.The DC-DC boost converter was used to connect to the DC bus, and the inverter was used to connect with the grid on the AC bus.The quality of the system decreased due to the use of electronic switches and transformers, and the error rate increased as a result of environmental factors, so it was decided to turn to one of the power compensation devices and quality problems.UPFC, which is based on compensating the active and reactive power through series and parallel compensators, is used in this study.The UPFC shall be controlled to determine its performance through adjusting the required compensation values.Therefore, to control its performance, the FOPID controller was chosen to obtain the optimal values for the FOPID factors; then, for maximum compensation, the ASO algorithm was used to assist the UPFC.

PV System
As shown in Figure 2, the PV plant consists of PV arrays to cover the required loads.With the connection to a DC-DC boost converter, the incremental conductance technique of MPPT is applied [30].Then, a DC/AC inverter is used for connecting the DC output of the converter to the electrical grid.

PV System
As shown in Figure 2, the PV plant consists of PV arrays to cover the required loads.With the connection to a DC-DC boost converter, the incremental conductance technique of MPPT is applied [30].Then, a DC/AC inverter is used for connecting the DC output of the converter to the electrical grid.

Wind System
This study will investigate the effect of UPFC on HRES.Changes in the climate, including fluctuations in wind speed, will be regarded as one of the system disturbances.The DFIG is the best generator for these variable speed uses [29].Despite the usage of alternative generators such as switching reluctance generators [31], self-excited asynchronous generators [32], and permanent magnet synchronous generators [33], as shown in Figure 3, DFIGs account for more than 50% of the generators used in wind energy systems [18,20].
Energies 2023, 16, 4362 5 of 22 DFIG has two converters, the rotor side converter (RSC) and the grid side converter (GSC), one for the rotor and the other for the stator, respectively.These two converters are linked by a DC-link as shown in Figure 3.

Wind System
This study will investigate the effect of UPFC on HRES.Changes in the climate, including fluctuations in wind speed, will be regarded as one of the system disturbances.The DFIG is the best generator for these variable speed uses [29].Despite the usage of alternative generators such as switching reluctance generators [31], self-excited asynchronous generators [32], and permanent magnet synchronous generators [33], as shown in Figure 3, DFIGs account for more than 50% of the generators used in wind energy systems [18,20].DFIG has two converters, the rotor side converter (RSC) and the grid side converter (GSC), one for the rotor and the other for the stator, respectively.These two converters are linked by a DC-link as shown in Figure 3.

Unified Power Flow Controller
FACT devices are used to achieve reliability and enhance equilibrium in the system and treat system quality problems [34].The UPFC was chosen from among the FACTS devices due to its broader impact on the quality and balance of the system, as it contains a shunt active power filter and a series active power filter.As shown in Figure 4, the UPFC was controlled through the FOPID controller with work to reach the optimum values through the controller with its regulation optimized using the ASO algorithm [35].

Wind System
This study will investigate the effect of UPFC on HRES.Changes in the climate, including fluctuations in wind speed, will be regarded as one of the system disturbances.The DFIG is the best generator for these variable speed uses [29].Despite the usage of alternative generators such as switching reluctance generators [31], self-excited asynchronous generators [32], and permanent magnet synchronous generators [33], as shown in Figure 3, DFIGs account for more than 50% of the generators used in wind energy systems [18,20].DFIG has two converters, the rotor side converter (RSC) and the grid side converter (GSC), one for the rotor and the other for the stator, respectively.These two converters are linked by a DC-link as shown in Figure 3.

Unified Power Flow Controller
FACT devices are used to achieve reliability and enhance equilibrium in the system and treat system quality problems [34].The UPFC was chosen from among the FACTS devices due to its broader impact on the quality and balance of the system, as it contains a shunt active power filter and a series active power filter.As shown in Figure 4, the UPFC was controlled through the FOPID controller with work to reach the optimum values through the controller with its regulation optimized using the ASO algorithm [35].

Unified Power Flow Controller
FACT devices are used to achieve reliability and enhance equilibrium in the system and treat system quality problems [34].The UPFC was chosen from among the FACTS devices due to its broader impact on the quality and balance of the system, as it contains a shunt active power filter and a series active power filter.As shown in Figure 4, the UPFC was controlled through the FOPID controller with work to reach the optimum values through the controller with its regulation optimized using the ASO algorithm [35].

MPPT
The Incremental Conductance method was applied to get the maximum benefit from the proposed system under constant changes in environmental conditions.This method is based on the comparison of the instantaneous slope of the voltage-to-power relationship curve produced by the system.As shown in Figure 5, where the power is expressed as P = VI, the derivative of the function is represented through the relationship..The slope of the slope is zero at the point where the maximum power of the system is achieved, and it is positive on the left and negative on the right, as shown in the relations [36].

MPPT
The Incremental Conductance method was applied to get the maximum benefit from the proposed system under constant changes in environmental conditions.This method is based on the comparison of the instantaneous slope of the voltage-to-power relationship curve produced by the system.As shown in Figure 5, where the power is expressed as P = VI, the derivative of the function is represented through the relationship..The slope of the slope is zero at the point where the maximum power of the system is achieved, and it is positive on the left and negative on the right, as shown in the relations [36].

The Stages of Adjusting the Performance of the UPFC
The controller manages the performance of the UPFC through reading the syste voltage in the event of an error and then producing pulses to operate the two UP converters, thus producing signals to reach the measured reference voltage and th limit system quality problems.The UPFC system contains two controllers, one for t series part and the other for the shunt part, as follows:

The Stages of Adjusting the Performance of the UPFC
The controller manages the performance of the UPFC through reading the system voltage in the event of an error and then producing pulses to operate the two UPFC converters, thus producing signals to reach the measured reference voltage and thus limit Energies 2023, 16, 4362 7 of 22 system quality problems.The UPFC system contains two controllers, one for the series part and the other for the shunt part, as follows:

Control of Series Power Filter
As it appears in Figure 6, The three-phase voltage is calculated using the phase-locked loop (PLL) and converted to d-q axes using the dq transformation (Clark transform) described in Equation (2) [37].
where V q refers to the quadrature axis voltage, (V a , V b , V c ) refer to the three-phase voltage, and V d refers to the direct axis voltage for both direct and alternating components, which can be smoothed through the low-pass filter as in Equation ( 3).
where V refers to the quadrature axis voltage, (V , V , V ) refer to the three-phase voltage, and V refers to the direct axis voltage for both direct and alternating components, which can be smoothed through the low-pass filter as in Equation (3).
Then, the voltage dq is returned to a three-phase voltage used as a reference voltage for Equation (4).Therefore, a comparison can be made between the reference voltage and the output of the inverter in the system before the filter is placed, and thus the FOPID controller compensates the difference signal until it reaches the reference value through the ASO.Then, the voltage dq is returned to a three-phase voltage used as a reference voltage for Equation (4).Therefore, a comparison can be made between the reference voltage and the output of the inverter in the system before the filter is placed, and thus the FOPID controller compensates the difference signal until it reaches the reference value through the ASO.

Control of Shunt Power Filter
As in Figure 7, the control system begins with converting the current as well as the voltage to α, β as in Equation ( 5), from which the values of the active power P and reactive power Q are measured, as shown in Equation (6).
Energies 2023, 16, 4362 Energies 2023, 16, x FOR PEER REVIEW 9 of 24 The P passes over the LPF to measure the reference values for α and β components, and then it is converted again into three-phase voltages, as in Equation (7), that are used as reference values based on which the ASO compares the source streams with the reference and finds the parameter values for the FOPID needed to produce the pulses to counter the error.The P passes over the LPF to measure the reference values for α and β components, and then it is converted again into three-phase voltages, as in Equation (7), that are used as reference values based on which the ASO compares the source streams with the reference and finds the parameter values for the FOPID needed to produce the pulses to counter the error. 

Proposed Control Strategy
This section demonstrates the FOPID controller-based UPFC control approach that uses ASO to fine-tune the controller parameters.

ASO with the UPFC
The UPFC is controlled through the FOPID controller, which receives the incoming signals on the inverter and smoothes them with the help of the ASO algorithm, which compares the actual voltage V dc from the inverter with the smoothed value, which is taken as a reference signal V dc(re f ) , and this makes a comparison between the optimal FOPID parameters and the reference values.So, the algorithm conducts tests to reach the optimal values of the controller, referring to the difference as an error signal E. The FOPID pumps the pulses of the UPFC to determine its performance on how to overcome the error signals through pumping compensatory signals, as shown in Equation ( 8).

FOPID Controller
The FOPID outputs a signal for the control u(s) based on the error value E(s).As it appears in Figure 8 [38], it is based on five parameters linked in Equation ( 9), [39].The Energies 2023, 16, 4362 9 of 22 best values for them are represented in "Table 1" in [40], from which the ASO [40] adjusted them with some details as in "Table 2" in [40].
where K p refers to the proportional gain, K i refers to the integral gain, K d refers to the derivative gain, λ refers to the integral order, and µ refers to the derivative order.Therefore, λ and µ are used to widen the scope of control in the system.

FOPID Controller
The FOPID outputs a signal for the control u(s) based on the error value E(s).As it appears in Figure 8 [38], it is based on five parameters linked in Equation ( 9), [39].The best values for them are represented in "Table 1" in [40], from which the ASO [40] adjusted them with some details as in "Table 2" in [40].
where K refers to the proportional gain, K refers to the integral gain, K refers to the derivative gain, λ refers to the integral order, and µ refers to the derivative order.Therefore, λ and µ are used to widen the scope of control in the system.

Atom Search Algorithm
An iterative improvement technique is used to obtain the best gain parameters for the optimal work of FOPID.It is a type of optimization technique based on the interaction of atoms with each other, whether attraction or repulsion, forming covalent bonds that differ in size and shape from each other.This is according to the type of substance of the constituent molecule, but with time, the molecules are exposed to expansion.This causes a force of repulsion with the atoms of other molecules until the strength of the atoms weakens and begins to attract with repetition to reach the optimal atom.The forces between atoms are represented as potential energy, which expresses that energy as Lennard-Jones potential energy, which has been mathematically formulated between two atoms, a and b [25].
Its objective is to reach the optimal FOPID values that lead to a decrease in the value of the difference in the DC voltage as it is in Equation (10).Therefore, it works on the factors through improving the value of  to reduce the steady-state error and the rise time, while improving  to get rid of the stability error and K to reduce the time for stability as well as overshooting time [41].
An iterative improvement technique has been mathematically formulated to obtain the best gain parameters for the optimal work of FOPID that studies atomic motion in the formula, depends on the forces of interaction of atoms with each other, and produces potential energy called Lennard-Jones potential energy [25].It expresses the energy that shows L-J between two atoms (a, b) as shown in Equations ( 11) and (12).

Atom Search Algorithm
An iterative improvement technique is used to obtain the best gain parameters for the optimal work of FOPID.It is a type of optimization technique based on the interaction of atoms with each other, whether attraction or repulsion, forming covalent bonds that differ in size and shape from each other.This is according to the type of substance of the constituent molecule, but with time, the molecules are exposed to expansion.This causes a force of repulsion with the atoms of other molecules until the strength of the atoms weakens and begins to attract with repetition to reach the optimal atom.The forces between atoms are represented as potential energy, which expresses that energy as Lennard-Jones potential energy, which has been mathematically formulated between two atoms, a and b [25].
Its objective is to reach the optimal FOPID values that lead to a decrease in the value of the difference in the DC voltage as it is in Equation (10).Therefore, it works on the factors through improving the value of K p to reduce the steady-state error and the rise time, while improving K i to get rid of the stability error and K d to reduce the time for stability as well as overshooting time [41].
An iterative improvement technique has been mathematically formulated to obtain the best gain parameters for the optimal work of FOPID that studies atomic motion in the formula, depends on the forces of interaction of atoms with each other, and produces potential energy called Lennard-Jones potential energy [25].It expresses the energy that shows L-J between two atoms (a, b) as shown in Equations ( 11) and (12).
Energies 2023, 16, 4362 where R ab refers to the position of the a th atom in space and σ refers to the collision diameter.refers to the attractive force, and ε refers to the strength of the interaction, so the interaction force is presented as Equation (13).
There are also restraining forces resulting from the length of the bond, and there are steps followed in the control process with the use of ASO algorithm, as shown in Figure 9 [26,42].where  refers to the position of the a th atom in space and  refers to the collision diameter.refers to the constraint force, refers to the attractive force, and  refers to the strength of the interaction, so the interaction force is presented as Equation (13).
There are also restraining forces resulting from the length of the bond, and there are steps followed in the control process with the use of ASO algorithm, as shown in Figure 9 [26,42].

Initialization
At first, the atoms move randomly and thus attract or repel each other according to the distances between the atoms, so the lighter atoms make the exploratory movement in other distances, which avoids the problem of concentrating the atoms in the same area, with the iterations weakening the repulsion and, thus, the atoms begin to attract, and their strength can be determined through the L-J potential.Then, the bonds forming the molecules begin, and work can be done to obtain the best location for the atoms and the formation of bonds.

Fitness Evaluation
It is necessary to take into account the constraints affecting the atom, which depend on the upper and the lower bound parameters, location of atoms, and space area calculation.The fitness function can be calculated based on the objective function and gives the optimal gain through Equations ( 14)- (16).
where T refers to the number of iterations and fit a (T) refers to the fitness value of the ath atom at the T th iteration.

Compute the Mass and C Neighbors' Fitness
The group of C atoms with the best fitness results is selected through Equation ( 17), which gradually decreases with iterations.Therefore, in the ASO algorithm, the atoms explore and iterate until it reaches the last iterations when the atoms are bonded.
where t refers to dimension in time, N refers to the size of the population, and T refers to maximum iterations.Since the greater the mass of the atom, the acceleration decreases.This affects the fitness, so use Equation (18) to determine the mass and, thus, calculate the fitness of the atom and choose the C neighbors:

Interaction Force and Acceleration Computation
The extent of the atom's interaction with the community can be measured through the strength of the interaction and the acceleration of the properties of the atoms via adding random weights of the various compounds that affect the atom from other atoms.The sum of the forces is expressed through Equation (19).
where rand b refers to a random number in [0,1], D refers to the measurement of the search space, and f refers to the fitness function.
Additionally, the acceleration of the atom can be calculated from Equations ( 20) and (21).
where ∝ (T) refers to the Lagrangian multiplier and β refers to the multiplier weight.

The Updating Process
At this stage, the speed and position of the atom are updated in order to obtain the best results in terms of reducing quality problems and achieving maximum benefit.The update process can be obtained through Equations ( 22) and (23).
where V D a (t + 1) and X D a (t + 1) refer to the velocity and position, respectively, of the ath atom at the (t + 1)-th iteration.
Thus, the best solution can be obtained based on the fitness function, leading to the optimal parameters for the FOPID controller.The resulting solutions must be checked via iteration, and the constraints should be checked to obtain the optimal power from the integrated HRES [43].

Simulation Results and Discussions
The quality and stability of the system under study were evaluated with and without connecting the UPFC to the system at different fault events.These events are sag/swell and unbalanced loading conditions.In addition, different load patterns are simulated to check the capability of the proposed controller for UPFC to reduce the total harmonic distortions.The effect of adding UPFC to the system during these faults will be investigated through system voltages and current waveforms.
The first step is tuning the FOPI controller parameters using ASO.In addition, the parameters used for adjusting the ASO algorithm are given in Table 1, while the FOPI controller parameters are given in Table 2. Through supporting the voltage and current values and reducing their THD, these ASO-FOPI controllers will be used to control the UPFC and improve the overall hybrid system.

Assessment of the Used ASO-FOPI Controller
The main aim of this work is to improve the performance of an HRES through optimal control of the UPFC.A FOPI controller is used for regulating the DC-link voltage of the UPFC during some fault events.To assess the performance of the system with the proposed ASO technique, another optimization technique, Genetic Algorithm (GA), which is considered the benchmark for optimization algorithms, will be considered [44].A swell fault condition of 30% between 0.1 and 0.3 s will be investigated.The convergence of the objective function ( 10) is plotted with ASO and GA in Figure 10a.When using ASO to optimize the FOPI controller parameters as opposed to GA, the DC-link, which is the objective function (10) that will be minimized in this study, exhibits a superior profile, as seen in Figure 10b.From these two figures, ASO outperforms GA in terms of tuning the FOPI controller parameter optimally.In order to enhance HRES performance, ASO will be utilized to adjust the FOPI controller parameters for the UPFC.

Assessment of the Used ASO-FOPI Controller
The main aim of this work is to improve the performance of an HRES through op timal control of the UPFC.A FOPI controller is used for regulating the DC-link voltag of the UPFC during some fault events.To assess the performance of the system with th proposed ASO technique, another optimization technique, Genetic Algorithm (GA) which is considered the benchmark for optimization algorithms, will be considered [44] A swell fault condition of 30% between 0.1 and 0.3 s will be investigated.The conver gence of the objective function ( 10) is plotted with ASO and GA in Figure 10a.Whe using ASO to optimize the FOPI controller parameters as opposed to GA, the DC-link which is the objective function (10) that will be minimized in this study, exhibits a su perior profile, as seen in Figure 10b.From these two figures, ASO outperforms GA i terms of tuning the FOPI controller parameter optimally.In order to enhance HRE performance, ASO will be utilized to adjust the FOPI controller parameters for th UPFC.

Test case 1: Sag condition
Voltage sag events will be simulated in order to assess the capacity of the controlled UPFC to inject reactive power to the HRES to support the voltage at the point of connecting (POC) the UPFC to the system.This sag condition is simulated via adding a nonlinear RL load to the system between 0.1 and 0.3 s.Through installing this non-linear load, the sagging appears in both the voltage and currents at the POC.The UPFC is operated to raise the voltage as a result of this defect through compensating both the voltage and current through series and shunt filter control as shown in Figures 11a-c and 12a-c.In Energies 2023, 16, 4362 14 of 22 this sagging condition, the value of the POC voltage decreases to 250 V, and the value of the current reaches 1 A between 0.1 and 0.3 s.When the UPFC is connected to the system, both the voltage and current return to their normal value of 280 V and 1.5 A, respectively.The injected voltage and current by the UPFC due to this sagging condition are shown in Figures 11c and 12c, respectively.This case of error has been studied on the state of the output power during calculating the original power resulting from stabilizing radiation at 1000 W/m 2 and finding the output of the solar system, as well as stabilizing the wind speed at the average for the region, which is 12 m/s, and finding the output of the wind system, which is shown in Figure 13.


Test case 1: Sag condition Voltage sag events will be simulated in order to assess the capacity of the controlled UPFC to inject reactive power to the HRES to support the voltage at the point of connecting (POC) the UPFC to the system.This sag condition is simulated via adding a nonlinear RL load to the system between 0.1 and 0.3 s.Through installing this non-linear load, the sagging appears in both the voltage and currents at the POC.The UPFC is operated to raise the voltage as a result of this defect through compensating both the voltage and current through series and shunt filter control as shown in Figures 11a-c and 12a-c.In this sagging condition, the value of the POC voltage decreases to 250 V, and the value of the current reaches 1 A between 0.1 and 0.3 s.When the UPFC is connected to the system, both the voltage and current return to their normal value of 280 V and 1.5 A, respectively.The injected voltage and current by the UPFC due to this sagging condition are shown in Figures 11c and 12c, respectively.This case of error has been studied on the state of the output power during calculating the original power resulting from stabilizing radiation at 1000 W/m 2 and finding the output of the solar system, as well as stabilizing the wind speed at the average for the region, which is 12 m/s, and finding the output of the wind system, which is shown in Figure 13.Test case 2: Swell condition Voltage swell events will be simulated in order to assess the capacity of the controlled UPFC to inject reactive power to the HRES and afterward support the voltage.This swell condition is simulated through removing a nonlinear RL load to the system between 0.1 and 0.3 s.As it is in Figures 14 and 15, the value of the voltage and current increases in this peand then the UPFC begins to work to compensate this inflation.So that the capacitor works to compensate the error using the stored energy which is controlled through the Test case 2: Swell condition Voltage swell events will be simulated in order to assess the capacity of the controlled UPFC to inject reactive power to the HRES and afterward support the voltage.This swell condition is simulated through removing a nonlinear RL load to the system between 0.1 and 0.3 s.As it is in Figures 14 and 15, the value of the voltage and current increases in this period, and then the UPFC begins to work to compensate this inflation.So that the capacitor works to compensate the error using the stored energy which is controlled through the FOPID, it works to reduce the error as much as possible through the ASO algorithm.Figure 16 shows the resulting power of the HRES when changing environmental conditions.
Energies 2023, 16, x FOR PEER REVIEW 17 of 23 FOPID, it works to reduce the error as much as possible through the ASO algorithm.Figure 16 shows the resulting power of the HRES when changing environmental conditions.(a)  Test case 3: disturbance condition The voltage and current are affected by the grid's unbalanced load, so the UPFC attempts to make up for this through injecting regulated voltage and current to reach a stable state using the FOPID controller.The unbalance operation is simulated in this case with a single phase fault, and hence the POC voltage and currents are unbalanced, as depicted in Figures 17 and 18, respectively.The regulated UPFC injects the appropriate voltage and currents to restore the balanced operation. (a)

Test case 3: disturbance condition
The voltage and current are affected by the grid's unbalanced load, so the UPFC attempts to make up for this through injecting regulated voltage and current to reach a stable state using the FOPID controller.The unbalance operation is simulated in this case with a single phase fault, and hence the POC voltage and currents are unbalanced, as depicted in Figures 17 and 18, respectively.The regulated UPFC injects the appropriate voltage and currents to restore the balanced operation.
Test case 3: disturbance condition The voltage and current are affected by the grid's unbalanced load, so the UPFC attempts to make up for this through injecting regulated voltage and current to reach a stable state using the FOPID controller.The unbalance operation is simulated in this case with a single phase fault, and hence the POC voltage and currents are unbalanced, as depicted in Figures 17 and 18, respectively.The regulated UPFC injects the appropriate voltage and currents to restore the balanced operation.The UPFC has an impact on improving the system power quality through reducing the THD.In this case, the injection of some harmonics will be simulated to test the effectiveness of the controlled UPFC in reducing the THD will be presented.The harmonics are simulated through connecting different loads: R, RL, as well as the induction motor.The tuned FOPI controller succeeded to control the UPFC to reduce the THD while using different loads for both the voltage and current profiles at the POC as illustrated in Figures 19 and 20, respectively (a) The UPFC has an impact on improving the system power quality through reducing the THD.In this case, the injection of some harmonics will be simulated to test the effectiveness of the controlled UPFC in reducing the THD will be presented.The harmonics are simulated through connecting different loads: R, RL, as well as the induction motor.The tuned FOPI controller succeeded to control the UPFC to reduce the THD while using different loads for both the voltage and current profiles at the POC as illustrated in Figures 19 and 20, respectively The UPFC has an impact on improving the system power quality through reducing the THD.In this case, the injection of some harmonics will be simulated to test the effectiveness of the controlled UPFC in reducing the THD will be presented.The harmonics are simulated through connecting different loads: R, RL, as well as the induction motor.The tuned FOPI controller succeeded to control the UPFC to reduce the THD while using different loads for both the voltage and current profiles at the POC as illustrated in Figures 19 and 20  Finally, to examine the expected methodology, An ASO-based FOPID controller is analyzed in the HRES interconnected system under unbalanced loading, sagging, and bulging.Figures 21 and 22 show the real and reactive power using the proposed control technique, which gives results that show very low error rates, and thus energy is conserved from the grid side.Finally, to examine the expected methodology, An ASO-based FOPID controller is analyzed in the HRES interconnected system under unbalanced loading, sagging, and bulging.Figures 21 and 22 show the real and reactive power using the proposed control technique, which gives results that show very low error rates, and thus energy is conserved from the grid side.Finally, to examine the expected methodology, An ASO-based FOPID controller is analyzed in the HRES interconnected system under unbalanced loading, sagging, and bulging.Figures 21 and 22 show the real and reactive power using the proposed control technique, which gives results that show very low error rates, and thus energy is conserved from the grid side.

Conclusions
This paper presents the improvement of the quality of an HRES power system connected to the grid.This improvement is achieved through reducing the harmonics and supporting the voltage at voltage sag/swell conditions and unbalanced load operations.This is done via integrating the UPFC device with the proposed HRES, whose composition has the characteristics of increasing the harmonics for mixing two sources of renewable energy PV/WT with the electric grid.FOPID-based control of HESS quickly responds to the change in the load and generation resulting in the smoothing of power.The FOPID was used on the UPFC using the help of ASO technology to find the optimal values for the parameters.The proposed FOPID-ASO controller showed a better performance concerning the system voltage and the HRES's power.The proposed controller for the UPFC also succeeded at keeping the continuous connection of the PV/wind to the system without disconnection for longer fault-clearing times.The implementation of the hybrid system with the UPFC makes an advantage that can ameliorate the efficacy of the on-grid HPS.System performance has been verified using error state at 0.1:0.3s and proven to be effective in improving system quality and optimizing performance.In the future, this work may be implemented in a real hybrid power system.

Conclusions
This paper presents the improvement of the quality of an HRES power system connected to the grid.This improvement is achieved through reducing the harmonics and supporting the voltage at voltage sag/swell conditions and unbalanced load operations.This is done via integrating the UPFC device with the proposed HRES, whose composition has the characteristics of increasing the harmonics for mixing two sources of renewable energy PV/WT with the electric grid.FOPID-based control of HESS quickly responds to the change in the load and generation resulting in the smoothing of power.The FOPID was used on the UPFC using the help of ASO technology to find the optimal values for the parameters.The proposed FOPID-ASO controller showed a better performance concerning the system voltage and the HRES's power.The proposed controller for the UPFC also succeeded at keeping the continuous connection of the PV/wind to the system without disconnection for longer fault-clearing times.The implementation of the hybrid system with the UPFC makes an advantage that can ameliorate the efficacy of the on-grid HPS.System performance has been verified using error state at 0.1:0.3s and proven to be effective in improving system quality and optimizing performance.In the future, this work may be implemented in a real hybrid power system.

Figure 8 .
Figure 8. Structural design of the FOPID Controller. u

Figure 8 .
Figure 8. Structural design of the FOPID Controller.
(a) Objective function convergence (b) DC-link voltage

Figure 13 .
Figure 13.PV and wind powers while environmental conditions are stable.(a) PV irradiance, (b) PV power, (c) wind speed, and (d) wind power.

Figure 15 .Figure 16 .
Figure 15.Swell current signals: (a) source current, (b) load current, (c) injected current.Red lines represent current of phase a, blue lines phase b, green lines phase c.Energies 2023, 16, x FOR PEER REVIEW 18 of 23

Figure 16 .
Figure 16.The resulting power of the HRES when changing Environmental conditions.(a) PV irradiance, (b) PV power, (c) wind speed, and (d) wind power.

Figure 18 . 3 -
Figure 18.3-Phase current before and after a disturbance in the load and injected value.(a) Source current, (b) load current, and (c) injected current.

Figure 20 .
Figure 20.THD for current signals in (a) R, (b) RL, and (c) IM load states while connecting the UPFC.

Figure 20 .
Figure 20.THD for current signals in (a) R, (b) RL, and (c) IM load states while connecting the UPFC.

Author Contributions:
Methodology, M.O.a.e.-R., S.A.A.M. and M.M.S.; software, S.A.A.M. and M.M.S.; formal analysis, S.A.A.M.; investigation, M.M.S. and H.A.A.; writing-original draft, M.O.a.e.-R., M.I.M. and H.A.A.; writing-review & editing, M.O.a.e.-R.and M.I.M.All authors have read and agreed to the published version of the manuscript.Funding: This research received no external funding