← IBR Dynamic Modeling and Simulation

IBR Dynamic Modeling and Simulation

Mode-Switching Hybrid Models

C1-08 · Lesson + simulation + practice · Allow 90 minutes

Treat GFL–GFM transitions as mode-specific dynamics with explicit resets.

Learning objectives

  • Distinguish mode switching from parallel operation.
  • Explain reset, hold, and release operations.

From structure to model

A mode label changes which equations are active

A mode-switching inverter uses one active controller at a time. Let m ∈ {GFL, VSM}, with ẋ = f_m(x,u) between events and x⁺ = R(x⁻,u) at a switching event. An active-state vector and a union of saved checkpoint variables are different objects; the union is not automatically a larger ODE.

This demonstration starts in the four-state GFL realization, applies a command disturbance at 1 s, and switches to the four-state VSM realization at 2 s. Although both vectors have length four, their meanings differ: [δ_PLL, ξ_PLL, i_d, i_q] cannot be copied into [δ_source, ω, P_f, Q_f].

Construct a terminal-compatible reset

Before switching, record PCC V, injected I, P, Q and PLL ω. The incoming source must satisfy U⁺ = V⁻ + Z_f I⁻. Set its angle to arg(U⁺), its frequency to ω⁻, and its power filters to P⁻ and Q⁻. These conditions reconstruct the same terminal voltage and current through the incoming source impedance.

Set E₀⁺ = |U⁺| + n_q(Q⁻ − Q*) and P*⁺ = P⁻ + D(ω⁻ − 1). The voltage offset is matched, and initial VSM acceleration is zero. This is an explicit policy that recalibrates the incoming command and voltage offset. It does not promise that the pre-switch P* remains unchanged.

Measure what is continuous

The reset audit measures the largest jump in complex PCC voltage, P, Q and internal frequency. The default should be close to floating-point roundoff. The source angle can change because the incoming source sits behind an impedance while the outgoing angle belongs to the PLL. Angle equality would be the wrong continuity criterion here.

Algebraic voltage can still jump at the separate disturbance event at 1 s. The reset conditions apply at 2 s and should not be confused with general continuity under every input change.

What remains for a detailed transition model

The lab has one scheduled transition and no inactive-controller tracking, limiter, dwell timer or protection guard. The source VSM–PLL transition notebook additionally treats hold/release policies and different active-state dimensions. It also separates a stable controller-specific demonstration profile from an unstable same-gain GFM endpoint. Endpoint tests alone do not validate a same-device mode transition.

Core equations

\dot x=f_m(x,u),\qquad x^+=R_{m^-\to m^+}(x^-,u)
U^+=V^-+Z_f I^-,\quad\delta^+=\arg U^+,\quad\omega^+=\omega^-,\quad P_f^+=P^-,\quad Q_f^+=Q^-
E_0^+=|U^+|+n_q(Q^--Q^*),\qquad P^{*+}=P^-+D(\omega^--1)

Simulation experiment

  1. Run the scheduled switch and inspect the trace immediately before and after 2 s.
  2. Read the reset residual and the final command offsets in the numerical audit.
  3. In reset_to_vsm(), deliberately replace the reset angle by the PLL angle; inspect the resulting jump.

Laboratory · Python runs in your browser

Predict → run → inspect

Predict the response, then change a parameter and run. The initial plot is a baseline generated by the same solver. The first computation downloads Python; later runs reuse it.

Loading the baseline…

Numerical audit and samples

Low-frequency teaching realization: nominal-frequency algebraic network and ideal current/voltage realization. 50 Hz, 10 kVA, 400 V; initial PCC total P = 0.6, Q = 0; X/R = 10. τᵢ = 0.02 s, τₚ = 0.1 s, τq = 0.05 s, nq = 0.0325; GFM source impedance 0.00625 + j0.1 pu. LCL, inner PI, DC dynamics and current limits are omitted.

Edit the model and reproduce the experiment

The code reads the controls above and plots its own result. Edit the experiment or expand the solver source to test your prediction. Download experiment produces one .py file containing the parameters, full solver and experiment code; local execution needs only Python 3.

case is a snapshot of the controls when you press Run. Call solve(case) and assign the final solution to result to plot it.

Download solver

The first run needs internet access to download Python. Computation stays in your browser; the solver uses only the standard library.

Ready to run.

Output appears here.
Inspect and edit the model source (advanced)

The source contains the transforms, LCL, PLL, droop, VSM, shared PCC and explicit reset. Source edits affect the next Python experiment; the laboratory above retains the original teaching equations.

Check your understanding

Can equal-length GFL and VSM state vectors be copied directly at a switch?

Explain why stable endpoints alone do not validate a transition.

Continue in the source repository

Adapted from local PINN-IBR materials reviewed on 2026-10-03. The web code is a separately authored teaching realization. These repository paths contain the detailed models, configurations and research cases.

  • Coding/Modeling/Single-IBR-Infinite-Bus/10_VSM_PLL_Transition_Infinite_Bus.ipynb
  • Coding/Modeling/src/ibrsim/models/vsm_pll_transition.py

PINN-IBR repository

All nine modules
  1. System Boundaries and Model Representations
  2. Reference Frames and Per-Unit Conventions
  3. Averaged Converter and LCL Plant
  4. PLL and Grid-Following Control
  5. Droop Grid-Forming Control
  6. VSM and Virtual Inertia
  7. Parallel GFL–GFM Hybrid Models
  8. Mode-Switching Hybrid Models
  9. Equilibrium, Disturbances, and Fair Comparison