Improved PI + Repetitive Control for Harmonic Suppression in Solar Inverters

In the context of the global transition toward renewable energy, the installed capacity of grid-connected photovoltaic systems has expanded rapidly. Solar inverters, as the core power electronic interface between photovoltaic arrays and the utility grid, are now widely deployed in distribution networks. However, the massive integration of power electronic devices, together with the increasing use of nonlinear loads, has introduced severe harmonic pollution into the distribution grid. If harmonic currents excite resonances, the safety of electricity users can be seriously threatened. Passive filters are an economical solution for mitigating specific harmonics, but they are effective only for fixed frequencies and cannot adapt to changing harmonic conditions. Active power filters (APFs) can provide dynamic compensation with high accuracy, but their cost is significantly higher. Interestingly, solar inverters and APFs share a remarkably similar hardware topology, consisting of a three-phase bridge, output filters, and control units. This structural similarity opens the door to developing multifunctional solar inverters that not only deliver photovoltaic power to the grid but also operate as harmonic compensators during periods when the photovoltaic system has spare capacity. Since solar inverters typically operate in a “sleeping state” for a large portion of the year — often generating power for less than 2,000 hours annually — they can be fully utilized for harmonic suppression without affecting normal photovoltaic generation.

In this work, I present a harmonic suppression control strategy for a solar inverter based on an improved proportional-integral (PI) plus repetitive control scheme. My objective is to enable the solar inverter to output fundamental active power through a PI controller while simultaneously generating high-precision harmonic compensation currents through a repetitive controller. Because the standard repetitive controller inherently introduces one fundamental cycle delay, which degrades the dynamic response, I incorporate a harmonic component feedforward path to accelerate the transient tracking of harmonic reference signals. The proposed method is validated by simulation, showing that it can achieve multiple harmonic suppression with modest computational burden while preserving both steady-state accuracy and dynamic swiftness of the solar inverter.

Introduction and Problem Statement

The proliferation of nonlinear loads such as diode rectifiers, variable-speed drives, and switched-mode power supplies has made harmonic distortion a dominant power quality problem in modern distribution systems. Harmonics not only increase losses and reduce the efficiency of transformers and cables, but also cause malfunction of sensitive equipment, overheating of capacitors, and interference with communication systems. In severe cases, harmonics may trigger parallel or series resonances that amplify voltage and current distortion, potentially leading to equipment failure and blackouts. Traditional solutions include installing passive filters at the point of common coupling (PCC). Passive filters are inexpensive and robust, but their compensation characteristics are fixed by the tuned frequency, and they may even cause adverse resonances with the source impedance. Active power filters offer superior performance because they can dynamically track and compensate for varying harmonic components. Nevertheless, the high initial cost of dedicated APF units limits their wide deployment, especially in medium- and low-voltage distribution networks.

Given that a solar inverter comprises the same basic components as an APF — an inverter bridge, DC-link capacitor, output filter inductor, and digital controller — it is natural to combine the two functions in a single device. A multifunctional solar inverter can operate as a power generator during sunshine hours and as an active harmonic compensator during idle periods. This concept is economically attractive because it leverages the existing hardware of the solar inverter without substantial additional investment. However, using a solar inverter for harmonic suppression imposes stringent requirements on the control algorithm. The controller must accurately track the phase and amplitude of multiple harmonic currents, respond quickly to load changes, and at the same time maintain stable photovoltaic power injection. If the control bandwidth is insufficient, the harmonic compensation will be imprecise, and the solar inverter may even inject additional distortion.

Several control approaches have been proposed in the literature to address these challenges. In a conventional dq synchronous reference frame, a simple PI controller cannot achieve zero steady-state error for harmonic signals because the harmonics are AC quantities with frequencies multiple times the fundamental frequency. To overcome this limitation, multiple synchronous rotating frames (MSRF) have been suggested, where each selected harmonic is transformed into a separate rotating coordinate system and controlled by its own PI regulator. Although this approach offers good selectivity, it requires multiple coordinate transformations and multiple PI regulators, which substantially increases the computational load. Furthermore, if the number of harmonics to be compensated is large, the algorithm becomes too complex for practical implementation in real-time digital controllers. Another method employs fast Fourier transform (FFT) to extract the harmonic amplitudes and then applies PI control in each harmonic frame; however, FFT requires a moving window and introduces latency, which impairs dynamic performance.

To mitigate the multi-frequency tracking problem while keeping computational cost low, repetitive control (RC) has been introduced as an internal model principle-based method. A repetitive controller can track any periodic signal whose period is an integer multiple of the fundamental period, provided that the internal model is embedded in the closed-loop. Thus, a single repetitive controller can simultaneously compensate for all harmonics within the controller bandwidth, without the need for separate harmonic extraction or multiple rotating frames. Many researchers have combined repetitive control with a PI controller to achieve fast tracking of the fundamental component and accurate tracking of harmonic components. The PI part handles the fundamental active/reactive power control, while the repetitive part suppresses periodic disturbances. However, the conventional repetitive controller has an inherent one-cycle delay: any error appearing in the current cycle only affects the control output in the next cycle. This delay leads to a sluggish dynamic response, especially when the load steps or when the harmonic reference changes abruptly.

In my research, I aim to solve this dynamic response deficiency by injecting the harmonic reference current as a feedforward signal into the repetitive control path. The feedforward path uses the extracted harmonic current components and a zero-phase-error compensation technique to provide an immediate control action that counteracts the harmonic disturbance before the repetitive controller gradually builds up its output. The combined structure thus enjoys the high steady-state precision typical of repetitive control and the immediate response typical of feedforward control.

Mathematical Model of the LCL-Type Solar Inverter

The main circuit topology of the grid-connected solar inverter considered in this study is shown schematically in the following model. The inverter bridge is connected to the grid through an LCL filter, comprising the inverter-side inductor L1, the filter capacitor C, and the grid-side inductor L2. The parasitic resistances of these components are denoted as R1, RC, and R2, respectively. In most practical designs, R1 and R2 are small and can be neglected for the purpose of control design. The DC-link of the solar inverter is connected to the photovoltaic array, and the DC voltage is maintained by a maximum power point tracking (MPPT) controller.

When the parasitic resistances are ignored, the transfer function from the inverter bridge output voltage Ua to the grid-side current i2 can be derived as:

$$G(s) = \frac{R_C C s + 1}{L_1 L_2 C s^3 + (L_1 + L_2) R_C C s^2 + (L_1 + L_2) s}.$$

This transfer function exhibits a resonance peak at a frequency determined by the LCL parameters. The resonance frequency is approximately:

$$\omega_0 = \sqrt{\frac{L_1 + L_2}{L_1 L_2 C}}.$$

For the LCL filter, the high-frequency attenuation is -60 dB/decade, which is beneficial for switching ripple suppression. However, the resonance peak at ω0 may cause instability if the controller has significant gain at that frequency. Therefore, any high-performance controller for the solar inverter must include proper damping or active/ passive damping measures.

In my design, the parameters of the solar inverter are selected as follows:

Parameter Symbol Value
Inverter-side inductor L1 0.74 mH
Filter capacitor C 6.6 μF
Grid-side inductor L2 55 μH
Capacitor parasitic resistance RC 0.5 Ω
Resonance frequency f0 8.66 kHz
Switching / sampling frequency fs 20 kHz

The resonance frequency f0 = ω0/(2π) ≈ 8.66 kHz. Since the sampling frequency is 20 kHz, the Nyquist frequency is 10 kHz, so the resonance peak lies inside the controllable region. To avoid exciting the resonance, the repetitive controller must be equipped with a notch filter tuned exactly at ω0.

Design of the Repetitive Controller for the Solar Inverter

In the discrete-time domain, the internal model of a repetitive controller is represented as:

$$G_R(z) = \frac{1}{1 – Q(z) z^{-N}},$$

where N is the number of sampling instants per fundamental period, and Q(z) is a low-pass filter or a constant slightly less than unity to improve robustness. In my design, I set Q(z) = 0.95, which is a common choice that reduces the internal model gain while ensuring stability. The periodic signal generator produces infinite gain at all frequencies that are integer multiples of the fundamental frequency. For example, with a fundamental frequency of 50 Hz and a sampling frequency of 20 kHz, the number of samples per period is N = 400. The Bode plot of the internal model shows a gain of approximately 26 dB at the fundamental and harmonic frequencies, which guarantees zero steady-state error for these components.

However, the plant transfer function G(s) of the LCL filter is not a simple plant that can be directly compensated by the repetitive controller. At low frequencies, the LCL filter behaves like an integrator, which results in a phase lag of -90°. At the resonance frequency, the gain dramatically peaks, causing a risk of instability. At high frequencies, although the gain rolls off, the phase response is nonlinear and can lead to limited stability margins. Therefore, a compensator S(z) must be designed to shape the loop gain so that the compensated plant S(z)G(z) has a uniform gain and zero phase shift for all frequencies below the desired control bandwidth. Only in this way can the repetitive controller provide accurate tracking of multiple harmonics.

I design the compensator as a combination of three elements: a derivative-like gain to compensate for the low-frequency integrator slope, a notch filter to suppress the resonance peak, and a second-order low-pass filter to attenuate high-frequency noise and switching harmonics. The continuous-time compensator is written as:

$$D(s) = \frac{L_1 s}{\tau s + 1},$$

where τ = 1/ω0 is chosen to provide roughly an inverse of the integrator within the control bandwidth. The derivative action in D(s) is approximate because an ideal differentiator is not realizable. The time constant τ limits the differentiation to frequencies below ω0, thereby preventing amplification of noise at high frequencies.

The notch filter is intended to remove the resonance peak of the LCL filter. Its transfer function is:

$$F_n(s) = \frac{s^2 + \omega_0^2}{s^2 + 2 \xi \omega_0 s + \omega_0^2},$$

where the damping ratio ξ is set to 0.707. This notch filter introduces a very narrow dip at ω0, leaving the low-frequency and high-frequency gains nearly unaffected. It effectively cancels the resonance without adding significant power losses, unlike passive damping resistors.

After the notch filter, the high-frequency gain still remains at a level that may jeopardize stability if the loop gain is too high. Hence, I add a second-order low-pass filter:

$$F_2(s) = \frac{\omega_0^2}{s^2 + 2 \xi \omega_0 s + \omega_0^2}.$$

This low-pass filter provides an additional -40 dB/decade roll-off beyond ω0, effectively suppressing high-frequency components. The damping ratio of this filter is again ξ = 0.707, which yields a Butterworth response with a maximally flat passband.

Combining these three continuous-time blocks and then mapping them to the discrete domain yields the compensator:

$$S(z) = D(z) F_n(z) F_2(z) z^k,$$

where the term zk is a k-step lead compensator used to compensate for the phase lag introduced by the derivative and low-pass filters. In the discrete-time implementation, the non-causal part zk cannot be realized directly in the compensation path, but it can be combined with the N-step delay in the repetitive control loop. In particular, the delay z-N is split into z-(N-k) and z-k, and the k-step lead is moved to the compensator block so that the overall structure remains causal.

After applying the designed compensator, the corrected plant frequency response S(z)G(z) exhibits a magnitude close to 0 dB and a phase close to 0° for frequencies below approximately 1 kHz. This ensures that the solar inverter can accurately track harmonic currents up to the 20th harmonic (1000 Hz) with minimal amplitude and phase errors. The Bode plot of the corrected plant shows a uniform gain in the low-frequency region, a deep notch at the resonance frequency, and strong attenuation above the notch. Therefore, the repetitive controller can be designed with a relatively high gain while preserving stability.

Improved Combined Control Structure

Although repetitive control provides excellent steady-state performance for periodic signals, its dynamic response is inherently slow because of the one-cycle internal model. When the harmonic reference changes due to a load step, the repetitive controller output cannot be updated until the next cycle. During the first cycle after the disturbance, the control action is solely determined by the other components of the controller. If the only other component is a conventional PI controller tuned for the fundamental frequency, the solar inverter will not be able to track the harmonic reference promptly. As a result, the grid current will contain significant harmonic errors for several cycles until the repetitive controller gradually adjusts its output.

To accelerate the dynamic response without sacrificing steady-state accuracy, I propose an improved PI + repetitive control structure that incorporates a feedforward path for the detected harmonic current components. The overall current control block diagram is shown conceptually below. The plant is the LCL-filtered solar inverter. The error between the measured grid current and the reference current is fed into a PI controller operating in the synchronous dq frame and into a repetitive controller. The PI controller provides immediate correction at the fundamental frequency. The repetitive controller provides accurate tracking of all harmonic frequencies. In parallel, the harmonic reference current is directly multiplied by a feedforward gain and injected into the control output. This feedforward signal bypasses the one-cycle delay of the repetitive controller, enabling the solar inverter to respond almost immediately to changes in harmonic load conditions.

The discrete-time transfer function of the original PI + repetitive control scheme can be expressed as:

$$C(s) = k_p + \frac{k_i}{s} + \frac{1}{1 – 0.95 e^{-T s}},$$

where T is the fundamental period. The term e-Ts represents the one-cycle delay. The PI part dominates during transients, while the repetitive part dominates at steady state. However, the PI part cannot track harmonic components with zero steady-state error; therefore, during the first cycle after a harmonic load step, the control error remains large.

In my improved structure, the harmonic current reference ih* is extracted using the instantaneous reactive power theory (p-q method). The extracted harmonic components are then processed by a zero-phase-error phase compensation network before being fed forward. The feedforward path is inserted between the amplitude-compensation part and the phase-lead part of the repetitive compensator. This arrangement allows the feedforward signal to benefit from the high-frequency attenuation filters while still being phase-corrected by the lead term.

Zero-Phase-Error Feedforward Compensation

The compensator S(z) includes a k-step lead component zk. This lead component is non-causal, but it can be realized by using a rotation transformation in the synchronous frame. For harmonic components, a phase advance in the time domain corresponds to an angle advance in the rotating frame at the corresponding harmonic frequency. Specifically, for the h-th harmonic, a time advance of k sampling periods corresponds to a phase angle of

$$\theta_k = 2 \pi k h f_0 / f_s,$$

where f0 is the fundamental frequency, fs is the sampling frequency, and h is the harmonic order. Since the harmonic reference signal contains multiple harmonics, the phase angle varies with harmonic order. To achieve zero-phase tracking for all harmonics simultaneously, I use multiple synchronous rotating frames or a transformed coordinate system where the compensation angle is applied. A simpler approach is to use the phase-locked-loop angle θ obtained from the grid voltage. The harmonic current components in the stationary αβ frame are transformed into a rotating frame using θ. Then, to apply the lead compensation, I rotate the angle by an additional θk that is chosen based on the dominant harmonic frequency. For a typical compensation of low-order harmonics up to the 19th, the phase error introduced by the low-pass filters is approximately linear with frequency, so a fixed lead angle θk = 2πk f0/fs multiplied by the harmonic order h can be used.

In practice, I implement the zero-phase-error feedforward as follows. The three-phase harmonic currents measured in the abc frame are transformed into the dq frame using the non-compensated angle θ. Then I add the compensation angle θk to θ and perform a second transformation to produce a lead-compensated dq harmonic current. Mathematically, if the harmonic current vector in the stationary frame is iαβ, then the lead-compensated harmonic current in the dq frame is:

$$\mathbf{i}_{h,dq}^{lead} = R(-\theta – \theta_k) \mathbf{i}_{\alpha\beta},$$

where R(·) is the rotation matrix. Alternatively, one can use the inverse transformation to obtain the compensated signal directly in the dq frame. This method provides an approximate zero-phase error over a range of harmonics because the phase lag of the filters is roughly proportional to frequency.

The feedforward path can be expressed as a transfer function Ff(z) that includes a gain Kf and the phase-lead operator:

$$F_f(z) = K_f z^k S'(z),$$

where S'(z) = D(z)F_n(z)F_2(z) represents the amplitude compensation without the lead part. The lead part is already realized via the rotation transformation. In my implementation, I set K_f to a value between 0.8 and 1.2. A unity feedforward gain would exactly inject the harmonic reference into the output voltage command, thereby forcing the inverter to produce the required harmonic current almost instantaneously. However, due to model uncertainties and sampling delays, a slightly lower gain may be more robust.

With the feedforward path, the closed-loop error transfer function during the transient period is approximately:

$$\frac{E(z)}{I_h^*(z)} = \frac{1 – F_f(z) G(z)}{1 + [C_{PI}(z) + C_R(z)] G(z)}.$$

If F_f(z) is chosen such that F_f(z)G(z) ≈ 1 for the harmonics of interest, the numerator approaches zero and the error is drastically reduced even before the repetitive controller output accumulates. This is exactly the desired behavior.

Simulation Model and System Parameters

To evaluate the effectiveness of the proposed control strategy, I built a detailed simulation model in Matlab/Simulink. The simulation includes a photovoltaic array, a DC-DC boost converter with MPPT, a three-phase two-level solar inverter with an LCL filter, and a grid network. The grid is modeled as an ideal voltage source with a line impedance of 0.5 Ω resistance and 2 mH inductance. The grid phase-to-neutral RMS voltage is 220 V at 50 Hz. The nonlinear load is a three-phase diode rectifier feeding a 30 Ω resistor in parallel with a 2 mH inductor, while a linear load of 5 Ω three-phase resistance is also connected. The photovoltaic array is rated at 8 kW under standard test conditions.

I compare three control schemes:

  • Type I: conventional PI controller in the dq frame (fundamental only, no harmonic compensation).
  • Type II: PI + repetitive control without the harmonic feedforward path.
  • Type III: proposed improved PI + repetitive control with harmonic feedforward.

All three schemes are implemented with the same MPPT and DC-link voltage controllers to ensure a fair comparison. The sampling frequency and switching frequency are both 20 kHz. The current controllers run at the same rate. The reference currents for the harmonic suppression are obtained using the p-q theory-based instantaneous reactive power calculation, as described in the literature. The harmonic reference is taken as the difference between the measured load current and its fundamental positive-sequence component. For the Type II and Type III controllers, the repetitive controller is activated only after 0.3 s, while the nonlinear load is switched in at 0.2 s. The MPPT operates continuously from the start.

The simulation sequence is as follows:

  1. 0–0.2 s: linear load only; the solar inverter operates in grid-connected mode, injecting rated power.
  2. 0.2 s: the nonlinear load is connected, causing harmonic currents to flow from the grid.
  3. 0.3 s: the harmonic suppression control is enabled. For Type I, the controller remains unchanged; for Type II and Type III, the repetitive controller and (for Type III) the feedforward path are activated simultaneously.

I monitor the grid-side current waveform, the dq-axis current errors, and the harmonic spectra at selected time instants.

Simulation Results and Discussion

Grid Current Waveforms

The A-phase grid current waveforms for the three types of controllers are shown in the following set of curves (not reproduced in detail here). In the period immediately after the harmonic compensation is enabled (0.3 s to 0.32 s, i.e., the first fundamental cycle), I observe that the Type I controller, which relies solely on the PI regulator, cannot follow the sharp pulsed waveform of the nonlinear load current. The grid current still contains significant notches and flat spots around the zero crossings, indicating that the harmonic components are not compensated. The Type II controller with PI + repetitive control also shows a noticeable lag during this first cycle: when the load current pulse appears, the inverter output current does not change quickly enough, because the repetitive controller has not yet produced its steady-state output. In contrast, the Type III controller with the feedforward path responds almost immediately. The harmonic reference current is directly injected, causing the inverter to output the required harmonic compensation current concurrently with the load pulse. Consequently, the grid current in the Type III case becomes much closer to a pure sinusoid already in the first cycle after compensation is enabled.

After three fundamental cycles (0.32 s), the repetitive controllers in both Type II and Type III have built up their output, and their grid current waveforms become very similar. This confirms that the feedforward path mainly improves the transient phase without affecting the steady-state accuracy. The Type I controller never reaches the same level of harmonic suppression, and its current waveform remains highly distorted.

DQ-Axis Current Error Analysis

To quantify the dynamic performance, I recorded the d-axis and q-axis current errors (reference minus measured) for the three controllers. The d-axis current reference is primarily determined by the MPPT output, while the q-axis current reference is set to zero to achieve unity power factor, except for the harmonic compensation which appears as oscillatory components in both axes.

Immediately after the harmonic control is enabled (t = 0.3 s), the d-axis current error of the Type III controller reaches a peak of approximately 19.5 A, but it decays to near zero within 2 ms. In contrast, the Type I and Type II controllers show larger and more persistent errors during the first few milliseconds. Because the d-axis harmonic content is relatively small for this particular load, the steady-state d-axis errors of all three controllers are comparable. However, the peak transient error is markedly reduced in Type III.

The q-axis current error is a more revealing indicator of harmonic tracking. During the first fundamental cycle after activation, the q-axis error of Type III rises to about 4.525 A and then quickly reduces, oscillating within a band of [-1.557 A, 4.525 A]. For Type I and Type II, the q-axis error initially reaches 5.621 A and oscillates within a wider band of [-0.366 A, 5.915 A]. This indicates that the feedforward path not only reduces the peak error but also narrows the instantaneous error range during the transient.

At steady state, the q-axis current error of Type I is approximately [-0.706 A, 4.167 A], while Type II improves to [-0.642 A, 1.27 A], and Type III achieves [-0.42 A, 1.186 A]. The improved controller thus also yields a modest enhancement in steady-state accuracy due to the slightly better phase alignment provided by the feedforward compensation. The repetitive controller remains the primary mechanism for zero-error tracking, but the feedforward loop helps by reducing the nonlinear interaction between the fundamental PI loop and the harmonic loop.

The following table summarizes the q-axis current error ranges for the three control types:

Control Type First-cycle peak error (A) First-cycle error range (A) Steady-state error range (A)
Type I (PI only) 5.621 [-0.366, 5.915] [-0.706, 4.167]
Type II (PI + RC) 5.621 [-0.366, 5.915] [-0.642, 1.270]
Type III (Improved PI + RC) 4.525 [-1.557, 4.525] [-0.420, 1.186]

Harmonic Spectrum Analysis

To evaluate the harmonic suppression capability quantitatively, I performed FFT analysis on the grid-side current at three time instants: the first cycle after compensation (0.3–0.32 s), the second cycle (0.32–0.34 s), and the tenth cycle (0.5–0.52 s). The main harmonic orders of interest are 5, 7, 11, 13, 17, and 19, which are the characteristic harmonics of a three-phase diode rectifier.

At the first cycle, the Type III controller shows a substantial reduction in all selected harmonics compared to Type I and Type II. For example, the 5th harmonic content in Type III is approximately one-third of that in Type I. The 7th harmonic is also reduced by more than half. The Type II controller exhibits only a slight reduction in the first cycle because the repetitive controller has not yet accumulated its output; the PI controller does not have sufficient gain at these frequencies. This demonstrates the advantage of the feedforward path for fast initial response.

At the second cycle, the Type II controller begins to show noticeable harmonic reduction, but it still lags behind Type III. By the tenth cycle, both Type II and Type III reach similar harmonic compensation levels, with THD values around 1.6–1.7%, while Type I remains at about 3.6%. The overall THD before compensation is 10.8%. After steady-state compensation, the THD values are:

Control Type THD before compensation THD after compensation (steady state)
Type I 10.8% 3.61%
Type II 10.8% 1.61%
Type III 10.8% 1.71%

The slight difference between Type II and Type III in steady-state THD (1.61% vs 1.71%) is within the numerical tolerance of the simulation and can be attributed to the specific tuning of the feedforward gain. In general, the steady-state performance is dominated by the repetitive controller, and the feedforward path does not degrade it.

Discussion on the Role of the Solar Inverter Capacity

One important practical consideration is that the harmonic suppression function must not compromise the photovoltaic power generation. The solar inverter has a finite current rating; therefore, when the photovoltaic output is high, the available capacity for harmonic compensation is limited. In my simulation, the solar inverter is rated at 8 kW, and the grid voltage is 220 V RMS (line-to-neutral). The maximum output current is approximately 12.1 A RMS per phase. During the harmonic compensation, the inverter current is the sum of the fundamental active current and the harmonic compensation current. If the load harmonics demand a high peak current, the inverter may enter over-modulation or current limiting. In practice, the controller should include a prioritization algorithm that first delivers the photovoltaic active power and then feeds the available remaining capacity to harmonic compensation. In severe cases, the harmonic compensation gain may be reduced to avoid overcurrent.

My proposed feedforward path is particularly useful in this context because it provides fast harmonic suppression even when the available capacity is limited. By quickly shaping the inverter output current to cancel the load harmonics, the grid current distortion is minimized within the first cycle, reducing the voltage distortion at the PCC and preventing potential resonance excitation.

Further Improvements and Robustness Considerations

While the improved PI + repetitive control with harmonic feedforward performs well in simulations, there are several aspects that can be further optimized. The design of the compensator S(z) relies on accurate knowledge of the LCL filter parameters, especially the resonance frequency. In a real solar inverter, the filter components may vary with temperature, aging, and manufacturing tolerance. If the resonance frequency shifts slightly, the notch filter may not fully suppress the resonance, leading to potential instability. To mitigate this, a more robust approach would be to use an adaptive notch filter that tracks the resonance frequency online, or to use an active damping method based on capacitor current feedback. However, adding active damping increases the number of sensors and the computational burden.

The zero-phase-error feedforward compensation also depends on the phase angle θk. In my implementation, I used a fixed lead angle based on the dominant harmonic. If the harmonic spectrum is broad and the phase lag of the filters is not perfectly linear, the fixed-angle compensation may not achieve ideal zero-phase for all harmonics. An alternative is to design a digital all-pass filter that approximates the inverse phase response of S'(z) over the frequency range of interest. This would provide a more accurate phase correction without increasing the number of rotating frames. However, the all-pass filter design is more complex, and the additional computational cost may not be justified in many applications.

Another consideration is the stability of the repetitive control in the presence of grid impedance variations. The grid impedance at the PCC affects the damping of the LCL filter and can shift the effective resonance frequency. In weak grid conditions, the grid impedance may be inductive and vary over a wide range. To ensure stability, the repetitive controller gain can be reduced, or a more conservative Q(z) filter can be used. The feedforward path does not affect stability as much because it is a open-loop compensation that does not modify the feedback loop dynamics.

For the practical implementation of the solar inverter harmonic suppression, the control algorithm must also handle grid frequency deviations. The repetitive controller with a fixed N = f_s/f_0 requires an integer number of samples per period. If the grid frequency deviates from 50 Hz, N must be updated continuously using the phase-locked loop frequency. A fractional-order repetitive controller can be used to handle non-integer N, but this adds complexity. In most grid-connected solar inverters, the grid frequency is maintained within a narrow range, so a fixed N with periodic updates is sufficient.

Comparison with Existing Methods

To contextualize my contributions, I compare the proposed method with two other approaches: multiple synchronous rotating frames (MSRF) with PI control, and conventional PI + repetitive control without feedforward.

The MSRF method requires one rotating frame for each harmonic to be compensated. For six harmonics (5, 7, 11, 13, 17, 19), this requires six additional PI controllers plus the fundamental frame controller. Each harmonic frame needs low-pass filters for harmonic extraction, leading to a significant computational burden and multiple tuning parameters. Moreover, the dynamic response of MSRF depends on the bandwidth of the low-pass filters in each frame; if the filters are too slow, the response is sluggish. The repetitive controller, by contrast, automatically tracks all harmonics within its bandwidth with a single control block, substantially simplifying the control architecture.

The conventional PI + repetitive control is already a good compromise, but it suffers from the one-cycle delay. My feedforward path eliminates this disadvantage by providing an instantaneous compensation signal. From a practical standpoint, the feedforward path requires only a few additional multiplication and addition operations per sampling period, plus the phase compensation transformation, which is already available if the harmonic extraction algorithm uses a rotating frame. Therefore, the improved method retains the low computational cost of PI + repetitive control while achieving dynamic responses comparable to more complex multi-frame methods.

The following table summarizes the qualitative comparison of the three approaches:

Aspect Multiple synchronous frames PI + repetitive control Improved PI + repetitive control
Computational complexity High Low Low
Number of harmonics compensated Limited by number of frames All within bandwidth All within bandwidth
Steady-state accuracy Good for selected harmonics Excellent Excellent
Dynamic response Moderate (depends on filters) Slow (one-cycle delay) Fast (feedforward)
Tuning effort High (many PI gains) Moderate Moderate

In terms of total harmonic distortion, the MSRF method can achieve similarly low THD as the repetitive control if all dominant harmonics are regulated. However, if the nonlinear load produces harmonics beyond the selected set, those uncompensated harmonics remain. The repetitive controller automatically attenuates all harmonics up to the Nyquist frequency, but the high-order harmonics are usually attenuated by the LCL filter and the low-pass filter in the compensator, so the practical benefit is mainly for low-order harmonics.

Practical Implementation Details

I now describe how the proposed control algorithm is implemented in a digital signal processor (DSP) for a real solar inverter. The control routine is executed at a fixed sampling period of 50 μs (20 kHz). At each sampling instant, the following steps are performed:

  1. Sample the three-phase grid currents, the DC-link voltage, and the grid voltages.
  2. Estimate the grid phase angle θ using a synchronous reference frame phase-locked loop (SRF-PLL).
  3. Extract the fundamental active current component in the dq frame. The reference d-axis current is set by the MPPT controller, and the q-axis reference is set to zero for unity power factor.
  4. Extract the harmonic currents using the p-q theory. The load currents are transformed into the αβ frame, and the instantaneous real/reactive power, including the DC component, is calculated. The AC components of p and q, which represent harmonic currents, are used to reconstruct the harmonic current reference in the abc frame.
  5. Transform the harmonic reference into the dq frame (rotating at θ) to obtain the harmonic dq reference signals.
  6. Apply the zero-phase-error lead compensation: rotate the harmonic dq signals by an additional angle θk to obtain the feedforward compensation signals.
  7. Compute the PI controller output from the fundamental dq current errors.
  8. Compute the repetitive controller output. The stored error values from the previous cycle (N steps ago) are multiplied by the compensator S'(z) and added to the current error. The repetitive controller state is updated each sample.
  9. Add the feedforward harmonic signal to the sum of the PI and repetitive outputs.
  10. Transform the total control output back to the abc frame and generate PWM signals using a space vector modulation (SVM) or sinusoidal PWM (SPWM) scheme.

The repetitive controller in the discrete domain can be implemented as follows. Let e(n) be the current error at sample n. The repetitive output u_R(n) is computed as:

$$u_R(n) = u_R(n-N) + e(n).$$

Then, the compensated output u_R'(n) is obtained by filtering u_R(n) through S'(z). However, to avoid large transients, the repetitive controller is often enabled only when the system has reached a quasi-steady state. In my simulation, I enable it at t = 0.3 s, but in practice one may use a soft-start mechanism that ramps up the repetitive gain over a few cycles.

The feedforward gain K_f is chosen based on the inverter model. In an ideal situation where the inverter bridge is considered a linear amplifier with unity gain and the LCL filter is exactly modeled by G(z), the feedforward compensation voltage should be:

$$u_{ff}(z) = G^{-1}(z) i_h^*(z).$$

Since exact inverse of the LCL filter is not realizable, the feedforward path uses the approximate inverse provided by S'(z) and the lead rotation. This is equivalent to a model-based feedforward control. In my simulation, I found that a gain K_f = 1.0 works well, but for robustness, K_f = 0.9 is recommended because it reduces the risk of overcompensation due to parameter errors.

Impact of the Solar Inverter on Power Quality

The main benefit of using the solar inverter for harmonic suppression is the improvement of the grid power quality without installing a dedicated APF. By compensating the harmonics at the source of distribution, the voltage distortion at the PCC is reduced, which in turn improves the performance of other sensitive loads connected to the same bus. The grid-side current THD is the primary metric, and my simulation shows that it can be reduced from 10.8% to below 2% with the proposed controller.

Another important benefit is the reduction of neutral conductor currents in three-phase four-wire systems, if the solar inverter has a neutral connection. However, three-wire three-phase inverters cannot compensate zero-sequence harmonics; they only compensate positive- and negative-sequence harmonic components. For the diode rectifier load used in the simulation, the main harmonics are of order 6k ± 1, i.e., 5, 7, 11, 13, etc., which include both negative and positive sequences. The dq-based control handles these naturally because negative-sequence harmonics appear as 6th-order oscillations in the dq frame.

The proposed controller also contributes to damping harmonic resonance. When parallel capacitors and inductive loads cause resonances at certain frequencies, the active impedance of the solar inverter at those frequencies can be shaped by the repetitive controller to provide active damping. The feedforward path, by quickly injecting harmonic currents with the correct phase, effectively reduces the harmonic voltage at the PCC and prevents resonance amplification.

Simulation Results in Tabular Form

To provide a comprehensive view of the dynamic response, I present the following table showing the settling time for the q-axis current error to remain within a ±2 A band after enabling the harmonic control at t = 0.3 s.

Control Type Settling time (ms) Peak error during settling (A) THD at steady state (%)
Type I > 50 (never settles within ±2A) 5.62 3.61
Type II ~35 5.62 1.61
Type III ~2 4.53 1.71

The settling time of Type III is dramatically shorter than that of Type II — about 2 ms versus 35 ms. This confirms that the feedforward path successfully eliminates the one-cycle delay bottleneck. Even though the steady-state THD of Type III is slightly higher than Type II in the table, the difference is within the simulation precision and can be reduced by fine-tuning K_f. In fact, if I increase K_f to 1.05, the THD of Type III becomes approximately 1.55%, slightly better than Type II. However, I keep K_f = 1.0 for a conservative design.

The dynamic behavior of the individual harmonic components is also interesting. During the first cycle after activation, the 5th harmonic component in Type III is reduced by 70% compared to the uncompensated case, while Type II exhibits only a 10% reduction. By the second cycle, Type II reaches 45% reduction, while Type III reaches 75%. By the tenth cycle, both exceed 85% reduction. This step-by-step improvement is characteristic of repetitive control, and the feedforward mainly shifts the initial part of the trajectory upward.

Code-Level Description of the Improved Controller

Though this paper is not meant to provide detailed code, I can outline the discrete-time equations that are executed in the DSP. Let T_s = 1/20000 s and N = 400. The error signal e(n) is the difference between the reference current and the measured current in the αβ frame (or equivalently in the dq frame with appropriate transformations). The PI controller in the dq frame outputs:

$$u_{PI}(n) = k_p e_{dq}(n) + k_i T_s \sum_{m=0}^{n} e_{dq}(m).$$

The repetitive controller output in the αβ frame (or dq frame) is:

$$u_{RC}(n) = Q u_{RC}(n-N) + e(n).$$

Then the compensated repetitive output is:

$$u_{RC}'(n) = b_0 u_{RC}(n) + b_1 u_{RC}(n-1) + … + a_1 u_{RC}'(n-1) + a_2 u_{RC}'(n-2),$$

where the coefficients correspond to the discretized D(z)F_n(z)F_2(z). In my implementation, the compensator S'(z) is realized as a third-order digital filter with coefficients derived from the bilinear transform of the continuous-time blocks.

The feedforward signal in the dq frame is:

$$u_{ff,dq}(n) = K_f R(\theta_k) i_{h,dq}^*(n),$$

where R(θ_k) is the rotation matrix for the lead angle. The total control voltage in the dq frame is:

$$u_{dq}(n) = u_{PI,dq}(n) + u_{RC,dq}'(n) + u_{ff,dq}(n).$$

Then u_dq is transformed to the abc frame to generate the PWM reference voltages.

One practical concern is that the repetitive controller may amplify sensor noise at high frequencies. The low-pass filter F_2(z) in the compensator mitigates this, but if the noise is severe, one can reduce the Q(z) from 0.95 to 0.9, albeit at the expense of a slight steady-state error. The feedforward path is also susceptible to noise because it directly injects the harmonic reference; however, the harmonic reference is obtained from the load current through low-pass filters in the p-q calculation, so high-frequency noise is largely attenuated. In the simulation, no significant noise issue is observed.

Effect of Grid Voltage Distortion

In a real distribution network, the grid voltage itself may be distorted. The harmonic current compensation performance of the solar inverter should be evaluated under distorted grid voltage conditions. In my simulation, I assumed an ideal sinusoidal voltage source. To test robustness, I added a 5% 5th harmonic voltage distortion to the grid source. The results show that the proposed controller still suppresses the load harmonics effectively, but the grid current THD is slightly higher because the inverter cannot fully compensate for voltage harmonics if it is not connected in a feedback loop that regulates the PCC voltage. For a solar inverter primarily intended for current compensation, the grid voltage distortion is usually handled by the PLL and the current reference. If voltage regulation is also required, an additional voltage loop at the PCC would be necessary.

The repetitive controller can actually be designed to reject periodic disturbances injected from the grid voltage side as well, as long as the disturbance frequency is an integer multiple of the fundamental. The internal model of the repetitive controller provides infinite gain at these frequencies, thereby reducing the current error caused by grid voltage harmonics. However, in my current implementation, the grid voltage feedforward is not included, so the effect relies on the feedback alone. The improved feedforward path for harmonic current also indirectly helps because it reduces the current harmonics that interact with the grid impedance to create voltage harmonics.

Limitations and Future Work

The proposed method has been validated by simulation, but several practical issues require further investigation. First, the computational delay in a real DSP is not negligible. My simulation assumes zero computational delay; in practice, the PWM update is often performed in the next sampling period, which adds a one-sample delay. This delay can be incorporated into the plant model G(z) by multiplying by z-1. The compensator S(z) should then be redesigned to account for this delay. My lead compensation zk can be extended to include the extra sample delay, but the achievable phase margin may decrease.

Second, the saturation of the PWM modulator and the inverter current limit are not modeled in detail. If the harmonic compensation requires a voltage that exceeds the available DC-link voltage, the inverter will saturate, causing current distortion and possible instability. A practical anti-windup scheme for the repetitive controller is necessary to handle saturation. One common approach is to freeze the repetitive controller output when the PWM reference is saturated, or to use a conditional integration method.

Third, the detection of the harmonic reference using p-q theory assumes that the load currents are measured locally. In a multifunctional solar inverter, the harmonic currents can be measured either at the inverter output or at the PCC. The placement of the current sensors affects the control architecture. In my design, I measure the load current (the sum of the inverter current and the grid current) to extract the harmonics that need to be compensated. This is similar to the load current detection method used in active power filters.

Fourth, the dynamic response of the MPPT loop may interact with the harmonic compensation loop. When the harmonic compensation causes additional AC currents in the DC link, the DC-link voltage may fluctuate at harmonic frequencies. The MPPT algorithm usually filters out these fluctuations, but if the DC-link capacitor is small, the voltage ripple can affect the inverter output. My simulation uses a relatively large DC-link capacitance, so this effect is negligible. In practice, a feedforward of the DC-link voltage ripple can be added to the modulation index to improve performance.

Future work will focus on experimental validation of the proposed method using a laboratory-scale solar inverter prototype. I plan to implement the improved PI + repetitive control on a digital signal processor and test its performance under various nonlinear loads and grid conditions. Additionally, I will investigate adaptive feedforward gain tuning that maximizes harmonic suppression while respecting the inverter current and voltage limits. The combination of the proposed method with active damping of the LCL resonance is also an interesting topic.

Conclusion

In this article, I have presented a harmonic suppression control method for a solar inverter based on an improved PI + repetitive control scheme. The key contributions are the design of a compensator that shapes the LCL filter response to allow accurate multi-harmonic tracking, and the addition of a harmonic current feedforward path with zero-phase-error compensation to overcome the one-cycle delay of the conventional repetitive controller. The simulation results demonstrate that the proposed method enables the solar inverter to achieve fast and accurate harmonic suppression while maintaining stable photovoltaic power injection. Compared with a conventional PI controller and a standard PI + repetitive controller, the improved controller significantly reduces the transient current error and shortens the settling time from tens of milliseconds to a few milliseconds. The steady-state THD is reduced from 10.8% to approximately 1.7%, which meets the IEEE 519 recommended limits for general distribution systems.

The improved PI + repetitive control method is particularly attractive for practical solar inverter applications because it retains the low computational cost and simple tuning of the repetitive control architecture, while providing a dynamic response comparable to more complex multi-frame control strategies. The feedforward path uses the already available harmonic reference from the load current detection algorithm, requiring only a small additional rotation transformation and a gain multiplication. This makes the proposed method easy to embed in existing solar inverter control software.

Finally, I note that the solar inverter is an underutilized asset in most photovoltaic systems. By adding harmonic suppression functionality, the solar inverter can contribute to power quality improvement in distribution networks, providing economic and technical benefits to both the photovoltaic owner and the grid operator. The proposed control strategy is a step toward realizing the full potential of the solar inverter as a multifunctional device, and I hope that my work will inspire further research in this direction.

Scroll to Top