Control of Transformerless Inverter-Based Two-Stage Grid-Connected Photovoltaic System Using Adaptive-PI and Adaptive Sliding Mode Controllers

To enhance the move towards a sustainable society, the solar Photovoltaic (PV) industry and its applications are progressing at a rapid rate. However, the associated issues need to be addressed when connecting PV to the grid. Advanced and efficient controllers are required for the DC link to control the second harmonic ripple and current controllers to inject quality active and reactive power to the grid in the grid-connected PV system. In this paper, DC-link voltage, active power, and reactive power are successfully controlled in stationary reference using Adaptive-PI (A-PI) and Adaptive-Sliding Mode Controller (A-SMC) for a 3 kW single-phase two-stage transformerless grid-connected inverter. A Resonant Harmonic Compensator (RHC)-based Proportional Resonant (PR) controller is employed in the current-controlled loop. The magnitude, phase, and frequency information of the grid voltage are provided by Second-Order General Integral (SOGI)-based PLL that has harmonic immunity, fast-tracking accuracy, and a rapid-dynamic response. MATLAB®/Simulink®/Simscape R2017b were used for the test bench implementation. Two scenarios were considered: in the first case, the input PV power feedforward loop was avoided, while in second case, it was included. The feedforward loop of input PV power improved the overall system dynamics. The results show that the designed controller improves both the steady-state and dynamic performance as compared with a proper-regulated PI-controller. The proposed controllers are insensitive to active and reactive power variations, and are robust, stable, faster, and fault tolerant, as compared to controllers from prior studies.


Introduction
Depletion of conventional energy resources and a sudden increase in the need for clean power generation due to environmental concerns have increased the installation of PV systems around the globe [1]. Grid-connected PV systems are becoming even more important as a result of the popularity of power electronic converters and the declining prices of PV modules [2,3]. Although three-phase PV systems are used in the industry for large PV installations, single-phase PV systems are gaining popularity for grid and household connections [4].
In order to guarantee the reliability, integrity, and availability of the electrical installation, distribution system operators need to meet grid codes set by the authorities [5,6]. The controllability of single-phase grid-connected PV system is a challenge. The PV system should be able to meet the requirements by providing necessary support services, such as Low-Voltage Ride Through (LVRT) and reactive power support [7]. Several LVRT schemes are presented in the literature for single-phase PV systems [8][9][10][11][12][13]. The PV system should also be capable of handling grid faults. This needs smart control strategies to manage fluctuations and ensure accurate voltage regulation. Power quality-related problems are the main cause of economic losses. These aspects of a PV system are evaluated by multiple parameters, such as voltage fluctuations, unbalance, harmonics, and flickers [14].
Grid-Connected Transformerless PV (GTPV) inverters are becoming more popular than transformer-based inverters because they are cheaper, more efficient, simpler in design, lighter in weight, and smaller in volume. Generally, current control is a dual control loop: the DC-link voltage is regulated in the outer loop and the current is controlled in the inner loop, with a PI controller normally being used in both loops. The DC-link capacitors are extensively employed for power stabilization and to control decoupling of grid-connected PV system. Fast and efficient control is needed to limit fluctuation in the input DC voltage of the inverter, to minimize DC-link capacitance, and to reduce ripples to improve the overall reliability of the system [15]. The PI closed-loop system uses DC-link voltage as feedback, which results in second-order ripples in the magnitude of the reference current. These ripples result in third-order harmonics in the current waveform. In order to overcome this issue, a low-pass filter can be used, but the filter has a narrower control band. Moreover, robust and efficient current controllers with proper grid-interfaced filters are required to inject quality active and reactive power into the grid. Generally, a Proportional Integral (PI) controller is used in transformerless GTPV inverters. The PI controller is not suitable for dynamically varying operating conditions, sudden disturbances, and parametric uncertainties because it uses fixed values of proportional and integral gains. Adaptive and robust controllers are required to resolve this issue by injecting high-quality active and reactive powers with zero steady-state error. One of the major concerns in GTPV inverters is the leakage current [3]. In order to deal with this, to improve the performance of the GTPV system, researchers proposed multiple control schemes. In [3], Fuzzy PI (F-PI) and Fuzzy Sliding Mode Control (F-SMC) are utilized on the GTPV inverter for Maximum Power Point Tracking (MPPT) on the PV side, and high-quality current injection on the inverter side. DC-link voltage control for a single-phase GTPV inverter is presented in [15][16][17][18][19]. F-SMC incorporates the qualities of PI fuzzy and SMC because it uses both PI fuzzy control and SMC approaches to update the designed controller [20,21]. A variety of controllers are utilized by researchers in order to improve the transient and steady-state performance of GTPV inverters. These include, SMC [22], the proportional resonant controller [23], the deadbeat controller [24], the hysteresis controller [25], and the PI controller [3]. The Artificial Neural Network (ANN) controller, the nonlinear adaptive controller, the Artificial Intelligence (AI) fuzzy controller, and the neuro-fuzzy controller are also proposed [26][27][28][29]. The above-mentioned controllers improve the performance of grid-connected PV system. Nevertheless, they lack the analysis and comparison of adaptive PI, adaptive-SMC, and PR with RHC in coordination with and without a feedforward loop of PV power.
In this paper, DC-link voltage, active power, and reactive power are successfully controlled in stationary reference using A-PI and A-SMC for 3 kW a single-phase two-stage transformerless grid-connected inverter. The advantages of FLC and conventional PI are integrated in A-PI. The K p and K i gains are updated using fuzzy rules. FLC can deal with uncertainties and nonlinearities. This makes FLC useful for applications in which models are not properly defined, are complicated, and are nonlinear with parametric variations. The designed A-PI has fewer update parameters, a simple structure, and is easy to implement. Since FLC is implemented in coordination with the PI controller, it provides faster and better steady-state and dynamic responses, and is robust and more accurate [30]. In addition, A-SMC combines the promising features of A-PI and SMC. In A-PI fuzzy IF-THEN rules are used to update the K p and K i . The A-PI controller reduces chattering in steady-state operations. The SMC enhances the stability of the system and has a fast transient response. The SMC is insensitive to external disturbances and robust to parameter variation and uncertainties [31]. A RHC-based PR controller is employed in the current-controlled loop. The PR controller with RHC mitigates the grid distortions, i.e., third, fifth, and seventh [32]. The magnitude, phase, and frequency information of the grid voltage are provided by SOGI-based PLL, which has harmonic immunity, fast-tracking accuracy, and a rapid-dynamic response. MATLAB ® /Simulink ® /Simscape R2017b were used for the test bench implementation. Two scenarios were considered: in first case, the input PV power feedforward loop was avoided, while in second case, it was included. The feedforward loop of the input PV power improved the overall system dynamics. The results show that the designed controller improves both the steady-state and dynamic performance as compared to a proper-regulated PI controller. The proposed controllers are insensitive to active and reactive power variation, are robust, stable, fast, and fault tolerant, as compared to controllers from prior studies.
The main contributions of this paper are: • The design of a A-PI and A-SMC for DC-link voltage control, for both active and reactive power control; • The current controller was designed with an RHC-based PR controller to mitigate third, fifth, and seventh harmonics; • A SOGI-based PLL was employed that has harmonic immunity, fast-tracking accuracy, and a rapid dynamic response; • Testing of the proposed system under two scenarios, i.e., with and without a feedforward PV power loop, to improve dynamics and control; • A comparative assessment of the designed controllers with a conventionally welltuned PI controller.
The remainder of the paper is organized as follows: In Section 2, the overall structure of the two-stage single-phase grid-connected inverter for a PV system is presented, then the equations of the control loop with and without the feedforward loop of PV power are comprehensively derived, the PR controller with RHC is discussed, and the SOGI PLL design is outlined. The designed controllers, i.e., A-PI and A-SMC, are discussed and described in Section 3. The simulation results are presented and discussed in Section 4, and the conclusion along with a brief proposition are presented in Section 5. Figure 1 shows the structure of the single-phase two-stage transformerless gridconnected PV inverter. The parametric values of the system are given in Table 1. MATLAB ® / Simulink ® /Simscape R2017b were used as a control design and simulation platform. For the effective operation of the designed system, control of various parts is mandatory, i.e., the PV side: for maximum power extraction; the inverter side: injection of high-quality current (active and reactive power); and the grid: for ancillary functions. In addition, the consideration of mission profiles (solar irradiance) and ambient temperature are important during the design and planning phase of a PV system as they influence the PV energy [33,34]. Each stage, e.g., the DC-AC inverter and DC-DC converter parts, were completely designed in [3]. This work is an extension of our previously published work [3].

Control of Transformerless PV Inverter Design of Control Loop
The grid-connected PV system's control structure consists of dual cascaded loops. The inner loop is recognized as the current-control loop and is used for managing power quality and current protection. The outer loop is the power-or voltage-control loop and is used to generate the references for the current loop [5]. The injected powers (active and reactive) are measured using single-phase PQ theory. The orthogonal signal generator is used to generate v gα and v gβ as follows: where P is the active power, Q is the reactive power, and i gαβ , v gαβ are the stationary reference frame's grid current and voltage, respectively. The current reference is calculated using Equation (1) as follows: In Equation (2), the ' * ' shows the reference signals. Equation (2) can be written as A PI controller is used for power regulation since the P and Q are DC quantities in steady state, as follows: where " * " is the reference signal, and the active and reactive powers are regulated using the PI controllers with transfer functions G p (s) and G q (s), as follows: Figure 2 presents the control-loop implementation. The DC-link voltage, and the active and reactive powers are regulated with a well-tuned PI controller, while the currentcontrolled loop employs PR with RHC. As shown in Figure 2, two scenarios are considered: in first case, (a) the input PV power feedforward loop is avoided; while (b) in second case, it is included. The feedforward loop of input PV power improves the overall system dynamics. For the DC-link controller, the PI controller is employed as follows: where k p and k i are proportional and integral gains, respectively. Then, using Equation (4), the inner current loop reference is calculated. To mitigate the grid distortions, the PR controller with RHC is utilized. In this, the central frequencies of the multiple resonant controllers are allocated at different harmonics, i.e., third, fifth, and seventh. The gains of this controller are set as k pr = 18, k pi = 2200, k 3 pi = 1200, k 5 pi = 800, k 7 pi = 200, respectively [34,35].
During normal operation, the grid should inject the maximum possible active power with a power factor close to unity. When a grid fault occurs, the inverter should also inject some reactive power in order to support the grid voltage during recovery. The injection of the reactive power is dependent on the current rating of the inverter and the voltage sage depth. Using Discrete Fourier Transform (DFT), the average and reactive power references are measured as in [5]. The second-order generalized integrator was designed in our previous work [3]. The transfer function is defined as follows: where ω is the resonance frequency of SOGI. The closed-loop transfer functions are represented by H d (s) and H q (s) as

Fuzzy Controller Design
Real-world problems are very complex in nature, and complex problems are basically fuzzy. Fuzzy Logic Controllers (FLC) do not rely on mathematical models and add human logical thinking to the system. FLC can deal with uncertainties as well as nonlinearities. This makes FLC helpful for applications in which models are not properly defined, are complicated, and are nonlinear with parametric variations.
FLC is implemented in four steps as shown in Figure 3. These steps are detailed as follows: 1. Fuzzification: in this step, a fuzzifier uses linguistic variables, terms, and fuzzy membership functions to map real/crisp input data, obtained from the system, to the fuzzy set; 2. Rule-base: this step contains a fuzzy set of rules, a condition, and a conclusion. These IF-THEN rules are used to define the controller action to control the output variables in terms of input variables; 3. Fuzzy inference mechanism: this mechanism controls the plant in the best possible manner by taking expert decisions to interpret and apply the rules; 4. Defuzzification: in this step, de-fuzzifier converts the fuzzy input from the inference mechanism to a real-time/crisp output, which goes to the plant as the controller effort/input.

Adaptive-PI Controller Design
Conventional PI controllers cannot perform well in the presence of sudden disturbances, parametric variations, and model uncertainties because they use constant values of proportional (K p ) and integral gains (K i ). Adaptive-PI (A-PI) controllers solve this problem by adjusting their parameters/gains, as shown in Table 2 and Figure 4. They use following fuzzy rules to adjust the parameters according to error function: • If absolute error |e(t)| is small, then K i is zero and K p is large; • If |e(t)| is large, then both K i and K p are large; • If |e(t)| = 0, then K i is smaller while K p is large. Guassian membership functions are often used in FLC and are expressed as where c i is the center and σ i is variance or standard deviation. The PI controller is expressed as where K p and K i are the proportional and integral gains, e(t) is the input to the controller, and v * DC /i g is the output of the controller. Equation (11) shows that the proportional and integral gains are fixed and are not able to manage parameter uncertainties, load variations, disturbances, and electrical faults. This problem is solved by the adaptive fuzzy-PI controller because it uses adaptive gains: v * DC /i * g (Fuzzy) = X 1 L 1 e(t) + X 2 L 2 e(t)dt.
where X 1 and X 2 are the outputs of the fuzzy logic controller, and L 1 and L 2 are the learning rate constants for the gains K p and K i , respectively.

Adaptive Sliding Mode Controller Design
The Adaptive Sliding Mode Controller (A-SMC) is the combination of fuzzy-PI and Sliding Mode Controller (SMC). The A-SMC combines the favorable features of both controllers. Figure 5 shows the implementation of the F-SMC. Fuzzy IF-THEN rules are used to update the proportional gain (K p ) and the integral gain (K i ) of the fuzzy-PI controller [20,36]. The SMC enhances the stability of the system and has a fast transient response. In the first step of the SMC, the sliding surface is defined using error and derivative of error. In the second step of the SMC, a control law is designed for reference tracking [37,38]. The error and its derivative are always directed towards the sliding surface of the SMC. The sliding surface is defined as follows: where λ is constant and depends on the bandwidth. λe(t) is defined as λe(t) is updated using the fuzzy-PI controller as explained in the previous subsection. The control law is designed as v * DC /i * g = −Usgn(S). (15) where U is positive gain, S is the sliding surface, and the sgn function is defined as The control law designed in Equation (15) causes chattering and oscillations. In order to avoid this, the continuous sat function is used instead of the discontinuous sgn function. This replacement adds continuous approximation to the system and results in a smooth control law, as shown in Equation (17):

Results and Discussion
The performance of the proposed control system was validated by simulating the Fuzzy-Logic-based PI (A-PI) and Fuzzy-Logic-based Sliding Mode Controller (A-SMC) for DC-link voltage control, and active power and reactive power control loops. The implementation platform for the test bench of the 3 kW grid-connected PV system based on two stages with an LCL filter was MATLAB ® /Simulink ® /PLECS/Simscape. A PR with RHC was used as a current controller for the STGT PV inverter. The current controller was designed with and without the feedforward PV power loop to improve dynamics and control, as presented in case 1 and case 2, respectively. The SOGI-based PLL was utilized for a fast dynamic response, fast tracking accuracy, and harmonic immunity. The system's nominal parameters, PV panel, and designed controller parameters are given in Table 1, Table A1, Table A2, and Table A3 respectively. The main objectives of the case I and case II experiments were threefold: (i) to check the efficient performance of the DC-link, active power, reactive power, and current-control loops; (ii) to assess the results and compare them with a traditional well-tuned PI controller; (iii) to verify the robustness of the designed controllers.

Case 1
In this case, the feedforward PV power was avoided and the control loop for active and reactive powers was included. A solar irradiance perturbation was added at 1 s by adjusting 1 kW/m 2 to 0.6 kW/m 2 and then to 0.8 kW/m 2 at 1.2 s. The simulation results were obtained for 3.2 s. The v dc , active power, and reactive power loops were first regulated by the PI controller and then by the A-PI and A-SMC. Figure 6a presents the DC-link voltage response for the designed controllers. Moreover, 1 PU is equivalent to 400 v dc , whereas the error response of this loop is presented in Figure 6b. At the start, the overshoot of the PI controller extended to 1.13 PU, normalizing at 0.9 s, while that of designed controller was 1.05 PU, settling at 0.2 s. When the solar irradiance perturbation occurred, the PI controller demonstrated more sensitivity. In brief, the designed controllers are faster, robust, less sensitive to sudden disturbances and parameter uncertainties, produce less chattering, and have a permissible overshoot and undershoot. Furthermore, the PI error was much higher than that of the designed controllers. Figure 6c demonstrates the active power loop response for the PI controller only. The reference power is well tracked by the actual power. Initially, the behavior is oscillatory, but after 0.35 s, it stabilizes. From 0 s to 1 s, a 3 kW active power (up to nominal value) was injected, from 1 s to 1.2 s, approximately 1.5 kW was injected, as shown in zoom area, and from 1.2 s onwards, 2 kW of active power was injected. A spike can be seen at 2 s and 2.6 s when reactive power was injected and removed. The responses of A-PI and A-SMC are not presented because for every controller, a new reference was generated. However, their responses were fast, efficient, robust, as can be seen from the other results. The reactive power injection of PI and the designed controllers is illustrated in Figure 6d. In order to analyze the operation of the reactive power loop, we can see that, initially, the reference reactive power was zero until 2 s, and at 2 s, 1-kVAR reactive power was injected into the system until 2.6 s. At the start, an oscillation can be seen, which settled after 0.15 s. Similarly, an oscillation in the reactive power occurred between 1 s and 1.2 s due to the variation in the solar irradiance or the active power variation. As can be seen from the zoomed-in areas, the output of the A-PI and A-SMC is robust, fast, reliable, and less oscillatory as compared with a fine-tuned PI controller. Figure 6e provides the grid current and voltage response. The zoomed-in window at 0.54 s to 0.63 s shows that the currents and voltages are in phase. The quality of the current and voltage is a better metric with which to validate the efficient performance of SOGI PLL. At 1 s, the active power decreased due to the solar irradiance, which is why the value of the current decreased accordingly (zoomed-in window from 0.96 s to 1.09 s). As demonstrated in the third zoomed-in window, from 1.8 s to 2.09 s, the current and voltage were out of phase at 2 s because the reactive power was injected. The designed control is exceptionally efficient with high-quality current and voltage. The reference and measured current response using the PR with RHC controller is described in Figure 6f. The controller response was fast, robust, efficient, and less sensitive to solar irradiance variation and reactive power injection. The reference and measured currents were welltuned with negligible error. Figure 6g shows the PV panel power (input power). The PV panel power was 3 kw until 1 s, from 1 s to 1.2 s, it was approximately 1.5 kW, and thereafter, it was approximately 2 kW. In comparison to the designed controllers, the PI controller was slower, oscillatory, with large spikes, and sensitive to disturbances and variations, as shown in the zoomed-in areas. The designed controller improves the PV power with a stable, reliable, efficient response, is less sensitive to disturbances and uncertainties, and is fast and accurate.

Case 2
In this case, the PV power was feedforward and the control loop for active and reactive power were included. The simulation results were taken for 3.2 s. A solar irradiance perturbation was added as previously described. The Vdc, active power, and reactive power loops were first regulated by he PI controller and then by the A-PI and A-SMC. The performance of the DC-link voltage is presented in Figure 7a for the designed controllers, while the error response of this loop is presented in Figure 7b. By comparing the results with Figure 6, in this case, both the steady-state and dynamic responses were greatly improved, i.e., the PI controller response was slower and showed sensitivity towards sudden disturbances, as illustrated in the zoomed-in area. The A-PI and A-SMC demonstrated faster responses and lower sensitivity to parameter uncertainty and sudden disturbances. The initial spike in the Vdc for the PI controller was 0.08 PU, while for the A-PI and A-SMC, it was negligible. In addition, the overshoot, undershoot, and settling time of the PI controller were much higher than for the designed control loops. This can also be noted in the error response. Furthermore, the error response for the PI controller demonstrated a higher variation. The active power loop response is presented in Figure 7c for the PI controller. The actual power tracked the reference power well. Initially, the behavior was oscillatory, but after 0.2 s, it stabilized. From 0 s to 1 s, a 3 kW active power (up to a nominal value) was injected, from 1 s to 1.2 s, approximately 1.5 kW was injected, as shown in the zoomed-in area, and from 1.2 s, 2 kW active power was injected. A spike can be seen at the 2 s injection and the removal of reactive power at 2.6 s. The responses of the A-PI and A-SMC are not presented as for every controller, a new reference was generated. However, their response was fast, efficient, robust as can be seen from other results. Figure 7d represents the reactive power injection. The reference reactive power was zero until 2 s, and at 2 s, 1 kVAR of reactive power was injected into the system until 2.6 s, in order to analyze the operation of reactive power loop. The start oscillation at the beginning settled after 0.2 s. Similarly, the oscillation in the reactive power occurred at 1 s to 1.2 s due to the variation in the solar irradiance and active power. As can be seen from the zoomed-in areas, the output of the A-PI and A-SMC was fast, robust, reliable, and less oscillatory as compared with the well-regulated PI controller.
The grid voltage and current response are presented in Figure 7e. The zoomed-in window at 0.58 s to 0.67 s shows that the currents and voltages are in phase. The quality of the current and voltage is a better metric for validating the performance of SOGI PLL. At 1 s, the active power decreased due to the solar irradiance, which is why the value of the current decreased accordingly. As demonstrated in the third zoomed-in window, from 1.9 s to 2.2 s, the current and voltage were out of phase at 2 s because of the injection of reactive power. The designed control is exceptionally efficient. Figure 7f shows the references and measured current response using the PR with RHC controllers. The controller response was fast, robust, efficient, and insensitive to solar irradiance variation and reactive power disturbance. The PV panel power is presented in Figure 7g. The PV panel power was 3 kW until 1 s, from 1 s to 1.2 s, it was approximately 1.5 kW, and thereafter, it was approximately 2 kW. In comparison to A-PI and A-SMC, the response of the PI controller was slower, it was oscillatory, with large spikes, and it was sensitive to disturbances and variations, as shown in the zoomed-in areas. The designed controller improved the PV power with a globally stable, reliable, fast response.

Conclusions
In this study, DC-link voltage, active power, and reactive power were successfully controlled in stationary reference using A-PI and A-SMC for a 3 kW two-stage single-phase transformerless grid-connected inverter. A PR with RHC is employed in the currentcontrolled loop. The phase information is provided by PLL, known as SOGI, which has harmonic immunity, fast tracking accuracy, and a fast dynamic response. Two scenarios are considered: in first case, the input PV power is not feedforward, while in second case, it is feedforward. The results demonstrate that the designed controller improves both the dynamic and steady-state performance as compared with a well-regulated PI controller. The proposed controllers are insensitive to active and reactive power variations, and are robust, stable, faster, and fault tolerant. In addition, the feedforward loop of the input PV power improves the overall system dynamics. The PV panel power is improved and its quality is enhanced. The injected current is of high quality and well controlled with negligible distortion.
In the foreseeable future, the simulation responses obtained will be validated using DSP TMS320F28335, FPGA, or DSPACE hardware boards. Next generation switching devices, i.e., Silicon Carbide (SiC) and Gallium Arsenide (GaN) will be replaced on MOSFET and IGBT to further enhance the efficiency of the system. Advanced controllers, e.g., a higher order sliding mode controller, a fuzzy-neural network, h-infinity, feedback linearization control, adaptive L1, etc., will be designed and compared with a well-tuned PI and with the controller designed in this paper to provide a better comparison. In addition, the heating effect produced by the ripple current in the DC-link capacitor causes vaporization and degradation of aluminum electrolytic capacitor, which should be addressed in forthcoming studies by designing online monitoring techniques. Furthermore, the H-bridge inverter can be replaced by another H-bridge (H-5, H-6, HERIC etc.) and neutral point clamped topologies to obtain better results. Funding: This Research was Supported by BK21PLUS. We also acknowledged NUST.

Conflicts of Interest:
The authors declare no conflict of interest.   Table A3. Control gains with PV power feedforward loop.