1 Introduction

The primary goal of sustainable power adoption in India is to boost economic growth, increase energy sustainability, improve energy accessibility, and address global warming [1]. This correlates with achieving sustainable development by ensuring affordable, reliable and modern energy access for all citizens through sustainable energy sources. Low-power standalone wind-based generating may now operate at higher speeds because of the availability of generators including permanent magnet synchronous generators, brushless DC generators, and self-excited induction generators (SEIGs) [2]. Sankardoss et al. [3] focus on modelling, simulating, and analysing a SEIG driven by wind power. This generator is linked to the local load through an AC–DC–AC conversion strategy. The SEIG, employed in a system for converting wind energy, exhibits an inherent issue of frequency and voltage magnitude fluctuations due to changes in load and wind speed. To address this challenge, the voltage at the generator terminals, characterized by variable magnitude and frequency, is rectified, and the resulting DC power is then transmitted to the local load using a PWM inverter. In recent times, as nonlinear loads such as rectifiers, computers, and switched-mode power supplies (SMPS) become more prevalent in distribution systems, there has been a gradual rise in power quality issues within the electric distribution system [4]. Harmonics arise from factors like nonlinear loads, unbalanced loads, voltage fluctuations (sag/swell), changes in load levels, and voltage distortion. Due to load unbalancing, there is asymmetry in voltage or current. Nonlinear devices in unbalanced loads, like power converters, contribute non-sinusoidal currents, leading to harmonic distortion. The load unbalance can disturb phase angles, causing odd-order harmonics. Resonance may occur when natural frequencies align with harmonics, amplifying distortion. International standards, including the IEEE-519 standard, have been established to define acceptable power quality levels [5]. In order to mitigate harmonics and improve power quality, distribution systems utilize power electronics-based shunt custom power devices (CPDs) to enhance system reliability. Among the most frequently utilized CPDs are distribution static compensators (DSTATCOMs), which are installed at the point of common coupling (PCC) within the system [6]. The DSTATCOM is capable of fulfilling several roles, including balancing reactive power, neutral current compensation, load balancing, and regulating voltage, at the PCC in three-phase four-wire system, and enhancing overall power quality [7]. It utilizes a transformer with a star-connected primary and delta-connected secondary configuration, enabling the neutral point of the load to connect with the star winding. This setup facilitates the handling of both zero sequence fundamentals and harmonics in neutral currents [8]. Integration of a battery energy storage system (BESS) with a voltage source converter (VSC) at the PCC effectively enhances power quality. The BESS at the VSC's DC-link serves as a load during low-demand periods and switches to a power source during overloads, ensuring consistent power performance in distributed generation (DG) systems [9]. The control strategy plays a vital role in ensuring the effective operation of the DSTATCOM within the electric distribution system. Its significance lies in accurately estimating the fundamental load current component, which is then used to generate switching pulses for the VSC to balance source currents during abnormal conditions. Additionally, the control strategy is employed to generate switching pulses for VSC operation, contributing to harmonics reduction and overall power quality improvement [10].

In the literature, several traditional time-domain control algorithms are discussed for extracting reference currents. Two widely employed methods for reference current generation are instantaneous reactive power theory (IRPT) [11], which involves a three-phase to two-phase transformation, and synchronous reference frame theory (SRFT) [12], which is based on converting from a stationary frame to a rotating frame. While the phase-locked loop (PLL) has achieved maturity in power and energy applications, especially in three-phase systems, the frequency-locked loop (FLL) remains in a less mature state. This is likely due to the utilization of FLLs in the SRF, which adds complexity to its modelling, tuning and performance improvement when compared to PLLs [13]. Numerous techniques based on the theory of adaptive control are available in the literature. The least mean square (LMS), normalized LMS, variable step-size LMS, and leaky LMS adaptive filter algorithms are some of the most well-known and widely utilized adaptive filter algorithms [14, 15]. In ref. [16], the author provides an affine projection technique that is robust to impulsive noise. The significant impact of impulsive noise on systems has been mitigated through the implementation of adaptive control algorithms incorporating updating equations. Tan et al. [17] have introduced an innovative adaptive filtering technique utilizing a logarithmic function to dynamically adjust the step size. Naidu et al. [18] have implemented a control methodology known as the variable fractional power-least mean square. An adaptive framework for improving the variable power aspect of the fractional least mean square (FLMS) algorithm was introduced by Ahmad et al. [19] in which the fractional power of the FLMS algorithm is modified to achieve rapid convergence while minimizing steady-state errors. In ref. [18] and ref. [19], fixed step size is employed that creates a trade-off between convergence accuracy and time. When the algorithm employs a fixed step size, there exists an inverse relationship between convergence accuracy and convergence time. Specifically, reducing the step size improves convergence accuracy but significantly extends the convergence time. Conversely, increasing the step size reduces convergence time but results in a significant drop in convergence accuracy [20]. To overcome above-said limitation, in this research work, the robust variant of variable step-size fractional least means square (RVSS-FLMS) is selected as a control algorithm that dynamically modifies the FLMS’s step size [21].

To modify proportional integral (PI) controller gains, optimization approaches offer an alternative approximation strategy. As a result, system control techniques will work more efficiently because the optimization technique has taken responsibility for evaluating PI gains. To find the most effective control settings for two PI controllers, a new optimization technique called whale optimization algorithm (WOA) is implemented in this study. WOA generally requires fewer tuning parameters in contrast to PSO [22]. This simplification streamlines the parameter tuning process, making WOA particularly well-suited for adjusting the gains of a PI controller. WOA exhibits lower sensitivity to initial solutions when compared to PSO [23]. Unlike PSO, which relies on velocity vectors for updating particle positions, WOA utilizes predefined movements inspired by whale behaviours. This results in a more straightforward algorithmic structure, potentially reducing the risk of instability associated with methods reliant on velocity vectors. WOA achieves a balanced trade-off between global exploration and local exploitation [22,23,24]. The proposed approach combines RVSS-FLMS control with WOA-optimized PI gain estimation to enhance DSTATCOM performance in mitigating current-based power quality disturbances. Due to the variable step size, the proposed control technique is more robust to disturbances and computationally less expensive. The proposed control algorithm consistently exhibits resilience and effectiveness across various operating conditions such as wind speed variations and load unbalancing conditions, showcasing its reliability and adaptability in adaptive filtering. Furthermore, the step size accomplished with proposed control is not fixed value; but it is variable that changes as per the changed in wind speed variations. This contributes to its robust nature. This approach offers advantages such as lower steady-state error and faster convergence rates. RVSS-FLMS accurately estimates fundamental components from non-ideal input signals for generating reference source currents.

The major key features of this article are written below.

  • The control strategy employed for wind-based DSTATCOM operation utilizes the RVSS-FLMS methodology. This approach effectively extracts the active and reactive fundamental components from the distorted load current, ensuring the precise generation of reference source current without oscillations.

  • The control strategy is compared to the conventional LMS control method, demonstrating its effectiveness in terms of percentage overshoot, settling time, and compensation capability.

  • The DSTATCOM integrates two control loops to regulate frequency and terminal voltage. The tuning of PI controllers for both loops is achieved through the implementation of the WOA algorithm. This approach yields superior results as compared to PSO algorithm, characterized by enhanced precision, faster convergence, and straightforward implementation.

A brief discussion about the wind energy system implemented by different authors up till now is mentioned in introduction section. Section II includes the system configuration and a detail explanation about different parts and its uses to make an efficient system. Controller design with detailed mathematical equations is described, and implementation of it in the system is given in section III. Optimization techniques like WOA and PSO play a major role in tuning PI controller. WOA’s importance, implementation and its execution in the system details are mentioned in section IV. Implementation of the system in MATLAB and its results with detailed explanation are included in section V. Section VI consists of all the conclusion points executed in the article.

2 System configuration

Figure 1 illustrates the proposed configuration for a four-wire wind distribution system. The SEIG, which is configured in a star connection, is connected to a horizontal axis wind turbine and provides power to three single-phase nonlinear loads. The nonlinear load in the form of three single-phase diode bridge rectifiers includes an R-L component. The SEIG receives mechanical torque from the wind turbine, and its velocity is nearly synchronous when there is no load on it. The DSTATCOM is linked in a shunt at the PCC to mitigate the harmonic and reactive power under a nonlinear load. To account for the zero-sequence current, the star-delta transformer is connected in shunt at the load terminals. The neutral points of the load, source, and transformers are connected to the common point. The four-wire topology is advantageous over the three-phase three-wire topology due to the inclusion of a neutral wire. This neutral wire provides flexibility in connecting both single-phase and three-phase loads, facilitates balanced loading, offers a convenient grounding point, and reduces voltage fluctuations. These benefits make the three-phase four-wire configuration more versatile and suitable for applications where a mix of equipment with different power requirements coexists, contributing to improved efficiency and stability in electrical distribution systems.

Fig. 1
figure 1

Developed wind-powered four-wire distribution generation system

This setup consists of a BESS, a VSC, and three-phase interfacing inductors for attaching the PCC to the AC side of the VSC. One terminal of the three single-phase nonlinear loads is connected to one phase, and the other is connected to the neutral point. When there is no load, the voltage across the generator terminal is produced by a star-connected capacitor bank. These capacitors operate as a noise filter for high switching frequencies, as well as providing a self-excitation mechanism, and reactive power to raise the no-load voltage. Three-phase load currents (iL) have been measured at the load bus, and three-phase supply current (Is) has been measured at the PCC, where various current disturbances can occur. The suggested control algorithm produces the three-phase reference source current. Moreover, gate pulses are produced using these three-phase reference source currents. The next section of this paper goes into more detail about the control algorithm.

3 Description of robust variant of variable step-size fractional least mean square algorithm

Figure 2 depicts in detail control circuit utilized to produce the reference source current for DSTATCOM by proposed RVSS-FLMS-based control scheme. The complete mathematical and graphical description of the proposed control are discussed in this section.

Fig. 2
figure 2

RVSS-FLMS-based control algorithm

For phase ‘a,’ and similarly for phases ‘b’ and ‘c’, the fundamental active component estimation described mathematically that is important in producing source reference current has been taken into consideration. The cost function ‘\(H_{{\text{a}}} \left( k \right)\) of a fractional LMS is represented by Eq. (1) [21]. As indicated in Eq. (2), one can estimate the error component. Equation (3) represents the derivative of the cost function with respect to the weight factor ‘Ia (k)’ of FLMS. The fractional derivative of the cost function with respect to ‘Ia (k)’ is represented in Eq. (4).

$$ {\rm H}_{\text{a}} \left( k \right) = \frac{1}{2}e_{\text{a}} \left( k \right)^{2} $$
(1)
$$ e_{\text{a}} \left( k \right) = d_{\text{a}} \left( k \right) - y_{\text{a}} \left( k \right) = i_{\text{La}} \left( k \right) - r_{\text{pa}} \left( k \right)I_{\text{p}} \left( k \right) $$
(2)
$$ \frac{{\partial {\rm H}_{\text{a}} \left( k \right)}}{{\partial {\rm I}_{\text{a}} \left( k \right)}} = \frac{{\partial {\rm H}_{\text{a}} \left( k \right)}}{{\partial e_{\text{a}} \left( k \right)}} \cdot \frac{{\partial e_{\text{a}} \left( k \right)}}{{\partial y_{\text{a}} \left( k \right)}} \cdot \frac{{\partial y_{\text{a}} \left( k \right)}}{{\partial {\rm I}_{\text{a}} \left( k \right)}} $$
(3)
$$ \left( {\frac{\partial }{{\partial {\rm I}_{\text{a}} \left( k \right)}}} \right)^{g} {\rm H}_{\text{a}} \left( k \right) = \frac{{\partial {\rm H}_{\text{a}} \left( k \right)}}{{\partial e_{\text{a}} \left( k \right)}} \cdot \frac{{\partial e_{\text{a}} \left( k \right)}}{{\partial y_{\text{a}} \left( k \right)}} \cdot \left( {\frac{\partial }{{\partial {\rm I}_{\text{a}} \left( k \right)}}} \right)^{g} y_{\text{a}} \left( k \right) $$
(4)

Derivative cost function and fractional derivative of cost function are used to generate the update weight factor of FLMS, which is represented in Eq. (5) [20, 21]

$$ {\rm I}_{\text{a}} \left( {k + 1} \right) = {\rm I}_{\text{a}} \left( k \right) - \frac{{\eta \partial {\rm H}_{\text{a}} \left( k \right)}}{{\partial {\rm I}_{\text{a}} \left( k \right)}} - \eta_{\text{f}} \left( {\frac{\partial }{{\partial {\rm I}_{\text{a}} \left( k \right)}}} \right)^{g} {\rm H}_{\text{a}} \left( k \right) $$
(5)

where ‘\(\eta\)’ and ‘\(\eta_{\text{f}}\)’ are the step sizes, ‘g’ is the fractional power derivative, and ‘\({\rm I}_{\text{a}} \left( k \right)\)’ is the weight update.

$$ \frac{{\partial {\rm H}_{\text{a}} \left( k \right)}}{{\partial {\rm I}_{\text{a}} \left( k \right)}} = - e_{\text{a}} \left( k \right)r_{\text{a}} \left( k \right) $$
(6)
$$ \left( {\frac{\partial }{{\partial {\rm I}_{\text{a}} \left( k \right)}}} \right)^{g} {\rm H}_{\text{a}} \left( k \right) = - e_{\text{a}} \left( k \right)r_{\text{a}} \left( k \right)\frac{{{\rm I}_{\text{a}}^{{\left( {1 - g} \right)}} \left( k \right)}}{{\Gamma \left( {2 - g} \right)}} $$
(7)

Equations (3) and (4) have been simplified using the Riemann–Liouville fractional derivative method as Eqs. (6) and (7), respectively. Equations (6) and (7) can be substituted in Eq. (5) to create Eq. (8), as

$$ {\rm I}_{\text{a}} \left( {k + 1} \right) = {\rm I}_{\text{a}} \left( k \right) + \eta e_{\text{a}} \left( k \right)r_{\text{a}} \left( k \right) + \eta_{\text{f}} e_{\text{a}} \left( k \right)r_{\text{a}} \left( k \right)\frac{{{\rm I}_{\text{a}}^{{\left( {1 - g} \right)}} \left( k \right)}}{{\Gamma \left( {2 - g} \right)}} $$
(8)

It is possible to modify Eq. (8) to obtain the variable frictional derivatives. For simplicity, we consider \(\eta_{\text{f}} = \eta \Gamma \left( {2 - g} \right)\) Eq. (8) become as

$$ {\rm I}_{\text{a}} \left( {k + 1} \right) = {\rm I}_{\text{a}} \left( k \right) + \eta e_{\text{a}} \left( k \right)r_{\text{a}} \left( k \right) + \eta e_{\text{a}} \left( k \right)r_{\text{a}} \left( k \right){\rm I}_{\text{a}}^{{\left( {1 - g} \right)}} \left( k \right) $$
(9)
$$ {\rm I}_{\text{a}} \left( {k + 1} \right) = {\rm I}_{\text{a}} \left( k \right) + \eta e_{\text{a}} \left( k \right)r_{\text{a}} \left( k \right)\left( {1 + {\rm I}_{\text{a}}^{{\left( {1 - g} \right)}} \left( k \right)} \right) $$
(10)

We can use ‘\(\eta \left( k \right)\)’ instead of ‘\(\eta\)’ for the time-varying step size that provides the in-phase fundamental element. This modification for the phase ‘a’ is represented in Eq. (11).

$$ {\rm I}_{\text{pa}} \left( {k + 1} \right) = {\rm I}_{\text{pa}} \left( k \right) + \eta \left( k \right)e_{\text{pa}} \left( k \right)r_{\text{pa}} \left( k \right)\left( {1 + {\rm I}_{\text{pa}}^{{\left( {1 - g} \right)}} \left( k \right)} \right) $$
(11)

For the learning rate adaptation, we recommended employing the RVSS-LMS algorithm’s error energy correlation. The update rule for the suggested RVSS-FLMS for the time-varying learning rate ‘\(\eta_{\text{pa}} \left( k \right)\)’is defined as follows.

$$ \eta_{{{\text{pa}}}} \left( {k + 1} \right) = \delta \eta_{{{\text{pa}}}} \left( k \right) + \lambda \Re_{{{\text{pa}}}}^{2} \left( k \right) $$
(12)

where \(\left( {0 < \delta < 1} \right),\left( {\lambda > 0} \right),\text{ and }\left( {0 < \phi < 1} \right)\) are constants and ‘\(\Re_{\text{a}} \left( k \right)\)’ is the average energy correlation which is presented as

$$ \Re_{\text{pa}} \left( k \right) = \phi \Re_{\text{pa}} \left( {k - 1} \right) + \left( {1 - \phi } \right)e_{\text{pa}} \left( k \right)e_{\text{pa}} \left( {k - 1} \right) $$
(13)

In a similar manner, the weight update equation has been provided for estimating the fundamental active component of phases ‘b’ and ‘c’ in Eqs. (14)–(16) and (17)–(19), respectively, where \(r_{\text{pa}}\), \(r_{\text{pb}}\), and \(r_{\text{pc}}\) are in-phase templates obtained using Eq. (32).

$$ {\rm I}_{\text{pb}} \left( {k + 1} \right) = {\rm I}_{\text{pb}} \left( k \right) + \eta \left( k \right)e_{\text{pb}} \left( k \right)r_{\text{pb}} \left( k \right)\left( {1 + {\rm I}_{\text{pb}}^{{\left( {1 - g} \right)}} \left( k \right)} \right) $$
(14)
$$ \eta_{\text{pb}} \left( {k + 1} \right) = \delta \eta_{\text{pb}} \left( k \right) + \lambda \Re_{\text{pb}}^{2} \left( k \right) $$
(15)
$$ \Re_{\text{pb}} \left( k \right) = \phi \Re_{\text{pb}} \left( {k - 1} \right) + \left( {1 - \phi } \right)e_{\text{pb}} \left( k \right)e_{\text{pb}} \left( {k - 1} \right) $$
(16)
$$ {\rm I}_{\text{pc}} \left( {k + 1} \right) = {\rm I}_{\text{pc}} \left( k \right) + \eta \left( k \right)e_{\text{pc}} \left( k \right)r_{\text{pc}} \left( k \right)\left( {1 + {\rm I}_{\text{pc}}^{{\left( {1 - g} \right)}} \left( k \right)} \right) $$
(17)
$$ \eta_{\text{pc}} \left( {k + 1} \right) = \delta \eta_{\text{pc}} \left( k \right) + \lambda \Re_{\text{pc}}^{2} \left( k \right) $$
(18)
$$ \Re_{\text{pc}} \left( k \right) = \phi \Re_{\text{pc}} \left( {k - 1} \right) + \left( {1 - \phi } \right)e_{\text{pc}} \left( k \right)e_{\text{pc}} \left( {k - 1} \right) $$
(19)

where ‘\(r_{\text{pa}}\)’, ‘\(r_{\text{pb}}\)’, and ‘\(r_{\text{pc}}\)’ are quadrature templates calculated using Eq. (32).

Equation (20) has been used to calculate the average three-phase fundamental active element of current [9, 12].

$$ {\rm I}_{\text{p}} = \frac{{{\rm I}_{\text{pa}} + {\rm I}_{\text{pb}} + {\rm I}_{\text{pc}} }}{3} $$
(20)

Similarly, the weight updating equation for estimation of fundamental reactive components of all the three-phases is depicted in Eqs. (21)–(29).

$$ {\rm I}_{\text{qa}} \left( {k + 1} \right) = {\rm I}_{\text{qa}} \left( k \right) + \eta \left( k \right)e_{\text{qa}} \left( k \right)r_{\text{qa}} \left( k \right)\left( {1 + {\rm I}_{\text{qa}}^{{\left( {1 - g} \right)}} \left( k \right)} \right) $$
(21)
$$ \eta_{\text{qa}} \left( {k + 1} \right) = \delta \eta_{\text{qa}} \left( k \right) + \lambda \Re_{\text{qa}}^{2} \left( k \right) $$
(22)
$$ \Re_{\text{qa}} \left( k \right) = \phi \Re_{\text{qa}} \left( {k - 1} \right) + \left( {1 - \phi } \right)e_{\text{qa}} \left( k \right)e_{\text{qa}} \left( {k - 1} \right) $$
(23)
$$ {\rm I}_{\text{qb}} \left( {k + 1} \right) = {\rm I}_{\text{qb}} \left( k \right) + \eta \left( k \right)e_{\text{qb}} \left( k \right)r_{\text{qb}} \left( k \right)\left( {1 + {\rm I}_{\text{qb}}^{{\left( {1 - g} \right)}} \left( k \right)} \right) $$
(24)
$$ \eta_{\text{qb}} \left( {k + 1} \right) = \delta \eta_{\text{qb}} \left( k \right) + \lambda \Re_{\text{qb}}^{2} \left( k \right) $$
(25)
$$ \Re_{\text{qb}} \left( k \right) = \phi \Re_{\text{qb}} \left( {k - 1} \right) + \left( {1 - \phi } \right)e_{\text{qb}} \left( k \right)e_{\text{qb}} \left( {k - 1} \right) $$
(26)
$$ {\rm I}_{\text{qc}} \left( {k + 1} \right) = {\rm I}_{\text{qc}} \left( k \right) + \eta \left( k \right)e_{\text{qc}} \left( k \right)r_{\text{qc}} \left( k \right)\left( {1 + {\rm I}_{\text{qc}}^{{\left( {1 - g} \right)}} \left( k \right)} \right) $$
(27)
$$ \eta_{\text{qc}} \left( {k + 1} \right) = \delta \eta_{\text{qc}} \left( k \right) + \lambda \Re_{\text{qc}}^{2} \left( k \right) $$
(28)
$$ \Re_{\text{qc}} \left( k \right) = \phi \Re_{\text{qc}} \left( {k - 1} \right) + \left( {1 - \phi } \right)e_{\text{qc}} \left( k \right)e_{\text{qc}} \left( {k - 1} \right) $$
(29)

Using Eq. (30), the average fundamental reactive component across all three phases has been calculated as,

$$ {\rm I}_{\text{q}} = \frac{{{\rm I}_{\text{qa}} + {\rm I}_{\text{qb}} + {\rm I}_{\text{qc}} }}{3} $$
(30)

The magnitude of terminal voltage (vmag) can be calculated as,

$$ \nu_{\text{mag}} = \sqrt {0.67 \times \left( {\nu_{\text{sa}}^{2} + \nu_{\text{sb}}^{2} + \nu_{\text{sc}}^{2} } \right)} $$
(31)

where \(\nu_{\text{sa}}\), \(\nu_{\text{sb}}\), and \(\nu_{\text{sc}}\) are the relative instantaneous voltage values for the a, b, and c phases at PCC.

The in-phase and quadrature unit vectors used for extracting the fundamental components are computed by Eqs. (32) and (33), respectively [9, 12].

$$ r_{\text{pa}} (n) = \frac{{\nu_{\text{sa}} }}{{\nu_{\text{mag}} }},r_{\text{pb}} (n) = \frac{{\nu_{\text{sb}} }}{{\nu_{\text{mag}} }},r_{\text{pc}} (n) = \frac{{\nu_{\text{sc}} }}{{\nu_{\text{mag}} }} $$
(32)
$$ \left. {\begin{array}{*{20}c} {r_{\text{qa}} (n) = \frac{{ - r_{\text{pb}} (n) + r_{\text{pc}} (n)}}{\sqrt 3 },} \\ {r_{\text{qb}} (n) = \frac{{3r_{\text{pa}} (n) + r_{\text{pb}} (n) - r_{\text{pc}} (n)}}{2\sqrt 3 },} \\ {r_{\text{qc}} (n) = \frac{{ - 3r_{\text{pa}} (n) + r_{\text{pb}} (n) - r_{\text{pc}} (n)}}{2\sqrt 3 }} \\ \end{array} } \right\} $$
(33)

Unit templates for quadrature and in-phase have been calculated by utilizing the three-phase source voltage (\(\nu_{\text{sabc}}\)) as shown in Eqs. (32) and (33), respectively, where (\(\nu_{\text{mag}}\)) denotes the estimated magnitude of three-phase voltage as shown in Eq. (31). The error ‘\(f_{\text{ge}}\)’ is calculated by subtracting actual frequency ‘\(f_{\text{g}}\) ‘from reference frequency ‘\(f_{\text{g}}^{ * }\) ‘. The active component of load current is computed as shown in Eq. (34).

$$ i_{\text{lP}} = {\rm I}_{\text{d}} + {\rm I}_{\text{D}} $$
(34)

The magnitude of source voltage ‘\(\nu_{\text{mag}}\)’ is computed by utilizing Eq. (31), and the error ‘\(\nu_{\text{eg}}\)’ has been processed through the PI controller by comparing with its reference value ‘\(\nu^{ * }\). The reactive component of load current is computed as shown in Eq. (35).

$$ i_{Lq} = {\rm I}_{Q} - {\rm I}_{\text{q}} $$
(35)

The active three-phase element of the reference current ‘\(i_{\text{pabc}}^{ * }\)’ has been estimated by multiplying the in-phase unit templates \(\left( {r_{\text{pa}} ,r_{\text{pb}} ,r_{\text{pc}} } \right)\) with ‘\(i_{\text{Lp}}\)’ as given in Eq. (36). Similarly, the reactive three-phase element of the reference current ‘\(i_{\text{qabc}}^{ * }\)’ has been estimated as given in Eq. (37)

$$ i_{\text{pa}}^{ * } = i_{\text{Lp}} \times r_{\text{pa}} ,i_{\text{pb}}^{ * } = i_{\text{Lp}} \times r_{\text{pb}} ,i_{\text{pa}}^{ * } = i_{\text{Lp}} \times r_{\text{pc}} $$
(36)
$$ i_{\text{qa}}^{ * } = i_{Lq} \times r_{\text{qa}} ,i_{\text{qb}}^{ * } = i_{Lq} \times r_{\text{qb}} ,i_{\text{qc}}^{ * } = i_{Lq} \times r_{\text{qc}} $$
(37)

The estimate of the reference source current is obtained by combining the active and reactive components of the reference current as,

$$ i_{\text{sabc}}^{*} = i_{\text{pabc}}^{*} + i_{\text{qabc}}^{*} $$
(38)

The actual ‘\(i_{\text{sabc}}\)’ are compared with these generated ‘\(i_{\text{sabc}}^{ * }\)’. After comparison, the estimated three-phase errors were processed using a triangle waveform based on a high-frequency carrier, and gate pulses were produced for the semiconducting switching devices utilized in the VSC.

4 Whale optimization algorithm for tuning PI controller

The wind-based system on DSTATCOM uses a whale optimization algorithm (WOA) to determine the best PI control settings for managing reactive power flow. The whale is among the most brilliant animals because it has brain cells that are similar to those in human brains, making WOA a novel optimization method. The two PI controllers’ four parameters are optimized, and the solution creates the appropriate objective function (J), shown in Eq. (39), by assuming random solutions for these parameters. At each iteration of WOA, the position has been updated by the search agents, and this update was utilized to calculate the objective function. The best solution is recorded, and the process is repeated as many times as possible. DSTATCOM is driven by two PI controllers, each of which contains two parameters (kp, ki). The WOA optimization approach is suggested for determining the suitable parameters of the PI controller while minimizing the target function ‘J’ in the presence of fault events. It is possible to define the goal function, ‘J’, as follows.

$$ J = \int {e_{{\text{v}}} } t^{2} {\text{d}}t $$
(39)

where ev is the difference in error between the actual and reference values and t is the time.

Three steps constitute the WOA-based optimization process:

4.1 Surrounding prey

The location of their prey is first identified by humpback whales before they circle it. The current best answer or a solution that is close to the best one is expected by the WOA computation. Hence, after the best search agent has been determined, the other search agents will try to update their positions in favour of that agent. The equations below indicate this behaviour.

$$ \vec{\rm A} = \left| {\vec{\rm B} \cdot \vec{Z}^{ * } } \right.\left( j \right) - \left. {\vec{Z}\left( j \right)} \right| $$
(40)
$$ \vec{Z}\left( {j + 1} \right) = \vec{Z}^{ * } \left( j \right) - \vec{\rm P} \cdot \vec{\rm A} $$
(41)

where ‘j’ is the current repetition, ‘\(\vec{Z}\)’ is the position vector, ‘\(\vec{Z}^{ * }\)’ is the best solution position vector, and ‘\(\vec{\rm P}\)\(\vec{\rm B}\)’ are the coefficient vectors. It is important to note that if the solution is better than ‘\({\rm Z}^{ * }\)’ has been updated in each iteration.

The following calculation is performed on the vectors ‘\(\vec{\rm P}\)’and ‘\(\vec{\rm B}\)’,

$$ \vec{\rm P} = 2\vec{p} \cdot \vec{r}_{r} - \vec{p} $$
(42)
$$ \vec{\rm B} = 2 \cdot \vec{r}_{r} $$
(43)

In both the exploration and exploitation stages, ‘\(\vec{p}\)’ is reduced linearly from 2 to 0 for iterations, while ‘\(\vec{r}_{r}\)’ is a random vector with a value between [0, 1].

4.2 Bubble-net attacking strategy

This bubble-net pursuing step defines two methodologies: spiral updating positions and shrinking encircling mechanism.

First, the methodology is obtained by reducing the magnitude of ‘\(\vec{p}\)’ in Eq. (42). Noted that the range of variation ‘\(\vec{\rm P}\)’ is also lowered by ‘\(\vec{p}\)’. In other words, ‘\(\vec{\rm P}\)’ is a randomly chosen value within the range [− p, p], where p reduces from 2 to 0 during the period of iteration. Using random values ‘\(\vec{\rm P}\)’ in the range (1, 1), the new position of a search agent can be defined anywhere between the agent’s original position and the position of the current best agent.

Second, the approach, which is based on modifying position attitudes, is stated as,

$$ \vec{Z}\left( {j + 1} \right) = \vec{\rm A}^{\prime} \cdot e^{\beta n} \cdot \cos \left( {2\pi n} \right) + \vec{Z}^{ * } \left( j \right) $$
(44)

where \(\vec{\rm A}^{\prime} = \left| {\vec{Z}^{ * } } \right.\left( j \right) - \left. {\vec{Z}\left( j \right)} \right|\) shows the gap between the ‘jth’ whale and its prey; the logarithmic spiral's shape is determined by the constant ‘\(\beta\)’, n is a random number in (− 1 1). Whales used to swim around their prey simultaneously using the two techniques indicated above when they were pursuing them. The following 50% probabilities are considered for these two techniques to update the whales’ position:

$$ \vec{Z}\left( {j + 1} \right) = \left\{ \begin{array}{*{20}l} \vec{Z}^{ * } \left( j \right) - \vec{\rm P} \cdot \vec{\rm A} ,& \quad\text{if} {r_{n} < 0.5} \hfill \\ \vec{\rm A}^{\prime} \cdot e^{\beta n} \cdot \cos \left( {2\pi n} \right) + \vec{Z}^{ * } \left( j \right),& \quad\text{if } {r_{n} \ge 0.5} \\ \end{array} \right\} $$
(45)

where \(r_{n}\) is a randomly chosen number in the range from 0 to 1.

4.3 Searching for prey

It is possible to find prey applying the same procedure based on the variation of vectors \(\vec{\rm P}\). In practice, humpback whales conduct random position-based searches. Hence, to induce the search agent to move a significant distance from the reference whale, we use ‘\(\vec{\rm P}\)’ random values as \(\vec{\rm P} > 1\) or \(\vec{\rm P} < - 1\). In the exploration phase, as opposed to the exploitation phase, we alter the positioning of a search agent by selecting another search agent randomly, rather than choosing the best search agent identified thus far. By this technique and the fact that | \(\vec{\rm P}\) |> 1, the WOA algorithm may run a global search. The mathematical model is given as,

$$ \vec{\rm A} = \left| {\vec{\rm B} \cdot \vec{Z}_{rndm} } \right. - \left. {\vec{Z}} \right| $$
(46)
$$ \vec{Z}\left( {j + 1} \right) = \vec{Z}_{rndm} - \vec{\rm P} \cdot \vec{\rm A} $$
(47)

where ‘\(\vec{Z}_{rndm}\)’ represents a position vector randomly chosen from the current populace.

The flowchart of WOA optimization technique is given in Fig. 3.

Fig. 3
figure 3

Flowchart of WOA algorithm

5 Simulation result

The VSC-based three-leg DSTATCOM has been simulated using the simulation environment MATLAB. The ODE4 solver is utilized along with sampling time as 20 µs. ODE4 is characterized by its simplicity in implementation and favourable stability properties. As the step size decreases, ODE4 converges more rapidly towards the true solution, thereby achieving higher levels of accuracy. System with fast dynamics or rapid changes may require a smaller sample time to capture the behaviour accurately. A 20-µs sample time allows the simulation to capture rapid changes in the system behaviour. The suggested RVSS-FLMS control creates gate pulses at a frequency of 5 kHz and then processes them through the VSC to perform as DSTATCOM for the compensation of various current disruptions. On the load side, the three-phase four-wire system is thought to have some current problems. The proposed control method to determine the reference source current has been utilised to calculate the revised weights for the active and reactive components of the connected load current. Both constant and varying wind speeds have been utilized in the study. On system performance in scenarios, including neutral current compensation, load balancing, harmonics reduction, and reactive power compensation, the effects of the control algorithm have been assessed.

5.1 Internal signals of proposed control

Figure 4 shows internal signals of the proposed control algorithm for the estimation of active and reactive components and reference source current. The subplot (1) shows the three-phase source voltages. Subplot (2) represents the source current. When phase ‘a’ is removed, then ‘\(i_{\text{sabc}}\)’ is slightly decreased. Moreover, these are balanced. The subplot (3) depicts the load current for phase ‘a’ which is removed from interval 3.3 s to 3.4 s, during this interval load is unbalanced. Subplots (4) and (5) indicate the in-phase and quadrature unit template, respectively. Subplot (6) indicates the active component of current \(I_{\text{d}}\) , which is obtained by passing the average of active components of phases ‘a’, ‘b’ and ‘c’ through LPF. When wind speed is changed, then this current is also changed, during the load unbalance it is reduced. The subplot (7) indicates the variable wind speed. When wind speed is increased, then ‘\(I_{\text{d}}\)’ is also increased and vice versa. Subplot (8) illustrates the reactive component of current ‘\(I_{\text{q}}\)’ which is obtained by passing the average of reactive components of phase ‘a,’ ‘b’ and ‘c’ through low-pass filter (LPF).

Fig. 4
figure 4

Internal signal of proposed control algorithm

This component of current is negative and remains constant. With the help of ‘\(I_{\text{d}}\)’ and ‘\(I_{\text{q}}\)’ components of the current, the active and reactive reference current ‘\(i^{*}_{\text{pabc}}\)’ and ‘\(i^{*}_{\text{qabc}}\)’ is estimated as depicted in subplots (9) and (10). The subplot (11) shows the reference current ‘\(i^{*}_{\text{sabc}}\)’ which is written by Eq. (37-a). It is observed that the source current ‘\(i_{\text{sabc}}\)’ is balanced with lower magnitude even though the unbalance has been created between time intervals 3.3 s and 3.4 s. This shows that the proposed controller works significantly by maintaining the source current ‘\(i_{\text{sabc}}\)’.

5.2 Dynamic operation of the system with fixed wind speed

Figure 5a and b shows the dynamic behaviour of the system with a four-wire layout under a constant wind velocity and varying nonlinear loads. The DG system in this scenario has been tested with variable load and constant wind velocity. In other words, the performance of the system is evaluated with a fixed input and variable load.

Fig. 5
figure 5

a and b Dynamical operation under constant wind speed

The operation is conducted with a constant wind speed of 13 m/s. For the time interval 3.3 s to 3.4 s, phase ‘a’ is removed to introduce load unbalanced into the system. The measurements include supply currents (isabc), supply voltages (vsabc), compensator currents (iabcC), load currents (iLabc), source frequency (f), amplitude of terminal voltage (Vt), wind speed (Vw), mechanical rotor speed (Wr), battery current, battery voltage (Vb), battery power (Pb), generator power (Pg), load power (PL), electromagnetic torque (Te), and mechanical rotor speed (Wr). Since voltage in this system is measured between phase and neutral, the line-to-line voltage in this system has an RMS value of 240 V, and the maximum RMS value for each phase is 195.9 V. It is considered that SEIG operates in fixed wind velocity mode at a wind speed of 13 m/s.

The reactive power and harmonic compensation in this case at PCC are performed by compensator current. Due to the imbalanced situation in the system, the simulation results of the DG system indicate satisfactory performance. The control technique runs the VSC in a way that keeps the balancing of the source current but with a lower magnitude when one phase becomes open-circuited due to decreased load on the generator. The waveform indicates that the terminal voltage and frequency are kept at their respective reference value of 195 V and 50 Hz. These results indicate that the proposed control technique and its DG system are performing effectively, as seen in the aforementioned figure. The simulation results of this control technique are determined to be satisfactory in terms of improving the power quality feature in SEIG. Figure 6a–c depicts the results of the distribution system related to power quality features. For phase ‘a’, phase voltage, supply, and load current are measured as vsa = 195.4 V, isa = 13.19A, and iLa = 11.78A, and its total harmonic distortions are recorded as 1.62%, 3.84%, and 33.79%, respectively, in a steady-state condition. The THD values for the remaining parameter are given in a tabular format and are displayed in Table 1.

Fig. 6
figure 6

Harmonics spectrum of phase ‘a’. a Source voltage. b Source current. c Load current

Table 1 Performance at the steady condition for constant wind speed

The aforementioned THD values are shown together with the harmonic’s spectrum and signal window for FFT. These values are in the range allowed by the IEEE-519-2014 standard. The proposed controller is implemented to extract the fundamental components of the load current while simultaneously monitoring the PCC voltage, source current, and load current. Due to this, the gate pulses that regulate the VSC provide a reference supply current. At the PCC, the VSC injects compensated current to remove the harmonics from the supply current, and the reactive portion of the load current is also compensated. As a result, the supply current maintains its sinusoidal shape. The system’s dynamic operation with fixed wind speed is shown in Fig. 5a and b. Subplot (1) shows that the supply phase voltages are balanced. Subplot (2) shows the balanced three-phase supply current; its value is reduced during load unbalance. The load unbalancing has been obtained at t = 3.3 s to 3.4 s by removing phase ‘a,’ as depicted in the subplot (3). Subplots (4)–(6) show the VSC’s compensating currents and indicate how effectively reactive power is compensated for source current. Subplot (7) demonstrates a consistent terminal voltage (Vt) of around 195 V during steady-state operation; however, in the presence of load imbalance, a slight increase in its value is observed. Subplot-8 depicts the battery voltage (Vb). The consistent wind speed (Vw) is observable in subplots (9).

In Fig. 5b, the generated power (Pg) is observed in Subplot (1), where it remains consistently constant. When the phase ‘a’ is eliminated, the implemented control method triggers the activation of DSTATCOM. This ensures the balance of supply currents at a slightly reduced level, while also leading to a decrease in the load power demand (PL), as depicted in subplot (2). The battery power (Pb) experiences an upsurge when the load becomes unbalanced, as illustrated in subplot (3). This is due to the converter side receiving generator power (Pg) aimed at charging the battery to its full capacity. The current of the battery is displayed in subplot (4), and it increases when the load is unbalanced. This suggests that the battery is consistently recharging throughout this period. Subplot (5) depicts the source frequency (f), which is tuned close to 50 Hz to improve the power quality. For a 4-pole machine, subplot (6) shows the electromagnetic torque (Tem), while the mechanical rotor speed (Wr) is shown in subplot (7).

5.3 Dynamic operation of the system with variable wind speed

When the wind velocity is steady, the power source generates consistent voltage and frequency. However, when the wind speed fluctuates due to its variable nature, predicting these changes becomes exceedingly challenging. We conducted simulations of the identical system with variations in mechanical parameters at the input to investigate its transient behaviour.

Subplot (8) of Fig. 7a shows the variable wind speed. Wind speed is changed as \(13 \le V_{\text{w}} \le 15\) m/s and \(15 \le V_{\text{w}} \le 12.7\) m/s at the time t = 3.1 s and t = 3.2 s, respectively, to properly examine the system. At the time (t = 3.1 s), when the wind speed (Vw) rises from 13 to 15 m/s, all phases of the supply current also rise, but the amplitude of the PCC voltage does not change. The increased supply current from the previous reference moment has been directed towards the battery system via the VSC, as there has been no alteration in the load current. Therefore, after the introduction of higher wind speed, a greater compensating current is observed as shown in subplot-(4–6) of Fig. 7a. When wind speed increases at the time (t = 3.1 s), then generator power (Pg) is increased as shown in subplot (2) of Fig. 7b, and electromagnetic torque (Tem) and mechanical rotor speed (Wr) are gradually increased as shown in subplots (5) and (6) of Fig. 7b. When employing a star-delta transformer connected at PCC, subplots (8–10) within Fig. 7b illustrate the waveforms of the supply neutral current (iSN), transformer neutral current (iTN), and load neutral current (iLN). The supply neutral current registers as zero indicated in the diagram, this occurs because the load neutral current and transformer neutral current are in phase opposition, effectively cancelling each other out. Since this supply neutral current is compensated by the transformer, it does not pass through the source side. The behaviour of the other parameters is the same as fixed wind speed parameters.

Fig. 7
figure 7figure 7

a and b Dynamical operation under variable wind speed. c Unbalance in the load alone with variable wind speed changes

The load unbalance during variable wind velocity is depicted in Fig. 7c. Here, the wind velocity ‘Vw’ is increased from 13 to 15 m/s at time (t) equal to 3.1 s. After t = 3.2 s, ‘Vw’ is then decreased by 2.3 m/s and continued as 12.7 m/s up to time (t) equal to 3.3 s. The load unbalance is introduced in phase ‘a’ at \(3.15 \, s \le t \le 3.25 \, s\). Even though ‘Vw’ is changed at t = 3.2 s, the DSTATCOM controller injects compensating current during, maintaining supply voltage and frequency at its reference value. At the same time, supply current is balanced during said period.

Moreover, Fig. 8a–c shows the quality of power of the system, which has been analysed. The supply current, supply voltage, and load current values have been noted as 195.1 V, 13.01A, and 11.77A, respectively. Total harmonic distortion (THD) is determined to be 1.73%, 3.76%, and 33.82% for the input voltage, input current, and output current under rated loading circumstances with varying wind speeds. According to IEEE standards 519–2014, this value is less than the allowable limit. The remaining parameter’s THD values are provided in tabular format, as seen in Table 2. As a result, it can be concluded that the proposed control is effective in every possible environmental scenario. Three-phase instantaneous power of the system is given in Table 3.

Fig. 8
figure 8

Harmonics analysis of DSTATCOM, a source voltage of phase ‘a’, b source current of phase ‘a’, c load current of phase ‘a’

Table 2 Performance at the steady condition for variable wind speeds
Table 3 Three-phase instantaneous power of the system

5.4 Performance of WOA for estimation of PI gains

The performance of WOA is compared with PSO algorithm. The necessary parameters for WOA have been decided upon after several implementation trials. To estimate the gains of both PI controllers, 10 search agents have been chosen with a fixed dimension of 4 for the search agents. The number of iterations is 10. The performance attained during the optimization process for estimating the gains of PI controllers is shown in Fig. 8a–c. It covers both the convergence and the gains versus iteration curves.

From Fig. 9c, it is clear that a minimum cost function execution is done by WOA than that of PSO. The convergence curves show that the WOA approach has achieved a minimum value of 17,951.55 after iteration six. The variation of tuning parameters kp1 and ki1 with respect to iterations of the frequency-loop controller is shown in Fig. 9a, whose value settled to a value of 0.28755 and 0.038709, respectively, after 6th iterations. Similarly, the variation of tuning parameters kp2 and ki2 with respect to iterations of the terminal voltage PI controller is shown in Fig. 9b, which are settled to a value of 0.19208 and 0.070581, respectively, after 6th iterations. Table 4 presents the kp and ki values for both the trial-and-error and WOA methods. Table 5 shows the performance comparison of DSTATCOM with PSO and WOA optimization algorithm.

Fig. 9
figure 9

a Variations of the PI gains (Kp, Ki) values for the frequency loop, b variations of the PI gains (Kp, Ki) values for the AC loop, c convergence curve

Table 4 Value of kp and ki for PI tuning
Table 5 Performance of DSTATCOM with PSO and WOA optimization algorithm

5.5 Comparative analysis between manual and WOA tuning

Figure 10 and Table 6 show the comparative performance between manual and WOA tuning of the proposed control in terms of oscillation and steady-state error. Table 6 shows the rise time, overshoot, and settling time of terminal voltage under transient conditions of the proposed control. It is clear that the oscillations and its deviation are less in while performing WOA technique, whereas it is more in the trial-and-error technique. The settling time and overshoot of terminal voltage are less in WOA method as compared to trial-and-error method. Hence, WOA is a powerful optimization algorithm that can be used to tune PI controllers for a wide range of applications, offering advantages such as efficiency, robustness, accuracy, flexibility, automation, and ease of use. Table 7 shows the performance comparison of proposed control scheme with LMS control scheme in terms of Rise time, overshoot and settling time.

Fig. 10
figure 10

Comparative performance between manual and WOA tuning

Table 6 Comparative performance between manual and WOA tuning for terminal voltage
Table 7 Performance comparison of proposed control scheme with LMS control scheme

5.6 Comparative analysis of RVSS-FLMS and conventional LMS control scheme

Figure 11 illustrates the comparison of the proposed RVSS-FLMS control with conventional LMS for terminal voltage at transient conditions. The red colour and blue colour waveforms show the terminal voltage response of conventional LMS and proposed RVSS-FLMS control, respectively. It is observed from Fig. 11 that the settling time (ts) is 1.82 s and percentage overshoot (Mp) is 5.27% in case of proposed RVSS-FLMS control. The settling time is faster and the percentage overshoot is smaller in case of proposed RVSS-FLMS control compared with the conventional LMS control.

Fig. 11
figure 11

Performance comparison of RVSS-FLMS with LMS for terminal voltage at transient condition

6 Conclusion

In the paper, the current-based power quality problems due to connected load were discussed. These problems are compensated through DSTATCOM with WOA-optimized PI gains in wind-powered, self-excited induction generator. It is used for power generation in a standalone system. In this system, the RVSS-FLMS-based adaptive control has been used for regulation of frequency and voltage with PQ problems such as neutral current compensation, load balancing, harmonics reduction, and reactive power compensation for the nonlinear load. The fundamental frequency components of the supplied current that are not ideal have been successfully extracted by the suggested RVSS-FLMS control. Furthermore, the source reference current is produced using the extracted basic fundamental components. After comparing the proposed control algorithm with LMS control scheme, it is examined that there is quicker settling time (1.82 s) and lesser percentage overshoot (5.27%) in case of RVSS-FLMS control scheme. This is evidence of having better performance. The gains of both the PI controllers are tuned by whale optimization algorithm. The trajectory of cost function for WOA and PSO algorithm notifies that the value of cost function is small in case of WOA. Due to advantages like fewer parameter tuning, no dependency on initial solution, straightforward algorithm structure, smaller overshoot, and faster settling time, WOA is well suited for gain tuning of PI controller.