Grid-Tied Inverters: Synchronisation, Current Control and IEEE 1547
A rooftop PV system, a home battery and a wind turbine's converter all end in the same box: an inverter that pushes current into a grid it does not control. It must make its current sinusoidal and in step with a voltage that wanders in frequency, jumps in phase during faults and is distorted by everyone else's loads. It must deliver exactly the power its DC side offers, supply or absorb reactive power on command, keep running through grid disturbances that the rules say it must ride through, and stop within two seconds when the grid disappears so that it never energises a line a worker believes is dead. This lesson builds that controller from parts the course already has: the inverter and SVPWM (Space-Vector PWM), the Park transform and dq current loops (Clarke and Park Transforms and FOC), and a phase-locked loop.
Safety: calculation and simulation only. Grid-tied inverters are mains equipment with DC links of several hundred volts. Never connect anything you build to the grid or to a socket, not even through a small transformer, and never back-feed a building's wiring. The bench part of this lesson locks a PLL onto a signal generator.
The structure
The inverter is a current source towards the grid: a filter inductor sits between the bridge's PWM voltage and the grid voltage, and the controller sets the current through it. Two cascaded loops do the work. The outer loop holds the DC-link voltage: if the PV stage delivers more power than the inverter exports, rises and the loop raises the active current reference ; so the inverter always exports what the DC side supplies. The inner loops regulate the currents in a frame aligned with the grid voltage, where with amplitude-invariant transforms and
so sets active power and reactive power (with this sign, a negative injects reactive power, like an over-excited generator). The plant of each axis is the filter, plus the cross-coupling ; the controller adds the measured grid voltage and the coupling terms as feed-forward, and the PI gains are those of the FOC lesson, , . Single-phase inverters cannot form a dq frame from one voltage directly; they either build an orthogonal signal (a second-order generalised integrator) or use a proportional-resonant controller, which has infinite gain at the way an integrator has at DC.
The filter. A plain inductor needs many millihenries to keep the switching ripple within the harmonic limits. Most inverters use an LCL filter ( on the bridge, , towards the grid), whose third-order roll-off does more with less inductance but adds a resonance at that must be damped, passively with a resistor in series with or actively in the control; for , , it lies at , between the line frequency and a carrier, as it should.
Synchronisation: the phase-locked loop
The synchronous-reference-frame PLL applies the Park transform to the grid voltages with its own angle estimate . If is right, ; if it lags by a small angle, . A PI controller turns into a frequency, which integrates to . Linearised, the loop is second order:
A fast PLL follows phase jumps quickly but passes harmonics and unbalance into its angle; a slow one is smooth but lags during disturbances. Bandwidths of to are common; weak grids need care, because the inverter's own current then moves the voltage the PLL measures.
import numpy as np
# Synchronous-reference-frame PLL on a 400 V, 50 Hz grid (phase peak 326.6 V), sampled at 10 kHz
Vm, h = 400 / np.sqrt(3) * np.sqrt(2), 1e-4
wn, zeta = 2 * np.pi * 20, 0.707 # loop natural frequency 20 Hz
Kp, Ki = 2 * zeta * wn / Vm, wn**2 / Vm # linearised loop: vq = Vm (theta - theta_hat)
print(f"Kp = {Kp:.4f} rad/(V s), Ki = {Ki:.2f} rad/(V s^2)")
def grid(t):
"""Grid angle: 50 Hz, a 20 degree phase jump at 0.10 s, then 50.5 Hz from 0.20 s."""
th = 2 * np.pi * 50 * t + (np.radians(20) if t >= 0.10 else 0.0)
if t >= 0.20:
th += 2 * np.pi * 0.5 * (t - 0.20)
return th
th_hat, integ = 0.0, 2 * np.pi * 50 # start locked at nominal frequency
marks = {0.0999, 0.1000, 0.1050, 0.1200, 0.1500, 0.2100, 0.2500, 0.4000}
print(" t (s) angle error (deg) f estimate (Hz)")
for n in range(4001):
t = n * h
th = grid(t)
va, vb, vc = (Vm * np.cos(th - k * 2 * np.pi / 3) for k in range(3))
al = (2 / 3) * (va - 0.5 * vb - 0.5 * vc)
be = (vb - vc) / np.sqrt(3)
vq = -al * np.sin(th_hat) + be * np.cos(th_hat) # Park with the estimated angle
integ += Ki * vq * h
w = integ + Kp * vq
if round(t, 4) in marks:
err = round(float(np.degrees((th - th_hat + np.pi) % (2 * np.pi) - np.pi)), 3) + 0.0
print(f" {t:6.4f} {err:8.3f} {w / (2 * np.pi):7.3f}")
th_hat += w * hKp = 0.5441 rad/(V s), Ki = 48.35 rad/(V s^2)
t (s) angle error (deg) f estimate (Hz)
0.0999 0.000 50.000
0.1000 20.000 59.758
0.1050 6.027 55.717
0.1200 -4.004 49.637
0.1500 0.162 49.972
0.2100 0.647 50.532
0.2500 -0.022 50.496
0.4000 0.000 50.500
With a loop the phase jump is down to after and below after , and the PI's integrator follows the frequency step to with no steady angle error (two integrators in the loop track a ramp in phase). Note the frequency estimate: for a moment the phase jump looks like . A protection function that trusted this raw estimate would trip on every nearby fault, which is why frequency and rate-of-change-of-frequency (RoCoF) measurements are filtered and why ride-through requirements specify phase jumps explicitly.
Worked example: a 10 kW three-phase inverter
Given: into a , grid at unity power factor, then with injected; filter , per phase; DC link ; current-loop bandwidth .
Find: , the inverter voltage needed, the minimum DC-link voltage, and the PI gains.
Solve:
Check: . Injecting reactive power raises the voltage the bridge must make; leaves of margin for grid overvoltage (at the unity-pf point alone needs about ) and for current transients. The simulation ramps over (stepping it would saturate the bridge), then steps .
import numpy as np
# 10 kW three-phase grid-tied inverter, 400 V 50 Hz, L filter 5 mH with 0.1 ohm, DC link 700 V
Vd, L, R, Vdc = 400 / np.sqrt(3) * np.sqrt(2), 5e-3, 0.1, 700.0
w = 2 * np.pi * 50
wc = 2 * np.pi * 1000 # current-loop bandwidth 1 kHz
Kp, Ki = wc * L, wc * R
Ts, sub = 1e-4, 20 # 10 kHz control, plant in 20 sub-steps
emax = Vdc / np.sqrt(3) # SVPWM linear limit (phase peak)
P_ref = 10e3
id_ref = 2 * P_ref / (3 * Vd)
print(f"grid vd = {Vd:.1f} V peak, id* for 10 kW = {id_ref:.2f} A, Kp = {Kp:.2f} V/A, Ki = {Ki:.1f} V/(A s)")
i_d = i_q = s_d = s_q = 0.0
for n in range(400): # 40 ms
t = n * Ts
idr = id_ref * min(t / 0.01, 1.0) # ramp active power up over 10 ms
iqr = -10.0 if t >= 0.02 else 0.0 # inject reactive power from 20 ms
ed, eq = idr - i_d, iqr - i_q
vd = Kp * ed + s_d + Vd - w * L * i_q # PI + grid feed-forward + decoupling
vq = Kp * eq + s_q + w * L * i_d
m = np.hypot(vd, vq)
if m > emax: # saturate, and stop integrating (anti-windup)
vd, vq, m = vd * emax / m, vq * emax / m, emax
else:
s_d += Ki * ed * Ts
s_q += Ki * eq * Ts
h = Ts / sub
for _ in range(sub): # L di/dt = v_inv - R i - v_grid -/+ w L i (dq frame)
dd = (vd - R * i_d - Vd + w * L * i_q) / L
dq = (vq - R * i_q - w * L * i_d) / L
i_d += dd * h
i_q += dq * h
if n + 1 in (50, 100, 120, 200, 202, 205, 210, 400):
P = 1.5 * Vd * i_d
Q = -1.5 * Vd * i_q
print(f"t = {(n+1)*Ts*1e3:5.1f} ms: id = {i_d:6.2f} A, iq = {round(i_q, 2) + 0.0:6.2f} A, "
f"P = {P/1e3:6.3f} kW, Q = {round(Q/1e3, 3) + 0.0:6.3f} kvar, |v_inv| = {m:5.1f} V")
print(f"SVPWM limit Vdc/sqrt(3) = {emax:.1f} V peak; minimum Vdc for the last point = {np.sqrt(3)*m:.0f} V")grid vd = 326.6 V peak, id* for 10 kW = 20.41 A, Kp = 31.42 V/A, Ki = 628.3 V/(A s)
t = 5.0 ms: id = 9.88 A, iq = 0.00 A, P = 4.841 kW, Q = 0.002 kvar, |v_inv| = 338.1 V
t = 10.0 ms: id = 20.09 A, iq = 0.00 A, P = 9.841 kW, Q = 0.002 kvar, |v_inv| = 340.3 V
t = 12.0 ms: id = 20.41 A, iq = 0.00 A, P = 10.000 kW, Q = 0.000 kvar, |v_inv| = 330.2 V
t = 20.0 ms: id = 20.41 A, iq = 0.00 A, P = 10.000 kW, Q = 0.000 kvar, |v_inv| = 330.2 V
t = 20.2 ms: id = 20.18 A, iq = -8.46 A, P = 9.886 kW, Q = 4.146 kvar, |v_inv| = 367.7 V
t = 20.5 ms: id = 20.40 A, iq = -9.90 A, P = 9.992 kW, Q = 4.852 kvar, |v_inv| = 346.2 V
t = 21.0 ms: id = 20.41 A, iq = -9.98 A, P = 10.001 kW, Q = 4.889 kvar, |v_inv| = 345.7 V
t = 40.0 ms: id = 20.41 A, iq = -9.99 A, P = 10.001 kW, Q = 4.893 kvar, |v_inv| = 345.7 V
SVPWM limit Vdc/sqrt(3) = 404.1 V peak; minimum Vdc for the last point = 599 V
The active current follows its ramp, the reactive step settles within about (a first-order loop has ), and dips by only during the step thanks to the decoupling.
Interactive: one phase, as phasors (calculation only)
The netlist lab holds one phase of the worked example: the bridge's fundamental ( rms at ), the filter's and , and the grid ( at ). It reads at : unity power factor, per phase. Raise the inverter magnitude to at the same angle: the current becomes at , about and injected in total. Voltage magnitude moves mainly reactive power, angle mainly active power, as for a generator on the grid (Power-Angle Characteristic); the current controller hides this by choosing both at once.
Anti-islanding
An unintentional island forms when a breaker upstream opens and the inverters on that section keep feeding its loads. If the load happens to match the inverters' output, voltage and frequency barely move and nothing seems wrong, while the line is live. Passive methods watch for the change: under- and overvoltage, under- and overfrequency, RoCoF, a phase jump, a rise in voltage harmonics. Each has a non-detection zone (NDZ). For a parallel RLC load with quality factor and voltage and frequency windows , , an island stays undetected if the power the grid was supplying, and , satisfies
With a to voltage window, to and (the test load of the islanding test standards), that is to in active power and to in reactive power: a balanced island is easily missed. Active methods therefore push the system out of balance on purpose: they shift the current's frequency slightly in the direction the frequency is already drifting (Sandia frequency shift, slip-mode), or inject small reactive-power or impedance-measuring disturbances; on a stiff grid these do nothing, in an island they drive voltage or frequency out of the window. The test is standardised with a tuned RLC load () in IEEE 1547.1-2020 and IEC 62116 (2014 edition).
The rules: IEEE 1547-2018 and its amendment
In North America the interconnection requirements are IEEE 1547-2018, amended by IEEE 1547a-2020, tested to IEEE 1547.1-2020; inverters in the United States are listed to UL 1741, whose Supplement SB (2021) applies the 2018 requirements (as of 2026-11 these are current; a revision of IEEE 1547 is in progress). The Smart Grid lesson of the power-systems course covers the grid side; for the inverter designer, the requirements translate into control functions (as of 2026):
| Requirement | What the inverter must do |
|---|---|
| reactive power, Category A or B | inject up to of nameplate apparent power and absorb up to (Category A) or (Category B); constant pf, volt–var, watt–var and constant var modes, plus volt–watt for active power |
| ride-through, Category I, II or III | stay connected, and keep exporting current, through specified voltage and frequency excursions, including phase jumps |
| frequency response | frequency–droop (frequency–watt) |
| trip | cease to energise when voltage or frequency stay outside adjustable limits for adjustable times; for example the fast overvoltage trip clears at within by default |
| unintentional islanding | detect it and cease to energise within |
| power quality | DC current injection at most of rated current; current distortion limits (a total rated-current distortion of ) |
| enter service | wait for the grid to be within limits for a set time, then ramp power up |
| interoperability | a communication interface (IEEE 2030.5, IEEE 1815, or SunSpec Modbus) |
In Europe the same functions come from the network code Requirements for Generators (Regulation (EU) 2016/631, still in force; a revised "RfG 2.0" that would repeal it was published as a draft in July 2026 and was not yet adopted as of 2026-11), EN 50549-1:2019 with Amendment A1:2023 for low-voltage connection, and national codes. Ride-through and anti-islanding pull in opposite directions: the inverter must not trip on a disturbance, yet must trip on an island within seconds. Active anti-islanding methods are what reconcile them.
Guided lab: a PLL on a signal generator
Hand calculation. For a PLL sampling at on a peak test signal (so in the gain formulas), compute and for , : , .
Simulation. Set Vm = 1.0 in the PLL cell (the gains scale with it, so the response is identical) and try and ; note the settling time after the phase jump and the peak frequency estimate.
What you would measure. A microcontroller board (USB-powered) runs a single-phase PLL (a second-order generalised integrator to make the quadrature signal, then the same PI) on an ADC input biased to mid-supply, fed from a function generator at peak, . Output the estimated angle as a sine on a DAC pin and compare it with the input on a two-channel scope. Step the generator to , or switch between two synchronised channels with a phase offset: expect lock within to for a loop and a steady phase error within (limited by the ADC and the sample timing).
Hazards and safe setup. Signal levels only, from a function generator; keep the input within the ADC's range with the bias network. No connection to the mains in any form, including small "safe" transformers: the lesson's inverter is simulated only.
Pitfalls
- Exporting before synchronising. Closing the relay with the bridge out of phase produces a current surge; inverters wait for the PLL to lock and the grid to be within limits.
- A PLL too fast for a weak grid. The inverter's current moves the measured voltage, and the PLL and current loop can interact and oscillate.
- An undamped LCL resonance. It shows up as a growing oscillation near as soon as the current loop closes.
- Trusting passive anti-islanding alone. A matched island can sit inside its non-detection zone indefinitely.
Practice
- A three-phase inverter on : find for unity power factor.
- What injects into the same grid?
- With voltage limits to , what is the active-power NDZ of a passive scheme?
Answer
- (peak, amplitude-invariant).
- .
- to .
Test yourself
In the grid-voltage-oriented dq frame (), active power is set by…
- , through
- the PLL bandwidth
- the DC-link capacitor
The outer loop of a PV grid-tied inverter typically regulates…
- the grid frequency
- the DC-link voltage, so the inverter exports whatever power the DC side delivers
- the module temperature
- the relay
Why do grid-tied inverters need active anti-islanding methods?
- passive methods are forbidden
- when the island's load matches the inverter's output, voltage and frequency stay inside the trip windows (the non-detection zone)
- to improve efficiency
- to synchronise the PLL
Under IEEE 1547-2018, after an unintentional island forms the DER must cease to energise it within…
- 0.02 s
- 2 s
- 60 s
- never: it must ride through