EMT Ph3 Grid-Forming VSI Implementation
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
| Index | Name | Kind |
|---|---|---|
| 0, 1 | PFiltered, QFiltered | power filter |
| 2, 3 | Omega, Theta | droop frequency and angle |
| 4 | VoltageMagnitude | voltage droop output |
| 5, 6 | VoltageIntegratorD, VoltageIntegratorQ | outer voltage control |
| 7, 8 | CurrentIntegratorD, CurrentIntegratorQ | inner current control |
| 9, 10 | DelayVoltageD, DelayVoltageQ | modulation delay |
| 11–13 | VcA, VcB, VcC | filter capacitor voltage, per phase |
| 14–16 | IfA, IfB, IfC | filter 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
- Source: header, implementation
- C++ example, IEEE 9-bus mixed machine and inverter
- Python notebook
- Grid-following counterpart: EMT Ph3 averaged VSI implementation