@@ -14,28 +14,58 @@ abstract type AbstractAlgebraicGridDynamics <: GridDynamics end
1414
1515NetworkRHS (g:: GridDynamics ) = g. rhs
1616
17- " TBD"
17+ """
18+ struct OrdinaryGridDynamics <: AbstractOrdinaryGridDynamics
19+ rhs::NetworkRHS
20+ end
21+
22+ The data structure that contains all the information necessary for a power grid model that can be described
23+ as an ordinary differential equation. In this case, only the [`PowerDynBase.NetworkRHS`] is necessary.
24+ """
1825@with_kw struct OrdinaryGridDynamics <: AbstractOrdinaryGridDynamics
1926 rhs:: NetworkRHS
2027end
2128(dyn:: OrdinaryGridDynamics )(dx_dt:: AbstractVector , x_in:: AbstractVector , p, t) = dyn. rhs (ODEVariable (x_in, dx_dt), t)
2229
23- " TBD"
30+ """
31+ struct OrdinaryGridDynamicsWithMass <: AbstractAlgebraicGridDynamics
32+ rhs::NetworkRHS
33+ masses::AbstractVector{Bool} # diagonal part of the mass matrix, off-diagonal is assumed to be 0 anyway
34+ end
35+
36+ The data structure that contains all the information necessary for a power grid model that can be described
37+ as an ordinary differential equation with masses, i.e. a semi-explicit differential algebraic equation.
38+ `rhs` is the [`PowerDynBase.NetworkRHS`]. `masses` is a 1-dimensional array representing the diagonal entries
39+ of the mass matrix. The off-diagonal entries are assumed to be 0. `masses` can only contain boolean values
40+ representing: `true` the equation is treated as a ordinary differential eqation and `false` the equation is
41+ treated as an algebraic constraint on the state variables.
42+ """
2443@with_kw struct OrdinaryGridDynamicsWithMass <: AbstractAlgebraicGridDynamics
2544 rhs:: NetworkRHS
2645 masses:: AbstractVector{Bool} # diagonal part of the mass matrix, off-diagonal is assumed to be 0 anyway
2746end
2847(dyn:: OrdinaryGridDynamicsWithMass )(dx_dt:: AbstractVector , x_in:: AbstractVector , p, t) = dyn. rhs (ODEVariable (x_in, dx_dt), t)
2948
30- " TBD"
49+ """
50+ struct AlgebraicGridDynamics <: AbstractAlgebraicGridDynamics
51+ rhs::NetworkRHS
52+ differentials::AbstractVector{Bool} # boolean values whether there a variable is a differential
53+ end
54+
55+ The data structure that contains all the information necessary for a power grid model that can be described
56+ as an differential algebraic equation.
57+ `rhs` is the [`PowerDynBase.NetworkRHS`]. `differentials` is a 1-dimensional array of boolean values.
58+ A `true` entry means the corresponding variable is dynamic and has a derivative variable.
59+ A `false` entry means the corresponding variable is defined by an algebraic constraint only.
60+ """
3161@with_kw struct AlgebraicGridDynamics <: AbstractAlgebraicGridDynamics
3262 rhs:: NetworkRHS
3363 differentials:: AbstractVector{Bool} # boolean values whether there a variable is a differential
3464end
3565(dyn:: AlgebraicGridDynamics )(x_out:: AbstractVector , dx_dt:: AbstractVector , x_in:: AbstractVector , p, t) = dyn. root (DAEVariable (val= x_in, ddt= dx_dt, out= x_out), t)
3666
3767
38- " Create for each subtype of [`DPSABase .AbstractNodeDynamics`](#ref) the corresponding subtype of [`DPSABase .GridDynamics`](#ref)."
68+ " Create for each subtype of [`PowerDynBase .AbstractNodeDynamics`](#ref) the corresponding subtype of [`PowerDynBase .GridDynamics`](#ref)."
3969_GridDynamics (nodes:: AbstractVector{<:OrdinaryNodeDynamics} , LY:: AbstractMatrix ) =
4070 OrdinaryGridDynamics (NetworkRHS (nodes, LY))
4171
6393 skip_LY_check=false,
6494 kwargs...)
6595
66- Bring all sutypes of [`DPSABase .AbstractNodeDynamics`](#ref) on one level and then
67- create for each subtype of [`DPSABase .AbstractNodeDynamics`](#ref) the corresponding subtype of [`DPSABase .GridDynamics`](#ref) by using
68- [`DPSABase ._GridDynamics`](#ref).
96+ Bring all sutypes of [`PowerDynBase .AbstractNodeDynamics`](#ref) on one level and then
97+ create for each subtype of [`PowerDynBase .AbstractNodeDynamics`](#ref) the corresponding subtype of [`PowerDynBase .GridDynamics`](#ref) by using
98+ [`PowerDynBase ._GridDynamics`](#ref).
6999"""
70100function GridDynamics (
71101 nodes:: AbstractArray{<:AbstractNodeDynamics} ,
84114"""
85115 function GridDynamics(nodes::AbstractVector{<:AbstractNodeParameters}, args...; kwargs...)
86116
87- Convert all subtypes of [`DPSABase .AbstractNodeParameters`](#ref) to the corresponding
88- subtypes of [`DPSABase .AbstractNodeDynamics`](#ref) and then call [`DPSABase .GridDynamics`](#ref)
117+ Convert all subtypes of [`PowerDynBase .AbstractNodeParameters`](#ref) to the corresponding
118+ subtypes of [`PowerDynBase .AbstractNodeDynamics`](#ref) and then call [`PowerDynBase .GridDynamics`](#ref)
89119again.
90120"""
91121function GridDynamics (nodes:: AbstractVector{<:AbstractNodeParameters} , args... ; kwargs... )
92122 GridDynamics (map (construct_node_dynamics, nodes), args... ; kwargs... )
93123end
94124
95-
125+ " Return the 1-dimensional differentials array (see [`PowerDynBase.AlgebraicGridDynamics`]) for the internal variables for each node. "
96126int_differentials (node:: AbstractAlgebraicNodeDynamics , nodes:: AbstractAlgebraicNodeDynamics... ) = [int_differentials (node); int_differentials (nodes... )]
127+ " Return the 1-dimensional differentials array (see [`PowerDynBase.AlgebraicGridDynamics`]) for the voltagee variables for each node."
97128u_differentials (node:: AbstractAlgebraicNodeDynamics , nodes:: AbstractAlgebraicNodeDynamics... ) = [u_differentials (node); u_differentials (nodes... )]
98129u_differentials (node:: OrdinaryNodeDynamicsWithMass ) = repeat ([node. m_u], inner= 2 ) # 1 Complex number is 2 Real numbers
99130int_differentials (node:: OrdinaryNodeDynamicsWithMass ) = node. m_int
0 commit comments