1 Introduction

Modern Power System objective is to meet the increase demand for electric power while ensuring supply security, reliability, and power quality. The utilization of renewable energy sources in the recent age due to limitations in conventional power generation leads to setting of more number of microgrids. Microgrids play a vital role in power generation and exchange and posses many advantages, some draw backs is also marked in many research papers (Şerban 2011; Kafle et al. 2016; Bevrani et al. 2012), one major drawback is the frequency deviation during islanding mode of operation (Şerban 2011; Kafle et al. 2016). To overcome the issues and to maintain Tie-line power flow, primary and secondary controllers suggested (Şerban 2011), the response of the primary control is fast while the secondary control is influenced by primary droop control causes significant challenges to regulate the frequency properly and maintain the power flow.

In interconnected microgrids, frequency deviation is the result of constant load variation and the intermittent nature of renewable energy sources. Frequency deviation throughout the entire system via interconnected tie-lines propagates if suitable measures are not provided (Şerban 2011; Kafle et al. 2016). So, it is crucial to monitor, regulate and control the frequency to protect the system from abnormalities. Various controllers such as conventional PI, PD and PID are suggested (Şerban 2011; Kafle et al. 2016; Bevrani et al. 2012) to maintain frequency within an acceptable range after disturbances or load changes in microgrids, however due to the intermittency nature of RES and load perturbations in the standalone multi-microgrid results in large frequency deviations. To overcome the frequency deviation problem, different types of optimization algorithms such as PSO, GWO and GSA are used to first tune the conventional parameters to obtain less deviation in frequency as addressed in Bevrani et al. (2012), Annamraju and Nandiraju (2018) and Srinivasarathnam et al. (2019). However, these controllers fail to meet the challenges due to their poor dynamic performance. To improve the overall operation, control, and efficiency of the microgrid, numerous adaptive methods and new techniques have been presented and discussed (Bevarani et al. 2016; Janani and Muniraj 2014; Dhanalakshmi and Palanswami 2011; Anuoluwapo and Kumar 2021; Naderipour et al. 2023; Kumar et al. 2022; Boopathi et al. 2023; Uddin et al. 2023; Santra and De 2023; Vidyarthi and Kumar 2024a, b; Vidyarthi 2024).

A secondary frequency control loop using \({\text{H}}_{\infty }\) and \({\upmu }\) synthesis robust control technique (Bevarani et al. 2016) is developed to reduce the frequency deviation in AC microgrid system under different load disturbances and parametric uncertainties. Fuzzy Logic Controller (FLC) (Janani and Muniraj 2014; Dhanalakshmi and Palanswami 2011; Kayalvizhi and Vinod Kumar 2017; Simpson-Porco et al. 2015a) along with different types of optimization technique and conventional technique is adopted to stabilize the dynamic behaviour of the MG in Islanded mode, comparative analysis of Fuzzy PID, PI and Fuzzy is presented (Dhanalakshmi and Palanswami 2011) and their effectiveness to reduce the frequency deviation in combined Fuzzy-PID is verified. A modified harmony search algorithm in a Feed Forward factional order PID (FFOPID) control strategy in load frequency control problem is addressed (Simpson-Porco et al. 2015b), the proposed algorithm is used to tune the parameters of FFOPID to achieve optimum performance in regulating the frequency. Muliti input and Single output FLC with PSO and FLC with GOA is addressed in Asgari et al. (2021) and Yu et al. (2019) to solve the frequency deviation and tie line power flow deviation in multi MG system. Artificial Neural Network (ANN) controller is implemented in a interconnected microgrid system. PSO based ANN is used to tune the parameters in PID controller is addressed (Safari et al. 2019) to regulate and control the frequency in an Electric Vehicle (EV) integrated microgrid system. In Veerasamy et al. (2022),the stability issues in a Hybrid Power System (HPS) is resolved using Hankel metod of model order reduction technique, PI-PD along with PSO-GSA (Gravitational Search Algorithm) are explored in this work with IAE cost function. Frequency based control strategy with an EV integrated Grid (Oureilidis et al. 2016) is discussed and a Droop curve methodology is also implemented to maintain the frequency by judging the SOC of the battery in an AC bus in the microgrid system is discussed (Li et al. 2023). An Adaptive Model Predictive Control (AMPC) is proposed to enhance the load frequency control in a two-area interconnected power system alongside a standalone microgrid is presented (Anuoluwapo and Kumar 2021) where a comprehensive state-space model is developed taking both controllable and uncontrollable generating power sourceses in standalone microgrid system. Load frequency control (LFC) within an islanded Microgrid (MG) through adaptive event-triggered control (ETC) is presented (Naderipour et al. 2023). PSO-driven PID and hybrid approach of IGSA-BPSO driven PID is implemented to solve ALFC problem is presented (Kumar et al. 2022), the effectiveness of technique is proved in a 2-Area system. Improved Gravitational Search Algorithm–Binary Particle Swarm Optimization (GSA-BPSO) driven PID controller is suggested (Boopathi et al. 2023).

From the above discussion, it becomes evident that most industrial controllers still rely on conventional PI or PID controller due to their simple design and reliability. While alternative techniques such as PSO, GWO, and GSA have been explored for parameter tuning, they often exhibit premature convergence and struggle to reach global optima. These methods fail to minimize the error effectively in systems with significant dynamics. Focus on developing metaheuristic techniques for PID, PI, and PD controller parameter tuning with various algorithms in multi interconnected microgrid system is also discussed (Uddin et al. 2023; Aggarwal et al. 2024; Nanda Kumar et al. 2024; Yousuf et al. 2023; Santra and De 2023; Vidyarthi and Kumar 2024a).

The novelity of the work is the adoption of hybrid algorithms for parameter tuning emerges as one of the best solution in this domain, Thus, focus on utilizing hybrid optimization techniques due to their simplicity and ability to attain global optima is discussed above but in particular the development of PSO-GWO hybrid algorithm to tune PID and cascade PI-PD controller in multi interconnected microgrid system is not investigated so far with different load changing condition. So, in this work, the developed PSO-GWO algorithm is implemented with both controllers to enhance the performance.

The contributions of the work are as follows.

  1. 1.

    A novel hybrid PSO-GWO optimized PID controller is developed and its performance is compared with individual PSO driven PID controller and GWO driven PID controller with different load changing condition in an interconnected microgrid systems

  2. 2.

    The novel hybrid PSO-GWO optimized cascade PI-PD controller is also developed and its performance is compared with PSO-GWO optimized PID controller with different load changing condition in an interconnected microgrid systems

The presentation of the research work consists of five sections. In the first section, Introduction of microgrid and some reviews are critically analyzed. Section 2 present the details of the proposed model for a two-area microgrid system, while Sect. 3 explains the details of hybrid approach of PSO and GWO algorithm Sect. 4, Result and analysis of output is discussed. The presentation concludes in Sect. 5.

2 Proposed model of two area microgrid

The proposed two area microgrid under consideration as a case study is shown in Fig. 1, the model represents microgrid (MG) in islanded mode because the control strategy is more important in islanded mode rather grid connected mode. The model consists of Diesel Engine Generator (DEG), Photo Voltaic (PV) Panel, Wind Turbine Generator (WTG) and Battery Energy storage system which makes it more reliable, if there is a deficit generation in order to maintain the load demand, DEG provides full back up to operate the system effectively and efficiently.

Fig. 1
figure 1

Block diagram of two area connected microgrid

The deviation in the frequency of each area of the microgrid model can be expressed as

$$ \Delta {\text{f}}_{1} = \frac{1}{{{\text{M}}_{1} {\text{sD}}_{1} }}\left( {\Delta {\text{P}}_{{{\text{DEG}}_{1} }} + \Delta {\text{P}}_{{{\text{WTG}}_{1} }} + \Delta {\text{P}}_{{{\text{PV}}_{1} }} - \Delta {\text{P}}_{{{\text{BESS}}_{1} }} - \Delta {\text{P}}_{{{\text{Tie}}_{12} }} - \Delta {\text{P}}_{{{\text{L}}_{1} }} } \right) $$
(1)
$$ {\Delta f}_{{2}} = \frac{{1}}{{{\text{M}}_{{2}} {\text{sD}}_{{2}} }}\left( {{\Delta P}_{{{\text{DEG}}_{{2}} }} + {\Delta P}_{{{\text{WTG}}_{{2}} }} + {\Delta P}_{{{\text{PV}}_{{2}} }} - {\Delta P}_{{{\text{BESS}}_{{2}} }} - {\Delta P}_{{{\text{Tie}}_{{{21}}} }} - {\Delta P}_{{{\text{L}}_{{2}} }} } \right) $$
(2)

In the above Eqs. 1 and 2 the deviation of frequency in Area-1 and Area-2 of the proposed model is presented. Area-1 frequency deviation is obtained by subtracting sum of powers of \({\text{BESS}}_{{1}}\), \({\Delta P}_{{{\text{Tie}}12}}\) and \({\Delta P}_{{{\text{L}}_{{1}} }}\) from the of sum of deviation of power of \({\text{DEG}}_{{1}}\),\({\text{WTG}}_{{1}}\),\({\text{PV}}_{{1}}\) and in similar way Area-2 frequency deviation is obtained by subtracting the sum of deviation of in \({\text{BESS}}_{{2}}\),\({\Delta P}_{{{\text{Tie}}21}}\) and \({\Delta P}_{{{\text{L2}}}}\) from sum of deviation of power of \({\text{DEG}}_{{2}}\),\({\text{WTG}}_{{2}}\) and \({\text{PV}}_{{2}}\). In the above Eqs. 1 and 2 represents \({\text{M}}_{{1}} {\text{,M}}_{{2}}\) and \({\text{D}}_{{1}} {\text{,D}}_{{2}}\) are the inertia and damping constant respectively.

\({\Delta P}_{{{\text{Tie}}_{{{12}}} }}\) Is defined as

$$ {\Delta P}_{{{\text{Tie}}_{{{12}}} }} = \frac{{{\text{Ti}}_{{{12}}} }}{{\text{s}}}\left( {{\Delta f}_{{1}} - {\Delta f}_{{2}} } \right) $$
(3)
$$ {\Delta P}_{{{\text{Tie}}_{{{21}}} }} = - {\Delta P}_{{{\text{Tie}}_{{{12}}} }} $$
(4)

Equations 3 and 4 represents Tie-line coefficient, Deviation of power in \({\text{Tie}}_{{{12}}}\) is obtained from the difference of deviation of frequency in Area-1 and in Area-2 and in a similar way \({\text{Tie}}_{{{21}}}\) is obtained from difference in deviation of frequency in Area-2 AND Area-1 or it can be represented as minus of \({\text{Tie}}_{{{12}}}\) as in Eq. 4

$$ {\text{ACE}}_{{1}} = {\upbeta }_{{1}} * {\Delta f}_{{1}} + {\Delta P}_{{{\text{Tie}}_{{{12}}} }} $$
(5)
$$ {\text{ACE}}_{{2}} = {\upbeta }_{{2}} * {\Delta f}_{{2}} + {\Delta P}_{{{\text{Tie}}_{{{21}}} }} $$
(6)

Interconnected microgrid objective is to balance the generation and load demand. This can be achieved by minimizing the Area Control Error (ACE) of each area of microgrid to a tolerable limit. Equations 5 and 6 represents the area control error IN Area-1 and in Area-2, it is the sum of Tie-Line power deviation and product of frequency device multiplied with bias factor in the respective area. \(\upbeta _{1} ,\upbeta _{2}\) Represents the Bias Factors.

2.1 Modelling of DEG

In the proposed system shown in Fig. 1, DEG is provided to maintain the load demand when there is a shortage of renewable energy generation (RES) and this instant can be identified with continous monitring of the output of the RES.The measurement is carried out with the help of governer control. The transfer function of the DEG model is presented in the Fig. 2

$$ \frac{{{\Delta P}_{{{\text{DEG}}}} }}{{{\Delta P}_{{\text{C}}} }} = - \frac{{1}}{{\text{R}}}\left( {\frac{{1}}{{{1} + {\text{T}}_{{\text{g}}} {\text{s}}}} \times \frac{{1}}{{{1} + {\text{T}}_{{\text{t}}} {\text{s}}}}} \right) $$
(7)
Fig. 2
figure 2

DEG model with transfer function

The required powerd of the proposed microgrid is compensated with the DEG with the help of governer and the speed-drop system. The Transfer function of the DEG is represented in Eq. 7, where Tg and Tt are the governor and turbine time constants respectively and R is the speed Regulation constant.

2.2 Modelling of wind turbine generator in the proposed model

Harnessing power from the wind, wind generating units generate the power, the mechanism is blowing winds kinetic energy is transformed to electrical energy through the wind generating units, absorption of wind pressure kinetic energy is done the rotor and after that it transforms to rotary motion.

Power output is expressed as

$$ {\text{P}}_{{{\text{WT}}}} = \frac{1}{2}\uprho {\text{AC}}_{{\text{p}}} \left( {\uplambda ,\upbeta } \right)V_{{\text{W}}}^{3} $$
(8)
$$ \frac{{{\Delta P}_{{{\text{WTG}}}} }}{{{\Delta P}_{{{\text{WT}}}} }} = \frac{{{\text{K}}_{{{\text{WTG}}}} }}{{{1} + {\text{T}}_{{{\text{WTG}}}} {\text{s}}}} $$
(9)

The wind turbine generator power output is represented in Eq. 8 which depends on the various parameters such as the power coefficient, tip speed ratio, blade pitch angel, area, density factor and wind speed, all the mentioned parameters represented by the respective symbols \({\text{C}}_{{\text{p}}} ,\uplambda ,\upbeta ,{\text{A}},\uprho ,{\text{V}}_{{\text{w}}}\). The corresponding transfer function of the wind turbine generator is represented in Eq. 9.

In Eq. 9, \({\text{K}}_{{{\text{WTG}}}} {\text{,T}}_{{{\text{WTG}}}}\), are gain and time constant of the wind turbine respectively. The transfer function model is presented in Fig. 3

Fig. 3
figure 3

Wind Turbine model with the first order transfer function

2.3 PV modelling

Depending on the requirement of current of and voltage, A PV system can be designed by combining many PV panels in series and parallel. The output of the PV Panel is directly affected by the load current and solar irradiation and mathematically, it is expressed by the below equation

$$ {\text{P}}_{{{\text{PV}}}} = {\eta A}\phi \left[ {{1} - {0}{\text{.005(T}}_{{\text{a}}} + {25)}} \right] $$
(10)
$$ \frac{{{\Delta P}_{{{\text{PV}}}} }}{{{\Delta }\phi }} = \frac{{{\text{K}}_{{{\text{PV}}}} }}{{{1} + {\text{T}}_{{{\text{PV}}}} {\text{s}}}} $$
(11)

The PV panel output is represented by the Eq. 9 and it is calculated by taking various parameters such as area of PV array, temperature, efficiency of the array and solar irradiation etc. The symbols of the parameters are represented as \({\text{A}},{\text{T}}_{{\text{a}}} ,\upeta ,\phi\) respectively.

The Transfer function of the Solar PV Modeling is represented in Eq. 11, In the Eq. 11, \({\text{K}}_{{{\text{PV}}}} {\text{,T}}_{{{\text{PV}}}}\) represents gain constant and time constant respectively. PV array transfer function model is shown in Fig. 4.

Fig. 4
figure 4

Solar PV model with first order transfer function

3 Proposed hybrid PSO-GWO implementation with different controllers

PI/PID controller is the secondary control and its values are predefined, which cannot be changed dynamically if there is a change in system operating condition, conventional PI/PID controller are not able to perform well because of the intermittent nature of the renewable energy source used in microgrid as a result desired output cannot be achieved, but if the control parameters are change dynamically using any techniques with the changing operating condition then controllers can achieve the desired performance easily. To obtain the optimum performance to control the frequency deviation in micro grid, in this work, intelligent algorithm which is the combination of both PSO and GWO is developed and termed as hybrid PSO-GWO hybrid technique.

PSO is easy to understand and implement, and it can be applied to a wide range of optimization problems, including continuous and discrete optimization. It also converges quickly when the fitness function is smooth, allowing efficient computation on parallel or distributed systems. Furthermore, it is robust to noisy and stochastic fitness functions. However, it possesses some disadvantages such as premature convergence and a lack of global exploration (Xinming et al. 2021; Kraiem et al. 2021).

Grey Wolf Optimization (GWO) Technique has strong exploration capabilities, aiding in the exploration of the search space and preventing premature convergence. It exhibits fast convergence to the optimal solution but suffers from sensitivity to parameter settings, requiring thorough tuning for optimal results. Additionally, it encounters difficulties with dynamic optimization problems (Xinming et al. 2021; Kraiem et al. 2021), nevertheless, combining these approaches leads to enhanced optimization performance.

This two popular algorithm combination is implemented in this work to achieve optimal value of the parameter, exploration and exploitation. Exploitation has the capability to converge near best result and exploration has the capability to search the search space for better result, the hybrid approach suppresses the demerits of individual algorithm. Sometimes PSO results are not up to the mark because it gets pin down in local optimum point rather than arriving to the global optimum point though the convergence rate of the algorithm is fast(Veerasamy et al. 2022; Xinming et al. 2021; Kraiem et al. 2021; Fini and Golshan 2018; Tudu et al. 2024; Aggarwal et al. 2024; Nanda Kumar et al. 2024; Yousuf et al. 2023) This problem can be easily avoided by implementing GWO. PSO and GWO which strengths the control capability is chosen. The hybridization techniques of the two algorithms improve the ability of exploitation in PSO using the exploration ability of GWO which generate variants strength. Updating of position of agents in search space of the proposed algorithm is carried out followed by the below mathematical equations. A modified equation in Veerasamy et al. (2022) is presented where a new variable “w” is used.

The variable ‘W’ is defined as,

$$ {\text{W}} = {0}{\text{.5}} + \frac{{{\text{r}}_{{1}} }}{{2}} $$
(12)
$$ {\text{C}} = {2} * {\text{r}}_{{2}} $$
(13)

where \({\text{r}}_{{1}} {\text{,r}}_{{2}}\) randomly chosen values between 0 and 1,\({\text{w}}\upvarepsilon \left[ {0,5,1} \right],{\text{a}} = 2\) is the initial value.

$$ {\text{d}}_{{\upalpha }} = \left[ {{\text{C}}_{{1}} {\text{X}}_{{\upalpha }} - {\text{w}} * {\text{X}}} \right] $$
(14)
$$ {\text{d}}_{{\upbeta }} = \left[ {{\text{C}}_{{2}} {\text{X}}_{{\upbeta }} - {\text{w}} * {\text{X}}} \right] $$
(15)
$$ {\text{d}}_{{\updelta }} = \left[ {{\text{C}}_{{3}} {\text{X}}_{{\updelta }} - {\text{w}} * {\text{X}}} \right] $$
(16)

\({\text{X}}_{{\upalpha }} {\text{,X}}_{{\upbeta }} {\text{,X}}_{{\updelta }}\) are best three solutions for the position occupied and \({\text{X}}\) represent randomly chosen initial positions, the updated position of the three best solutions is \({\text{X}}_{{1}} {\text{,X}}_{{2}} {\text{,X}}_{{3}}\) respectively

$$ {\text{A}} = {2} * {\text{a}} * {\text{r}} - {\text{a}} $$
(17)

Further updating of the position vector, PSO approach is taking in to consideration with a modified version followed by the below equation

$$ {\text{V}}\left( {{\text{t}} + {1}} \right) = {\text{w}} * \left[ {{\text{V}}\left( {\text{t}} \right) + {\text{K}}_{{1}} {\text{r}}_{{1}} \left( {{\text{X}}_{{1}} - {\text{X}}\left( {\text{t}} \right) + {\text{K}}_{{2}} {\text{r}}_{{2}} \left( {{\text{X}}_{{2}} - {\text{X}}\left( {\text{t}} \right)} \right) + {\text{K}}_{{3}} {\text{r}}_{{3}} \left( {{\text{X}}_{{3}} - {\text{X}}\left( {\text{t}} \right)} \right)} \right)} \right] $$
(18)
$$ {\text{X}}\left( {{\text{t}} + {1}} \right) = {\text{X}}\left( {\text{t}} \right) + {\text{V}}\left( {{\text{t}} + {1}} \right) $$
(19)

“a” and no of iteration are reciprocal, once “a” decreased iteration increased.

$$ {\text{a}} = {2} * \left( {{1} - \frac{{{\text{itr}}}}{{{\text{max.itr}}}}} \right) $$
(20)

Current iteration number is represented by itr, Eqs. 1219 reprents the process of updating the parameters using the hybrid algorithm and Eq. 20 shows the inverse relation between “a” and itr.

3.1 Exploitation

More importance is given to obtain optimal solution towards exploring (Simpson-Porco et al. 2015b) of the search space when the value of “A” lies between −1 to 1, initiation of all the things happens at the starting of algorithm. Another factor “C” also helps the process of exploration whose values varies from 0 to 2 as it is observed from the equation. As “C” posses some random values even during the later stage the value of “a “can be decreased and initiates converging towards optimum solution. The factor “c” plays an important role by adding randomness in the developed algorithm and avoid jab in local optimum.

figure a

The implementation of the combined algorithm approach with different controller is discussed below section.

3.1.1 Hybrid PSO-GWO based PID controller

In this work, the hybrid technique which is the combination of PSO-GWO algorithm is implemented in the PID controller to increase the dynamic performance of the PID controller; the system is shown in Fig. 5. Improvement of performance can be obtained by properly evaluating the optimal parameter values for the PID controller using the proposed hybrid algorithm considering the disturbance in the system and after that the frequency deviation can be controlled.

Fig. 5
figure 5

PID controller with PSO-GWO

3.1.2 Cascade control scheme

The idea behind the Cascaded control techniques came from sequential loops, where output of the secondary loop is connected to the primary loop as input shown below Fig. 6. Both the primary and secondary loops consist of measurement variables. The details of the major characteristics of cascaded controller described in Veerasamy et al. (2022), external disturbance impact in the sequence outer process can be reduced by inner measurement and the objective of outer process measurement is to ensure the system output is within the appropriate limit.

Fig. 6
figure 6

Cascade control system

Cascade control is a common method for achieving accelerated disturbance rejection before it spreads to different areas of the system. In the section below, we'll go through the outer and inner loops of cascade power.

3.2 Primary loop

In the analysis of primary loop, the output is obtained as follow

$$ {\text{Y}}\left( {\text{s}} \right) = {\text{P}}_{{1}} \left( {\text{s}} \right){\text{U}}_{{1}} \left( {\text{s}} \right) $$
(21)
$$ {\text{U}}_{{1}} \left( {\text{s}} \right) = {\text{Y}}_{{2}} \left( {\text{s}} \right) $$
(22)

The main or primary loop of system is referred to as outer loop, which includes the controlled process. The outer plant here is referred as \({\text{P}}_{{1}} \left( {\text{s}} \right)\). The output of the Loop is presented by the Eq. 21.Thus; the main goal of primary controller loop is to track reference by the output in the presence of load disruption. In the proposed work, PI controller is taken in primary loop for improved reference monitoring and load disturbance rejection. Where \({\text{U}}_{{1}} \left( {\text{s}} \right)\) is input to outer loop and also output to inner loop \({Y}_{2}(s)\)\({\text{Y}}_{{2}} \left( {\text{s}} \right)\) which is represented in Eq. 22

3.3 Secondary Loop

The secondary loop, also known as the inner or slave loop, is made up of inner or supply process \({\text{P}}_{{2}} {\text{(S)}}\) with the whole mechanism being subjected to \({\text{d}}_{{1}} {\text{(s)}}\) load perturbation.

$$ {\text{Y}}_{{2}} \left( {\text{s}} \right) = {\text{P}}_{{2}} \left( {\text{s}} \right){\text{.U}}_{{2}} \left( {\text{s}} \right) + {\text{d}}_{{1}} \left( {\text{s}} \right) $$
(23)

The above Eq. 23 presents the inner loop process and it consists of inner loop measurement which is influenced by system uncertainties. The inner loop's primary goal is reducing impact of system modelling and minimising influence of inner process gain variation on control system output. Inner loop, out of the three terms, involves a quick supply disruption rejection with PD gain terms. Figure 6 Depicts the closed loop control of an integrated plant using a cascaded PI-PD controller.

3.4 PI-PD cascaded controller

In PI-PD cascaded controller, the primary loop of the system is designed with the PI controller as the control system and in which the secondary loop is cascaded with the PD controller as the secondary control system. Tackling of disturbance and reference tracking can be easily achieved by implementing the two controls, these two controllers are treated as input and output controller respectively

$$ {\text{C}}_{{1}} \left( {\text{s}} \right) = {\text{K}}_{{\text{p}}} + \frac{{{\text{K}}_{{\text{i}}} }}{{\text{s}}} $$
(24)
$$ {\text{C}}_{{2}} \left( {\text{s}} \right) = {\text{K}}_{{\text{p}}} + {\text{K}}_{{\text{D}}} {\text{s}} $$
(25)

Equation 24 and Eq. 25 represents the input and output of the PI-PD cascaded controller The decomposed output diagram, as seen in Fig. 7, is used to evaluate overall performance of the cascade control system, and closed loop transfer function can be depicted as shown below,

Fig. 7
figure 7

Block diagram of PI-PD Controller with PSO-GWO

3.5 PSO-GWO based cascaded PI-PD hybrid controller

In the past, conventional PI/PID controls were used for secondary control in power systems. These PI/PID controllers have predefined operating parameters that cannot be modified dynamically in response to changing device operating conditions, as the MG system consists of the renewable energy source, intermittent problems makes problems as a result the desired output cannot be achieved, to improve the MG system performance in all aspects, it is better to go for cascaded PI-PD controller, the controller consists of two loops, primary which consists of PI controller and it is cascaded to the secondary loop which consists of PD controller. The above two control loops are implemented in such a way, so that the system response behaves fast in order to tackle the disturbance rejection and reference tracking. Further improvement of dynamic performance of the system can be enhanced by implementing PSO-GWO algorithm in conjunction with the above two controllers.

The main objective to implement the hybrid algorithm is to tune the parameters in such a way, so that optimal parameter values can be achieved and frequency deviation can be minimized. The block diagram of the discussed model is shown in below Fig. 7

$$ {\text{Y}}_{{{11}}} \left( {\text{s}} \right) = \left[ {\frac{{{\text{P}}_{{1}} \left( {\text{s}} \right){\text{P}}_{{2}} \left( {\text{s}} \right){\text{C}}_{{1}} \left( {\text{s}} \right){\text{C}}_{{2}} \left( {\text{s}} \right)}}{{{\text{W}}\left( {\text{s}} \right)}}} \right]{\text{R}}\left( {\text{s}} \right) $$
(26)
$$ {\text{Y}}_{{{12}}} \left( {\text{s}} \right) = \left[ {\frac{{{\text{P}}_{{1}} \left( {\text{s}} \right)}}{{{\text{W}}\left( {\text{s}} \right)}}} \right]{\text{d}}_{{1}} \left( {\text{s}} \right) $$
(27)
$$ {\text{W}}\left( {\text{s}} \right) = {1} + {\text{P}}_{{2}} \left( {\text{s}} \right){\text{C}}_{{2}} \left( {\text{s}} \right) + {\text{P}}_{{1}} \left( {\text{s}} \right){\text{P}}_{{2}} \left( {\text{s}} \right){\text{C}}_{{1}} \left( {\text{s}} \right){\text{C}}_{{2}} \left( {\text{s}} \right) $$
(28)
$$ {\text{Y}}\left( {\text{s}} \right) = {\text{Y}}_{{{11}}} \left( {\text{s}} \right) - {\text{Y}}_{{{12}}} \left( {\text{s}} \right) $$
(29)

where \({d}_{1}(s)\)\({\text{d}}_{{1}} \left( {\text{s}} \right)\) is the load perturbation, \({P}_{2}(s)\)\({\text{P}}_{{2}} \left( {\text{s}} \right)\) is secondary control loop and \({P}_{1}\left(s\right)\) \({\text{P}}_{{1}} \left( {\text{s}} \right)\) is primary control loop of a multi-source system, the closed loop transfer function of the proposed loop in Fig. 7 is represented from Eqs. 2529.

3.6 Mathematical analysis of the controllers

Optimization value of the gains of the controller can be achieved by taking frequency variation and flow of tie-line power as reference in the multi-MG system, which can be further used to define the fitness function by utilizing ITAE criteria.

$$ {\text{Fitness}} = {\text{Minimize}}\left\{ {{\text{ITAE}}} \right\} = {\text{Min}}\left\{ {\int_{{0}}^{{{\text{T}}_{{{\text{sim}}}} }} {{\text{t}}_{{1}} \left( {\left| {{\Delta f}_{{1}} } \right| + \left| {{\Delta f}_{{2}} } \right| + \left[ {{\Delta P}_{{{\text{Tie}}}} } \right]} \right){\text{.dt}}} } \right\} $$
(30)

The fitness function is treated as the performance index to tune the PID controller gains. The fitness function ITAE is represented mathematically by the above Eq. 30.

4 Results and analysis

The effectiveness of the hybrid PSO-GWO techniques with PID controllers and PI-PD controllers is verified through the proposed MG system under various loading conditions. Additionally, the system's frequency stability under dynamic conditions is also investigated by applying different load conditions and incorporating irregularities of RES. For all the all the above work, autonomous MG and multi-MG systems are simulated using MATLAB/SIMULINK software under the specified conditions. The simulated results and their analysis is described below in the respective sections.

4.1 PSO, GWO, PSO-GWO based PID controller LFC Analysis

Case 1: Step change in load

In this case, two interconnected microgrids are considered to verify the effectiveness of the proposed hybrid optimization technique along with PID controller. Both microgrids are subjected to step load disturbances as shown in Fig. 8. The load disturbances in both microgrids occur at different times. In the first microgrid, the load changes by 0.078p.u. From t = 3 to 8 s, and in the second microgrid, the load changes from t = 10.7 to 14 s by a magnitude of 0.069 p.u.

Fig. 8
figure 8

Step load disturbances vs. time for the two microgrids

It can be observed from the simulated waveform shown in Figs. 9, 10, 11, The frequency deviation in MG.1, MG2 and Tie-line power flow deviation in the interconnected microgrid during the above mentioned load disturbance is very less in hybrid PSO-GWO optimization technique with PID controller in comparison to individual PSO and GWO optimization technique.

Fig. 9
figure 9

Frequency deviation vs. time in first microgrid corresponding to Fig. 8

Fig. 10
figure 10

Frequency deviation vs. time in the second microgrid corresponding to Fig. 8

Fig. 11
figure 11

Tie-line power flow deviation vs time in interconnected microgrid corresponding to Fig. 8

Case2: Step load change in one microgrid and continuous changes in other microgrid

In this case, the same interconnected microgrids are considered to verify the effectiveness of the proposed hybrid optimization technique along with PID controller, from Fig. 12, it can be observed that on the first microgrid, a continuous load disturbance ranging from 0.02 to 0.07 p.u. is applied, and the second microgrid experiences step load disturbances of magnitude 0.061 p.u. from time t = 7–13 s.

Fig. 12
figure 12

Load disturbances vs. time for the two microgrids

It can be observed from the simulated waveform shown in Figs. 13, 14, 15, The frequency deviation in MG.1, MG2 and Tie-line power flow deviation in the interconnected microgrid during the above mentioned load disturbance is very less in hybrid PSO-GWO optimization technique with PID controller in comparison to individual PSO and GWO optimization technique.

Fig. 13
figure 13

Frequency deviation vs. time corresponding to Fig. 12 in the first microgrid due to continuous load

Fig. 14
figure 14

Frequency deviation vs. time corresponding to Fig. 12 in the second microgrid due to step load

Fig. 15
figure 15

Tie-Line Power flow deviation vs time corresponding to Fig. 12 in interconnected microgrid

Case 3: Continuous load change in both microgrids

In this case, to verify the effectiveness of the proposed hybrid optimization technique along with PID controller both the interconnected microgrids are applied with the continuously changing loads as shown in Fig. 16 with magnitudes ranging from 0.012 to 0.084p.u. and 0.02 to 0.071 p.u., respectively.

Fig. 16
figure 16

Continuous Load disturbances vs time for the two microgrids

It can be observed from the simulated waveform shown in Figs.17, 18, 19, The frequency deviation in MG.1, MG2 and Tie-line power flow deviation in the interconnected microgrid during the above mentioned load disturbance is very less in hybrid PSO-GWO optimization technique with PID controller in comparison to individual PSO and GWO optimization technique.

Fig. 17
figure 17

Frequency deviation vs. time corresponding to Fig. 16 In the first microgrid due to continuous load

Fig. 18
figure 18

Frequency deviation vs. time corresponding to Fig. 16 In the second microgrid due to continuous load

Fig. 19
figure 19

Tie-Line Power flow deviation vs. time corresponding to Fig. 16 In interconnected microgrids

4.2 PSO-GWO based PID and PI-PD controller LFC Analysis

Case1: Step change in load

In this case, to verify the effectiveness of the proposed hybrid optimization technique along with the cascade PI-PD controller, two interconnected microgrids are considered, and each microgrid is subjected to step load disturbances with magnitudes of 0.077 p.u. and 0.068 p.u. occurring from t = 2 to 6 s and t = 10 to 15 s, respectively, as shown in Fig. 20

Fig. 20
figure 20

Load disturbances vs. time for the two microgrids

It can be observed from the simulated waveform from Figs. 21, 22, 23, the hybrid PSO-GWO optimization techniques with cascade PI-PD controller gives better results in terms of less deviation in Frequency in first microgrid, Frequency deviation in the second microgrid and Tie-Line Power flow deviation in interconnected microgrid in comparison to PSO-GWO optimization with PID controllers during the above mentioned load disturbance in microgrid. It can also be observed that in cascade PI-PD settling time and overshoot is very less in comparison to PID controller.

Fig. 21
figure 21

Frequency deviation vs. time corresponding to Fig. 20 in the first microgrid

Fig. 22
figure 22

Frequency deviation vs. time corresponding to Fig. 20 in the second microgrid

Fig. 23
figure 23

Tie-Line Power flow deviation vs. time corresponding to Fig. 20

Case 2: Step load change in one and continuous changes in other microgrid

In this case, two interconnected microgrids are taken and from Fig. 24, it can be observed that on first microgrid a continuous load disturbance ranging from 0.022 to 0.07p.u. is applied and the second microgrid is applied with the step load disturbances of magnitude 0.07p.u. From time t = 5.8 to 11 s.

Fig. 24
figure 24

Load disturbances vs time for the two microgrids

It can be observed from the simulated waveform from Figs. 25, 26, 27 respectively, the hybrid PSO-GWO optimization techniques with cascade PI-PD controller gives better results in terms of less deviation in Frequency in first microgrid, Frequency deviation in the second microgrid and Tie-Line Power flow deviation in interconnected microgrid in comparison to PSO-GWO optimization along with PID controllers during the above mentioned load disturbance in microgrid. It can also be observed that in cascade PI-PD settling time and overshoot is very less in comparison to PID controller.

Fig. 25
figure 25

Frequency deviation vs. time corresponding to Fig. 24 in the first microgrid

Fig. 26
figure 26

Frequency deviation vs. time corresponding to Fig. 24 in the second microgrid

Fig. 27
figure 27

Tie-Line Power flow deviation vs time corresponding to Fig. 24

Case 3: Continuous load change in both microgrids

In this case, both the interconnected microgrids are applied with the continuously changing loads as shown in Fig. 28 with magnitudes ranging from 0.017 to 0.079 p.u. and 0.02–0.071 p.u., respectively.

Fig. 28
figure 28

Continuous Load disturbances vs time for the two microgrids

It can be observed from the simulated waveform from Figs. 29, 30, 31,the hybrid PSO-GWO optimization techniques when implemented in cascade PI-PD controller gives better results in terms of less deviation in Frequency in first microgrid, Frequency deviation in the second microgrid and Tie-Line Power flow deviation in interconnected microgrid due to same load disturbance in comparison to PSO-GWO optimization along with PID controllers.

Fig. 29
figure 29

Frequency deviation vs. time corresponding to Fig. 28 in the first microgrid

Fig. 30
figure 30

Frequency deviation vs. time corresponding to Fig. 28 in the second microgrid

Fig. 31
figure 31

Tie-Line Power flow deviation vs. time corresponding to Fig. 28 In interconnected microgrid

A comparative analysis table of different state variable values to verify the effectiveness of our proposed technique with some existing techniques is presented below in Table 1, the comparison has been made among PSO-PID, IGSA-BPSO-PID (Kumar et al. 2022) technique with our proposed PSO-PID, PSO-GWO-PI-PD technique. The proposed techniques give better results in comparison to the existing techniques. Hence proves its effectiveness.

Table 1 A Comparative analysis of existing and proposed methods with continuous load changing condition

5 Conclusions

The paper presents a detailed implementation of PSO-GWO hybrid optimization techniques with PID and cascade PI-PD controllers for addressing frequency deviation and Tie-line power flow problems in multi-microgrid systems. Through result analysis, it becomes evident that the PSO-GWO hybrid optimization technique with a PI-PD controller stands out as one of the best options for resolving the mentioned challenges in interconnected microgrid systems compared to the PSO-GWO-PID controller, particularly under varying conditions such as load variations and the intermittent nature of renewable energy sources. Additionally, the hybrid techniques with a PI-PD controller exhibit reduced peak overshoot and settling time compared to the PID controller. From the results and analysis section, it is easily observed that in PSO-GWO hybrid techniques based on the PI-PD controller, the frequency deviation in the first microgrid is 0.007 and in the second microgrid it is 0.001. Similarly, the deviation of Tie-line power flow and settling time are and 0.15 s respectively. These results prove the effectiveness of the proposed PI-PD controller. The simulation results demonstrate the robustness and effectiveness of both hybrid-based PI-PD and PID controllers in controlling frequency deviation and maintaining tie-line power flow in multi-microgrid systems. However, for dynamic frequency control within the proposed hybrid optimization framework, the PI-PD based controller emerges as the more suitable option.