Load-frequency control in an islanded microgrid PV/WT/FC/ESS using an optimal self-tuning fractional-order fuzzy controller

Due to the increased complexity and nonlinear nature of microgrid systems such as photovoltaic, wind-turbine fuel cell, and energy storage systems (PV/WT/FC/ESSs), load-frequency control has been a challenge. This paper employs a self-tuning controller based on the fuzzy logic to overcome parameter uncertainties of classic controllers, such as operation conditions, the change in the operating point of the microgrid, and the uncertainty of microgrid modeling. Furthermore, a combined fuzzy logic and fractional-order controller is used for load-frequency control of the off-grid microgrid with the influence of renewable resources because the latter controller benefits robust performance and enjoys a flexible structure. To reach a better operation for the proposed controller, a novel meta-heuristic whale algorithm has been used to optimally determine the input and output scale coefficients of the fuzzy controller and fractional orders of the fractional-order controller. The suggested approach is applied to a microgrid with a diesel generator, wind turbine, photovoltaic systems, and energy storage devices. The comparison made between the results of the proposed controller and those of the classic PID controller proves the superiority of the optimized fractional-order self-tuning fuzzy controller in terms of operation characteristics, response speed, and the reduction in frequency deviations against load variations.


Introduction
As the world's energy consumption increases, conventional power systems are facing issues such as environmental concerns, the high cost of constructing new power plants, restrictions on the construction of transmission and distribution lines, and the shortage of fossil fuels (Zhang et al. 2006). To increase reliability in customer service and reduce congestion and loss in distribution and transmission lines, distributed generation (DG) resources and renewable energy sources (RESs) were introduced as appropriate options for modern power systems (Naderipour et al. 2021). With the emergence of DGs, several problems such as maintenance and protection of resources, how to properly adapt these resources to the basic parameters of the network such as frequency, voltage, and how to exchange power between the main grid and DGs appeared (Ramirez et al. 2008). The concept of MGs was first introduced in modern power systems in 1998 by the Consortium for Electric Reliability Technology Solutions (CERT) to solve the problems of DGs (Overholt 2002). A microgrid is a stand-alone set of loads and small power sources in the form of a single control system that provides generation capacity for a local area (Naderipour et al. 2018).
In the field of urban electricity supply, a microgrid as a quick controllable source can meet the transmission system requirements. The storage devices in the microgrid act similarly to the spinning reserve of large generators in Responsible Editor: Philippe Garrigues * Amirreza Naderipour namirreza@utm.my conventional systems (Osika 2005). Obviously, in achieving the benefits of microgrids, it is important to provide a control structure to balance the supply and demand. The components of the microgrid balance the supply and demand through a decision-making process (Cai and Mitra 2010). An important part in the control hierarchy of microgrids is centralized and local control, in which all factors (RESs) are independent and cooperate with their neighbour factors to achieve power balance and sustainable operation in the microgrid (Schwaegerl et al. 2009). With regard to the fact that the microgrid can operate in an islanded and off-grid mode, its ability to maintain the frequency, after a disturbance or significant imbalance between generation and load, is very important. On the other hand, the use of non-dispatchable resources, including wind turbines and PV generators, also causes many problems such as increasing voltage deviations and frequency fluctuations. Changes in load consumption also affect stability, which increases the need to control frequency and voltage in microgrids (Colet-Subirachs et al. 2011). In a microgrid, not all renewable units participate in the load-frequency control; thus, frequency control is often realized using a diesel generator, which further complicates the control design (Khooban et al. 2016). Therefore, load control along with frequency control in a microgrid is of great importance. The classic PID controller compensates for power due to frequency changes by creating a closed-loop control. The simplicity of implementation is one of the advantages of the PID-based controller and its poor performance in dealing with uncertainties and rapid load changes are among the demerits of this category of methods. For load frequency control (LFC) in an islanded microgrid, Bevrani et al. utilized the robust H ∞ control method and μ-synthesis to overcome system uncertainties (Bevrani et al. 2015). In the proposed control scheme, microgenerators are responsible for balancing load and frequency in the MG system. In Vafamand et al. (2018), a fuzzy predictive control (FPC) is used to establish dynamic stability and robust control in a small DC microgrid. The concept of fractionalorder-based controllers for voltage or frequency control in microgrids has been proposed since 2013 (Pan and Das 2014;Rasoanarivo and Sargos 2013).
A novel optimum fractional-order fuzzy PD+I load frequency controller for islanded microgrids in a ship power system was created (Khooban et al. 2017). Because the controller's performance is determined by its parameters, optimizing these coefficients may significantly improve the LFC control's output performance. Asgari et al. (2021) present a feedforward fractional-order PID control technique for microgrid load frequency regulation. A feedforward controller is used to operate the microgrid in islanded operation in the proposed design. The disturbance signal, which is defined as the difference between the power of renewable sources and the demand, is assessed using a disturbance observer to employ the feedforward controller.
In particular, the idea of a fractional-order PID controller (FOPID) for control in a three-phase stand-alone microgrid optimized by a meta-heuristic method has received special attention and has shown a desirable performance. In addition to the acceptable performance of FOPID-based methods, it seems that the use of methods based on human knowledge such as fuzzy logic can improve performance, overcome model uncertainties, and reduce frequency deviations in the microgrid. On the other hand, hybrid fuzzy logic and PID (FLPID) controller methods or FPC methods are deprived of the flexibility in the coefficients of the fractional orders used in fractional-order-based methods (Yeşil et al. 2004). Control of wind turbine blade angles and plug-in hybrid electric vehicles (PHEVs) using the model predictive model (MPC) to improve the microgrid frequency has been addressed (Pahasa and Ngamroo 2014). Liu et al. (2014) examine the effect of communication delay on the secondary frequency control of an island microgrid with a multiple distribution generator. In this paper, a method based on the small-signal model has been introduced for the microgrid to find the delay margin in which the microgrid can remain stable. By conducting a series of laboratory studies, the relationship between secondary frequency control gain and delay margin has been obtained and a planning method has been proposed to compensate for the effect of communication delay on secondary frequency control.
The vehicle to grid (V2G) connection method and the use of electrical devices (EV) as mobile storage units are a suitable solution for the load frequency control of the microgrid (Yang et al. 2015). This paper presents a control based on the multivariable generalized predictive control (MGPC) for an LFC in an islanded microgrid [20]. Design parameters in a FLPID controller include proportional, integral, and derivative coefficients, membership functions, and control rules. To achieve these optimal parameters for frequency control in a microgrid, several optimization techniques including particle swarm optimization (PSO) and whale optimization algorithm (WOA) have been utilized (Yang et al. 2015).
This paper employs a novel method to control the load frequency in an islanded microgrid. In the proposed method, a fuzzy method has been used to overcome the constant parameters of the classical PID controller. In this method, the fuzzy self-tuning controller, in addition to overcoming the PID problem, is able to support the uncertainties caused by the modeling and parametric changes of the system, as well as changing the operating conditions and operating points of the system and provides desirable performance. Different fuzzy self-tuning controls apply different parameters to the system for load-frequency control. The output of the fuzzy self-tuning controller is the same as the PID control coefficients, which change dynamically under different conditions.
In the suggested method, a fractional-order controller has been utilized in the output of the fuzzy self-tuning controller.
The use of fractional-order control systems increases the response speed and improves the performance of the control system in reducing the frequency deviation. In addition, the WOA has been used to determine the orders in the fractionalorder controller and the scale coefficients in the fuzzy controller. The WOA is selected for its easy and flexible implementation, high convergence speed, and the need for a small number of tuning parameters (Mirjalili and Lewis 2016;Sivalingam et al. 2017). The proposed control method is applied in an islanded microgrid that includes diesel generators, wind turbines, photovoltaic systems, fuel cells, and energy storage systems. The simulation results prove the efficiency and high performance of the proposed optimized self-tuning fractional-order fuzzy controller in load-frequency control. The proposed method has shown better performance compared to other controllers.

Structure of AC microgrids
Microgrids come in a variety of sizes and shapes and usually use several DG units. A structure of some kind of an AC microgrid is shown in Fig. 1. A microgrid usually includes a grid and a single feeder or a residential home, and it is part of a low voltage (LV) distribution system. Also, in general, the main components in a microgrid are the small power source, electrical power consumer, power storage, microgrid central controller (MGCC), and common connection point (PCC) (Liu et al. 2014). The PCC is defined as the point of connection of a microgrid to the upstream distribution network. Small DG units are the main energy sources in microgrids that can be used as rotating generators or as units connected to the grid via power electronic converters.
The technology of DG units can be in the form of microturbines, fuel cells, photovoltaic systems, wind energy systems, diesel cars, gas turbines, or any other type (Schwaegerl et al. 2009). Also, common energy storage technology is in the form of the flywheel, battery, supercapacitor, and superconducting magnetic storage (SMES) (Yang et al. 2015). The storage devices in the microgrids are similar to the spinning reserve of large generators in conventional networks. This equipment is responsible for maintaining the balance between energy production and consumption, especially during sudden changes in energy consumption or production (Sivalingam et al. 2017). As mentioned, the microgrid can be used in both parallel and islanded operation modes. In the parallel mode, the microgrid, depending on the amount of energy consumed and generated, as well as interactions with the electricity market, absorbs power or injects it into the main grid. When the quality of power supply is compromised due to any disturbance in the main grid, the microgrid can be isolated from the grid and operated in the islanded mode (Zhang et al. 2006).

Load-frequency control in microgrids
Deviation in the network frequency is an indication of a change in the production and consumption process. Therefore, it is one of the most important factors in the operation and control of the network situation. In network operation, the frequency data must be recorded instantaneously; this means that a vast amount of this data in a time domain must be recorded and examined. It is worth mentioning that the frequency deviations more than its nominal value, in addition to causing damage to the power grid facilities, will also harm the equipment and electrical appliances of the electricity customers. Thus, if the network frequency is not controlled to the desired and permissible level, it will cause instability and even collapse of the network (Khooban et al. 2016 Due to the fact that the microgrid is able to be isolated from the main network and operate in an islanded mode, its ability to maintain a constant frequency is of great importance after a significant disturbance or imbalance between production and load. On the other hand, the application of non-dispatchable resources such as wind resources and solar generators also causes many problems such as increasing voltage deviation and frequency fluctuation. Furthermore, the changes in load consumption by consumers also affect stability, which necessitates frequency and voltage control in microgrids (Mirjalili and Lewis 2016). Therefore, the microgrid will fluctuate frequently by changing the load and if the load demand is not met on time by the microgrid sources. Given that not all renewable   (Bevrani et al. 2015) units participate in primary control and load-frequency control, it will be difficult to control frequency, so it may be necessary for renewable power units to provide power and participate in primary and secondary frequency controls. Diesel generators can suitably improve frequency fluctuations by compensating for the reduction in production (Bevrani et al. 2015;Khooban et al. 2016). To this end, loadfrequency control is of high importance in a microgrid. In load-frequency control, the diesel generator can compensate for power oscillations using a control loop. The classic PID controller compensates for power oscillation caused by frequency changes by creating a closed-loop control (Khooban et al. 2016).

Microgrid modeling
Various structures have been presented in the literature for load-frequency control in microgrids, which are mainly independent of the grid. The proposed structure in this paper for load-frequency control is shown in Fig. 2. This structure of the islanded AC microgrid network includes wind turbine sources (WTG), photovoltaic (PV) panels, diesel energy generator (DEG), micro-turbine (MT), fuel cell (FC), and energy storage devices such as flywheel energy storage systems (FESS) and the battery energy storage system (BESS). The demandsupply is as follows (Bevrani et al. 2015).
Since PVs and WTGs rely on environmental conditions, the secondary controller can be performed using MT, DEG, and FC devices. The changes in the MG sources concerning the frequency modulation are presented as follows (Bevrani et al. 2015): Low-order dynamic models have been taken into account in this paper to analyze the frequency control problem. Figure 3 illustrates the frequency domain model of the microgrid understudy for load-frequency control of the load along with the generation sources with linear transform functions.

Controller design
Fuzzy self-tuning controller Design and deployment of PID controllers require tuning and deciding on the values of three parameters, known as the PID controller's coefficients or gains. However, tuning these coefficients is not straightforward and many rules and approaches have been proposed for this issue (Antunes 2014). One of these methods for designing a PID controller is online or offline approaches, which determine the values of the PID Membership functions for output signals (I, P) in the five sections are considered as small (S), medium (M), big (B), very big (VB), and very very big (VVB) in triangular and symmetric forms. Mamdani and centerof-gravity methods have been employed for inference and defuzzification processes, respectively controller parameters at any given time. Other PID-based control methods include multi-objective PID controller with fuzzy decision-making and adaptive or self-tuning PID controller. Designing and tuning PID controller coefficients using fuzzy logic decision-making have a similar approach to adaptive controllers and are established based on human knowledge and the ability to inference fuzzy systems that provide a special offer for the values of PID control coefficients at any given time. A fuzzy system, by receiving an error and error derivative at any time, calculates the values of the PID controller coefficients appropriately and places them in the controller structure (Pedrasa and Spooner 2006). In this paper, the fuzzy self-tuning control structure has been utilized. The fuzzy logic used is the Mamdani type and consists of four main parts: fuzzification, knowledge base, inference engine, and defuzzification. The general schematic of the fuzzy self-tuning controller is as shown in Fig. 4.
As shown in Fig. 4, the fuzzy control system has two inputs and three outputs. Speed changes and derivatives of speed changes have been used as control inputs. The coefficients K 1 and K 2 are responsible for compressing or widening the Fig. 5 Membership function of the inputs to the fuzzy inference system Fig. 6 Membership functions of proportional, derivative, and integral outputs of the proposed system fuzzy input range and placing the input signals within the allowable range. These coefficients are called input scaling coefficients. Also, the values of the three proportional, derivative, and integral coefficients are considered as the outputs of this system. The coefficient K out is called the output scaling coefficient, which acts as a scaling coefficient between the output of the fuzzy controller and the input of the system. The control signal generated by the fuzzy self-tuning controller is applied as an auxiliary signal to the governor system. The membership functions for the input signals e (t) and Δe (t) in five sections are considered as negative big (NB), negative small (NS), zero (ZZ), positive small (PS), and positive big (PB) in triangular and symmetrical forms. Existing experience and knowledge of the performance of existing systems and the study of the input and output waveforms are commonly used in the design of base rules in fuzzy controllers. Based on this knowledge, one of the rules in designing fuzzy logic control systems is considered as follows: If e t ð Þ ¼ NB and Δe t ð Þ ¼ NB Then K ¼ s and I ¼ s and D

¼ s
This control law states that in cases where the error and its derivative are negative big (NB), all the proportional, derivative, and integral control coefficients must be small. All output values are considered the same for all coefficients. Thus, Table 1 lists the proposed fuzzy control rules for all three proportional, derivative, and integral coefficients. Figures 5  and 6 show the membership function used for input and output signals. Allowed ranges of inputs and outputs, based on human knowledge as well as trial and error, are selected as [−0.5, 0.5], [0,160], [0,75], and [0, 27.5] for inputs, the proportional output, the derivative output, and the integral output, respectively. The inference method is of the Mamdani type and the defuzzification method is of the center of gravity type.

Fractional-order controller
Describing systems with fractional-order models benefit a higher degree of flexibility in describing the dynamics of a system as they use more parameters compared to integer-order models. This feature is especially evident in the description of memory systems, whose current state depends on their past state. The history of fractional calculations dates back to the seventeenth century (Cafagna 2007). In 1823, Liouville introduced the fractional derivative as an expansion for the integer derivative. Reimann, by defining the first fractional derivative, introduced Liouville's work as Reimann-Liouville. In 1967, Caputo presented a usable definition in the field of engineering for fractional derivatives (Atangana 2017;Luo and Wang 2017;Podlubny 1999). In the Riemann-Liouville derivative, the first block is the integrator and the second block is the derivative, but in the Caputo's definition, first the derivative with an integer order and then the fractional integrator is used. The other widely used definition in the area of fractional-order calculation is Grunwald-Letnikov's definition.
PID controllers are one of the classic, simple, and widely used controllers in terms of structure and implementation. To improve the performance of this controller, it is possible to reduce the derivative and integral orders to a non-integer number by converting it to the fractional order. These fractionalorder controllers introduced by Podlubny have better performance than the classic controller (Podlubny 1999;Zheng et al. 2018). They also provide a larger stability area than the classic controllers for a process. Also, in this controller, in order to achieve the desired response, more settings can be made on the parameters and the order of the controller. The derivative and integral operators in the fractional-order calculations are defined as follows (Atangana 2017): Fig. 7 Prey hunting by humpback whales by creating circular bubbles (Mirjalili and Lewis 2016) In the above equations, a D α t shows the derivative-integral operator, α > 0 is the derivative fractional-order operator, and α < 0 denotes the integral fractional-order operator. As fractional-order differential equations cannot be solved straightforwardly, approximation techniques are mostly used. One of such approximation methods is Oustaloup approximation. The approximation relationship based on Oustaloup approximation is described in (4) (Gao and Liao 2012;Oustaloup et al. 2000). where and n is the approximation order.

Whale optimization algorithm
Whale optimization algorithm (WOA) was first introduced by Mirjalili in 2016 as a novel metaheuristic method (Mirjalili and Lewis 2016). The algorithm is inspired by the hunting behavior of humpback whales and how this sea mammal creates bubbles. Whales, the world's largest mammals, are smart creatures. Based on this, the hunting-based optimization method of these animals was invented with easy implementation features, no need for gradient information, ability to cross local minima, and cover a wide range of problems in different fields with minimum tuning parameters. Figure 7 shows how whales create bubbles and encircle prey fish on the surface of the water. Bubble rings created by whales with a larger radius and at greater depths can encircle the prey. The ring is gradually narrowed as approaching the sea level, such that it gives the hunter a compact batch of fish.
The following presents a mathematical model of the WOA, which results from the siege of prey with circular bubbles. The humpback whale detects the prey and surrounds it. Since the optimal position is in the search space and is not predictable, the WOA considers the best solution for the target prey or the closest place to it. In the next step, the search is defined; the search agents update their position with respect to the best search agent. This behavior is shown by the following equations: where t is the current iteration, A and C are coefficients, X * (t) denotes the position vector of the best solution obtained so far, and X(t) is the position vector of the body particle. It  should be noted that X * (t) has to be updated at each iteration and select the best solution. Vectors A and C are given as: In Eq. (10), a is a linear vector that decreases from 2 to 0 during the iterations and r is a random vector in the range of 0 and 1 (Mirjalili and Lewis 2016). Two methods are designed as follows to mathematically model the behavior of the bubble created by the humpback whale: 1. Reducing the encirclement mechanism: This behavior is achieved by reducing vector a in Eq. (10). Note that the range of oscillation of A reduces as does vector a. In other words, the values of changes in vector A are randomly in the range [−a, a]. 2. Spiral updating position: As is seen in Fig. 7, the first approach to calculate the distance between the whale and the prey is a spiral equation established between the whale and prey positions. The imitation of the whale's spiral movement is given here: Simulation results In this paper, in order to increase the efficiency of the fuzzy self-tuning controller, the input and output coefficients of the controller along with the fractional-order parameters are optimally determined by the WOA. To this end, an optimization problem with the following objective function is used: In the above optimization equation, Δf is the frequency change in the duration 0 to t. Also, the optimization problem along with the related constraints is given as: Min F Δf ð Þ s:th: : Parameters K 1 , K 2 , K 3 , μ, and λ are denoted in Fig. 4. This section presents the results of the proposed method obtained for load-frequency control of the microgrid. Numerical values of the microgrid structure under study are listed in Table 2.   Simulation results were studied in three different scenarios: -Frequency control for step changes in the load -Frequency control for variable step changes in the load -Frequency control for changes in the parameters of the system Step changes in the load This section considers step changes of 0.01 in the load.
Optimization results of the WOA in this scenario are given in Table 3. Moreover, simulation results of the load-frequency control for step changes of 0.01 in the load are provided in Fig.  8. The power output of wind turbines, solar panels, and the fuel cell is illustrated in Fig. 9. Also, the power output of the diesel generator is shown in Fig. 10. Based on the obtained results, it can be claimed that the frequency response of the microgrid for the load-frequency control in the proposed method is better, faster, and with reduced oscillations compared to other methods.

Frequency control for variable step changes in the load
In this section, to prove the robustness of the proposed controller against different load changes at different times, step load changes are applied to the microgrid. These load changes are shown in Fig. 11. Optimization results of the parameters are the same as the parameters of Table 3. The simulation results of the frequency response of the microgrid along with variable load changes are shown in Fig. 12. Also, the generation power of renewable resources is shown in Fig. 13. As is observed in Fig. 12, the proposed controller has been able to reduce the frequency deviations caused by variable load changes and presents a higher response speed and higher damping with lower amplitude than other controllers. Figure 14 shows the amount of power generated by the diesel generator along with the load changes to reduce the frequency deviations.

Frequency control for changes in the system parameters
In this section, in order to show the robustness of the proposed controller against various changes in the system parameters, the system parameter changes have been applied to the microgrid as given in Table 4. Additionally, the type of selected load is in the form of a time-varying step according to the previous scenario in Fig. 11. Simulation results of the microgrid frequency response with respect to the changes in system parameters are shown in Fig. 15. Also, the generation capacity of renewable resources is given in Fig. 16. Figure 17 shows the power output of the diesel generator for changes in the system parameters.  As shown in Fig. 17, due to various changes in the load and system parameters, the proposed controller was able to mitigate frequency deviations caused by changes in the load and system parameters with higher speed and lower amplitude compared to other controllers. The numerical results obtained from the network frequency control according to the evaluation criterion (13) show a decrease of 40% and 27% in the amplitude of deviations compared to the PID control and FPI control methods, respectively.

Conclusions
In this paper, a novel load-frequency control method is used in an islanded microgrid. In the proposed method, the fuzzy method has been utilized to overcome the constant parameters of the classical PID controller. In this method, the fuzzy selftuning controller, in addition to overcoming PID problems, can support the uncertainties caused by system modeling, parametric changes, as well as changing operating conditions and operating system points, and increase the performance of the control system. In this method, the fuzzy self-tuning control, according to the different conditions, applies different parameters to the system for the load-frequency control. In addition, due to the fact that the output of the fuzzy selftuning controller is the same as the PID control coefficients, but they change dynamically under different conditions, a fractional-order controller along with the whale optimization algorithm has been used to improve the performance of the proposed controller. The proposed control method is applied to an islanded microgrid which consists of diesel generators, wind turbines, photovoltaic systems, fuel cells, energy storage systems, and flywheels. The simulation results verify the high efficiency and performance of the proposed fuzzy self-tuning fractional-order controller optimized with the whale algorithm in load-frequency control of microgrids. The proposed method has shown better performance compared to other controllers. Fig. 16 Generation power of renewable sources against variable load changes and system parameter changes Fig. 17 Generation power the diesel generator against variable load changes and system parameter changes