Power Quality Improvement Using Distributed Power Flow Controller with BWO-Based FOPID Controller

The integration of hybrid renewable energy sources (HRESs) into the grid is currently being encouraged to meet the increasing demand for electric power and reduce fossil fuels which are causing environmental-related problems. Integration of HRESs into the grid can create some power quality (PQ) problems. To mitigate PQ problems and improve the performance of grid-connected HRESs some flexible devices should be used. This paper presents a distributed power flow controller (DPFC), as a type of flexible device to mitigate some PQ problems, including voltage sag, swell, disruptions, and eliminating the harmonics in a hybrid power system (HPS). The HPS presented in this work comprises a photo voltaic (PV) system, wind turbine (WT) and battery energy storage system (BESS). As a result, black widow optimization (BWO) with DPFC with real and reactive power (DPFC-PQ) is built in this paper to solve the PQ issues in HRES systems. The main aim of the work is to mitigate PQ problems and compensate for load demand in the HRES scheme. The controller used to drive this DPFC-PQ is a fractional-order PID (FOPID) controller optimized by the black widow optimization (BWO) technique. To assess the capability of BWO in fine-tuning the FOPID controller parameters, twelve optimization techniques were presented: P&O, PSO, Cuckoo, GA, GSA, BBO, Whale, ESA, RFA, ASO, and EVORFA. Additionally, a comparison between the FOPID controller and the classical PI controller is introduced. The results showed that the proposed BWO-FOPID controller for DFPC had mitigated the PQ problems in grid-connected HRESs. The system’s performance with the presented BWO-FOPID controller is compared with eleven optimization techniques used to optimize the FOPID controller and also compared with the conventional PI controller. The design of the proposed system is implemented in the MATLAB/Simulink platform and performances were analyzed.


Introduction
HRESs are currently playing a vital role, as traditional energy sources face several challenges related to the usage of fossil fuels that have great negative environmental impacts. HRESs can mitigate emissions and global warming in addition to their significant economic advantages [1]. Due to global economic problems and increasing ecological awareness, HRESs-based distributed generation (DG) is becoming more relevant [2]. Many HRESs have been implemented and integrated into the classical power networks, like wind energy, photovoltaic energy, fuel cells (FCs), and biomass [3]. Each RES has distinct characteristics different from other sources in terms of being AC or DC [4]. The PV and FC generated DC voltages with different levels, while wind energy generates either AC or DC based on the Table 1. Survey of previously published work.

Contribution
Year Reference • They have presented that the bacterial graphical user interface oriented by particle swarm optimization method for optimization of various type DFACTS for power quality improvement in the distribution system. • EBFO based multiple DFACTS allocation utilizing DSSSC, APC, and DSTATCOM are preferred to decrease power losses, improve load balancing, and increase voltage deviation index to 70%, 38%, and 132%, correspondingly, and also it may improve loading factor without extra power loss.

•
The multi-objective issue in which four objective functions include the maximization of voltage stability, power loss reduction, and minimizing of voltage deviation and equalizing the feeder load balancing in the distribution system.
2017 [16] • The single-phase voltage source inverter that connects the distributed generation plant to the grid must address several issues related to the quality of current injected into the grid, output power factor, and power exchange between the plant and the grid. • For single-phase grid linked VSI, the model predictive current controller (MPCC) is developed, which can perform well in both steady-state and transient state operations.

•
The current study also shows how to build the digital MPCC in hardware utilizing a low-cost digital signal processor (DSP). A single-phase grid-connected VSI of 1 kW is modeled and simulated.
2017 [17] • They proposed the DSTATCOM method for minimizing power quality problems during power delivery. One of the unique power gadgets was this technique. • Some of the features such as reimbursement of imaginary power, reduction of voltage harmonics, reduction of power factor, and reduction of current harmonics were accomplished using the DSTATCOM method.

•
In terms of utilizing these methods, the primary goal was to improve power quality by minimizing noise and reducing voltage fluctuation. Authentication and demonstration of the suggested method were carried out here.
2017 [18] • They proposed the unified power quality conditioner (UPQC) method for improving power quality. The achievement of UPQC's series and shunt active power filter (APF) virtual power-sharing. • These methods of power-sharing were predicated on the instability of the voltage source. Some of the problems arose as a result of voltage level instabilities.

•
To overcome these problems, a combination of power angle control (PAC) and synchronous reference frame (SRF) was employed. Parameters like load current were utilized to mitigate power quality problems while efficiently using the UPQC inverters.
2017 [19] • They proposed that the two methods, UPQC-O and PV array with battery and UPQC-O and PV array without batteries, be combined. In the method of UPQC-O and PV array with battery, the PV array generates some quantity of energy that is often stored. Those energies were used during peak hours to conduct efficient energy storage operations.

•
The PV array was injected directly into the network in the UPQC-O and PV array without the battery method. These two methods were coupled with operational parameters like bus voltage.

•
In this case, the replacement was done in terms of UPQC-O with the PV array in the networking methods. Some of the goals include lowering the operating costs of batteries, PV arrays, and inverters, as well as reducing energy loss. In addition, the particle swarm optimization method was utilized to improve the energy preservation solution.

Contribution
Year Reference • They proposed a static synchronous compensator (STATCOM). This method was used to reduce reactive power using the Icos algorithm. In this method, the continuous power supply was maintained while conducting the power quality enhancement.

•
The uninterrupted power supply protects both the telecommunications and computer systems. Some supply-side commotion, such as sag, swell, and harmonics, were reduced as compensation for poor power quality. Voltage and current were both unstable; therefore they were balanced.
2018 [21] • They demonstrated the multi-functional grid-connected inverter (MFGCI) for increasing power quality in both micro-grid (MG) and distributed generation (DG) systems. • The MFGCI method was used to reduce the voltage-based power quality approach reimbursing. In addition, the shunt series switched multi-functional grid-connected inverter (SSS-MFGCI) method was utilized to address both current and voltage-based power quality problems.
2018 [22] • They proposed using the shunt active power filter (SAPF) method to minimize power supply problems. This kind of technique was also used to reduce harmonic turbulences. • This filter was specifically designed for regulating DC voltage amid power quality. In this method, the total harmonic distortion (THD) value was evaluated in terms of harmonic mitigation. In this technique, sinusoidal waveforms were generated to mitigate power quality problems.
2019 [23] • They had developed a control method that could give a fast and reliable solution as the operating conditions of the system varied. The UPQC coupled wind energy to increase energy quality is the design of the technique. • Voltage sag, source tension swell, and current source power harmonics reduction. The Adaptable PI controller has been used in shunt-based and serial APFs, which enable the adaptive PI controller using the Park control mechanism. This signifies that there are no anomalous effects on any modification to the external state of the system depicted.
2019 [24] • They proposed a shunt active power filter and a series active power filter for improving power quality. The adaptive ANFIS method was utilized to assess power quality performance in UPQC devices. • Some drawbacks, including voltage swell and voltage sag, exist with UPQC devices. These types of problems were minimized by using UPQC-based methods. 2020 [25] • They had introduced a hybrid flow management approach (PFM) of the micro-grid (MG) connected hybrid renewable source (HRES). This strategy is proposed by the integration of both the whale optimization algorithm (WOA) and the SSAWO squirrel search (SSA) algorithm.

•
Here the SSA develops voltage source inverter control signals subject to the power exchange difference between the source and the load side. The multi-objective function is determined by the active and reactive power variants needed for the grid generated using the accessible source power. The technology-based control model created improve the power controller control parameters, given the variety of power flows. 2020 [26] • They proposed an enhanced fuzzy-based multi converter-unified power quality conditioner for improving power quality (MC-UPQC). Using this method also helped to reduce inefficiencies in voltage and current.

•
In addition, the fuzzy incremental conductance method was utilized to determine the power point that occurs at the maximum level. Using this fuzzy-based method, the wind energy system (WES) was enhanced.
2021 [27] • They proposed a new technique for DVR. They optimized FOPID controller with GS algorithm. • They have addressed various PQ issues like voltage regulation, fault compensation, sag, swell, and THD reduction. 2021 [28]

Modeling of the Proposed HRES System
In the distribution system, HRESs such as PV and WT are used more extensively. HRES is considered to be the best option in an integrated DG system [29]. In the distribution system, HRES should satisfy the load demand expected by customers, which implies problems of flexibility and reliability of power quality [30]. For the smooth running of the device, these PQ issues must be avoided [31]. FACT devices are utilized with the Sustainability 2021, 13, 11194 5 of 33 development of power electronics devices to mitigate PQ problems. DPFC is designed to mitigate power PQ problems such as voltage sag, current sag, disruptions, and THD [32]. The combination of PV, WT, and the battery as energy storing system (BESS) interfaced with the grid is proposed. As the sources considered are intermittent, BESS is designed to satisfy the load demand under critical environmental conditions. PQ problems are generated in the HRES system because of the faults, non-linear loads, and sudden loads. [33]. Due to these problems, voltage instability and mismatches in reactive power are created. PQ issues such as voltage sag, current sag, real power, reactive power, and THDs are discussed in this paper [34]. To improve the voltage regulations in the HRES interfaced grid-connected system DPFC-FOPID controller is designed to solve these problems. The tuning of the FOPID controller which controls the operation of the series controller and shunt controller is done using the BWO technique. Using perturb and observe (P&O) maximum power point tracking (MPPT), the PV and wind powers are derived [35]. A reference DC bus voltage is produced from the BWO. The DC relation voltage reference is set to its default value at a time when there is no solar energy [36]. The HRES's PQ problems are considered primarily due to faults, non-linear load, and sudden grid side loads [37].
The proposed system is equipped with DPFC, shown in Figure 1 [38]. It comprises series and shunt controllers which are operated using control techniques to compensate the PQ problems and for stable operation power compensation can be accomplished by providing the best gain parameters for the FOPID controller [39], which filters and injects the necessary power by selecting the best gain parameters for the FOPID controller. The FOPID controller is controlled by a BWO technique, which is programmed to select the values necessary to run the control operation under PQ conditions [40].

Modeling of PV
The design PV panel current and terminal voltage are computed based on the following Equations ((1)-(3)) [41].
The PV is the ideal option for producing power from solar energy from various HRESs while avoiding greenhouse gas pollution, with durability, long life, good efficiency, and less maintenance. It consists of cells connected in series in the PV system to achieve the voltage required. Figure 2 shows the built PV panel model, the power produced from the PV panel is formulated as follows.

Modeling of PV
The design PV panel current and terminal voltage are computed based on the following Equations (1)-(3) [41].
The PV is the ideal option for producing power from solar energy from various HRESs while avoiding greenhouse gas pollution, with durability, long life, good efficiency, and less maintenance. It consists of cells connected in series in the PV system to achieve the voltage Sustainability 2021, 13, 11194 6 of 33 required. Figure 2 shows the built PV panel model, the power produced from the PV panel is formulated as follows.
The maximum power extraction from the grid would not always exist as the variations in both the load and the environmental conditions and, consequently, the current drawn from HRESs, especially PV systems.
The PV is the ideal option for producing power from solar energy from various HRESs while avoiding greenhouse gas pollution, with durability, long life, good efficiency, and less maintenance. It consists of cells connected in series in the PV system to achieve the voltage required. Figure 2 shows the built PV panel model, the power produced from the PV panel is formulated as follows.
The maximum power extraction from the grid would not always exist as the variations in both the load and the environmental conditions and, consequently, the current drawn from HRESs, especially PV systems.

Modeling of Wind Turbine
The output power produced by the WT is dependent on the wind speed under the stated hub height. WT power is expressed as (4). The PV and WT systems on the grid side are used to compensate for load requirements. Often the requirement for load rises, which cannot be covered by HRES, because the battery is often attached to the device. The battery system's statistical modeling is presented in the section below.

Modeling of BESS
When the power provided by the HRES is insufficient, the battery meets the needed load requirement. The battery output is calculated using the reference autonomy day (AD) under the condition of the system's required power consumption. AD is defined as the total number of days that the battery is capable of producing power to counterbalance the demand for loads. This battery output may be described as (5).
The battery in the HRES system is charged using the excess electricity produced by RES. The battery capacity is calculated using Equations (6) and (7). State of charge (SOC) is a critical parameter in the battery related to further energy production and energy shortfall in HRES as discussed below. It can impact PQ issues such as sag, swell, voltage interference, and so on in the proposed design framework. The problems of power efficiency in the system must be resolved to increase the reliability of the system obtained with the usage of the DPFC unit in the HRES system. In the segment below, the modeling of DPFC is discussed.

Modeling of DPFC
To transfer the actual power, the shunt and series controllers will be linked to the AC terminals of a transmission line [42]. The mean value of the product of non-sinusoidal current and voltage is used to calculate real power (see Figure 1). The cross-product of the integral parameters is 0 at various frequencies. The active power may be expressed as in the following (8) Since real power has no frequency dependency, it enhances the converter's mobility and capacity to create active power even in the absence of an electrical source, which is a benefit that at varying frequencies, the same strength may be consumed. Actual power must be received from the grid through a shunt converter operating at the fundamental frequency. At the harmonic standard, current must be injected into the grid through the distribution line. The high-pass filter allows for harmonic modules while disabling the portion of the frequency in DPFC that provides the harmonic components with a return path. The filter will harmonic current converters with a locked loop. In comparison, the DPFC's monitoring power is high because it comprises several converters of the smallrated set, the process is not impaired by the failure of one converter, showing no effect on the whole system while other converters must continue to contribute to the overall system's regular function. The appearance of the device is rendered more effective by bypass protection.

Perturb and Observe MPPT
MPPT approaches are often used to monitor maximum power from intermittent sources such as renewable energy sources. P&O is the most extensively used approach for producing duty pulses that are required to run the converter. It compares and monitors the reference voltages continually until the best value is reached. P&O is set at a relatively tiny size to guarantee little power loss. The sole disadvantage is that optimal power is not obtained under rapidly changing air conditions. The procedure described in Figure 3 is relatively simple and widely used. The suggested HRES system for PQ enhancement seen in Figure 4 is shown in the flow chart below. The next part, Section 3, has a full explanation of all of the modules. sources such as renewable energy sources. P&O is the most extensively used approach for producing duty pulses that are required to run the converter. It compares and monitors the reference voltages continually until the best value is reached. P&O is set at a relatively tiny size to guarantee little power loss. The sole disadvantage is that optimal power is not obtained under rapidly changing air conditions. The procedure described in Figure 3 is relatively simple and widely used. The suggested HRES system for PQ enhancement seen in Figure 4 is shown in the flow chart below. The next part, Section 3, has a full explanation of all of the modules.

Proposed Control Model of DPFC
In this section, a HRES connected system with DPFC model is proposed. The control model of DPFC which includes series and shunt controllers are used to mitigate PQ issues. DPFC is operated with the use of a FOPID controller. The tuning of the FOPID controllers is done with BWO technique which obtains the best gain values. The series controller mitigates the current related problems and shunt controller is used to mitigate voltage-related problems.  Figure 4. Flow chart of HRES system to mitigate PQ issues [44].

Proposed Control Model of DPFC
In this section, a HRES connected system with DPFC model is proposed. The control model of DPFC which includes series and shunt controllers are used to mitigate PQ issues. DPFC is operated with the use of a FOPID controller. The tuning of the FOPID controllers is done with BWO technique which obtains the best gain values. The series controller mitigates the current related problems and shunt controller is used to mitigate voltagerelated problems.

Implementation of the Principle of Coordinated PQ in DPFC
The DPFC consists of three basic controllers, as indicated in Figure 5 (e.g., central, series, and shunt controllers). Because it provides signals to the other controllers in the same device, the central controller is the primary controller in this system. At the same time, current harmonics are corrected for voltage using shunt and series controllers.

Central Control
On several levels, it interacts with the DPFC characteristics (e.g., balancing of unbalanced components and power flow control). For the shunt and series controllers, a reference signal will be created. This satisfies the method's criteria by generating a reference to the series and shunt regulators, as well as voltage signals. The fundamental frequency will be used to create all of the reference voltage signals. Figure 6 depicts the control process based on the series active power filter. The phase locked loop (PLL) is used to determine the reference voltage at first. The three-phase voltage measurement is converted into the d-q axis using the dq transformation technique (Clarke transformation) [33]. The power filter was also employed in this manner to monitor the DPFC to tackle the system's power quality issues [45]. The mechanism of dq transformation from three-phase voltage is formally represented in Equation (9),

Central Control
On several levels, it interacts with the DPFC characteristics (e.g., balancing of unbalanced components and power flow control). For the shunt and series controllers, a reference signal will be created. This satisfies the method's criteria by generating a reference to the series and shunt regulators, as well as voltage signals. The fundamental frequency will be used to create all of the reference voltage signals. Figure 6 depicts the control process based on the series active power filter. The phase locked loop (PLL) is used to determine the reference voltage at first. The three-phase voltage measurement is converted into the d-q axis using the dq transformation technique (Clarke transformation) [33]. The power filter was also employed in this manner to monitor the DPFC to tackle the system's power quality issues [45]. The mechanism of dq transformation from three-phase voltage is formally represented in Equation (9),

Series Controller
The d axis voltage is represented as a direct voltage as well as the alternating component voltage. The d axis voltage can be smoothing by the low-pass filter (LPF) which is mathematically formulated as (10), After that, the voltage is changed into three phases (11), the voltage's hysteresis band is controlled using the control pulses which are calculated and tuned by FOPID with BWO. Similarly, the shunt active power filter with a control algorithm is presented in the following section.
After that, the voltage is changed into three phases (11), the voltage's hysteresis band is controlled using the control pulses which are calculated and tuned by FOPID with BWO. Similarly, the shunt active power filter with a control algorithm is presented in the following section.

Shunt Active Power Filter Control Strategy
The shunt active power filter control strategy with the proposed controller is illustrated in Figure 7. The three-phase currents and voltages are changed into α and β, which are described in the following Equations ( (12) and (13)) [46,47]. Based on phase neutral voltages and load currents, the actual and unconsidered powers of instantaneous values are computed. In the shunt active filter, the real and reactive power is computed based on Equation (14)

Shunt Active Power Filter Control Strategy
The shunt active power filter control strategy with the proposed controller is illustrated in Figure 7. The three-phase currents and voltages are changed into α and β, which are described in the following Equations (12) and (13) [46,47]. Based on phase neutral voltages and load currents, the actual and unconsidered powers of instantaneous values are computed. In the shunt active filter, the real and reactive power is computed based on Equation (14)  After that, the reference currents are computed based on Equation (15)  Based on the I ref , the error current is computed which must be compensated with the FOPID controller with the BWO algorithm [48]. In the shunt active power filter, the optical pulses are selected and created on the error values of the system. The optimal pulses are generated with the help of the BWO algorithm. A detailed description of the FOPID controller with BWO optimization is presented in the sections below.
After that, the reference currents are computed based on Equation (15) 1 0 Based on the Iref, the error current is computed which must be compensated with the FOPID controller with the BWO algorithm [48]. In the shunt active power filter, the optical pulses are selected and created on the error values of the system. The optimal pulses are generated with the help of the BWO algorithm. A detailed description of the FOPID controller with BWO optimization is presented in the sections below.

Strategies of DPFC Regulation
The control structure plays a crucial length in identifying and strengthening DPFC's efficiency in minimizing the quality issues like sag, swell, and harmonics. Usage of this controller for the voltage and harmonics allows the problems arising in the power system to be investigated, recognized, and analyzed. The controller's management technique solves the PQ challenges on the distribution side by taking three steps: (1) The system voltage under fault conditions has to be recognized. (2) It is important to produce switching pulses for the operation of converters. (3) It should then produce the necessary reference voltage, which is required for modification purposes. DPFC incor-

Strategies of DPFC Regulation
The control structure plays a crucial length in identifying and strengthening DPFC's efficiency in minimizing the quality issues like sag, swell, and harmonics. Usage of this controller for the voltage and harmonics allows the problems arising in the power system to be investigated, recognized, and analyzed. The controller's management technique solves the PQ challenges on the distribution side by taking three steps: (1) The system voltage under fault conditions has to be recognized. (2) It is important to produce switching pulses for the operation of converters. (3) It should then produce the necessary reference voltage, which is required for modification purposes. DPFC incorporating PI, and FOPID controllers are used to alleviate PQ problems (e.g., sag, swell, and harmonics). A study of harmonics is also done for each controller [49].

Regulation of DPFC
This section will explain the PI controller for DPFC. By comparing the reference and actual voltage levels, the PI controller is used for producing the proper gate signals for the inverter's operation. Swell, sag, and other circumstances were created to test the PI controller's behavior. The PI controller's settings are tuned using BWO-based optimization. The DPFC controller is then activated to adjust for voltage swells and sags.

DPFC with BWO
A reference value is used to compute DC voltage in DPFC. As a consequence, the error is conveyed to the FOPID controller based on BWO, which creates the required power to activate the series and shunt controllers [50]. The difference between the reference voltage (V dc ) and the actual DC voltage is received by the FOPID controller (V dc ). The error equation is as follows: Figure 8 depicts the basic FOPID diagram [51]. The e(s) error signal helps in the generation of the u(s) control output. FOPID is designed to reduce PQ issues caused by voltage and current changes in the HRES device with BWO tuning. The FOPID controller has five parameters which receives the best gain values which are listed in Table 2, are obtained when tuned with BWO techniques with set of instructions as listed in Table 3. The FOPID controller control signal is formally expressed as (17),

FOPID Controller
The following steps are required during the design of the controller: • K P is optimized for minimizing steady-state error and rise time • K d is optimized for minimizing the settling time and overshoot • K i is optimized for eliminating the steady-state error • s λ and s µ are fractional order parameters  Figure 8. FOPID controller.

DC Voltage Regulation Using BWO Optimization
The controller's voltage source inverter (VSI) does not supply reactive power, has no reactive power, and should be utilized at steady state [52]. The primary aim here is to get FOPID optimal values, which result in extremely low DC voltage (Vdc) dynamics. The ability to fine-tune FOPID to improve settling time and overshoot. This is accomplished using BWO optimization, which reduces the Vdc variation from the reference Vdc*. The major factors that determine the optimality of FOPIDC are the rising time (tr), maximum overshoot (Vc max), and steady-state error (Ess) [53]. The major goal here is to reduce the dc voltage variation (Vdc), which is expressed as Equation (19) represents the objective function (J) which is generally considered to be integral time absolute error (ITAE) which minimizes the error between Vdc and Vdc * . With the use of the BWO technique, the best gain values of FOPID controller are obtained which results in low DC voltage (Vdc) [54].

DC Voltage Regulation Using BWO Optimization
The controller's voltage source inverter (VSI) does not supply reactive power, has no reactive power, and should be utilized at steady state [52]. The primary aim here is to get FOPID optimal values, which result in extremely low DC voltage (V dc ) dynamics. The ability to fine-tune FOPID to improve settling time and overshoot. This is accomplished using BWO optimization, which reduces the V dc variation from the reference V dc *. The major factors that determine the optimality of FOPIDC are the rising time (tr), maximum overshoot (V c max), and steady-state error (Ess) [53]. The major goal here is to reduce the dc voltage variation (V dc ), which is expressed as Equation (19) represents the objective function (J) which is generally considered to be integral time absolute error (ITAE) which minimizes the error between V dc and V dc * . With the use of the BWO technique, the best gain values of FOPID controller are obtained which results in low DC voltage (V dc ) [54].

Black Widow Optimization
The BWO technique is illustrated in Figure 9. The proposed BWO technique generated the best gain parameters for the FOPID controller. BWO is an evolutionary algorithm that begins with the initialization of the population of spiders in which each spider is a possible solution. The initial population of spiders tries to reproduce the new generation in pairs. During or after mating, the female black widow consumes the male [55]. In her semen, they hold accumulated sperms and releases them into egg sacs. Spiderlings come out of the sacs as early as 11 days after being laid. For many days to a week, they cohabit on the maternal network, during this time sibling cannibalism is detected. Later they leave by being carried on the wind. rithm that begins with the initialization of the population of spiders in which each spider is a possible solution. The initial population of spiders tries to reproduce the new generation in pairs. During or after mating, the female black widow consumes the male [55]. In her semen, they hold accumulated sperms and releases them into egg sacs. Spiderlings come out of the sacs as early as 11 days after being laid. For many days to a week, they cohabit on the maternal network, during this time sibling cannibalism is detected. Later they leave by being carried on the wind.

Step 1: Initialize Population
To solve an optimization problem, first, create an appropriate framework for resolving the current problem using the values of the problem variables. This structure is referred to as a "Chromosome" and a "Particle position" in GA and PSO methods, respectively. In BWO, it is referred to as "Widow." Each possible option is represented by a black widow spider that shows the problem variables' values. The structure should be seen as an array to solve benchmark functions in this work.
In a problem of Nvar-dimensional optimization, a widow is an array of 1*Nvar, describing the problem's solution. Equation (20) defines the array as follows:

Step 1: Initialize Population
To solve an optimization problem, first, create an appropriate framework for resolving the current problem using the values of the problem variables. This structure is referred to as a "Chromosome" and a "Particle position" in GA and PSO methods, respectively. In BWO, it is referred to as "Widow." Each possible option is represented by a black widow spider that shows the problem variables' values. The structure should be seen as an array to solve benchmark functions in this work.
In a problem of Nvar-dimensional optimization, a widow is an array of 1*Nvar, describing the problem's solution. Equation (20) defines the array as follows: All the variable values (X 1 , X 2 , . . . , X Nvar ) are the floating-point number. The fitness of widow is obtained by evaluation of fitness function f at a widow of (X 1 , X 2 , . . . , X Nvar ) So (21), Fitness = f(Widow) = f(X 1 , X 2 , . . . , X Nvar ) To begin with the optimization technique, a candidate matrix of widows with an initial spider population, the size N pop × N var is created. Then we randomly choose pairs of parents to execute the procreation stage by mating, in which the female consumes the male black widow during mating.

Step 2: Procreate
The couples begin to mate and reproduce in the present generation since they are self-contained. Each pair mates autonomously from the others in nature. During each mating, around 1000 eggs are laid, with any larger spider babies surviving. This method might alternatively make use of an array named alpha. The offspring are produced using alpha, where x1 and x2 are parents and y1 and y2 are ancestors, as illustrated below, as long as the widow array is generated with random values (22).
This procedure is continuously repeated for Nvar/2 times, with randomly chosen variables which should not be repeated. Finally, the infants and mothers are added to an array and categorized according to their health importance, now focused on a few of the best citizens which are applied to the newly produced population according to the cannibalism ranking. This procedure is applied to all the pairs.

Step 3: Cannibalism
In our world, there are three sorts of cannibalism. The first is sexual cannibalism, in which the black widow eats her partner while they are mating or immediately thereafter. Based on their fitness scores, we should be able to distinguish the female and male in this manner. The second kind of sibling cannibalism, in which the stronger spiderlings consume the weaker siblings. In this method, we create a cannibalism rating (CR) ranking, from which the number of survivors is calculated. In circumstances when the newborn consumes its mother, the third kind of cannibalism occurs. We utilize the fitness value of little spiderlings to estimate high fitness value.

Step 4: Mutations
At this point, we randomly pick the number of people from the population. As Figure 10 reveals, each of the choices selected two items in the sequence is shared at random. The evaluation of mutation decides Mutepop.
parents to execute the procreation stage by mating, in which the female consumes the male black widow during mating.

Step 2: Procreate
The couples begin to mate and reproduce in the present generation since they are self-contained. Each pair mates autonomously from the others in nature. During each mating, around 1000 eggs are laid, with any larger spider babies surviving. This method might alternatively make use of an array named alpha. The offspring are produced using alpha, where x1 and x2 are parents and y1 and y2 are ancestors, as illustrated below, as long as the widow array is generated with random values (22).
This procedure is continuously repeated for Nvar/2 times, with randomly chosen variables which should not be repeated. Finally, the infants and mothers are added to an array and categorized according to their health importance, now focused on a few of the best citizens which are applied to the newly produced population according to the cannibalism ranking. This procedure is applied to all the pairs.

Step 3: Cannibalism
In our world, there are three sorts of cannibalism. The first is sexual cannibalism, in which the black widow eats her partner while they are mating or immediately thereafter. Based on their fitness scores, we should be able to distinguish the female and male in this manner. The second kind of sibling cannibalism, in which the stronger spiderlings consume the weaker siblings. In this method, we create a cannibalism rating (CR) ranking, from which the number of survivors is calculated. In circumstances when the newborn consumes its mother, the third kind of cannibalism occurs. We utilize the fitness value of little spiderlings to estimate high fitness value.

Step 4: Mutations
At this point, we randomly pick the number of people from the population. As Figure 10 reveals, each of the choices selected two items in the sequence is shared at random. The evaluation of mutation decides Mutepop.

Step 5: Convergences
Compared to the other most evolutionary techniques, here three-stop requirements can also be considered: (a) the number of predefined iterations; (b) observance in conformity with several iterations, no improvement in the fitness value of the best widow; (c) achieving the degree of precision mentioned. BWO would be extended to some benchmarks in the next segment. Since optimal results are known in advance for benchmark functions, thereby we can achieve a defined degree of accuracy standard. The maximum sum of iteration is often set as a stop as well.

Step 6: Setting Parameters
To produce vest results with the proposed BWO technique requires certain parameters like rate of procreation (PP), cannibalism rate (CR), and the rate of mutation (PM).
The chosen values in this paper for these parameters are seen in Table 3.The parameters should be changed accordingly to boost the algorithm's efficiency in obtaining the best results. The more the number of parameters is tuned, the greater the probability of jumping out of every optimal and greater local capability to find them in the search space globally. Consequently, the correct set of parameters that regulate the equilibrium between exploitation and exploration should be assured. The proposed algorithm has three controlling parameters, PP, CR, and PM. The number is PP in procreation, which defines how many persons are interested in procreation. By monitoring the output, further diversification is given by separate offspring which gives more opportunities to more specifically analyze the quest space. The cannibalism operator's control parameter, the CR, excludes the community from the wrong persons. By adjusting the needed value for this parameter, great efficiency for the exploitation step may be ensured by changing the quest agents from the local to the global stage and vice versa. PM denotes the percentage of people who are involved. In mutation, the appropriate value for this parameter should be employed to ensure that the duration between exploitation and exploration is balanced. This parameter may monitor the transition of the quest agents from the global level to the state and local level and drive them to the correct decision.

Step 7: Stop
The following step-by-step procedure repeats until the final optimal pulses are generated by the proposed FOPID controller

Results and Discussion
In this section, the performance of the proposed method is validated and analyzed. The proposed method for mitigating PQ issues in grid-connected HRES has been developed. The main aim is to increase the system's reliability by minimizing problems with the quality of electricity. There are drawbacks to the current methods that were listed in Section 4. So, with the aid of the proposed controller and DPFC, the efficiency of the system is enhanced. Here, the proposed method will include the current and voltage regulations in integrated HRES using DPFC with the proposed controller. Based on voltage, current, and fault conditions such as sag, swell voltage distortion, and harmonics with THD, the HRES grid-connected device with the suggested controller is evaluated. The FOPID parameters are evaluated with and without the system's PQ problems. In MATLAB/Simulink with the processor, the predicted method is executed on a computer with the following specifications: Intel(R) Core(TM) i5-3570S CPU @ 3.10 GHz, and the presentation is analyzed. The projected technique is compared with twelve techniques P&O, PSO, Cuckoo, GA, GSA, BBO, Whale, ESA, RFA, ASO, EVORFA, and BWO with existing PI controller techniques. The criteria for implementation are presented in Table 4. The proposed technique is verified in the system using PQ concerns like sag, swell, disturbance, and harmonics. The PQ difficulties are compensated by delivering ideal shunt and series active power filter pulses with the help of the BWO-FOPID controller, which ideally regulates the PQ issues using the DPFC and the needed suggested shunt and series active power filter controller [56]. The DPFC will supply the required power to mitigate the PQ issues and adjust for load demand in the system. In the proposed HRES system, the DPFC configuration is employed to deliver critical power and mitigate PQ concerns. PV and WT systems can generate enough power to fulfill the load demand, which is considered the system's major source of electricity [57]. The WT and PV may be impacted by external influences that may be mitigated by factors including the MPPT approach in the device [58]. The DPFC system uses the generated electricity to counter load demand and mitigate PQ issues in the system. The DPFC system is compatible with a grid-connected load scheme. Evaluation of the predicted design structure is done under the three failure circumstances of sag, swell, voltage, disturbance, as well as the device's signal harmonic levels. Three different examples are utilized to assess the device output; these scenarios are explained below. The five cases are individually analyzed with the design parameters of voltage, current, power, and injected power from the DPFC.

Case 1: Analysis of HRES during constant and variable inputs
Here in this case HRES performance is simulated under constant irradiance and wind speed of PV and wind. The input to the PV is set to 1000 W/m 2 and WT velocity to 12 m/s to compensate for the load demand in the system. From Figure 11 we can observe the power produced with the PV and WT sources is 31 kW and 80 W. Thus, the generated power is transferred to meet the load demand. When surplus energy is generated it can be stored in the battery and can be used under critical conditions. Figure 12 shows the battery requirements for SOC and battery capacity Case 2: Analysis of HRES during variable irradiance and wind speed From Figure 13 we can observe the analysis of HRES simulated under variable irradiance and wind speed. The produced power of PV is modified depending on the variance of irradiance since irradiance is directly proportional to the generated power. The power produced by PV is increased if irradiance is increased. Similarly, the pace of WT is increased, as well as the power produced by WT. The analysis of HRES is shown in Table 3.

Case 3: Condition for voltage and current sag
For the stable and linear operation of the device, the voltage sag has to be eliminated. The DPFC is used to provide the necessary power to fulfill the demand for loads and eliminate PQ problems. DPFC designed is used to mitigate the PQ issues related to both voltage and current sag under fault conditions with the proposed controller. The series and shunt active power filters are playing an important role to balance the current and voltage in the HRES system.
In the proposed HRES interface grid-connected system, a three-phase fault has been created. Due to this fault, there is a sudden reduction of voltage and current is observed which is generally termed to be sag. To overcome this condition the proposed DPFC and the controller is designed to operate with the use of the FOPID controller. The optimal pulse is generated using the BWO technique which is used to eliminate the PQ problem and compensate load demand. During a three-phase fault at t = 0.75 s to t = 0.85 s, voltage sag of 200 V is observed as shown in Figure 14a. The sag is then eliminated with the injected voltage of 300 V which can be seen in Figure 14b Figure 15a shows the current decrease during sag of about 0.2A. Figure 15b shows the injected current of 1.8A and Figure 15c shows the compensated load current of 2A.

Case 4: Condition for voltage and current swell
In the proposed HRES interface grid-connected system, a three-phase fault has been created. Due to this fault, there is a sudden increase of voltage and current is observed which is generally termed swell. The swell is characterized as an increased voltage and current concerning reference voltage and current. For the constant operation in the network, the swell produced under fault conditions must be eliminated using the suggested controller. To overcome this condition, the proposed DPFC and the controller is designed to operate with the use of the FOPID controller. The optimal pulse is generated using the BWO technique which is used to eliminate the PQ problem and compensate load demand. During a three-phase fault at t = 0.75 s to t = 0.85 s, a voltage swell of 100 V is observed as shown in Figure 16a. The swell is then eliminated with the absorption voltage of 100 V which can be seen in Figure 16b. From Figure 16c the load voltage after elimination of voltage swell can be observed. Similarly, during t = 0.75 s to 0.85 s, current swell is observed under fault conditions. Figure 17a shows the current increase during sag of about 1.8 A. Figure 17b shows the absorbed current of 1.8 A and Figure 17c shows the compensated load current of 2 A with the assistance of the suggested controller. The PQ problems, and load demand targets are accomplished. To calculate the right error values by choosing optimum device values, the series, and shunt active power filters with

Case 4: Condition for voltage and current swell
In the proposed HRES interface grid-connected system, a three-phase fault has been created. Due to this fault, there is a sudden increase of voltage and current is observed which is generally termed swell. The swell is characterized as an increased voltage and current concerning reference voltage and current. For the constant operation in the network, the swell produced under fault conditions must be eliminated using the suggested controller. To overcome this condition, the proposed DPFC and the controller is designed to operate with the use of the FOPID controller. The optimal pulse is generated using the BWO technique which is used to eliminate the PQ problem and compensate load demand. During a three-phase fault at t = 0.75 s to t = 0.85 s, a voltage swell of 100 V is observed as shown in Figure 16a. The swell is then eliminated with the absorption voltage of 100 V which can be seen in Figure 16b. From Figure 16c the load voltage after elimination of voltage swell can be observed. Similarly, during t = 0.75 s to 0.85 s, current swell is observed under fault conditions. Figure 17a shows the current increase during sag of about 1.8 A. Figure 17b shows the absorbed current of 1.8 A and Figure 17c shows the compensated load current of 2 A with the assistance of the suggested controller. The PQ problems, and load demand targets are accomplished. To calculate the right error values by choosing optimum device values, the series, and shunt active power filters with FOPID controller-based BWO are primarily involved. In the segment below, the voltage disruption situations are evaluated.

Case 5: Condition for voltage and current disruptions
Normally, signal distortion happens as a result of the non-linear load relationship. When a non-linear load is introduced to the load side, the impact of voltage changes in the network is instantly established. The suggested controller is meant to adjust for load demand and PQ difficulties in the device, allowing the HRES device to have a continuous impact. The proposed effect is designed to provide for safe working and PQ problems reduction in the HRES framework under non-linear load, essential load, and unbalanced load situations. The BWO is utilized to offer the optimal gain settings of the FOPID controller to reduce the error value of the V ref and I ref in the signals. The suggested controller would correct for load demand and PQ problems in the HRES framework resulting from a variety of research scenarios. It is compared to previously devised methodologies to validate the proposed system evaluation. The anticipated system's comparative analysis is detailed in the related unit.
From Figure 18a we can observe the variation in three-phase voltages during t = 0.75 s to t = 0.85 s. Figure 18b shows the voltage difference is then corrected with the use of FOPID controller operating series controller of the DPFC which is mainly used to correct the voltage-related issues. In Figure 18c we can observe the load voltage after mitigating the disturbances. Similarly, in Figure 19a we can observe the variation in current from t = 0.75 s to t = 0.85 s due to the sudden changes in load. Figure 19b shows the current has been corrected using the FOPID controller using shunt controller which is used to mitigate the problems related to current. Figure 19c shows the load current after mitigation.

Case 5: Condition for voltage and current disruptions
Normally, signal distortion happens as a result of the non-linear load relationship. When a non-linear load is introduced to the load side, the impact of voltage changes in the network is instantly established. The suggested controller is meant to adjust for load demand and PQ difficulties in the device, allowing the HRES device to have a continuous impact. The proposed effect is designed to provide for safe working and PQ problems reduction in the HRES framework under non-linear load, essential load, and unbalanced load situations. The BWO is utilized to offer the optimal gain settings of the FOPID controller to reduce the error value of the Vref and Iref in the signals. The suggested controller would correct for load demand and PQ problems in the HRES framework resulting from a variety of research scenarios. It is compared to previously devised methodologies to validate the proposed system evaluation. The anticipated system's comparative analysis is detailed in the related unit.
From Figure 18a we can observe the variation in three-phase voltages during t = 0.75 s to t = 0.85 s. Figure 18b shows the voltage difference is then corrected with the use of FOPID controller operating series controller of the DPFC which is mainly used to correct the voltage-related issues. In Figure 18c we can observe the load voltage after  Figure 19a we can observe the variation in current from t = 0.75 s to t = 0.85 s due to the sudden changes in load. Figure 19b shows the current has been corrected using the FOPID controller using shunt controller which is used to mitigate the problems related to current. Figure 19c shows the load current after mitigation.

Comparison Analysis
PQ issues in the HRES integrated system are analyzed with the use of the FOPID-based BWO technique with DPFC address issues like sag, swell, disruptions, and THD reduction. The FOPID controller is optimized with the proposed technique and compared with various existing methods, and we have proven that the proposed technique gives the best results. In this section, the results from Figure 20 represent the comparative analysis of HRES powers. In Figure 21a a real power comparison and Figure  21b reactive power comparison can be seen which is compared with PI controller, PSO, Cuckoo, GA, GSA, BBO, Whale, ESA, RFA, ASO, EVORFA, and BWO. Figure 22a depicts THD analysis before compensation and after compensation. Figure 22b shows the THD analysis of various existing methods. The proposed HRES integrated system with BWO controller reduced the THDs, which falls within the limits of IEEE 519 standards. Table 5 provides the THD analysis before DPFC and Table 6 after DPFC.

Comparison Analysis
PQ issues in the HRES integrated system are analyzed with the use of the FOPIDbased BWO technique with DPFC address issues like sag, swell, disruptions, and THD reduction. The FOPID controller is optimized with the proposed technique and compared with various existing methods, and we have proven that the proposed technique gives the best results. In this section, the results from Figure 20 represent the comparative analysis of HRES powers. In Figure 21a a real power comparison and Figure 21b reactive power comparison can be seen which is compared with PI controller, PSO, Cuckoo, GA, GSA, BBO, Whale, ESA, RFA, ASO, EVORFA, and BWO. Figure 22a depicts THD analysis before compensation and after compensation. Figure 22b shows the THD analysis of various existing methods. The proposed HRES integrated system with BWO controller reduced the THDs, which falls within the limits of IEEE 519 standards. Table 5 provides the THD  analysis before DPFC and Table 6 after DPFC.

Conclusions
Power quality improvement in HRES grid-connected systems has become a more advanced research area in DG integrated with HRES systems to eliminate PQ problems. With the use of non-linear loads, instability load, and high-frequency switching characteristics on the load side, PQ issues in the device are increased. FACT devices are playing an important role in solving the PQ issues in the HRES integrated system. DPFC is proposed to solve the PQ problems and compensate for the load demand. The HRES system is modeled with a DPFC device with a BWO-FOPID controller. DPFC is equipped with two proposed controllers, series active power filters and shunt active power filters. With the utilization of the DPFC system, the voltage and existing PQ problems are mitigated. In MAT-LAB/Simulink framework, the proposed approach was designed and validated. To verify the proposed procedure, three separate cases are evaluated by connecting non-linear loads such as sag, swell, disruption, and harmonics on the grid side. The proposed BWO-based FOPID controller is compared with P&O, PSO, Cuckoo, GA, GSA, BBO, Whale, ESA, RFA, ASO, EVORFA, and PI. The efficiency of the proposed approach has obtained the strongest results in terms of THD.

Conflicts of Interest:
The authors declare no conflict of interest. Three-phase reference voltages V sa , V sb , V sc Three-phase supply voltages X 1 and X 2 Parents Y 1 and Y 2 Ancestors