Injector Models
RAMSES custom injector models represent loads, induction machines, inverter-based resources (IBR), and battery energy storage systems (BESS) connected to network buses.
Load Models
Section titled “Load Models”inj_load — Exponential Recovery Load
Section titled “inj_load — Exponential Recovery Load”Description
Section titled “Description”The exponential recovery load model captures the transient and steady-state voltage and frequency dependency of aggregated loads. Immediately after a voltage disturbance, the load behaves according to a transient voltage exponent; it then recovers exponentially to a steady-state behaviour described by a different exponent. The model supports separate active () and reactive () power recovery dynamics, each with individual minimum/maximum limiters on the recovery variable.
Scientific Description
Section titled “Scientific Description”The model is parameterized in terms of initial active and reactive conductance/susceptance, and . Two recovery state variables and evolve according to:
where is the per-unit speed deviation, is the bus voltage magnitude, is the initial voltage, are transient exponents, are steady-state exponents, and is the load recovery time constant. The injected currents are then:
When the recovery variable hits its limit (due to e.g. stalling or complete voltage collapse), the limit is held until the direction of the derivative reverses.
Parameters
Section titled “Parameters”| # | Name | Description | Unit |
|---|---|---|---|
| 1 | DP | Frequency sensitivity of active power | pu/pu |
| 2 | A1 | Proportion of type-1 component in | — |
| 3 | alpha1 | Transient voltage exponent for (type 1) | — |
| 4 | A2 | Proportion of type-2 component in | — |
| 5 | alpha2 | Transient voltage exponent for (type 2) | — |
| 6 | alpha3 | Transient voltage exponent for (type 3, proportion ) | — |
| 7 | DQ | Frequency sensitivity of reactive power | pu/pu |
| 8 | B1 | Proportion of type-1 component in | — |
| 9 | beta1 | Transient voltage exponent for (type 1) | — |
| 10 | B2 | Proportion of type-2 component in | — |
| 11 | beta2 | Transient voltage exponent for (type 2) | — |
| 12 | beta3 | Transient voltage exponent for (type 3) | — |
Internal computed parameters include the steady-state exponents for each component (derived from the transient exponents), initial conductance , susceptance , and initial voltage .
State Variables
Section titled “State Variables”| Variable | Description |
|---|---|
iy | -component of injected current (pu on system base) |
ix | -component of injected current (pu on system base) |
xp | Active power recovery variable (dimensionless) |
xq | Reactive power recovery variable (dimensionless) |
Observables: P, Q, xp, xq
Usage Example
Section titled “Usage Example”INJEC load LOAD1 BUS1 1. 1. 0. 0. 1.5 0.3 1.0 0.2 2.0 0.5 1.8 0.4 2.5 0.1 3.0 2.0 ;Parameters: DP A1 alpha1 A2 alpha2 alpha3 DQ B1 beta1 B2 beta2 beta3
inj_vfd_load — Variable Frequency Drive Load
Section titled “inj_vfd_load — Variable Frequency Drive Load”Description
Section titled “Description”The VFD load model represents aggregate industrial loads driven by variable-frequency drives, where the power consumption exhibits a composite voltage-dependent characteristic with multiple exponential components and frequency sensitivity. It also includes low-voltage protection: below a configurable threshold , the load switches to a constant-admittance representation, preventing numerical difficulties during deep voltage sags.
Scientific Description
Section titled “Scientific Description”The active and reactive powers depend on bus voltage and frequency deviation :
Below , an equivalent constant admittance is used:
where and are computed at initialization to ensure continuity at . The switch between the two regimes is governed by a piecewise-linear function of :
A small voltage filter (time constant 0.003 s) smooths the transition. The frequency deviation can optionally be computed from the local bus frequency (measured via an f_inj block with time constant ) or from the system centre-of-inertia speed.
The initial voltage can differ from the transmission bus voltage if a distribution transformer ratio is implied (set to specify the distribution-side voltage; otherwise the transmission voltage is used directly).
Parameters
Section titled “Parameters”| # | Name | Description | Unit |
|---|---|---|---|
| 1 | Dp | Frequency sensitivity of active power | pu/pu |
| 2 | a1 | Fraction of type-1 component in | — |
| 3 | alpha1 | Voltage exponent of type-1 component | — |
| 4 | a2 | Fraction of type-2 component in | — |
| 5 | alpha2 | Voltage exponent of type-2 component | — |
| 6 | alpha3 | Voltage exponent of type-3 component (fraction ) | — |
| 7 | Dq | Frequency sensitivity of reactive power | pu/pu |
| 8 | b1 | Fraction of type-1 component in | — |
| 9 | beta1 | Voltage exponent of type-1 component | — |
| 10 | b2 | Fraction of type-2 component in | — |
| 11 | beta2 | Voltage exponent of type-2 component | — |
| 12 | beta3 | Voltage exponent of type-3 component | — |
| 13 | Vinit | Initial distribution-bus voltage (0 = use transmission voltage) | pu |
| 14 | Vlow | Voltage threshold for constant-admittance regime (recommended 0.5–0.7) | pu |
| 15 | foption | 1 = use local bus frequency; 0 = use COI speed | flag |
| 16 | Tmes | Frequency measurement time constant | s |
State Variables
Section titled “State Variables”| Variable | Description |
|---|---|
Vreal | Voltage at equivalent distribution bus |
V | Filtered distribution-bus voltage (3 ms filter) |
P | Active power consumed |
Q | Reactive power consumed |
fbus | Local bus frequency (used if foption=1) |
df | Frequency deviation |
u | Regime switch (1 = above , 0 = constant admittance) |
Observables: P, Q, df, u
Usage Example
Section titled “Usage Example”INJEC vfd_load VFD1 BUS_IND 1. 1. 0. 0. 1.5 0.7 2.0 0.2 1.0 0.5 1.2 0.5 2.5 0.1 1.5 0.8 0.0 0.6 0 0.1 ;inj_restld — Restorative Load
Section titled “inj_restld — Restorative Load”Description
Section titled “Description”The restorative load model represents loads that self-restore toward a nominal characteristic after a voltage disturbance. The load’s active and reactive powers are governed by two internal recovery variables that evolve dynamically, allowing the simulation to capture the slow restoration of thermostatically controlled loads (heating, cooling) and similar self-restoring demand.
Scientific Description
Section titled “Scientific Description”The recovery variable for active power satisfies:
with analogous equation for . Here and are the steady-state and transient voltage exponents respectively. Limiters are applied. The injected currents are expressed as:
where the ratio governs the voltage dependence through vrat.
Parameters
Section titled “Parameters”| # | Name | Description | Unit |
|---|---|---|---|
| 1 | DP | Frequency sensitivity of active power | pu/pu |
| 2 | alphat | Transient active power voltage exponent | — |
| 3 | alphas | Steady-state active power voltage exponent | — |
| 4 | xP_min | Minimum limit for | — |
| 5 | xP_max | Maximum limit for | — |
| 6 | DQ | Frequency sensitivity of reactive power | pu/pu |
| 7 | betat | Transient reactive power voltage exponent | — |
| 8 | betas | Steady-state reactive power voltage exponent | — |
| 9 | xQ_min | Minimum limit for | — |
| 10 | xQ_max | Maximum limit for | — |
| 11 | Tr | Load recovery time constant | s |
State Variables
Section titled “State Variables”| Variable | Description |
|---|---|
iy | -component of injected current |
ix | -component of injected current |
xp | Active power recovery variable |
xq | Reactive power recovery variable |
Observables: P, Q, xp, xq
Usage Example
Section titled “Usage Example”INJEC restld RESTLD1 BUS2 1. 1. 0. 0. 1.5 0.5 2.0 0.0 2.0 1.2 0.5 2.5 0.0 2.0 60.0 ;inj_PQ — Constant PQ Load
Section titled “inj_PQ — Constant PQ Load”Description
Section titled “Description”The simplest injector model: maintains constant active and reactive power consumption regardless of bus voltage or frequency. The power is fixed at its initial operating-point value. A small first-order filter (time constant Tout) drives the injected currents smoothly to their target values, preventing algebraic loops.
Scientific Description
Section titled “Scientific Description”The current references are set to deliver the initial powers and at the measured voltage :
These references pass through a first-order filter with time constant to produce the actual injected currents:
Parameters
Section titled “Parameters”| # | Name | Description | Unit |
|---|---|---|---|
| 1 | Tout | Output filter time constant (recommended: 0.01 s) | s |
Initial conditions , , are computed automatically at initialization.
State Variables
Section titled “State Variables”| Variable | Description |
|---|---|
ix | Injected -current |
iy | Injected -current |
Ixset | Current reference |
Iyset | Current reference |
P | Observed active power |
Q | Observed reactive power |
V | Bus voltage magnitude |
Observables: P, Q
Usage Example
Section titled “Usage Example”INJEC PQ LOAD_PQ BUS3 1. 1. 0. 0. 0.01 ;inj_theveq — Thévenin Equivalent
Section titled “inj_theveq — Thévenin Equivalent”Description
Section titled “Description”Models an external network or generator cluster as a Thévenin equivalent: an ideal voltage source behind a pure reactance . The model computes the internal voltage magnitude and phase angle at initialization from the initial bus conditions and holds them constant during the simulation. It is useful for representing neighbouring system equivalents or simplified machine representations.
Scientific Description
Section titled “Scientific Description”The Thévenin reactance is obtained from the specified short-circuit power (MVA):
The internal voltage phasor is computed at :
During simulation the injected currents satisfy:
Parameters
Section titled “Parameters”| # | Name | Description | Unit |
|---|---|---|---|
| 1 | XTH | Short-circuit power of the equivalent (converted to at initialization) | MVA |
Internal parameters ETH (Thévenin voltage magnitude, pu) and phase (internal angle, rad) are computed automatically.
State Variables
Section titled “State Variables”| Variable | Description |
|---|---|
iy | Injected -current |
ix | Injected -current |
Observables: P, Q (in MW and Mvar at system base)
Usage Example
Section titled “Usage Example”INJEC theveq EQUIV1 SLACK_BUS 1. 1. 0. 0. 2000.0 ;Induction Machine Models
Section titled “Induction Machine Models”inj_indmach1 — Single-Cage Induction Machine
Section titled “inj_indmach1 — Single-Cage Induction Machine”Description
Section titled “Description”A single-cage (single-rotor-circuit) induction machine model for motor loads. The machine is represented on its own MVA base (or inferred from load factor LF) with a shunt capacitor to represent power factor correction. The mechanical torque is a quadratic function of rotor speed. At initialization, the model solves nonlinear algebraic equations to find the operating-point slip and flux linkages.
Scientific Description
Section titled “Scientific Description”The machine uses the standard - reference-frame formulation with and . The rotor flux-linkage equations are:
where and is the rotor mechanical speed. The equations for the stator (with shunt susceptance ) are:
The rotor speed dynamics follow the swing equation:
where the electromagnetic torque is:
and the mechanical torque is the quadratic load curve:
Parameters
Section titled “Parameters”| # | Name | Description | Unit |
|---|---|---|---|
| 1 | SNOM | Machine nominal apparent power (0 = infer from LF) | MVA |
| 2 | RS | Stator resistance | pu |
| 3 | Lls | Stator leakage inductance | pu |
| 4 | LSR | Magnetizing inductance | pu |
| 5 | RR | Rotor resistance | pu |
| 6 | Llr | Rotor leakage inductance | pu |
| 7 | H | Machine inertia constant | s |
| 8 | A | Quadratic torque-speed coefficient | — |
| 9 | B | Linear torque-speed coefficient | — |
| 10 | LF | Load factor (for SNOM inference) | — |
State Variables
Section titled “State Variables”| Variable | Description |
|---|---|
iy | -component of stator current |
ix | -component of stator current |
psidr | -axis rotor flux linkage |
psiqr | -axis rotor flux linkage |
omegam | Rotor mechanical speed |
Observables: P, Qmot+comp, Qmot, omega, Tm
Usage Example
Section titled “Usage Example”INJEC indmach1 MTR1 BUS_MV 1. 1. 0. 0. 10.0 0.01 0.10 2.50 0.015 0.10 1.5 0.8 0.1 0.0 ;inj_indmach2 — Double-Cage Induction Machine
Section titled “inj_indmach2 — Double-Cage Induction Machine”Description
Section titled “Description”A double-cage (double-rotor-circuit) induction machine model following the Eurostag formulation. Two parallel rotor cages allow more accurate representation of the machine’s impedance-vs-frequency characteristic, which is especially important for the starting transient. The model structure mirrors inj_indmach1 but includes a second set of rotor flux states.
Scientific Description
Section titled “Scientific Description”The machine has parameters: stator resistance , stator leakage , magnetizing inductance , cage-1 resistance and leakage , cage-2 resistance and leakage . The state vector is with flux-linkage equations for each cage:
where and . The total electromagnetic torque combines contributions from both cages:
The swing equation is identical to inj_indmach1.
Parameters
Section titled “Parameters”| # | Name | Description | Unit |
|---|---|---|---|
| 1 | SNOM | Machine MVA rating (0 = infer from LF) | MVA |
| 2 | R1 | Stator resistance | pu |
| 3 | L1 | Stator leakage inductance | pu |
| 4 | Lm | Magnetizing inductance | pu |
| 5 | R2 | First cage resistance | pu |
| 6 | L2 | First cage leakage inductance | pu |
| 7 | R3 | Second cage resistance | pu |
| 8 | L3 | Second cage leakage inductance | pu |
| 9 | H | Inertia constant | s |
| 10 | A | Quadratic torque-speed coefficient | — |
| 11 | B | Linear torque-speed coefficient | — |
| 12 | LF | Load factor (for SNOM inference) | — |
State Variables
Section titled “State Variables”| Variable | Description |
|---|---|
iy | -component of stator current |
ix | -component of stator current |
psidr1 | -axis flux of first rotor cage |
psiqr1 | -axis flux of first rotor cage |
psidr2 | -axis flux of second rotor cage |
psiqr2 | -axis flux of second rotor cage |
omegam | Rotor mechanical speed |
Observables: P, Qmot+comp, Qmot, omega
Usage Example
Section titled “Usage Example”INJEC indmach2 MTR2 BUS_MV 1. 1. 0. 0. 10.0 0.01 0.08 2.00 0.02 0.06 0.04 0.10 1.5 0.8 0.1 0.0 ;inj_INDM1 — Alternative Induction Machine (INDM1)
Section titled “inj_INDM1 — Alternative Induction Machine (INDM1)”Description
Section titled “Description”An alternative single-cage induction machine model that uses the INI_indmach1 helper function for initialization. It is equivalent in physics to inj_indmach1 but implements the equations using RAMSES .txt-style model syntax with explicit state initialization calls. This can simplify parameterization when the helper function’s output is directly used.
Scientific Description
Section titled “Scientific Description”The model equations match those of inj_indmach1. The key distinction is the use of the INI_indmach1 function at parameter-evaluation time to pre-compute , , and the initial flux linkages and rotor speed, rather than solving the initialization system in Fortran. With and , the rotor flux equations are:
The rotor speed integral uses:
with a lower limit of .
Parameters
Section titled “Parameters”| # | Name | Description | Unit |
|---|---|---|---|
| 1 | SNOM | Machine MVA rating | MVA |
| 2 | RS | Stator resistance | pu |
| 3 | Lls | Stator leakage inductance | pu |
| 4 | LSR | Magnetizing inductance | pu |
| 5 | RR | Rotor resistance | pu |
| 6 | Llr | Rotor leakage inductance | pu |
| 7 | H | Inertia constant | s |
| 8 | A | Quadratic torque-speed coefficient | — |
| 9 | B | Linear torque-speed coefficient | — |
| 10 | LF | Load factor | — |
Computed internally: BSH (shunt susceptance), TM0 (initial mechanical torque), LSS, LRR.
State Variables
Section titled “State Variables”| Variable | Description |
|---|---|
Psidr | -axis rotor flux linkage |
Psiqr | -axis rotor flux linkage |
omegam | Rotor mechanical speed |
iym, ixm | Stator current components (on machine base) |
dPsidr, dPsiqr, domegam | Time-derivative auxiliary states |
Observables: omegam
Usage Example
Section titled “Usage Example”INJEC INDM1 MTR3 BUS_MV 1. 1. 0. 0. 10.0 0.01 0.10 2.50 0.015 0.10 1.5 0.8 0.1 0.0 ;Renewable Generation / Inverter-Based Resources
Section titled “Renewable Generation / Inverter-Based Resources”inj_IBG — Inverter-Based Generator (Generic IBR)
Section titled “inj_IBG — Inverter-Based Generator (Generic IBR)”Description
Section titled “Description”A generic inverter-based generation model suitable for representing aggregated distributed generation or any grid-following IBR. The model includes a Phase-Locked Loop (PLL), inner current control with active () and reactive () current commands, LVRT/HVRT logic with voltage-dependent reactive current injection, frequency-responsive active power modulation, and reconnection logic after disconnection events.
Scientific Description
Section titled “Scientific Description”The PLL tracks the terminal voltage angle via a second-order PI controller with a freeze option below :
where is the -axis terminal voltage in the PLL frame. The current commands and are derived from outer controls:
-
Active power is modulated by frequency according to frequency deadband
fdbd: -
During voltage dips (LVRT), reactive current is boosted:
-
Current magnitude is limited to with priority to reactive current during LVRT.
The injected currents in - frame are:
Parameters
Section titled “Parameters”| # | Name | Description | Unit |
|---|---|---|---|
| 1 | Imax | Maximum current magnitude | pu |
| 2 | IN | Nominal current | pu |
| 3 | Iprate | Active current ramp rate | pu/s |
| 4 | Tg | Generator time constant | s |
| 5 | Tm | Measurement filter time constant | s |
| 6 | tLVRT1 | LVRT ride-through time threshold 1 | s |
| 7 | tLVRT2 | LVRT ride-through time threshold 2 | s |
| 8 | tLVRTint | LVRT integration time | s |
| 9 | Vmax | Maximum voltage for operation | pu |
| 10 | tau | PLL response time | ms |
| 11 | Vminpll | Voltage below which PLL is frozen | pu |
| 12 | a | LVRT voltage-current curve slope | — |
| 13 | Vmin | Minimum LVRT voltage | pu |
| 14 | Vint | Intermediate LVRT voltage | pu |
| 15 | fmin | Minimum frequency for operation | pu |
| 16 | fmax | Maximum frequency for operation | pu |
| 17 | fstart | Frequency threshold for P modulation | pu |
| 18 | b | Frequency droop gain | — |
| 19 | fr | Reference frequency | pu |
| 20 | Tr | Reconnection delay after trip | s |
| 21 | Re | Grid equivalent resistance | pu |
| 22 | Xe | Grid equivalent reactance | pu |
| 23 | CM1 | LVRT control mode flag | — |
| 24 | kRCI | Reactive current injection gain (LVRT) | — |
| 25 | kRCA | Reactive current absorption gain (HVRT) | — |
| 26 | m | Active-reactive current priority parameter | — |
| 27 | n | Active-reactive current priority parameter | — |
| 28 | dbmin | Frequency deadband lower limit | pu |
| 29 | dbmax | Frequency deadband upper limit | pu |
| 30 | HVRT | HVRT flag | — |
| 31 | LVRT | LVRT flag | — |
| 32 | CM2 | Control mode 2 flag | — |
| 33 | Vtrip | Trip voltage threshold | pu |
State Variables
Section titled “State Variables”| Variable | Description |
|---|---|
vxl, vyl | Filtered terminal voltage components |
Vt | Terminal voltage magnitude |
PLLPhaseAngle | PLL phase angle |
Vm | Voltage magnitude measurement |
Ip, Iq | Active and reactive current outputs |
Ipcmd, Iqcmd | Current commands |
Iqmax, Iqmin | Reactive current limits |
Ipmax, Ipmin | Active current limits |
DeltaW, DeltaWf | Frequency deviation and filtered value |
Pgen, Qgen | Generated active and reactive power |
Usage Example
Section titled “Usage Example”INJEC IBG IBG1 BUS_GEN 1. 1. 0. 0. 1.2 1.0 0.5 0.02 0.01 0.5 1.0 0.05 1.1 20.0 0.1 2.0 0.1 0.5 0.95 1.05 0.0 2.0 1.0 1.0 0.0 0.05 1 2.0 1.5 2.0 2.0 -0.02 0.02 1 1 1 0.85 ;inj_WT3WithChanges — Type 3 Wind Turbine (DFIG)
Section titled “inj_WT3WithChanges — Type 3 Wind Turbine (DFIG)”Description
Section titled “Description”A Type 3 wind turbine model implementing the WECC composite structure with four coupled sub-models:
- REPC_A: Plant-level controller (reactive power / voltage regulation, frequency response)
- REEC_A: Electrical controller (inner - current control, LVRT/HVRT logic)
- WTGTRQ_A: Generator torque controller (rotor speed regulation via electrical torque command)
- WTGPT_A: Pitch controller (aerodynamic power limitation)
- WTGAR_A: Aerodynamic rotor model
- WTGT_A: Two-mass mechanical drivetrain (turbine inertia , generator inertia , shaft stiffness , damping )
The doubly-fed induction generator (DFIG) topology allows decoupled control of active and reactive power via rotor-side converter injection.
Scientific Description
Section titled “Scientific Description”The two-mass drivetrain model governs rotor dynamics:
The torque controller (WTGTRQ_A) uses a piecewise power-speed characteristic:
The electrical controller (REEC_A) provides reactive current injection during voltage dips:
with limiter .
The plant controller (REPC_A) optionally provides frequency response:
Parameters (selected key parameters)
Section titled “Parameters (selected key parameters)”| # | Name | Sub-model | Description | Unit |
|---|---|---|---|---|
| 1 | SNOM | — | Nominal power | MW |
| 2–32 | REPC_A | Plant controller | Reactive/voltage/frequency control | various |
| 33–46 | WTGTRQ_A | Torque ctrl | Speed-torque lookup table, rate limits | various |
| 47–56 | WTGPT_A | Pitch ctrl | Pitch PI gains, angle limits, rate limits | various |
| 57–58 | WTGAR_A | Aero | Aerodynamic gain, initial pitch angle | — |
| 59–62 | WTGT_A | Drivetrain | , , , | s, pu |
| 63–97 | REEC_A | Elec ctrl | LVRT/HVRT, current limits, inner PI | various |
| 98+ | REGC_A | Generator | Generator electrical conversion | various |
Full parameter list has 80+ entries; refer to the embedded Fortran header comments in inj_WT3WithChanges.f90.
Usage Example
Section titled “Usage Example”INJEC WT3WithChanges WT3_1 BUS_WIND 1. 1. 0. 0. 100.0 0.0 0.02 0 0.0 0.05 0 0.0 0.3 -0.3 2.0 0.4 0.3 -0.3 0.0 0.15 0.9 0.05 0.0 -0.06 0.06 -0.05 0.05 0.05 -0.05 2.0 1.0 1.0 -1.0 0.02 0 0 0.8 1.5 1.5 0.01 0.5 ... ;inj_WT4WithChanges — Type 4 Wind Turbine (Full Converter)
Section titled “inj_WT4WithChanges — Type 4 Wind Turbine (Full Converter)”Description
Section titled “Description”A Type 4 wind turbine with full-rated converter. Unlike Type 3, the generator is fully decoupled from the grid through a back-to-back converter. The model implements the same WECC framework as WT3 but without the doubly-fed rotor circuit: the mechanical sub-model is a single-mass (or two-mass) drive train, and all electrical power passes through the converter. Sub-models include REPC_A (plant controller), REEC_A (electrical controller), WTGT_A (drivetrain), and REGC_A (generator/converter).
Scientific Description
Section titled “Scientific Description”The two-mass drivetrain is identical to WT3:
There is no pitch controller or aerodynamic rotor in the basic Type 4 configuration; the active power reference is supplied directly (or from REPC_A), and rate limits dPmax/dPmin apply to the power order ramp.
The REEC_A electrical controller supplies current commands with the same LVRT/HVRT logic as WT3, with current limits through the converter lookup table (piecewise linear in voltage: for active current and for reactive).
Parameters (selected key parameters)
Section titled “Parameters (selected key parameters)”| # | Name | Sub-model | Description | Unit |
|---|---|---|---|---|
| 1 | SNOM | — | Nominal power | MW |
| 2–32 | REPC_A | Plant ctrl | Same as WT3 | various |
| 33–37 | WTGT_A | Drivetrain | , , , , | s, pu |
| 38–80 | REEC_A | Elec ctrl | LVRT, current limits, PI gains | various |
| 81+ | REGC_A | Generator | Converter electrical model | various |
Usage Example
Section titled “Usage Example”INJEC WT4WithChanges WT4_1 BUS_WIND 1. 1. 0. 0. 100.0 0.0 0.02 0 0.0 0.05 0 0.0 0.3 -0.3 2.0 0.4 0.3 -0.3 0.0 0.15 0.9 0.05 0.0 -0.06 0.06 -0.05 0.05 0.05 -0.05 2.0 1.0 1.0 -1.0 0.02 0 0 5.0 1.5 1.0 1.5 20.0 ... ;inj_PVG — Photovoltaic Generator
Section titled “inj_PVG — Photovoltaic Generator”Description
Section titled “Description”A photovoltaic generator model with similar WECC-derived structure to the wind turbine models. The model includes a plant controller (voltage/reactive power regulation), an electrical controller (current limits, LVRT), and generator/converter representation. Unlike wind turbines, there is no mechanical drive train; the active power set-point follows an irradiance input or a fixed reference. LVRT/HVRT logic and current limiting are identical to the Type 4 wind model.
Scientific Description
Section titled “Scientific Description”The PV generator delivers active and reactive power through current commands:
subject to the constraint . The inner current loop is a first-order filter:
Low-voltage power-logic (LVPL) limits active current during deep voltage sags via a piecewise-linear function of with breakpoints lvpnt0, lvpnt1, Lvpl1. HVRT and LVRT timers control disconnection and reconnection.
Parameters (selected)
Section titled “Parameters (selected)”| # | Name | Description | Unit |
|---|---|---|---|
| 1 | Imax | Maximum converter current | pu |
| 2 | IN | Nominal current | pu |
| 3 | ratemax | Reconnection ramp rate | pu/s |
| 4 | Tg | Active current filter time constant | s |
| 5 | Tm | Reactive current filter time constant | s |
| 6–9 | LVRT timers | tLVRT1, tLVRT2, tLVRTint, Vmax | s, pu |
| 10 | kpll | PLL gain | — |
| 11 | Vminpll | PLL freeze voltage | pu |
| 12–14 | LVRT curve | a, Vmin, Vint | — |
| 21–22 | Re, Xe | Grid equivalent impedance | pu |
| 23–29 | Current control | CM1, kRCI, kRCA, m, n, dbmin, dbmax | — |
| 34 | BM | Battery module flag | — |
Usage Example
Section titled “Usage Example”INJEC PVG PV1 BUS_PV 1. 1. 0. 0. 1.2 1.0 0.5 0.02 0.01 0.5 1.0 0.05 1.1 20.0 0.1 2.0 0.1 0.5 0.95 1.05 0.0 2.0 1.0 1.0 0.0 0.05 1 2.0 1.5 2.0 2.0 -0.02 0.02 1 1 1 0.85 0 ;inj_GFOR — Grid-Forming Converter
Section titled “inj_GFOR — Grid-Forming Converter”Description
Section titled “Description”A grid-forming voltage source converter implementing Virtual Synchronous Machine (VSM) dynamics. The converter’s output voltage phase angle and magnitude are controlled to mimic the behaviour of a synchronous machine: an inertia-like integrator creates a synthetic swing equation, a droop loop regulates frequency, and a current limiter protects against overcurrents using a virtual impedance that attenuates the modulated voltage.
Scientific Description
Section titled “Scientific Description”The phase reactor algebraic equations (pu on machine base) are:
The VSM swing equation is:
The attenuation factor limits power during overcurrent:
When the current exceeds , the virtual impedance modifies the modulated voltage:
Parameters
Section titled “Parameters”| # | Name | Description | Unit |
|---|---|---|---|
| 1 | Rpr | Phase reactor resistance | pu |
| 2 | Lpr | Phase reactor inductance | pu |
| 3 | r | Transformer turns ratio | — |
| 4 | Snom | Nominal apparent power | MVA |
| 5 | H | Inertia constant | s |
| 6 | RVSC | Steady-state frequency droop | pu |
| 7 | Kp | Proportional gain in active power control | — |
| 8 | Imax | Maximum current | pu |
| 9 | n | Exponent in attenuation factor | — |
| 10 | Kc | Gain of current limiter integral control | — |
| 11 | L1 | Lower limit of current correction | pu |
| 12 | L2 | Upper limit of current correction | pu |
State Variables
Section titled “State Variables”| Variable | Description |
|---|---|
wref | Angular speed of reference axes |
ixt, iyt | Converter-side currents (on machine base) |
Vm | Modulated voltage magnitude |
deltam | Modulated voltage phase angle |
P | Active power (on Snom base) |
gamma | Attenuation factor |
omegam1 | VSM inertia integrator output |
omegam | VSM frequency estimate |
deltaomegam | Phase-angle integrator input |
I | Current magnitude |
deltaVm_un, deltaVm | Voltage corrections (before/after limiter) |
Pout, Qout | Active and reactive power (MW, Mvar) |
Usage Example
Section titled “Usage Example”INJEC GFOR GFM1 BUS_BESS 1. 1. 0. 0. 0.005 0.15 1.0 50.0 5.0 0.05 0.01 1.1 2.0 0.5 0.0 0.05 ;inj_GFOR_v2 — Grid-Forming Converter v2
Section titled “inj_GFOR_v2 — Grid-Forming Converter v2”Description
Section titled “Description”An advanced grid-forming VSC model with three selectable active-power synchronization modes, comprehensive reactive-power control options, DC-link dynamics, and integrated battery storage. The model is suitable for detailed studies of grid-forming inverters in islanded or weak-grid conditions.
Synchronization mode (selected by delta_m_switch):
- VSM — Virtual Synchronous Machine: swing equation with inertia constant , droop , and damping
- Droop — P- droop control filtered by
- Selfsync — Self-synchronization using power error integration with gains and
Reactive power control (selected by QV_switch):
- 0: No reactive power control ()
- 1: Q-V droop control (Options A, B, or C switchable via
QV_switch_state)
Current limiting (selected by VI_CL_switch):
- 0: Virtual Impedance — attenuates modulated voltage using virtual and
- 1: Current Limiter — integral control corrects to enforce
DC link and battery: The DC voltage evolves according to capacitor dynamics. A PI controller regulates to its setpoint. Battery SOC is tracked via integration of battery current. SOC limits automatically clamp battery current.
Scientific Description
Section titled “Scientific Description”VSM active power loop:
Droop active power loop:
Selfsync active power loop:
Phase reactor (algebraic):
Virtual Impedance current limiting:
Modulation index:
DC link dynamics:
where is the non-battery DC current (proportional to AC power) and is the battery current filtered by .
Battery SOC:
Battery current is clamped by rated current and by SOC limits:
Parameters
Section titled “Parameters”| # | Name | Description | Unit |
|---|---|---|---|
| 1 | Snom | Nominal apparent power | MVA |
| 2 | Pnom | Nominal DC-side power (base) | MW |
| 3 | VB | AC base voltage | kV |
| 4 | Vdc0pu | Initial DC link voltage | pu |
| 5 | Rpr | Phase reactor resistance | pu |
| 6 | Lpr | Phase reactor inductance | pu |
| 7 | r | Transformer turns ratio | — |
| 8 | H | VSM inertia constant | s |
| 9 | R_vsm | VSM frequency droop | pu |
| 10 | Kp | VSM damping constant | — |
| 11 | Td | Droop filter time constant | s |
| 12 | Ts | Selfsync filter time constant | s |
| 13 | Ks | Selfsync integral gain | — |
| 14 | Ks_prime | Selfsync feedforward gain | — |
| 15 | mp | Droop proportional gain (P-) | — |
| 16 | T_QF | Reactive power filter time constant | s |
| 17 | Kq | Reactive power control gain | — |
| 18 | Kqvp | Q-V PI proportional gain | — |
| 19 | Kqvi | Q-V PI integral gain | — |
| 20 | Tvf | Voltage filter time constant | s |
| 21 | dv | Voltage control proportional gain | — |
| 22 | Tconv | Converter delay time constant | s |
| 23 | Imax | Maximum current | pu |
| 24 | Ilim | Current threshold for virtual impedance activation | pu |
| 25 | n | Exponent in attenuation factor | — |
| 26 | Kc | Current limiter integral gain | — |
| 27 | L1 | Lower limit of current correction | pu |
| 28 | L2 | Upper limit of current correction | pu |
| 29 | Kpvi | Virtual resistance gain | — |
| 30 | sigma_xr | Virtual reactance-to-resistance ratio | — |
| 31 | QV_switch | Reactive power control flag (0=none, 1=active) | flag |
| 32 | VI_CL_switch | Current limiting mode (0=VI, 1=CL) | flag |
| 33 | delta_m_switch | Synchronization mode (1=VSM, 2=Droop, 3=Selfsync) | flag |
| 34 | Cdcpu | DC capacitance | pu |
| 35 | Kppi | DC voltage PI proportional gain | — |
| 36 | Kipi | DC voltage PI integral gain | — |
| 37 | Tsimp | Battery source simplified transfer function time constant | s |
| 38 | m_max | Upper limit on modulation index | — |
| 39 | SOC0 | Initial state of charge | — |
| 40 | Q_battery | Battery nominal capacity | Ah |
| 41 | Vbat_pu | Battery voltage | pu |
| 42 | I_batrated | Battery rated current | kA |
| 43 | SOC_upperlimit | SOC upper limit | % |
| 44 | SOC_lowerlimit | SOC lower limit | % |
| 45 | BatFrac | Fraction of power supplied by battery | — |
State Variables (selected)
Section titled “State Variables (selected)”| Variable | Description |
|---|---|
Vmo_pu_machbase | Modulated voltage setpoint (machine base) |
wref | Reference angular speed |
ixt, iyt | Converter-side currents |
delta_m_rad | Modulated voltage phase angle |
delta_m_VSM | Phase angle from VSM integrator |
delta_m_droop | Phase angle from droop integrator |
delta_m_sync | Phase angle from selfsync integrator |
P | Active power (Snom base) |
P_m | Droop-filtered active power |
P_s | Selfsync-filtered active power |
omega_m | VSM frequency (pu) |
I_pu_machbase | Current magnitude |
Rvi, Xvi | Virtual impedance components |
Vm_pu_machbase | Modulated voltage magnitude |
vdc | DC link voltage |
SOC | Battery state of charge |
i_int | Integrated battery current (for SOC) |
Pout_MW, Qout_MVAR | Power outputs |
Observables: Vm_pu_machbase, delta_m_rad, omega_m, Pout_MW, Qout_MVAR, I_pu_machbase, i_dc, vdc, SOC, and more.
Usage Example
Section titled “Usage Example”INJEC GFOR_v2 GFOR_V2_VSM BUS_BESS 1. 1. 0. 0. 50.0 50.0 20.0 1.0 0.005 0.15 1.0 5.0 0.05 0.01 0.5 0.5 1.0 0.0 0.02 0.5 1.0 1.0 5.0 0.1 0.0 0.05 1.1 0.9 2.0 0.5 0.0 0.05 0.5 1.5 1 0 1 0.005 0.5 5.0 0.05 1.05 0.5 100.0 1.0 0.1 90.0 10.0 0.5 ;INJEC GFOR_v2 GFOR_V2_DRP BUS_BESS 1. 1. 0. 0. 50.0 50.0 20.0 1.0 0.005 0.15 1.0 5.0 0.05 0.01 0.5 0.5 1.0 0.0 0.02 0.5 1.0 1.0 5.0 0.1 0.0 0.05 1.1 0.9 2.0 0.5 0.0 0.05 0.5 1.5 1 0 2 0.005 0.5 5.0 0.05 1.05 0.5 100.0 1.0 0.1 90.0 10.0 0.5 ;INJEC GFOR_v2 GFOR_V2_SS BUS_BESS 1. 1. 0. 0. 50.0 50.0 20.0 1.0 0.005 0.15 1.0 0.0 0.0 0.0 0.5 0.5 1.0 0.0 0.0 0.5 1.0 1.0 5.0 0.1 0.0 0.05 1.1 0.9 2.0 0.5 0.0 0.05 0.5 1.5 1 0 3 0.005 0.5 5.0 0.05 1.05 0.5 100.0 1.0 0.1 90.0 10.0 0.5 ;inj_GFol — Grid-Following Converter
Section titled “inj_GFol — Grid-Following Converter”Description
Section titled “Description”A grid-following VSC model for representing inverter-interfaced generation or storage in following mode. The converter synchronises to the grid via a PLL and regulates active and reactive power through outer PI controllers and an inner current loop. It includes low-voltage protection (PLL freeze), reactive current support during voltage dips, a DC link energy balance equation, and optional voltage-droop reactive support.
Scientific Description
Section titled “Scientific Description”The PLL tracks the terminal voltage angle using:
where is the PLL response time and is the -axis voltage. The phase reactor in - frame:
Active power outer loop:
Reactive outer loop (voltage droop or Q control):
During voltage dips below :
The DC power balance (assuming lossless converter):
Parameters
Section titled “Parameters”| # | Name | Description | Unit |
|---|---|---|---|
| 1 | R | Series transformer resistance | pu |
| 2 | L | Series transformer reactance/inductance | pu |
| 3 | Rc | Virtual resistance for voltage control | pu |
| 4 | Xc | Virtual reactance for voltage control | pu |
| 5 | Snom | Nominal apparent power | MVA |
| 6 | Pnom | Nominal active power | MW |
| 7 | Kpp | Active power PI: proportional gain | — |
| 8 | Kip | Active power PI: integral gain | — |
| 9 | T_filp | Active power recovery filter time constant | s |
| 10 | dPdt_min | Minimum active power ramp rate | pu/s |
| 11 | dPdt_max | Maximum active power ramp rate | pu/s |
| 12 | Kpq | Reactive power PI: proportional gain | — |
| 13 | Kiq | Reactive power PI: integral gain | — |
| 14 | tau | PLL response time | s |
| 15 | vdc | DC voltage setpoint | pu |
| 16 | Vs_pll | PLL freeze voltage threshold | pu |
| 17 | Imax | Maximum current | pu |
| 18 | Vs1 | Voltage threshold for reactive support activation | pu |
| 19 | Vs2 | Voltage threshold for full reactive support | pu |
| 20 | qlim | Reactive power limit (±) | pu |
| 21 | vqswitch | 1 = voltage control, 0 = reactive power control | flag |
State Variables
Section titled “State Variables”| Variable | Description |
|---|---|
P | Active power delivered |
ix_1, iy_1 | VSC currents in - frame (Snom base) |
w_pll, Dw_pll | PLL speed and deviation |
theta_pll | PLL angle |
id, iq | - currents |
vmd, vmq | Modulated voltages |
PB, VB | PI integrator states |
idc | DC current |
id_lim | Limited active current |
Q | Reactive power |
P_MW, Q_MVAr | Power outputs |
Observables: Pdc, Q, P_MW, Q_MVAr, I, V, PSnom
Usage Example
Section titled “Usage Example”INJEC GFol GFOL1 BUS_IBR 1. 1. 0. 0. 0.005 0.15 0.0 0.0 100.0 100.0 2.0 20.0 0.1 -10.0 10.0 2.0 20.0 0.05 1.0 0.1 1.1 0.9 0.7 0.4 1 ;Energy Storage
Section titled “Energy Storage”inj_BESSWithChanges — Battery Energy Storage System
Section titled “inj_BESSWithChanges — Battery Energy Storage System”Description
Section titled “Description”A comprehensive BESS model implementing the full WECC framework (REPC_A + REEC_C + REGC_A) plus battery state of charge (SOC) tracking. The model supports both grid-following operation (bidirectional active power dispatch) and reactive power / voltage regulation. It is built on the same REPC_A plant controller as the wind turbine models, and uses the REEC_C converter electrical controller which handles a piecewise-linear -vs- and -vs- characteristic for fault ride-through.
The battery SOC evolves through integration of injected power:
with hard clamps at SOCmin and SOCmax that modify the active power limits Pmax/Pmin dynamically:
Parameters (key parameters)
Section titled “Parameters (key parameters)”| # | Name | Sub-model | Description | Unit |
|---|---|---|---|---|
| 1 | SNOM | — | Nominal power | MW |
| 2–32 | — | REPC_A | Plant controller (same as WT3/WT4) | various |
| 33–76 | — | REEC_C | Electrical controller with piecewise , | various |
| 68 | CapBat | BESS | Battery energy capacity | MWh |
| 69 | SOCini | BESS | Initial state of charge | pu |
| 70 | SOCmax | BESS | Maximum SOC limit | pu |
| 71 | SOCmin | BESS | Minimum SOC limit | pu |
| 72–73 | dPmax, dPmin | BESS | Active power ramp rate limits | pu/s |
| 74–75 | pmax, pmin | REEC_C | Active current limits (pu on SNOM) | pu |
| 76 | Tpord | REEC_C | Active power order time constant | s |
Full parameter listing (125 parameters) is detailed in the embedded header of inj_BESSWithChanges.f90.
State Variables
Section titled “State Variables”The BESS model uses over 40 internal states reflecting the three sub-models. Key states include:
| Variable | Description |
|---|---|
SOC | State of charge |
Pref | Active power reference |
Qext | Reactive power reference from REPC_A |
Ip, Iq | Active/reactive current outputs |
PLLPhaseAngle | PLL phase angle |
Pgen, Qgen | Generated powers |
Usage Example
Section titled “Usage Example”INJEC BESSWithChanges BESS1 BUS_ST 1. 1. 0. 0. 100.0 0.0 0.02 0 0.0 0.05 0 0.0 0.3 -0.3 2.0 0.4 0.3 -0.3 0.0 0.15 0.9 0.05 0.0 -0.06 0.06 -0.05 0.05 0.05 -0.05 2.0 1.0 1.0 -1.0 0.02 0 0 0.1 0.1 0.02 1.0 0.0 -0.2 0.2 0.2 -0.2 0.6 0.4 0.6 -0.6 1.1 0.9 1.0 0.5 0.01 0.01 0.05 0.9 0.2 0.9 0.1 0.9 -0.1 0.5 -0.5 0.5 -0.5 1.0 -1.0 0.5 -0.5 50.0 0.7 0.9 0.1 5.0 -5.0 1.0 -1.0 0.05 1.1 0.0 2 0.01 ;Special / Utility
Section titled “Special / Utility”inj_svc_hq_generic1 — SVC (Hydro-Québec Generic)
Section titled “inj_svc_hq_generic1 — SVC (Hydro-Québec Generic)”Description
Section titled “Description”A Static VAr Compensator model based on the Hydro-Québec generic SVC structure. It consists of two lead-lag blocks (representing the measurement chain and voltage regulator), a PI voltage controller, and a susceptance limiter. An optional PSS (power system stabiliser) output can add a damping signal to the voltage reference. The model represents the reactive power exchange of the SVC as a variable susceptance .
Scientific Description
Section titled “Scientific Description”The voltage measurement and regulator chain consists of two transfer functions in cascade:
The PI voltage controller computes the susceptance command:
The susceptance is limited to , then normalised to the nominal susceptance :
The injected currents satisfy the reactive power balance:
Parameters
Section titled “Parameters”| # | Name | Description | Unit |
|---|---|---|---|
| 1 | G1 | Gain of first regulator block | — |
| 2 | T1 | Time constant of first regulator block | s |
| 3 | a | Zero time constant of first regulator block | s |
| 4 | K1 | Gain of second stage in first block | — |
| 5 | L1 | Saturation limit for first block output | pu |
| 6 | G2 | Gain of second regulator block | — |
| 7 | T2 | Time constant of second regulator block | s |
| 8 | b | Zero time constant of second regulator block | s |
| 9 | K2 | Gain of second block | — |
| 10 | L2 | Saturation limit for second block output | pu |
| 11 | Ltot | Total limit on regulator output | pu |
| 12 | Kp | PI controller proportional gain | — |
| 13 | Ki | PI controller integral gain | — |
| 14 | Bp | Slope of V-Q droop characteristic | pu/pu |
| 15 | Bmax | Maximum susceptance | pu |
| 16 | Bmin | Minimum susceptance | pu |
| 17 | Bnom | Nominal susceptance (MVAr at 1 pu) | MVAr |
Computed parameter: Vref (voltage setpoint, computed at initialization)
State Variables
Section titled “State Variables”| Variable | Description |
|---|---|
iy | -component of injected current |
ix | -component of injected current |
| Regulator states (×3) | Outputs of lead-lag and PI blocks |
| PSS states (×2) | PSS washout and lead-lag output |
Bsvc | SVC susceptance (normalised) |
Observables: Q, dvpss, Bsvc, Vref, Vb
Usage Example
Section titled “Usage Example”INJEC svc_hq_generic1 SVC1 BUS_SVC 1. 1. 0. 0. 1.0 0.02 0.01 1.0 0.5 1.0 0.05 0.02 1.0 0.5 0.8 100.0 500.0 0.03 200.0 -100.0 100.0 ;inj_vfault — Voltage Fault Injector
Section titled “inj_vfault — Voltage Fault Injector”Description
Section titled “Description”A utility model for testing LVRT behaviour and fault-ride-through capabilities. It injects a shunt admittance into the network at a specified bus, driving the bus voltage to a target value vfault_val set externally (through the RAMSES disturbance interface). The admittance is updated iteratively using a secant method until the voltage target is reached to within ±0.5%. This model requires no user parameters in the data file — all control is through the disturbance mechanism.
Scientific Description
Section titled “Scientific Description”The injected currents implement a shunt admittance :
The fault admittance is updated via the secant iteration:
where the derivative is estimated numerically from consecutive iteration steps. The discrete state tracks convergence: when pu. Up to 10 correction steps are attempted; if convergence is not reached, the simulation halts with an error message.
Parameters
Section titled “Parameters”No user parameters required. The target voltage vfault_val and injector number are set via the RAMSES disturbance module.
State Variables
Section titled “State Variables”| Variable | Description |
|---|---|
ix | -component of injected current |
iy | -component of injected current |
Discrete state: z(1) — convergence flag (0 = iterating, 1 = converged)
Observable: Xfault — current fault admittance
Usage Example
Section titled “Usage Example”INJEC vfault FAULT_TEST BUS_FAULT ;The fault voltage level is set through the RAMSES disturbance file or programmatically via vfault_val.