Control of UPQC based on steady state linear Kalman filter for compensation of power quality problems

A frequency lock loop (FLL) based steady state linear Kalman filter (SSLKF) for unified power quality conditioner (UPQC) control in three-phase systems is introduced. The SSLKF provides a highly accurate and fast estimation of grid frequency and the fundamental components (FCs) of the input signals. The Kalman filter is designed using an optimized filtering technique and intrinsic adaptive bandwidth architecture, and is easily integrated into a multiple model system. Therefore, the Kalman state estimator is fast and simple. The fundamental positive sequence components (FPSCs) of the grid voltages in a UPQC system are estimated via these SSLKF-FLL based filters. The estimation of reference signals for a UPQC controller is based on these FPSCs. Therefore, both active filters of a UPQC can perform one and more functions towards improving power quality in a distribution network. In addition to the SSLKF-FLL based algorithm, a bat optimization algorithm (based on the echolocation phenomenon of bats) is implemented to estimate the value of the proportional integral (PI) controller gains. The bat algorithm has a tendency to automatically zoom into a region where a promising alternative solution occurs, preventing the solution from becoming trapped in a local minima. The complete three-phase UPQC is simulated in the Matlab/Simulink platform and the hardware is tested under various power quality problems.


Introduction1
The fast development of nonlinear loads in electrical systems is resulting in a deterioration of both the voltage and current power quality (PQ) at the point of common coupling (PCC) [1] . The nonlinear loads are mostly based on power electronics devices [2] . Similarly, the growth of digital electronics and microprocessorbased control has increased the number of critical loads that require ideal sinusoidal input signals to function appropriately [3] . Disruptions to the grid voltage affect the critical industrial load, resulting in frequent tripping [4] . Power electronics based flexible AC transmission system (FACTS) devices are attractive tools for enhancing the reliability and control of reactive power in transmission systems [5] . These devices offer greater system flexibility and respond quickly to Manuscript received October 13, 2019; revised February 9, 2020; accepted May 11, 2020. Date of publication June 30, 2020; date of current version June 12, 2020. any disturbances [6] . The unified power flow controller (UPFC) is chosen for regulation of bus voltage and control of power flow in a transmission system via a common DC link [7] . Similar FACTS devices is configured, such as shunt, series, and hybrid, for improving the PQ in distribution power system [8] . In these systems, a unified power quality controller (UPQC) is a hybrid device configured similarly to a UPFC, which combines the functionality of shunt and series active power filters (APF) [9] . The shunt APF compensates for current based disturbances, while the series APF suppresses voltage based PQ problems. Simultaneously, the UPQC mitigates reactive current components of the load and improves the power factors of the system [10] . Therefore, the UPQC is acknowledged as one of the most powerful devices for mitigating PQ problems.
A comprehensive review of UPQC control structures are discussed in Refs. [10][11]. Most methods used to regulate UPQC control are based on time domains as they involve easy calculations and fewer memory space requirements [12] . The majority of techniques frequently used in UPQC include instantaneous reactive power theory (IRPT) [13] , synchronous reference frame theory (SRF) [14] , the unit vector template method [15] , and instantaneous symmetrical components theory (ISCT) [16] . Among these, the SRF method is the simplest owing to its simple structure and low computation cost. However, the SRF algorithm still uses low pass filter (LPF) dependency on numerical filter, which creates delay in the signal [17] . The retrieval of fundamental components of the grid voltage is a vital requirement for injecting a balanced positive sequence current under asymmetric voltage or harmonic distortion conditions [18] . In Ref. [19], the use of conventional second order generalized integrator frequency lock loop (SOGI-FLL) filters for extracting fundamental components (FCs) is suggested, they provide high accuracy when the grid voltage is smooth. However, the synchronization error is unacceptable under distorted grid conditions due to the limited attenuation capacity of the second order generalized integrator (SOGI) filters [20] , these are highly vulnerable to the presence of lower order harmonics and DC offset in the system [21] . Some modifications, on the basis of conventional PLL structures, are suggested in the literature resulting in advanced SOGI-PLLs, their performance is further improved by employing Kalman filter techniques [22] . Similarly, a steady state linear Kalman filter (SSLKF) based frequency lock loop (FLL) is been proposed for extracting FCs under distorted conditions, which is superior to conventional SOGI filters [23] . This includes a linear Kalman filter (LKF) for extracting the in-phase FC signal and its quadrature and a frequency estimation of the input signals. The SSLKF-FLL significantly improves DC offset filtering and has a lower computational cost and faster dynamic response, compared to the standard SOGI-FLL. This characteristic plays a major role in the design of the aforementioned classical control algorithm to better mitigate PQ issues for a UPQC system.
In combination with the SSLKF control algorithm, PQ issues are continuously and effectively mitigated when the UPQC DC link voltage is maintained at the desired magnitude, usually via control schemes and, specifically, a proportional integral (PI) controller. The PI controller gains, filtering parameters, and other gains of the UPQC are calculated using a linearized mathematical model of the system. However, such design parameter values might not provide satisfactory results under dynamic working conditions or when the system is a highly nonlinear complex structure. To overcome this, the application of genetic algorithms is proposed by researchers for the optimal choice, location, and sizing of FACTS devices in deregulated power systems [24] . In Ref. [25], a nature-inspired bat algorithm (BA), based on the echolocation phenomenon used by bats, is implemented in a static VAR compensator (SVC) for power system stability enhancement. Similarly, the BA in Ref. [26] is adopted for tuning the PID-controller design variables in a biological wastewater treatment plant. The BA can automatically zoom into a region where a promising alternative solution has been found, using echolocation and frequency tuning techniques to solve problems [27] . The control parameters used in the BA can be varied throughout the iterative process, it provides a way to automatically transition from exploration and exploittation as the optimal solution approaches [28] . The BA has several further advantages, such as speed, accuracy, flexibility, and ease of execution. It can efficiently resolve a broad variety of issues and highly nonlinear problems [29] . This advantage of the BA is useful for calculating PI controller gains to achieve better performance of a UPQC with highly nonlinear loads.
In this paper, a SSLKF control based FLL algorithm is developed for a three-phase UPQC. The SSLKF is placed in front of the FLL in order to obtain sinusoidal waveforms that match the input signal as closely as possible, even when the voltage is highly distorted. This ensures fast and low distortion operation of the FLL and hence of the UPQC system. The computational burden is relatively modest, as the Kalman filter is fully linear. The fundamental components of the current, voltage, and angle can be obtained from the initial state via the Kalman filter. Consequently, this method is fast and simple. Two sets of SSLKF-FLLs are used for the extraction of the fundamental positive sequence components (FPSCs) from the common coupling point bus, these further help to build reference signals for both APFs. The reference currents generated from the Kalman filter based control for the shunt compensator are sinusoidal and balanced. Similarly, the series APF is used to maintain the sinusoidal load voltage at a required magnitude. In addition to a SSLKF-FLL based control algorithm, the BA is implemented to calculate the gain of the PI-controller, improving the system response. The performance analysis of the UPQC is validated under commonly encountered dynamic conditions, such as voltage, sag/swell, load unbalancing, and distortion in the three-phase supply system.

UPQC configuration and design
The complete power circuit diagram is shown in Fig. 1. The main components of the UPQC system are shunt compensator (shunt APF), series compensator (series APF), attached alongside a DC capacitor (C DC ), series and shunt interfacing inductors (L se , L sh ) and ripple filters (R f , C f ). The DC bus voltage is controlled via the proposed SSLKF-FLL algorithm, with proportional integral (PI) control and sinusoidal pulse width modulation (SPWM) switching techniques. As a series compensator, voltage-related PQ problems on the source side must be compensated for using the series APF. Similarly, the shunt compensator must compensate for current-related PQ problems on the load side via the shunt APF. Each APF consists of six insulated gate bipolar transistor (IGBT) switches. The series and shunt APFs interface with the grid via the interfacing inductors L se and L sh , respectively. The series injection transformer is employed to insert the necessary compensating voltages produced by the series APF, providing the desired sinusoidal voltages to sensitive loads. The supply side impedance of the grid is taken as Z s . The ripple filters (R f , C f ) are designed to evade the harmonics generated when both APFs are switched.
The UPQC system design process begins from the consideration of system parameters, such as nominal voltage, frequency, load power rating, etc. The shunt compensator is configured to mitigate current harmonics and full-load reactive power. In sequence to incorporate the required series compensator design, e.g., turns ratio (N), injection DVR transformer, DC bus capacitor (C DC ), and series interfacing inductor (L se ). The other specifically designed components are the shunt interfacing inductors (L sh ) and ripple filters (R f , C f ). The design of the UPQC system is given below.

DC link voltage (V DC )
The magnitude of the DC-link voltage is calculated based on modulation index (m) and grid line voltage (V L ) and expressed as [2,18] L DC 2 2 3

DC bus capacitor (C DC )
The DC capacitor bus value builds upon the instantaneous energy of the shunt compensator during the transients. The factors that should be considered during transient operation are the overloading factor (a), phase voltage (V ph ), shunt APF phase current (I sh ), variation in energy dynamics (k), and t is the time through which the DC link voltage is to be recovered. According to the conservation of energy principle, the C DC is formulated as where V DC is the nominal DC voltage equal to the reference level DC quantity and V DC1 is the minimum DC voltage value.

Shunt interfacing inductor (L sh )
This relies on the current ripple (I cr,pp ), switching frequency (f sw ), overloading factor (a), modulation index (m), DC link voltage (V DC ), and is selected as DC sh sw cr,pp 3 12

Series injection transformer
This is a single unit three-phase transformer in which series APF side winding are joined together in a star arrangement and line side windings of the transformer are attached to each line in series, as demonstrated in Fig. 1. Let 'x' be the maximum p.u. swell/sag calculated when the reference load voltage (V L ) is taken with supply voltage (V s ). The series transformer (S SE ) rating is based on the injected voltage (V inj ), DC bus voltage of the APF (V APF ), current carried during sag (I se,sag ), and turns ratio (N) and formulated as

Series interfacing inductor (L se )
It is calculated using the ripple current at swell condition (I cr,swell ), turns ratio (N), overloading factor (a), modulation index (m), and switching frequency (f sw ) and the DC link voltage can be given as DC se sw cr,swell L se,swell ph 3 12 A first order high-pass filter designed and calibrated for filtering out the higher frequency noise at half of the switching frequency. The time constant for a ripple filter should be very small compared to the fundamental time period (T), R f ×C f T/10, where R f and C f are the filter resistance and capacitance, respectively.

Control strategy
The complete control strategy for generalized UPQC is illustrated in Fig. 2. Here, the reference signal generation for both APFs is broadly illustrated using SSLKF-FLL. Fig. 2 depicts the block diagram of a SSLKF based FLL filter. The SSLKF-FLL is used to extract the FCs from the PCC voltage. Subsequently, these signals are used to generate reference signals for both the shunt and series compensators. Finally, the BA optimization technique is helpful in tuning the PI controller gains, rather than tuning the gains via a trial and error (manual) method. This section includes each aspect of the control strategy, including the BA for PI gains tuning. Fig. 2 shows the block diagram of a SSLKF based FLL filter. It is inherently a discrete time domain algorithm that involves a LKF to extract the in-phase FCs and quadrature of the input signal. Simultaneously, the FLL circuit is used to estimate the frequency of the system. The Kalman filter is used to extract unknown variables from the noisy and linearly related states of the linear dynamic system. The primary distinction between the SSLKF-FLL and conventional SOGI is that some computationally demanding recursive equations are used to update the Kalman gains. The grid frequency, ω, estimation depends only upon the gains, λ. Therefore, as the steady-state grid frequency shows a slight variation across the nominal frequency, it can be analyzed that the steady-state values of λ has minor modifications to their nominal frequency. The SSLKF-FLL provides a significant improvement to DC offset filtering, with less computational burden and a faster dynamic response [23] compared to standard SOGI-FLL. Let ω in Fig. 2 be constant. Therefore, the transfer functions relating the output signals, v fα and v fβ , to the input signal, V in , can be obtained as

SSLKF-FLL
Based on the SOGI-FLL tuning conditions, ω = ω n = 100π rad/s is selected for the computation of the gain parameters of SSLKF-FLL. By defining k 1 =kω, k 2 = For different combinations of damping factor and Kalman parameters (k 1 , k 2 ), bode plots of the in-phase signal (v fα ) of the SSLKF with respect to supply signal (V in ) are shown in Fig. 3. Similarly, the bode plot of the quadrature (v fβ ) components can be plotted with the help of Eq. (7). Here, ω = ω n = 100π rad/s is selected. Note that the phase structure of the SSLKF, shown in Fig. 3, behaves as a band pass filter for a damping factor 1 / 2 ζ = , which is more stable than the other damping factors. However, the quadrature components of the SSLKF behave like a low pass filter.  Fig. 3, it can be concluded that the SSLKF-FLL yields a relatively greater DC offset and better harmonic rejection capability. These features can be attributed to the second control gain (the β-axis gain) of the SSLKF-FLL. Therefore, it has a slightly greater and more damped dynamic response than the SOGI-FLL.

Reference signal generation using SSLKF-FLL for UPQC
The development of the reference signal for UPQC relies on the fundamental positive sequence components (FPSCs) of the PCC signals. The separation of the FPSCs is a key task for the generation of reference signals in UPQC control. In this paper, the FPSCs are estimated using the SSLKF-FLL, with a positive sequence transformation matrix, T + , illustrated in Eqs. (8)- (9). As can be observed from Fig. 2, the SSLKF-FLL provides fundamental in-phase (v fα ) and quadrature (v fβ ) version components of the input signal (V in ).
To extract the FPSCs from the input voltages (v sabc ), a Kalman filter is employed, shown in Fig. 4. The three-phase voltages (v sa , v sb , and v sc ) are transformed to two-phase voltages (α-β frame) using Clark's transformation matrix. The α components, v α , and β components, v β , of the voltages are filtered using SSLKF-FLL filters to estimate the fundamental (v fα , v fβ ) and quadrature components (qv fα , qv fβ ). The relationship between the FPSCs and FCs is illustrated as Compensation of Power Quality Problems The fundamental positive sequence voltages in the α-β frame ( , where power, P loss (t) is projected as active power of the supply current at instant t. K p and K i are the PI controller constants. The P loss not only contains all the switching losses but also the ohmic losses of the compensators. It is a necessary element for controlling the DC link voltage over PQ disruptions in order for the shunt compensator to regulate the DC link voltage to its required level. Accordingly, the reference power (P ref ) to be drawn from the grid is obtained as, ref These fundamental positive reference currents ( sabc i + ), obtained from Eq. (11), act as reference supply currents ( * labc i ). They are then with the sensed actual currents (i sabc ) via a SPWM controller to generate the gating pulses required for the shunt APF, as shown in Fig. 4. The main function of the series APF is to protect critical loads from PCC voltage disturbances. Fig. 4 also illustrates the reference load voltage generation for the series connected compensator. The magnitude of the FPSC from the PCC voltage is determined as This amplitude is used in calculation of unit templates from FPSC. It is given as The load reference voltage ( * labc v ) is determined by multiplying the peak reference voltage ( * lref v ) with the unit templates ( sabc u + ). These reference load voltages ( * labc v ) are compared to the actual sensed load voltages (v labc ) to generate the gating pulses. These SPWM based gate signals are required for the series APF. This can be clearly observed in Fig. 4.

PI-controller gains evaluation from bat algorithm technique
This section investigates the BA for PI parameters in the UPQC control scheme, such that the UPQC can produce better outcomes with respect to error regulation, strengthening the UPQC performance. The BA is based on micro bats echo-location characteristics. This uses a frequency tuning technique to increase the diversity of potential solutions within the population pool, while concurrent automated zooming aims to balance exploration and exploitation during the search cycle. BA optimization is a stochastic algorithm, in which diverse results are achieved each time, although the same initial point is considered for further evaluation. The BA optimization is therefore repeated 20 times to provide reasonable observations for further analysis. This is to achieve optimal PI-Controller gain results, based on when the stopping criteria is met, i.e., in this study, reaching the maximum number of iterations (t). The result was chosen on the basis of the integral time square error (ITSE) as the cost function or objective function. This selection is due to characteristics of this function, which improves dynamic response with satisfactory settling time. ITSE can be expressed as where ( ) ( ) ( ) e t y t r t = − is the error in Eq. (14) and y(t) and r(t) are the output and required output of the system. Thus, a smaller error results in a smaller burden on the PI-controller gains of Eq. (10) in the UPQC system. The optimal tuned PI-controller gains values are selected when value of objective function (ITSE value) is smallest. Thus, the UPQC system performs better when the cost function ITSE value is lowest.
The BA's approximate rules can be classified into three categories [28][29] . First, each bat use echo-location to sense distance and in some unknown manner they also understand the distinction between food/prey and the surrounding obstacles. Second, bats fly arbitrarily, with variable frequency (f), variable wavelength (λ), and loudness (A 0 ), investigating for prey by automatic adjusting the frequency of their emitted pulses. Finally, although the loudness may differ in various ways, it is expected to vary within the range A 0 to minimum constant value A min . Fig. 5 shows the BA flowchart.
The BA techniques are specified as following.
(1) Initialize the randomly generated micro bats and initial population size of bats in an N-dimensional search space.
(2) Estimate the objective function for each random number of bats. The internal parameters are also initialized including pulse frequency, pulse rate, and loudness.
(3) Generate the initial bats position and velocity.
(4) If a random number between 0 and 1 is bigger than the pulse rate (i.e., random>pulse rate), choose the best solution from the bats groups.
(5) If a random number is greater than loudness (i.e., random > loudness) and f new ≤ f min , acknowledge this as a new solution. (6) Keep this location and increase the pulse rate and loudness. Determine the optimum and rank the bats accordingly.
(7) Return to Step (3) and repeat all steps until the criteria for stopping is met.
where [0,1] β ∈ is a random vector derived from an even distribution; t i x is the present global best location (solution) found after computing each bat to the entire solution. The present best solution is obtained by where A t is the average loudness of all the best components in the current iteration process; the constant [ 1,1] ∂ ∈ − is a random number. By executing these steps, the optimum PI gains (K p and K i ) are predicted using the optimal cost function f(x) of 6 318.74, as shown in Fig. 6. Using these acquired PI values, the UPQC has a better dynamic response when compared with manually tuned values. This method improves UPQC's output, improving the PQ. Here, the BA uses 20 agents and 2 design variables (K p and K i ) for 50 iterations. Fig. 6a depicts the adjustment of the objective function values in comparison to iterations reached after the 20 iterations at 6 318.74. Fig. 6b and Fig. 6c demonstrates the K p and K i PI gains plots for a DC link voltage, which settled at 200.15 and 1.0, respectively. These acquired PI values improve the performance of the UPQC's output, improving the PQ. In order to check the acknowledgment and reliability of the PI controller with the BA technique, the DC bus voltage with the previously mentioned PQ disturbances is examined. It is determined that the BA techniques result in a more stable and rapid DC-bus voltage, compared to trial and error tuning techniques. The optimized value of K p and K i , retrieved via the BA, will assist in UPQC control. The results of which are explained in the following section.

Simulation results
The performance evaluation of the proposed SSLKF based FLL control algorithm is carried out on the UPQC system. The model is analyzed using the Matlab/Simulink software platform, with a fixed sampling time of 10 μs and a discrete domain through 5 ode solvers. The PI controller parameter values obtained via the BA are also employed to estimate the performance of the UPQC. Throughout this section, the results for system disturbances, such as voltage sag, swell, harmonics, and unbalanced loading conditions are reported to demonstrate the successful operation of the SSLKF-FLL controller with a nonlinear load on the UPQC system. Tab. 1 contains system parameters and detailed design values of three wire UPQC for performance analysis.

Dynamic behavior SSLKF-FLL based control and shunt converter used in UPQC
The dynamic behavior of the UPQC under unbalanced loading and current distortions is presented in Fig. 7. Load unbalancing is obtained in phase 'c', when it is injected at time 0.5 s and before that it is in two phases connection to line appearing in the unbalanced load situations. Due to phase removal the balanced supply currents (i s ) have been observed during load current (i l ) unbalancing. The compensating current (i coma , i comb , and i comc ) of the shunt APF, as shown in Fig. 7, indicates the well-organized reactive power compensation for the supply current. The self supporting DC bus voltage (V DC ) summary is also shown here, which is within the 3% tolerance limit. The V DC is accommodating of its 700 V level from fluctuations of 16 V. There is an imperceptible shift of one cycle in the waveforms due to the use of lower order filters in the DC link voltage and active average power (P lavg ) calculation. It is necessary for the UPQC controller to estimate reference power (P ref ) calculations. The load voltage (v l ) profile is sustained at its desired level irrespective of load unbalancing conditions. The  The waveforms show that the three-phase supply current (i s ) almost follows the reference supply currents * sref ( ) i under dynamics disruption due to the shunt APF injected current. It is also of note that supply voltage (v s ), load voltage (v l ), and supply current (i s ) are in phase with each other. Thus, it is concluded that the shunt compensator of UPQC functions as power factor correction during load dynamics. From the results, the load in "phase c" is connected from 0.5 s and the variation in compensating currents (i coma , i comb , and i comc ,) of all phases are shown. At this time, it is observed that the shunt APF provides the necessary compensating currents with desired magnitude in all three phases, before and after the unbalanced load conditions, to maintain the sinusoidal supply current.

Steady-state and dynamic response of UPQC with SSLKF-FLL
The steady-state and dynamic response of UPQC with SSLKF-FLL control is shown in Fig. 8. The waveforms seen in this figures are the three-phase supply voltages (v s ), supply currents (i s ), load voltage (v l ), load currents (i l ), DC link voltage (V DC ), series compensator compensation voltages (v inja , v injb , and v injc ), and shunt compensator compensation currents (i coma , i comb , and i comc ). A voltage sag of 0.70 p.u magnitude is observed at 0.5-0.56 s; voltage swells of 1.30 p.u amplitude at 0.6-0.66 s; and at 0.5-0.56 s a supply voltage corrupted from the −11 th to the +13 th order harmonic, with amplitudes of 1/15 th and 1/20 th of the fundamental voltage, is imposed on the grid voltages (v s ). At 0.5-0.6 s the load is adjusted from three-to two-phase, when "phase c" is removed from the supply line. This caused an unbalanced load state in the network. From the implementation results, it is observed that the shunt compensator part of the UPQC compensates for unbalanced loading. Similarly, it balances the sinusoidal source current (i s ) and maintains it as in phase with the source voltages (v s ). The UPQC series compensator serves as compensation for the voltage sag/swell and distortion and results in distortion free load voltage (v l ), as shown in Fig. 8. It also compensates for the load voltage (v l ) from all the PQ perturbations and is sinusoidally balanced with the desired magnitude. Therefore, it maintains constant voltage at the load side common coupling point. Simultaneously, the shunt compensator maintains the balanced supply current and regulates the power factor at unity. The SSLKF-FLL control algorithm keep up the DC link voltage close to a reference level under the PQ perturbations mentioned above. The harmonic spectrums of supply voltage (v s ), supply current (i s ), load voltage (v l ), and load current (i l ), are expressed in Tab. 2. The "line to line" signals are listed here for the harmonic spectrum study but due to the symmetrical phase results they are practically identical to the other phases of the system. The total harmonic distortion (THD) of the source current is 3.63%, filtered from the load current THD of 26.83%. Similarly, the THD of the load voltage is 3.16%, also filtered from a supply voltage THD of 16.85%. The harmonic range supports the restriction of harmonic levels below 5% for medium level grid voltage as per, the IEEE standards on SSLKF-FLL control of UPQC systems.

Test results
The SSLKF-FLL control algorithm is built on a three wire UPQC system for non-linear loads. The SSLKF-FLL is designed and programmed using OP-5142 real time simulator with 60 μs sampling time. The four channel digital storage oscilloscope (DSO) is used to capture all waveforms. A switching frequency of 10 kHz is chosen during the implementation for both APFs. The dynamic behavior of the UPQC system is tested with PQ disturbances described previously. A PQ analyzer, FLUKE-4B, is used to evaluate the THD during harmonic distortion. Both the internal signal and steady-state response of the UPQC are measured in "phase to ground" values. The entire performances of the waveforms are shown in Figs. 9-11, with identical references to phase 'a' and other phases. The system parameter and control algorithm values are given in Tab. 3.

Reference supply current generation for shunt compensator
The primary task of the SSLKF-FLL circuit is to estimate the FPSCs during steady-state and under PQ perturbations. On the basis of these in-phase ( )  Fig. 9a illustrates its stability during transient conditions. It is regulated by instantaneous active power loss components (P loss ), as demonstrated in Fig. 4. The active powers (P lavg ) in subplot 3 are needed for generating the reference signal for the shunt APF at the load side. During sag conditions, the reference power (P ref ) in subplot 4 is obtained when P loss is added to P lavg , represented in Fig. 9a , shown in subplots 1, 2, 3, and 4, respectively, used to generate the reference supply current for the shunt compensator. Fig. 9c depicts the reference source current ( * sa i ) in subplot 1 generated for the shunt APF with the help of signals shown in Fig. 9b. In Fig. 9c, it is noted that the sensed source current (i sa ) in subplot 1 follows the reference source current ( * sa i ) in subplot 2, during sag deviation. In the SPWM controller, the errors (i er ) in signals derived between the difference of the sensed actual and reference supply current, subplot 3 of Fig.  9c, are utilized to procure gating pulses (G 1a in subplot 4) for the shunt APF.

Dynamic performance of UPQC
Figs. 10-11 illustrate UPQC's dynamic performance analysis to compensate the above mentioned PQ disruption using an SSLKF-FLL based control technique. These signals are taken for "phase a" at occurrence when the dynamic PQ disruptions are adjusted to nominal conditions. Figs. 10a-10d depicts the information regarding the supply voltage (v sa ), supply current (i sa ), load voltage (v la ), and load current (i la ) during voltage swells, sags, harmonics distortions and load unbalancing, respectively. In these figures, a voltage swell of 20%, sag of 20%, and 11 th and 13 th order voltage distortions are superimposed on the initial supply voltages, as shown in Figs. 10a-10c. The UPQC provides alleviation for voltage harmonics and manages distortion free load voltage, as indicated in Fig. 10c. The supply current magnitude decreases or increases in conjunction with the change in input voltages, as seen in Figs. 10a-10b, subplot 2, during voltage sag and swell deviations. Simultaneously, load voltage is sustained in a sinusoidal wave-shape with a fixed magnitude, independent of PQ disturbances. As shown in subplot 4 of Fig. 10, the load current tends to be extremely distorted and the supply current retains a sinusoidal wave-shape via the UPQC. Phase 'a' of the load is disconnected to cause an unbalanced load condition (in subplot 4), which is shown in Fig. 10d. The sinusoidal feature of the supply current is also sustained at the desired level. Simultaneously, sinusoidal load voltage is maintained throughout various PQ disturbances. From close observation of Figs. 10a-10d during these disruptions and nominal situations, the load voltages (v la ) in subplot 3 are seen to be in-phase with the supply currents (i sa ) in subplot 2, indicating that the UPQC maintains a unity power factor and preserves the balanced load voltage. Figs. 11a-11c shows the behavior of the DC link voltage (V DC ), in subplot 4, with supply voltage (v sa ) in subplot 1, load voltage (v la ) in subplot 2, and the compensating voltage of "phase a" (v ca ) in subplot 3 at various PQ disruptions. Figs. 11a-11c clarifies that the compensated voltage injected by the series transformer is in-phase during sag and harmonic distortion and in-quadrature during swell conditions. Similarly, Fig.  11d shows the supply current (i sa ) in subplot 1; load current (i la ) in subplot 2; compensating current of phase A (i ca ) in subplot 3, injected during the unbalance loading situation; and the DC link voltage (V DC ) in subplot 4. It is seen that the sinusoidal supply current is preserved and the shunt compensator injects a current with the required wave-shape. The fluctuations of the DC link voltage can be seen in Figs. 11a-11d in subplot 4, during dynamic disturbance and the DC link voltage is regulated at the required level over one cycle. All figures indicated that the UPQC's dynamic performance with the SSLKF-FLL based control algorithm successfully mitigates all of the PQ problems.  Fig. 12a and Fig. 12b illustrates the waveforms recorded when the supply voltage distortions are present in-line with nonlinear loads. Fig. 12a displays the supply voltage (v sa ) waveforms with voltage distortion of the above mentioned conditions and supply current (i sa ) after mitigation. The source current (THD) in Fig. 12b has been improved to 3.8% from the load current THD of 18.20%.

UPQC performance at steady state condition
The summarized results relating to steady-state analysis for harmonic distortion are given in Tab. 4. Tab. 4 illustrates the recorded results of "phase a" during uncompensated supply voltage (v sa ), compensated load voltage (v la ), mitigated source current (i sa ), and distorted load current (i la ) under non-linear loads on the UPQC system. These performance results are studied with aforesaid harmonic distortions in the supply side voltage and load current. The results refer to knowledge concerning the distorted supply voltage with 11.30% THD and an RMS value of 110.70 V. It is clarified that the load voltage (v la ) is compensated for, having a 109.3 V RMS value and 4.7% THD.  Similarly, the supply current has an RMS value of 6.62 A with 3.8% THD, after mitigation. The nonlinear load is known to have an RMS value of 5.75 A and a THD of 18.20%. It is evident that v la and i la are within the acceptable THD limits provided by IEEE-519-2014. This result proves the capability of the UPQC system to compensate for harmonic disturbances.

Conclusions
SSLKF based control is conducted for a three-phase UPQC system under a nonlinear load to achieve PQ compensation. SSLKF control is able to identify the FPSCs (in-phase and quadrature) and grid frequency accurately for the UPQC system, providing fast and smooth steady-state and dynamic responses. The combination of FLL with steady state linear Kalman filters demonstrates superior behavior when compared to other types of single phase PLL techniques published in the literature. It shows that the phase angle and amplitude of a distorted waveform can be precisely and rapidly determined via the Kalman filters. The PI controller parameters, which are tuned in this study using BA optimization, seek minimized DC bus voltage variations, even with upset value of current or voltage. After the 20 iterations, the PI controller proportional (K p ) and integral (K i ) gain are obtained as 200.15 and 1.0, respectively, which maintains the DC bus voltage levels at their desired magnitude. The simulation and test results determine the validity of the proposed UPQC algorithm. The proposed UPQC and BA demonstrates the potential for performance enhancement of the system and PQ improvement of the distribution networks. The presented work can be investigated and evaluated in the future with different linear (or a combination of both linear and nonlinear) loads via the same control algorithm. Similarly, soft computing techniques, such as fuzzy control, artificial neural networks, or intelligent control algorithms, can be used for three-phase UPQCs to improve the system's effectiveness. Renewable energy sources, such as wind and solar power can be integrated with this (or other) topologies of UPQC.