Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DEGOV #1027

Merged
merged 9 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/PowerSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export GeneralGovModel
export HydroTurbineGov
export IEEETurbineGov1
export SteamTurbineGov1
export DEGOV

# Converter Exports
export Converter
Expand Down
131 changes: 131 additions & 0 deletions src/descriptors/power_system_structs.json
Original file line number Diff line number Diff line change
Expand Up @@ -11816,6 +11816,137 @@
],
"supertype": "TurbineGov"
},
{
"struct_name": "DEGOV",
"docstring": "Parameters Woodward Diesel Governor Model. DEGOV in PowerWorld.",
"fields": [
{
"name": "T1",
"comment": "Governor mechanism time constant",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": "eps()",
"max": 100.0
}
},
{
"name": "T2",
"comment": "Turbine power time constant",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": "eps()",
"max": 100.0
}
},
{
"name": "T3",
"comment": "Turbine exhaust temperature time constant",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": "eps()",
"max": 100.0
}
},
{
"name": "K",
"comment": "Governor gain (reciprocal of droop)",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": "eps()",
"max": 100.0
}
},
{
"name": "T4",
"comment": "Governor lead time constant",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": "eps()",
"max": 100.0
}
},
{
"name": "T5",
"comment": "Governor lag time constant",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": "eps()",
"max": 100.0
}
},
{
"name": "T6",
"comment": "Actuator time constant",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": "eps()",
"max": 100.0
}
},
{
"name": "Td",
"comment": "Engine time delay",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": "eps()",
"max": 100.0
}
},
{
"name": "P_ref",
"comment": "Reference Load Set-point",
"null_value": 0,
"default": "1.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": "states",
"exclude_setter": true,
"comment": "The states of the DEGOV model are:\n\tx_ecb1: Electric control box 1,\n\tx_ecb2: Electric control box 2,\n\tx_a1: Actuator 1,\n\tx_a2: Actuator 2,\n\tx_a3: Actuator 3,",
"internal_default": "[:x_ecb1, :x_ecb2, :x_a1, :x_a2, :x_a3]",
"data_type": "Vector{Symbol}"
},
{
"name": "n_states",
"exclude_setter": true,
"comment": "DEGOV has 5 states",
"internal_default": 5,
"data_type": "Int"
},
{
"name": "states_types",
"comment": "DEGOV has 5 differential states",
"internal_default": "[StateTypes.Differential, StateTypes.Differential, StateTypes.Differential, StateTypes.Differential, StateTypes.Differential]",
"data_type": "Vector{StateTypes}"
},
{
"name": "internal",
"comment": "power system internal reference, do not modify",
"data_type": "InfrastructureSystemsInternal",
"internal_default": "InfrastructureSystemsInternal()",
"exclude_setter": true
}
],
"supertype": "TurbineGov"
},
{
"struct_name": "GeneralGovModel",
"docstring": "GE General Governor/Turbine Model. The GeneralGovModel (GGOV1) model is a general purpose governor model used for a variety of prime movers controlled by proportional-integral-derivative (PID) governors including gas turbines.",
Expand Down
157 changes: 157 additions & 0 deletions src/models/generated/DEGOV.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
#=
This file is auto-generated. Do not edit.
=#

#! format: off

"""
mutable struct DEGOV <: TurbineGov
T1::Float64
T2::Float64
T3::Float64
K::Float64
T4::Float64
T5::Float64
T6::Float64
Td::Float64
P_ref::Float64
ext::Dict{String, Any}
states::Vector{Symbol}
n_states::Int
states_types::Vector{StateTypes}
internal::InfrastructureSystemsInternal
end

Parameters Woodward Diesel Governor Model. DEGOV in PowerWorld.

# Arguments
- `T1::Float64`: Governor mechanism time constant, validation range: `(eps(), 100)`
- `T2::Float64`: Turbine power time constant, validation range: `(eps(), 100)`
- `T3::Float64`: Turbine exhaust temperature time constant, validation range: `(eps(), 100)`
- `K::Float64`: Governor gain (reciprocal of droop), validation range: `(eps(), 100)`
- `T4::Float64`: Governor lead time constant, validation range: `(eps(), 100)`
- `T5::Float64`: Governor lag time constant, validation range: `(eps(), 100)`
- `T6::Float64`: Actuator time constant, validation range: `(eps(), 100)`
- `Td::Float64`: Engine time delay, validation range: `(eps(), 100)`
- `P_ref::Float64`: Reference Load Set-point, validation range: `(0, nothing)`
- `ext::Dict{String, Any}`
- `states::Vector{Symbol}`: The states of the DEGOV model are:
x_ecb1: Electric control box 1,
x_ecb2: Electric control box 2,
x_a1: Actuator 1,
x_a2: Actuator 2,
x_a3: Actuator 3,
- `n_states::Int`: DEGOV has 5 states
- `states_types::Vector{StateTypes}`: DEGOV has 5 differential states
- `internal::InfrastructureSystemsInternal`: power system internal reference, do not modify
"""
mutable struct DEGOV <: TurbineGov
"Governor mechanism time constant"
T1::Float64
"Turbine power time constant"
T2::Float64
"Turbine exhaust temperature time constant"
T3::Float64
"Governor gain (reciprocal of droop)"
K::Float64
"Governor lead time constant"
T4::Float64
"Governor lag time constant"
T5::Float64
"Actuator time constant"
T6::Float64
"Engine time delay"
Td::Float64
"Reference Load Set-point"
P_ref::Float64
ext::Dict{String, Any}
"The states of the DEGOV model are:
x_ecb1: Electric control box 1,
x_ecb2: Electric control box 2,
x_a1: Actuator 1,
x_a2: Actuator 2,
x_a3: Actuator 3,"
states::Vector{Symbol}
"DEGOV has 5 states"
n_states::Int
"DEGOV has 5 differential states"
states_types::Vector{StateTypes}
"power system internal reference, do not modify"
internal::InfrastructureSystemsInternal
end

function DEGOV(T1, T2, T3, K, T4, T5, T6, Td, P_ref=1.0, ext=Dict{String, Any}(), )
DEGOV(T1, T2, T3, K, T4, T5, T6, Td, P_ref, ext, [:x_ecb1, :x_ecb2, :x_a1, :x_a2, :x_a3], 5, [StateTypes.Differential, StateTypes.Differential, StateTypes.Differential, StateTypes.Differential, StateTypes.Differential], InfrastructureSystemsInternal(), )

Check warning on line 84 in src/models/generated/DEGOV.jl

View check run for this annotation

Codecov / codecov/patch

src/models/generated/DEGOV.jl#L83-L84

Added lines #L83 - L84 were not covered by tests
end

function DEGOV(; T1, T2, T3, K, T4, T5, T6, Td, P_ref=1.0, ext=Dict{String, Any}(), states=[:x_ecb1, :x_ecb2, :x_a1, :x_a2, :x_a3], n_states=5, states_types=[StateTypes.Differential, StateTypes.Differential, StateTypes.Differential, StateTypes.Differential, StateTypes.Differential], internal=InfrastructureSystemsInternal(), )
DEGOV(T1, T2, T3, K, T4, T5, T6, Td, P_ref, ext, states, n_states, states_types, internal, )
end

# Constructor for demo purposes; non-functional.
function DEGOV(::Nothing)
DEGOV(;
T1=0,
T2=0,
T3=0,
K=0,
T4=0,
T5=0,
T6=0,
Td=0,
P_ref=0,
ext=Dict{String, Any}(),
)
end

"""Get [`DEGOV`](@ref) `T1`."""
get_T1(value::DEGOV) = value.T1
"""Get [`DEGOV`](@ref) `T2`."""
get_T2(value::DEGOV) = value.T2
"""Get [`DEGOV`](@ref) `T3`."""
get_T3(value::DEGOV) = value.T3
"""Get [`DEGOV`](@ref) `K`."""
get_K(value::DEGOV) = value.K
"""Get [`DEGOV`](@ref) `T4`."""
get_T4(value::DEGOV) = value.T4
"""Get [`DEGOV`](@ref) `T5`."""
get_T5(value::DEGOV) = value.T5
"""Get [`DEGOV`](@ref) `T6`."""
get_T6(value::DEGOV) = value.T6
"""Get [`DEGOV`](@ref) `Td`."""
get_Td(value::DEGOV) = value.Td
"""Get [`DEGOV`](@ref) `P_ref`."""
get_P_ref(value::DEGOV) = value.P_ref
"""Get [`DEGOV`](@ref) `ext`."""
get_ext(value::DEGOV) = value.ext
"""Get [`DEGOV`](@ref) `states`."""
get_states(value::DEGOV) = value.states
"""Get [`DEGOV`](@ref) `n_states`."""
get_n_states(value::DEGOV) = value.n_states
"""Get [`DEGOV`](@ref) `states_types`."""
get_states_types(value::DEGOV) = value.states_types
"""Get [`DEGOV`](@ref) `internal`."""
get_internal(value::DEGOV) = value.internal

Check warning on line 134 in src/models/generated/DEGOV.jl

View check run for this annotation

Codecov / codecov/patch

src/models/generated/DEGOV.jl#L134

Added line #L134 was not covered by tests

"""Set [`DEGOV`](@ref) `T1`."""
set_T1!(value::DEGOV, val) = value.T1 = val
"""Set [`DEGOV`](@ref) `T2`."""
set_T2!(value::DEGOV, val) = value.T2 = val
"""Set [`DEGOV`](@ref) `T3`."""
set_T3!(value::DEGOV, val) = value.T3 = val
"""Set [`DEGOV`](@ref) `K`."""
set_K!(value::DEGOV, val) = value.K = val
"""Set [`DEGOV`](@ref) `T4`."""
set_T4!(value::DEGOV, val) = value.T4 = val
"""Set [`DEGOV`](@ref) `T5`."""
set_T5!(value::DEGOV, val) = value.T5 = val
"""Set [`DEGOV`](@ref) `T6`."""
set_T6!(value::DEGOV, val) = value.T6 = val
"""Set [`DEGOV`](@ref) `Td`."""
set_Td!(value::DEGOV, val) = value.Td = val
"""Set [`DEGOV`](@ref) `P_ref`."""
set_P_ref!(value::DEGOV, val) = value.P_ref = val
"""Set [`DEGOV`](@ref) `ext`."""
set_ext!(value::DEGOV, val) = value.ext = val
"""Set [`DEGOV`](@ref) `states_types`."""
set_states_types!(value::DEGOV, val) = value.states_types = val
3 changes: 3 additions & 0 deletions src/models/generated/includes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ include("SingleMass.jl")
include("FiveMassShaft.jl")
include("TGFixed.jl")
include("GasTG.jl")
include("DEGOV.jl")
include("GeneralGovModel.jl")
include("SteamTurbineGov1.jl")
include("HydroTurbineGov.jl")
Expand Down Expand Up @@ -344,6 +345,7 @@ export get_Tb1
export get_Tc
export get_Tc1
export get_Tcomp
export get_Td
export get_Td0_p
export get_Td0_pp
export get_Td_gov
Expand Down Expand Up @@ -879,6 +881,7 @@ export set_Tb1!
export set_Tc!
export set_Tc1!
export set_Tcomp!
export set_Td!
export set_Td0_p!
export set_Td0_pp!
export set_Td_gov!
Expand Down
13 changes: 13 additions & 0 deletions test/test_dynamic_generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,19 @@ end
D_turb = 0.0,
)
@test gast_tg isa PowerSystems.DynamicComponent

degov_tg = PSY.DEGOV(;
T1 = 0.0,
T2 = 0.0,
T3 = 0.0,
K = 18.0,
T4 = 12.0,
T5 = 5.0,
T6 = 0.2,
Td = 0.0,
P_ref = 0.0,
)
@test degov_tg isa PowerSystems.DynamicComponent
end

################ AVR Data #####################
Expand Down
Loading