Skip to content

Commit

Permalink
Add Sauer Pai struct (#905)
Browse files Browse the repository at this point in the history
* Add Sauer Pai struct

* Generated structs

* Add test for struct

Co-authored-by: Jose Daniel Lara <[email protected]>
  • Loading branch information
marenat and jd-lara authored Aug 4, 2022
1 parent 6dcc30a commit c0d1704
Show file tree
Hide file tree
Showing 5 changed files with 402 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/PowerSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export SalientPoleQuadratic
export RoundRotorExponential
export SalientPoleExponential
export OneDOneQMachine
export SauerPaiMachine
export MarconatoMachine
export SimpleMarconatoMachine
export AndersonFouadMachine
Expand Down
178 changes: 178 additions & 0 deletions src/descriptors/power_system_structs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7931,6 +7931,184 @@
],
"supertype": "Machine"
},
{
"struct_name": "SauerPaiMachine",
"docstring": "Parameters of synchronous machine: Sauer Pai model",
"fields": [
{
"name": "R",
"comment": "Resistance after EMF in machine per unit",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": null
}
},
{
"name": "Xd",
"data_type": "Float64",
"null_value": 0,
"comment": "Reactance after EMF in d-axis per unit",
"valid_range": {
"min": 0,
"max": null
}
},
{
"name": "Xq",
"data_type": "Float64",
"null_value": 0,
"comment": "Reactance after EMF in q-axis per unit",
"valid_range": {
"min": 0,
"max": null
}
},
{
"name": "Xd_p",
"comment": "Transient reactance after EMF in d-axis per unit",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": null
}
},
{
"name": "Xq_p",
"comment": "Transient reactance after EMF in q-axis per unit",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": null
}
},
{
"name": "Xd_pp",
"comment": "Sub-Transient reactance after EMF in d-axis per unit",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": null
}
},
{
"name": "Xq_pp",
"comment": "Sub-Transient reactance after EMF in q-axis per unit",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": null
}
},
{
"name": "Xl",
"comment": "Stator Leakage Reactance",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": null
}
},
{
"name": "Td0_p",
"comment": "Time constant of transient d-axis voltage",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": null
}
},
{
"name": "Tq0_p",
"comment": "Time constant of transient q-axis voltage",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": null
}
},
{
"name": "Td0_pp",
"comment": "Time constant of sub-transient d-axis voltage",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": null
}
},
{
"name": "Tq0_pp",
"comment": "Time constant of sub-transient q-axis voltage",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": null
}
},
{
"name": "ext",
"data_type": "Dict{String, Any}",
"null_value": "Dict{String, Any}()",
"default": "Dict{String, Any}()"
},
{
"name": "γ_d1",
"data_type": "Float64",
"internal_default": "(Xd_pp-Xl)/(Xd_p-Xl)",
"comment": ""
},
{
"name": "γ_q1",
"data_type": "Float64",
"internal_default": "(Xq_pp-Xl)/(Xq_p-Xl)",
"comment": ""
},
{
"name": "γ_d2",
"data_type": "Float64",
"internal_default": "(Xd_p - Xd_pp) / (Xd_p - Xl)^2",
"comment": ""
},
{
"name": "γ_q2",
"data_type": "Float64",
"internal_default": "(Xq_p - Xq_pp) / (Xq_p - Xl)^2",
"comment": ""
},
{
"name": "states",
"exclude_setter": true,
"comment": "The states are:\n\tψq: q-axis stator flux,\n\tψd: d-axis stator flux,\n\teq_p: q-axis transient voltage,\n\ted_p: d-axis transient voltage\n\tψd_pp: subtransient flux linkage in the d-axis\n\tψq_pp: subtransient flux linkage in the q-axis",
"internal_default": "[:ψq, :ψd, :eq_p, :ed_p, :ψd_pp, :ψq_pp]",
"data_type": "Vector{Symbol}"
},
{
"name": "n_states",
"exclude_setter": true,
"comment": "SauerPaiMachine has 6 states",
"internal_default": 6,
"data_type": "Int"
},
{
"name": "internal",
"comment": "power system internal reference, do not modify",
"data_type": "InfrastructureSystemsInternal",
"internal_default": "InfrastructureSystemsInternal()",
"exclude_setter": true
}
],
"supertype": "Machine"
},
{
"struct_name": "MarconatoMachine",
"docstring": "Parameters of 6-states synchronous machine: Marconato model",
Expand Down
206 changes: 206 additions & 0 deletions src/models/generated/SauerPaiMachine.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
#=
This file is auto-generated. Do not edit.
=#

#! format: off

"""
mutable struct SauerPaiMachine <: Machine
R::Float64
Xd::Float64
Xq::Float64
Xd_p::Float64
Xq_p::Float64
Xd_pp::Float64
Xq_pp::Float64
Xl::Float64
Td0_p::Float64
Tq0_p::Float64
Td0_pp::Float64
Tq0_pp::Float64
ext::Dict{String, Any}
γ_d1::Float64
γ_q1::Float64
γ_d2::Float64
γ_q2::Float64
states::Vector{Symbol}
n_states::Int
internal::InfrastructureSystemsInternal
end
Parameters of synchronous machine: Sauer Pai model
# Arguments
- `R::Float64`: Resistance after EMF in machine per unit, validation range: `(0, nothing)`
- `Xd::Float64`: Reactance after EMF in d-axis per unit, validation range: `(0, nothing)`
- `Xq::Float64`: Reactance after EMF in q-axis per unit, validation range: `(0, nothing)`
- `Xd_p::Float64`: Transient reactance after EMF in d-axis per unit, validation range: `(0, nothing)`
- `Xq_p::Float64`: Transient reactance after EMF in q-axis per unit, validation range: `(0, nothing)`
- `Xd_pp::Float64`: Sub-Transient reactance after EMF in d-axis per unit, validation range: `(0, nothing)`
- `Xq_pp::Float64`: Sub-Transient reactance after EMF in q-axis per unit, validation range: `(0, nothing)`
- `Xl::Float64`: Stator Leakage Reactance, validation range: `(0, nothing)`
- `Td0_p::Float64`: Time constant of transient d-axis voltage, validation range: `(0, nothing)`
- `Tq0_p::Float64`: Time constant of transient q-axis voltage, validation range: `(0, nothing)`
- `Td0_pp::Float64`: Time constant of sub-transient d-axis voltage, validation range: `(0, nothing)`
- `Tq0_pp::Float64`: Time constant of sub-transient q-axis voltage, validation range: `(0, nothing)`
- `ext::Dict{String, Any}`
- `γ_d1::Float64`
- `γ_q1::Float64`
- `γ_d2::Float64`
- `γ_q2::Float64`
- `states::Vector{Symbol}`: The states are:
ψq: q-axis stator flux,
ψd: d-axis stator flux,
eq_p: q-axis transient voltage,
ed_p: d-axis transient voltage
ψd_pp: subtransient flux linkage in the d-axis
ψq_pp: subtransient flux linkage in the q-axis
- `n_states::Int`: SauerPaiMachine has 6 states
- `internal::InfrastructureSystemsInternal`: power system internal reference, do not modify
"""
mutable struct SauerPaiMachine <: Machine
"Resistance after EMF in machine per unit"
R::Float64
"Reactance after EMF in d-axis per unit"
Xd::Float64
"Reactance after EMF in q-axis per unit"
Xq::Float64
"Transient reactance after EMF in d-axis per unit"
Xd_p::Float64
"Transient reactance after EMF in q-axis per unit"
Xq_p::Float64
"Sub-Transient reactance after EMF in d-axis per unit"
Xd_pp::Float64
"Sub-Transient reactance after EMF in q-axis per unit"
Xq_pp::Float64
"Stator Leakage Reactance"
Xl::Float64
"Time constant of transient d-axis voltage"
Td0_p::Float64
"Time constant of transient q-axis voltage"
Tq0_p::Float64
"Time constant of sub-transient d-axis voltage"
Td0_pp::Float64
"Time constant of sub-transient q-axis voltage"
Tq0_pp::Float64
ext::Dict{String, Any}
γ_d1::Float64
γ_q1::Float64
γ_d2::Float64
γ_q2::Float64
"The states are:
ψq: q-axis stator flux,
ψd: d-axis stator flux,
eq_p: q-axis transient voltage,
ed_p: d-axis transient voltage
ψd_pp: subtransient flux linkage in the d-axis
ψq_pp: subtransient flux linkage in the q-axis"
states::Vector{Symbol}
"SauerPaiMachine has 6 states"
n_states::Int
"power system internal reference, do not modify"
internal::InfrastructureSystemsInternal
end

function SauerPaiMachine(R, Xd, Xq, Xd_p, Xq_p, Xd_pp, Xq_pp, Xl, Td0_p, Tq0_p, Td0_pp, Tq0_pp, ext=Dict{String, Any}(), )
SauerPaiMachine(R, Xd, Xq, Xd_p, Xq_p, Xd_pp, Xq_pp, Xl, Td0_p, Tq0_p, Td0_pp, Tq0_pp, ext, (Xd_pp-Xl)/(Xd_p-Xl), (Xq_pp-Xl)/(Xq_p-Xl), (Xd_p - Xd_pp) / (Xd_p - Xl)^2, (Xq_p - Xq_pp) / (Xq_p - Xl)^2, [:ψq, :ψd, :eq_p, :ed_p, :ψd_pp, :ψq_pp], 6, InfrastructureSystemsInternal(), )
end

function SauerPaiMachine(; R, Xd, Xq, Xd_p, Xq_p, Xd_pp, Xq_pp, Xl, Td0_p, Tq0_p, Td0_pp, Tq0_pp, ext=Dict{String, Any}(), γ_d1=(Xd_pp-Xl)/(Xd_p-Xl), γ_q1=(Xq_pp-Xl)/(Xq_p-Xl), γ_d2=(Xd_p - Xd_pp) / (Xd_p - Xl)^2, γ_q2=(Xq_p - Xq_pp) / (Xq_p - Xl)^2, states=[:ψq, :ψd, :eq_p, :ed_p, :ψd_pp, :ψq_pp], n_states=6, internal=InfrastructureSystemsInternal(), )
SauerPaiMachine(R, Xd, Xq, Xd_p, Xq_p, Xd_pp, Xq_pp, Xl, Td0_p, Tq0_p, Td0_pp, Tq0_pp, ext, γ_d1, γ_q1, γ_d2, γ_q2, states, n_states, internal, )
end

# Constructor for demo purposes; non-functional.
function SauerPaiMachine(::Nothing)
SauerPaiMachine(;
R=0,
Xd=0,
Xq=0,
Xd_p=0,
Xq_p=0,
Xd_pp=0,
Xq_pp=0,
Xl=0,
Td0_p=0,
Tq0_p=0,
Td0_pp=0,
Tq0_pp=0,
ext=Dict{String, Any}(),
)
end

"""Get [`SauerPaiMachine`](@ref) `R`."""
get_R(value::SauerPaiMachine) = value.R
"""Get [`SauerPaiMachine`](@ref) `Xd`."""
get_Xd(value::SauerPaiMachine) = value.Xd
"""Get [`SauerPaiMachine`](@ref) `Xq`."""
get_Xq(value::SauerPaiMachine) = value.Xq
"""Get [`SauerPaiMachine`](@ref) `Xd_p`."""
get_Xd_p(value::SauerPaiMachine) = value.Xd_p
"""Get [`SauerPaiMachine`](@ref) `Xq_p`."""
get_Xq_p(value::SauerPaiMachine) = value.Xq_p
"""Get [`SauerPaiMachine`](@ref) `Xd_pp`."""
get_Xd_pp(value::SauerPaiMachine) = value.Xd_pp
"""Get [`SauerPaiMachine`](@ref) `Xq_pp`."""
get_Xq_pp(value::SauerPaiMachine) = value.Xq_pp
"""Get [`SauerPaiMachine`](@ref) `Xl`."""
get_Xl(value::SauerPaiMachine) = value.Xl
"""Get [`SauerPaiMachine`](@ref) `Td0_p`."""
get_Td0_p(value::SauerPaiMachine) = value.Td0_p
"""Get [`SauerPaiMachine`](@ref) `Tq0_p`."""
get_Tq0_p(value::SauerPaiMachine) = value.Tq0_p
"""Get [`SauerPaiMachine`](@ref) `Td0_pp`."""
get_Td0_pp(value::SauerPaiMachine) = value.Td0_pp
"""Get [`SauerPaiMachine`](@ref) `Tq0_pp`."""
get_Tq0_pp(value::SauerPaiMachine) = value.Tq0_pp
"""Get [`SauerPaiMachine`](@ref) `ext`."""
get_ext(value::SauerPaiMachine) = value.ext
"""Get [`SauerPaiMachine`](@ref) `γ_d1`."""
get_γ_d1(value::SauerPaiMachine) = value.γ_d1
"""Get [`SauerPaiMachine`](@ref) `γ_q1`."""
get_γ_q1(value::SauerPaiMachine) = value.γ_q1
"""Get [`SauerPaiMachine`](@ref) `γ_d2`."""
get_γ_d2(value::SauerPaiMachine) = value.γ_d2
"""Get [`SauerPaiMachine`](@ref) `γ_q2`."""
get_γ_q2(value::SauerPaiMachine) = value.γ_q2
"""Get [`SauerPaiMachine`](@ref) `states`."""
get_states(value::SauerPaiMachine) = value.states
"""Get [`SauerPaiMachine`](@ref) `n_states`."""
get_n_states(value::SauerPaiMachine) = value.n_states
"""Get [`SauerPaiMachine`](@ref) `internal`."""
get_internal(value::SauerPaiMachine) = value.internal

"""Set [`SauerPaiMachine`](@ref) `R`."""
set_R!(value::SauerPaiMachine, val) = value.R = val
"""Set [`SauerPaiMachine`](@ref) `Xd`."""
set_Xd!(value::SauerPaiMachine, val) = value.Xd = val
"""Set [`SauerPaiMachine`](@ref) `Xq`."""
set_Xq!(value::SauerPaiMachine, val) = value.Xq = val
"""Set [`SauerPaiMachine`](@ref) `Xd_p`."""
set_Xd_p!(value::SauerPaiMachine, val) = value.Xd_p = val
"""Set [`SauerPaiMachine`](@ref) `Xq_p`."""
set_Xq_p!(value::SauerPaiMachine, val) = value.Xq_p = val
"""Set [`SauerPaiMachine`](@ref) `Xd_pp`."""
set_Xd_pp!(value::SauerPaiMachine, val) = value.Xd_pp = val
"""Set [`SauerPaiMachine`](@ref) `Xq_pp`."""
set_Xq_pp!(value::SauerPaiMachine, val) = value.Xq_pp = val
"""Set [`SauerPaiMachine`](@ref) `Xl`."""
set_Xl!(value::SauerPaiMachine, val) = value.Xl = val
"""Set [`SauerPaiMachine`](@ref) `Td0_p`."""
set_Td0_p!(value::SauerPaiMachine, val) = value.Td0_p = val
"""Set [`SauerPaiMachine`](@ref) `Tq0_p`."""
set_Tq0_p!(value::SauerPaiMachine, val) = value.Tq0_p = val
"""Set [`SauerPaiMachine`](@ref) `Td0_pp`."""
set_Td0_pp!(value::SauerPaiMachine, val) = value.Td0_pp = val
"""Set [`SauerPaiMachine`](@ref) `Tq0_pp`."""
set_Tq0_pp!(value::SauerPaiMachine, val) = value.Tq0_pp = val
"""Set [`SauerPaiMachine`](@ref) `ext`."""
set_ext!(value::SauerPaiMachine, val) = value.ext = val
"""Set [`SauerPaiMachine`](@ref) `γ_d1`."""
set_γ_d1!(value::SauerPaiMachine, val) = value.γ_d1 = val
"""Set [`SauerPaiMachine`](@ref) `γ_q1`."""
set_γ_q1!(value::SauerPaiMachine, val) = value.γ_q1 = val
"""Set [`SauerPaiMachine`](@ref) `γ_d2`."""
set_γ_d2!(value::SauerPaiMachine, val) = value.γ_d2 = val
"""Set [`SauerPaiMachine`](@ref) `γ_q2`."""
set_γ_q2!(value::SauerPaiMachine, val) = value.γ_q2 = val
Loading

0 comments on commit c0d1704

Please sign in to comment.