Construction and Performance Investigation of Three-Phase Solar PV and Battery Energy Storage System Integrated UPQC

This study examines the use of Unified Power Quality Conditioner (UPQC) to mitigate the power quality problems existed in the grid and the harmonics penetrated by the non-linear loads. The UPQC is supported by the Photovoltaic (PV) and Battery Energy Storage System (BESS) in this work. Generally, the PV system supplies the active power to the load. However, if the PV is unable to supply the power then the BESS activates and provides power especially during the longer-term voltage interruption. The standalone PV-UPQC system is less reliable compared to a hybrid PV-BESS system because of its instability and high environment-dependency. Therefore, BESS will improve the voltage support capability continuously in the longer-term, reduce the complexity of the DC-link voltage regulation algorithm, and keep producing clean energy. The phase synchronization operation of the UPQC controller is directed by a self-tuning filter (STF) integrated with the unit vector generator (UVG) technique. Implementation of STF will make sure the UPQC can successfully operate under unbalanced and distorted grid voltage conditions. Thus, the requirement of a phase-locked loop (PLL) is omitted and the STF-UVG is utilized to produce the synchronization phases for the series and shunt active power filter (APF) compensator in UPQC controller. Finally, the proposed STF-UVG method is compared with the conventional synchronous references frame (SRF-PLL) method based UPQC to show the significance of the proposed technique. Several case studies are further considered to validate the study in MATLAB-Simulink software.


I. INTRODUCTION
Energy is the basic input of life. Electricity is one of the significant energy among the different forms of energy. It ensures the flexibility of life and the demand for this energy is increasing rapidly. In recent decades, the 'Power Quality' term has achieved remarkable responses from the researchers, most importantly in the electrical engineering sector. Energy efficiency is maintained by compensating the power quality problems which ensures a smooth generation of electrical energy and to encourage decarbonization of the grid. Under The associate editor coordinating the review of this manuscript and approving it for publication was Madhav Manjrekar. different environmental conditions and requirements, the definition of power quality can have several interpretations and significances. For instance, the network can be affected by the harmonics created by non-linear loads which is a great concern for the utility and the disturbances existed in the supplied voltage is a great concern for the consumers. Power losses, undesirable and abnormal characteristics of equipment due to power quality problems can cause interference in neighboring communication lines, and disruption to different consumers. IEEE-1159 [1] stated the behavior of a standard waveform and categorized a different kind of disturbances. A complex power quality scenario is a specific disturbance that consists of an amalgamation of two or more individual disturbances, VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ for instance, fluctuation or harmonics for a small period distortion such as, sags or surges [2]. The voltage disturbances such as voltage harmonics, swells, and sags are responsible for the tripping of equipment like sensitive loads and the consequences can be detrimental for industrial plants, for instance, termination of the industrial process. These scenarios are familiar in the industry which creates high economical losses. To overcome this situation, mitigation devices of the series APFs are installed by the industrial customers to secure their plant from the disturbances coming from the grid [3]- [8]. The use of power electronics components is growing rapidly in modern plants which results in harmonics generation and sensitive load in the system, and for this reason, shunt APFs are implemented to overcome issues [9]- [12]. Therefore, a new trend is established to fulfill dual purposes, firstly serving the utility, and secondly benefiting the customers. The significance of this trend is to protect simultaneously both the utility and customers so that the sensitive components are protected from the disturbances in the voltage and to minimize the distortion penetrated to the utility by the loads utilized by the customers [13]. Therefore, The UPQC model is formed with series and shunt APF compensator in a back to back configuration that can control both the load voltage and grid current concurrently [14]. The current trend of microgrid and distributed generation increase the interest of the researcher to work on UPQC [15]- [17]. In addition, there has been an increased concern on the utilization of renewable power sources, reduced dependence on depleting sources of fossil fuels, which also caused global warming. There is a necessity for renewable energy systems, which also enhance power quality and also have the potentiality for operation during the unavailability of the grid.
In [19], proposed a fuel cell (FC) integrated with UPQC to mitigate PQ issues effectively on the grid side by providing real power support during voltage interruption. However, in their study, did not give any emphasize on the integration of renewable energy resources with UPQC and also have not encouraged decarbonization of the grid connected system. In [20], [21], proposed a PV integrated with UPQC to produce clean energy and improve the power quality problems. However, long interruption and deep voltage sag were not considered in their study. Furthermore, the dynamic voltage restorer (DVR) connected with superconducting magnetic energy storage system (SMES) to support the load for long term and thus, addressed the issue on long interruption [22]. Nonetheless, the current related harmonics problem was not considered. In such case, energy storage system like BESS can be interfaced with the PV-UPQC and can be a great support for continuously providing real power to the load. When UPQC operating in standalone mode, BESS is most essential for renewable energy systems. The extra cost of the BESS is justified when the system is applied for critical loads such as semiconductor industries, hospitals etc. where an uninterrupted supply of best quality power is of supreme importance. Therefore, The UPQC is supported by the PV and BESS was design in this work. The PV is attached to the DC-link through DC-DC boost converter and the BESS is connected to the DC-link through DC-DC buck-boost converter [23], [24]. Generally, the PV system supplies the active power to the load but when the PV is unable to supply the power then the BESS activates and provides power especially during the longer-term voltage interruption in order to enhance the stability of the distribution power system. In [19] and [25]- [27], researchers try to design the DC-link voltage regulation algorithm to ensure stable and constant DC-link capacitor voltage. But, the UPQC controller become more complex and computational burden. However, PV-BESS can be considered a better alternative since it can support DC-link capacitor of a UPQC externally and can reduce the burden on the DC-link capacitor.
The synchronization phase is one the most significant parts of the control of an UPQC system. Note that the accurate synchronization phase operation is required for generating reference current and voltage by the shunt and series APF compensator, respectively [28]. The UPQC should be able to perform the synchronization operation effectively by injecting the voltage and current in phase with the grid. In [15]- [21], most of the UPQC controller is developed utilizing a conventional SRF-PLL for the synchronization phase algorithm which is not capable of dealing with unbalanced and distorted voltage grid condition. Moreover, a conventional PLL controller consists of a low pass filter that introduce phase delay in the synchronization operation causing undesired ripples in the reference current and voltage. Furthermore, the PI controller of a PLL increase the control complexity and require fine tuning which is time consuming [29]. A possible solution to the phase detection synchronization is utilizing the STF that have better phase tracking and fundamental component extraction capabilities. In this work, to produce to come up with simple controller structure by its working principle involves generation of unit vectors consisting of sine and cosine function for the process of extracting harmonic current algorithm and voltage error algorithm. Furthermore, the synchronization phases in term of unit vector is apply on the reference current generation in shunt compensator that design with integrating together with strength STF with working concept of the direct-quadraturezero (STF-dq0) that not depending on any components of PLL. In series compensator, the reference voltage generation also will be applying working concept of the dq0 with utilizing synchronization phases for in-phase compensation. Most importantly, the proposed technique that will applying on UPQC controller need to be superior and more reliable when dealing with unbalanced and distorted voltage grid condition. It is also can maintaining grid current sinusoidal with regulating the desired load voltage which minimizing the phase difference to achieve almost unity power factor.
In this paper, PV and BESS connected parallelly with UPQC is proposed to solve the complex power quality problems specifically in case of long voltage interruption. Various case study is applied to validate the dynamic performance of the suggested UPQC integrated with PV and BESS. The comparison between the performance of UPQC with only DC-link capacitor and the UPQC integrated with PV and BESS is also shown. In addition, the STF integrated with the UVG technique (STF-UVG) is utilized to produce the synchronization phases for the UPQC controller to address the drawbacks of the conventional PLL. The performance comparison of the STF-UVG and a standard SRF-PLL to validate the superiority of the proposed technique. Finally, the performance of the suggested UPQC system is investigated utilizing MATLAB-Simulink software under dynamic condition.

II. SYSTEM CONSTRUCTION
The construction of PV-BESS-UPQC is displayed in Fig. 1. The three-phase system is designed for the PV-BESS-UPQC model. The PV-BESS-UPQC comprises of series and shunt APF compensator linked with DC-link split capacitor. The battery and the PV array are linked parallelly to the DClink. The PV is linked through a boost converter to the DClink. Moreover, the BESS is linked through a buck-boost converter to the DC-link. The series compensator works like a controlled voltage source manner and mitigates for the supply voltage sags, swells, interruption, voltage harmonic. On the other hand, the shunt compensator mitigates the current harmonics for the load. Both the series and shunt APF compensator are attached through interfacing inductors.
Due to the converter switching action harmonics are generated and therefore, ripple filter is utilized to filter out harmonics. The series compensator uses a series injection transformer to insert voltage to the grid. In this work, a three-phase non-linear load is utilized. The PV-BESS-UPQC design procedure starts with the accurate measurement of PV array, split capacitor, reference voltage of DClink etc. The design of the shunt compensator follows the way that apart from mitigating current harmonics it controls the peak output power from PV array. Since the PV array is connected to the UPQC DC-link directly, the PV array is constructed in a way such that the maximum power point (MPP) voltage is equivalent to the reference DC-link voltage. During nominal conditions, the rating of PV array ensures that the load active power is delivered by the PV array and power is supplied to the grid and charging BESS by the PV array as well. Besides, the BESS is designed in a way that, when the PV array generate less power than the DC-link load demand, the BESS provides the insufficient power equivalent to the decrease in DC-link voltage. Moreover, when there is no power produced by PV array, the BESS will supply the total load demand.

A. DESIGN OF UPQC 1) DC-LINK VOLTAGE MAGNITUDE
The minimum value of DC-link voltage, V dc,min relies on phase-voltage of the system. The voltage magnitude of the DC-link needs to be nearly twice the peak value of the phasevoltage of the supply. The equation of V dc,min is given as follows: where, m indicates the index of modulation depth that assigned as 1 and V LL,rms indicates the phase-voltage of the grid which is selected as 400 V rms considered by Malaysia Energy Commission following IEC standard. Therefore, V dc,min is obtained as 653.2 V for a V LL,rms of 400 V rms . DClink voltage, V dc is chosen as 700 V after considering the value of PV-BESS as external source of DC-link.

2) DC-LINK CAPACITOR VALUE
The equation of the DC-link capacitor is presented as follows: Here, V ph indicates the phase-voltage, i sh indicates the phasecurrent for shunt APF, a f indicates the overloading factor, t indicates the time to achieve the steady-state,k e indicates the variation of energy during dynamic condition, V dc,set indicates the voltage which is equivalent to the reference voltage and V dc,min indicates the minimum required voltage of the DC-link. The calculated minimum voltage of the DC link, V dc,min = 677.69V , V dc,set = 700V , V ph = 230.9 V, i sh = 57.5 A, t = 30 ms, a f = 1.2, and energy variation during dynamics = 10% (k e = 0.1), the measured value of C dc,min is 9330.28 µF and it is approximated as 9400 µF. Then, two split capacitors are set on 4700 µF each.

3) INDUCTOR RIPPLE FILTER FOR SHUNT APF
The shunt APF is attached through an inductor with the network as a passive filter which relies on the switching frequency denoted as f SH , I cr,pp denotes ripple current and V dc,set denotes the DC-link voltage. The interfaced inductor equation is shown as follows: Here, m indicates the modulation depth, a f indicates the maximum overload value in pu unit, I cr,pp indicates the ripple current for the inductor which measured as 20% of Shunt APF rms phase current. f SH indicates the switching frequency.
Considering I cr,pp = 20%, f s=10 kHz, m = 1, V DC =700 V, and a = 1.5, the value of L f ,min is measured as 1.79 mH. Here, the set value is considered which is 3mH in this investigation

4) SERIES INJECTION THREE-PHASE ISOLATION TRANSFORMER
The injection transformer is considered for attaching the VSC of a series APF in series with the grid. The transformer voltage rating relies on the voltage that need to be injected and the DC-link voltage. For compensating a voltage variation of ±60%, the voltage to be injected, V SE is calculated as 138.54 V. In that case the modulation index becomes low for the series compensator at 700 V DC-link voltage. The maximum value turns ratio of the injection transformer for the series APF is expressed as follows: where the K SE is calculated was 1.667 approximate to 2. The VA rating of the injection transformer is expressed as follows: The current across the series APF is equivalent to the grid current. During the voltage sag condition of 0.6 pu, the supply current is measured as 36 A. Therefore, the achieved injection transformer VA rating is 15 kVA.

5) INDUCTOR RIPPLE FILTER FOR SERIES APF
The series APF is attached through an inductor with the network as a passive filter which relies on the DC-link voltage, ripple current and switching frequency. The interfaced inductor equation is shown as follows: Here, m denotes the modulation depth, a denotes the maximum overload value in per unit, I r denotes the ripple current for the inductor which computed as 20% of Series APF rms phase current. f SE denotes the switching frequency. Where, m = 1, a f = 1.5, f SE = 10 kHz, 20% ripple current and V dc,set = 700 V, so the measured inductor value is 3.6 mH.

B. DESIGN OF UPQC CONNECTING WITH PV-BESS AS EXTERNAL SUPPORT OF DC-LINK
The suggested model displayed in Fig. 2 comprises the PV system, BESS, boost converter, buck-boost converters, and controller. The BESS is attached parallelly to the DC-link capacitor utilizing buck-boost converter, so the stability of the UPQC is improved for compensating power quality problem.
In the model, the total power flow is expressed in the (7). Furthermore, the PV system parameters and the parameters of Li-ion battery implemented in this paper are tabulated in the Table 1.

1) PV SYSTEM MODELLING
In this paper, the PV model is utilized from the Simulink library. The PV model consists of some strings of PV modules connected in parallel. Besides, series PV modules are included on each string as well to achieve the required current, voltage and power ratings. In a module, each PV cells can be modelled by utilizing single-diode equivalent circuit as displayed in Fig. 3. The construction of the single-diode equivalent circuit consists of a current source parallelly connected with a forward diode, a series connected resistance and a resistance connected in parallel. Whenever the PV cell detect the sunlight, it starts producing current. Utilizing Kirchhoff's current law, PV cell output current is derived as: Here, i ph denotes the photocurrent, i d indicates the current flowing across the forward diode and i sh denotes the current flowing across the shunt resistance. Substituting relevant expressions for i d and i sh in (9) can be described as follows: where i s denotes the leakage current or reverse saturation of the diode (A), Q denotes the electron charge (1.602 × 10 −19 C), η denotes the diode ideality factor following the type of PV cell technology (Si-mono) which is 1.2 used in this work, k denotes the Boltzmann's constant (1.381×10 −23 J/K), T c denotes the actual temperature of the cell ( • C), V pv,c denotes the cell output voltage (V), i pv,c denotes the cell output current (A), R sh denotes the shunt resistance of the cell ( ) and R s denotes the cell series resistance ( ). Furthermore, when the PV cells are attached in series to create a module, the output voltage and output current relationship expressed in (10) can be rewritten as: where i pv,m indicates the module current (A), V pv,m indicates the module voltage (V) and N s indicates the series connected PV cells number for a module. Moreover, the PV modules can be attached in parallel or in series to attain the required output voltage and power. The array is formed by the series and/or parallel connected PV modules. The modification of (10) builds the PV array as follows: where N p denotes the number of cell strings in parallel. From (8), the photocurrent, i ph relies on the solar irradiation G, the actual cell temperature, T c and on the surface of the PV cell. Thus, the i ph can be expressed as: where G denotes the solar irradiance (W/m2), G n denotes the solar irradiance at STC (W/m2), i ph,n denotes the photocurrent (A) at STC, K 1 denotes the temperature coefficient of short circuit current (A/ • C), T c denotes the variation of the T c actual cell temperature ( • C) and T c,n denotes the cell temperature at STC ( • C). From (9)- (11), the diode saturation current, i s relies on the cell temperature and it can be stated as: where E go denotes the energy band gap of the material (eV) and 1.12eV is selected as the value according to the category of semiconductor material utilized in this work and i s,n denotes the diode saturation current at STC. The i s,n can be expressed as follows: The shunt resistance R sh and series resistance R s enhance the cell performance by managing the slope of voltage and current relationship. The R sh and R s can be approximated as follows in (15) and (16). Where V oc denotes the open circuit voltage (V) and i sh denotes the short circuit current (A).
The construction of the PV system model follows the parameter of PV panel specified to acquire the desired current, voltage and power ratings that is desired by the UPQC system in MATLAB Simulink. The parameter utilized for the PV system in this work is tabulated in Table 1. The parameters of cell and array of the PV model is developed to follow SunPower SPR-215-WHT-U PV module. The PV characteristic curve with specified temperature (25 • C) for the PV module and varying irradiance is displayed in Fig. 4. The I-V characteristic illustrates in Fig. 4(A) and the P-V characteristics is shown in Fig. 4(B) for solar array.   The characteristic curve with specified irradiance (1000 W/m2) and varying temperature is shown in Fig. 5. I-V characteristic illustrates in Fig. 5(A) and the P-V characteristics is shown in Fig. 5(B) for solar array.
Next, the solar radiations achieved by the solar panel are varied continuously which results in low quality performance of the solar panel. Likewise, higher temperatures are also responsible for lowering the performance quality of the solar module. The Variation in insolation modifies all the parameters (P max , V max , i max , V oc , i sc ) of the solar module illustrated in the PV cell characteristics curves in Fig. 6. Maximum power point tracking (MPPT) can be utilized to improve the efficiency of a PV module under a specified irradiance and temperature. The DC-DC boost converter duty cycle is regulated to maintain the algorithm of the MPPT. In this work, a simple method named Perturb and observe  Table 2. Therefore, the complete PV curve is examined by small-scale perturbations to locate the MPP that extend the response time of the algorithm. On the other hand, if the perturbation size is expanded, it produces steady-state oscillations about the MPP. The P & O algorithm output is the approximated MPPT voltage V mpp . The MPPT voltage is employed to regulate the DC-DC converter to achieve the PV open-circuit voltage continuously. The PV system output power, P pv is boosted by the DC-DC boost converter that control by controller shows in Fig. 8. The controller of the DC-DC boost converter is operating by getting DC voltage error, V DC,error . The voltage error is calculated by comparing the given reference voltage, The reference voltage is assigned with instantaneous DC-DC Boost converter output DC voltage V DC . Afterwards, V * DC,error is approximated by reducing the V DC,error (t) using a PI controller. In mathematic terms, the approximation can be explained as found from (17) and (18): where k p,1 and k i,1 indicates the two fixed values that denotes as proportional gain and integral gains of the controller PI 1 .   The values are allocated as 0.1 and 0.1, consecutively. However, the controller of the DC-DC Boost converter will break off the PV system output power, P pv during battery's state of charge SOC BESS is over or equal to 98% of battery capacity. The reason is to keep away the battery from being overcharged and unstable. Moreover, the lifetime of the battery can be reduced due to overcharging.

2) BATTERY ENERGY STORAGE SYSTEM MODELLING
Batteries generally consist of one or more electrochemical cells in series and/or parallel to achieve the desired nominal voltage and capacity for the BESS modelling. Generally, the classification of battery models depends on electrochemical model and electric circuit model, and from these models the other models are normally obtained. For example, using Peukert's equation, the model of a battery is improved by integrating current. Besides, Stepherd's equation which is an electrochemical model. The mathematical model is utilized in this work because of efficient tools like SIMULINK/MATLAB. The Li-ion battery is used in this work due to its high-power density and energy, slow selfdischarge and low maintenance cost, comparing to the other batteries. The parameter utilized for the BESS system in this work is tabulated in Table 1.
The equivalent electrical circuit of battery is constructed by a controlled voltage source connected with a constant internal resistance in series. The charging/discharging model of the Li-ion battery is stated in as follows: where V battery,charge indicates the battery voltage (V), E f 1,2 (i t , i l , i) indicates the no-load voltage (V), R indicates the internal resistance ( ), and i indicates the battery current (A). Next, the controlled voltage source can be expressed for charging and discharging in charge model and discharging model. Then, the charging model of Li-ion battery is given as follows: Then, the discharging model of the Li-ion battery is stated in as follows: From the (20) and (21), where E 0 indicates the battery constant voltage (V), K indicates the polarization voltage (Ah −1 ), Q indicates the battery rated capacity (Ah), i t dt indicates the extracted battery capacity current rate (Ah), A indicates the exponential zone amplitude (V), B indicates the exponential zone time constant inverse (Ah −1 ) and i l indicates the low frequency current (A). Next, the term A exp (−B. i t dt) symbolizes the exponential area of the voltage when it is fully charged to the edge of exponential zone of the discharge characteristic curve. Thus, the gain of undetermined parameters of A and B can be specified from the exponential part as follows.
The voltage drops during the exponential zone express in as follows.
where E full indicates the fully charged voltage and E exp indicates the voltage at the boundary of exponential zone. The exponential zone time constant inverse is: where Q exp indicates the charge at the boundary of exponential zone. Here, the parameter E 0 utilized in (20) and (21) symbolizes the transition quantity between the starting of voltage when it is fully charged and the boundary of exponential zone. Thus, the value of E 0 can be calculated from the voltage in fully charged condition and it can be stated as follows: The (20) and (21) indicates the nominal area from the boundary of exponential zone to the boundary of nominal zone of the discharge characteristic curve. Thus, the gain of K can be specified from the nominal part as follows: where E nom indicates the end voltage of the nominal zone and Q nom indicates the end voltage of the nominal zone. The value of the completely charged voltage, charge of nominal zone, the end voltage and charge of the exponential zone can be determined from the discharge characteristic curve of that battery.
The Battery State of Charge (SOC) Regarding Charging and Discharging: The SOC presents one of the most important feature for batteries, however it represents many different concerns. Generally, the SOC of a battery is determined as the ratio of its current capacity to the nominal capacity.
The manufacturer provide the nominal capacity and it shows the charge that can be stored in maximum amount in the battery. The counting method by Coulomb estimates the charging current and discharging current of a battery is integrated over time in order to measure the SOC. Coulomb counting technique is done to measure the SOC (t) charge or SOC (t) discharge at time in (%), which is calculated from the charging current, i BESS,charge (t) or discharging current, i BESS,dicharge (t) with battery capacity in (Ah), and prior calculated SOC values, (26) and (27) (27) However, there are some factors that affect the perfection of Coulomb counting method involving the battery history, temperature, discharge current, and cycle life.
The discharge featured waveform of Li-ion battery is illustrated in Fig. 9. The discharge features are separated into three section and which are nominal section, exponential section and the last is discharge curve. Voltage reduced rapidly in the exponential area, whereas the nominal battery voltage is the mid-point voltage throughout the charging and discharging and flatter curve represent minor inequality in voltage in this region. In the fully charged stage the voltage is superior over the nominal voltage. However, when end of life is appeared, the voltage is lower comparing to the mid-point voltage.

3) FREQUENCY SHARING STRATEGY OF A BESS-PV
In Fig. 10, shown the bidirectional converter Buck-Boost DC-DC controller for charging and discharging mode that contains embedded internal control loops and external control loops.
The stability of the frequency is maintained by the provided active power with proper configuration of the external control  with a frequency droop f droop . The design of internal control loop is constructed with a control loop of voltage to stabilize the system voltage and for fast dynamic response the filter output current is adjusted by the current control loop. The BESS active power can be measured as: Here, P DC−LINK is the DC-link active power, P pv is the total active power supplied by the PV. The active power of BESS, P BESS obtained from (28) present the frequency droop, The f droop can be adjusted within their suitable limits to gain system stability. The methodology is suggested based on the frequency stability approach where load is divided between low and high-frequency elements by utilizing of a filter as demonstrated below in (30) and (31).
The PV module DC-link voltage of a, V * DC,ref is compared with the DC voltage reference, V ref and is then delivered to the voltage controller outer loop using PI 2 controller to generate current reference. Mathematically, the approach can be expressed as obtained from (32) and (33).  (34) and (35).
where k p,3 and k i,3 are the two fixed values that denotes as proportional gain and integral gains of the controller PI 3 . The values are allocated as 0.043 and 0.65. When the active power of a PV module increases than the load demand of DC-link for UPQC, then the voltage frequency components is high. But, When the active power of a PV module decreases than the load demand of DC-link for UPQC, then the voltage frequency components is low. The lower frequency components delivered, and the gate signals are generated for the DC-DC converter of a BESS for discharging mode. In Table 3 explains the interpretation of the frequency droop features for power distributing under several working conditions of the PV-BESS-UPQC system.

III. WORKING PRINCIPLE OF THE PROPOSED CONTROL OF PV-BESS-UPQC USING SELF-TUNING FILTER TECHNIQUE A. STF-UVG SYNCHRONIZATION TECHNIQUE
The proposed STF-UVG technique extract the synchronization phases in a simple method from the supply voltage and the method is non-iterative. In Fig.11 shown the STF technique in UPQC controller scheme. In (36) the matrix form of VOLUME 8, 2020 the three-phase supply voltage is demonstrated, and Clarke transformation matrix is used to convert the source voltage from abc-domain to αβ0-domain.
The distorted supply voltage is separated into fundamental component and harmonic component by considering only two phases in αβ-domain. The relationship is shown in (37).
Here, V s,α(fund) indicates the fundamental (fund) component and V s,α(har) indicates the harmonic (har) component in αβdomain. Both the fundamental component in αβ-domain is required to produce synchronization phases. The fundamental components are extracted by self-tuning filtering (STF) method. The STF method is applied to suppress the existed harmonic components in the distorted supply voltage. Therefore, the synchronization phases are extracted more perfectly, and the quality of the extraction is improved. The Laplace transformation is performed and a typical STF transfer function is expressed in (38).
Here, K 1 denotes constant gain parameter and f c1 denotes the cut-off frequency. The rating of K 1 can be estimated in between 20 to 80 and the rating of f c1 follows the system frequency. In this project, the rating is estimated 20 for K 1 and 50 Hz for f c1 . Synchronization phases of sin (ωt) and cos (ωt) can be attained with the availability of V s,α(fund) and V s,β(fund) and demonstrated in the (39).
The action of conventional PLL element can be omitted by utilizing (39) as UVG technique and the generation of synchronization phases can be effectively done in the presence of supply voltage distortion in UPQC.

B. CONTROL OF SERIES APF COMPENSATION
The three-phase reference voltage signal, V * ref ,abc in abcdomain is calculated as follows in (40) by utilizing the information of phase and frequency of STF-UVG. Here, the value of maximum peak voltage magnitude, V m,max−peak is obtained from peak amplitude of the fundamental load voltage. The reference voltage signal should be in phase with supply voltage at PCC, peak amplitude load reference voltage is the d-frames components while the q-frames components should be zero.
Then, three-phase reference voltage signal demonstrated in matrix form in (41) and Clarke transformation matrix is used to convert the reference voltage signal from abc domain to αβ0-domain. Next, the fundamental component of the distorted supply voltage at PCC is extracted by using the proposed STF-UVG to generate synchronization phases and frequency that obtained in (39) is used for producing the reference axis in the dq-frames. Considering only two phases, the reference voltage signal is acquired in the dq-frames by using (42) where Park transformation matrix is utilized. Moreover, the Equation (43) is utilized to transform the threephase load voltage, V L,αbc from abc-domain to αβ0-domain utilizing Clarke-matrix. Then, load voltage signal in αβ0domain is converted by considering only two phases in dqframes by using Park-matrix with the consideration of synchronization phases and frequency from STF-UVG for producing the reference axis in the dq-frames and demonstrated in (44).
Next, the Equation (45) is utilized to transform the threephase supply voltage, V s,αbc from abc-domain to αβ0-domain utilizing Clarke-matrix. Then, supply voltage signal in αβ0-domain is converted by considering only two phases in dq-frames by using Park-matrix with the consideration of synchronization phases and frequency from STF-UVG for producing the reference axis in the dq-frames and demonstrated in (46).  (47) and (48).
Then, the V * SE,d and V * SE,q is converted from dq-frames to abc-domain and demonstrated in Equations (49) and (50). The injection reference voltage series compensator, V *

SE,abc
are passed through in a hysteresis voltage controller to generate appropriate gating pulses for the series converter

C. CONTROL OF SHUNT APF COMPENSATION
The extraction of the load current harmonic component is done by the suggested STF on αβ-domain. The (51) is utilized to transform the three-phase load current i L,abc from abc domain to αβ0-domain utilizing Clarke-matrix. Emphasizing on αβ-domain, the signal of load current i L,αβ can be divided into fundamental component and harmonic component. Therefore, the relationship can be stated in (52).
Here, i L,α(fund) indicate the fundamental (fund) components and i L,α(har) indicate the harmonic (har) components of load current on α-domain. The representation of load current component in β-domain is same as α-domain. The Laplace transformation is performed and the STF technique is implemented for the extraction of load current fundamental components (i L,α(fund) and i L,β(fund) ) on αβ-domain. The formula is shown in (53).
Here, K 2 denotes constant gain parameter and f c2 denotes the cut-off frequency. The rating of K 2 can be estimated in between 20 to 80 and the rating of f c2 follows the system frequency. In this project, the rating is estimated 20 for K 1 and 50 Hz for f c1 . The harmonic components (i L,α(har) and i L,β(har) ) can be achieved by utilizing the fundamental components (i L,α(fund) and i L,β(fund) ). The calculation is expressed in (54): Equation (54) shows the process of extraction of harmonic components. The process follows by the subtraction between the fundamental components (the extraction is done using STF filter) and the load current component i L,αβ in αβdomain. Therefore, the harmonic components are extracted in an indirect manner. Next, the harmonic components attained from (54) and synchronization phases attained from (39) are used to achieve the harmonic components in d-frame following the (55).
The wave of the original load current in αβ-domain, i L,αβ and the identical synchronized phases are implemented to operate the transformation of αβ-domain into frame-q by utilizing the following approach in (56): In the αβ0-domain, 0-domain does not require to be transformed. However, the DC component of the d-frame denotes the fundamental load current magnitude and the oscillating AC component denotes the harmonic current magnitude. Besides, q-frame carries the phase data of the load current. Noteworthy fact is frame-0 of reference frame dq0 which is straightly acquired from the domain-αβ0 is required to stabilize the dc-link voltage. Likewise, the harmonic component of d-frame loads current i L,d(har) , load current i L,q in q-frame and load current i L,0 , in 0-frame are three different undesirable component of load currents that denote unbalanced, harmonic and reactive currents. Next, i error,dc is measured by reducing the error e 1 (t) obtained between total instantaneous dc-link voltage and where k p,4 and k i,4 are two fixed values that denotes as proportional gain and integral gains of the controller PI 4 . The values are allocated as 0.3 and 2 in this study. Therefore, the grid reference current in the d-frame is given as in (59): Then, the signal i * L,d and i L,q is converted into abc-domain injection reference grid currents. From (60) and (61) are applied to produce the reference current i SH ,abc . The injection reference supply currents and the measured supply current are compared in a hysteresis current controller to produce the shunt converter gating pulses.

IV. SIMULATION RESULTS
The operation of proposed PV-BESS-UPQC using STF-UVG combine with STF-dq0 filter technique (knowns as STF technique) is presented and the operation is analysed using MATLAB-Simulink platform (R2018a). The simulation studies include connection of the proposed PV-BESS-UPQC circuits, design of the PV-BESS-UPQC control system and performance assessment. A standard two-level inverter for the shunt APF compensator and series APF compensator sharing common DC-link which is a combination of the DC link capacitor, PV and BESS. At the shunt APF, standard split DC-link capacitors of 4700 µF are utilized and each of them stores the reactive power from the unbalance non-linear load. Then, the output of shunt compensator is attached to a 3 mH L-typed filter while by attaching a 3.6 mH L-typed filter to the series APF, switching ripples is minimized. In this study, the DC-link reference capacitor voltage is assigned as 700 V. Meanwhile, unbalance nonlinear loads are considered, and they are comprising of nonlinear loads allocated as three single-phase in unbalanced manner. The unbalance non-linear load parameter is summarized in Table 4. The performance of the proposed model is analysed in a comparative manner, performance simulated by UPQC that connected with PV and BESS (with PV-BESS) as external support of DC-link capacitor is compared with standard conventional UPQC (without PV-BESS) to validate the significance of UPQC after connecting the  The performance of PV-BESS-UPQC under context of source voltage harmonics at PCC and the combination of harmonic and sag are displayed in Fig. 12. The irradiation is maintained constant at 800 W/m 2 and the temperature 45 degree Celsius that follow the Malaysia tropical climate. The different observed signals are grid voltages, series compensated voltages, load voltages, load currents, shunt compensated currents, source currents. From Fig. 12(A), it can be noticed VOLUME 8, 2020 that during 0.3s to 0.45s, there is voltage harmonics and during 0.6s to 0.65s, there is a combination of voltage harmonic and voltage sag of 0.7 pu and during 0.65s to 0.7s, there is a combination of voltage harmonic and voltage sag of 0.4 pu. An appropriate voltage V SE is injected by the series compensator to mitigate the source voltage, V S under these contexts during the condition of voltage sag which can be seen in Fig. 12(B) to keep the load voltage, V L equivalent to the rated voltage. It can be noticed from Fig. 12(C) that the load voltage is sinusoidal and equal to the rated voltage. Fig. 12(D) shows the distorted load current, i L created by the unbalanced non-linear load. Three-phase unbalance load is considered in this work. Since the non-linear load is utilized, the shunt compensator mitigates for the source current, i S by injecting a current i SH shown in Fig. 12(E) to keep the grid current sinusoidal. The sinusoidal grid current can be seen from Fig. 12(F). From Fig. 13(A), it can be noticed that the DC link voltage is stable at 700 V during the voltage harmonic and the combination of voltage harmonic and voltage sag. The PV current is around 46.2 A observed in Fig. 13(B) and the power of the PV can be seen in Fig. 13(C) which is 32 KW. The DC link power can be observed in Fig. 13(D) and it is increased during 0.3s to 0.45s so that the voltage harmonics can be compensated. Moreover, during 0.6s to 0.75s the power of the DC is increased so that the harmonics can be mitigated, and the load can be supported during insufficient voltage supplied from the source as well. The power of the BESS is seen in Fig. 13(E) and it can be observed that during 0.3s to 0.45s the power of the BESS is slightly increased and during 0.6s to 0.75s when the combination of harmonics and sag happened the power of the BESS is increased little high since the current of the BESS is increased. The state of charge (SOC) shows in Fig. 13(F) and can be noticed the charging operation of the BESS throughout the process. The THD for current under voltage harmonic condition is shown in Fig. 14(A). It can be observed that the THD is very low which is 2.05%. Moreover, Fig. 14(B) shows the THD for current under voltage harmonic with sag condition and can be  noticed that the THD is only 2.09%. Furthermore, Fig. 14(C) shows the THD for voltage and can be seen that the THD is only 0.28%. All these THD results fulfil the IEEE standard 519. From Fig. 15, it can be noticed that the rise time of the capacitor voltage is very fast. At 0.01s the capacitor voltage achieved the desired voltage. When the capacitor voltage reaches to the desired voltage faster, rapid compensation by the series compensator and the shunt compensator can be executed. Moreover, the capacitor voltage is stable during 0.3s to 0.45s when the voltage harmonic happened and during 0.6s to 0.75s when the combination of voltage harmonic and sag happened. These results verified that the shunt compensator is working properly since the shunt compensator is responsible for capacitor voltage balancing. The capacitor current is also shown in the Fig. 15. It can be observed from the Fig. 15 that transient response exists until 0.01s in the capacitor current and then it becomes stable throughout the operation. However, the UPQC without PV and BESS does not show quality result like the PV-BESS-UPQC. In the scenario B, UPQC without PV and BESS will be discussed and comparison with PV-BESS-UPQC will be shown in Table 5 and Table 6 in terms of THD.

2) SCENARIO B: BALANCE HARMONIC SOURCE VOLTAGE WITH NON-LINEAR LOAD AT CONSTANT IRRADIANCE 800 W/M 2 AT 45 • (WITHOUT CONNECTING EXTERNAL SOURCE OF PV-BESS)
The performance of UPQC under context of PCC voltage harmonics and the combination of harmonic and sag are displayed in Fig 16. The case study is done without connecting PV and BESS. The irradiation is maintained constant at 800 W/m 2 and the temperature 45 degree Celsius. The different observed signals are grid voltages, series compensated voltages, load voltages, load currents, shunt compensated currents, source currents. From Fig. 16(A), it can be noticed that during 0.3s to 0.45s, there is voltage harmonics and during 0.6s to 0.65s, there is a combination of voltage harmonic and voltage sag of 0.7 pu and during 0.65s to 0.7s, there is a combination of voltage harmonic and voltage sag of 0.4 pu. The series compensator mitigates for the source voltage under these contexts by injecting an appropriate voltage V SE during voltage sag which can be seen in Fig. 16(B) to keep the load voltage, V L equivalent to the rated voltage. It can be observed from Fig. 16(C) that the load voltage is sinusoidal and equal to the rated voltage. Fig. 16(D) shows the distorted load current, i L created by the unbalanced non-linear load. Three phase unbalance loads are considered in this work. Since the non-linear load is utilized in this work, the shunt compensator is supposed to mitigate for the source current under non-linear load context by injecting an appropriate current i SH shown in Fig. 16(E) to keep the source current, i S sinusoidal. However, the capacitor voltage takes long time to attain the determined voltage and most of the capacitor voltage is utilized by the series compensator and for that reason the shunt compensator does not have enough support from the capacitor to inject appropriate compensation current to mitigate for the source current. From Fig. 16(F) it can be VOLUME 8, 2020 noticed that the source current is high at the beginning and not pure sinusoidal like the PV-BESS-UPQC case study.
The THD for current under voltage harmonic condition is shown in Fig. 17(A). It can be observed that the THD is 4.66% which is higher than the PV-BESS-UPQC case study. Moreover, Fig. 17(B) shows the THD for current under voltage harmonic with sag condition and can be noticed that the THD is 5.49% which is also higher than the PV-BESS-UPQC case study. Furthermore, Fig. 17(C) shows the THD for voltage and can be seen that the THD is only 0.29% which is slightly higher than the PV-BESS-UPQC case study. From  Fig. 18, it can be noticed that the capacitor voltage is rising very slow and the stability is not achieved accurately. Since the capacitor voltage reach to the desired voltage very slow, rapid compensation by the series compensator and the shunt compensator is not possible. Moreover, the capacitor voltage is not stable during 0.35s to 0.45s when the voltage harmonic happened and during 0.6s to 0.75s when the combination of voltage harmonic and sag happened. These results verified that the shunt compensator is not working properly since the shunt compensator is responsible for capacitor voltage balancing. The capacitor current is also shown in the Fig. 18. However, the UPQC without PV and BESS does not show quality result like the PV-BESS-UPQC.
The summary of the findings of source current and load voltage is tabulated in Table 5 and Table 6. The comparative analysis between the UPQC with PV-BESS and UPQC without PV-BESS can be realized from the Table 5 and Table 6. From Table 5, it can be noticed that before connecting the UPQC during voltage harmonic condition the THD values for the source currents are 53.28%, 52.92% and 53.28% for a, b and c phases. Afterwards, UPQC is integrated in the system with PV and ESS and the THD values are significantly reduced and the values for a, b and c phases are 2.05%, 2.54% and 3.05% respectively. To verify the significance of PV-BESS-UOQC system, the PV and the BESS is removed  and observed the performance of the UPQC with DC link capacitor only and it can be observed that the THDs are increased which are 4.66%, 5.63% and 5.69% for a, b and c phases respectively. Besides, during the condition of voltage harmonic with sag without attaching the UPQC the THD values for the source currents are 49.49%, 49.57% and 49.43% for a, b and c phases respectively. After attaching the UPQC in the system with PV and BESS and the THD is observed for phase a, b and c and which are 2.09%, 2.83% and 3.07% respectively. To verify the significance of PV-BESS-UOQC system, the PV and the BESS is removed and observed the performance of the UPQC with DC link capacitor only and it can be observed that the THD is increased which is 5.49%, 6.35% and 6.43% for phase a, b and c respectively.
From Table 6, it can be noticed that before connecting the UPQC during voltage harmonic condition the THD values for the load voltages are 18.81%, 18.82% and 18.82% for phase a, b and c respectively. Next, UPQC is connected in the system with PV-ESS and the THD values are reduced remarkably and the values for phase a, b and c are 0.28%, 0.28% and 0.28% respectively. To validate the significance of PV-BESS-UOQC system, the PV and the BESS is detached and consider the performance of the UPQC with DC link capacitor only and it can be noticed that the THD is increased slightly which is 0.29%, 0.29% and 0.29% for phase a, b and c respectively. Besides, during the condition of voltage harmonic with sag without attaching the UPQC the THD values for the load voltages are 32.62%, 34.11% and 34.11% for a, b and c phases respectively. Next, attaching the UPQC in the system with PV and ESS and the THD is noticed for a, b and c phases which are 0.28%, 0.28% and 0.28% respectively. To validate the significance of PV-BESS-UOQC system, the PV and the BESS is disconnected and noticed the performance of the UPQC with DC link capacitor only and the THD is increased slightly which is 0.29%, 0.29% and 0.29% for a, b and c phases respectively. In the case study 2, the operation of PV-BESS-UPQC is operated utilizing the constant PV irradiation, which is maintained at 800 W/m 2 and the temperature is maintained at 45 degree Celsius that follow the Malaysia tropical climate. For the scenario A under case study 2, the PV-BESS-UPQC is considered under context of sinusoidal-balanced source voltage sag and swell condition at PCC. The performance simulation of PV-BESS-UPQC under context of sinusoidalbalanced source voltage sags and swells at PCC are displayed in term of simulation waveform are shown in The different observed waveforms are supply voltages, series compensated voltages, load voltages, load currents, shunt compensated currents, source currents. From Fig. 19(A), it can be noticed that source voltage, V S at PCC during 0.3s to 0.35s and 0.4s to 0.45s, there is 0.7 pu voltage sag and 0.35s to 0.4s, there is 0.4 pu voltage sag. Moreover, from 0.6s to 0.65s and 0.7s to 0.75s, there is 1.3 pu voltage swell and from 0.65s to 0.7s, there is 1.6 pu voltage swell. An appropriate voltage V SE is injected by the series APF compensator to mitigate for the source voltage at PCC under these contexts. The injected voltage is in phase with the grid voltage during the condition of voltage sag and opposite phase with source voltage during the condition of voltage swell which can be seen in Fig. 19(B) to keep the load voltage,V L is equivalent to the rated voltage. It can be noticed from Fig. 19(C) that the load voltage is sinusoidal and equal to the rated voltage. Fig. 19(D) shows the distorted load current, i L created by the unbalanced non-linear load. Three phase unbalance loads is considered in this work. Since the non-linear load is utilized in this work, the shunt APF compensator mitigates for the source current, i S under non-linear load context by injecting an appropriate current i SH shown in Fig. 19(E) to keep the source current sinusoidal. Therefore, the source current is maintained sinusoidal and can be seen from Fig. 19(F).
From Fig. 20, it can be seen that the compensation magnitude of load voltage, V L is achieved appropriately which is equal to the rated voltage. It shows the compensation by the series APF compensator during the condition of voltage sag and voltage swell. It can be observed that 0.3s to 0.35s and 0.35s to 0.4s, there is voltage sag of 0.7 pu and 0.4 pu respectively. The series APF compensator injected appropriate to compensate for the source voltage on both conditions. Therefore, the load voltage achieves the rated voltage during the voltage sag. Moreover, there is 1.3 pu voltage swell and 1.6 pu during the period of 0.6s to 0.65s and 0.65s to 0.7s respectively. An appropriate voltage in opposite phase with the source voltage is injected by the series compensator to compensate the grid voltage.
The THD for current under balanced voltage sag condition is displayed in Fig. 21(A). It can be observed that the THD is 2.09%. Moreover, Fig. 21(B) shows the THD for current under balanced voltage swell condition and can be noticed that the THD is 2.02%. Furthermore, Fig. 21 (C) shows the THD for voltage and can be seen that the THD is only 0.28%.
From Fig. 22(A), it can be noticed that the measured DC link voltage is stable at 700 V during the condition of voltage sag and voltage swell. The PV current is around 46.2 A observed in Fig. 22 (B) and the power of the PV can be seen in Fig. 22(C) which is 32 KW. The DC link power can be observed in Fig. 22(D) and it is increased during 0.3s to 0.45s so that the load can be supported during insufficient voltage supply. On the other hand, the DC link power is reduced during 0.6s to 0.75s because of over voltage supply from the grid. The power of the BESS is seen in Fig. 22(E) and it is increased during the voltage sag from 0.3s to 0.45s since the current of the BESS is increased whereas the power of the BESS is reduced during voltage swell from 0.6s to 0.75s since the current of the BESS is decreased. The state of charge (SOC) shows in Fig. 22(F) and can be noticed the charging operation of the BESS throughout the process.
In Fig. 23, it can be noticed clearly that the suggested STF-UVG in Fig. 23(A) and standard conventional SRF-PLL technique in Fig. 23(B) are capable of detecting the synchronization phase value accurately in sin (ωt) and cos (ωt) from the grid voltage which sinusoidal-balanced under sag and swell condition at PCC. Besides, Table 7 summarizes the comparative analysis for source current when simulating the PV-BESS-UPQC with proposed STF-UVG extraction method and the conventional SRF-PLL extraction method. Besides. the comparative analysis for load voltage is tabulated in Table 8 considering the PV-BESS-UPQC with proposed STF-UVG extraction method and the conventional SRF-PLL extraction method. The comparative analysis is done under the sinusoidal-balanced source voltage sags and swells condition at PCC. The both techniques are mitigating harmonic currents produced by non-linear load and the grid currents are maintained as sinusoidal shape with THD values suggested by IEEE standard 519 which is beneath the 5% harmonic limit. The results show that the THD is slightly lower in the proposed STF-UVG and STF-dq0 filter technique than using the SRF-PLL and MAF filter technique. Furthermore, the resulted phase differences between the source voltage and current is large and reduced by the STF-UVG and STF-dq0 filter techniques of UPQC. In other words, it proves that the STF-UVG and STF-dq0 filter both techniques can synchronize UPQC with the grid effectively. This is because the phase values are detected accurately in sin (ωt) and cos (ωt) by both techniques. Therefore, the grid current operates in phase with the grid voltage and so unity power factor is nearly achieved which is 0.999. Overall, the STF-UVG extraction method and the conventional SRF-PLL extraction method both methods perform identically during the source voltage operating condition of sinusoidal-balanced sag and swell for case study 2: scenario A. In Scenario B for case study 2, an unbalanced source voltage of swell and sag condition at PCC is considered to test the VOLUME 8, 2020    is voltage sag of 0.8 pu in phase a, 0.6 pu in phase b and 0.4 pu in phase c. An appropriate voltage V SE is injected by the series compensator to mitigate for the source voltage under the context of unbalance sag and swell source voltage which can be seen in Fig. 24(B) to keep the load voltage equivalent to the rated voltage. The sinusoidal load voltage can be noticed from Fig. 24(C) and it is equal to the rated voltage. Fig. 24(D) shows non-linear load distorted current. To keep the source current sinusoidal the shunt compensator, inject the compensation current which is displayed in Fig. 24(E).  Since the non-linear load is utilized in this work, the shunt compensator mitigates for the source current under non-linear load context by injecting an appropriate current i SH to keep the source current sinusoidal. Therefore, the source current is maintained sinusoidal and can be seen from Fig. 24(F). From Fig. 25, it can be seen that the compensation is achieved appropriately during the unbalanced voltage sag and swell. The figure shows the compensation by the series compensator during the voltage swell from 0.25s to 0.5s and voltage sag from 0.65s to 0.85s. The series compensator injects different voltage magnitude according to the demand. The result proves that the compensation is successfully achieved. Therefore, the load voltage achieved the rated voltage during the condition of unbalanced voltage sag and swell. The DC link voltage can be seen from Fig. 26(A) and it is stable at 700 V during the voltage distortion in the supply, and Fig. 26(B) shows that the PV current is around 46.2 A and the power of the PV is shown in Fig. 26(C) and the DC link power is 32 KW. The DC link power is reduced during voltage swell from 0.25s to 0.5s so that the load can be protected in the overvoltage condition. On the other hand, the DC link power is increased during voltage swell from 0.65s to 0.85s to support the load in the insufficient voltage condition and shown in Fig. 26(D). The power of the BESS is observed in Fig. 26(E) and it is increased during the voltage sag from 0.65s to 0.85s since the current of the BESS is increased  whereas the power of the BESS is reduced during voltage swell from 0.25s to 0.5s since the current of the BESS is decreased. The state of charge (SOC) shows in Fig. 26(F) that the BESS is charged throughout the process.  Table 9, the comparative analysis for source current of the proposed UPQC-STF and UPQC-SRF techniques are tabulated. From the Table 9, it can be noticed that both UPQC-STF and UPQC-SRF reduced the THD value significantly. Before connecting the UPQC system in the PCC, the THD values were 53.28%, 52.92% and 53.28% for a, b and c phases respectively for unbalance voltage swell and 49.49%, 49.57% and 49.43% for phase a, b and c respectively for unbalance voltage sag. On the other hand, both PV-ESS-UPQC with STF technique and SRF technique reduced the THD. For STF technique, the THD values are 2.62%, 2.89% and 3.00% for a, b and c respectively for unbalance voltage swell and 2.62%, 2.93% and 3.25% for a, b and c respectively for unbalance voltage sag and the almost unity power factor is achieved. For SRF technique, the THD values are 4.51%, 4.92% and 5.13% for a, b and c respectively for unbalance voltage swell and 4.55%, 4.69% and 5.09% for a, b and c respectively for unbalance voltage sag and the almost unity power factor is achieved.
In the Table 10, the comparative analysis for load voltage is summarized considering the PV-BESS-UPQC with proposed STF-UVG extraction method and the conventional SRF-PLL extraction method. The comparative analysis result is obtained considering the unbalanced voltage sags and swells condition at PCC. The results show that before connecting the UPQC system the THDs for load voltages are 12.67%, 13.79% and 14.92% for unbalanced voltage swell condition for a, b and c respectively. Besides, for unbalanced voltage sag condition the THDs for load voltages are 18.20%, 22.79% and 34.28% for a, b and c respectively. Next, the PV-BESS-UPQC system is connected using the STF technique and can be noticed that the THDs for load voltages are 0.28%, 0.37% and 0.38% for unbalanced voltage swell condition for phase a, b and c respectively and for unbalanced voltage sag condition the THDs for load voltages are 0.28%, 0.33% and 0.35% for a, b and c respectively. On the other hand, utilizing PV-BESS-UPQC with SRF-MAF technique the THDs for load voltages are 0.28%, 1.37% and 2.31% for unbalanced voltage swell condition for a, b and c respectively and for unbalanced voltage sag condition the THDs for load voltages are 0.28%, 1.94% and 2.72% for a, b and c respectively. It can be observed that the THDs are slightly lower in the proposed STF-UVG technique than the SRF-PLL technique.
Based on Fig. 28(A), it can be observed that the synchronization phase value in sin (ωt) and cos (ωt) are detected accurately by the suggested STF-UVG method which is equivalent to the expected phase value. On the other hand, minor displacement can be noticed between desired phase value and the detected phase value in the Fig. 28(B) where the standard conventional SRF-PLL technique is implemented. Therefore, it indicates that the standard conventional SRF-PLL technique is not able to extract the phase value accurately  as desired during an unbalance three-phase source voltage swell and sag condition across the PCC. The operation of UPQC under context of PCC voltage sags and interruption are displayed in Fig. 28. The irradiation is reduced to 0 W/m 2 from 800 W/m 2 during 0.35s to 0.9s. The different observed waveforms are supply voltages, series compensated voltages, load voltages, load currents, shunt compensated currents, source currents. From Fig. 29(A) it can be observed that during 0.25s to 0.35s, there is 0.6 pu voltage sag and 0.35s to 0.45s, there is 0.3 pu voltage sag. Moreover, from 0.45s to the end of the simulation the voltage supply is interrupted. An appropriate voltage V SE is injected by the series compensator to mitigate for the source voltage under these contexts and support the load completely during voltage interruption occurred in the grid voltage. The voltage injection is displayed in Fig. 29(B). The load voltage is shown in Fig. 29(C) and it can be noticed that the load voltage is equivalent to the rated voltage. Fig. 30 shows the source voltage magnitude and the load voltage magnitude. The dotted lines indicate the source voltages and the straight lines show the load voltages. It can be seen from the Fig. 30 that the compensation is achieved appropriately. The Fig. 30 shows the compensation by the series compensator during the voltage sag from 0.25s to 0.45s and from 0.45s the source voltage is zero and the total load voltage is supplied by the series compensator using the PV and BESS.
An appropriate voltage is injected by the series compensator in phase with the grid voltage to mitigate for the source voltage on both conditions. Therefore, the load voltage achieved the rated voltage during the voltage sag and also during the voltage interruption. From Fig. 31(A), it can be noticed that the DC link voltage is stable at 700 V during the voltage sag and voltage interruption. From Fig. 31(B) it can be noticed that the PV current is around 46.2A until 0.35s and after that it becomes zero because the irradiation is reduced to 0 W/m 2 and the temperature also reduced to 0 0 C which can be seen in Fig. 31(D) and Fig. 31(E) respectively.
From 0.9s the PV current start increasing again since the PV is connected and the irradiation is back to 800 W/m 2 . The power of the PV can be seen in Fig. 31(C) which is 32 KW at the beginning and from 0.35s to 0.9s it becomes zero because the irradiation is reduced to 0 W/m 2 and then it rises again since the irradiation is now returned to 800 W/m 2 . From the Fig. 31(F), the increase of DC link power is noticed during 0.3s to 0.45s and become maximum at 0.45s so that the load can be supported during insufficient voltage supply and also when there is no voltage supplied from the grid. The power of the BESS can be seen in Fig. 31(G) and it can be noticed that the power is decreased in the beginning and then become stable. When the PV is disconnected then the BESS supplied the power to the load through the DC link. At the beginning the BESS is started charging since the PV is still connected but when the PV is disconnected then the BESS started suppling power and start discharging. Afterwards, the PV is connected again at 0.9s and started sending power to the load. At this moment the BESS stopped suppling power and move to charging mode. The state of charge (SOC) in Fig. 31(H) shows that the BESS is charged at the beginning and then start discharging from 0.35s to 1.1s.

V. CONCLUSION
The construction of three-phase UPQC has been investigated considering the condition of complex power quality problems which are an amalgamation of harmonics, voltage swell, and sags, and voltage interruption under unbalanced and distorted voltage grid condition. Integrating the BESS and PV with the UPQC provides active power capability to the network. The main benefit of BESS integrated with UPQC is that it makes the system capable of supplying and absorbing active power from the PV. Since renewable energy is not completely reliable because of its environment-dependent feature, integrating a BESS will solve the lack of renewable energy resources. Finally, it can be figured that the BESS and PV attached with UPQC can be a good alternative in the distributed generation to upgrade the power quality of the contemporary distribution system. The DC-link voltage is stable because of the continuous supply from the PV-BESS system. Therefore, it can reduce the complexity of the DC-link voltage regulation algorithm. The STF-UVG technique for synchronization phases is applied successfully in the shunt and series APF compensator to generate reference current and voltage. Thus, the UPQC is designed without relying on the PLL components, and mitigation of current and voltage are achieved successfully following the grid condition to ensure the system stability and to achieve almost unity power factor. The implementation of the proposed technique has confirmed that the grid current harmonics follow the IEEE-519 standard. Finally, it is worth mentioning that the proposed system can enhance the overall efficiency of the grid power system.