Full-Order and Simplified Dynamic Phasor Models of a Single-Phase Two-Stage Grid-Connected PV System

This paper presents a study on the use of the dynamic phasor (DP) method to develop efficient simulation models for a single-phase two-stage grid-connected photovoltaic (PV) system. Two DP models, DP-Full and DP-Simp, are proposed, with the former modeling the PV array, PV capacitor, boost converter, DC-link, and MPPT (maximum power point tracking) control in detail, while the latter simplifies the DC-side model of the inverter by aggregating the PV capacitor- and boost inductor dynamics into a first-order function and calculating the MPP (maximum power point) voltage and current analytically. The accuracy and execution speed of the two DP models are verified by comparing their performance with those of a detailed switching model simulated in a commercially available electromagnetic transient program. Simulation and error calculation results show that there is a good agreement between results from the proposed DP models and the detailed switching model. The proposed DP models also demonstrate computational advantage over the detailed switching model in a multi-converter scenario, making them useful for fast-paced transient analysis of distribution grids with high PV penetrations.

INDEX TERMS Dynamic phasor, grid-connected inverter, reduced-order modeling, single-phase, solar photovoltaic (PV) system, two-stage inverter. The desire to entrench environmentally friendly, reliable, and sustainable generation and utilization of electricity by governments and stakeholders due to concerns over energy security and climate change, have resulted in the increasing integration of renewable energy sources such as photovoltaic (PV) and wind energy systems into the power system [1].

Symbol Definition
For instance, about 800,000 micro inverters fed by solar PV sources have already been installed on Oahu Island (Hawaii) [2]. More PV-based micro inverters are expected to be installed in Hawaii as the Hawaiian government works toward ensuring 100% of its electricity comes from renewables [2]. Based on the number of power processing stages, singlephase grid-connected PV systems can be categorized into single-stage and multi-stage systems [3], [4], [5], [6]. In a single-stage PV inverter topology, the inverter is responsible for optimizing and exporting PV power production, grid synchronization, and the injection of commanded reactive power to stabilize local voltage. A single-stage PV topology has the advantages of lower installation cost, higher reliability, and higher conversion efficiency compared to the two-stage topology but at the expense of loss of voltage boosting capability and limited control flexibility. A commonly used multi-stage PV generation system is the two-stage topology consisting of an intermediate DC/DC conversion stage and a main DC/AC conversion stage [4]. The DC/DC conversion stage ensures that maximum power is extracted from the PV arrays while the DC/AC conversion stage stabilizes the DC-link voltage as well as synchronizes the inverter to the grid. The main advantages of the two-stage topology are the increased control flexibility and the opportunity to eliminate bulky transformers. However, compared to the single-stage topology, the two-stage PV inverter topology has the limitations of lower conversion efficiency, lower reliability, and higher installation and maintenance costs. In [5], a survey of topologies and applications of impedance source inverters is provided while extensive research on integrated input and output inverter control scheme is suggested. The authors of [6] provide surveys of control philosophies, power-stage configurations, synchronization methods, and various technical requirements for roof-top PV integration into the existing low voltage distribution network while identifying important research gaps. The authors of [6] concluded that the efficiency of single-stage topologies is higher compared to two-stage topologies. However, the flexibility provided by two-stage topologies to implement modularized MPPT (maximum power point tracking) units for optimal energy production while also allowing transformerless operation makes them well-suited for residential PV installations [7].
Due to the stochastic nature of solar energy and the lack of natural inertia provided by converter-interfaced energy sources, stabilization, design, and resilient operation of PV-rich power systems will become more challenging [8].
With the large number of inverter-based sources already integrated into power systems, scalable models that present very low computational costs are essential in analyzing the dynamics of several PV-based inverters in future electricity networks [9]. Detailed switching-type models of PV-based two-stage inverters found in commercial software packages such as EMTP (Electromagnetic Transients Program), PSCAD (Power Systems Computer Aided Design), and Simulink/Simscape impose excessive computational burden when used to simulate power systems made up of several inverters. Averaged models used in transient stability (TS)type simulation programs are not suitable for system-level studies in PV-rich networks. In fact, postmortem investigations of the recent California wildfires attributed the use of simplified PV models, which neglect the dynamics of a phase-locked loop (PLL) and DC source, as responsible for hampering the ability of power system operators to prevent widescale outages during the wildfires [10]. The report stated that simplified TS-type models failed to predict the actual transient behavior of the PV-based inverters during transmission faults induced by the wildfires. Specifically, the reports suggest that these PV inverters disconnected due to (1) PLL frequency deviating from the nominal value, (2) overcurrent in the DC-link, or (3) overvoltage in the AC-side converter. Therefore, PV-based inverters simplified as current sources with electromechanical time constants and no DC source dynamics are unsuitable for studying the impact of AC-side faults on inverter-based PV systems.
To overcome the low accuracy of TS-type models and excessive computational cost of detailed models, the dynamic phasor (DP) method has been used by several researchers to model power converters [11], [12], [13]. The DP method is based on describing the dominant harmonics of a system via a set of time-varying Fourier coefficients. The DP method allows the flexibility to model harmonics of interest thereby enabling the possibility of reducing model complexity without losing much accuracy [14], [15], [16]. In [12] and [13], the DP method is used to derive a reduced-order model of a single-phase PV inverter suitable for large-scale distribution system analysis. The MPPT, DC source, and PLL dynamics are neglected to simplify the model. However, the omission of DC source dynamics limits the ability of such reduced-order model to predict the impacts of transient faults and conditions discussed in [10]. In [17], the DP method is used to model a single-phase two-stage converter. Harmonics based on the system frequency and boost converter/inverter switching frequencies are modeled. Results from [17] show that the DP-based two-stage inverter model is computationally more efficient than a detailed model built on Simulink/SimPowerSystems. However, the inverter modeled works in standalone mode. Therefore, the model is unsuitable for studying grid-connected PV systems. The authors in [8] develop simplified and phasor models suitable for fast-paced time-domain and phasor simulation of a distribution system with many PV generators. Although the models in [8] significantly saved computation time, however, the boost converter and coupling inductor dynamics, as well as PV voltage and grid current loops are neglected. Such models are unsuitable for conducting studies required to proactively avert blackouts during grid disturbances as reported in [10]. In [9], the phasor models of voltage-sourced converters widely used in grid integration studies are discussed. These phasor models neglect current loop and AC inductor dynamics to reduce execution time. The authors concluded that although phasor models provide the benefits of faster simulation and insightful results compared to detailed models, the results from phasor models must be scrutinized to ensure that these results are reliable. In [18], simplified and phasor-based two-stage PV inverter models are proposed. The proposed models neglect the boost converter, AC inductor dynamics, and inner current loop as in [8]. Thus, the models have the demerits of those in [8] in addition to being unsuitable for estimating 2 nd -order harmonics in the DC-link voltage.
In this paper, the DP method is used to develop two computationally efficient models of a two-stage grid-connected PV inverter. The benefit of using the DP method is that time-domain signals are converted to slow-varying signals thereby enabling large step sizes to be used in accelerating simulations. In the first DP-based two-stage inverter model, referred to as DP-Full in this paper, switching harmonics are neglected whereas the dynamics of boost inductor, PV capacitor, DC-link capacitor, and inverter AC filter are preserved. In the second DP-based two-stage inverter model (DP-Simp), the boost inductor and PV capacitor dynamics are represented with a first-order lag filter to reduce the number of state variables. However, the DC-link capacitor dynamics are still retained thereby making the model suitable for transient analysis reported in [10] unlike the reduced-order models proposed in [12] and [13]. The main contributions of this paper include (1) extending the DP-based decoupled power control to a single-phase two-stage grid-connected inverter and (2) proposing the DP model of a two-stage PV system with a simplified DC-DC converter without omitting DC-link dynamics. The proposed model is well-suited for system-level studies and analyses.
The rest of the paper is organized as follows. In Section II, the DP method is explained briefly. Section III presents the DP-Full and DP-Simp models of a two-stage grid-connected PV system. Small-signal models and expressions for computing control gains are outlined in Section IV. In Section V, the two DP models are validated via simulations and comparative analyses. In Section VI, the computational performance of the two DP models in a two-bus power system is validated. Conclusions are drawn in Section VII.

II. DYNAMIC PHASOR METHOD
The basic principle of the DP method is that a nearly periodic time-domain waveform, x (τ ) with a fundamental frequency, f and having potential high-order harmonics, can be represented by a time-dependent Fourier series on the interval τ ∈ (t − T , t] [11], [12], [13], [14], [15], [16], where ω is the fundamental frequency of x (τ ) in rad s , and T is the sliding window length. Since x (τ ) may be aperiodic, the complex Fourier coefficient, ⟨x⟩ k (t) has a varying amplitude and it is therefore referred to as the kth DP [11], [12], [13], [14], [15], [16]. ⟨x⟩ k (t) can be determined via an averaging operation using: The kth DP obtained in (2) is a low-pass version of x (τ ). Therefore, the DP method allows large step sizes to be used in simulating models since comparatively fewer samples can accurately define low-pass signals compared to original instantaneous signals [11]. The accuracy and complexity of DP models are controlled via k i.e., a set of dynamic phasors. The more the number of harmonics included, the closer the signal reconstructed using DPs is to the original time-domain signal. However, the inclusion of higher-order DPs increases complexity and computation cost [11]. Therefore, expert knowledge is required to ensure a good compromise between accuracy and complexity. Nevertheless, in practice, only a few dominant harmonics are modeled. For clarity, the time argument will be dropped. Other important DP properties are given as follows: where ⟨x⟩ * k is the complex conjugate of ⟨x⟩ k , * is the conjugate property, ⟨x⟩ 0 , ⟨x⟩ R k and ⟨x⟩ I k are the zeroth, real, and imaginary components of ⟨x⟩ k , respectively.

III. MODELING OF SINGLE-PHASE TWO-STAGE GRID-CONNECTED PV SYSTEM
This section outlines the operational principle of a twostage grid-connected photovoltaic (PV) system. It also presents the averaged and DP models of the proposed DP-Full and simplified DP models. To compute control gains and ensure that the dynamic and steady-state behavior of the proposed DP models align with that of the detailed switching model, the small-signal method is utilized to develop transfer functions and expressions, which are then compared.
A. PRINCIPLE OF OPERATION Fig. 1(a) depicts the structure of a detailed single-phase twostage grid-connected PV system. The first (conversion) stage features a boost converter used for performing MPPT operation, voltage boosting, and decoupling of the PV source from the DC link [19]. The indirect single-loop MPPT control strategy is used to keep the PV capacitor voltage at the MPP [20]. The second stage comprises of a currentcontrolled H -bridge inverter used to convert DC power produced by the PV modules to AC power, a PLL used for grid following/synchronization, and a double-loop cascade control scheme made up of a slower outer voltage loop and a faster inner current loop, for injecting commanded activeand reactive-power into the grid [19], [20]. An inductive filter of inductance, L g with R g representing the grid losses is used to interface the inverter to the grid. The PV capacitor, C pv converts the current source (PV array) to a voltage source whereas the DC-link capacitor, C dc is used to stabilize the DC-link voltage. The PV source considered in this paper is assumed to consist of 16 KC200GT modules, with 4 seriesconnected modules and 4 shunt-connected PV strings. More details about a PV module can be found in [21] and [22]. The perturb and observe (P&O) MPPT algorithm [21] is used to obtain the reference PV voltage, v * pv .
B. FULL AVERAGED MODEL Fig. 1(b) shows the full averaged model of a single-phase two-stage PV system. The boost converter and the H -bridge inverter switches are replaced by transformer equivalents. The transformer equivalents enable easy analytical control design and the development of DP-based model of a singlephase two-stage PV system. The equations which capture the inverter-side and DC-side dynamics of the PV system are developed as follows.
Based on the single-diode model of a PV cell discussed in [22], the I-V characteristic equation for a PV array is given by where I ph and I o denote the PV and saturation currents of the module, respectively, R p denotes the equivalent shunt resistance of the module, R s represents the equivalent series resistance of the module, V t = N s k b T i q is the total thermal voltage VOLUME 11, 2023 of the module with N s series-connected cells, a is the ideality factor, q is the electron charge, k b is the Boltzmann constant, and N par and N ser are the numbers of parallel-connected PV strings and series-connected modules [22]. The PV capacitor dynamic equation can be expressed as where i pv and i L respectively denote the PV output current the boost inductor current. The boost converter dynamics can be captured with where v pv is the PV array output voltage, d is the average duty cycle of the boost converter's pulse-width modulator (PWM), d ′ = 1 − d, and i g represents the grid current. The inverter inductive filter reduces high-frequency harmonics in the injected current grid. Its dynamics can be captured with where m is the average duty cycle of the inverter's PWM.
The control system of the two-stage grid-connected PV system consists of PV voltage, DC-link voltage, reactive power, and AC current regulators. The dynamics of these regulators are derived as follows: To regulate the PV voltage, a proportional-integral (PI) controller is adopted. The PI controller is used to force the PV modules to operate at MPP. Assuming e v is a state variable, the PV voltage controller dynamics is given by: where K pbo and K ibo are the proportional and integral gains, respectively of the PV voltage controller. The DC-link PI controller dynamics are captured with: where K pdc and K idc are the proportional and integral gains, respectively of the outer loop voltage controller, b v is a state variable, V * dc = v * dc , and v dcf is the low-pass filtered DC-link voltage, obtained from: The cut-off frequency of the low-pass filter, ω f is selected to be one-tenth of the double line frequency (i.e., 12 Hz). The inverter current control is performed with a proportional-resonant (PR) controller represented by: where i * g denotes the reference grid current, I * g denotes the reference grid current amplitude, K p and K r are the proportional and integral gains of the PR controller, respectively, ω c is the PR controller cut-off frequency, ρ f and σ f are fictitious parameters, used to make the PR controller to become an ideal or a non-ideal type. For an ideal PR controller, (15) yields: where g 1 and g 2 denote the states of the PR controller.
To ensure voltage stability in distribution networks (DNs), recent regulations, and standards (e.g., VDE-AR-4105 [23] and IEEE Std. 1547-Rule 21 [24]), require inverters connected to the DN to participate in voltage regulation [6]. Thus, the reactive power loop should be modeled. The reactive power injected into the grid, Q g is controlled via a PI controller. The Q g controller dynamics is: where K pQ and K iQ denote the proportional and integral gains, respectively of the reactive power controller, b Q denote a state variable, and Q gf is the low-pass filtered version of Q g . Q gf is obtained from: The output variables of the outer loop controllers are transformed from the dq rotating reference frame to the αβ reference frame using: where i * gα and i * gβ denote the alpha and beta components of the reference grid current, respectively, I * gd and I * gq denote the direct and quadrature components of the reference grid current, respectively, and t represents the time variable.

C. REDUCED-ORDER AVERAGED MODEL
For system-level studies, a model that captures the PV capacitor, boost inductor, and MPPT dynamics might be unnecessarily too detailed. To reduce complexity, the boost inductor and PV capacitor dynamics can be aggregated and then represented with a first-order lag filter as shown in Fig. 1(c). In addition, the MPPT setpoint can be calculated analytically instead of using an MPPT algorithm. This eliminates the need to model the PV voltage regulator which further reduces the number of states in the model. This simplification does not impact the results significantly as confirmed by simulations.
The reduced-order equation representing the dynamics of the PV capacitor and boost inductor can be expressed as (20) where i * sp is the reference DC source current, i sp is the DC source current, τ b is the time constant of the DC source.The reference DC source current i * sp is calculated from: where P * pv denotes the reference PV array power from the MPPT block. According to [22], P * pv can be obtained as follows. For an array, its MPP voltage, V A mpp , and MPP current, I A mpp can be calculated from: where ϵ = R ser R par while V 1mpp and I 1mpp denote the MPP voltage and current of the simplified PV module model, respectively. Then, P * pv = V A mpp I A mpp . The variables V 1mpp and I 1mpp are obtained from: where W denotes the Lambert function [22], and V t is the thermal voltage of each module. Note that for solar radiation levels below 100 W.m −2 , ϵ will be high due to the low value of R ser . Thus, the analytical MPPT method might yield inaccurate results [25]. The DC-link dynamic equation is modified to be: Note that (11), (13)- (19) are relevant for the reduced-order averaged model.

D. DP-FULL MODEL
The DP-Full model is derived from the full averaged model by choosing a suitable set of dynamic phasors to approximate the detailed model. For the PV source, PV capacitor, and boost inductor dynamic equations, it is assumed that due to the high switching frequency of the boost converter, zeroth order DP is sufficient to capture the necessary dynamic interactions. For the DC-link capacitor, it is assumed that the zeroth order and 2 nd harmonic DP components are dominant. Therefore, a set of DPs k = {0, 2} is used to capture DC-link capacitor dynamics. For the inductive filter and grid current controller, it is assumed that the first harmonic DP component The DP model of the PV array is given by: The PV capacitor and boost inductor dynamics are given by For the DC-link capacitor, its dynamic model in the DP domain is given by: Furthermore, the AC inductor dynamics are captured with: The dynamics of the PV voltage regulator are: The DC-link capacitor dynamics in the DP domain are: The reactive power controller is modeled with: VOLUME 11, 2023 Note that the variables i g * 1 R and i g * 1 I are respectively equivalent to I gd * and I gq [26]. The AC current controller is modeled in the DP domain with: The DP-Simp model is derived from the reduced-order averaged model by a using suitable set of DPs.
In the DP domain, the simplified DC source is modeled as The zeroth order DP dynamics of the DC-link capacitor is captured with: The second harmonic part is the same as (30b)-(30c). Note that (31), (33)-(35) are also part of the DP-Simp model.

IV. SMALL-SIGNAL MODELING APPROACH
In this paper, transfer functions and mathematical expressions suitable for calculating control gains and ensuring the stability of the AC current, DC-link voltage, PV voltage, and reactive power loop controllers are obtained via the smallsignal modeling approach.

A. AC CURRENT LOOP
For the DP model, the AC current loop plant transfer function, H ac is given by: where where h 1 = 2ω c ρ f L g + R g , h 2 = 2ω c ρ f R g + ω 2 L g , and h 3 = ω 2 R g .
In this paper, the loop-shaping technique [26], [27] is used to compute K p and K r . Assume that K r affects the open-loop characteristics around ω. Then, G OL I can be simplified by setting K r to zero. Therefore, If the gain of G OL I (sim) is set to 1 i.e., G OL I (sim) (jω ICF ) = 1, where, ω ICF is the cut-off frequency of the PR controller. The desired phase margin, ψ d can be obtained from From (42), K r is expressed as If an ideal PR controller is used [27], then: For the detailed switching model, there is a PWM gain of 1/V dc . Therefore, G OL I for the detailed model is given by: Following the steps adopted for the DP model, then: where K ′ p and K ′ r denote the detailed model's PR controller gains.

B. DC-LINK VOLTAGE LOOP
For the DP model, the DC-link voltage loop plant is developed as follows. Recall that in most grid-connected PV systems, the amount of reactive power injected into the grid is usually small due to economic considerations. Therefore, we can assume that i g 1 I is zero. In steady-state, the real and imaginary parts of (31) reduce to ⟨m⟩ 1 I = 0 and ⟨m⟩ 1 R = v g 1 R /⟨v dc ⟩ 0 (higher-order DP components and R g are assumed to be negligible). Applying this assumption modifies (30a) to where P pv ≈ ⟨v dc ⟩ 0 ⟨i L ⟩ 0 d ′ is the PV array output power. Linearizing (47) around a stable operating point while also assuming a strong grid result in: Then, the DC-link plant is: Since the proportional and integral gains of the DC-link PI controller are denoted as K pdc and K idc , respectively, then the DC-link voltage closed-loop transfer function, G CL vdc is: where G f = ω f /(s + ω f ) is the transfer function of the lowpass filter. The loop gain is given by: The gains, K pdc and K idc are obtained by constructing a Bode plot of (51) and then imposing the desired phase margin and bandwidth. For the detailed model, the DC-link voltage control loop is implemented in the dq domain. The plant model is given by: Comparing (49) and (52) shows that the detailed model's DClink voltage plant is one-half of that of DP model. Therefore, the gains of the DP model's DC-link voltage loop will be onehalf of that of the detailed model. The loop gain is:

C. REACTIVE POWER LOOP
Reference [26] derives the reactive power loop plant, which is utilized with G f and PI controller transfer function to determine the reactive power loop gain of the DP model. The same procedure can be applied to derive the loop gain of the reactive power loop for the detailed model. It should be noted that the gains of the DP model's reactive power controller are half of those in the detailed model.

D. PV VOLTAGE LOOP
To derive the small-signal model of the PV voltage control loop, the equivalent circuit of the PV array at MPP is developed. According to [28], the equivalent output voltage, V eq and series resistance, R eq of a KC200GT module, linearized at MPP and under STC are 51.65V and 3.33 , respectively where R eq is the reciprocal of the slope of the current-voltage characteristic of the PV module. For a PV array comprising of 4 series-connected KC200GT modules and 4 shuntconnected PV strings, the PV array equivalent output voltage, V A eq and equivalent series resistance, R A eq are 206.6V and 3.33 , respectively. Fig. 2(a) shows the equivalent circuit of the boost converter and the PV array used for small-signal modeling and control design. From Fig. 2(a), the PV capacitor dynamic equation is: The linearization of (29), (30a) and (54) around an equilibrium point while treating the AC variables in (30a) as disturbances, yields: where D ′ = 1 − D, and D denotes the steady-state duty cycle. Le0 . In a twostage PV inverter, the PV voltage loop bandwidth is usually greater than the DC-link voltage loop bandwidth. In addition, by design choice, C dc is usually greater than C pv . As a result, v dc can be considered invariant (i.e., v dc = 0) and accordingly, (55c) can be neglected. Then, (55b) becomes: Equation (55) depicts the PV array as a current source connected to a stiff DC voltage source via a boost converter. Differentiating (55a) with respect to time, and substituting (55) into the resulting equation leads to: VOLUME 11, 2023 In the Laplace domain, where K u = −v dce0 /L b C pv is the gain, ω u = 1/ L b C pv is the undamped natural frequency, and ε u = 1/(2R A eq C pv ω u ) is the damping factor. Thus, under the open-loop control strategy, the damping value strongly depends on the operating point (i.e., R A eq ). As a result, a closed-loop control scheme is required to make the system robust to changes in operating points. Considering Fig. 2(b), the closed-loop transfer function of the PV voltage control is given as With the aid of a control design tool, (59) can be used to calculate the values of K pbo and K ibo .
Note that the open-loop and closed-loop transfer functions of the PV voltage control loop for the DP model are the same as that of a detailed model since the average PV voltage is the control target in both models.

E. CALCULATION OF TIME CONSTANT OF THE FIRST-ORDER LAG FILTER
The simplified DC source's time constant, τ b , is determined by studying the closed-loop transfer function of i sp . However, if (10) and (26) are compared, it is clear that i sp , which equals d ′ i L , is the boost converter diode current. Since i sp is a scaled version of i L , we can assume that the dynamics/pole distribution of i sp , can be determined by studying the closedloop transfer function of i L relative to v * pv . By leveraging the small-signal method, this transfer function is obtained as The study of the dominant poles and zeros in (60) is used to get the approximate value of

V. VALIDATION OF THE PROPOSED DP MODELS OF A TWO-STAGE GRID-CONNECTED PV INVERTER
In order to validate the fidelity of the proposed two DP models of a two-stage grid-connected PV system, the results from a corresponding detailed switching model are used. The two DP models are scripted in MATLAB while the detailed switching (SW) model is built on Simulink/Simscape environment (an electromagnetic transient simulator). Simulations were conducted on an HP Envy Windows 10 laptop with Intel® Core™ i5-7200U and CPU @ 2.50GHz.
The parameters of the system under study are summarized in Table 1. The PV array consists of 4 series-connected modules and 4 shunt-connected PV strings. The inverter PWM switching frequency ω s is 62.8 krad/s (10 kHz) while the boost converter's switching frequency is 314.2 krad/s (50 kHz).
Due to 120 Hz ripples in the DC-link voltage, a low-pass filter is used in the SW model to obtain the average DC-link voltage before passing it to the DC-link voltage controller. To ensure that the dynamic response of the SW model and the two DP models are similar, the low-pass filter is also included in the two DP models even though the average DClink voltage is explicit in the two DP models (i.e., ⟨v dc ⟩ 0 is inherent in the DP models).

A. COMPUTATION OF CONTROL GAINS
The control gains of the AC current, DC-link, PV voltage, and reactive power loops are computed as follows:

1) AC CURRENT LOOP
Assuming a target bandwidth, ω ICF = 5.03krad/s (i.e., 0.08ω s ) and a phase margin, ψ d = 45 • . Using (41), (43), (45) and (46), the parameters of the PR controller are obtained as K p = 0.075 and K r = 188.5 for the DP model, and K ′ p = 15; K ′ r = 37701 for the SW model. Fig. 3. shows the Bode plot of the loop gain (G 1 (s) for SW model and G 2 (s) for DP model) using the calculated gains. The PR controller's resonant feature allows the inverter to achieve a high gain at the resonant frequency thereby ensuring excellent current tracking. Also, the Bode plot of the SW and DP agree strongly agree, which confirms the accuracy of the smallsignal models derived in Section IV.

2) REACTIVE POWER LOOP
The reactive power loop parameters are K pQ = 0.006 and K iQ = 2, for the DP model and K pQ = 0.012 and K iQ = 4 for the SW model.

3) DC-LINK VOLTAGE LOOP
Using (51), the DC-link voltage controller parameters for the DP model are obtained K pdc = 0.4 and K idc = 7.5, corresponding to phase margin of 30.2 • and crossover frequency of 79.8 rad/s (12.70 Hz) as shown in Fig. 4. For the SW model, the control gains are obtained as: K pdc = 0.8 and K idc = 15 by using (53), which yields similar Bode plot as the DP model. The computed phase margin is sufficient to keep the DC-link control loop immune to disturbances and high frequency noise.
By using (58b), the PV voltage controller gains for both SW and DP models are calculated to be: K pbo = 0.01 and K ibo = 0.3. The chosen gains yield a crossover frequency of 0.97krad/s and a phase margin, 24 • as illustrated on Fig. 5. The resulting bandwidth is sufficient to ensure a clear dynamic separation between the DC-link voltage control loop and the PV voltage control loop.

5) SIMPLIFIED DC SOURCE TIME CONSTANT (τ b )
The time constant of the simplified DC source is obtained by studying the closed-loop poles and zeros of (60). Substituting the PV voltage controller gains and the parameters listed in Table 1

B. VALIDATION OF RESULTS
Considering the maximum occurring frequency in the SW and proposed two DP models, step sizes of 0.2µs, 0.1ms and 0.5ms are used to simulate the detailed model (SW), the DP model with a full-order DC source (DP-Full), and the DP model with a simplified DC source (DP-Simp), respectively. The perturb-and-observe algorithm is adopted as the MPPT algorithm in the SW and DP-Full models whereas the MPP variables are calculated analytically in the DP-Simp model. The PV capacitor, the DC-link capacitor, and the DC-link voltage filter are initialized to 105.2 V, 200 V, and 200 V, VOLUME 11, 2023 respectively. The performance of the proposed DP models is verified by considering two case studies involving change in irradiance and change in reactive power setpoint.

1) STEP CHANGE IN IRRADIANCE
In the first case study, the two-stage PV system is injecting 0.1 kVAR into the grid. At t = 0.3 s, the irradiance i rr is stepped from 1kW/m 2 to 0.8kW/m 2 with T i = 25. Fig. 7 shows the waveforms obtained from the SW model and the proposed two DP models during a step change in irradiance. Fig. 7(a) shows the PV voltage waveform. During steady state, the response of the DP model with a full-order DC source highly matches the SW model's response. However, during transients, there is a mismatch in the response of the DP-Full model due to inability of the zeroth-order DP equations of the boost inductor and PV capacitor current to accurately capture the dynamics. Moreover, due to low bandwidth of the v pv controller, the PV voltage waveform obtained from the SW model has 120 Hz frequency ripples. Notice that the waveform of v pv 0 obtained from the DP-Full and DP-Simp models tracks the average of the 120 Hz ripples in v pv . However, since the MPP voltage and current are calculated analytically in the DP-Simp model (i.e., there is no MPPT algorithm such as the P&O algorithm), the PV voltage waveform from the DP-Simp model is invariant and thus does not show the influence of MPPT on the PV voltage dynamics. Fig. 7(b) depicts the boost converter diode current (and equivalently the source current for the DP-Simp model) obtained from the SW, DP-Full, and DP-Simp models. To allow for easy comparison of waveforms, the 50 kHz switching ripples in i sp waveform from the SW model is filtered using a low-pass filter with a cut-off frequency of 60 Hz. We observe that the boost diode current decreases with irradiance. Moreover, the i sp waveforms obtained from the DP-Full and DP-Simp models represent the average of the i sp waveform from the SW model because only the zeroth-order DP of i sp is modeled in both DP-Full and DP-Simp models. Fig. 7(c) depicts the DC-link voltage waveform. Note that v dc waveforms for the DP-Full and DP-Simp models are obtained by using the expression: ⟨v dc ⟩ 0 + 2R(⟨v dc ⟩ 2 e j2ωt ). Notice that there are double-line frequency (120 Hz) ripples in the DC-link voltage waveforms obtained from the SW, DP-Full, and DP-Simp models. These ripples justify the passing of the DC-link voltage through a low-pass filter to obtain the average DC-link voltage which is in turn fed to the DC-link voltage controller. Otherwise, the double-line frequency ripples in the DC-link voltage will metamorphose into high-order harmonics in the grid current. Since only a fundamental frequency PR controller is present in the grid current loop, these ripples will not be filtered out leading to a deterioration in the grid current quality. Fig. 7(d) shows the grid current. The grid current waveform obtained from the three models is sinusoidal due to high grid inductance and the use of a fundamental PR controller. Results obtained from the DP-Full and DP-Simp models show a high degree of matching with the SW model results.
Figs. 7(e) and 7(f) show the active power and reactive power waveforms obtained from DP-Full, DP-Simp, and SW models during a step change in irradiance. The active and reactive power waveforms are filtered using a low-pass filter with cut-off frequency equal to 12 Hz. When the irradiance is 1kW/m 2 , the active power being injected into the grid is 3.2 kW. When the irradiance dropped to 0.8 kW/m 2 , the active power injected the grid dropped to about 2.55 kW. We can see that the active and reactive power waveforms obtained from the DP-Full, DP-Simp, and SW models are well-matched with each other. During startup, there is a ringing in the reactive power waveform due to the small amount of coupling between the reactive and active power loops as well as the slow reaction of the DC-link voltage loop. The slow speed of the DC-link voltage loop is caused by the high DC-link inertia (high DC-link capacitance) and low DC-link voltage bandwidth. However, during a step-change in irradiance, the reactive power waveform remains invariant in SW, DP-Full, and DP-Simp models which demonstrates the capability of the proposed DP models to accurately capture dynamics associated with decoupled power control operation.

2) STEP CHANGE IN REACTIVE POWER SETPOINT
In some applications for e.g., in distribution systems, the two-stage PV inverter may be required to absorb or inject reactive power to stabilize the system voltage. In this paper, the capability of the proposed DP models to enable the Simulation results from SW, DP-Full, and DP-Simp models of a single-phase two-stage grid-connected PV system during a step change in irradiance. (a) PV voltage (b) boost converter diode current (c) DC-link voltage (d) grid current (e) low-pass filtered active power injected into the grid (f) low-pass filtered reactive power injected into the grid. Note that the SW model's boost diode current is filtered using a low-pass filter with a cut-off frequency of 60 Hz, to remove 50 kHz switching ripples. independent control of reactive power is demonstrated by ramping Q * g from 0.1 kVAR to −0.2 kVAR between t = 0.6 s to t = 0.7 s. Fig. 8 shows the waveforms obtained from the SW, DP-Full, and DP-Simp models during a ramp change in reactive power setpoint. There is no change in PV voltage, boost diode current, and DC-link voltage because these DC-side variables are responsible for active power injection rather than reactive power injection. In addition, the active power injected into the grid remains unchanged in SW, DP-Full, and DP-Simp models due to decoupled nature of the outer loop controllers I the inverter side. There is no noticeable change in the grid current during the ramp change because the reactive power request is small compared to the active power injection. We can see that the proposed DP models are able to accurately predict the ramp change in reactive power which further confirms the high fidelity of the proposed DP models. Overall, the proposed two DP models reflect with a high degree of accuracy, the dynamic and steady-state responses of a detailed single-phase two-stage grid-connected PV system to dynamic changes in irradiance and reactive power setpoint.

C. ERROR ANALYSIS
The accuracy of the proposed DP-Full and DP-Simp models of a single-phase two-stage grid-connected PV system is quantified by computing the coefficient of variance (CV) of the root-mean-square error (RMSE) (also called root-meansquare deviation (RMSD)) in the DP-Full and DP-Simp models' variables with respect to the detailed switching model's variables. The RMSE and CV of RMSE are [29] and [30]: where x DP [i] is the value of the signal predicted by the DP model at i th data point or time step, x SW [j] is the value of the signal obtained from the detailed (or switched (SW)) model at j th data point or time step, N DP is the total number of data points or time steps in the DP model variable, and x SW is the mean value of the signal data obtained from the detailed switching model. Note that for i g , the root-meansquare value is used for normalization (i.e., for computing the CV (RMSE)) rather than the mean value (which equals zero) while for Q gf , the range is used for normalization [30] because the Q gf waveform contains both positive and negative values. Also note that we picked values at the same time step for both the DP model and the detailed model to ensure consistency. For instance, if data is picked at 0.2500 s and 0.2501 s for the DP model (i.e., 2500 th and 2501 st time steps, if the DP model's step size is 0.1ms), the same thing is done for the SW model (i.e., 1,250,000 th and 1,250,500 th time steps if the SW model's step size is 0.2µs). Therefore, the dimension of the vector of variables used for computing the CV(RMSE) for the DP model is equal to that of the SW model. Table 2 shows the CV(RMSE) values of variables obtained from DP-Full and DP-Simp models. The CV(RMSE) value in v dc is the lowest followed by that of i g for both DP-Full and DP-Simp models. These CV(RMSE) values are supported by the time-domain waveforms in Fig. 7 and Fig. 8 which reveal an excellent matching between the responses of DP-Full, DP-Simp, and SW models for v dc and i g . Moreover, the CV(RMSE) of i g from the DP-Full model (1.41%) is lower that obtained in [30] (i.e., 1.77% for a fully DP model with PR based current controller and ideal DC source) thus confirming the high fidelity of the DP-Full model. The CV(RMSE) in i sp for DP-Full and DP-Simp is about 7% because the zeroth-order DP of i sp do not precisely track the average of the 50 kHz ripples in the i sp waveform obtained from the SW model. Moreover, the use of a low pass filter to filter the i sp waveform originally obtained from the SW model might have introduced delays and significant errors. Generally, the CV(RMSE) in variables obtained from the DP-Full model is less that those from the DP-Simp models because of the simplification of DC source of the DP-Simp model, though the difference is very small. Overall, the CV(RMSE) in any of the variables obtained from the proposed DP-Full and DP-Simp models are less than 7% which further corroborates the accuracy of the proposed DP models. Therefore, the proposed DP models can be used for accurate study of a distribution grid consisting of several single-phase two-stage PV inverters. Table 3 summarizes the simulation execution time of the DP-Full, DP-Simp, and SW models. The DP-Simp and DP-Full models are about 952 and 555 times faster than the SW model, respectively. The DP-Simp model is faster than the DP-Full model because of a fewer number of state variables in DP-Simp model compared to DP-Full model. Considering that there are minor deviations between the SW model results and the proposed DP model results, we can conclude from the perspective of computational speed that the proposed two DP models offer more advantages than the SW model.

E. THE SIGNIFICANCE OF PROPOSED DP MODELS
The results shown in previous subsections reveal that the proposed DP-Full and DP-Simp models computationally outperforms the SW model in terms of execution time while yielding sufficiently accurate results. It is envisioned that the proposed DP models can be used for the accurate study of power system with several single-phase PV inverters. For instance, the smart contracts and transactions in local electricity markets or peer-to-peer energy trading [31], [32], [33] comprising of several prosumers that own PV-battery hybrid systems, can be quickly verified in the simulation domain (in offline or real-time mode) for technical feasibility by using the proposed DP-Full and DP-Simp models. In Section VI, the benefit of using the proposed DP models in a system-level simulations will be demonstrated on a two-bus power system.

VI. SIMULATION-DOMAIN STUDY OF TWO PARALLEL-CONNECTED TWO-STAGE PV INVERTERS
In this section, the computational superiority of the proposed two DP models over a detailed switching model in a multiple converter-based system is demonstrated by studying a two-bus power system shown in Fig. 9.
The two-bus power system consists of two parallelconnected single-phase two-stage PV systems. One of the two-stage PV system is directly connected to the point of common coupling (PCC) whereas the other one is connected to the PCC via a short distribution line with resistance R l (50 m ) and inductance L l (2 mH). To simplify the analysis, it is assumed that the both grid-connected PV inverters are mandated by the system operator to work in MPPT mode. The parameters of the two PV systems are the same as those in Table 1. The control gains computed in Section V-A are used in the PVI-1 and PVI-2 inverters.

A. SIMULATION RESULTS
Due to cloud movement at t= 0.3 s, the irradiance incident on the solar PV array connected to the first inverter (PVI-1) changes from 1kW/m 2 to 0.8 kW/m 2 while that of the second inverter (PVI-2) changes from 0.7 kW/m 2 to 0.9 kW/m 2 at t= 0.4s. The ambient temperature is assumed to remain fixed at T i = 25 • during the insolation changes. Also, due to the need to manage the voltage profile in the two-bus power system, it is assumed that the system operator requested PVI-1 to ramp its reactive power from 0.1 kVAR to −0.2 kVAR between 0.6 s and 0.7 s while PVI-2 is mandated to ramp its reactive power from 0 kVAR to 0.15 kVAR during the same period. Fig. 10 and Fig. 11 show the results obtained from the simulation of the two-bus power system. The two-bus power system built with SW, DP-Full, and DP-Simp models of a two-stage PV inverter are simulated with step sizes of 0.2µs, 0.1ms, and 0.5ms, respectively. Fig. 10 shows the response of PVI-1 during the change in irradiance and reactive power setpoint. The waveforms from the SW, DP-Full, and DP-Simp models are very well matched. Fig. 11 shows the response of PVI-2. During startup, there is ringing in the reactive power waveform due to slow DC-link voltage loop as well as small amount of coupling between the DC-link voltage loop and the reactive power control loop. Notice that the reaction of the DC-link voltage loop governs the shape of active power and grid current waveforms. This is because 1) the DClink voltage loop is responsible for balancing active power production and export in the two-stage PV inverter; and 2) the amount of active power injected into the grid is far greater than the reactive power injected into or absorbed from the grid. Generally, the results from the two-bus power system built with SW, DP-Full, and DP-Simp models strongly agree. Fig. 12 shows the total current injected into the grid i gT by two parallel-connected PV inverters. The total grid current is sensitive to irradiance changes in the two inverters because the two PV inverters have similar capacity. Overall, the total grid current waveforms from the two-bus power system built with SW, DP-Full, and DP-Simp models are well-matched. Table 4 illustrates the CV(RMSE) of variables obtained from the simulation of two-bus power system built with SW, DP-Full, and DP-Simp models. The two-bus power system with DP-Full models is more accurate than the power system built with DP-Simp inverter model. The CV(RMSE) in the variables from the PVI-2 inverter is smaller compared to that of PVI-1 owing to increased AC inductance seen by PVI-2 inverter as well as lower amount of power exported to the grid.

B. ERROR ANALYSIS
The increased AC inductance reduces the magnitude of the high-order harmonics thereby reducing the approximation error resulting from the use of a fewer number of harmonics to construct the DP-Full and DP-Simp models. Overall, the variables of the two-bus power system built with DP-Full and DP-Simp models have accuracy above 93%. Table 5 shows the execution speed of the two-bus power system built with SW, DP-Full, and DP-Simp models. As observed in Table 5, the DP-Full-based two-bus power system and the DP-Simp-based two-bus power system are respectively 506 and 784 times faster than the SW-based twobus power system. Compared to the one-bus case, there is FIGURE 8. Simulation results from SW, DP-Full, and DP-Simp models of a single-phase two-stage grid-connected PV system during a step change in reactive power setpoint. (a) PV voltage (b) boost converter diode current (c) DC-link voltage (d) grid current (e) low-pass filtered active power injected into the grid (f) low-pass filtered reactive power injected into the grid. Note that the SW model's boost diode current is filtered using a low-pass filter with a cut-off frequency of 60 Hz, to remove 50 kHz switching ripples. a reduction in the computational advantage of the DP-Full and DP-Simp models over the SW model. This reduction can be attributed to the following reasons. One, the detailed VOLUME 11, 2023 FIGURE 9. The structure of a two-bus power system made up of two parallel-connected two-stage PV inverters. converter models in a commercial software is optimized to simulate faster for multiple-converter-based studies via parallelization and exploitation of sparsity features whereas the computer codes for the DP models are not optimized for multiple-converter-based simulations. Two, the DP model requires at least twice as many differential equations as the detailed model due to the separation of variables into real and imaginary components. As a result, the computational FIGURE 10. Response of PVI-1 built with SW, DP-Full, and DP-Simp models in a two-bus power system. (a) DC-link voltage (b) grid current (c) low-pass filtered active power injected into the grid (d) low-pass filtered reactive power injected into the grid.

TABLE 5.
Comparison of execution time of a two-bus power system built with SW, DP-Full, and DP-Simp models of a single-phase two-stage grid-connected PV system (Runtime: 0.8 s).
advantage of the DP model decreases as the number of converters in the system increases. . Response of PVI-2 built with SW, DP-Full, and DP-Simp models in a two-bus power system. (a) DC-link voltage (b) grid current (c) low-pass filtered active power injected into the grid (d) low-pass filtered reactive power injected into the grid.

FIGURE 12.
Total current injected into the grid by PVI-1 and PVI-2 inverters built with SW, DP-Full, and DP-Simp models in a two-bus power system.

VII. CONCLUSION
In this paper, the dynamic phasor method is extended to the modeling and design of control systems of a single-phase two-stage grid-connected PV system. Two DP models, DP-Full and DP-Simp, are proposed based on how the DC side of the inverter is modeled. In the DP-Full model, the PV array, PV capacitor, boost converter, DC-link, and MPPT control are modeled in detail. In the DP-Simp model, the DC side is simplified by aggregating the dynamics of the PV capacitor and inductor into a first-order lag filter function while the MPP voltage and current are calculated analytically. By leveraging the small-signal method, the control systems of the proposed DP models are designed to exhibit behaviour/characteristics that align with that of a detailed switching model. The accuracy and efficacy of the proposed DP-Full and DP-Simp models are verified by comparing their computational performance and results with those from a detailed switching model. Root-mean-square-error calculations are analyzed and then used to quantify the accuracy of the proposed DP models. Simulation results show that waveforms obtained from the proposed DP models are well-matched with waveforms from a corresponding detailed switching model. The proposed models demonstrate a computational advantage over the detailed model when used in a two-bus power system. The proposed DP models may be useful for the fast-paced verification of system stability (or the feasibility of local electricity market transactions) in low-voltage grids. Future work will focus on ascertaining the value of the DP method when investigating the stability of novel control schemes and the influence of (control and device) parameters and subsystems on small-signal stability for two-stage PV systems.