Control Design and Parameter Tuning for Islanded Microgrids by Combining Different Optimization Algorithms

Load and supply parameters may be uncertain in microgrids (MGs) due for instance to the intermittent nature of renewable energy sources among others. Guaranteeing reliable and stable MGs despite parameter uncertainties is crucial for their correct operation. Their stability and dynamical features are directly related to the controllers’ parameters and power-sharing coefficients. Hence, to maintain power good quality within the desirable range of system parameters and to have a satisfactory response to sudden load changes, careful selection of the controllers and power-sharing coefficients are necessary. In this paper, a simple design approach for the optimal design of controllers’ parameters is presented in an islanded MG. To that aim, an optimization problem is formulated based on a small-signal state-space model and solved by three different optimization techniques including particle swarm optimization (PSO), genetic algorithm (GA), and a proposed approach based on the combination of both PSO and GA. The optimized coefficients are selected to guarantee desirable static and dynamic responses in a wide range of operations regardless of the number of inverters, system configuration, output impedance differences, and load types. Through the proposed design and tuning method, the performance of the MG is improved as compared to those obtained using state-of-art techniques. This fact is demonstrated by using numerical simulations performed on a detailed model implemented in PSIM© software.


Introduction
With the use of distributed renewable energy sources that can be utilized locally to produce and feed electric power, the concept of microgrids (MGs) has emerged. The MGs have two operating modes: grid-connected and islanded mode [1]. The issue of power balance between production and consumption, which is equivalent to the load and frequency control has been one of the major challenges in the islanded mode of operation [2]. Imbalances between distributed generations (DGs) and loads in MGs create frequency fluctuation which leads to a decrease in power quality or even may put the system stability at risk [3]. Furthermore, high penetration of renewable energies in MGs can bring uncertainties due to unpredictable environmental changes in terms of solar irradiance, temperature, wind speed, etc. [4]. Therefore, a robust control technique is needed to guarantee the small-signal stability of MGs despite load or source changes. In the islanded mode of operation, the most usable controller is the PI corrector which is implemented in a two-loop hierarchical structure. Namely, power control is performed by an outer control loop with low bandwidth while an inner control loop with higher bandwidth than the outer loop is responsible for voltage and current control [5]. The responsibility of the configuration, output line impedance, or types of loads, a straightforward design approach is presented. This can minimize designers' efforts to the tuning MG controllers' parameters when the output impedances, the number of inverters, and MG configuration may change. Since the VSIs are interfaced to a common bus voltage with huge coupling inductances and the distribution lines have resistive-inductive impedances, it can be concluded that the stable and optimal operation of each VSI can guarantee stable and optimal operation of the whole MG provided that interacting effects are neglected. Therefore, in the proposed design approach, the small signal analysis of a VSI is considered. A novel eigenvaluesbased objective function is defined which involves stability criteria eliminating the need of performing sophisticated stability analysis and making the control design method simpler than traditional techniques. Power controller coefficients, PI current and voltage controller gains are determined through the optimization problem which is solved through different algorithms such as PSO, GA, and proposed PSO-GA intending to improve both system static and dynamic performances. The proposed combined PSO-GA uses both PSO and GA. The controllers' coefficients can be determined off-line for the worst-case scenario of the operating point. In order to validate the proposed method, different case studies including load changes in the two-inverter system are simulated in the islanded mode of operation using PSIM © software. A comparative analysis among optimization algorithms is carried out for the different case studies. The main contributions of the paper are listed below.
• Proposing a new simple design approach and tuning method for the optimal setting of power, voltage, and current controllers' coefficients. • Proposing novel objective function evaluating optimized parameters for the controllers while ensuring the VSI stability in the whole range of operation. • Proposing a combination of PSO and GA for parameter tuning for a VSI in an MG application.
The rest of this paper is organized as follows. In, Section 2, a complete small-signal model of the VSI inverter in an MG application is derived. Section 3 is devoted to defining the proposed design approach and formulating the optimization problem which is solved through GA, PSO, and the proposed PSO-GA algorithm. Section 4 presents simulation results for different case studies. Section 5 concludes the paper. Figure 1 shows the control schematic diagram of a VSI in an islanded MG. The used control strategy consists of power, voltage, and current controllers in a hierarchical structure. The current controller is the fastest one and the power controller is the slowest one. The control is implemented in the dq reference frame. The most appropriate and simplest controller in this frame is a PI controller [36] which is used in this study, for both current and voltage loops. For the power controller, the droop control method is employed.

Voltage Controller
Power Controller As the inverter is connected to the AC common bus through an inductor (L c ), the power control can be carried out by using two artificial linear characteristics in the inverter frequency and voltage as shown in Figure 2. The frequency is set based on droop gain m p and the voltage is set according to the droop gain n q . The inverter phase can be determined by integrating the frequency. Droop control technique arises from synchronous generator governor and inertia characteristics. As an example, when the generator has drawn, power increases, and the rotation speed decreases [37]. Therefore, MG active and reactive power can be controlled in the dq reference frame by manipulating inverter output voltage magnitude and frequency as follows: where ω n and V n are the nominal frequency and voltage respectively. P and Q are the DC components of instantaneous active and reactive power. It should be noted that in presence of more than one inverter in the MG, to build the complete small-signal model, the rotation speed of one inverter δ should be considered as a reference frame. Then, all other inverters' rotation speeds should translate to the one which is considered as a reference. Figure 3 illustrates the block diagram of the control scheme in dq reference frame. First, measured currents and voltages go through the dq transform block. Then, DC values of active and reactive power are calculated with a low pass filter. The low pass filter is used to guarantee the proper current sharing of nonlinear loads [38]. According to the dq synchronous reference frame theory, harmonic components will appear in the nonlinear load active and reactive power. These should be removed from the DC values. The DC values of active and reactive power enter the frequency and voltage droop loops and build the rotation angle and d-axis voltage reference value for the outer voltage controllers. The qaxis voltage reference value is set to zero. Thereafter, the outputs of PI voltage controllers plus a portion of dq-axis voltages and dq-axis output currents make the reference value of inner current controllers. The calculated reference value for the inverter voltage goes through an inverse dq transform block to build three-phase signals for the inverter pulse width modulation. A complete small-signal model of an islanded MG, which is detailed by [17,39], is briefly presented here. Combining the state-space model of power, voltage, and current controllers and linearizing the models at the operating point yields to (2).
In (2), φ d , φ q , ψ d , and ψ q are the state variables of current and voltage controllers. V bd , V bq , I ld , I lq , I od , I oq , V od , V oq are the operating points of the MG and ω c is the cutoff frequency of power controller. K pv , K iv , K pc , K ic are the proportional and the integral gains of the voltage and current controllers respectively while F is the gain of dynamic improvement loop. As it is shown in (2), the state matrix for an islanded MG with only one inverter has 13 × 13 dimension. Therefore, it has 13 eigenvalues and their locus in the complex plain are shown in Figure 4. The comparison of the small-signal average model of the islanded MG with one inverter and the large-signal switched model is shown in Figure 5. The islanded MG operation point changes from a normal one to another operating condition with 100% load step change.

Proposed Design Approach
In this section, the proposed design approach of controllers' coefficients is presented. The design approach is formulated as an optimization problem to find the best-fitted values Energies 2022, 15, 3756 7 of 25 for the control system coefficients [m p n q K pv K iv K pc K ic ]. The optimization problem is solved through different optimization techniques including PSO, GA, and the proposed PSO-GA which is the combination of PSO and GA.

Formulation of Optimization Problem
The aim of minimising the objective function is to improve system dynamic behaviour and damping characteristics as well as to keep the stability of the whole system under load changes. This can be done by making all the eigenvalues of the state matrix with a damping ratio close to an appropriate value [40]. The selection of damping ratio is to make a trade-off between magnitude and time of system overshoot. Therefore damping ratio selection is a subjective choice and is usually selected between 0.4 and 0.7. As it is mentioned previously, the state matrix of the inverter has 13 eigenvalues all can be expressed as follows where ζ and ω n are the modes damping ratio and natural frequency. In this paper, the objective function is selected in such a way that all the 13 system eigenvalues are such that the damping ratio is 0.5. Another important thing is the stability of the closed-loop system with PI controllers. To have a stable system, a term is added to the objective function to guarantee the stability of the whole system with designed controller parameters. This term is isstable() function in MATLAB environment which returns zero when a state matrix is unstable and returns one when it is stable. Adding this term to the objective function eases the stability analysis of the system. Therefore, the resulted parameters through all optimization algorithms guarantee the stability of the whole system. The definition of the objective function is illustrated in the following equation where in the denominator of the objective function second term, 13 × 0.25 would normalize the value between 0 and 1 [41].

Proposed PSO-GA
The proposed optimization technique is the combination of two powerful optimization algorithms, PSO and GA, and is called here PSO-GA. The proposed PSO-GA provides both powers of PSO and GA in one optimization algorithm. PSO has the ability to traverse the search space continuously like birds flocking to find the optimum value. Furthermore, it is powerful for solving multiobjective optimization problems. However, PSO may stick in the local optima and suffer from low-quality solutions. The ability of GA can solve this problem since the candidate solutions are randomized and muted. Moreover, GA has the ability in both continuous and discrete optimization problems. Therefore, in the proposed PSO-GA, the risk of sticking to local optimums significantly decreases. The proposed PSO-GA starts with population initialization. Then, PSO operators are applied in a predetermined subiteration of PSO. Thereafter, GA operators including crossover, mutation, and selection are applied to the fitted population in a predetermined sub-iteration of GA. Finally, the best population is drawn when the iteration condition of PSO-GA is satisfied. Figure 6 shows the flowchart of the proposed PSO-GA algorithm.  Table 1 shows the considered values of the islanded MG, including a VSI, an LC output filter, and a grid coupling inductance. In order to select the cutoff frequency of the low pass filter for the power controller, a trade-off between filtering capability and dynamic response exists. The lower the cutoff frequency, the better the filtering feature but the slower the dynamic response. To make this trade-off, the best cutoff frequency proposed in the literature is within 5-25 Hz [42]. Therefore, in this paper, the cutoff frequency is selected as 5 Hz (ω c = 31.41 rad/s). It should be noted that, since the low pass filter frequency is fixed and included in the state-space matrix, the designed voltage and current controller Energies 2022, 15, 3756 9 of 25 parameter ranges obtained from optimization algorithms will not interfere with the low pass filter cutoff frequency ranges. To compare the performance of different optimization techniques, a case study is considered. The operating point values for the case study are shown in Table 2.

Designing Controllers' Coefficients for a Case Study
PSO, GA, and the PSO-GA algorithms are run offline. The number of population, PSO parameters [43,44], GA coefficients [45], and search interval of variables are shown in Table 3. The controllers' parameters are calculated with the different optimization algorithms and are shown in Table 4. In addition, the designed parameters based on Ziegler-Nichols method, labelled as conventional (conv.), are taken from [17] to make a comparison with the proposed methods in this paper. Figure 7 shows the convergence of the three used optimization techniques. As it can be seen from this figure, the PSO-GA converges in less than 100 iterations and the value of the objective function is improved.

Effect of Operating Point Changes
As it can be seen in Figure 4, there are three frequency modes as follows: • High-frequency modes which consist of seven poles; • Low-frequency modes which consist of three poles; • Very low-frequency modes which consist of three poles.
In addition, the small-signal state-space matrix of the inverter is related to the operating point, V bd , V bq , I ld , I lq , I od , I oq , V od , V oq . The very low-frequency modes are so close to the right half-plane. Therefore, they have an inherent capability to jeopardize the inverter stability when the operating point changes. The changes in the MG common bus voltages v b are normally small as the common bus is supported by different sources of energy in the MG. The reference value for v bd is set to the nominal voltage V n , 380 V and the reference value for v bq is set to 0 V. Nevertheless, the trace of inverter eigenvalues when 200 ≤ V bd ≤ 380 and −20 ≤ V bq ≤ 20 is shown in Figure 8. It should be noted that v o is imposed by v b since there is a negligible voltage drop along coupling inductance; hence, V od and V oq are approximately the same as V bd and V bq . Similarly, in the nominal frequency, the filter capacitor has a huge impedance; so its current is significantly smaller than the inverter output current. As a result, I ld and I lq are approximately the same as I od and I oq . The ranges of I od and I oq are related to the maximum active power P max and maximum reactive power Q max of the DG which can be obtained by the following The trace of inverter eigenvalues when 0 ≤ I od ≤ 75 and −50 ≤ I oq ≤ 50 is shown in Figure 9. As it can be seen in this figure, the worst case scenario for the inverter stability would happen when I od is zero and I oq is I min oq . Therefore, if the control system coefficients are designed for the worst-case scenario, they would guarantee the stability of the inverter in the whole range of operating points. This is the reason why the operating point in Table 2 is chosen.

Effect of Output Impedance Changes
As it is shown in (2), the state-space matrix of the inverter is also dependent on the output impedance (r L c + jωL c ). The impact of its changes in the very low-frequency modes is shown in Figure 10. From this figure, it can be concluded that the system is stable for a wide range of output impedance. In case of huge output impedance changes, the optimization problem can run again with the new values of output impedances to optimally select the controllers' parameters.

Plug-and-Play Capability of the Design Approach
Plug-and-play functionality and MG configuration independency of the proposed design approach with three different inverters and output impedances are illustrated in Figure 11. The controller parameters for each inverter are selected by solving the optimization problem. The value of inverter output filter, output impedance, and worst case scenario of operation point are the input variables for the optimization problems. The output values of the optimization problem are the controller parameters for each inverter. In the case of adding a new DG to the AC common bus, the optimization problem will be solved to optimally select the controller parameters of the newly added DG.
Equation (2) Equation (2) Design of Controllers MG configuration with three different inverters Figure 11. The design of MG controllers for three different inverters with different output impedances.

Simulation Results
In this section, the effectiveness of the proposed design approach using the GA, PSO, and the PSO-GA optimization algorithms is validated through numerical simulation performed in PSIM © software. The simulation is carried out for three different case studies to show the robustness of the designed controllers against various disturbances and in different MG configurations. The first one is a one-inverter system with a linear load and the second one is a one-inverter system with a nonlinear load. The last case study is a higher-order system with two inverters and a linear load. A comparative analysis among different optimization algorithms is performed in each case study. Figure 12 shows the first case study considered in this paper. First, a linear three-phase load is connected to the islanded MG (R = 5 Ω, L = 1 mH). A 100% load step change is applied to the islanded MG at t = 0.4 s. The load three-phase current is shown in Figure 13.  The controllers' parameters were previously presented in Table 4. Figure 14 shows the evolution of the frequency of the islanded MG under linear load step changes. As it can be observed from this figure, the desired steady-state frequency of the MG in which controllers' parameters are selected with PSO and PSO-GA is more accurate than that obtained from other designed controllers. The steady-state values of frequency after load step change with conventional, GA, PSO, and PSO-GA parameters are 49.46, 49.76, 49.971, and 49.972 Hz respectively. Figure 15 shows the dq-axis output currents with different designed controllers.   The three-phase output voltage of the islanded MG under linear load changes with different designed controllers is shown in Figure 18

Case Study II: One Inverter with Nonlinear Load
The second case study investigated in this paper is shown in Figure 19. A nonlinear load is connected to the islanded MG and a step load change is applied at t = 0.4 s. Figure 20 shows the nonlinear load three-phase currents. Figure 21 shows the time evolution of the frequency of the islanded MG under the nonlinear load changes with four control approaches: controllers with Ziegler-Nichols classically designed parameters, controllers with optimized tuned parameters through GA, controllers with optimized tuned parameters through PSO, and controllers with optimized tuned parameters through proposed PSO-GA. It can be seen that the steady-state frequency error with optimized controllers decreases in comparison with controllers with classically designed parameters. The proposed PSO-GA has a more acceptable steady-state frequency among others and it is 49.972 Hz. For example, in the first method, the frequency deviation from nominal frequency 50 Hz is 0.56 Hz while in the proposed PSO-GA, the frequency deviation is less than 0.03 Hz.   The dynamic performance of the dq-axis currents is shown in Figure 22 from which it can be observed that the dq current magnitudes steady-state errors with the proposed PSO-GA control parameters are less than the other controllers. Furthermore, from this Figure, it can also be seen that no matter of 100% increase in the magnitude of dq currents, the control system has a proper and smooth transient response under nonlinear load changes. There is only an oscillation in the dq-axis voltages and currents which comes from the nonlinearity of the load. The dynamic performance of the dq-axis voltages is illustrated in Figure 23.  The same as with current controllers, it can be observed that the steady-state errors of dq-axis voltage magnitudes with the proposed PSO-GA control parameters are 0.62 V and 0.001 V which are hugely less than the conventionally designed controllers 25.37 V and 0.082 V. The dynamic response of MG active and reactive power are illustrated in Figure 24. The capability of providing active and reactive power is improved by the controllers designed with PSO-GA. Figure 25

Case Study III: Two Inverter with Linear Load
In order to investigate the performance of the designed controllers in high-order systems, a two-inverter MG is considered. Figure 26 shows another considered case study in which two inverters feed a linear load. A 100% load step change is applied to the islanded MG with two inverters at t = 0.4 s.  It can be clearly observed that the two inverters with classically designed controllers are unstable after load step change. It should be noted that the system would only be stable with the considered transmission line impedance. For example, in the compact MGs in which the inductive value of the transmission line is so small, the system designed in [17] with conventional controllers would be unstable. However, all the systems with optimized designed controllers are stable after loading step change at t = 0.4 s. It can be seen in these figures that the d-axis inverter output voltage with controllers designed by proposed The frequency, the active, and the reactive power of the two-inverter MG controlled by conventionally tuned, GA-tuned, PSO-tuned, and PSO-GA-tuned controllers are shown in Figure 28. It can be seen that the system with conventional controllers is unstable. Since each inverter has the same characteristics and the same output filter, the load power-sharing between them is the same as illustrated in Figure 28B(b), Figure 28C(b), and Figure 28D(b) for the GA, PSO, and the PSO-GA-tuned controllers respectively.
Three-phase output voltages of two-inverters MG with different designed controllers are shown in Figure 29. Figure 29a is the three-phase output voltage of the first inverter and Figure 29b is the three-phase output voltage of the second inverter with classically designed controllers. As can be observed in this figure, the three-phase output voltages are unstable for both inverters. Three-phase output voltages of inverters controlled by optimized controllers are pure sinusoidal and balanced. Figure 29c,d shows the threephase output voltages of two inverters in which GA is used to design their controllers, while Figure 29e,f are the three-phase output voltages of two inverters in which PSO is used. The three-phase output voltages of two-inverter MG controlled by the proposed PSO-GA-designed controllers are shown in Figure 29g,h. After investigating all the case studies above, it can be concluded that the proposed design approach is universal for any MG size and configuration no matter of line impedances and loads types. This helps designers to minimize their efforts to tune the controllers if the output impedance or the number of inverters changes. In addition, from all the presented figures, it can be inferred that the controllers tuned with the proposed PSO-GA have better performance than others in different case studies such as linear load step changes, nonlinear load step changes, and linear load step changes in an MG with two inverters. Table 6 shows the comparative analysis of the designed controllers in different case studies. As it can be seen from this table, the steady-state values of the frequency, the three-phase output voltage magnitude, the dq-axis currents, the dq-axis voltages, and the frequency and voltage magnitude deviation from their nominal values are better with the proposed PSO-GA algorithm.

Conclusions
In this paper, a new design approach is presented for the optimized selection of controllers' parameters in an islanded MG. The state-space model of a VSI involving power, voltage, and current controllers are used for the formulation of the optimization problem. The impact of operating point and output impedance changes in the eigenvalues of the inverter small-signal state-space matrix are investigated. Then, the optimization problem is solved through different optimization algorithms, including the PSO, the GA, and the proposed PSO-GA for the worst-case scenario of the operating point. This can guarantee the stability of the system in the whole range of operations. As a result, the power, voltage, and current control coefficients are determined. The performance of the control system with tuned parameters through PSO, GA, and PSO-GA has been compared with classically-designed controller parameters under linear and nonlinear load changes with one and two parallel-connected inverters. The system is unstable in the islanded MG with two parallel-connected inverters without significant line impedance under classicallydesigned controllers parameters while it is stable with tuned parameters through PSO, GA, and PSO-GA. The simulation results showed that the performance of the control system with the proposed PSO-GA-tuned controller's parameters is much better than the classicallydesigned controller's parameters. By virtue of this method, the bus frequency and voltage of the islanded MG are in the allowable and appropriate range. The effectiveness of the presented method was verified by simulation results from PSIM © software. The main advantages of the proposed method are summarized below.
• Proposing a simple guideline for engineers to design controllers' parameters in an islanded MG regardless of the number of inverters, MG configuration, output impedances, and loads types which significantly reduces the effort and complexity of the design issue. • Improvement in the steady-state frequency, the dq currents, and the three-phase voltages response under linear load changes, nonlinear load changes, and linear load changes in the islanded MG with two grid-forming inverters. • Needless of coefficient readjustment for the whole range of operating points. • Providing a plug-and-play design approach when a new DG wants to be added to the MG.