The increasing integration of renewable energy sources via power electronic interfaces has fundamentally altered the characteristics of modern power systems. The grid connected inverter serves as the critical interface between distributed generation units and the utility grid, making its performance under various operating conditions paramount. Traditional control paradigms, designed primarily for ideal, balanced sinusoidal grid voltages, often exhibit significant performance degradation when confronted with real-world, non-ideal grid environments. These environments, characterized by voltage unbalance, harmonic distortion, and frequency deviations, are becoming more prevalent due to the widespread use of non-linear loads and the intermittent nature of renewable generation. This necessitates the development of robust control algorithms that ensure stable operation, high-quality current injection, and compliance with stringent grid codes, even when the grid voltage is distorted or unbalanced.
Non-ideal grid conditions primarily manifest as the presence of negative-sequence components and characteristic harmonics (typically of orders 6h±1, where h is an integer) in the three-phase grid voltage. For a grid connected inverter, these disturbances lead to several detrimental effects: the injection of unbalanced currents, the generation of double-frequency ripple in the DC-link voltage and output active power, and potential instability if not properly mitigated. Therefore, the control challenge is twofold: first, to accurately and rapidly detect or extract these non-ideal components (negative sequence and specific harmonics) from the measured grid voltage; and second, to synthesize a control law that actively compensates for their influence, forcing the inverter to output balanced, sinusoidal currents at the fundamental frequency.
This article focuses on a Neutral Point Clamped (NPC) three-level grid connected inverter, a topology favored in medium-voltage and higher-power applications for its superior voltage quality and reduced switching losses compared to two-level converters. We first establish the mathematical model of the NPC inverter under generalized grid conditions. Subsequently, a novel signal extraction method based on a Generalized Sliding Discrete Fourier Transform (GSDFT) is proposed to isolate fundamental positive-sequence, negative-sequence, and characteristic harmonic components. Finally, a dual-loop control strategy leveraging these extracted signals is designed to achieve high-performance operation under non-ideal grid voltages, validated through both simulation and experimental results.
Mathematical Modeling and Problem Analysis
NPC Three-Level Inverter Topology
The topology of a three-phase three-level NPC grid connected inverter is shown in the schematic below (excluding the LCL filter details for clarity). The DC-link is split by two capacitors (C1, C2), creating a neutral point ‘O’. Each phase leg has four active switches and two clamping diodes, enabling the output phase voltage to attain three discrete levels: +Vdc/2, 0, and -Vdc/2.

The system dynamics can be described in the stationary αβ-frame. Defining the grid voltage vector \(\mathbf{e}_{s}\), the inverter output voltage vector \(\mathbf{u}_{s}\), and the grid current vector \(\mathbf{i}_{s}\) as:
$$
\mathbf{e}_{s} = \frac{2}{3}(e_a + \alpha e_b + \alpha^2 e_c), \quad \mathbf{u}_{s} = \frac{2}{3}(u_a + \alpha u_b + \alpha^2 u_c), \quad \mathbf{i}_{s} = \frac{2}{3}(i_a + \alpha i_b + \alpha^2 i_c)
$$
where \(\alpha = e^{j2\pi/3}\), the voltage equation for the filter inductance (L) and resistance (R) is:
$$
L \frac{d\mathbf{i}_{s}}{dt} + R\mathbf{i}_{s} = \mathbf{u}_{s} – \mathbf{e}_{s} – \mathbf{u}_{oo’}
$$
Here, \(\mathbf{u}_{oo’}\) represents the voltage difference between the inverter neutral point ‘O’ and the grid neutral point ‘O”. In an ideal three-wire system with balanced voltages, this term is zero. However, under non-ideal conditions, it cannot be neglected a priori in the general analysis.
Model under Unbalanced and Distorted Grid Voltage
Under non-ideal conditions, the three-phase grid voltage can be decomposed into positive-sequence (\(e^{+}\)), negative-sequence (\(e^{-}\)), and zero-sequence (\(e^{0}\)) components at the fundamental frequency, plus harmonic components (\(e^{h}\)). For a three-wire grid connected inverter, zero-sequence current cannot flow, so the zero-sequence voltage component can often be ignored in current control analysis. The phase voltages can be expressed as:
$$
\begin{bmatrix} e_a \\ e_b \\ e_c \end{bmatrix} = \begin{bmatrix} e_a^+ \\ e_b^+ \\ e_c^+ \end{bmatrix} + \begin{bmatrix} e_a^- \\ e_b^- \\ e_c^- \end{bmatrix} + \sum_{h \neq 1}\begin{bmatrix} e_a^h \\ e_b^h \\ e_c^h \end{bmatrix}
$$
The positive and negative sequence fundamental components in the time domain are:
$$
\begin{aligned}
e_a^+ &= E_m^+ \cos(\omega t + \theta^+)\\
e_b^+ &= E_m^+ \cos(\omega t + \theta^+ – 120^\circ)\\
e_c^+ &= E_m^+ \cos(\omega t + \theta^+ + 120^\circ)\\[6pt]
e_a^- &= E_m^- \cos(\omega t + \theta^-)\\
e_b^- &= E_m^- \cos(\omega t + \theta^- + 120^\circ)\\
e_c^- &= E_m^- \cos(\omega t + \theta^- – 120^\circ)
\end{aligned}
$$
Transforming the system equations (considering only the fundamental positive and negative sequences for now) into the synchronous reference frame (dq-frame) rotating at angular speed \(\omega\) yields insightful results. The transformation for a generic variable \(x\) is given by \(x_{dq} = x_{\alpha\beta} e^{-j\omega t}\). Applying this to the voltage components:
$$
e_{dq}^+ = e_{\alpha\beta}^+ e^{-j\omega t} = E_m^+ e^{j(\theta^+)} \quad \text{(DC component)}
$$
$$
e_{dq}^- = e_{\alpha\beta}^- e^{-j\omega t} = E_m^- e^{j(2\omega t + \theta^-)} \quad \text{(Double-frequency component)}
$$
This reveals a crucial point: in the dq-frame synchronized to the positive-sequence, the fundamental positive-sequence voltage appears as a DC quantity, while the fundamental negative-sequence voltage manifests as a component oscillating at twice the fundamental frequency (2ω). Similarly, harmonic components of order h will appear as AC components at frequencies (h±1)ω in the dq-frame. The dynamic equation in the dq-frame becomes:
$$
L \frac{d\mathbf{i}_{dq}}{dt} = \mathbf{u}_{dq} – \mathbf{e}_{dq} – j\omega L \mathbf{i}_{dq} – R\mathbf{i}_{dq}
$$
where \(\mathbf{e}_{dq} = e_{dq}^+ + e_{dq}^- + \sum e_{dq}^h\). The primary control objective for the grid connected inverter under such conditions is to regulate the dq-currents to references that ensure balanced sinusoidal currents at the point of common coupling, despite the oscillatory disturbances present in \(\mathbf{e}_{dq}\).
Generalized Sliding Discrete Fourier Transform (GSDFT) for Signal Extraction
Accurate and fast extraction of the sequence components and specific harmonics is the foundation for high-performance control. The Discrete Fourier Transform (DFT) is a fundamental tool. For a periodic signal \(v(n)\) with period N, the k-th harmonic component is calculated as:
$$
V(k) = \sum_{n=0}^{N-1} v(n) e^{-j\frac{2\pi}{N}kn}
$$
The Sliding DFT (SDFT) is an efficient recursive algorithm that updates the DFT for a moving window of the most recent N samples. If \(V_m(k)\) is the DFT for the window from sample \(m-N+1\) to \(m\), then the DFT for the window from \(m-N+2\) to \(m+1\) is:
$$
V_{m+1}(k) = e^{j\frac{2\pi}{N}k} [V_{m}(k) + v(m+1) – v(m-N+1)]
$$
While computationally efficient, the standard SDFT computes (or can extract) all harmonic bins up to the Nyquist frequency. For a grid connected inverter targeting specific non-ideal components (like the negative-sequence fundamental (k=2 in a positive-sequence dq-frame rotating at 2ω for negative sequence extraction) or 5th/7th harmonics), this is redundant. The Generalized SDFT (GSDFT) modifies the underlying filter structure to target only a specific subset of harmonics, thereby improving the transient response speed.
Principle of GSDFT
The transfer function of the standard SDFT for extracting the k-th harmonic from a stream of data with window length M is derived from its recursive equation and can be expressed in the z-domain as:
$$
H_{SDFT}^k(z) = \frac{1}{M} \cdot \frac{1 – z^{-M}}{1 – e^{j\frac{2\pi}{M}k}z^{-1}}
$$
The numerator \(1 – z^{-M}\) represents a comb filter with M zeros uniformly spaced on the unit circle at frequencies \(\omega = \lambda \cdot \frac{2\pi}{M}\) for \(\lambda = 0,1,…,M-1\). The denominator places a complex pole at \(z = e^{j\frac{2\pi}{M}k}\), which cancels the zero at the frequency of the k-th harmonic, allowing that specific component to pass. The system’s response time is inherently linked to the window length M.
The key innovation of GSDFT is to replace the generic comb filter \((1 – z^{-M})\) with a tailored filter that introduces zeros only at the frequencies of the harmonics we wish to reject or separate, rather than at all integer multiples of the fundamental frequency. For a grid connected inverter in a three-phase system, the most relevant disturbances are:
- Negative-Sequence Fundamental: Extracted as a component at double grid frequency (2ω). In a suitably defined frame, this corresponds to targeting a specific harmonic index.
- Characteristic Harmonics: In voltage-source converters, the dominant low-order harmonics are often the 5th and 7th, and more generally, of orders \(6h \pm 1\) (e.g., 5th, 7th, 11th, 13th…).
Therefore, we design two specialized GSDFT filters:
- For 6h±1 Harmonics: We need a comb filter with zeros at harmonic indices that are multiples of 6, i.e., at \(z = e^{j\frac{2\pi}{M}6l}\) for integer l. This filter is given by \(1 – z^{-M/6}\) (considering its root structure). A more precise construction that captures the 6h±1 family leads to a transfer function:
$$
H_{GSDFT, 6h\pm1}^k(z) = \frac{1}{M} \cdot \frac{(1 – z^{-M/6}e^{j\frac{2\pi}{M}})(1 – z^{-M/6}e^{-j\frac{2\pi}{M}})}{1 – e^{j\frac{2\pi}{M}k}z^{-1}} = \frac{1}{M} \cdot \frac{1 – 2\cos(\frac{2\pi}{M})z^{-M/6} + z^{-M/3}}{1 – e^{j\frac{2\pi}{M}k}z^{-1}}
$$
This filter has approximately M/3 delay elements, compared to M in the standard SDFT, tripling the response speed for these harmonics.
- For the Negative-Sequence (2h) Component: We target components at even harmonic orders relative to a specific frame. The corresponding zero-placement filter is \(1 – z^{-M/2}\), leading to:
$$
H_{GSDFT, 2h}^k(z) = \frac{1}{M} \cdot \frac{1 – z^{-M/2}}{1 – e^{j\frac{2\pi}{M}k}z^{-1}}
$$
This filter has M/2 delay elements, doubling the response speed compared to the standard SDFT for extracting the negative-sequence component.
The following table summarizes the key differences between SDFT and the proposed GSDFT variants:
| Algorithm | Target Components | Zero-Placement Filter | Approx. Delay | Relative Speed |
|---|---|---|---|---|
| Standard SDFT | Any harmonic k | \(1 – z^{-M}\) | M samples | 1x (Baseline) |
| GSDFT (6h±1) | 5th, 7th, 11th, 13th,… | \(1 – 2\cos(\frac{2\pi}{M})z^{-M/6} + z^{-M/3}\) | M/3 samples | ~3x Faster |
| GSDFT (2h) | Negative-Sequence Fundamental | \(1 – z^{-M/2}\) | M/2 samples | ~2x Faster |
Implementation for Grid Synchronization and Decomposition
For a grid connected inverter, the GSDFT is applied as part of a enhanced phase-locked loop (PLL) or signal decomposition block. The process is as follows:
- Positive-Sequence Fundamental Extraction: The three-phase grid voltages (\(e_{abc}\)) are transformed to the αβ-frame. A GSDFT tuned to the fundamental positive-sequence frequency (or a standard PLL using the GSDFT-filtered signal) is used to extract the magnitude and phase angle (\(\theta^+\)) of \(e_{\alpha\beta}^+\). This provides a clean synchronization signal even in the presence of unbalance and harmonics.
- Negative-Sequence and Harmonic Extraction: Using the phase angle \(\theta^+\), the measured grid voltage is transformed into the positive-sequence synchronous dq-frame (\(e_{dq}\)). In this frame:
- The fundamental negative-sequence component appears as a 2ω oscillation.
- The 5th harmonic appears as a -6ω oscillation (or +6ω depending on sequence).
- The 7th harmonic appears as a +6ω oscillation.
Multiple parallel GSDFT filters, each tuned to a specific oscillation frequency (e.g., 2ω, 6ω), can then extract the magnitude and phase of these individual disturbance components from \(e_{dq}\). The GSDFT’s faster response allows for quicker adaptation to sudden grid changes.
The extracted components (\(e_{dq}^+\), \(e_{dq}^-\), \(e_{dq}^{h5}\), \(e_{dq}^{h7}\)) form the basis for the advanced current controller of the grid connected inverter.
Dual-Loop Control Strategy for the NPC Grid Connected Inverter
With accurate real-time information about the grid voltage components, a control strategy can be designed to achieve specific objectives. A common objective is to inject balanced sinusoidal currents despite an unbalanced and distorted grid, thereby eliminating negative-sequence current and preventing double-frequency power pulsation at the inverter terminals.
Current Reference Generation
The instantaneous active (\(p\)) and reactive (\(q\)) power delivered to the grid by the grid connected inverter in the αβ-frame is given by:
$$
\begin{bmatrix} p \\ q \end{bmatrix} = \begin{bmatrix} e_\alpha & e_\beta \\ e_\beta & -e_\alpha \end{bmatrix} \begin{bmatrix} i_\alpha \\ i_\beta \end{bmatrix}
$$
If the grid voltage contains both positive and negative sequences (\(e = e^+ + e^-\)) and we force the injected current to contain only the positive sequence (\(i = i^+\)), the instantaneous power becomes:
$$
p = e_\alpha^+ i_\alpha^+ + e_\beta^+ i_\beta^+ + \underbrace{(e_\alpha^- i_\alpha^+ + e_\beta^- i_\beta^+)}_{p_{2\omega}}, \quad q = e_\beta^+ i_\alpha^+ – e_\alpha^+ i_\beta^+ + \underbrace{(e_\beta^- i_\alpha^+ – e_\alpha^- i_\beta^+)}_{q_{2\omega}}
$$
Even with balanced currents, the power contains a double-frequency (2ω) ripple term (\(p_{2\omega}, q_{2\omega}\)) due to the interaction between the negative-sequence voltage and the positive-sequence current. To achieve constant instantaneous power (a common objective to avoid DC-link voltage ripple), the current references must be calculated accordingly. However, a more standard and grid-code compliant objective is simply to inject balanced, sinusoidal currents at unity power factor relative to the positive-sequence voltage. This eliminates negative-sequence current injection, which is often a grid requirement.
The reference currents in the αβ-frame for this objective are:
$$
\begin{bmatrix} i_{\alpha}^* \\ i_{\beta}^* \end{bmatrix} = \frac{P^*}{(e_{\alpha}^+)^2 + (e_{\beta}^+)^2} \begin{bmatrix} e_{\alpha}^+ \\ e_{\beta}^+ \end{bmatrix}
$$
where \(P^*\) is the desired active power setpoint (from a DC-link voltage regulator or a power dispatch command), and \(e_{\alpha\beta}^+\) is the extracted positive-sequence fundamental voltage from the GSDFT block. Transforming these references to the dq-frame synchronized with \(e^+\) yields constant DC references: \(i_d^* = \sqrt{2}P^*/E_m^+\), \(i_q^* = 0\).
Current Controller Design
The core current control loop for the grid connected inverter is implemented in the positive-sequence dq-frame. The plant model from the inverter voltage \(u_{dq}\) to the grid current \(i_{dq}\) is:
$$
G_p(s) = \frac{1}{Ls + R}
$$
A standard PI controller is designed to regulate the d and q currents to their references. However, the presence of the extracted disturbance voltages (\(e_{dq}^-\), \(e_{dq}^{h}\)) can be actively compensated for via feedforward terms to improve performance. The final control voltage command is:
$$
u_{dq}^* = \underbrace{\left(K_p + \frac{K_i}{s}\right)(i_{dq}^* – i_{dq})}_{\text{PI Output}} + \underbrace{j\omega L i_{dq}}_{\text{Decoupling}} + \underbrace{\hat{e}_{dq}^+ + \hat{e}_{dq}^- + \sum \hat{e}_{dq}^h}_{\text{Full Grid Voltage Feedforward}}
$$
Where \(\hat{e}_{dq}^+\) is the estimated positive-sequence voltage (a DC value), and \(\hat{e}_{dq}^-, \hat{e}_{dq}^h\) are the estimated disturbance components extracted by the GSDFT blocks. This full feedforward effectively linearizes the plant and rejects the oscillatory disturbances, allowing the PI controller to focus on tracking errors and unmodeled dynamics.
The outer control loop typically regulates the DC-link voltage to a constant value by adjusting the active power reference \(P^*\). For an NPC grid connected inverter, an additional control loop is required to balance the voltages of the two DC-link capacitors (\(C_1\) and \(C_2\)) by manipulating the neutral point current. This is often achieved by injecting a specific common-mode voltage into the modulation signals.
The overall block diagram of the proposed control system for the NPC grid connected inverter is summarized below:
| Module | Function | Key Algorithms/Components |
|---|---|---|
| Signal Extraction & PLL | Extracts \(e^+\), \(e^-\), \(e^{h5}\), \(e^{h7}\) from \(e_{abc}\). Provides phase angle \(\theta^+\). | GSDFT filters for 2ω (negative-seq) and 6ω (5th/7th harmonics). |
| Reference Generator | Calculates balanced positive-sequence current references \(i_{dq}^*\). | Uses \(P^*\) (from outer loop) and \(e_{\alpha\beta}^+\). |
| Current Controller | Generates voltage command \(u_{dq}^*\) to track \(i_{dq}^*\). | PI Regulator, Decoupling, Full Voltage Feedforward. |
| Modulation & Balancing | Generates switching signals for NPC inverter. Balances DC-link capacitor voltages. | Space Vector Modulation (SVM) or PWM with neutral point control. |
| Outer Loop | Regulates DC-link voltage to setpoint. | PI Controller producing \(P^*\). |
Simulation and Experimental Verification
To validate the proposed GSDFT-based control strategy for the NPC grid connected inverter, comprehensive simulations and hardware-in-the-loop or prototype experiments are conducted.
GSDFT Extraction Performance
Case 1: Harmonic Extraction. A three-phase grid voltage with superimposed 5th harmonic on phase A and 7th harmonic on phase B is applied. The standard SDFT and the proposed GSDFT (for 6h±1) are used to extract these harmonics. The GSDFT demonstrates a settling time approximately one-third of the SDFT’s window length, confirming its faster dynamic response. The extracted harmonic waveforms are clean and accurately track the injected disturbances.
Case 2: Negative-Sequence Extraction during Voltage Sag. A 30% voltage sag is applied to phase A. The GSDFT (for 2h) rapidly extracts the resulting negative-sequence component in the dq-frame. The response time is approximately half that of a standard SDFT-based extractor, allowing the current controller to react more swiftly to the grid fault.
Closed-Loop Inverter Performance
An experimental setup is built using a scaled-down NPC three-level inverter prototype. The controller is implemented on a digital signal processor (e.g., TMS320F28335). The grid is emulated using a programmable AC source capable of generating unbalanced and distorted voltages.
Test Scenario: The grid voltage is set with phase A having a 20% voltage drop and containing 5% 5th harmonic. The grid connected inverter is commanded to deliver a fixed amount of active power at unity power factor.
Results:
- Without Advanced Compensation: Using a conventional SRF-PLL and PI controller without negative-sequence/harmonic feedforward, the injected grid currents become unbalanced and distorted, with a high Total Harmonic Distortion (THD). Significant 2ω ripple is observed in the active power.
- With Proposed GSDFT-Based Control: The three-phase grid currents remain balanced and nearly sinusoidal. The current THD is significantly reduced, well below 5% as required by standards like IEEE 1547. The active power flow is smooth with minimal low-frequency ripple. The DC-link capacitor voltages remain balanced.
The experimental waveforms clearly demonstrate the effectiveness of the combined GSDFT extraction and feedforward compensation strategy in enabling a grid connected inverter to operate reliably and provide high-quality power injection under severe non-ideal grid conditions.
Conclusion
The transition towards power-electronics-dominated grids makes robust control of grid connected inverters under non-ideal conditions an essential research and engineering topic. This article has presented a comprehensive solution centered on a Generalized Sliding DFT algorithm and a dual-loop control strategy for an NPC three-level inverter.
The proposed GSDFT algorithm offers a significant advantage over conventional methods by tailoring its frequency response to target only the specific disturbance components relevant to three-phase systems—namely, the negative-sequence fundamental and the characteristic 6h±1 harmonics. This specialization results in a markedly faster dynamic response, enabling quicker adaptation to grid transients such as voltage sags, swells, or the onset of harmonic distortion.
By integrating the rapidly extracted grid voltage components into the control law through precise feedforward compensation, the current controller of the grid connected inverter is able to achieve its primary objective: injecting balanced, low-THD currents despite an unbalanced and distorted grid voltage. The outer DC-link voltage loop ensures stable power transfer from the DC source (e.g., solar PV, battery).
The methodology is general and can be adapted to other multilevel inverter topologies and grid conditions. Future work may explore the integration of this strategy with fault-ride-through capabilities and the coordination of multiple inverters in a microgrid to collectively improve power quality at the point of common coupling.
