Hardware-in-the-Loop Testing of Seamless Interactions of Multi-Purpose Grid-Tied PV Inverter Based on SFT-PLL Control Strategy

This paper introduces a multifunction interactive PV system that has the ability to feed a nonlinear local load in either grid-tied topology (GTT) or off-grid topology (OGT) and transits between the two topologies are seamless. The interactive PV system utilizes a sliding Fourier transform-based phase-locked loop (SFT-PLL) as an adaptive and robust control technique for extracting the fundamental load current. Further, the SFT-PLL is also used to synchronize the inverter output voltage with the grid during the GTT. The proposed synchronization technique has a superior immunity to the weak grid problems. The SFT-PLL based control technique has a very good ability to mitigate the nonlinear load harmonics and to deliver active current to the grid with a unity power factor. Moreover, the proposed control technique is able to keep a balanced grid current when the connected load is unbalanced whether the PV source is available or not. The DC-link voltage is controlled by the controller of the voltage source inverter (VSI) during GTT. During the OGT, the AC load voltage is regulated by the VSI controller while the DC-link voltage is regulated by the boost converter controller to satisfy the power requirements of the connected load. The simulation and experimental results show the effectiveness of the proposed control technique in feeding a balanced current with THD adheres to the IEEE-519 standard at different operating conditions. The performance of the proposed method is compared with recently published adaptive filtering techniques to show its effectiveness especially when the load current has a DC-offset.

D ω , S ω The lower frequency and the larger frequency of the active and reactive components. θ 1 , θ 2 The ratio between D ω , S ω and the double nominal frequency. k 1 , k 2 The lower magnitude and larger magnitude of the active and reactive components.
The fundamental magnitude of the load current and the circuit loss current. V DC_ref , V DC_act The DC-link reference and actual voltage.

I PVff
The PV feed-forward current.

V Gm
The estimated maximum grid voltage by SFT -PLL. I Gd_ref , I Gd_act , I Gq_ref , I Gq_act The grid current d-q components (reference and actual values).
The voltage in the alpha-beta frame.

D Boost
The duty cycle of the boost converter. θ OGT , θ OGTN , θ e , θ e_N , θ G OGT phase angle before and after synchronization, angle error before and after synchronization, and the estimated grid angle. θ The selected phase angle based on the mode signal. V G , V L The grid and load voltage.
The Gains of the PID controllers. P max , I max ,V max The PV maximum power, current, and voltage. V PV , V oc , I PV , P PV , V DC The PV operating voltage, PV open-circuit voltage, PV current, PV power, and DC-link voltage. I Ga , I ia , I La The phase ''a'' current of the grid, the inverter, and the load. I Gabc , I iabc , I Labc The three-phase currents of the grid, the inverter, and the load.

P n
The rated power of the inverter. r i , r G The ripple rate of the inverter and grid side inductor. ω SW The switching frequency. a c The ripple attenuation of the capacitor voltage. C s , r s The filter capacitor and damping resistor. L i , r Li The inverter-side inductor and its internal resistance. L G , r LG The grid-side inductor and its internal resistance.

Euro
European Efficiency.

I. INTRODUCTION
The use of fossil fuel-based traditional sources is going to be reduced due to the growing environmental concerns. The upward trends are now pushing towards the intensive use of renewable sources as clean alternatives. With the photovoltaic (PV) panels' availability, reducing cost patterns, PV is now a strong candidate to other renewable energy sources [1]- [3]. In the penetration of energy from the photovoltaic system into the electrical grid, the converters have a significant role [4], [5]. Basically, grid-connected PV systems, are divided into the two-stage structure and single-stage structure. In the two-stage structure, the PV array is connected to the grid through a dc-dc converter and a VSI, where the PV maximum power extracted by the dc-dc boost converter and the VSI supplies the local loads and transfers the excess power to the grid. On the other hand, the PV array is directly connected to the VSI, in the single-stage structure to perform responsibilities such as maximum extraction of the PV power and feeding the excess power to the grid [1]. The two-stage configuration is adopted in this study. The maximum power point tracking (MPPT) is an essential task for the PV systems.
There are many MPPT techniques that can be found in the literature [6]- [8]. In this study, Perturb and Observe (P&O) MPPT is used for its simplicity. The inverter supplies the local loads and the grid with active and reactive power in the GTT if a surplus power exists. The VSI is controlled by a current controller during the GTT. The inverter is not able to control the current in the OGT, because the local loads determine the active and reactive power. Hence the output voltage must be controlled by a voltage controller in this operation topology. Due to the high voltage and current surges during transfer between these two topologies, a seamless transfer must be carried out to avoid such surges [9]- [12]. A synchronization process prior to the grid connection importance is crucial to achieve seamless transfer from OGT to GTT. In this research, a simple synchronization method will be introduced based on the difference between the voltage angle during OGT and the estimated angle of the grid voltage. The difference in phase angle is added gradually to the angle of the load voltage while operating in OGT through a rate limiter. There are many techniques used for grid angle estimation mentioned in [13], [14]. In this research, the estimation of grid angle voltage is based on the SFT-PLL technique which has a high immunity to a variety of grid distortions [15]. A further challenge to be addressed is the power quality when a solar photovoltaic array is running in GTT. The quality of the grid currents gets low when the system feeds nonlinear loads. In addition, the power factor becomes worse owing to the inductive connected loads. Therefore, the power quality improvement is a significant issue in GTT along with extracting maximum available PV power [16]. The literature [17]- [24] lists a broad range of methods of identification of harmonic components. The harmonics methods of detection are mainly used in the load current to isolate the fundamental component and harmonics. These methods include the well-known p-q theory [17], [18]. However, the instantaneous p-q theory is susceptible to the voltage distortions at the PCC. Other advanced methods are using adaptive filters. The least mean square (LMS) and least mean fourth (LMF) are used in [19], [20] respectively. The LMS-based technique aims to minimize the Mean square error (MSE). Therefore, the LMS technique is efficient if the error norm is less than 1.0. On the other hand, the LMF technique represents a higher-order filter with better MSE than LMS technique. In [21], a least mean mixed norm (LMMN) adaptive filter is used to specify the reference current of a single-phase VSI and to compensate the resulting harmonics from the nonlinear connected loads. The results show a good matching between the simulation and experimental results. LMMN is also introduced in [22] to control a three-phase VSI during the grid connection mode to achieve power quality improvements. In [23] the leaky least mean mixed norm (LLMMN) adaptive filtering technique is introduced which has a good performance to estimate the fundamental load current with smaller oscillation than using LMMN adaptive filtering technique. The disadvantage of the above-mentioned adaptive techniques is their noticeable inability to maintain acceptable performance in the presence of DC-offset as mentioned in [24]. In the context of treating this disadvantage, the proposed SFT-PLL is introduced to extract the fundamental load current component. SFT-PLL has a high ability to mitigate the DC-offset even if combined with the variable grid frequency. The contributions of this paper can be summarized as follows: 1-Extracting the fundamental load current by SFT-PLL as a new application for such a robust technique. 2-Using SFT-PLL in estimating the grid angle due to its high immunity to the polluted grid. 3-Introducing a detailed and simple method for synchronization with the grid prior to the transition to GTT. 4-Seamless transitions between OGT and GTT. 5-Stabilizing the DC-link voltage at its reference value during all operation modes; by switching the boost converter from MPPT mode to voltage control mode. 6-Injecting a balanced current to the grid with unity power factor and THD within the IEEE-519 standard limits even if the load is unbalanced and /or nonlinear.
7-Comparing between the adopted SFT-PLL technique and the newly published adaptive filtering techniques, and showing the effectiveness of the proposed technique especially at the existence of the DC-offset and harmonics. The break of the paper is outlined as follows: Section II describes the system configuration of the proposed multi-purpose PV system. In Section III, the control strategy is described, where the proposed SFT-PLL control for extracting the fundamental load current is explained. In section IV the design of the LCL filter is introduced. The performance evaluation of the proposed system based on experimental and simulation results as well as the comparison between the proposed control technique with the previous adaptive control techniques are presented in Section V. Finally, conclusions are presented in Section VI.

II. SYSTEM CONFIGURATION
The schematic diagram of the proposed system is depicted in Fig. 1. The PV array is connected to a boost converter to enable a full control of its output power at any operation mode by either extracting the maximum power during GTT or regulating the DC-link voltage during OGT. The boost converter design is based on the equations in [25], [26]. A PV switch is used to connect or disconnect the PV array to the DC-link of the VSI in case of the solar irradiation is sufficient at a day time or insufficient at a night time. The three-phase inverter is connected to the grid through an LCL filter to bypass the higher harmonic contents due to the PWM switching. The design of the LCL filter is based on the equations in [27]. The three-phase nonlinear load is connected at the point of common coupling (PCC). The operation mode contactor is used to connect or disconnect the PV system from the grid, according to the mode signal status, which will be activated based on activation of the grid status signal and activation of the synch-ok signal as will be discussed in Section III.

III. CONTROL STRATEGY
The control philosophy for the adopted multi-purpose PV system is divided into three scenarios as following: VOLUME 9, 2021 (1) grid-tie scenario: during GTT an SFT-PLL based current controller is used to drive the three-phase VSI, while a P&O MPPT is used to drive the boost converter for extracting the available maximum power from the PV array. (2) Offgrid scenario: during OGT, a voltage controller is used to control the three-phase VSI to stabilize the AC voltage of the critical local at its reference value, and the boost converter is controlled by a PI to stabilize the DC-link voltage at its reference value. The boost converter extracts the required power by the local load during this scenario as shown in Fig. 2. (3) Synchronization process: from the OGT to GTT. Each scenario will be discussed in detail in the following sections.

A. GTT CONTROL SCENARIO
During the operation in the GTT, the control scenario is divided into VSI controller and boost converter controller as follows:

1) VSI CONTROLLER
The three-phase VSI switching is generated by activating the current controller during GTT. The current controller is based on the SFT-PLL control technique to inject active current to the grid with improved power quality. The reference grid current can be estimated by SFT-PLL [15] through estimating the fundamental load current as shown in Fig. 3. The SFT-PLL mathematical derivation can be derived by assuming the three-phase load currents are represented by a balanced three-phase sinusoidal current I l with a frequency that equals the grid frequency f G and with a peak value I m , thus the three-phase currents can be expressed by (1): where θ ini is the initial phase shift of I la at t = 0 s. The threephase load currents are processed by sine and cosine filters according to Fourier formulation. The filters are built using two orthogonal sets of three-phase balanced signals (I liω and I liζ ) having the same grid phase sequence and running at a pre-known (nominal) frequency f o (Hz) with unity amplitude as in (2), (3). The suffix i in the expressions I liω and I liζ is referring to the phases a, b and c.
3 ) 3 ) Fourier transform can be applied on (1)-(3) using integrations in (4) to find the phase angle θ a of the load current I la where T o = 1/f o , and the suffix i refers to the phases a, b, c.
When f o is positive and has a non-zero value, two cases are used to calculate the integrals in (4). The first case is the general case when For the general case when and by using a proper trigonometry, we can find that ω i (active component) and ζ i (reactive component) in (4) are functions in the time and the frequencies as follows: For phase a: For phase b: For Phase c: where, The active and reactive components ω i and ζ i for the three phases (i = a, b, c) as represented in (5) to (10) are consisting of two sinusoidal terms. One term has a larger magnitude k 1 and a lower frequency D ω and the second term has a lower magnitude k 2 and a larger frequency S ω . Referring to the second term in the right-hand side of (5), (7), and (9) it is evident that the three terms are balanced three-phase sets with cosine notation which yields zero-sum. Also, in the second term of (6), (8), (10) it is evident that the three terms are balanced three-phase sets with sine notation which yields zero-sum.
Therefore, the total sum of the active component ω t and reactive component ζ t of the load current can be calculated by (17) and (18), respectively: Dividing (18) by (17) yields: Substituting from (11) in (19), one gets:  (21) From (1), (21) the phase angle of the load current can be expressed by (22): The left-hand side of (21) represents the difference between the grid frequency of phase ''a'' and the nominal frequency f o . When we have a PLL whose nominal frequency f o , so that the right-hand side of (20) will represent the output of the phase detector stage of this PLL.
At this point, the nominal case when f o = f G shall be highlighted, where the Fourier transforms is operated at the nominal frequency and the values of 2π(f G − f o )t, θ 1 will be vanish. During the phase lock θ ini vanishes and the quantity ζ t /ω t turns to be zero. The nominal frequency of the Fourier transforms has an excellent harmonic and DCoffset rejection. To keep the adaptive operation at the nominal case and achieve the excellent performance of the nominal case operation; the SFT is used as a phase detector for the conventional PLL as shown in Fig. 3. The nominal frequency f o in (2), (3) will be replaced by f G which estimated by the PLL, and the T o in (4) will be equal to T o = 1/f G . By using this configuration, the operation at the nominal case is guaranteed, which achieving the high ability to the harmonic and DC-offset rejection.
The magnitude of the fundamental component of the load current I l_f can be calculated from (23): The DC-link voltage V DC_act can be controlled at its reference value V DC_ref by determining the losses inside the circuit (I c_loss ) by (24): The PV current I PVff represents the magnitude of AC current that delivers to the grid the same power produced by the PV arrays, assuming that the inverter and DC-link circuits are lossless and no-load is attached to the inverter output. The I PVff can be calculated using the measured grid voltage at PCC, and using the PV array output voltage (V PV ) and current (I PV ) to calculate the extracted PV power (P PV ). The I PVff can be expressed by (25): where V Gm is the estimated peak of the grid voltage by the SFT-PLL.
To improve and accelerate the system dynamic response, this current is used in the feed-forward arrangement as shown in Fig. 2. Therefore, the grid reference active current component I Gd_ref can be calculated by (26): The quadrature reference current for the grid I Gq_ref is set to zero to achieve a unity displacement factor. The actual active I Gd_act and reactive I Gq_act grid current components compared with their reference values and the error is fed to two PI current controllers to generate the reference direct V id_ref and quadrature V iq_ref voltage components in the synchronous rotating frame. A decoupling mechanism between I Gd_act and I Gq_act is used to facilitate independent control of both components. The two resulting voltage components are transformed from the d-q synchronously rotating reference (SRF) frame to the stationary frame V α and V β using Park's transform to drive the space vector pulse width modulation (SVPWM) and generate the switching signals of the three-phase inverter.

2) BOOST CONVERTER CONTROLLER
In this GTT, the boost converter duty cycle (D Boost ) is determined by the P&O MPPT to capture the available maximum PV power as shown in Fig. 2. The power balance, in this case, determines whether solar power is injected into the grid in case of surplus PV power with respect to the load or the grid will supply the shortage in available PV power to satisfy the load demand.

B. OGT CONTROL SCENARIO 1) VSI CONTROLLER
An LCL filter is used to smooth the output voltage of the inverter, there is a definite drop of voltage and watt across the LCL filter which depends on load current. To compensate this voltage drop irrespective of the current drawn, two PI controllers in SRF are used to regulate the direct and quadrature voltages components at V Ld_ref = 380 * √ 2 (V) and V Lq_ref = 0 (V), respectively. The load measured voltage is transformed to the SRF components using Clarke and Park transformation, as in (27), (28): The output of the PI controllers V id_ref , V iq_ref are the command values of the SVPWM. These two reference components V id_ref , V iq_ref are converted using Park's transform into V α , V β stationary reference frame to drive the SVPWM for switching the three-phase VSI as depicted in Fig. 2.

2) BOOST CONVERTER CONTROLLER
During the OGT, the boost converter is responsible for regulating the DC-link voltage based on a PI controller. The boost voltage controller is responsible for generating the duty cycle required to regulate the DC-link voltage at its reference value as in (29).
The transition scenario is based on the grid status. Whenever the grid's voltage and frequency are satisfying the requirements of the IEEE-1745 standard for few seconds, as shown in Fig. 4, the grid state signal is asserted high and the synchronization process starts. Before switching from OGT to GTT, the load voltage must be synchronized with the grid voltage. This is necessary to avoid sudden disturbances to the load due to a possible mismatch in the voltage angle and/or magnitude between the load and grid. A simple synchronization process is introduced in this paper as shown in Fig. 4. This process is based on estimating the grid angle θ G by the SFT-PLL technique when the grid is restored. The SFT-PLL has high immunity to multiple distortions of the grid. Further, it offers an accurate estimation of the angle of the grid positive sequence voltage during the existence of harmonics, unbalances, phase jumps, DC-offset. The SFT-PLL is adaptive to frequency change. These features make SFT-PLL superior to other conventional techniques widely used in process of synchronization with the grid. The load frequency during OGT is strictly fixed at ω o = 314(rad/sec) therefore, the phase angle of the load can be calculated as θ OGT = ω o t. The difference in phase angle θ e can be calculated by (30). Then by gradually adding this difference to the θ OGT through a rate limiter, a smooth synchronization with the grid can be guaranteed and to phase jumps are completely avoided. The new phase angle θ OGTN can be determined by (31). When the difference between the θ OGTN and the grid angle θ G becomes within a permissible range as in [28], [29], the Synch-Ok signal is activated high and hence the mode signal is switched to GTT position. The prescribed functions of the boost converter (MPPT-based control) and the VSI inverter (DC-link voltage regulation mode) in GTT are commenced. The phase angle θ generated from the synchronization block is override by θ G .

IV. DESIGN OF LCL FILTER
It is important to apply a filter at the inverter output. Because the inverted signal comprises harmonics at the switching frequency and its multipliers. The filter employed in the inverter output in this work is an LCL filter. By giving the values of the dc-link voltage (V DC ), the grid line voltage, the rated power of the inverter (P n ), the ripple rate of the inverter side inductor r i , the ripple rate of the grid side inductor r G , the switching frequency ω sw , and the ripple attenuation of the capacitor voltage a c . The LCL filter can be designed as follows: VOLUME 9, 2021 The minimum value of the inverter side inductor (L i ) can be calculated by (32) as in [27] The grid side inductor (L G ) can be calculated using (33) The value of the filter capacitor can be calculated by (34) The value of r i can be selected as 0.011, r G = 8 * 10 −4 and a c = 3 * 10 −4 to achieve the values of the LCL filter parameters given in Table 1.

V. SIMULATION AND EXPERIMENTAL RESULTS
The entire system is simulated using the MATLAB Simulink package. The simulation results are verified experimentally using the MicroLabBox dSPACE1202 platform which executes the proposed control algorithm with a sampling time of 80 µs. The hardware configuration depicted in Fig. 1 has been emulated using Typhoon HIL-402 with the provided specs in [30]. The experimental setup is shown in Fig. 5. The simulation and experimental results have been tested at the same conditions to mutually validate the simulation and experimental results. The test scenarios include unbalanced and nonlinear loads. The parameters in of the experimental and simulation system are summarized in Table 1. The dynamic tests will be discussed at various conditions such as OGT with a step-change in solar irradiance, the transition from OGT to GTT, step-change in irradiance during GTT, disconnection of the PV source during GTT, and finally the transition from GTT to OGT. The performance of all case studies proves the effectiveness of the control strategy.
The supplied or absorbed current to or from the grid is balanced and meets the IEEE-519 standard THD requirements with a unity power factor as depicted in the simulation and experimental results. Further seamless transfer during all operation modes is verified by the simulation and experimental results.
The system efficiency can be verified by the European efficiency [31], which is the measure of the average efficiency of the inverter power per the year corresponding to the middle Europe climate. This European efficiency represents a weighted value can be obtained by giving the different efficiencies at different percentages of the rated inverter power (P n ) as in (35) By applying this equation in our system, one gets: In this test, the nonlinear load has been fed by the PV source during the grid outage. The simulation and experimental results are depicted in Fig. 6 to Fig. 8. Fig. 6(a)      the irradiance changes at t = 0.1 s and 0.3 s respectively, the load voltage (V L ) is stable and the grid current (I Ga ) equals to zero during this test as expected in the OGT. The inverter current (I ia ) is equal to the load current (I La ). The load current is stable and continuous during the irradiance change as long as the irradiance level is sufficient for the PV array to supply the load demand as shown in Fig. 6(a), (b). The PV current is oscillating around a fixed value. The width of the oscillations band is in direct proportion to the level of irradiance since the irradiance level shifts the array power and current upward when it increases and downward when it decreases. The PV voltage decreases with the irradiance decrease, while the PV output power is stable at the load power demand as shown in Fig. 8(a), (b

B. OGT TO GTT DYNAMIC TRANSITION
This case study shows the performance of the system during the transition from OGT to GTT. Initially, the PV system feeds the load in the OGT. The VSI and boost converter are driven by the voltage controller during that period of operation. Fig. 9 to Fig. 14 show the simulation and experimental results for this case study. The load voltage (V L ) is regulated at its reference value and the load current is stable at its demand. The grid voltage (V G ) and grid current (I Ga ) are zero during this period as shown in Fig. 9(a), (b) respectively. When the grid is restored at t = 0.05 s, the grid state signal is activated as soon as the voltage magnitude and frequency check is fulfilled then the synchronization process starts. Fig. 10(a), (b) show the simulation and experimental results of the synchronization process respectively. When the grid has detected the difference in phase angle between the grid and the load voltage (fed in standalone so far) θ e is added to the load phase angle θ OGT through the rate limiter to obtain the new angle θ OGTN . As soon as the difference between θ OGTN and θ G becomes within its permissible value and the grid state signal activated high. The GTT mode signal is activated and the boost converter starts the maximum power point tracking process. At the instant of the load voltage (V L ) and the grid voltage (V G ) are locked, and mode signal activated high, the grid contactor connects the grid and the inverter starts to feed it with the surplus power seamlessly as shown in Fig. 9(a), (b). It is clear that the supplied current  to the grid (I Ga ) is in phase with grid voltage as intended. Fig. 11(a), (b) show the simulation and the experimental results of the three-phase balanced grid current (I Gabc ), the unbalanced inverter current (I iabc ) and the unbalanced load current (I Labc ). Fig. 12(a), (b) show the simulation and the experimental results of the THD of the grid current and the load current. The grid current THD is below 5% as recommended by the IEEE-519 standard. The DC-link voltage is stable during these transitions while the PV power increases due to the changing from voltage controller to the MPPT controller as shown in Fig. 13(a), (b). The SFT-PLL internal signals such as active (ω) and reactive (ζ ) components of phases with the total summation (ω t , ζ t ) and the estimated fundamental magnitude of the load current (I l−f ) are shown in Fig. 14.

C. STEP CHANGE IN IRRADIANCE DURING STEADY-STATE OPERATION IN GTT
This case represents the steady-state operation of grid-tied topology (GTT) while a step-change in irradiance from 1000W/m 2 to 500 W/m 2 , then to 1000 W/ m 2 occurs. Fig. 15 to Fig. 17 show all the simulated and experimental results in this case. The load voltage (V L ) is the same as the grid voltage (V G ). I Ga is sinusoidal with a unity power factor. I Ga is reduced with the irradiance drop then recovered again with irradiance rise while the load current is stable during all irradiance transitions as per the simulation and experimental results shown in Fig. 15(a), (b) respectively. The three-phase current of the grid (I Gabc ) is sinusoidal and balanced while  the inverter current (I iabc ) is unbalanced and changes with the irradiance change. The load current (I Labc ) is unbalanced and constant during irradiance transitions as per the simulation and experimental results shown in Fig. 16(a), (b) respectively. The simulated and experimental response of the maximum power point of the PV voltage (V PV ), the PV current (I PV ), the DC-link voltage (V DC ), and the PV power (P PV ) during the occurrence of irradiance changes are depicted in Fig. 17 (a), (b). The DC-link voltage is stable during these transitions while the PV power decreases and increases.

D. DYNAMIC CONNECTION AND DISCONNECTION OF THE PV ARRAY DURING GTT
The performance of the dynamic switching of the PV array is depicted in Fig. 18 to Fig. 21. The simulated and experimental results shown in Fig. 18(a), (b) verify that the load and grid voltages are stable during disconnecting and connecting the PV array at t = 0.2 s and 0.36 s respectively. The grid current is sinusoidal with a unity power factor and its direction is reversed at t = 0.2 s to show that the grid is responsible for feeding the load in case of PV absence. The load current is stable during the PV switching off and ON. Fig. 19(a), (b) show the simulation and the experimental results of the grid current I Gabc , inverter current I iabc , the load current I Labc .
The grid current I Gabc is balanced during all the time of operation. The inverter is responsible to feed the load and the grid in case of surplus solar power existence during the  PV availability. Also, the inverter is responsible to mitigate the harmonics caused by the non-linear load whether the PV power is available or not. The load current I Labc is stable during all operation transitions as shown in Fig. 19(a), (b). The simulated and the experimental results of the THD of the grid current while the PV is switched OFF are complying with IEEE-519 requirements as shown in Fig.20(a), (b). The PV outputs I PV and P PV decrease to zero at the instant of disconnection and returned to their maximum values when the PV has turned ON again. The DC-link voltage is maintained constant during these transitions as per the simulation and experimental results shown in Fig. 21(a), (b).

E. DYNAMIC TRANSITION FROM GTT TO OGT
During the outage of the grid, the voltage controller is activated for driving the boost converter and the 3-phase VSI. The dynamic simulation and the experimental performance results of this case study are shown in Fig. 22 to Fig. 24. The grid voltage, load voltage, grid current and load current are shown in Fig. 22(a), (b). The grid voltage and grid current   The experimental results of the transitions in the threephase currents I Gabc , I iabc , I Labc are shown in Fig. 23(a), (b); where the load current remains stable during transitions. The PV output is changed from operation at maximum power point to operation at voltage control to meet the load flow requirements. The PV outputs I PV and P PV are decreased while the V PV is increased due to operation in the voltage control mode near the open circuit voltage of the PV array (small partial load). The DC-link voltage is maintained constant as per the simulated and the experimental results shown in Fig. 24 (a), (b). All the simulation and the experimental results for this case study are matched and verify the stable operation of the load during switching from GTT to OGT.

F. COMPARATIVE STUDY BETWEEN SFT-PLL AND THE CONVENTIONAL ADAPTIVE TECHNIQUES FOR FUNDAMENTAL CURRENT EXTRACTION
The proposed method was tested for two types of loads namely, linear load and nonlinear load. The three-phase currents of the two loads are offset by a DC-component. The phase ''a'' of each load will be disconnected at t = 0.2 s, to show the performance during the occurrence of unbalance. The linear load three-phase current is shown in Fig. 25(a) and the nonlinear load three-phase current is shown in Fig. 26(a). The estimated fundamental magnitude of the load current using the proposed SFT-PLL control technique was compared with the previous control techniques such as LMS, LMF, LMMN, LLMMN [19]- [23] as shown in Fig. 25 (b) and Fig. 26 (b).
From the estimated magnitude in the two load cases, the SFT-PLL technique has a superior performance with no oscillations or steady-state error during the existence of harmonics, load unbalance along with the DC-offset. The previous methods suffer from oscillations and steady-state error during the existence of harmonics and DC-offset. Also, the previous methods are highly dependent on the value of its step size and its mixing parameter at different values of the load current at different harmonic contents [32]. Table 2 summarizes the comparison between the performance of the proposed SFT-PLL and the previous control techniques based on the oscillations percentage in the estimated magnitude of the fundamental load current shown in Fig. 25 (b) and Fig 26 (b). From Table 2, the proposed method is a general method that operates well at different conditions of load current values, harmonics content or DC-offset. The proposed technique is superior to capture the fundamental load current at different aggressive conditions with high accuracy.

VI. CONCLUSION
A multifunction PV inverter has been proposed in this paper. The PV system feeds critical local loads with a stable VOLUME 9, 2021  power during grid-tied topology and during off-grid topology. A simple synchronization technique before switching to GTT has been introduced in detail. A seamless transition between the two operation modes has been verified by the simulation and experimental results. During the GTT, the control technique is based on the SFT-PLL to extract the fundamental load current. Moreover, the SFT-PLL has been used for estimating the grid angle due to its high immunity to the severe grid disturbances. The system performance has been tested at various operating conditions. The supplied current to the grid was balanced with unity power factor and the THD complied with the IEEE-519 standard at all the tested cases, during the surplus of the PV power or during the disconnection of the PV array. The simulation results are verified by the real-time experimental emulation using (HIL-402 kit). The proposed SFT-PLL for extracting the fundamental load current has    The transfer function of the PI controller can be expressed by (a.2) The closed loop block diagram of the grid current in the d-q frame is depicted in Fig. 27.
The closed loop transfer function is presented by (a. 3), as shown at the top of the next page.

I Gdq_act I Gdq_ref =
G PI (s)G P (s) 1 + G PI (s)G P (s) = C s r s k p s 2 + k p s + C s r s k i s + k i L i L G C s s 4 + (L i + L G )r s C s s 3 + (L i + L G + C s r s k p )s 2 + (k p + C s r s k i )s + k i (a.3) V Ldq_act V Ldq_ref = G PI (s)G Pv (s) 1 + G PI (s)G Pv (s) = R L [C s r s k p s 2 + (k p + C s r s k i )s + k i ] L i L G C s s 4 + (L i + L G )r s C s s 3 + (L i + L G + C s r s k p R L )s 2 + (k p + C s r s k i )R L s + R L k i (a.7) where R L is the load resistance The closed loop block diagram of the load voltage in the d-q frame is depicted in Fig. 29.
The closed loop transfer function can be represented by (a.7), as shown at the top of the page.

D. THE DC-LINK VOLTAGE CLOSED LOOP T.F DURING OGT
The plant transfer function for the DC-link voltage controller can be represented by the boost converter transfer function (a.8). The inverter with the filter impedance and the load resistance (R L ) can be represented to the boost converter by an output resistance R o for simplicity.
where D = (1 − D) and D is the average duty cycle of the boost converter. The closed loop block diagram of the DC-link voltage is shown in Fig. 30.
The closed loop transfer function of the DC-link voltage can be represented by (a.9), as shown at the top of the page.