EMT Ph3 Grid-Forming VSI Implementation

How the grid-forming inverter is linearized, stamped and configured.

The equations and the linearization mathematics are derived under EMT Ph3 grid-forming voltage source inverter. This page covers only their arrangement in code.

Class and base

EMT::Ph3::SSN_GFM is final and derives from EMT::Ph3::TwoTerminalVTypeVariableSSNComp. All seventeen states are real.

State layout

IndexNameKind
0, 1PFiltered, QFilteredpower filter
2, 3Omega, Thetadroop frequency and angle
4VoltageMagnitudevoltage droop output
5, 6VoltageIntegratorD, VoltageIntegratorQouter voltage control
7, 8CurrentIntegratorD, CurrentIntegratorQinner current control
9, 10DelayVoltageD, DelayVoltageQmodulation delay
11–13VcA, VcB, VcCfilter capacitor voltage, per phase
14–16IfA, IfB, IfCfilter inductor current, per phase

Omega and Theta being states rather than inputs is what makes this grid forming: the converter carries its own frequency and angle instead of tracking a measured one through a PLL.

Numerical linearization

The Jacobians are not written out by hand. calculateNumericalJacobians forms all four by central differences of the nonlinear state and output functions, so a change to the control equations needs no matching change to any matrix code.

The perturbation for column $j$ is absoluteStep + relativeStep * max(1, |x_j|), defaulting to 1e-8 and 1e-6 and adjustable at runtime. The max(1, ...) floor means the step is effectively absolute for small states and relative for large ones, which keeps the difference well conditioned across states whose magnitudes differ by orders.

Because the model is time varying, the state-space form and its stamp are recomputed every step rather than cached. That is the cost of this approach and the reason it is used only where the control is genuinely nonlinear.

Source and examples