Skip to content

Commit

Permalink
add DEGOV1
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigomha committed Jul 17, 2024
1 parent 43bd05b commit 0e10645
Show file tree
Hide file tree
Showing 7 changed files with 374 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 @@ -188,6 +188,7 @@ export HydroTurbineGov
export IEEETurbineGov1
export SteamTurbineGov1
export DEGOV
export DEGOV1

# Converter Exports
export Converter
Expand Down
163 changes: 163 additions & 0 deletions src/descriptors/power_system_structs.json
Original file line number Diff line number Diff line change
Expand Up @@ -12107,6 +12107,169 @@
],
"supertype": "TurbineGov"
},
{
"struct_name": "DEGOV1",
"docstring": "Parameters Woodward Diesel Governor Model. DEGOV1 in PSSE",
"fields": [
{
"name": "droop_flag",
"comment": "Droop control Flag. 0 for throttle feedback and 1 for electric power feedback",
"null_value": 0,
"data_type": "Int",
"valid_range": {
"min": 0,
"max": 1
},
"validation_action": "error"
},
{
"name": "T1",
"comment": "Governor mechanism time constant in s",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": 100.0
}
},
{
"name": "T2",
"comment": "Turbine power time constant in s",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": 100.0
}
},
{
"name": "T3",
"comment": "Turbine exhaust temperature time constant in s",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": 100.0
}
},
{
"name": "K",
"comment": "Governor gain for actuator",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": 100.0
}
},
{
"name": "T4",
"comment": "Governor lead time constant in s",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": 100.0
}
},
{
"name": "T5",
"comment": "Governor lag time constant in s",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": 100.0
}
},
{
"name": "T6",
"comment": "Actuator time constant in s",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": 100.0
}
},
{
"name": "Td",
"comment": "Engine time delay in s",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": 100.0
}
},
{
"name": "T_lim",
"comment": "Operational control limits on actuator (T_min, T_max)",
"null_value": "(0.0, 0.0)",
"data_type": "Tuple{Float64, Float64}"
},
{
"name": "R",
"comment": "Steady state droop parameter",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": 100.0
}
},
{
"name": "Te",
"comment": "Power transducer time constant in s",
"null_value": 0,
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": 100.0
}
},
{
"name": "P_ref",
"comment": "Reference Load Set-point (pu)",
"null_value": 0,
"default": "1.0",
"data_type": "Float64",
"valid_range": {
"min": 0,
"max": null
}
},
{
"name": "ext",
"comment": "An *ext*ra dictionary for users to add metadata that are not used in simulation, such as latitude and longitude. See [Adding additional fields](@ref)",
"data_type": "Dict{String, Any}",
"null_value": "Dict{String, Any}()",
"default": "Dict{String, Any}()"
},
{
"name": "states",
"exclude_setter": true,
"comment": "(**Do not modify.**) The [states](@ref S) of the DEGOV1 model depends on the droop flag",
"internal_default": "PowerSystems.get_degov1_states(droop_flag)[1]",
"data_type": "Vector{Symbol}"
},
{
"name": "n_states",
"exclude_setter": true,
"comment": "(**Do not modify.**) The number of [states](@ref S) of the DEGOV1 model depends on the droop flag",
"internal_default": "PowerSystems.get_degov1_states(droop_flag)[2]",
"data_type": "Int"
},
{
"name": "internal",
"comment": "(**Do not modify.**) PowerSystems.jl internal reference",
"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
10 changes: 10 additions & 0 deletions src/models/dynamic_generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,13 @@ function _calc_states(machine, shaft, avr, prime_mover, pss)
get_states(pss),
)
end

function get_degov1_states(droop_flag::Int)
if droop_flag == 0
return [:x_g1, :x_g2, :x_g3, :x_g4, :x_g5], 5
elseif droop_flag == 1
return [:x_g1, :x_g2, :x_g3, :x_g4, :x_g5, :x_g6], 6

Check warning on line 161 in src/models/dynamic_generator.jl

View check run for this annotation

Codecov / codecov/patch

src/models/dynamic_generator.jl#L160-L161

Added lines #L160 - L161 were not covered by tests
else
error("Unsupported value of droop_flag on DEGOV1")

Check warning on line 163 in src/models/dynamic_generator.jl

View check run for this annotation

Codecov / codecov/patch

src/models/dynamic_generator.jl#L163

Added line #L163 was not covered by tests
end
end
176 changes: 176 additions & 0 deletions src/models/generated/DEGOV1.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
#=
This file is auto-generated. Do not edit.
=#

#! format: off

"""
mutable struct DEGOV1 <: TurbineGov
droop_flag::Int
T1::Float64
T2::Float64
T3::Float64
K::Float64
T4::Float64
T5::Float64
T6::Float64
Td::Float64
T_lim::Tuple{Float64, Float64}
R::Float64
Te::Float64
P_ref::Float64
ext::Dict{String, Any}
states::Vector{Symbol}
n_states::Int
internal::InfrastructureSystemsInternal
end
Parameters Woodward Diesel Governor Model. DEGOV1 in PSSE
# Arguments
- `droop_flag::Int`: Droop control Flag. 0 for throttle feedback and 1 for electric power feedback, validation range: `(0, 1)`
- `T1::Float64`: Governor mechanism time constant in s, validation range: `(0, 100)`
- `T2::Float64`: Turbine power time constant in s, validation range: `(0, 100)`
- `T3::Float64`: Turbine exhaust temperature time constant in s, validation range: `(0, 100)`
- `K::Float64`: Governor gain for actuator, validation range: `(0, 100)`
- `T4::Float64`: Governor lead time constant in s, validation range: `(0, 100)`
- `T5::Float64`: Governor lag time constant in s, validation range: `(0, 100)`
- `T6::Float64`: Actuator time constant in s, validation range: `(0, 100)`
- `Td::Float64`: Engine time delay in s, validation range: `(0, 100)`
- `T_lim::Tuple{Float64, Float64}`: Operational control limits on actuator (T_min, T_max)
- `R::Float64`: Steady state droop parameter, validation range: `(0, 100)`
- `Te::Float64`: Power transducer time constant in s, validation range: `(0, 100)`
- `P_ref::Float64`: (default: `1.0`) Reference Load Set-point (pu), validation range: `(0, nothing)`
- `ext::Dict{String, Any}`: (default: `Dict{String, Any}()`) An *ext*ra dictionary for users to add metadata that are not used in simulation, such as latitude and longitude. See [Adding additional fields](@ref)
- `states::Vector{Symbol}`: (**Do not modify.**) The [states](@ref S) of the DEGOV1 model depends on the droop flag
- `n_states::Int`: (**Do not modify.**) The number of [states](@ref S) of the DEGOV1 model depends on the droop flag
- `internal::InfrastructureSystemsInternal`: (**Do not modify.**) PowerSystems.jl internal reference
"""
mutable struct DEGOV1 <: TurbineGov
"Droop control Flag. 0 for throttle feedback and 1 for electric power feedback"
droop_flag::Int
"Governor mechanism time constant in s"
T1::Float64
"Turbine power time constant in s"
T2::Float64
"Turbine exhaust temperature time constant in s"
T3::Float64
"Governor gain for actuator"
K::Float64
"Governor lead time constant in s"
T4::Float64
"Governor lag time constant in s"
T5::Float64
"Actuator time constant in s"
T6::Float64
"Engine time delay in s"
Td::Float64
"Operational control limits on actuator (T_min, T_max)"
T_lim::Tuple{Float64, Float64}
"Steady state droop parameter"
R::Float64
"Power transducer time constant in s"
Te::Float64
"Reference Load Set-point (pu)"
P_ref::Float64
"An *ext*ra dictionary for users to add metadata that are not used in simulation, such as latitude and longitude. See [Adding additional fields](@ref)"
ext::Dict{String, Any}
"(**Do not modify.**) The [states](@ref S) of the DEGOV1 model depends on the droop flag"
states::Vector{Symbol}
"(**Do not modify.**) The number of [states](@ref S) of the DEGOV1 model depends on the droop flag"
n_states::Int
"(**Do not modify.**) PowerSystems.jl internal reference"
internal::InfrastructureSystemsInternal
end

function DEGOV1(droop_flag, T1, T2, T3, K, T4, T5, T6, Td, T_lim, R, Te, P_ref=1.0, ext=Dict{String, Any}(), )
DEGOV1(droop_flag, T1, T2, T3, K, T4, T5, T6, Td, T_lim, R, Te, P_ref, ext, PowerSystems.get_degov1_states(droop_flag)[1], PowerSystems.get_degov1_states(droop_flag)[2], InfrastructureSystemsInternal(), )

Check warning on line 87 in src/models/generated/DEGOV1.jl

View check run for this annotation

Codecov / codecov/patch

src/models/generated/DEGOV1.jl#L86-L87

Added lines #L86 - L87 were not covered by tests
end

function DEGOV1(; droop_flag, T1, T2, T3, K, T4, T5, T6, Td, T_lim, R, Te, P_ref=1.0, ext=Dict{String, Any}(), states=PowerSystems.get_degov1_states(droop_flag)[1], n_states=PowerSystems.get_degov1_states(droop_flag)[2], internal=InfrastructureSystemsInternal(), )
DEGOV1(droop_flag, T1, T2, T3, K, T4, T5, T6, Td, T_lim, R, Te, P_ref, ext, states, n_states, internal, )
end

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

"""Get [`DEGOV1`](@ref) `droop_flag`."""
get_droop_flag(value::DEGOV1) = value.droop_flag
"""Get [`DEGOV1`](@ref) `T1`."""
get_T1(value::DEGOV1) = value.T1
"""Get [`DEGOV1`](@ref) `T2`."""
get_T2(value::DEGOV1) = value.T2
"""Get [`DEGOV1`](@ref) `T3`."""
get_T3(value::DEGOV1) = value.T3
"""Get [`DEGOV1`](@ref) `K`."""
get_K(value::DEGOV1) = value.K
"""Get [`DEGOV1`](@ref) `T4`."""
get_T4(value::DEGOV1) = value.T4
"""Get [`DEGOV1`](@ref) `T5`."""
get_T5(value::DEGOV1) = value.T5
"""Get [`DEGOV1`](@ref) `T6`."""
get_T6(value::DEGOV1) = value.T6
"""Get [`DEGOV1`](@ref) `Td`."""
get_Td(value::DEGOV1) = value.Td
"""Get [`DEGOV1`](@ref) `T_lim`."""
get_T_lim(value::DEGOV1) = value.T_lim
"""Get [`DEGOV1`](@ref) `R`."""
get_R(value::DEGOV1) = value.R
"""Get [`DEGOV1`](@ref) `Te`."""
get_Te(value::DEGOV1) = value.Te
"""Get [`DEGOV1`](@ref) `P_ref`."""
get_P_ref(value::DEGOV1) = value.P_ref
"""Get [`DEGOV1`](@ref) `ext`."""
get_ext(value::DEGOV1) = value.ext
"""Get [`DEGOV1`](@ref) `states`."""
get_states(value::DEGOV1) = value.states
"""Get [`DEGOV1`](@ref) `n_states`."""
get_n_states(value::DEGOV1) = value.n_states
"""Get [`DEGOV1`](@ref) `internal`."""
get_internal(value::DEGOV1) = value.internal

Check warning on line 147 in src/models/generated/DEGOV1.jl

View check run for this annotation

Codecov / codecov/patch

src/models/generated/DEGOV1.jl#L147

Added line #L147 was not covered by tests

"""Set [`DEGOV1`](@ref) `droop_flag`."""
set_droop_flag!(value::DEGOV1, val) = value.droop_flag = val
"""Set [`DEGOV1`](@ref) `T1`."""
set_T1!(value::DEGOV1, val) = value.T1 = val
"""Set [`DEGOV1`](@ref) `T2`."""
set_T2!(value::DEGOV1, val) = value.T2 = val
"""Set [`DEGOV1`](@ref) `T3`."""
set_T3!(value::DEGOV1, val) = value.T3 = val
"""Set [`DEGOV1`](@ref) `K`."""
set_K!(value::DEGOV1, val) = value.K = val
"""Set [`DEGOV1`](@ref) `T4`."""
set_T4!(value::DEGOV1, val) = value.T4 = val
"""Set [`DEGOV1`](@ref) `T5`."""
set_T5!(value::DEGOV1, val) = value.T5 = val
"""Set [`DEGOV1`](@ref) `T6`."""
set_T6!(value::DEGOV1, val) = value.T6 = val
"""Set [`DEGOV1`](@ref) `Td`."""
set_Td!(value::DEGOV1, val) = value.Td = val
"""Set [`DEGOV1`](@ref) `T_lim`."""
set_T_lim!(value::DEGOV1, val) = value.T_lim = val
"""Set [`DEGOV1`](@ref) `R`."""
set_R!(value::DEGOV1, val) = value.R = val
"""Set [`DEGOV1`](@ref) `Te`."""
set_Te!(value::DEGOV1, val) = value.Te = val
"""Set [`DEGOV1`](@ref) `P_ref`."""
set_P_ref!(value::DEGOV1, val) = value.P_ref = val
"""Set [`DEGOV1`](@ref) `ext`."""
set_ext!(value::DEGOV1, val) = value.ext = val
Loading

0 comments on commit 0e10645

Please sign in to comment.