Dynamics Types

Dynamics Types

Node Dynamics

In this section, the implemented general types of node dynamics (which are all subtypes of PowerDynBase.AbstractNodeDynamics) with the corresponding helper functions and constants are introduced. The documentation is done for each type below. The main types are:

Abstract super type for all abstract node dynamics types.

OrdinaryNodeDynamics(;rhs, n_int)

The type representing the dynamics of a node that is described via ODEs.

Each node $a$ has the complex voltage $u$ and $n$ real internal variables $y_1, \dots, y_n$, so it generally describes a system of ordinary differential equation as

\[\frac{du_a}{dt} = f_u(u_a, {i_c}_a, y_1, \dots, y_n) \\ \frac{dy_{ak}}{dt} = f_k(u_a, {i_c}_a, y_1, \dots, y_n)\quad \forall k = 1, \dots, n.\]

$f$ is represented by rhs field of OrdinaryNodeDynamics.

  • the general signature of rhs is
rhs(dint_dt::AbstractVector,
    u::Complex,
    i::Complex,
    int::AbstractVector,
    t,
    )::Complex
  • Input
    • u is the complex voltage $u$
    • i is the complex current $i$
    • int is the array of internal variables $y_1, \dots, y_n$
    • t is the time $t$
  • Output
    • the (complex) return value describes $\frac{du}{dt}$
    • rhs writes values in dint_dt describing the left-hand side $\frac{dy_1}{dt}, \dots, \frac{dy_n}{dt}$
source
OrdinaryNodeDynamicsWithMass(;rhs, n_int, m_u, m_int)

The type representing the dynamics of a node that is described via ODEs.

Each node $a$ has the complex voltage $u$ and $n$ (= n_int) real internal variables $y_1, \dots, y_n$, so it generally describes a system of ordinary differential equation with a voltage mass $m_u$ and internal masses $m^{int}_1, \dots, m^{int}_n$ as

\[m_u\frac{du_a}{dt} = f_u(u_a, {i_c}_a, y_1, \dots, y_n) \\ m^{int}_k\frac{dy_{ak}}{dt} = f_k(u_a, {i_c}_a, y_1, \dots, y_n)\quad \forall k = 1, \dots, n.\]

As we assume that all masses are binary (either 1, or 0), that means, one can implement semi-explicit differential algebraic equations with this node dynamics type. $f$ is represented by rhs field of OrdinaryNodeDynamics.

  • the general signature of rhs is
rhs(dint_dt::AbstractVector,
    u::Complex,
    i::Complex,
    int::AbstractVector,
    t,
    )::Complex
  • Input
    • u is the complex voltage $u$
    • i is the complex current $i$
    • int is the array of internal variables $y_1, \dots, y_n$
    • t is the time $t$
  • Output
    • the (complex) return value describes $\frac{du}{dt}$
    • rhs writes values in dint_dt describing the left-hand side $\frac{dy_1}{dt}, \dots, \frac{dy_n}{dt}$

The binary masses are:

  • m_u is the boolean value for $m_u$
  • m_int is the array of boolean values for $m^{int}_1, \dots, m^{int}_n$

Helper Functions

to be done

Get the symbols representing the internal variables of the node.

Grid Dynamics

Analogously, for each of the node dynamics types exists a corresponding grid dynamics type, that represents the dynamics of a whole power grid model. They are all subtypes of PowerDynBase.GridDynamics These are:

Abstract super type for all abstract grid dynamics types.

struct OrdinaryGridDynamics <: AbstractOrdinaryGridDynamics
    rhs::NetworkRHS
end

The data structure that contains all the information necessary for a power grid model that can be described as an ordinary differential equation. In this case, only the PowerDynBase.NetworkRHS is necessary.

source
struct OrdinaryGridDynamicsWithMass <: AbstractAlgebraicGridDynamics
    rhs::NetworkRHS
    masses::AbstractVector{Bool} # diagonal part of the mass matrix, off-diagonal is assumed to be 0 anyway
end

The data structure that contains all the information necessary for a power grid model that can be described as an ordinary differential equation with masses, i.e. a semi-explicit differential algebraic equation. rhs is the PowerDynBase.NetworkRHS. masses is a 1-dimensional array representing the diagonal entries of the mass matrix. The off-diagonal entries are assumed to be 0. masses can only contain boolean values representing: true the equation is treated as a ordinary differential eqation and false the equation is treated as an algebraic constraint on the state variables.

source
struct AlgebraicGridDynamics <: AbstractAlgebraicGridDynamics
    rhs::NetworkRHS
    differentials::AbstractVector{Bool} # boolean values whether there a variable is a differential
end

The data structure that contains all the information necessary for a power grid model that can be described as an differential algebraic equation. rhs is the PowerDynBase.NetworkRHS. differentials is a 1-dimensional array of boolean values. A true entry means the corresponding variable is dynamic and has a derivative variable. A false entry means the corresponding variable is defined by an algebraic constraint only.

source

NetworkRHS

The logic of building a full power grid model (i.e. a subtype of PowerDynBase.GridDynamics) is encoded in PowerDynBase.NetworkRHS. Currently, the docs are a bit thin here.

struct NetworkRHS{T, M} <: AbstractNetworkFunction{T, M}
    nodes::AbstractVector{T}
    LY::M
    numnodes
    systemsize
    intrange # unitrange telling me where I find the internal dynamic variables
    nodalintranges # unit ranges to find the internal variables for each node in the full length of internal variables
end

Representing the full dynamics of the power grid.

source

Helper Functions

to be done