Optimal Power Flow Controller for Grid-Connected Microgrids using Grasshopper Optimization Algorithm

Despite the vast benefits of integrating renewable energy sources (RES) with the utility grid, they pose stability and power quality problems when interconnected with the existing power system. This is due to the production of high voltages and current overshoots/undershoots during their injection or disconnection into/from the power system. In addition, the high harmonic distortion in the output voltage and current waveforms may also be observed due to the excessive inverter switching frequencies used for controlling distributed generator’s (DG) power output. Hence, the development of a robust and intelligent controller for the grid-connected microgrid (MG) is the need of the hour. As such, this paper aims to develop a robust and intelligent optimal power flow controller using a grasshopper optimization algorithm (GOA) to optimize the dynamic response and power quality of the grid-connected MG while sharing the desired amount of power with the grid. To validate the effectiveness of proposed GOA-based controller, its performance in achieving the desired power sharing ratio with optimal dynamic response and power quality is compared with that of its precedent particle swarm optimization (PSO)-based controller under MG injection and abrupt load change conditions. The proposed controller provides tremendous system’s dynamic response with minimum current harmonic distortion even at higher DG penetration levels.


Introduction
During the last few decades, the use of electrical energy has increased almost exponentially due to rapidly increasing population. This increases the burden on the existing power system and causes the overloading of electric power generators, transmission lines, and distribution transformers. To overcome the stated issues, deployment of green energy sources into the existing power system has become essential in order to relieve the existing power system from overloading and to produce cheaper electricity with reduced carbon footprints. These distributed generators (DG) can be integrated together along with energy storage devices to form a microgrid (MG). Basically, MG is an electrical network, consisting of DGs like solar photovoltaic (PV), wind turbines, fuel cells, and microturbines in order to evaluate the power quality analysis of the studied power system, the harmonic analysis of the system output current waveform is undertaken using the fast Fourier transform (FFT). Finally, to prove the performance superiority of the developed control strategy, a comparison between PSO and GOA is carried out based on the most optimal selection of PI parameters that provides an optimal transient response of the considered grid-connected MG system. The high DG penetration (100kW, 70kVAR) is also one of the major outlooks of this research work.
The rest of the paper is structured as follows. Section 2 of this research work explicitly elaborates the research studies undertaken in the stated field of research. In Section 3, mathematical modeling of the studied grid-connected MG with its control strategy is developed. Section 4 discusses the formulation of fitness function for the proposed control system. A detailed elaboration of GOA has been provided in Section 5. Section 6, provides the simulation results and their analysis which duly endorses the fulfillment of the objectives of this study, and in the end, the conclusion section provides summary of this study in Section 7.

Background of Study
A general structure of MG along with the utility grid is shown in Figure 1. and GOA is carried out based on the most optimal selection of PI parameters that provides an optimal transient response of the considered grid-connected MG system. The high DG penetration (100kW, 70kVAR) is also one of the major outlooks of this research work. The rest of the paper is structured as follows. Section 2 of this research work explicitly elaborates the research studies undertaken in the stated field of research. In Section 3, mathematical modeling of the studied grid-connected MG with its control strategy is developed. Section 4 discusses the formulation of fitness function for the proposed control system. A detailed elaboration of GOA has been provided in Section 5. Section 6, provides the simulation results and their analysis which duly endorses the fulfillment of the objectives of this study, and in the end, the conclusion section provides summary of this study in Section 7.

Background of Study
A general structure of MG along with the utility grid is shown in Figure 1.  Figure 1 depicts a general arrangement of an MG which consists of two renewable energy sources (RES) as DGs and a battery bank for power storage, each one of them is connected to the point of common coupling (PCC) through a DC to AC or AC to AC power electronic interface. Three single-phase or three-phase loads are connected to the PCC while the local load may be directly connected to any of the DGs using a circuit breaker so as to receive the electric power supply even when there is a fault at the PCC. The power electronic interfaces are used to connected DGs with each other and with the grid by using a nonlinear interfacing device such as a voltage source inverter (VSI) [17]. The major drawback linked with the usage of these nonlinear interfacing devices is that they produce the harmonics and hence distort the output power quality. This is because of the reason that these devices generate high switching pulses which produces nonlinearity between the current and voltage [18]. This is the reason MG faces severe power quality challenges, especially while integrating a huge number of DGs [19]. To attain smooth operation of the MG system and to achieve high-power quality with successful accomplishment of the control objectives, an intelligent and robust control architecture is a fundamental requirement for both islanded and grid-connected modes of MG operation. However, while looking at the growing modern trend of integrating the MGs into existing power system for maximizing the power system reliability, this research work is purely carried out for grid-connected mode only.  Figure 1 depicts a general arrangement of an MG which consists of two renewable energy sources (RES) as DGs and a battery bank for power storage, each one of them is connected to the point of common coupling (PCC) through a DC to AC or AC to AC power electronic interface. Three single-phase or three-phase loads are connected to the PCC while the local load may be directly connected to any of the DGs using a circuit breaker so as to receive the electric power supply even when there is a fault at the PCC. The power electronic interfaces are used to connected DGs with each other and with the grid by using a nonlinear interfacing device such as a voltage source inverter (VSI) [17]. The major drawback linked with the usage of these nonlinear interfacing devices is that they produce the harmonics and hence distort the output power quality. This is because of the reason that these devices generate high switching pulses which produces nonlinearity between the current and voltage [18]. This is the reason MG faces severe power quality challenges, especially while integrating a huge number of DGs [19]. To attain smooth operation of the MG system and to achieve high-power quality with successful accomplishment of the control objectives, an intelligent and robust control architecture is a fundamental requirement for both islanded and grid-connected modes of MG operation. However, while looking at the growing modern trend of integrating the MGs into existing power system for maximizing the power system reliability, this research work is purely carried out for grid-connected mode only.
IY Chung et al. [20] designed a controller for both islanded and grid-connected MG where the PSO was utilized to select the optimal PI parameters. The proposed controller was able to optimize the system's dynamic and steady response in terms of regulating power flow during load changes and islanding conditions; however, there is a huge variation in the output power curves in steady state condition. This affects the power quality of the output and may not be suitable for sensitive loads. In addition, the final optimized value of the fitness function was achieved in around 480 iterations, which makes the optimization process very sluggish. Furthermore, the same authors have extended their previous research work and managed to expedite the convergence of PSO to get the final optimized value of fitness function within 10 iterations. The oscillations in the output power curves were also reduced but they were yet in the range of kWs, which makes it unsuitable for supplying sensitive loads. Furthermore, the power quality analysis was not undertaken in the referred research. Hassan and Abido [21], have mathematically modeled an MG along with PSO-based controller for both islanded and grid-connected MG operating modes. The values of the Resistive, Inductive and Capacitive (RLC) filter, damping resistance, and PI controller parameters were optimized for the grid-connected MG. The minimization of fitness function was obtained within 20 iterations of the simulation run and very smooth power curves were obtained during steady state condition; however, the analysis was made at very low power ratings of load and DG (maximum 10 kW and 10 KVA respectively). Besides, a huge settling time (~1 s) was observed during a very small load change of 5.8 kW. In addition, PSO-based power flow controller for grid-connected MG was also developed by Al-Saedi et al. in [3]. The PSO-based controller managed to achieve the prescribed ratio of power from DG before and after load change with minimum settling time (0.05 sec). The parameter which is further needed to be improved in this case is the overshoot in the grid power which is more than thrice as much as the rated value. However, the power quality analysis was not being studied in the referred study. Another relevant contribution of this study [3] is the high MG penetration level into the existing power system with the optimal transient response and distortion-less output power quality.
Given the above summary of relevant literature where in key studies Al-Saedi et al. [3], Hong et al. [11], and Hassan & Abido [21], the DG penetration levels up to 50 kW, 15 kW, and 16.9 kW were considered, respectively, this study employs GOA technique to optimize the dynamic response and power quality of the grid-connected MG at a much higher DG penetration level of 100 kW.

Modeling of Grid-Connected Microgrid with Proposed Control Strategy
The block diagram of the developed GOA-based power flow control architecture for the studied grid-connected MG is illustrated in Figure 2. In Figure 2, , and , represent the output currents and voltages in the d-q reference frame, respectively. , , and refer to the resistance, inductance, and capacitance, respectively, of each phase of the low pass filter (LPF). C represents the dc side capacitance; and refer to the MG's three phase current and voltage, respectively; is the utility grid voltage; refers to the angular frequency of the inverter's output voltage; p and q are the active and reactive power of DGs, respectively; * and * represent the reference active and reactive powers for DG units, respectively; * , * and * , * denote the reference voltages and currents in d and q axes, respectively; and and refer to the reference voltage signals for the in the alpha-beta (αβ) frame of reference.
The power circuit consists of two solar PV modules, DC-DC boost converter circuit, a six pulse three phase VSI, a coupling inductor, a RLC lower pass filter, and a three-phase delta connected load. The DC-DC boost converter, which utilizes the Perturb and Observe (P & O) algorithm for maximum power point tracking (MPPT), is deployed at the output terminals of solar PV modules in order to improve the voltage profile of PV panels and to obtain the maximum available power from them. To attenuate the out voltage and current fluctuations caused by the insulated-gate bipolar transistor (IGBT) switching, a low-pass filter is used. Two PI controllers each for power and current control loops are used to minimize the power and current error respectively. Since the PI controllers used to operate on the stationary current and voltages signals, the power and current control are carried out in the direct-quadrature (dq) reference frame [22]. To get the reference angle (θ) for converting threephase current and voltage signals into dq frame of reference, a phase-locked loop (PLL) is used. The MG power is injected into the main grid by using a three-phase circuit breaker. Two three-phase loads of 100 kW, 40 kVAR (AC Load1) and 90 kW, 40 kVAR (AC load2) are also connected to the power system through circuit breakers. Load 1 is connected to the network since start till the end of the simulation while load 2 is connected to the network at 0.2 s of the simulation run. The detailed discussion of the proposed power flow controller along with its mathematical modeling is provided in the following subsection.

Proposed GOA-Based Optimal Power Flow Controller
A detailed diagram of the proposed GOA-based power flow controller for the grid-connected MG is shown in Figure 3. In Figure 2, i d , i q and v d , v q represent the output currents and voltages in the d-q reference frame, respectively. R f , L f , and C f refer to the resistance, inductance, and capacitance, respectively, of each phase of the low pass filter (LPF). C represents the dc side capacitance; i abc and v abc refer to the MG's three phase current and voltage, respectively; V g is the utility grid voltage; w o refers to the angular frequency of the inverter's output voltage; p and q are the active and reactive power of DGs, respectively; P * and Q * represent the reference active and reactive powers for DG units, respectively; v * d , v * q and i * d , i * q denote the reference voltages and currents in d and q axes, respectively; and v α and v β refer to the reference voltage signals for the in the alpha-beta (αβ) frame of reference.
The power circuit consists of two solar PV modules, DC-DC boost converter circuit, a six pulse three phase VSI, a coupling inductor, a RLC lower pass filter, and a three-phase delta connected load. The DC-DC boost converter, which utilizes the Perturb and Observe (P & O) algorithm for maximum power point tracking (MPPT), is deployed at the output terminals of solar PV modules in order to improve the voltage profile of PV panels and to obtain the maximum available power from them. To attenuate the out voltage and current fluctuations caused by the insulated-gate bipolar transistor (IGBT) switching, a low-pass filter is used. Two PI controllers each for power and current control loops are used to minimize the power and current error respectively. Since the PI controllers used to operate on the stationary current and voltages signals, the power and current control are carried out in the direct-quadrature (dq) reference frame [22]. To get the reference angle (θ) for converting three-phase current and voltage signals into dq frame of reference, a phase-locked loop (PLL) is used. The MG power is injected into the main grid by using a three-phase circuit breaker. Two three-phase loads of 100 kW, 40 kVAR (AC Load1) and 90 kW, 40 kVAR (AC load2) are also connected to the power system through circuit breakers. Load 1 is connected to the network since start till the end of the simulation while load 2 is connected to the network at 0.2 s of the simulation run. The detailed discussion of the proposed power flow controller along with its mathematical modeling is provided in the following subsection.

Proposed GOA-Based Optimal Power Flow Controller
A detailed diagram of the proposed GOA-based power flow controller for the grid-connected MG is shown in Figure 3.  At starting the measured voltage and current at the PCC is converted to the dq reference frame using the following transformation equations.
This abc to dq transformation is necessary because of the fact that the PI controller does not work on sinusoidal waveforms. They always need stationary reference values to perform the required control task. The rotational frame angle θ is derived from PLL and is utilized to convert the current and voltage from the abc to dq and vice versa. The active and reactive power is calculated in the power calculation block using the following equations.
In order to remove the high switching frequency ripples, an LPF is placed in the controller circuit before the power controller. The transfer function model of the LPF is given in Equations (5) and (6).
where wc is the cut-off frequency for the filter. The power controller is employed to produce the reference current signal for the current controller. It consists of two conventional PI regulators whose gain values are selected by GOA optimizer. In this block, the measured inverter power is compared At starting the measured voltage and current at the PCC is converted to the dq reference frame using the following transformation equations.
This abc to dq transformation is necessary because of the fact that the PI controller does not work on sinusoidal waveforms. They always need stationary reference values to perform the required control task. The rotational frame angle θ is derived from PLL and is utilized to convert the current and voltage from the abc to dq and vice versa. The active and reactive power is calculated in the power calculation block using the following equations.
In order to remove the high switching frequency ripples, an LPF is placed in the controller circuit before the power controller. The transfer function model of the LPF is given in Equations (5) and (6).
where w c is the cut-off frequency for the filter. The power controller is employed to produce the reference current signal for the current controller. It consists of two conventional PI regulators whose gain values are selected by GOA optimizer. In this block, the measured inverter power is compared with that of the reference power (set-point). Two PI controllers are used to eliminate the difference between the measured and the reference values of active and reactive power. It may be noted that in order to avoid the old, inaccurate, and lengthy methods of PI tuning, we use the intelligence of one of the most modern optimization algorithms-GOA-to select the best values of the both PI controllers to achieve an optimal dynamic response which is very crucial in most modern MG systems and is the aim of the current research work. The mathematical equations that represent the dynamics of the power controller are expressed as follows.
The reference currents (i * d and i * q ) calculated by the power controller block are then fed to the current controller. The aim of using the current controller is to accurately track the current signal and remove short current transients. Two conventional PI controllers are employed in order to minimize the current error. Subsequently, the output reference voltage signals (v * d and v * q ) are converted into αβ reference frame by using well known Clarke's transformation. Finally, SVPWM block is used to produce controlled gate pulses for the inverter. The use of the SVPWM technique for generating controlled firing pulses for the IGBT inverter ensures the distortion less output voltage waveform [23], which can also be confirmed from the outcomes of this study. Mathematically, the function of the current controller can be depicted as Since the intelligence of GOA is used in the power controller block for PI tuning purpose, therefore, the optimization of the current controller's PI gains is not required, and hence both PI regulators are used with static gains whose values are taken from reference [3]. Furthermore, optimizing the current controller parameters would result in increased complexity in the optimization process due to the increased number of optimization variables. The output signal from the current controller is converted from the d-q to αβ reference frame and finally fed to the Space Vector Pulse Width Modulation (SVPWM). The controlled pulses are then used for switching the VSI so that a controlled amount of power may be injected into the power system with excellent power quality.

Formulation of Fitness Function
As the output power of the power system changes abruptly due to the abrupt load changes and DG's injection or disconnection throughout the day, using unoptimized parameters for the controller may result in an abnormal operating condition such as large overshoots, which may cause the system to enter the instability region. Hence, the proper PI parameters tuning is essential to ensure improved dynamic performance of the system and enhanced power quality during the MG injection and abrupt load changes. Keeping in view the above-mentioned problem, the parameters of the two PI regulators (K pq , K pi , K pq , and K iq ) are used in the power control loop of the proposed power flow controller and optimized using the intelligence of one of the most modern soft-computational algorithms called GOA. The optimization process of the PI parameters in GOA-based system is commenced by minimizing an error integrating FF. The Integral Time Absolute Error (ITAE) is the most widely used error integrating fitness function referred the literature due to its smoother employment and better outcomes as compared to its contenders like integral square error (ISE), integral absolute  [24,25]. The ISE and ITSE are very violent criterions due to the squaring of error, and hence produce impractical results. Further, compared to the ITAE, the IAE is also an inadequate choice as ITAE, owing to the integration of the time multiplying error function, provides more realistic error indexing. Therefore, the ITAE is formulated as the FF for optimized active and reactive power regulation in this study. ITAE is defined mathematically by Equations (11) and (12): where t is the simulation time and e(t) refers to the error signal which can be calculated by subtracting the DG's measured power value form the reference power (set-point). The e p and e q refer to the active and reactive power errors, respectively. To avoid the complexity in the optimization process, the overall FF, which needs to be minimized by the GOA, is formulated by adding DG's error integrating functions (ITAE 1 and ITAE 2) of active and reactive powers arithmetically, as provided in Equation (13).
It is important to understand that optimization of control parameters (K pq , K pi , K pq , and K iq ) can only be guaranteed when the formulated FF provides minimum value which in turn ensures the optimal transient response of the considered grid-connected MG system. The GOA coding, with a given number of iterations, particles, and variables along with the fitness function evaluation, has been carried out in MATLAB editor window, while the model for the studied grid-connected MG with the proposed control scheme is modeled in the MATLAB/SIMULINK software (version 2018b, MathWorks, MA, USA). The ITAE value for the PI regulators is calculated and added in SIMULINK environment before sending it to the MATLAB workspace where the GOA's intelligence is exploited to minimize the formulated FF. Finally, once the maximum iterations are reached, the optimized PI coefficients are fed to the PI regulators in MATLAB/SIMULINK model to attain the optimal transient behavior of the developed grid-connected MG system. This is how the proposed controller achieves the optimal power-sharing between MG and the main grid with minimum overshoot and harmonic distortion for the complete simulation time of the developed grid-connected MG system.

Grasshopper Optimization Algorithm for Active-Reactive Power Control
GOA was proposed in 2017 by Saremi et al. [26]. Grasshoppers are labeled as a pest due to their crop-damaging behavior. The life cycle of a grasshopper is shown in Figure 4. The three key stages of a grasshopper's lifecycle, as shown in Figure 4, are egg, nymph, and adult. Formation of the swarm in both nymph and adulthood is one of the exceptional features of the grasshopper swarm [27]. provides more realistic error indexing. Therefore, the ITAE is formulated as the FF for optimized active and reactive power regulation in this study. ITAE is defined mathematically by Equations (11) and (12): where t is the simulation time and e(t) refers to the error signal which can be calculated by subtracting the DG's measured power value form the reference power (set-point). The ep and eq refer to the active and reactive power errors, respectively. To avoid the complexity in the optimization process, the overall FF, which needs to be minimized by the GOA, is formulated by adding DG's error integrating functions (ITAE 1 and ITAE 2) of active and reactive powers arithmetically, as provided in Equation (13).
It is important to understand that optimization of control parameters (Kpq, Kpi, Kpq, and Kiq) can only be guaranteed when the formulated FF provides minimum value which in turn ensures the optimal transient response of the considered grid-connected MG system. The GOA coding, with a given number of iterations, particles, and variables along with the fitness function evaluation, has been carried out in MATLAB editor window, while the model for the studied grid-connected MG with the proposed control scheme is modeled in the MATLAB/SIMULINK software (version 2018b, MathWorks, MA, USA). The ITAE value for the PI regulators is calculated and added in SIMULINK environment before sending it to the MATLAB workspace where the GOA's intelligence is exploited to minimize the formulated FF. Finally, once the maximum iterations are reached, the optimized PI coefficients are fed to the PI regulators in MATLAB/SIMULINK model to attain the optimal transient behavior of the developed grid-connected MG system. This is how the proposed controller achieves the optimal power-sharing between MG and the main grid with minimum overshoot and harmonic distortion for the complete simulation time of the developed grid-connected MG system.

Grasshopper Optimization Algorithm for Active-Reactive Power Control
GOA was proposed in 2017 by Saremi et al. [26]. Grasshoppers are labeled as a pest due to their crop-damaging behavior. The life cycle of a grasshopper is shown in Figure 4. The three key stages of a grasshopper's lifecycle, as shown in Figure 4, are egg, nymph, and adult. Formation of the swarm in both nymph and adulthood is one of the exceptional features of the grasshopper swarm [27].  A key feature of grasshopper's swarm is searching for a food source. During food source searching process, the grasshoppers perform both exploitation (local searching) and exploration (Global searching) during nymph and adulthood, respectively. This exceptional property of grasshoppers makes them an excellent choice for molding their behavior into an optimization algorithm. The researchers Saremi et al. [26] have investigated this exceptional behavior of the grasshoppers and have mathematically modeled its behavior with great accuracy. A new metaheuristic optimization algorithm hence formed was named as "Grasshopper Optimization Algorithm". They have mathematically modeled the grasshopper's swarming behavior as given in Equation (14) [28].
where X i is the i-th grasshopper's position, C i represents social force of interaction for i-th grasshopper, G i defines the force of gravity on the i-th grasshopper, and W i denotes the wind advection force. Like all other metaheuristic optimization algorithms, the authors provided the randomness in Equation (15) as follows.
where r 1 , r 2 , and r 3 represent the random numbers in the range of [0, 1].
where d ij denotes the distance between the grasshopper i and j and is calculated as d ij = x j − x i ; x i and x j being the position of grasshopper i and j, respectively, N represents the total number of search agents (grasshoppers),d ij represents the unit vector from the grasshopper i to the grasshopper j, and c is a function which defines the social force strength and is calculated as follows.
where f represents the attraction strength and l is the attractive length scale. The component G i used in Equation (14) can be calculated by using the following equation.
where g is the acceleration constant of gravity andê g is a unit vector, directing towards the center of the earth. The W i component in Equation (14) can be calculated as where u is drift constant andê w represents the unity vector in the direction of wind. By substituting the values of C i , G i , and W i in Equation (14) the updated equation obtained is depicted as An improved version of the Equation (20) is formulated as given in Equation (21): where L u denotes the upper limit and L l represents the lower limit in the D-th dimension, k denotes the magnitude of particles for the current iteration, k + 1 is the magnitude of particles for the succeeding iteration, andT d represents the magnitude of the D-th dimension in the target which is actually the best possible solution explored till that time. It may be noted here that, in order to make balance between the exploitation and exploration properties of GOA, the coefficient b must be reduced in proportion to the increasing iteration number. This enhance the searching capability of GOA, as with the growing iteration number, the coefficient b decreases the comfort zone proportionately and is found by using following mathematical expression.
where b max denotes the maximum coefficient value, b min represents the minimum value of coefficient b, k denotes the number of current iteration, and K max represents the total iterations. A comprehensive flowchart of GOA employment in the designed control architecture is depicted in Figure 5. Like all other metaheuristic optimization techniques, GOA places some random searching agents within a specified boundary in the search space. These particles are then allowed to move in the search area based on the operating equations of the GOA in order to optimize the given FF which is minimization in this study. The optimized parameters obtained at the end of the simulation are implanted into the PI controllers and hence the optimized transient response of the considered grid-connected MG is obtained. To validate the superior optimization capability of GOA, a series of tests were carried out by its originators Saremi et al. [26]. The referred study compared the optimizing capability of GOA with other renowned optimization methods like genetic algorithm, differential evolution, and PSO, which are mainly based on the convergence and quality of the solution. The outcome of the referred research work shows that the GOA is much better than its counterpart optimization algorithms in balancing the exploration versus exploitation properties. Moreover, recently the GOA algorithm was used to address some of the most significant engineering problems, such as optimal allocation of compensators [29], optimal placement of distributed generators [30], load forecasting [31], optimal sizing of DGs [32], and voltage-frequency control of an islanded MG [1]. These studies have verified the GOA effectiveness in solving the mentioned optimization problems much better than the old and traditional optimization methods.

Simulation Results
In order to evaluate the performance of the developed power flow controller in obtaining the optimal dynamic response with high power quality and power-sharing, the developed model for grid-connected MG is simulated in MATLAB/SIMULINK environment. The power curves for the DG, utility grid, and the load were obtained using optimal PI values selected by GOA. The power quality analysis has also been undertaken to analyze the harmonic content present in the output current waveform. Finally, to validate the effectiveness of the proposed control strategy, the obtained results from the GOA-based controller are compared with that of the PSO-based controller for similar working conditions. In order to commence an impartial comparison, the number of iterations and particles are set to be 100 and 50, respectively, for both PSO and GOA algorithm. The search space boundaries for all four optimization variables (K pp , K ip , K pq , and K iq ) are kept within the range of 0 to 100. A pair of solar PV modules, 60 kW each, has been used. The sampling time is taken as 2 × 10 −6 s, which in turn decides the sampling frequency, i.e., 500 kHz. The model parameters include; filter capacitance C f = 2500 µF, filter inductance L f = 0.94 mH, coupling inductance L c = 5 mh, f = 50 Hz; the DC side capacitor is set to have 20mF capacitance. Moreover, the PI parameters used in the current control loop are kept as K i = 0.00215 and K p = 12.656. For the SVPWM-based VSI, the sampling and switching frequencies were fixed at 500 kHz and 10 kHz, respectively. The effectiveness of the proposed GOA-based controller has been evaluated for the following three cases.

Active and Reactive Power Control during MG Injection and Abrupt Load Change
The key parameter of measurement in the grid-connected mode of MG operation is the desired ratio of power-sharing among the DG and the grid with an optimal dynamic response. The controller is set so as to follow the set power values defined by the user during DGs injection and abrupt load change conditions with minimum settling time and overshoot. Once the power flow control molded using GOA, the MATLAB code is run from the editor window; the GOA begins searching the best combination of PI gains, which provides the minimum value of the formulated FF. The GOA's intelligence is used to attain the optimal parameters of two PI regulators used in the power controller block. The selection of optimal parameters is ensured by minimizing the error integrating fitness function which in turn ensures the optimal transient response of the MG system. Both DGs are inserted to the grid through a three-phase circuit breaker at 0.05 s of the simulation run. The corresponding response is shown in Figure 6a,b.
As can be seen from Figure 6a,b, the DGs starts supporting the utility grid once they are connected to the power system by sharing 60 kW of active and 50 kVAR of reactive power according to the set values of power. It is pertinent to mention that before the MG was connected to the power system network, the load power was completely supplied by the utility grid and hence the power output of the DG units is zero. At 0.2 s simulation time, another load of 90 kW and 40 kVAR is inserted into the studied grid-connected MG system. As can be seen from Figure 6, the DG shares almost half of the additional load (40 kW, 20 kVAR) as per the defined power values are given as set points to the controller. It may be noted that the overshoot in active and reactive power curves is a function of PI regulator gain; hence, their optimal selection by an intelligent method can reduce the power overshoots to their minimum level. However, these overshoots cannot be completely eliminated due to the large power system inertia in grid-connected mode of MG operation. Figure 7 shows the complete power flow between the AC utility grid and MG along with the load line.
It can be seen from Figure 7 that from 0 to 0.05 s, the complete load (100 kW, 40 kVAR) is supported by the grid as the DGs remain disconnected from the network during this time. Hence, the power supplied by the grid is almost equal to the load connected. Once the MG is connected to the network at 0.05 s, it shares the power according to the set power ratio (60 kW, 50 kVAR) of the total load at that time. As a result, the power supplied by the grid is lowered from 100 kW, 38 kVAR to 50 kW, −2 kVAR. It may be noted that the power consumed by the load is always equal to the addition of power supplied by the grid and the power supplied by the MG. Hence during the peak load hours of the day, the MG may be injected to relieve the utility grid (or vice versa) of supplying additional power which may otherwise result in an abnormal condition like load shedding or voltage drop. In order to test the performance of the developed controller during abrupt load changes, an additional load of 90 kW, 40 kVAR is inserted in to system at 0.2 s. Hence the total load has been increased from 100 kW, 40 kVAR to 190 kW, 90 kVAR. Yet again, the MG shares the part of the additional load as per the set power values (40 kW, 20 kVAR) with an excellent dynamic response. The performance of the proposed GOA-based controller in sharing the predefined active and reactive power with the utility grid with minimum overshoot and settling time validate its successful implementation. As can be seen from Figure 6 a,b, the DGs starts supporting the utility grid once they are connected to the power system by sharing 60 kW of active and 50 kVAR of reactive power according to the set values of power. It is pertinent to mention that before the MG was connected to the power system network, the load power was completely supplied by the utility grid and hence the power output of the DG units is zero. At 0.2 s simulation time, another load of 90 kW and 40 kVAR is inserted into the studied grid-connected MG system. As can be seen from Figure 6, the DG shares almost half of the additional load (40 kW, 20 kVAR) as per the defined power values are given as set points to the controller. It may be noted that the overshoot in active and reactive power curves is a function of PI regulator gain; hence, their optimal selection by an intelligent method can reduce the power One of the key features of this study is the high MG penetration of 100 KW into the existing power system compared to the previous research work Hong et al. [11], Hassan & Abido [21] and Al-Saedi et al. [3] where the authors have worked with DG penetration levels up to 15 kW, 16.9 kW, and 50 kW respectively. Furthermore, this study result demonstrates better dynamic response while controlling DG's active and reactive power than the referred research work. For instance, the percentage overshoot in DG's active power caused by the DG injection in Al-Saedi et al. [3] is~180% which is achieved as 94.40% in this study. In addition, the percentage overshoot for the active load power curve during the MG injection and a step load change in this study is 12.96% and 2.63%, respectively, which is also far better compared to PSO-based controller presented in the reference [3] where the values for the same parameters are around 108.50% and 81.81%, respectively. Hence, it can be concluded that the proposed grid-connected MG power flow controller with GOA-based parameters selection provide better dynamic response than the previously used PSO-based power flow controllers for the same research objectives. overshoots to their minimum level. However, these overshoots cannot be completely eliminated due to the large power system inertia in grid-connected mode of MG operation. Figure 7 shows the complete power flow between the AC utility grid and MG along with the load line.

Power Quality Analysis
The MG is generally connected to the main grid using a nonlinear power electronic converter or inverter. This power electronic device may produce nonlinearity and high switching frequency contents (harmonics) in the voltage and current waveforms if not properly controlled. Hence, a proper control strategy is needed for switching VSI in order to regulate the active and reactive power according to the reference values and to avoid the power quality issues. The proposed GOA-based control strategy has been found superior in regulating active and reactive power with optimal dynamic response and high-power quality. The FFT analysis of the inverter output current waveform has been made for both of the studied conditions, i.e., MG injection and abrupt load change are depicted in Figure 8a,b respectively. As can be observed from the FFT analysis, the current harmonic contents after MG insertion (0.07%) and load change (0.09%) are way below 5% and hence satisfies the IEEE standards 929-2000 [33]. This verifies the superior performance of the developed controller in maintaining the desired quality of power while meeting the power-sharing objectives. Moreover, the power quality achieved in this study is too far better than that of in the Zhang et.al [34] and Vinayagam et.al [35] where the %THD was recorded as 1.06% and 3.93%, respectively. In summary, it is established that the As can be observed from the FFT analysis, the current harmonic contents after MG insertion (0.07%) and load change (0.09%) are way below 5% and hence satisfies the IEEE standards 929-2000 [33]. This verifies the superior performance of the developed controller in maintaining the desired quality of power while meeting the power-sharing objectives. Moreover, the power quality achieved in this study is too far better than that of in the Zhang et al. [34] and Vinayagam et al. [35] where the %THD was recorded as 1.06% and 3.93%, respectively. In summary, it is established that the developed GOA-based MG power-sharing controller provides better power quality than previously used PSO-based MG controllers for the same working conditions.

Comparison of Proposed GOA with the PSO-Based Controller
In this case, the performance of the GOA-based MG power-sharing controller is compared with that of the PSO-based controller with the same fitness function and operating conditions. This has been accomplished by using the intelligence of two different soft-computational algorithms (PSO and GOA) for minimizing the same FF separately. Since both the metaheuristic optimization methods are basically stochastic in nature and their operation is based on the generation of random numbers for placing search agents in the search space, the model has been simulated for 20 times to extract the statistical data from results. As the main objective was to minimize the FF, consequently its least value is taken as the best value. The convergence curve for the studied optimization algorithms with the same number of particles and iterations is shown in Figure 9. developed GOA-based MG power-sharing controller provides better power quality than previously used PSO-based MG controllers for the same working conditions.

Comparison of Proposed GOA with the PSO-Based Controller
In this case, the performance of the GOA-based MG power-sharing controller is compared with that of the PSO-based controller with the same fitness function and operating conditions. This has been accomplished by using the intelligence of two different soft-computational algorithms (PSO and GOA) for minimizing the same FF separately. Since both the metaheuristic optimization methods are basically stochastic in nature and their operation is based on the generation of random numbers for placing search agents in the search space, the model has been simulated for 20 times to extract the statistical data from results. As the main objective was to minimize the FF, consequently its least value is taken as the best value. The convergence curve for the studied optimization algorithms with the same number of particles and iterations is shown in Figure 9. Two of the most important parameters to evaluate the optimization speed and quality of the solution, for any optimization algorithm, are the convergence rate and the final optimized convergence value of fitness function. The convergence rate decides the time for obtaining final optimized value while the final minimized or maximized the value of the convergence curve decides the quality of the obtained solution. In this case the minimization of FF is required in order to obtain most optimal dynamic response of the studied system. Therefore, the smaller the FF's final obtained value, the greater will be the quality of solution and hence better will be the dynamic response of the studied power system. On the other side, the greater the convergence rate, less will the number of iterations and time for achieving an optimal solution [1]. Unlike online optimization where convergence time is very important as compared to the quality of the solution, in all offline optimization processes, the quality of the solution is more significant as compared to the time consumption [1]. It is obvious from Figure 9 that the GOA-based power-sharing controller attains a better optimal solution and is much faster compared to the PSO-based MG power-sharing controller for the same system configuration and operating conditions. Table 1 provides the final minimized values and the number of iterations for which the optimized values of the FF has been achieved. Two of the most important parameters to evaluate the optimization speed and quality of the solution, for any optimization algorithm, are the convergence rate and the final optimized convergence value of fitness function. The convergence rate decides the time for obtaining final optimized value while the final minimized or maximized the value of the convergence curve decides the quality of the obtained solution. In this case the minimization of FF is required in order to obtain most optimal dynamic response of the studied system. Therefore, the smaller the FF's final obtained value, the greater will be the quality of solution and hence better will be the dynamic response of the studied power system. On the other side, the greater the convergence rate, less will the number of iterations and time for achieving an optimal solution [1]. Unlike online optimization where convergence time is very important as compared to the quality of the solution, in all offline optimization processes, the quality of the solution is more significant as compared to the time consumption [1]. It is obvious from Figure 9 that the GOA-based power-sharing controller attains a better optimal solution and is much faster compared to the PSO-based MG power-sharing controller for the same system configuration and operating conditions. Table 1 provides the final minimized values and the number of iterations for which the optimized values of the FF has been achieved. Once the simulation is commenced, the metaheuristic algorithms start searching for the best possible combination of the four PI parameters, which provides the optimal transient and steady state response of the studied system during MG injection and abrupt load change. This searching process stops once the maximum number of iterations is reached. The final values of the four optimized parameters under this study for both PSO and GOA-based power-sharing controllers are given in Table 2. Further, the dynamic performance evaluation of both the controllers was also undertaken and compared during MG injection and an abrupt load change condition. At the start of the simulation, the MG is disconnected from the power system through a three-phase circuit breaker and hence the load is supplied by the utility grid. At 0.05 s, the breaker is turned on and MG starts sharing power after a very small transient period. Subsequently, an additional load of 90 kW, 40 kVAR is inserted into the system at 0.5 s. As per the set power-sharing ratio, the MG adopts 40 kW, 20 kVAR and the grid supports the rest. Figure 10a,b shows the comparison of active and reactive power variation respectively, between two same controllers with different PI parameter selection methods.
It can be observed from Figure 10a,b, once the MG is inserted at 0.05 s the DGs adopts the power as per the set power-sharing ratio. The GOA-based parameter selection method provides more optimal dynamic response than the PSO-based selection method. The two major parameters of the dynamic response evaluation of any system are the percentage overshoot and settling time. These both indicators are calculated for the studied MG system after the MG insertion and load change conditions and are provided in Table 3. the MG is disconnected from the power system through a three-phase circuit breaker and hence the load is supplied by the utility grid. At 0.05 s, the breaker is turned on and MG starts sharing power after a very small transient period. Subsequently, an additional load of 90 kW, 40 kVAR is inserted into the system at 0.5 s. As per the set power-sharing ratio, the MG adopts 40 kW, 20 kVAR and the grid supports the rest. Figure 10 a,b shows the comparison of active and reactive power variation respectively, between two same controllers with different PI parameter selection methods. It can be observed from Figure 10 a,b, once the MG is inserted at 0.05 s the DGs adopts the power as per the set power-sharing ratio. The GOA-based parameter selection method provides more optimal dynamic response than the PSO-based selection method. The two major parameters of the dynamic response evaluation of any system are the percentage overshoot and settling time. These both indicators are calculated for the studied MG system after the MG insertion and load change conditions and are provided in Table 3.  It may be noted that in practical applications it is very difficult to achieve optimal parameters under continuously varying operating conditions in real-time online optimization. This is due to three major reasons, i.e., lengthy optimization searching process, extended simulation time, and unpredictable loads switching [1]. Therefore, in this study, an offline optimization method is used to find the optimized parameters, which are valid for all operating conditions throughout the simulation time. The key benefits of using GOA method include the smoother implementation of optimized parameters into the studied model as the optimized parameters selected by the intelligent algorithms holds good for all the system operating conditions.

Conclusions
An intelligent GOA-based power flow controller for the grid-connected MG system has been presented in this paper. The key objective of this study was to exchange the active and reactive power between MG and the utility grid with minimum overshoot, settling time, and reduced total harmonic distortion at the higher DG penetration level (100 kW, 70 kVAR). To evaluate the performance superiority of the proposed GOA-based power flow controller, its dynamic response for active and reactive power regulation has been compared with PSO-based controller for the same system configuration and working conditions. The GOA attains higher convergence rate and better quality of solution than PSO for the minimization of the same fitness function and hence the developed controller achieves a better transient response in terms of overshoot and settling time than the PSO-based controller. Hence, the optimal selection of PI parameters by GOA is more suitable than PSO. The results show that the proposed controller is better than its counterpart in extracting and maintaining the set ratio of power from the MG during different operating conditions like MG injection and abrupt load changes. In addition, the comparative analysis of proposed controller with the previous grid-connected MG power flow control architectures shows that the studied power flow controller with GOA-based parameters selection offers better transient response than the previously used PSO-based power flow controllers for the same research objectives. Finally, the power quality analysis of the considered MG system shows that the proposed controller duly satisfies the power quality standards set by IEEE standard 929-2000 and hence supplies distortion less power to the load.