Component Library

This page documents all the pre-built components available in the PowerDynamics.jl library.

PowerDynamics.Library Under Active Development

The PowerDynamics.Library component library is currently excluded from semantic versioning and is under heavy development.

While PowerDynamics itself follows semantic versioning, the Library submodule's API is highly unstable and variable names, function signatures, and model interfaces may change frequently without notice. If you are using specific models from PowerDynamics.Library in their current state, we strongly recommend copying them to your own source code to avoid breaking changes in future updates.

Building Blocks

The following building blocks can be used to construct custom control systems and machine models.

Basic Blocks

PowerDynamics.Library.SimpleLag โ€” Constant

SimpleLag block

    โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
 in โ”‚    K    โ”‚ out
โ•ถโ”€โ”€โ”€โ”คโ•ถโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ดโ”œโ”€โ”€โ”€โ”€โ•ด
    โ”‚ 1 + s T โ”‚
    โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Additional structural parameters:

  • guess=0/default: initial guess/default for the internal state (equals output in steady state)
  • allowzeroT: if true, the lag is bypassed when T=0 (this does not reduce the model order)

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.SimpleLead โ€” Constant

SimpleLead block

    โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
 in โ”‚ 1 + s T โ”‚ out
โ•ถโ”€โ”€โ”€โ”คโ•ถโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ดโ”œโ”€โ”€โ”€โ”€โ•ด
    โ”‚    K    โ”‚
    โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

This block directly uses Dt(in), therefore it does not add additional states but may not be used in all scenarios!

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.LeadLag โ€” Constant

LeadLag block

    โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
 in โ”‚  1 + sT1 โ”‚ out
โ•ถโ”€โ”€โ”€โ”คKโ•ถโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ดโ”œโ”€โ”€โ”€โ”€โ•ด
    โ”‚  1 + sT2 โ”‚
    โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Additional structural parameters:

  • guess=0: initial guess for the internal state (equals input in steady state)
  • allowzeroT: if true, the lead-lag is bypassed when T1=0 and T2=0 (this does not reduce the model order)

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.Derivative โ€” Constant

Derivative approximation block. Modeled after Modelica.Blocks.Continuous.Derivative

    โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
 in โ”‚   s K   โ”‚ out
โ•ถโ”€โ”€โ”€โ”คโ•ถโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ดโ”œโ”€โ”€โ”€โ”€โ•ด
    โ”‚ 1 + s T โ”‚
    โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Additional structural parameters:

  • guess=0: initial guess for the internal state (equals input in steady state)

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.SimpleGain โ€” Constant

Simple gain block

 in โ•ญโ”€โ”€โ”€โ•ฎ out
โ•ถโ”€โ”€โ”€โ”ค K โ”œโ”€โ”€โ”€โ”€โ•ด
    โ•ฐโ”€โ”€โ”€โ•ฏ

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.SimpleLagLim โ€” Function

SimpleLagLim block

              __ outMax
             /
      โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
   in โ”‚    K    โ”‚ out
  โ•ถโ”€โ”€โ”€โ”คโ•ถโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ดโ”œโ”€โ”€โ”€โ”€โ•ด
      โ”‚ 1 + s T โ”‚
      โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
outMin __/

Additional structural parameters:

  • guess=0: initial guess for the internal state (equals output in steady state)

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.LimIntegrator โ€” Function

LimIntegrator block

              __ outMax
             /
        โ•ญโ”€โ”€โ”€โ”€โ”€โ•ฎ
     in โ”‚  K  โ”‚ out
    โ•ถโ”€โ”€โ”€โ”คโ•ถโ”€โ”€โ”€โ•ดโ”œโ”€โ”€โ”€โ”€โ•ด
        โ”‚ s T โ”‚
        โ•ฐโ”€โ”€โ”€โ”€โ”€โ•ฏ
outMin __/

Additional structural parameters:

  • guess=0: initial guess for the internal state (equals output in steady state)

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.DeadZone โ€” Constant

DeadZone block, modeled after Modelica.Blocks.Nonlinear.DeadZone

        โ”‚    โ•ฑ
   uMin โ”‚   โ•ฑ
โ”€โ”€โ”€โ”€โ”€โ”ผโ•ผโ”โ”ฟโ”โ•พโ”ผโ”€โ”€โ”€โ”€โ”€
    โ•ฑ   โ”‚ uMax
   โ•ฑ    โ”‚

A dead zone nonlinearity that outputs zero when the input is within the specified band [uMin, uMax].

  • If in < uMin: out = in - uMin (negative linear)
  • If uMin โ‰ค in โ‰ค uMax: out = 0 (dead zone)
  • If in > uMax: out = in - uMax (positive linear)

Structural parameters:

  • uMax: Upper dead zone limit
  • uMin=-uMax: Lower dead zone limit (defaults to -uMax for symmetric dead zone)

For a concrete list of variables and parameters please check the model source on GitHub.

source

Utility Functions

PowerDynamics.Library.ss_to_mtkmodel โ€” Function
ss_to_mtkmodel(A, B, C, D; name=nothing, guesses=zeros(size(A,1)))

Convert a state-space representation to a ModelingToolkit model.

Matrices can be either of real numbers or symbolic parameters/terms.

Returns A System object with variables in (input), out (output), and xโ‚, xโ‚‚, ... (states).

source
PowerDynamics.Library.siso_tf_to_ss โ€” Function
siso_tf_to_ss(num, den)

Convert a SISO transfer function to state-space representation.

Takes polynomial coefficients for numerator and denominator and returns state-space matrices (A, B, C, D). The transfer function is represented as:

       num[1]sโฟ + num[2]sโฟโปยน + ... + num[end]
G(s) = โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
       den[1]sแต + den[2]sแตโปยน + ... + den[end]

Arguments

  • num: Vector of numerator coefficients (highest degree first)
  • den: Vector of denominator coefficients (highest degree first)

Returns

A tuple (A, B, C, D) of state-space matrices in controller canonical form.

Notes

  • Leading zeros in num/den are automatically truncated
  • Transfer function must be proper (numerator degree โ‰ค denominator degree)
  • Adapted from SymbolicControlSystems.jl (Copyright (c) 2020 Fredrik Bagge Carlson, MIT License)
source

Saturation Functions

Slack Models

Algebraic and Differential Slack

PowerDynamics.Library.SlackAlgebraic โ€” Constant
SlackAlgebraic

Algebraic slack bus that enforces constant real and imaginary voltage components.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.SlackDifferential โ€” Constant
SlackDifferential

Slack bus with differential voltage states, holding voltage constant via zero derivatives.

For a concrete list of variables and parameters please check the model source on GitHub.

source

Machine Models

Synchronous Machine Models

PowerDynamics.Library.PSSE_GENCLS โ€” Constant
PSSE_GENCLS

This model is a port of the OpenIPSL Electrical.Machines.PSSE.GENCLS model, maintaining the same mathematical formulation while adapting to PowerDynamics/ModelingToolkit conventions.

Validation

Validated against the OpenIPSL SMIB testcase Tests.Machines.PSSE.GENCLS. See validation plot generated by automatic validation script in /test/OpenIPSL_test.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.PSSE_GENROU โ€” Function
PSSE_GENROU

This model is a port of the OpenIPSL Electrical.Machines.PSSE.GENROU model, maintaining the same mathematical formulation while adapting to PowerDynamics/ModelingToolkit conventions.

Validation

Validated against the OpenIPSL SMIB testcase Tests.Machines.PSSE.GENROU. See validation plot generated by automatic validation script in /test/OpenIPSL_test.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.PSSE_GENROE โ€” Function
PSSE_GENROE

This model is a port of the OpenIPSL Electrical.Machines.PSSE.GENROE model, maintaining the same mathematical formulation while adapting to PowerDynamics/ModelingToolkit conventions.

Validation

Validated against the OpenIPSL SMIB testcase Tests.Machines.PSSE.GENROE. See validation plot generated by automatic validation script in /test/OpenIPSL_test.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.PSSE_GENSAL โ€” Function
PSSE_GENSAL

This model is a port of the OpenIPSL Electrical.Machines.PSSE.GENSAL model, maintaining the same mathematical formulation while adapting to PowerDynamics/ModelingToolkit conventions.

Validation

Validated against the OpenIPSL SMIB testcase Tests.Machines.PSSE.GENSAL. See validation plot generated by automatic validation script in /test/OpenIPSL_test.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.PSSE_GENSAE โ€” Function
PSSE_GENSAE

This model is a port of the OpenIPSL Electrical.Machines.PSSE.GENSAE model, maintaining the same mathematical formulation while adapting to PowerDynamics/ModelingToolkit conventions.

Validation

Validated against the OpenIPSL SMIB testcase Tests.Machines.PSSE.GENSAE. See validation plot generated by automatic validation script in /test/OpenIPSL_test.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.Swing โ€” Constant
Swing

Simplified swing-equation generator with constant voltage magnitude and active power balance.

For a concrete list of variables and parameters please check the model source on GitHub.

source

Control Systems

Exciters & AVRs

PowerDynamics.Library.PSSE_EXST1 โ€” Constant
PSSE_EXST1

This model is a port of the OpenIPSL Electrical.Controls.PSSE.ES.EXST1 model, maintaining the same mathematical formulation while adapting to PowerDynamics/ModelingToolkit conventions.

Validation

Validated against the OpenIPSL SMIB testcase Tests.Controls.PSSE.ES.EXST1. See validation plot generated by automatic validation script in /test/OpenIPSL_test.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.PSSE_ESST4B โ€” Constant
PSSE_ESST4B

This model is a port of the OpenIPSL Electrical.Controls.PSSE.ES.ESST4B model, maintaining the same mathematical formulation while adapting to PowerDynamics/ModelingToolkit conventions.

Validation

Validated against the OpenIPSL SMIB testcase Tests.Controls.PSSE.ES.ESST4B. See validation plot generated by automatic validation script in /test/OpenIPSL_test.

Slight deviations from OpenIPSL behavior

There are still some slight deviations, likely due to differences in the initialization/steady state (see the current integrator state in the validation plot).

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.PSSE_ESST1A โ€” Constant
PSSE_ESST1A

This model is a port of the OpenIPSL Electrical.Controls.PSSE.ES.ESST1A model, maintaining the same mathematical formulation while adapting to PowerDynamics/ModelingToolkit conventions.

Validation

Validated against the OpenIPSL SMIB testcase Tests.Controls.PSSE.ES.ESST1A. See validation plot generated by automatic validation script in /test/OpenIPSL_test.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.PSSE_SCRX โ€” Constant
PSSE_SCRX

This model is a port of the OpenIPSL Electrical.Controls.PSSE.ES.SCRX model, maintaining the same mathematical formulation while adapting to PowerDynamics/ModelingToolkit conventions.

Validation

Validated against the OpenIPSL SMIB testcase Tests.Controls.PSSE.ES.SCRX. See validation plot generated by automatic validation script in /test/OpenIPSL_test.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.PSSE_IEEET1 โ€” Constant
PSSE_IEEET1

This model is a port of the OpenIPSL Electrical.Controls.PSSE.ES.IEEET1 model, maintaining the same mathematical formulation while adapting to PowerDynamics/ModelingToolkit conventions.

Validation

Validated against the OpenIPSL SMIB testcase Tests.Controls.PSSE.ES.IEEET1. See validation plot generated by automatic validation script in /test/OpenIPSL_test.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.AVRFixed โ€” Constant
AVRFixed

Trivial AVR that holds the field voltage at a fixed parameter value.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.AVRTypeI โ€” Constant
AVRTypeI

IEEE Type I excitation system with amplifier, stabilizer feedback, field circuit, and ceiling function.

For a concrete list of variables and parameters please check the model source on GitHub.

source

Governors and Turbines

PowerDynamics.Library.PSSE_IEEEG1 โ€” Constant
PSSE_IEEEG1

This model is a port of the OpenIPSL Electrical.Controls.PSSE.TG.IEEEG1 model, maintaining the same mathematical formulation while adapting to PowerDynamics/ModelingToolkit conventions.

Validation

Validated against the OpenIPSL SMIB testcase Tests.Controls.PSSE.TG.IEEEG1. See validation plot generated by automatic validation script in /test/OpenIPSL_test.

Slight deviations from OpenIPSL behavior

There are still some slight deviations, likely due to differences in the initialization/steady state (see P_MECH output of the validation plot).

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.PSSE_HYGOV โ€” Constant
PSSE_HYGOV

This model is a port of the OpenIPSL Electrical.Controls.PSSE.TG.HYGOV model, maintaining the same mathematical formulation while adapting to PowerDynamics/ModelingToolkit conventions.

Validation

Validated against the OpenIPSL SMIB testcase Tests.Controls.PSSE.TG.HYGOV. See validation plot generated by automatic validation script in /test/OpenIPSL_test.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.GovFixed โ€” Constant
GovFixed

Trivial governor that holds the mechanical torque at a fixed parameter value.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.TurbineGovTypeI โ€” Constant
TurbineGovTypeI

Type-I turbine governor with droop, servo, and transient gain reduction stages (Milano p. 359).

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.TGOV1 โ€” Constant
TGOV1

TGOV1 steam turbine governor with droop, valve limiter, and reheater.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.PSSE_GGOV1_EXPERIMENTAL โ€” Constant
PSSE_GGOV1_EXPERIMENTAL

This model is a port of the OpenIPSL Electrical.Controls.PSSE.TG.GGOV1 model, maintaining the same mathematical formulation while adapting to PowerDynamics/ModelingToolkit conventions.

Validation

Warning

This model does not support delay! It is validaded against a modified version of the OpenIPSL SMIB testcase Tests.Controls.PSSE.TG.GGOV1 without delay (see reference data generation script in /test/OpenIPSL/GGOV1 for modified version). Also, the OpenIPSL testcase does not start in a steady state, so we have some deviation in the validation still. See validation plot generated by automatic validation script in /test/OpenIPSL_test.

For a concrete list of variables and parameters please check the model source on GitHub.

source

Power System Stabilizers (PSS)

PowerDynamics.Library.PSSE_IEEEST โ€” Constant
PSSE_IEEEST

This model is a port of the OpenIPSL Electrical.Controls.PSSE.PSS.IEEEST model, maintaining the same mathematical formulation while adapting to PowerDynamics/ModelingToolkit conventions.

Validation

Validated against the OpenIPSL SMIB testcase Tests.Controls.PSSE.PSS.IEEEST. See validation plot generated by automatic validation script in /test/OpenIPSL_test.

For a concrete list of variables and parameters please check the model source on GitHub.

source

Load Models

Static Load Models

PowerDynamics.Library.PQLoad โ€” Constant
PQLoad

Constant-power load that draws fixed active and reactive power regardless of voltage.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.ConstantYLoad โ€” Constant
ConstantYLoad

Constant-admittance (shunt Y) load drawing current proportional to the bus voltage.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.ZIPLoad โ€” Constant
ZIPLoad

ZIP load combining constant-impedance, constant-current, and constant-power fractions.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.ConstantCurrentLoad โ€” Constant
ConstantCurrentLoad

Constant-current load drawing a fixed current magnitude at a configurable phase offset relative to the bus voltage.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.PSSE_Load โ€” Constant
PSSE_Load

PSS/E load model combining ZIP (constant-impedance/current/power) characteristics with voltage-dependent scaling.

For a concrete list of variables and parameters please check the model source on GitHub.

source

Line Models

Transmission Line Models

PowerDynamics.Library.PiLine โ€” Constant
PiLine

Pi-section transmission branch with series impedance, shunt admittances, and optional transformer ratios.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.PiLine_fault โ€” Constant
PiLine_fault

Pi-section branch with a configurable mid-point fault (short-circuit or impedance-to-ground).

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.Breaker โ€” Constant
Breaker

Ideal circuit breaker: enforces equal terminal voltages when closed, zero current when open.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.DynamicSeriesRLBranch โ€” Constant
DynamicSeriesRLBranch(; R, L, ฯ‰0, r_src=1, r_dst=1)

Dynamic transmission line modeled as a series R-L circuit with optional transformer ratios.

This model represents a series resistance and inductance connecting two buses. The line current is a differential state, suitable for:

  • Transmission lines with significant inductive reactance
  • Transformer models with leakage impedance
  • Dynamic analysis requiring explicit current dynamics

Parameters

  • R: Line resistance [pu]
  • L: Line reactance [pu] at frequency ฯ‰0. Related to physical inductance by L = ฯ‰0 * L_actual.
  • ฯ‰0: Frame angular frequency [rad/s]. Default: 2ฯ€*50 rad/s.
  • r_src: Transformer voltage ratio at source. Default: 1.
  • r_dst: Transformer voltage ratio at destination. Default: 1.

For a concrete list of variables and parameters please check the model source on GitHub.

source

Shunt Models

Static and Dynamic Shunts

PowerDynamics.Library.StaticShunt โ€” Constant
StaticShunt(; G, B)

Static (algebraic) shunt element with constant admittance Y = G + jB.

This model represents a linear shunt connected to a bus, drawing current proportional to the bus voltage: I = Y * V. It has no dynamic states and is evaluated algebraically.

Parameters

  • G: Shunt conductance [pu]. Positive values represent resistive losses (real power consumption).
  • B: Shunt susceptance [pu]. Positive values represent capacitive behavior (leading current), negative values represent inductive behavior (lagging current).

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.DynamicCShunt โ€” Constant
DynamicCShunt(; C, ฯ‰0=2ฯ€*50)

Dynamic shunt element modeled as a pure capacitor.

The capacitor voltage is a differential state, suitable for DAE index reduction at current-source buses and modelling shunt capacitor banks without resistive losses.

Parameters

  • C: Shunt susceptance [pu] at frequency ฯ‰0. Related to physical capacitance by C = ฯ‰0 * C_actual.
  • ฯ‰0: Frame angular frequency [rad/s]. Default: 2ฯ€*50 rad/s.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.DynamicParallelRCShunt โ€” Constant
DynamicParallelRCShunt(; R, C, ฯ‰0=2ฯ€*50)

Dynamic shunt element modeled as a parallel R โˆฅ C circuit.

This model represents a parallel combination of resistance and capacitance connected to a bus. The capacitor voltage is a differential state, suitable for:

  • Shunt capacitor banks with resistive losses
  • Dynamic susceptance for DAE index reduction at current-source buses
  • Fast transient behavior of reactive compensation

Parameters

  • R: Shunt resistance [pu]
  • C: Shunt susceptance [pu] at frequency ฯ‰0. Related to physical capacitance by C = ฯ‰0 * C_actual.
  • ฯ‰0: Frame angular frequency [rad/s]. Default: 2ฯ€*50 rad/s.

For a concrete list of variables and parameters please check the model source on GitHub.

source

Renewable Energy Models

Inverter Models

PowerDynamics.Library.IdealDroopInverter โ€” Constant
IdealDroopInverter

Simplified droop-controlled inverter with first-order power filtering and ideal voltage source output.

For a concrete list of variables and parameters please check the model source on GitHub.

source

Composable Inverter Modeling

The ComposableInverter module within library provides common inverter models using cascaded controls over L, LC or LCL filters in a "component based" way.

Toplevel Models

PowerDynamics.Library.ComposableInverter.DroopInverter โ€” Function
DroopInverter(; name=:droop_inv, filter_type, defaults...)

Grid-forming inverter with droop control for frequency and voltage regulation.

Wraps VoltageSource with DroopOuter controller implementing P-f and Q-V droop characteristics. Suitable for:

  • Grid-forming inverters in microgrids
  • Virtual synchronous machine (VSM) implementations
  • Parallel inverter operation with power sharing

Parameters

  • filter_type: :LC or :LCL filter topology (passed to VoltageSource)
  • Droop controller parameters: Kp (P-f droop), Kq (Q-V droop), ฯ„_p, ฯ„_q (power filter time constants)
  • Filter parameters inherited from VoltageSource: Lf, C, Lg, ฯ‰0
  • defaults...: Additional parameter/variable defaults (e.g., Kp=0.5, ฯ„_p=0.2)

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.ComposableInverter.SimpleGFL โ€” Function
SimpleGFL(; name, iset_input=false, defaults...)

Simplified grid-following inverter with L-filter, current control, and PLL.

Implements single-loop current control (CC1) with PLL synchronization and simple L-filter. Suitable for:

  • Basic grid-following inverter models
  • Simplified renewable energy source representation
  • Studies where detailed filter dynamics are not critical

Parameters

  • iset_input: If true, current setpoint comes from RealInput ports. If false, uses internal isetd/isetq parameters.
  • Lf: Filter reactance [pu]. Related to physical inductance by Lf = ฯ‰0 * Lf_actual.
  • ฯ‰0: Frame angular frequency [rad/s]. Default: 2ฯ€*50 rad/s.
  • PLL and CC1 controller gains
  • defaults...: Additional parameter/variable defaults (e.g., Lf=0.05, PLL_Kp=50)

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.ComposableInverter.SimpleGFLDC โ€” Function
SimpleGFLDC(; name, defaults...)

Grid-following inverter with DC-link dynamics and active power control.

Extends SimpleGFL with DC-link capacitor model and PI controller for DC voltage regulation. The DC voltage controller generates active current reference (q-axis). Suitable for:

  • Inverters with significant DC-link capacitance
  • Renewable sources with DC power input (solar PV, battery storage)
  • Studies requiring DC-side transient analysis

Parameters

  • Lf: Filter reactance [pu]. Related to physical inductance by Lf = ฯ‰0 * Lf_actual.
  • ฯ‰0: Frame angular frequency [rad/s]. Default: 2ฯ€*50 rad/s.
  • C_dc: DC-link capacitance [pu]
  • V_dc: DC voltage reference [pu]
  • kp_v_dc, ki_v_dc: DC voltage PI controller gains
  • P_dc: External DC power draw [pu]
  • PLL and CC1 controller gains
  • defaults...: Additional parameter/variable defaults (e.g., Lf=0.03, V_dc=2.0)

For a concrete list of variables and parameters please check the model source on GitHub.

source

Building Blocks

PowerDynamics.Library.ComposableInverter.VoltageSource โ€” Function
VoltageSource(; name, Vset_input=false, filter_type=:LC, defaults...)

Grid-forming voltage source inverter with cascaded voltage and current control.

Implements two-loop control with voltage controller (VC) commanding current references to inner current controller (CC1). Operates in a fixed dq-frame (no PLL). Suitable for:

  • Grid-forming inverters establishing voltage and frequency
  • Islanded or weak-grid operation
  • Droop-controlled systems (via DroopInverter wrapper)

Parameters

  • Vset_input: If true, voltage setpoint comes from RealInput ports. If false, uses internal Vset/ฮดset parameters.
  • filter_type: :LC for LC filter or :LCL for LCL filter.
  • Lf: Inverter-side filter reactance [pu]. Related to physical inductance by Lf = ฯ‰0 * Lf_actual.
  • C: Filter susceptance [pu]. Related to physical capacitance by C = ฯ‰0 * C_actual.
  • Lg: Grid-side filter reactance [pu]. Related to physical inductance by Lg = ฯ‰0 * Lg_actual (LCL only).
  • ฯ‰0: Frame angular frequency [rad/s]. Default: 2ฯ€*50 rad/s.
  • Various PI controller gains (CC1KP, CC1KI, VCKP, VCKI)
  • defaults...: Additional parameter/variable defaults (e.g., Lf=0.01, CC1_KP=0.1)

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.ComposableInverter.CurrentSource โ€” Function
CurrentSource(; name, iset_input=false, defaults...)

Grid-following current source inverter with triple-loop cascaded control and PLL.

Implements three-loop control: outer current controller (CC2) โ†’ voltage controller (VC) โ†’ inner current controller (CC1). Uses PLL for grid synchronization. Suitable for:

  • Grid-following inverters injecting controlled current
  • Renewable energy sources (solar, wind) in grid-connected mode
  • Active/reactive power control applications

Parameters

  • iset_input: If true, current setpoint comes from RealInput ports. If false, uses internal isetd/isetq parameters.
  • Lf: Inverter-side filter reactance [pu]. Related to physical inductance by Lf = ฯ‰0 * Lf_actual.
  • C: Filter susceptance [pu]. Related to physical capacitance by C = ฯ‰0 * C_actual.
  • Lg: Grid-side filter reactance [pu]. Related to physical inductance by Lg = ฯ‰0 * Lg_actual.
  • ฯ‰0: Frame angular frequency [rad/s]. Default: 2ฯ€*50 rad/s.
  • PLL and controller gains (PLLKp, PLLKi, CC1*, VC, CC2_)
  • defaults...: Additional parameter/variable defaults (e.g., Lf=0.01, PLL_Kp=100)

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.ComposableInverter.SimplePLL โ€” Function
SimplePLL(; name, Kp, Ki, defaults...)

Basic PLL that tracks the grid voltage angle by driving the q-axis voltage to zero. Uses a PI controller on the angle error signal u_q.

Parameters

  • Kp: Proportional gain
  • Ki: Integral gain
  • defaults...: Additional parameter/variable defaults

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.ComposableInverter.PLL_LPF โ€” Function
PLL_LPF(; name, Kp, Ki, ฯ„_lpf, defaults...)

PLL with an additional low-pass filter on the frequency output. Uses a PI controller on the angle error, followed by a first-order LPF on the estimated frequency ฯ‰.

Parameters

  • Kp: Proportional gain
  • Ki: Integral gain
  • ฯ„_lpf: Low-pass filter time constant [s]
  • defaults...: Additional parameter/variable defaults

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.ComposableInverter.VC โ€” Function
VC

Voltage controller for the filter capacitor voltage, implementing PI control with optional current feedforward decoupling.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.ComposableInverter.CC1 โ€” Function
CC1

Inner current controller for the inverter-side inductor current, implementing PI control with optional decoupling feedforward.

For a concrete list of variables and parameters please check the model source on GitHub.

source
PowerDynamics.Library.ComposableInverter.CC2 โ€” Function
CC2

Outer current controller for the grid-side inductor current, implementing PI control with optional voltage feedforward decoupling.

For a concrete list of variables and parameters please check the model source on GitHub.

source

Fault Models

Ground Fault Models

PowerDynamics.Library.RXGroundFault โ€” Constant
RXGroundFault

Shunt RX impedance to ground representing a fault, switchable via the enable parameter.

For a concrete list of variables and parameters please check the model source on GitHub.

source