1 Introduction

In the recent years, incorporation of distributed generation like wind, tidal, solar, etc. into the distribution network is supported in order to minimize the burden and stress on the converters and ratings. The solar integrated UPQC was implemented to resolve PQ issues efficiently. In addition a novel fuzzy-based proportional integral controller (PI-C) was designed for Maximum power tracking technique for extract maximum power and to balance DLCV [1]. Besides, the double-stage UPQC with solar PV was suggested to handle voltage and current related issues based on unit vector generation technique (UVTG) [2]. Next, the three-level UPQC with ANN-based reference signal generation was suggested to handle the PQ issues and also to eliminate complex p-q transformations [3]. However, the UPQC in association to the solar battery system with ANN-based reference signal generation was proposed to handle the PQ issues and also to eliminate complex p-q transformations [4]. Further, the fuzzy back computation was adopted for DLCV stabilization and reference signal generation to minimize the voltage and current THD [5].

The various existing algorithms for controlling the operation of SHAPF and harmonics isolation techniques, DLCV regulation, current control methods were are discussed [6]. Meanwhile, the hybrid series active power filter was implemented with ANFIS controller to suppress the THD in voltage harmonics generated by nonlinear loads [7]. The distributed generation, which combines wind and PV, was built with the goal of creating an effortless transition between the grid to the island & vice versa while preventing load changes [8]. Meanwhile, the Solar-PV powered UPQC was presented to reduced grid current THD during voltage fluctuations like sag, swell by adopting ANN, and in addition the proposed method was compared with SRF and reactive power theory methods under varying load conditions [9]. Besides, particle swarm and grey wolf algorithms was chosen to achieve the PI-C’s optimal Kp, Ki values for SHAPF with a goal of controlling the power successfully and diminishing the distortions in current signal [10]. However, to keep the DLCV constant and to manage the power, the feedforward-based ANN was designed for wind system and solar PV system of UPQC [11]. A new ANN control-based reference signal generation was suggested for solar fuzzy-based MPPT battery system of UPQC to address PQ problems [12]. Future, a multilevel voltage source converter (VSC)-based UPQC was linked to the fuel cell with PV and wind system-based microgrid with an intention of handling PQ issues efficiently [13]. Meanwhile, the comprehensive analysis was done on several kinds of phased synchronize techniques which are suitable for the control and operation of SHAPF [14]. However, the GW-O-based PI-C was suggested for various loading conditions of UPQC with a view of minimizing THD [15].

A new method was proposed to UPQC for the quick action in fault reorganization with good accuracy in addition stabilizing DLCV oscillations [16]. The artificial neuro-based fuzzy hybrid control scheme was designed to UPQC for addressing grid voltage problems like swell, THD, sag etc. and load current THD efficiently [17]. The hybridization of both Improvedbat and Mothflame metaheuristic optimization methods for selection of gain parameters of PIC was suggested to address the PQ issues [18]. The fuzzy logic controller (FLC) was suggested for SEAF for the local distribution system to eliminate the voltage fluctuations and current THD effectively [19]. A Soccer match optimization for optimal design of ANNC was suggested to PV and BSS integrated UPQC to solve PQ issues in distribution system [20]. An adaptive hysteresis band with fuzzy logic controller (FL-C) was designed to the PV associated 9-level VSC-based UPQC with an aim of obtaining fluctuations free voltage waveforms [21]. A Soccer-league optimization was proposed for the optimal selection of gain parameters of PIC for UPQC to handle both voltage fluctuations and current distortions successfully [22]. The ANN-based reference gate pulse generation method was developed for five-level UPQC to handle current and voltage distortions successfully [23].

The UPQC controller achieved phase synchronization through the utilization of a STF combined with the UVGT. The successful execution of the Self-Tuning Filter (STF) in UPQC eliminated the requirement for a PLL, and the STF with UVGT method was employed to generate synchronization phases for both filters of UPQC [24]. Besides, a harmonic compensation method tailored for hybridized AC-DC converter operating for low switching frequency was introduced. The proposed approach was explored, covering the discussions on the approach, modeling schemes, stability studies [25]. Meanwhile, the development of a SAPF was aimed at regulating grid-integrated PV systems to mitigate harmonic distortions. The PV-integrated SAPF effectively supplies active and reactive power to the grid to reduce harmonic components. Furthermore, adaptive techniques such as ANN like ANFIS, Widrow–Hoff Adaptive Linear Neuron, and Modified Widrow–Hoff Adaptive Linear Neuron were utilized to create the reference current for the Inverter [26].

An enhanced photovoltaic system was combined with a hybrid filter to enhance the PQ in distribution network. The shunt filter was developed, incorporating photo-voltaic, utilizing an advanced signal processing technique known as the dual-tree complex wavelet transform to extract frequency-related information from the voltage and current signals caused by PQ disturbances [27]. Moreover, an economical Hybrid Shunt Active Power Filter was introduced to address the issue of THD. Furthermore, a unique inference method was employed to calculate the per-unit fundamental component of the reference current in-phase. In addition, a new Fuzzy-PID Controller was utilized to maximize the reference current value. The optimization of all controller parameters was carried out using an Enhanced Football Game Optimization method [28]. Furthermore, in order to mitigate disadvantages, a hybrid SHAPF was devised. The calculation of the reference current involved the utilization of the dual-tree complex wavelet transform (DT-CWT), while the optimization of the parameters for the HSAPF system was achieved through the application of conventional proportional-integral (CPI) control, as well as type-1 and type-2 fuzzy logic controllers (T1FLC and T2FLC). This approach was adopted to enhance the system's capability to compensate for harmonics and improve power factor [29].

Majority of the literature papers using evolutionary algorithms attempted only to tune parameters of the conventional PIC. It also illustrates that the traditional techniques for UPQC currently in use involve complex Clarke's and Park's changes. This research proposes an innovative artificial intelligence (AI) scheme, in conjunction with PV and BSS, incorporating an ANN approach, and it optimizes the ANFIS controller parameters of UPQC using FFHSA.

The prime contribution of this work is as follows:

  • An ANNC scheme trained with LMBP is recommended to produce required reference signals for VSCs, thereby avoiding the need for traditional abc to dq0 to αβ conversions, such as p-q and SRF methods.

  • FFHSA is suggested for optimal selection of fuzzy MSF parameters and weights of ANFIS controller for DC Link.

  • The prime goal of the developed ANNC-FFHSA is to suppress the distortions in source current signal and in turn enhancing the PF, handling the grid voltage related PQ issues like (sag, swell, disturbance, unbalances etc.)

  • The PV with BSS is associated to the UPQC’s DC link to meet the load demand, quick response in maintaining constant DLCV during variable load and irradiation to minimize the stress and rating of the VSC’s.

  • Additionally, the suggested ANNC-FFHSA for PV and energy BSS integrated UPQC (UPVBSS) is validated on four test studies for several combinations of supply voltages, G, temperature, loading conditions to reveal the overall performance w.r.t the current THD, PF through the waveforms.

  • However, to reveal the viability of the suggested method THD, and DLCV settling time is compared with GA and PS–O algorithms in addition to p–q and SRF methods.

The manuscript is structured as follows: Sect. 1 provides an introduction, Sect. 2 covers the design of proposed UPVBSS, Sect. 3 elaborates on the control scheme, Sect. 4 discusses the obtained results, and, lastly, Sect. 5 serves as the conclusion of the paper.

2 Design of proposed system

The developed UPQC arrangement is depicted in Fig. 1. In this setup, solar PV is linked to the DC link of the UPQC via a boost converter, while the BSS is connected through a buck-boost converter. In this context, "Vabc" denotes the supply side voltages, "Vs_abc" represents the phase voltages at the source bus, and "Vl" and "il" refer to current and voltage at the load terminals. "Rs" designates the grid side resistance, and "Ls" signifies the source inductance. The UPQC combines both series and shunt VSCs. The primary purpose of the SAPF is to address voltage-related issues on the grid side by supplying appropriate compensation voltage "Vse" through an injecting transformer. The RL filter consists of a resistor "Rse" and an inductor "Lse." The SHAPF is connected through resistance, interfacing inductance "Lsh," and capacitance "Csh" to the grid. The SHAPF's objective is to reduce harmonics in the current signal and maintain DLCV at a constant level with minimal settling time by injecting the necessary current "ish".

Fig. 1
figure 1

Block diagram of proposed UPQC

2.1 External support for direct current-link

The incorporation of solar/battery to the UPQC’s DClink reduces the requirement of large ratings and burden on converters with lower demand from the utility. Here, Boost Converter (B–C) is used to boost the output of solar system and the charge and discharge of battery attached to the DC’s link is handled with Buck-Boost converters (B–B–C) to regulate the DLCV during variation in loads. As the modeling of PV and Battery systems are already available in the literature [5], the control circuit of PV and battery is explained. The equation for DClink power demand (\(P_{{{\text{dc}}}}\)) of the suggested technique is given in Eq. (1).

$$ P_{{{\text{PV}}}} + P_{{{\text{BSS}}}} - P_{{{\text{dc}}}} = 0 $$
(1)

2.1.1 Solar power generating (SPG)

Solar system transfers the sun’s irradiation into electric power. The quantity of PV cells connected in series and in parallel plays a pivotal role in determining the necessary solar generation capacity. In this work PV model is taken from simulink library. As the modeling of PV is available in the literature, this work mainly focuses on the optimal design of controller. The power of PV system (\(P_{{{\text{PV}}}}\)) is given by Eq. (2)

$$ P_{{{\text{PV}}}} = V_{{{\text{PV}}}} \times i_{{{\text{PV}}}} $$
(2)

where\(V_{{{\text{PV}}}}\), \(i_{{{\text{PV}}}}\) implies the output voltage and current of photovoltaic panel. In this study, the Maximum Power Point Tracking (MPPT) employs the Perturb and Observe (P & O) a widely used method for maximizing the efficiency of solar photovoltaic systems or other renewable energy sources by continuously adjusting the operating point of the power converter to track the maximum power point (MPP). This technique involves perturbing (slightly changing) the operating conditions and observing the resulting change in power output. Here, it is used to regulate the duty cycle (ΔD) of the boost converter, as illustrated in Fig. 2. The adjustment in duty cycle is determined by assessing alterations in power (ΔP) and voltage (ΔV). When power increases, the algorithm raises the voltage, and conversely, when power decreases, it reduces the voltage.

Fig. 2
figure 2

P&O MPPT algorithm flow chart

2.1.2 BSS

The BSS supports in stabilizing the DLCV. The state-of-charge-of-battery (SOCB) is expressed in Eq. (3).

$$ {\text{SOCB}} = 100(1 + \int {i_{{{\text{BSS}}}} \;} {\text{d}}tQ) $$
(3)

The SPG output will decide the operational condition of a BSS, whether it should discharge or charge, while fulfilling to the constraints specified in Eq. (4).

$$ {\text{SOCB}}_{\min } \le {\text{SOCB}} \le {\text{SOCB}}_{\max } $$
(4)

By minimizing the DLCV error Vdc,err by a PI-C, the irefdc is calculated. By using PI-C, the battery error reference current iBS,err* is computed. Where, iBS,err represents the discrepancy between the battery reference current irefBS received from LPF and the irefdc obtained from it. The graphical representation of energy management at DC link is illustrated in Fig. 3. If the solar power produced is greater than the required DC link power, the excess solar power is used to charge battery if SOCB is less than its higher limit. Similarly, if solar power produced is lower than the required DC link power, the remaining power is supplied by the battery if the SOCB is greater that its lower limit. The complete control circuit of PV and battery systems with the proposed UPQC system is exhibited in Fig. 4.

Fig. 3
figure 3

Power Distribution at DC link

Fig. 4
figure 4

Controller of proposed system

2.2 Capacitor value at DC link

The value of \(C_{{{\text{dc}}}}\) can be calculated [5] by Eq. (5).

$$ C_{{{\text{dc}}}} = \frac{{\pi *i_{{{\text{sh}}}} \;}}{{\sqrt 3 \omega V_{{\text{cr,pp}}} }} $$
(5)

The \(V^{{{\text{ref}}}}_{{{\text{dc}}}}\) is selected within the allowable ratings of the proposed system. The selection of \(C_{{{\text{dc}}}}\) depends on peak to peak voltage ripple (\(V_{{\text{cr,pp}}}\)) and shunt compensating current.

2.3 Inductor for shunt and series VSC with isolation transformer

With the support of an inductor (\(L_{{{\text{sh}}}}\)), the shunt VSC is connected to the network. Equation (6) provides the switching frequency, ripple current, and DLCV.

$$ L_{{\text{sh,min}}} = \frac{{\sqrt 3 \;m\;V_{{{\text{dc}}}} }}{{12\;a_{f} \;f_{{{\text{sh}}}} \;I_{{\text{cr,pp}}} }} $$
(6)

Assuming the modulation depth (\(m\)) as 1, over loading factor (\(a_{f}\)) is 1.5, and switching frequency (\(f_{{{\text{sh}}}}\)) is 10 kHz [24], the value of \(L_{{{\text{sh}}}}\) depends on peak to peak ripples (\(I_{{\text{cr,pp}}}\)). The connection of the series VSC to the grid is facilitated by a 3-phase series injection transformer, and its design parameters are defined in Eqs. (7) and (8).

$$ K_{{{\text{se}}}} = \frac{{V_{L - L} }}{{\sqrt 3 \;V_{{{\text{se}}}} }} $$
(7)
$$ L_{{\text{se,min}}} = \frac{{\sqrt 3 \;m\;V_{{{\text{dc}}}} \;K_{se} }}{{12\;a_{f} \;f_{{{\text{se}}}} \;I_{{\text{cr,pp}}} }} $$
(8)

Assuming that the switching frequency (\(f_{{{\text{se}}}}\)) is 10 kHz [24], the series inductance depends on ripple current.

3 Proposed ANN scheme

Generally, VLDC varies during the dynamic load variation. However, a quick return to the initial value is required to bring the network back to normal state of DLCV. Here, the recommended ANNC is used together with PWM hysteresis-current-control for shunt VSC and gate firing pulses for VSC.

3.1 Shunt filter

The primary objective of SHAPF is to mitigate distortions in the current signal and maintain DLCV stable in the presence of faults and varying load situation by introducing compensatory currents.

3.1.1 Proposed FFHSA for optimal design of ANFIS for DLCV balancing

The ANFIS is suggested to maintain constant DLCV. The suggested ANFIS is an intelligent hybrid controller with the combination of ANN-C and FL-C features. However, for maintaining DLCV constant, the chosen reference DLCV is compared with respect to the obtained DLCV; and its output Error (E), change in Error (CE) is considered as inputs. The inputs fed to the ANNC are initially trained according to the triangular membership function (MSF) to produce the best as shown in Fig. 5. ANFIS mainly consists of five layers, the 1st layer (Fuzzification) the outputs of this layer are fuzzy MSF given by Eq. 9

$$ \begin{gathered} \mu_{{{\text{Ai}}}} (x),i = 1,2. \hfill \\ \mu_{{{\text{Bj}}}} (y),j = 1,2. \hfill \\ \end{gathered} $$
(9)

where, \(\mu_{Ai}\)\(\mu_{{{\text{Bj}}}}\) are the MSF outputs obtained from the 1st layer.

Fig. 5
figure 5

Triangular MSF

In this work, triangular MSF is selected due to its simplicity in defining and understanding. It is defined by three parameters: the lower bound (a), the peak or center value (b), and the upper bound (c). This simplicity makes them easy to work with in both theory and practical applications. Moreover, calculating the membership value for a given input is computationally efficient for triangular MSF compared to other types of MSF. The mathematical representation of triangular MSF is given by Eq. 10

$$ \mu_{{{\text{Ai}}}} {\text{(x)}} = \max (\min (\frac{{x - a_{i} }}{{b_{i} - a_{i} }},\frac{{c_{i} - x}}{{c_{i} - b_{i} }}),0) $$
(10)

where the range (universe of discourse) of x is xmaxxmin (upper and lower bonds) and bi is the point of maximum support of the fuzzy set i. The input and output categories include Negative-Big (NTB), Negative-Medium (NTM), Zero (ZOE), Positive-Small (PTS), Positive-Big (PTB), Positive-Medium (PTM), and Negative-Small (NTS). Figure 6 illustrates the inputs and outputs of the MSF, while Table 1 displays the fuzzy-rule base.

Fig. 6
figure 6

Fuzzy MF for E, CE

Table 1 Fuzzy rule-base

However, in the 2nd layer (weighting of fuzzy rules) the AND operator is applied, and calculates the firing strength \(w_{i}\) by adopting MSF computed in 1st layer whose output is calculated by Eq. (11).

$$ w_{k} = \mu_{{{\text{Ai}}}} (x)*\mu_{{{\text{Bj}}}} (y)i,j = 1,2. $$
(11)

The normalization of values takes places in the 3rd layer received from the previous layer. Each node reaches normalization by evaluating the ratio of the kth rule’s firing strength (truth values) to the summation of all rule’s firing strength is given Eq. (12).

$$ \overline{{w_{k} }} = \frac{{w_{k} }}{{w_{1} + w_{2} }}k = 1,2. $$
(12)

The self-adaptive ability of the ANN-C is carried out by applying the inference parameters \((p_{k} ,q_{k} ,r_{k} )\) in the 4th layer (defuzzification) output is given by Eq. (13).

$$ \overline{{w_{i} }} f_{i} = \overline{{w_{i} }} (p_{k} u + q_{k} v + r_{k} ) $$
(13)

Lastly, at the 5th layer inputs are get added up to produce the desired total ANFIS output by Eq. (14).

$$ f = \sum\limits_{i} {\overline{{w_{i} }} f_{i} } $$
(14)

Figure 7 shows the block diagram of the proposed ANFIS. The task is to reduce learning errors in order to improve the overall performance of the ANFIS controller by optimizing ai, bi and ci of MSF parameters and the neuron weights using FF and HSA combined hybrid algorithm. The problem is formulated to minimize the objective (Ω) which is represented as MSE by evaluating the fitness or brightness function \(F\) given by Eq. 15

$$ \begin{gathered} {\text{Maximize}}\;\;F = \frac{1}{1 + \Omega } \hfill \\ \Omega = \frac{1}{n}\sum\limits_{p = 1}^{m} {(O_{p} - \overline{O}_{p} )^{2} } \hfill \\ \end{gathered} $$
(15)
Fig. 7
figure 7

Structure of ANFIS

Here, \(o\) is the output obtained, \(\overline{o}\) is the desired, and m is the number of instance. The proposed hybrid algorithm (FFHSA) is discussed in detail.

3.1.2 Firefly algorithm (FFA)

The FFA is inspired by the flashing behavior of the set of the fireflies. Firstly, a set of fire flies are arbitrarily generated in the space. Here, every fire fly resembles the required solution, which relies totally on the selected parameters for control. Here, every firefly (y) is the control variables whose bonds are given as

$$ y^{k} (\min ) \le y^{k} \le y^{k} (\max );k = 1,2...{\text{nd}} $$
(16)

where \({\text{nd}}\) = Total variables.

This algorithm uses bioluminescent communication for the movement among the fireflies. Every firefly is mesmerized towards the brightness of another fire-fly and attempts to shift towards it. The brightness function (F) of firefly gives the suitable value of the chosen problem. In the iterative process FFA calculates F and alters their positions accordingly. The attractiveness \(\beta_{ij}\) between the \(i^{{{\text{th}}}}\), \(j^{{{\text{th}}}}\) firefly is represented by Eq. (17)

$$ \beta_{ij} = \beta {}_{0}\exp ( - \gamma r_{ij}^{2} ) $$
(17)

where \(r_{ij}^{{}}\) represents the Cartesian distance between \(i^{{{\text{th}}}}\), \(j^{{{\text{th}}}}\) firefly and is computed by Eq. (18)

$$ r_{ij}^{{}} = \left\| {y_{i} - y_{j} } \right\| = \sqrt {\sum\limits_{{k{ = 1}}}^{{{\text{nd}}}} {{\text{(y}}_{{\text{i}}}^{{\text{k}}} } } - y_{j}^{k} )^{2} $$
(18)

In team, \(i^{{{\text{th}}}}\) firefly shifts towards the \(j^{{{\text{th}}}}\) firefly and modifies its location, if \({\text{BF}}_{j}\) is larger than \({\text{BF}}_{i}\) at \(t^{{{\text{th}}}}\) moment by Eq. (19)

$$ y_{i} (t) = y_{i} (t - 1) + \beta_{ij} (y_{j} (t - 1) - y_{i} (t - 1)) + \alpha ({\text{rand}} - 0.5) $$
(19)

3.1.3 Harmony search algorithm (HSA)

It is inspired from the musicians' improvisation technique of music, is a metaheuristic iterative optimization technique and explores the problem space for optimal solution that maximizes the chosen fitness function (F) while fulfilling the problem constraints. The selected parameters of the algorithms are listed in Table 2. A harmony memory (HM) comprising a number of candidate solutions, each representing a harmony, is defined in the problem space as given in Eq. 20.

$$ \begin{gathered} {\text{HM}} = \left[ {\begin{array}{*{20}c} {{\text{harm}}_{1}^{1} } & {{\text{harm}}_{2}^{1} } & \cdots & {{\text{harm}}_{N}^{1} } \\ {{\text{harm}}_{1}^{2} } & {{\text{harm}}_{2}^{2} } & \cdots & {{\text{harm}}_{N}^{2} } \\ {{\text{harm}}_{1}^{3} } & {{\text{harm}}_{2}^{3} } & \cdots & {{\text{harm}}_{N}^{3} } \\ \vdots & \vdots & {} & \vdots \\ {{\text{harm}}_{1}^{{{\text{HMS}}}} } & {{\text{harm}}_{2}^{{{\text{HMS}}}} } & \cdots & {{\text{harm}}_{N}^{{{\text{HMS}}}} } \\ \end{array} } \right] \hfill \\ {\text{harm}}_{i} \to [{\text{harm}}_{{i{\kern 1pt} 1}} ,\;{\text{harm}}_{{i{\kern 1pt} 2}} ,\; \ldots {\text{,}}\; \ldots {\text{,}}\; \ldots ,\; \ldots \;{\text{,harm}}_{{i{\kern 1pt} m}} ] \hfill \\ \end{gathered} $$
(20)
Table 2 Selected parameters for algorithms

The optimal design of MSF for the FLC is selected as optimization problem with a aim of reducing the error by optimally choosing fuzzy membership parameters ai, bi and ci. The quality of each harmony is assessed by a harmony fitness function (F), formed from the objective as the chosen problem as Eq. 11. An improvised harmony \({\text{harm}}{\prime} {\text{ = (harm}}_{{1}}{\prime} {,}\;{\text{harm}}_{{2}}{\prime} {,}\;{\text{L}}\;{\text{,harm}}_{N}{\prime} {)}\) is generated by comparing a random number with HM adjusting rate (HMAR) value as explained in Eq. (21).

figure a

Where, rand () is a random number (0 ~ 1). The pitch of each variable in the improvised harmony is adjusted based on the pitch tuning rate (PTR) by Eq. 22.

figure b

Where, BW denotes bandwidth. If the improvised harmony vector \({\text{harm}}\,{^{\prime}}\) is superior than the worst harmony in the HM, then the worst one is replaced by the new harmony \({\text{harm}}\,{^{\prime}}\). The generation of new Harmony is repeated till convergence. Based on the \(F\) value, each firefly updates position, HMAR, PTR in HSA improves the convergence process to represent the global optima solution. The process is carried out until it reaches maximum iterations (Tmax). Table 3 lists the parameters that were selected for the optimizations that were suggested and compared.

Table 3 BSS and PV Ratings

The FFA is well-suited for solving global optimization problems, where the goal is to find the best solution in a search space. Its exploration and exploitation mechanisms help it converge to global optima efficiently. This approach allows for parallel exploration of the search space, increasing the chances of finding the global optimum. It is less prone to getting stuck in local optima, and it often finds high-quality solutions even in complex and non-convex search. Similarly, the HSA can be scaled for large-scale optimization problems by adjusting parameters and population sizes. This scalability allows it to tackle problems of varying complexity. Moreover, it is problem-independent it does not rely on prior knowledge of the optimization problem's mathematical structure. This makes it suitable for a wide range of real-world applications. Actually, large-scale optimization is the problem with the FFA. In a similar manner, the HSA algorithm should require improvement in terms of convergence speed. Therefore, combining the two methods is planned in order to achieve improved convergence and outcomes. In this work, the hybrid FFHSA adapts both the properties of FFA and HAS to obtain the best optimal solution. The pseudocode of the proposed hybrid algorithm is as follows:

figure c

3.2 ANN control scheme for reference current signal generation

Figure 6 depicts the suggested ANN controller for the shunt filter. An input layer (IPL), output layer (OPL), and hidden layer (HIL) are present in the ANNC configuration. The IPL's goal is to gather provided data and transfer it to the HIL. It is then multiplied by the weights on the linked links that connect the IPL and HIL. In this case, mathematical computations are performed with a chosen bias on HIL. Finally, the outcomes are resolved in OPL. To get the intended result, the link's weights are adjusted during training by analysing the inaccuracy.

The Levenberg–Marquardt (LM) algorithm is a widely used optimization technique for training ANN. The LM algorithm is used to minimize the cost function by adjusting the weights and biases of the neural network. The LM algorithm relies on computing gradients, and back propagation (LMBP) is used to calculate the gradients of the cost function with respect to the network parameters (weights and biases). This involves computing the gradients layer by layer, starting from the output layer and propagating them backward through the network. During the each iteration of the LM algorithm, the network's weights and biases are updated based on the calculated gradients. The updates are determined by the LM algorithm's rules, which depend on the curvature and error in the cost function. Therefore, LMBP technique is adopted in this work to obtain faster convergence.

As seen in Fig. 8, the reference currents (irefsh_a, irefsh_b, irefsh_c) are regarded as target data, whereas the load currents (il_a, il_b, il_c) and DC loss component (Δidc) acquired from FFHSA are considered as input. Additionally, Fig. 9 depicts the structure of the suggested BP for the generation of the reference current signal in the HIL using 200 neurons. It is believed that a hysteresis regulator with ± 0.25A and ± 0.5A band can generate the necessary gating signals for the shunt VSC.

Fig. 8
figure 8

Shunt VSC controller

Fig. 9
figure 9

structure of ANNC for reference current generation

3.3 Series filter

The primary contribution of SAPF is to provide appropriate compensating voltages to mitigate grid voltage fluctuations and maintain a stable voltage supply to the load. In Fig. 10, the proposed control scheme for the series VSC is depicted. The reference voltage signals (Vrefse_a, Vrefse_b, Vrefse_c) are generated using the supply voltage signals (Vs_a, Vs_b, and Vs_c) as input data, while the reference voltage is considered as the target data for the ANNs. Figure 11 illustrates the ANN's structure, consisting of 200 neurons in a HIL. The gating pulses for the series VSC are produced through PWM.

Fig. 10
figure 10

Series-VSC controller

Fig.11
figure 11

Series ANNC structure

4 Results with discussions

The UPVBSS with ANNC was designed using MATLAB 2016a. In Table 3, you can find the specifications for the solar system and BSS. Additionally, Table 4 displays the parameters for the system and UPQC. To demonstrate the functionality of the developed ANNC-FFHSA, four test cases were chosen, each involving various permutations of rectifier-based nonlinear loads, balanced or unbalanced source voltages, and different circumstances such as voltage swell, disturbance, and voltage sag, with varying irradiation (G) and a temperature of 25 °C, as outlined in Table 5. Specifically, for the first three studies, a balanced phase supply (VS) was selected, while an unequal phase supply was used for case 4. The first case examined balanced voltage sag, while cases 2 and 3 focused on sag and disturbance issues. The minimization of THD, improvement in PF and maintaining constant DLCV were considered as prime motive in this work. To show the working of the proposed ANN-based FFHSA, the results are compared with GA and ACA methods. The convergence plot of MSE for proposed FFHSA in comparison with GA and ACA for case1 is given in Fig. 12. The PF is extracted from the obtained THD by Eq. 23.

$$ {\text{PF}} = \cos \theta *\frac{1}{{\sqrt {1 + {\text{THD}}^{2} } }} $$
(23)
Table 4 Gris system’s & Device specifications
Table 5 Case studies
Fig. 12
figure 12

Comparison of convergence characteristics for case-1

The magnitude of voltage during sag/ swell (\(V_{{\text{sag/swell}}}\)) is evaluated by Eq. (24)

$$ V_{{\text{sag/swell}}} = \frac{{V_{l} - V_{S} }}{{V_{l} }} = \frac{{V_{{{\text{se}}}} }}{{V_{l} }} $$
(24)

The compensated voltage supplied by series converter is in Eq. (25)

$$ V_{{{\text{se}}}} = V_{l} - V_{S} $$
(25)

The compensated current supplied by series converter is in by Eq. (26)

$$ i_{{{\text{sh}}}} = i_{i} - i_{S} $$
(26)

For Case 1, balanced VS is chosen, and it is used to assess the performance of SAPF. In this scenario, 30% voltage sag was intentionally introduced into the VS from 0.25 s to 0.35 s, as depicted in Fig. 13a. The ANNC recognizes the dip, in the voltage effectively and supplies the required compensating voltage to maintain terminal voltage constant. To investigate the performance of SHAPF of proposed ANNC-FFHSA, load 1 and load 4 were considered. The load terminal current waveform is identified to be polluted with harmonics, nonsinusoidal and balanced as exhibited in Fig. 13b. The method that was developed effectively mitigated the distortions in the source current. As a result, the THD of the current decreased significantly, dropping from 29.94 to 3.61%. Additionally, the PF increased substantially to 0.99899, which is very close to unity. In addition, the proposed technique regulates the DLCV by maintaining the constant voltage of 700 V as highlighted in Fig. 13c for constant 1000W/m2 irradiation and 250c of constant temperature.

Fig. 13
figure 13figure 13

Signal for the suggested method for the case study one

In Case 2, much like in Case 1, balanced VS is employed. To assess the effectiveness of SAPF, a 30% voltage swell was induced in the time interval from 0.4 s to 0.5 s. However, ANNC identifies the hike in voltage in the grid current and eliminates it by injecting the required compensating voltage as illustrated in Fig. 14a. The il waveform was identified to be sinusoidal and unbalanced due to the combination of load 2 & 3. To demonstrate the variation in load current waveform load 3 is included at 0.6 s as seen in Fig. 14b. However, the suggested method successfully suppresses current THD, i.e. from 11.54% to 3.58%, which is lesser than other techniques and the PF rises to almost unity. Here, variable G and load change is considered simultaneously under constant temperature of 25 °C. However, the suggested method maintains constant DLCV of 700 V during G variations as shown in Fig. 14c.

Fig. 14
figure 14figure 14

Signal for the suggested method for the case study two

In case3, the VS is selected to be balanced and validated by inserting a disturbance from 0.6 to 0.7 s as demonstrated in Fig. 15a. Nonetheless, the ANNC successfully identifies and mitigates the disturbance by delivering the necessary voltage, as demonstrated in Fig. 13a. Likewise, to assess the effectiveness of the SHAPF, Load 1, in combination with Load 3, was taken into account. This combination resulted in a highly polluted and unbalanced current waveform, as depicted in Fig. 15b. The proposed approach effectively eliminates the imperfections and corrects the imbalance in the current signal. The THD of current signal falls from 24.33 to 3.48%, and the PF rises to almost unity. Besides, the proposed controller keeps DLCV constant for temperature variation as shown in Fig. 15c.

Fig. 15
figure 15figure 15

Signal for the suggested method for the case study three

For Case 4, unbalanced VS is selected. The ANNC-controlled SAPF successfully detects these imbalances and efficiently rectifies them, as depicted in Fig. 16a. In this scenario, Load 1 was connected in combination with Load 2 and Load 3. Load 2 was introduced at 0.3 s, and Load 3 at 0.5 s, resulting in a polluted and unbalanced load current waveform, as illustrated in Fig. 16b. The THD of the current was notably reduced, dropping from 21.86 to 4.51%, and the PF increased to unity. In addition, the proposed controller holds constant DLCV during load variation, temperature as well as irradiation variation successfully shown in Fig. 16c.

Fig. 16
figure 16figure 16

Signal for the suggested method for the case study four

Table 6 gives the THD and PF comparison of the proposed method (ANN-FFHSA) with those of other standard methods like GA, PS-O and other controllers available in the survey. It clearly exhibits that proposed method has much lower THD and higher PF when compared to other techniques. Figure 12 portrays that proposed FFHSA reaches to lower MSE of 0.01107 in lower number of iterations (25) has fast convergence when compared GA (52) and ACA (45).

Table 6 THD and PF comparison

The optimized MSE values of proposed method with GA, ACA are listed in Table 7. In Table 8, we compare the maximum, minimum, and average of THD values achieved by the 50 trials for case-1 using the PPFO method. Additionally, the success rate is also provided within the table. It reveals that the average THD attained by the FFHSA algorithm is much close to the lowest THD value. Moreover, compared to current methods, the success rate after 50 trials is higher. These results, which show both a higher success rate and lower THD, provide statistical evidence of the robustness of the proposed method in its ability to consistently converge towards the best global solution. However, Fig. 17 represents the spectrum of source current for the proposed system for all the test cases. The switching frequencies [24] and sampling time are 10 kHz and 10 µs. Furthermore, Fig. 18 shows the superior performance of the proposed approach in rapidly achieving stability in DLCV, taking less than 0.1 s, which is notably shorter than the durations required by alternative methods.

Table 7 Comparison of MSE
Table 8 Statistical comparison of THD result for case-1
Fig. 17
figure 17figure 17

THD spectrum for all case studies

Fig. 18
figure 18

Comparison plot of time (sec) taken to reach DLCV stable

5 Conclusion

This work suggests a AI approach for a solar battery-connected UPQC utilizing an ANNC. The ANNC, trained using the LMBP algorithm, is recommended for the integration of solar batteries with the UPQC. The objective is to generate the necessary reference signals for the shunt and series VSCs without the need for conventional transformations such as abc to dq0 to αβ. In addition, the ANFIS parameters are optimally selected by adopting FFHSA algorithm with a view of minimizing MSE effectively. However, the proposed UPVBSS maintains constant DLCV during loads and solar irradiation, temperature variations, suppress the current harmonics improves the shape of current waveform thereby boosting up the PF, eliminates the fluctuations of voltage. After analyzing the THD and PF of the system in the absence of the UPQC, the THD values were found to be 29.94% for case1, 11.54% for case2, and 24.33% and 21.86% for case3 and 4, respectively. However, through the implementation of the proposed FFHSA, the THD values were significantly reduced to 3.61%, 3.48%, 3.48%, and 4.51% for the respective cases. This clearly demonstrates that the FFHSA method effectively brought down the THD to acceptable levels and improved the PF to nearly unity. In future, the developed method can be expanded for the microgrid associated multilevel UPQC. In addition, the controllers and parameters can be optimally tuned by using advanced metaheuristic algorithms.