From d0810efada949f670158b26d560effbbd9b519d8 Mon Sep 17 00:00:00 2001 From: rodrigomha Date: Tue, 16 Jul 2024 15:35:11 -0700 Subject: [PATCH 1/5] add ESAC8B struct with parser --- src/PowerSystems.jl | 1 + src/descriptors/power_system_structs.json | 176 +++++++++++++++++++ src/models/generated/ESAC8B.jl | 203 ++++++++++++++++++++++ src/models/generated/includes.jl | 1 + src/parsers/psse_dynamic_mapping.yaml | 5 + 5 files changed, 386 insertions(+) create mode 100644 src/models/generated/ESAC8B.jl diff --git a/src/PowerSystems.jl b/src/PowerSystems.jl index 42cbe77dae..b82e72496a 100644 --- a/src/PowerSystems.jl +++ b/src/PowerSystems.jl @@ -132,6 +132,7 @@ export ESDC1A export ESDC2A export ESAC1A export ESAC6A +export ESAC8B export EXAC1 export EXAC1A export EXAC2 diff --git a/src/descriptors/power_system_structs.json b/src/descriptors/power_system_structs.json index e40327a7a6..d5a12508fb 100644 --- a/src/descriptors/power_system_structs.json +++ b/src/descriptors/power_system_structs.json @@ -7139,6 +7139,182 @@ ], "supertype": "AVR" }, + { + "struct_name": "ESAC8B", + "docstring": "Excitation System AC8B. Used to represent the Basler Digital Excitation Control System (DECS) with PID controller in PSSE.", + "fields": [ + { + "name": "Tr", + "comment": "Regulator input filter time constant in s", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Kp", + "comment": "Regulator proportional PID gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Ki", + "comment": "Regulator integral PID gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Kd", + "comment": "Regulator derivative PID gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Td", + "comment": "Regulator derivative PID time constant.", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": 10 + }, + "validation_action": "warn" + }, + { + "name": "Ka", + "comment": "Regulator output gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": 1000 + }, + "validation_action": "warn" + }, + { + "name": "Ta", + "comment": "Regulator output lag time constant in s", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": 10 + }, + "validation_action": "warn" + }, + { + "name": "Vr_lim", + "comment": "Limits for exciter field voltage `(Vr_min, Vr_max)`", + "null_value": "(min=0.0, max=0.0)", + "data_type": "MinMax" + }, + { + "name": "Te", + "comment": "Exciter field time constant", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": "eps()", + "max": 2 + }, + "validation_action": "error" + }, + { + "name": "Ke", + "comment": "Exciter field proportional constant", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": 2 + }, + "validation_action": "warn" + }, + { + "name": "E_sat", + "comment": "Exciter output voltage for saturation factor: (E1, E2)", + "null_value": "(0.0, 0.0)", + "data_type": "Tuple{Float64, Float64}" + }, + { + "name": "Se", + "comment": "Exciter saturation factor at exciter output voltage: (Se(E1), Se(E2))", + "null_value": "(0.0, 0.0)", + "data_type": "Tuple{Float64, Float64}" + }, + { + "name": "V_ref", + "comment": "Reference Voltage Set-point (pu)", + "null_value": 0, + "default": "1.0", + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + } + }, + { + "name": "saturation_coeffs", + "comment": "(**Do not modify.**) Coefficients (A,B) of the function: Se(V) = B(V - A)^2/V", + "data_type": "Tuple{Float64, Float64}", + "null_value": "(0.0, 0.0)", + "default": "PowerSystems.get_avr_saturation(E_sat, Se)" + }, + { + "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) are:\n\tVm: Sensed terminal voltage,\n\tx_i: Internal PI-block state,\n\tx_d: Internal Derivative-block state,\n\tVr: Voltage regulator state,\n\tEfd: Exciter output state", + "internal_default": "[:Vm, :x_i, :x_d, :Vr, :Efd]", + "data_type": "Vector{Symbol}" + }, + { + "name": "n_states", + "exclude_setter": true, + "comment": "(**Do not modify.**) ESAC8B has 5 states", + "internal_default": 5, + "data_type": "Int" + }, + { + "name": "states_types", + "comment": "(**Do not modify.**) ESAC8B has 5 states", + "internal_default": "[StateTypes.Hybrid, StateTypes.Differential, StateTypes.Differential, StateTypes.Hybrid, StateTypes.Differential]", + "data_type": "Vector{StateTypes}" + }, + { + "name": "internal", + "comment": "(**Do not modify.**) PowerSystems.jl internal reference", + "data_type": "InfrastructureSystemsInternal", + "internal_default": "InfrastructureSystemsInternal()", + "exclude_setter": true + } + ], + "supertype": "AVR" + }, { "struct_name": "ESST1A", "docstring": "This excitation system supplies power through a transformer from the generator terminals and its regulated by a controlled rectifier (via thyristors).\nParameters of IEEE Std 421.5 Type ST1A Excitacion System. ESST1A in PSSE and PSLF", diff --git a/src/models/generated/ESAC8B.jl b/src/models/generated/ESAC8B.jl new file mode 100644 index 0000000000..3572370ef1 --- /dev/null +++ b/src/models/generated/ESAC8B.jl @@ -0,0 +1,203 @@ +#= +This file is auto-generated. Do not edit. +=# + +#! format: off + +""" + mutable struct ESAC8B <: AVR + Tr::Float64 + Kp::Float64 + Ki::Float64 + Kd::Float64 + Td::Float64 + Ka::Float64 + Ta::Float64 + Vr_lim::MinMax + Te::Float64 + Ke::Float64 + E_sat::Tuple{Float64, Float64} + Se::Tuple{Float64, Float64} + V_ref::Float64 + saturation_coeffs::Tuple{Float64, Float64} + ext::Dict{String, Any} + states::Vector{Symbol} + n_states::Int + states_types::Vector{StateTypes} + internal::InfrastructureSystemsInternal + end + +Excitation System AC8B. Used to represent the Basler Digital Excitation Control System (DECS) with PID controller in PSSE. + +# Arguments +- `Tr::Float64`: Regulator input filter time constant in s, validation range: `(0, nothing)` +- `Kp::Float64`: Regulator proportional PID gain, validation range: `(0, nothing)` +- `Ki::Float64`: Regulator integral PID gain, validation range: `(0, nothing)` +- `Kd::Float64`: Regulator derivative PID gain, validation range: `(0, nothing)` +- `Td::Float64`: Regulator derivative PID time constant., validation range: `(0, 10)` +- `Ka::Float64`: Regulator output gain, validation range: `(0, 1000)` +- `Ta::Float64`: Regulator output lag time constant in s, validation range: `(0, 10)` +- `Vr_lim::MinMax`: Limits for exciter field voltage `(Vr_min, Vr_max)` +- `Te::Float64`: Exciter field time constant, validation range: `(eps(), 2)` +- `Ke::Float64`: Exciter field proportional constant, validation range: `(0, 2)` +- `E_sat::Tuple{Float64, Float64}`: Exciter output voltage for saturation factor: (E1, E2) +- `Se::Tuple{Float64, Float64}`: Exciter saturation factor at exciter output voltage: (Se(E1), Se(E2)) +- `V_ref::Float64`: (default: `1.0`) Reference Voltage Set-point (pu), validation range: `(0, nothing)` +- `saturation_coeffs::Tuple{Float64, Float64}`: (default: `PowerSystems.get_avr_saturation(E_sat, Se)`) (**Do not modify.**) Coefficients (A,B) of the function: Se(V) = B(V - A)^2/V +- `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) are: + Vm: Sensed terminal voltage, + x_i: Internal PI-block state, + x_d: Internal Derivative-block state, + Vr: Voltage regulator state, + Efd: Exciter output state +- `n_states::Int`: (**Do not modify.**) ESAC8B has 5 states +- `states_types::Vector{StateTypes}`: (**Do not modify.**) ESAC8B has 5 states +- `internal::InfrastructureSystemsInternal`: (**Do not modify.**) PowerSystems.jl internal reference +""" +mutable struct ESAC8B <: AVR + "Regulator input filter time constant in s" + Tr::Float64 + "Regulator proportional PID gain" + Kp::Float64 + "Regulator integral PID gain" + Ki::Float64 + "Regulator derivative PID gain" + Kd::Float64 + "Regulator derivative PID time constant." + Td::Float64 + "Regulator output gain" + Ka::Float64 + "Regulator output lag time constant in s" + Ta::Float64 + "Limits for exciter field voltage `(Vr_min, Vr_max)`" + Vr_lim::MinMax + "Exciter field time constant" + Te::Float64 + "Exciter field proportional constant" + Ke::Float64 + "Exciter output voltage for saturation factor: (E1, E2)" + E_sat::Tuple{Float64, Float64} + "Exciter saturation factor at exciter output voltage: (Se(E1), Se(E2))" + Se::Tuple{Float64, Float64} + "Reference Voltage Set-point (pu)" + V_ref::Float64 + "(**Do not modify.**) Coefficients (A,B) of the function: Se(V) = B(V - A)^2/V" + saturation_coeffs::Tuple{Float64, 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) are: + Vm: Sensed terminal voltage, + x_i: Internal PI-block state, + x_d: Internal Derivative-block state, + Vr: Voltage regulator state, + Efd: Exciter output state" + states::Vector{Symbol} + "(**Do not modify.**) ESAC8B has 5 states" + n_states::Int + "(**Do not modify.**) ESAC8B has 5 states" + states_types::Vector{StateTypes} + "(**Do not modify.**) PowerSystems.jl internal reference" + internal::InfrastructureSystemsInternal +end + +function ESAC8B(Tr, Kp, Ki, Kd, Td, Ka, Ta, Vr_lim, Te, Ke, E_sat, Se, V_ref=1.0, saturation_coeffs=PowerSystems.get_avr_saturation(E_sat, Se), ext=Dict{String, Any}(), ) + ESAC8B(Tr, Kp, Ki, Kd, Td, Ka, Ta, Vr_lim, Te, Ke, E_sat, Se, V_ref, saturation_coeffs, ext, [:Vm, :x_i, :x_d, :Vr, :Efd], 5, [StateTypes.Hybrid, StateTypes.Differential, StateTypes.Differential, StateTypes.Hybrid, StateTypes.Differential], InfrastructureSystemsInternal(), ) +end + +function ESAC8B(; Tr, Kp, Ki, Kd, Td, Ka, Ta, Vr_lim, Te, Ke, E_sat, Se, V_ref=1.0, saturation_coeffs=PowerSystems.get_avr_saturation(E_sat, Se), ext=Dict{String, Any}(), states=[:Vm, :x_i, :x_d, :Vr, :Efd], n_states=5, states_types=[StateTypes.Hybrid, StateTypes.Differential, StateTypes.Differential, StateTypes.Hybrid, StateTypes.Differential], internal=InfrastructureSystemsInternal(), ) + ESAC8B(Tr, Kp, Ki, Kd, Td, Ka, Ta, Vr_lim, Te, Ke, E_sat, Se, V_ref, saturation_coeffs, ext, states, n_states, states_types, internal, ) +end + +# Constructor for demo purposes; non-functional. +function ESAC8B(::Nothing) + ESAC8B(; + Tr=0, + Kp=0, + Ki=0, + Kd=0, + Td=0, + Ka=0, + Ta=0, + Vr_lim=(min=0.0, max=0.0), + Te=0, + Ke=0, + E_sat=(0.0, 0.0), + Se=(0.0, 0.0), + V_ref=0, + saturation_coeffs=(0.0, 0.0), + ext=Dict{String, Any}(), + ) +end + +"""Get [`ESAC8B`](@ref) `Tr`.""" +get_Tr(value::ESAC8B) = value.Tr +"""Get [`ESAC8B`](@ref) `Kp`.""" +get_Kp(value::ESAC8B) = value.Kp +"""Get [`ESAC8B`](@ref) `Ki`.""" +get_Ki(value::ESAC8B) = value.Ki +"""Get [`ESAC8B`](@ref) `Kd`.""" +get_Kd(value::ESAC8B) = value.Kd +"""Get [`ESAC8B`](@ref) `Td`.""" +get_Td(value::ESAC8B) = value.Td +"""Get [`ESAC8B`](@ref) `Ka`.""" +get_Ka(value::ESAC8B) = value.Ka +"""Get [`ESAC8B`](@ref) `Ta`.""" +get_Ta(value::ESAC8B) = value.Ta +"""Get [`ESAC8B`](@ref) `Vr_lim`.""" +get_Vr_lim(value::ESAC8B) = value.Vr_lim +"""Get [`ESAC8B`](@ref) `Te`.""" +get_Te(value::ESAC8B) = value.Te +"""Get [`ESAC8B`](@ref) `Ke`.""" +get_Ke(value::ESAC8B) = value.Ke +"""Get [`ESAC8B`](@ref) `E_sat`.""" +get_E_sat(value::ESAC8B) = value.E_sat +"""Get [`ESAC8B`](@ref) `Se`.""" +get_Se(value::ESAC8B) = value.Se +"""Get [`ESAC8B`](@ref) `V_ref`.""" +get_V_ref(value::ESAC8B) = value.V_ref +"""Get [`ESAC8B`](@ref) `saturation_coeffs`.""" +get_saturation_coeffs(value::ESAC8B) = value.saturation_coeffs +"""Get [`ESAC8B`](@ref) `ext`.""" +get_ext(value::ESAC8B) = value.ext +"""Get [`ESAC8B`](@ref) `states`.""" +get_states(value::ESAC8B) = value.states +"""Get [`ESAC8B`](@ref) `n_states`.""" +get_n_states(value::ESAC8B) = value.n_states +"""Get [`ESAC8B`](@ref) `states_types`.""" +get_states_types(value::ESAC8B) = value.states_types +"""Get [`ESAC8B`](@ref) `internal`.""" +get_internal(value::ESAC8B) = value.internal + +"""Set [`ESAC8B`](@ref) `Tr`.""" +set_Tr!(value::ESAC8B, val) = value.Tr = val +"""Set [`ESAC8B`](@ref) `Kp`.""" +set_Kp!(value::ESAC8B, val) = value.Kp = val +"""Set [`ESAC8B`](@ref) `Ki`.""" +set_Ki!(value::ESAC8B, val) = value.Ki = val +"""Set [`ESAC8B`](@ref) `Kd`.""" +set_Kd!(value::ESAC8B, val) = value.Kd = val +"""Set [`ESAC8B`](@ref) `Td`.""" +set_Td!(value::ESAC8B, val) = value.Td = val +"""Set [`ESAC8B`](@ref) `Ka`.""" +set_Ka!(value::ESAC8B, val) = value.Ka = val +"""Set [`ESAC8B`](@ref) `Ta`.""" +set_Ta!(value::ESAC8B, val) = value.Ta = val +"""Set [`ESAC8B`](@ref) `Vr_lim`.""" +set_Vr_lim!(value::ESAC8B, val) = value.Vr_lim = val +"""Set [`ESAC8B`](@ref) `Te`.""" +set_Te!(value::ESAC8B, val) = value.Te = val +"""Set [`ESAC8B`](@ref) `Ke`.""" +set_Ke!(value::ESAC8B, val) = value.Ke = val +"""Set [`ESAC8B`](@ref) `E_sat`.""" +set_E_sat!(value::ESAC8B, val) = value.E_sat = val +"""Set [`ESAC8B`](@ref) `Se`.""" +set_Se!(value::ESAC8B, val) = value.Se = val +"""Set [`ESAC8B`](@ref) `V_ref`.""" +set_V_ref!(value::ESAC8B, val) = value.V_ref = val +"""Set [`ESAC8B`](@ref) `saturation_coeffs`.""" +set_saturation_coeffs!(value::ESAC8B, val) = value.saturation_coeffs = val +"""Set [`ESAC8B`](@ref) `ext`.""" +set_ext!(value::ESAC8B, val) = value.ext = val +"""Set [`ESAC8B`](@ref) `states_types`.""" +set_states_types!(value::ESAC8B, val) = value.states_types = val diff --git a/src/models/generated/includes.jl b/src/models/generated/includes.jl index ae2ecdd03b..7a6cc7f3c9 100644 --- a/src/models/generated/includes.jl +++ b/src/models/generated/includes.jl @@ -54,6 +54,7 @@ include("EXAC1A.jl") include("EXAC1.jl") include("EXAC2.jl") include("ESAC6A.jl") +include("ESAC8B.jl") include("ESST1A.jl") include("EXPIC1.jl") include("ESST4B.jl") diff --git a/src/parsers/psse_dynamic_mapping.yaml b/src/parsers/psse_dynamic_mapping.yaml index 98def469a8..3ee484ec6d 100644 --- a/src/parsers/psse_dynamic_mapping.yaml +++ b/src/parsers/psse_dynamic_mapping.yaml @@ -94,6 +94,10 @@ EXST1: { AVR: EXST1 }, +ESAC8B: +{ + AVR: ESAC8B +}, ############################# #### Turbine Governors ###### @@ -234,6 +238,7 @@ parameter_mapping: SCRX: [1, 2, 3, 4, '(5, 6)', 7, 8], SEXS: [1, 2, 3, 4, '(5, 6)'], EXST1: [1, '(3, 2)', 4, 5, 6, 7, '(9, 8)', 10, 11, 12], + ESAC8B: [1, 2, 3, 4, 5, 6, 7, '(9, 8)', 10, 11, '(12, 14)', '(13, 15)'], #TGs GasTG: [1, 2, 3, 4, 5, 6, '(8, 7)', 9], GeneralGovModel: [1, 2, 3, 4, '(6, 5)', 7, 8, 9, 10, '(12, 11)', 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, '(35, 34)'], From 43bd05b09091fa2a138307f238319270fddddc1b Mon Sep 17 00:00:00 2001 From: rodrigomha Date: Tue, 16 Jul 2024 17:23:02 -0700 Subject: [PATCH 2/5] add ST6B --- src/PowerSystems.jl | 1 + src/descriptors/power_system_structs.json | 206 ++++++++++++++++++++ src/models/generated/ST6B.jl | 220 ++++++++++++++++++++++ src/models/generated/includes.jl | 17 ++ src/parsers/psse_dynamic_mapping.yaml | 5 + 5 files changed, 449 insertions(+) create mode 100644 src/models/generated/ST6B.jl diff --git a/src/PowerSystems.jl b/src/PowerSystems.jl index b82e72496a..9468753e38 100644 --- a/src/PowerSystems.jl +++ b/src/PowerSystems.jl @@ -139,6 +139,7 @@ export EXAC2 export EXPIC1 export ESST1A export ESST4B +export ST6B export SCRX export SEXS diff --git a/src/descriptors/power_system_structs.json b/src/descriptors/power_system_structs.json index d5a12508fb..1502b969e9 100644 --- a/src/descriptors/power_system_structs.json +++ b/src/descriptors/power_system_structs.json @@ -7992,6 +7992,212 @@ ], "supertype": "AVR" }, + { + "struct_name": "ST6B", + "docstring": "In these excitation systems, voltage (and also current in compounded systems) is transformed to an appropriate level. Rectifiers, either controlled or non-controlled, provide the necessary direct current for the generator field.\nParameters of IEEE Std 421.5 Type ST6B Excitacion System. ST6B in PSSE and PSLF", + "fields": [ + { + "name": "OEL_Flag", + "comment": "OEL Flag for ST6B: 1: before HV gate, 2: after HV gate", + "null_value": 0, + "data_type": "Int", + "valid_range": { + "min": 0, + "max": 2 + } + }, + { + "name": "Tr", + "comment": "Regulator input filter time constant in s", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "K_pa", + "comment": "Regulator proportional gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "K_ia", + "comment": "Regulator integral gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "K_da", + "comment": "Regulator derivative gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "T_da", + "comment": "Voltage regulator derivative channel time constant in s", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Va_lim", + "comment": "Regulator output limits (Vi_min, Vi_max)", + "null_value": "(min=0.0, max=0.0)", + "data_type": "MinMax" + }, + { + "name": "K_ff", + "comment": "Pre-control gain of the inner loop field regulator", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "K_m", + "comment": "Forward gain of the inner loop field regulator", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "K_ci", + "comment": "Exciter output current limit adjustment gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "K_lr", + "comment": "Exciter output current limiter gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "I_lr", + "comment": "Exciter current limiter reference", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Vr_lim", + "comment": "Voltage regulator limits (Vi_min, Vi_max)", + "null_value": "(min=0.0, max=0.0)", + "data_type": "MinMax" + }, + { + "name": "Kg", + "comment": "Feedback gain constant of the inner loop field regulator", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Tg", + "comment": "Feedback time constant of the inner loop field voltage regulator in s", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "V_ref", + "comment": "Reference Voltage 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) are:\n\tVm: Sensed terminal voltage,\n\tx_i: Regulator Integrator,\n\tx_d: Regulator Derivative,\n\tVg: Regulator Feedback", + "internal_default": "[:Vm, :x_i, :x_d, :Vg]", + "data_type": "Vector{Symbol}" + }, + { + "name": "n_states", + "exclude_setter": true, + "comment": "(**Do not modify.**) ST6B has 4 states", + "internal_default": 4, + "data_type": "Int" + }, + { + "name": "states_types", + "comment": "(**Do not modify.**) ST6B has 4 states", + "internal_default": "[StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid]", + "data_type": "Vector{StateTypes}" + }, + { + "name": "internal", + "comment": "(**Do not modify.**) PowerSystems.jl internal reference", + "data_type": "InfrastructureSystemsInternal", + "internal_default": "InfrastructureSystemsInternal()", + "exclude_setter": true + } + ], + "supertype": "AVR" + }, { "struct_name": "EXST1", "docstring": "IEEE Type ST1 Excitation System (PTI version)", diff --git a/src/models/generated/ST6B.jl b/src/models/generated/ST6B.jl new file mode 100644 index 0000000000..d17fa2c631 --- /dev/null +++ b/src/models/generated/ST6B.jl @@ -0,0 +1,220 @@ +#= +This file is auto-generated. Do not edit. +=# + +#! format: off + +""" + mutable struct ST6B <: AVR + OEL_Flag::Int + Tr::Float64 + K_pa::Float64 + K_ia::Float64 + K_da::Float64 + T_da::Float64 + Va_lim::MinMax + K_ff::Float64 + K_m::Float64 + K_ci::Float64 + K_lr::Float64 + I_lr::Float64 + Vr_lim::MinMax + Kg::Float64 + Tg::Float64 + V_ref::Float64 + ext::Dict{String, Any} + states::Vector{Symbol} + n_states::Int + states_types::Vector{StateTypes} + internal::InfrastructureSystemsInternal + end + +In these excitation systems, voltage (and also current in compounded systems) is transformed to an appropriate level. Rectifiers, either controlled or non-controlled, provide the necessary direct current for the generator field. +Parameters of IEEE Std 421.5 Type ST6B Excitacion System. ST6B in PSSE and PSLF + +# Arguments +- `OEL_Flag::Int`: OEL Flag for ST6B: 1: before HV gate, 2: after HV gate, validation range: `(0, 2)` +- `Tr::Float64`: Regulator input filter time constant in s, validation range: `(0, nothing)` +- `K_pa::Float64`: Regulator proportional gain, validation range: `(0, nothing)` +- `K_ia::Float64`: Regulator integral gain, validation range: `(0, nothing)` +- `K_da::Float64`: Regulator derivative gain, validation range: `(0, nothing)` +- `T_da::Float64`: Voltage regulator derivative channel time constant in s, validation range: `(0, nothing)` +- `Va_lim::MinMax`: Regulator output limits (Vi_min, Vi_max) +- `K_ff::Float64`: Pre-control gain of the inner loop field regulator, validation range: `(0, nothing)` +- `K_m::Float64`: Forward gain of the inner loop field regulator, validation range: `(0, nothing)` +- `K_ci::Float64`: Exciter output current limit adjustment gain, validation range: `(0, nothing)` +- `K_lr::Float64`: Exciter output current limiter gain, validation range: `(0, nothing)` +- `I_lr::Float64`: Exciter current limiter reference, validation range: `(0, nothing)` +- `Vr_lim::MinMax`: Voltage regulator limits (Vi_min, Vi_max) +- `Kg::Float64`: Feedback gain constant of the inner loop field regulator, validation range: `(0, nothing)` +- `Tg::Float64`: Feedback time constant of the inner loop field voltage regulator in s, validation range: `(0, nothing)` +- `V_ref::Float64`: (default: `1.0`) Reference Voltage 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) are: + Vm: Sensed terminal voltage, + x_i: Regulator Integrator, + x_d: Regulator Derivative, + Vg: Regulator Feedback +- `n_states::Int`: (**Do not modify.**) ST6B has 4 states +- `states_types::Vector{StateTypes}`: (**Do not modify.**) ST6B has 4 states +- `internal::InfrastructureSystemsInternal`: (**Do not modify.**) PowerSystems.jl internal reference +""" +mutable struct ST6B <: AVR + "OEL Flag for ST6B: 1: before HV gate, 2: after HV gate" + OEL_Flag::Int + "Regulator input filter time constant in s" + Tr::Float64 + "Regulator proportional gain" + K_pa::Float64 + "Regulator integral gain" + K_ia::Float64 + "Regulator derivative gain" + K_da::Float64 + "Voltage regulator derivative channel time constant in s" + T_da::Float64 + "Regulator output limits (Vi_min, Vi_max)" + Va_lim::MinMax + "Pre-control gain of the inner loop field regulator" + K_ff::Float64 + "Forward gain of the inner loop field regulator" + K_m::Float64 + "Exciter output current limit adjustment gain" + K_ci::Float64 + "Exciter output current limiter gain" + K_lr::Float64 + "Exciter current limiter reference" + I_lr::Float64 + "Voltage regulator limits (Vi_min, Vi_max)" + Vr_lim::MinMax + "Feedback gain constant of the inner loop field regulator" + Kg::Float64 + "Feedback time constant of the inner loop field voltage regulator in s" + Tg::Float64 + "Reference Voltage Set-point (pu)" + V_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) are: + Vm: Sensed terminal voltage, + x_i: Regulator Integrator, + x_d: Regulator Derivative, + Vg: Regulator Feedback" + states::Vector{Symbol} + "(**Do not modify.**) ST6B has 4 states" + n_states::Int + "(**Do not modify.**) ST6B has 4 states" + states_types::Vector{StateTypes} + "(**Do not modify.**) PowerSystems.jl internal reference" + internal::InfrastructureSystemsInternal +end + +function ST6B(OEL_Flag, Tr, K_pa, K_ia, K_da, T_da, Va_lim, K_ff, K_m, K_ci, K_lr, I_lr, Vr_lim, Kg, Tg, V_ref=1.0, ext=Dict{String, Any}(), ) + ST6B(OEL_Flag, Tr, K_pa, K_ia, K_da, T_da, Va_lim, K_ff, K_m, K_ci, K_lr, I_lr, Vr_lim, Kg, Tg, V_ref, ext, [:Vm, :x_i, :x_d, :Vg], 4, [StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid], InfrastructureSystemsInternal(), ) +end + +function ST6B(; OEL_Flag, Tr, K_pa, K_ia, K_da, T_da, Va_lim, K_ff, K_m, K_ci, K_lr, I_lr, Vr_lim, Kg, Tg, V_ref=1.0, ext=Dict{String, Any}(), states=[:Vm, :x_i, :x_d, :Vg], n_states=4, states_types=[StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid], internal=InfrastructureSystemsInternal(), ) + ST6B(OEL_Flag, Tr, K_pa, K_ia, K_da, T_da, Va_lim, K_ff, K_m, K_ci, K_lr, I_lr, Vr_lim, Kg, Tg, V_ref, ext, states, n_states, states_types, internal, ) +end + +# Constructor for demo purposes; non-functional. +function ST6B(::Nothing) + ST6B(; + OEL_Flag=0, + Tr=0, + K_pa=0, + K_ia=0, + K_da=0, + T_da=0, + Va_lim=(min=0.0, max=0.0), + K_ff=0, + K_m=0, + K_ci=0, + K_lr=0, + I_lr=0, + Vr_lim=(min=0.0, max=0.0), + Kg=0, + Tg=0, + V_ref=0, + ext=Dict{String, Any}(), + ) +end + +"""Get [`ST6B`](@ref) `OEL_Flag`.""" +get_OEL_Flag(value::ST6B) = value.OEL_Flag +"""Get [`ST6B`](@ref) `Tr`.""" +get_Tr(value::ST6B) = value.Tr +"""Get [`ST6B`](@ref) `K_pa`.""" +get_K_pa(value::ST6B) = value.K_pa +"""Get [`ST6B`](@ref) `K_ia`.""" +get_K_ia(value::ST6B) = value.K_ia +"""Get [`ST6B`](@ref) `K_da`.""" +get_K_da(value::ST6B) = value.K_da +"""Get [`ST6B`](@ref) `T_da`.""" +get_T_da(value::ST6B) = value.T_da +"""Get [`ST6B`](@ref) `Va_lim`.""" +get_Va_lim(value::ST6B) = value.Va_lim +"""Get [`ST6B`](@ref) `K_ff`.""" +get_K_ff(value::ST6B) = value.K_ff +"""Get [`ST6B`](@ref) `K_m`.""" +get_K_m(value::ST6B) = value.K_m +"""Get [`ST6B`](@ref) `K_ci`.""" +get_K_ci(value::ST6B) = value.K_ci +"""Get [`ST6B`](@ref) `K_lr`.""" +get_K_lr(value::ST6B) = value.K_lr +"""Get [`ST6B`](@ref) `I_lr`.""" +get_I_lr(value::ST6B) = value.I_lr +"""Get [`ST6B`](@ref) `Vr_lim`.""" +get_Vr_lim(value::ST6B) = value.Vr_lim +"""Get [`ST6B`](@ref) `Kg`.""" +get_Kg(value::ST6B) = value.Kg +"""Get [`ST6B`](@ref) `Tg`.""" +get_Tg(value::ST6B) = value.Tg +"""Get [`ST6B`](@ref) `V_ref`.""" +get_V_ref(value::ST6B) = value.V_ref +"""Get [`ST6B`](@ref) `ext`.""" +get_ext(value::ST6B) = value.ext +"""Get [`ST6B`](@ref) `states`.""" +get_states(value::ST6B) = value.states +"""Get [`ST6B`](@ref) `n_states`.""" +get_n_states(value::ST6B) = value.n_states +"""Get [`ST6B`](@ref) `states_types`.""" +get_states_types(value::ST6B) = value.states_types +"""Get [`ST6B`](@ref) `internal`.""" +get_internal(value::ST6B) = value.internal + +"""Set [`ST6B`](@ref) `OEL_Flag`.""" +set_OEL_Flag!(value::ST6B, val) = value.OEL_Flag = val +"""Set [`ST6B`](@ref) `Tr`.""" +set_Tr!(value::ST6B, val) = value.Tr = val +"""Set [`ST6B`](@ref) `K_pa`.""" +set_K_pa!(value::ST6B, val) = value.K_pa = val +"""Set [`ST6B`](@ref) `K_ia`.""" +set_K_ia!(value::ST6B, val) = value.K_ia = val +"""Set [`ST6B`](@ref) `K_da`.""" +set_K_da!(value::ST6B, val) = value.K_da = val +"""Set [`ST6B`](@ref) `T_da`.""" +set_T_da!(value::ST6B, val) = value.T_da = val +"""Set [`ST6B`](@ref) `Va_lim`.""" +set_Va_lim!(value::ST6B, val) = value.Va_lim = val +"""Set [`ST6B`](@ref) `K_ff`.""" +set_K_ff!(value::ST6B, val) = value.K_ff = val +"""Set [`ST6B`](@ref) `K_m`.""" +set_K_m!(value::ST6B, val) = value.K_m = val +"""Set [`ST6B`](@ref) `K_ci`.""" +set_K_ci!(value::ST6B, val) = value.K_ci = val +"""Set [`ST6B`](@ref) `K_lr`.""" +set_K_lr!(value::ST6B, val) = value.K_lr = val +"""Set [`ST6B`](@ref) `I_lr`.""" +set_I_lr!(value::ST6B, val) = value.I_lr = val +"""Set [`ST6B`](@ref) `Vr_lim`.""" +set_Vr_lim!(value::ST6B, val) = value.Vr_lim = val +"""Set [`ST6B`](@ref) `Kg`.""" +set_Kg!(value::ST6B, val) = value.Kg = val +"""Set [`ST6B`](@ref) `Tg`.""" +set_Tg!(value::ST6B, val) = value.Tg = val +"""Set [`ST6B`](@ref) `V_ref`.""" +set_V_ref!(value::ST6B, val) = value.V_ref = val +"""Set [`ST6B`](@ref) `ext`.""" +set_ext!(value::ST6B, val) = value.ext = val +"""Set [`ST6B`](@ref) `states_types`.""" +set_states_types!(value::ST6B, val) = value.states_types = val diff --git a/src/models/generated/includes.jl b/src/models/generated/includes.jl index 7a6cc7f3c9..e3bb999cff 100644 --- a/src/models/generated/includes.jl +++ b/src/models/generated/includes.jl @@ -58,6 +58,7 @@ include("ESAC8B.jl") include("ESST1A.jl") include("EXPIC1.jl") include("ESST4B.jl") +include("ST6B.jl") include("EXST1.jl") include("EX4VSA.jl") include("BaseMachine.jl") @@ -193,18 +194,24 @@ export get_K7 export get_K8 export get_KT export get_K_c +export get_K_ci export get_K_d +export get_K_da export get_K_ex +export get_K_ff export get_K_hp export get_K_hv export get_K_i +export get_K_ia export get_K_ig export get_K_im export get_K_ip export get_K_ir export get_K_lp export get_K_lr +export get_K_m export get_K_p +export get_K_pa export get_K_pg export get_K_pm export get_K_pr @@ -263,6 +270,7 @@ export get_Lvpl1 export get_Lvpl_sw export get_M_rtf export get_N_rtf +export get_OEL_Flag export get_Oel_lim export get_PF_Flag export get_PQ_Flag @@ -321,6 +329,7 @@ export get_TFRT_pnts export get_TVRT_pnts export get_T_AA export get_T_act +export get_T_da export get_T_eng export get_T_fltr export get_T_ft @@ -723,18 +732,24 @@ export set_K7! export set_K8! export set_KT! export set_K_c! +export set_K_ci! export set_K_d! +export set_K_da! export set_K_ex! +export set_K_ff! export set_K_hp! export set_K_hv! export set_K_i! +export set_K_ia! export set_K_ig! export set_K_im! export set_K_ip! export set_K_ir! export set_K_lp! export set_K_lr! +export set_K_m! export set_K_p! +export set_K_pa! export set_K_pg! export set_K_pm! export set_K_pr! @@ -793,6 +808,7 @@ export set_Lvpl1! export set_Lvpl_sw! export set_M_rtf! export set_N_rtf! +export set_OEL_Flag! export set_Oel_lim! export set_PF_Flag! export set_PQ_Flag! @@ -851,6 +867,7 @@ export set_TFRT_pnts! export set_TVRT_pnts! export set_T_AA! export set_T_act! +export set_T_da! export set_T_eng! export set_T_fltr! export set_T_ft! diff --git a/src/parsers/psse_dynamic_mapping.yaml b/src/parsers/psse_dynamic_mapping.yaml index 3ee484ec6d..5effe9ff01 100644 --- a/src/parsers/psse_dynamic_mapping.yaml +++ b/src/parsers/psse_dynamic_mapping.yaml @@ -98,6 +98,10 @@ ESAC8B: { AVR: ESAC8B }, +ST6B: +{ + AVR: ST6B +}, ############################# #### Turbine Governors ###### @@ -239,6 +243,7 @@ parameter_mapping: SEXS: [1, 2, 3, 4, '(5, 6)'], EXST1: [1, '(3, 2)', 4, 5, 6, 7, '(9, 8)', 10, 11, 12], ESAC8B: [1, 2, 3, 4, 5, 6, 7, '(9, 8)', 10, 11, '(12, 14)', '(13, 15)'], + ST6B: [1, 2, 3, 4, 5, 6, '(8, 7)', 9, 10, 11, 12, 13, '(15, 14)', 16, 17], #TGs GasTG: [1, 2, 3, 4, 5, 6, '(8, 7)', 9], GeneralGovModel: [1, 2, 3, 4, '(6, 5)', 7, 8, 9, 10, '(12, 11)', 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, '(35, 34)'], From 0e106450238d2b9e873dab5e8b63c1c257839255 Mon Sep 17 00:00:00 2001 From: rodrigomha Date: Tue, 16 Jul 2024 19:51:04 -0700 Subject: [PATCH 3/5] add DEGOV1 --- src/PowerSystems.jl | 1 + src/descriptors/power_system_structs.json | 163 ++++++++++++++++++++ src/models/dynamic_generator.jl | 10 ++ src/models/generated/DEGOV1.jl | 176 ++++++++++++++++++++++ src/models/generated/includes.jl | 5 + src/parsers/psse_dynamic_data.jl | 13 ++ src/parsers/psse_dynamic_mapping.yaml | 6 + 7 files changed, 374 insertions(+) create mode 100644 src/models/generated/DEGOV1.jl diff --git a/src/PowerSystems.jl b/src/PowerSystems.jl index 9468753e38..b377f4dd26 100644 --- a/src/PowerSystems.jl +++ b/src/PowerSystems.jl @@ -188,6 +188,7 @@ export HydroTurbineGov export IEEETurbineGov1 export SteamTurbineGov1 export DEGOV +export DEGOV1 # Converter Exports export Converter diff --git a/src/descriptors/power_system_structs.json b/src/descriptors/power_system_structs.json index 1502b969e9..7d2e7f1d59 100644 --- a/src/descriptors/power_system_structs.json +++ b/src/descriptors/power_system_structs.json @@ -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", diff --git a/src/models/dynamic_generator.jl b/src/models/dynamic_generator.jl index 4d46e34797..208ee4d59c 100644 --- a/src/models/dynamic_generator.jl +++ b/src/models/dynamic_generator.jl @@ -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 + else + error("Unsupported value of droop_flag on DEGOV1") + end +end diff --git a/src/models/generated/DEGOV1.jl b/src/models/generated/DEGOV1.jl new file mode 100644 index 0000000000..247ee55ed0 --- /dev/null +++ b/src/models/generated/DEGOV1.jl @@ -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(), ) +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 + +"""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 diff --git a/src/models/generated/includes.jl b/src/models/generated/includes.jl index e3bb999cff..98beba8adf 100644 --- a/src/models/generated/includes.jl +++ b/src/models/generated/includes.jl @@ -84,6 +84,7 @@ include("FiveMassShaft.jl") include("TGFixed.jl") include("GasTG.jl") include("DEGOV.jl") +include("DEGOV1.jl") include("GeneralGovModel.jl") include("SteamTurbineGov1.jl") include("HydroTurbineGov.jl") @@ -336,6 +337,7 @@ export get_T_ft export get_T_fv export get_T_g export get_T_iq +export get_T_lim export get_T_p export get_T_pord export get_T_q @@ -483,6 +485,7 @@ export get_dc_link_capacitance export get_delta_t export get_deployed_fraction export get_direction_mapping +export get_droop_flag export get_dynamic_injector export get_e_lim export get_efficiency @@ -874,6 +877,7 @@ export set_T_ft! export set_T_fv! export set_T_g! export set_T_iq! +export set_T_lim! export set_T_p! export set_T_pord! export set_T_q! @@ -1021,6 +1025,7 @@ export set_dc_link_capacitance! export set_delta_t! export set_deployed_fraction! export set_direction_mapping! +export set_droop_flag! export set_dynamic_injector! export set_e_lim! export set_efficiency! diff --git a/src/parsers/psse_dynamic_data.jl b/src/parsers/psse_dynamic_data.jl index cef5f9502c..2737ec95dd 100644 --- a/src/parsers/psse_dynamic_data.jl +++ b/src/parsers/psse_dynamic_data.jl @@ -377,6 +377,7 @@ function _parse_dyr_generator_components!( else struct_args = _populate_args(params_ix, componentValues) end + _convert_argument_types_for_gen!(struct_as_str, struct_args) temp[GEN_COMPONENT_TABLE[gen_field]] = component_constructor(struct_args...) end return @@ -459,6 +460,18 @@ function _convert_argument_types!(str::AbstractString, struct_args::Vector) end end +""" +Convert specific parameters to types that are not Float64 for +specific generator components + +""" +function _convert_argument_types_for_gen!(str::AbstractString, struct_args::Vector) + if str == "DEGOV1" + struct_args[1] = Int(struct_args[1]) + end + return +end + """ Add to a system already created the dynamic components. The system should already be parsed from a .raw file. diff --git a/src/parsers/psse_dynamic_mapping.yaml b/src/parsers/psse_dynamic_mapping.yaml index 5effe9ff01..626933948b 100644 --- a/src/parsers/psse_dynamic_mapping.yaml +++ b/src/parsers/psse_dynamic_mapping.yaml @@ -131,6 +131,11 @@ TGOV1DU: { TurbineGov: TGOV1DU }, +DEGOV1: +{ + TurbineGov: DEGOV1 +}, + ###################################### ###### Power System Stabilizers ###### ###################################### @@ -251,6 +256,7 @@ parameter_mapping: IEEETurbineGov1: [1, 2, 3, 4, 5, 6, '(8, 7)', 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], SteamTurbineGov1: [1, 2, '(4, 3)', 5, 6, 7, 0.0, 0.0, 0.0], TGOV1DU: [1, 2, '(4, 3)', 5, 6, 7, 8, 9, 10], + DEGOV1: [1, 2, 3, 4, 5, 6, 7, 8, 9, '(11, 10)', 12, 13], #PSSs: IEEEST: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, '(17, 16)', 18, 19], STAB1: [1, 2, 3, 4, 5, 6, 7], From 03af85df7d5acba4b4974df9002c80bc6b0b936b Mon Sep 17 00:00:00 2001 From: rodrigomha Date: Tue, 16 Jul 2024 20:26:49 -0700 Subject: [PATCH 4/5] add PIDGOV --- src/PowerSystems.jl | 1 + src/descriptors/power_system_structs.json | 197 +++++++++++++++++++ src/models/generated/PIDGOV.jl | 225 ++++++++++++++++++++++ src/models/generated/includes.jl | 15 ++ src/parsers/psse_dynamic_data.jl | 7 +- src/parsers/psse_dynamic_mapping.yaml | 5 + 6 files changed, 449 insertions(+), 1 deletion(-) create mode 100644 src/models/generated/PIDGOV.jl diff --git a/src/PowerSystems.jl b/src/PowerSystems.jl index b377f4dd26..e632550aed 100644 --- a/src/PowerSystems.jl +++ b/src/PowerSystems.jl @@ -189,6 +189,7 @@ export IEEETurbineGov1 export SteamTurbineGov1 export DEGOV export DEGOV1 +export PIDGOV # Converter Exports export Converter diff --git a/src/descriptors/power_system_structs.json b/src/descriptors/power_system_structs.json index 7d2e7f1d59..eac4509ad6 100644 --- a/src/descriptors/power_system_structs.json +++ b/src/descriptors/power_system_structs.json @@ -12659,6 +12659,203 @@ ], "supertype": "TurbineGov" }, + { + "struct_name": "PIDGOV", + "docstring": "Hydro Turbine-Governor with PID controller. 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", + "fields": [ + { + "name": "feedback_flag", + "comment": "Feedback signal for governor droop: 0 for electrical power, and 1 for gate position.", + "null_value": 1, + "data_type": "Int", + "valid_range": { + "min": 0, + "max": 1 + }, + "validation_action": "error" + }, + { + "name": "Rperm", + "comment": "Speed permanent droop parameter", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "T_reg", + "comment": "Speed detector time constant", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Kp", + "comment": "Governor proportional gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Ki", + "comment": "Governor integral gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Kd", + "comment": "Governor derivative gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Ta", + "comment": "Governor derivative time constant", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Tb", + "comment": "Gate-servo time constant", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "D_turb", + "comment": "Turbine damping factor", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "gate_openings", + "comment": "Gate-opening speed at different loads", + "null_value": "(0.0, 0.0, 0.0)", + "data_type": "Tuple{Float64, Float64, Float64}" + }, + { + "name": "power_gate_openings", + "comment": "Power at gate_openings", + "null_value": "(0.0, 0.0, 0.0)", + "data_type": "Tuple{Float64, Float64, Float64}" + }, + { + "name": "G_lim", + "comment": "Minimum/Maximum Gate openings `(G_min, G_max)`.", + "null_value": "(min=0.0, max=0.0)", + "data_type": "MinMax" + }, + { + "name": "A_tw", + "comment": "Factor multiplying Tw", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": "eps()", + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Tw", + "comment": "Water inertia time constant, sec", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": "eps()", + "max": null + }, + "validation_action": "warn" + }, + { + "name": "V_lim", + "comment": "Gate opening velocity limits `(G_min, G_max)`.", + "null_value": "(min=0.0, max=0.0)", + "data_type": "MinMax" + }, + { + "name": "P_ref", + "comment": "Reference Power 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 PIDGOV model are:\n\tx_g1: Filtered input measurement,\n\tx_g2: PI block internal state,\n\tx_g3: First regulator state, \n\tx_g4: Derivative block internal state, \n\tx_g5: Second regulator state, \n\tx_g6: Gate position state, \n\tx_g7: Water inertia state", + "internal_default": "[:x_g1, :x_g2, :x_g3, :x_g4, :x_g5, :x_g6, :x_g7]", + "data_type": "Vector{Symbol}" + }, + { + "name": "n_states", + "exclude_setter": true, + "comment": "(**Do not modify.**) PIDGOV has 7 states", + "internal_default": 7, + "data_type": "Int" + }, + { + "name": "states_types", + "comment": "(**Do not modify.**) PIDGOV has 7 [differential](@ref states_list) [states](@ref S)", + "internal_default": "[StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid]", + "data_type": "Vector{StateTypes}" + }, + { + "name": "internal", + "comment": "(**Do not modify.**) PowerSystems.jl internal reference", + "data_type": "InfrastructureSystemsInternal", + "internal_default": "InfrastructureSystemsInternal()", + "exclude_setter": true + } + ], + "supertype": "TurbineGov" + }, { "struct_name": "SteamTurbineGov1", "docstring": "Steam Turbine-Governor. This model considers both TGOV1 or TGOV1DU in PSS/E", diff --git a/src/models/generated/PIDGOV.jl b/src/models/generated/PIDGOV.jl new file mode 100644 index 0000000000..edaed063c9 --- /dev/null +++ b/src/models/generated/PIDGOV.jl @@ -0,0 +1,225 @@ +#= +This file is auto-generated. Do not edit. +=# + +#! format: off + +""" + mutable struct PIDGOV <: TurbineGov + feedback_flag::Int + Rperm::Float64 + T_reg::Float64 + Kp::Float64 + Ki::Float64 + Kd::Float64 + Ta::Float64 + Tb::Float64 + D_turb::Float64 + gate_openings::Tuple{Float64, Float64, Float64} + power_gate_openings::Tuple{Float64, Float64, Float64} + G_lim::MinMax + A_tw::Float64 + Tw::Float64 + V_lim::MinMax + P_ref::Float64 + ext::Dict{String, Any} + states::Vector{Symbol} + n_states::Int + states_types::Vector{StateTypes} + internal::InfrastructureSystemsInternal + end + +Hydro Turbine-Governor with PID controller. 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 + +# Arguments +- `feedback_flag::Int`: Feedback signal for governor droop: 0 for electrical power, and 1 for gate position., validation range: `(0, 1)` +- `Rperm::Float64`: Speed permanent droop parameter, validation range: `(0, nothing)` +- `T_reg::Float64`: Speed detector time constant, validation range: `(0, nothing)` +- `Kp::Float64`: Governor proportional gain, validation range: `(0, nothing)` +- `Ki::Float64`: Governor integral gain, validation range: `(0, nothing)` +- `Kd::Float64`: Governor derivative gain, validation range: `(0, nothing)` +- `Ta::Float64`: Governor derivative time constant, validation range: `(0, nothing)` +- `Tb::Float64`: Gate-servo time constant, validation range: `(0, nothing)` +- `D_turb::Float64`: Turbine damping factor, validation range: `(0, nothing)` +- `gate_openings::Tuple{Float64, Float64, Float64}`: Gate-opening speed at different loads +- `power_gate_openings::Tuple{Float64, Float64, Float64}`: Power at gate_openings +- `G_lim::MinMax`: Minimum/Maximum Gate openings `(G_min, G_max)`. +- `A_tw::Float64`: Factor multiplying Tw, validation range: `(eps(), nothing)` +- `Tw::Float64`: Water inertia time constant, sec, validation range: `(eps(), nothing)` +- `V_lim::MinMax`: Gate opening velocity limits `(G_min, G_max)`. +- `P_ref::Float64`: (default: `1.0`) Reference Power 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 PIDGOV model are: + x_g1: Filtered input measurement, + x_g2: PI block internal state, + x_g3: First regulator state, + x_g4: Derivative block internal state, + x_g5: Second regulator state, + x_g6: Gate position state, + x_g7: Water inertia state +- `n_states::Int`: (**Do not modify.**) PIDGOV has 7 states +- `states_types::Vector{StateTypes}`: (**Do not modify.**) PIDGOV has 7 [differential](@ref states_list) [states](@ref S) +- `internal::InfrastructureSystemsInternal`: (**Do not modify.**) PowerSystems.jl internal reference +""" +mutable struct PIDGOV <: TurbineGov + "Feedback signal for governor droop: 0 for electrical power, and 1 for gate position." + feedback_flag::Int + "Speed permanent droop parameter" + Rperm::Float64 + "Speed detector time constant" + T_reg::Float64 + "Governor proportional gain" + Kp::Float64 + "Governor integral gain" + Ki::Float64 + "Governor derivative gain" + Kd::Float64 + "Governor derivative time constant" + Ta::Float64 + "Gate-servo time constant" + Tb::Float64 + "Turbine damping factor" + D_turb::Float64 + "Gate-opening speed at different loads" + gate_openings::Tuple{Float64, Float64, Float64} + "Power at gate_openings" + power_gate_openings::Tuple{Float64, Float64, Float64} + "Minimum/Maximum Gate openings `(G_min, G_max)`." + G_lim::MinMax + "Factor multiplying Tw" + A_tw::Float64 + "Water inertia time constant, sec" + Tw::Float64 + "Gate opening velocity limits `(G_min, G_max)`." + V_lim::MinMax + "Reference Power 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 PIDGOV model are: + x_g1: Filtered input measurement, + x_g2: PI block internal state, + x_g3: First regulator state, + x_g4: Derivative block internal state, + x_g5: Second regulator state, + x_g6: Gate position state, + x_g7: Water inertia state" + states::Vector{Symbol} + "(**Do not modify.**) PIDGOV has 7 states" + n_states::Int + "(**Do not modify.**) PIDGOV has 7 [differential](@ref states_list) [states](@ref S)" + states_types::Vector{StateTypes} + "(**Do not modify.**) PowerSystems.jl internal reference" + internal::InfrastructureSystemsInternal +end + +function PIDGOV(feedback_flag, Rperm, T_reg, Kp, Ki, Kd, Ta, Tb, D_turb, gate_openings, power_gate_openings, G_lim, A_tw, Tw, V_lim, P_ref=1.0, ext=Dict{String, Any}(), ) + PIDGOV(feedback_flag, Rperm, T_reg, Kp, Ki, Kd, Ta, Tb, D_turb, gate_openings, power_gate_openings, G_lim, A_tw, Tw, V_lim, P_ref, ext, [:x_g1, :x_g2, :x_g3, :x_g4, :x_g5, :x_g6, :x_g7], 7, [StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid], InfrastructureSystemsInternal(), ) +end + +function PIDGOV(; feedback_flag, Rperm, T_reg, Kp, Ki, Kd, Ta, Tb, D_turb, gate_openings, power_gate_openings, G_lim, A_tw, Tw, V_lim, P_ref=1.0, ext=Dict{String, Any}(), states=[:x_g1, :x_g2, :x_g3, :x_g4, :x_g5, :x_g6, :x_g7], n_states=7, states_types=[StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid], internal=InfrastructureSystemsInternal(), ) + PIDGOV(feedback_flag, Rperm, T_reg, Kp, Ki, Kd, Ta, Tb, D_turb, gate_openings, power_gate_openings, G_lim, A_tw, Tw, V_lim, P_ref, ext, states, n_states, states_types, internal, ) +end + +# Constructor for demo purposes; non-functional. +function PIDGOV(::Nothing) + PIDGOV(; + feedback_flag=1, + Rperm=0, + T_reg=0, + Kp=0, + Ki=0, + Kd=0, + Ta=0, + Tb=0, + D_turb=0, + gate_openings=(0.0, 0.0, 0.0), + power_gate_openings=(0.0, 0.0, 0.0), + G_lim=(min=0.0, max=0.0), + A_tw=0, + Tw=0, + V_lim=(min=0.0, max=0.0), + P_ref=0, + ext=Dict{String, Any}(), + ) +end + +"""Get [`PIDGOV`](@ref) `feedback_flag`.""" +get_feedback_flag(value::PIDGOV) = value.feedback_flag +"""Get [`PIDGOV`](@ref) `Rperm`.""" +get_Rperm(value::PIDGOV) = value.Rperm +"""Get [`PIDGOV`](@ref) `T_reg`.""" +get_T_reg(value::PIDGOV) = value.T_reg +"""Get [`PIDGOV`](@ref) `Kp`.""" +get_Kp(value::PIDGOV) = value.Kp +"""Get [`PIDGOV`](@ref) `Ki`.""" +get_Ki(value::PIDGOV) = value.Ki +"""Get [`PIDGOV`](@ref) `Kd`.""" +get_Kd(value::PIDGOV) = value.Kd +"""Get [`PIDGOV`](@ref) `Ta`.""" +get_Ta(value::PIDGOV) = value.Ta +"""Get [`PIDGOV`](@ref) `Tb`.""" +get_Tb(value::PIDGOV) = value.Tb +"""Get [`PIDGOV`](@ref) `D_turb`.""" +get_D_turb(value::PIDGOV) = value.D_turb +"""Get [`PIDGOV`](@ref) `gate_openings`.""" +get_gate_openings(value::PIDGOV) = value.gate_openings +"""Get [`PIDGOV`](@ref) `power_gate_openings`.""" +get_power_gate_openings(value::PIDGOV) = value.power_gate_openings +"""Get [`PIDGOV`](@ref) `G_lim`.""" +get_G_lim(value::PIDGOV) = value.G_lim +"""Get [`PIDGOV`](@ref) `A_tw`.""" +get_A_tw(value::PIDGOV) = value.A_tw +"""Get [`PIDGOV`](@ref) `Tw`.""" +get_Tw(value::PIDGOV) = value.Tw +"""Get [`PIDGOV`](@ref) `V_lim`.""" +get_V_lim(value::PIDGOV) = value.V_lim +"""Get [`PIDGOV`](@ref) `P_ref`.""" +get_P_ref(value::PIDGOV) = value.P_ref +"""Get [`PIDGOV`](@ref) `ext`.""" +get_ext(value::PIDGOV) = value.ext +"""Get [`PIDGOV`](@ref) `states`.""" +get_states(value::PIDGOV) = value.states +"""Get [`PIDGOV`](@ref) `n_states`.""" +get_n_states(value::PIDGOV) = value.n_states +"""Get [`PIDGOV`](@ref) `states_types`.""" +get_states_types(value::PIDGOV) = value.states_types +"""Get [`PIDGOV`](@ref) `internal`.""" +get_internal(value::PIDGOV) = value.internal + +"""Set [`PIDGOV`](@ref) `feedback_flag`.""" +set_feedback_flag!(value::PIDGOV, val) = value.feedback_flag = val +"""Set [`PIDGOV`](@ref) `Rperm`.""" +set_Rperm!(value::PIDGOV, val) = value.Rperm = val +"""Set [`PIDGOV`](@ref) `T_reg`.""" +set_T_reg!(value::PIDGOV, val) = value.T_reg = val +"""Set [`PIDGOV`](@ref) `Kp`.""" +set_Kp!(value::PIDGOV, val) = value.Kp = val +"""Set [`PIDGOV`](@ref) `Ki`.""" +set_Ki!(value::PIDGOV, val) = value.Ki = val +"""Set [`PIDGOV`](@ref) `Kd`.""" +set_Kd!(value::PIDGOV, val) = value.Kd = val +"""Set [`PIDGOV`](@ref) `Ta`.""" +set_Ta!(value::PIDGOV, val) = value.Ta = val +"""Set [`PIDGOV`](@ref) `Tb`.""" +set_Tb!(value::PIDGOV, val) = value.Tb = val +"""Set [`PIDGOV`](@ref) `D_turb`.""" +set_D_turb!(value::PIDGOV, val) = value.D_turb = val +"""Set [`PIDGOV`](@ref) `gate_openings`.""" +set_gate_openings!(value::PIDGOV, val) = value.gate_openings = val +"""Set [`PIDGOV`](@ref) `power_gate_openings`.""" +set_power_gate_openings!(value::PIDGOV, val) = value.power_gate_openings = val +"""Set [`PIDGOV`](@ref) `G_lim`.""" +set_G_lim!(value::PIDGOV, val) = value.G_lim = val +"""Set [`PIDGOV`](@ref) `A_tw`.""" +set_A_tw!(value::PIDGOV, val) = value.A_tw = val +"""Set [`PIDGOV`](@ref) `Tw`.""" +set_Tw!(value::PIDGOV, val) = value.Tw = val +"""Set [`PIDGOV`](@ref) `V_lim`.""" +set_V_lim!(value::PIDGOV, val) = value.V_lim = val +"""Set [`PIDGOV`](@ref) `P_ref`.""" +set_P_ref!(value::PIDGOV, val) = value.P_ref = val +"""Set [`PIDGOV`](@ref) `ext`.""" +set_ext!(value::PIDGOV, val) = value.ext = val +"""Set [`PIDGOV`](@ref) `states_types`.""" +set_states_types!(value::PIDGOV, val) = value.states_types = val diff --git a/src/models/generated/includes.jl b/src/models/generated/includes.jl index 98beba8adf..0c2648349d 100644 --- a/src/models/generated/includes.jl +++ b/src/models/generated/includes.jl @@ -86,6 +86,7 @@ include("GasTG.jl") include("DEGOV.jl") include("DEGOV1.jl") include("GeneralGovModel.jl") +include("PIDGOV.jl") include("SteamTurbineGov1.jl") include("HydroTurbineGov.jl") include("IEEETurbineGov1.jl") @@ -133,6 +134,7 @@ export get_A5 export get_A6 export get_AT export get_A_set +export get_A_tw export get_Accel export get_Ae export get_At @@ -166,6 +168,7 @@ export get_FRT_pnts export get_Freq_Flag export get_Ftrip_Flag export get_G +export get_G_lim export get_Gen_Flag export get_H export get_H_ex @@ -304,6 +307,7 @@ export get_Recon_Flag export get_Ref_Flag export get_Rmin export get_Rp +export get_Rperm export get_Rrpwr export get_Rselect export get_SOC_ini @@ -342,6 +346,7 @@ export get_T_p export get_T_pord export get_T_q export get_T_rate +export get_T_reg export get_T_rv export get_Ta export get_Ta_2 @@ -494,6 +499,7 @@ export get_ext export get_f export get_fdbd_pnts export get_fe_lim +export get_feedback_flag export get_fh export get_fl export get_flow_limits @@ -504,6 +510,7 @@ export get_from_branch_control export get_fs export get_fuel export get_fuel_flag +export get_gate_openings export get_gate_position_limits export get_hysteresis_binary_logic export get_impedance_active_power @@ -579,6 +586,7 @@ export get_peak_active_power export get_peak_reactive_power export get_phase_angle_limits export get_power_factor +export get_power_gate_openings export get_power_trajectory export get_primary_shunt export get_prime_mover_type @@ -673,6 +681,7 @@ export set_A5! export set_A6! export set_AT! export set_A_set! +export set_A_tw! export set_Accel! export set_Ae! export set_At! @@ -706,6 +715,7 @@ export set_FRT_pnts! export set_Freq_Flag! export set_Ftrip_Flag! export set_G! +export set_G_lim! export set_Gen_Flag! export set_H! export set_H_ex! @@ -844,6 +854,7 @@ export set_Recon_Flag! export set_Ref_Flag! export set_Rmin! export set_Rp! +export set_Rperm! export set_Rrpwr! export set_Rselect! export set_SOC_ini! @@ -882,6 +893,7 @@ export set_T_p! export set_T_pord! export set_T_q! export set_T_rate! +export set_T_reg! export set_T_rv! export set_Ta! export set_Ta_2! @@ -1034,6 +1046,7 @@ export set_ext! export set_f! export set_fdbd_pnts! export set_fe_lim! +export set_feedback_flag! export set_fh! export set_fl! export set_flow_limits! @@ -1044,6 +1057,7 @@ export set_from_branch_control! export set_fs! export set_fuel! export set_fuel_flag! +export set_gate_openings! export set_gate_position_limits! export set_hysteresis_binary_logic! export set_impedance_active_power! @@ -1119,6 +1133,7 @@ export set_peak_active_power! export set_peak_reactive_power! export set_phase_angle_limits! export set_power_factor! +export set_power_gate_openings! export set_power_trajectory! export set_primary_shunt! export set_prime_mover_type! diff --git a/src/parsers/psse_dynamic_data.jl b/src/parsers/psse_dynamic_data.jl index 2737ec95dd..99433a8ea5 100644 --- a/src/parsers/psse_dynamic_data.jl +++ b/src/parsers/psse_dynamic_data.jl @@ -61,10 +61,15 @@ function _parse_input_types(_v, val) return NaN # If the parameter is a tuple (as a string), then construct the tuple directly. elseif isa(_v, String) + #TODO: Generalize n-length tuple m = match(r"^\((\d+)\s*,\s*(\d+)\)$", _v) + m2 = match(r"^\((\d+)\s*,\s*(\d+),\s*(\d+)\)$", _v) if m !== nothing _tuple_ix = parse.(Int, m.captures) return Tuple(val[_tuple_ix]) + elseif m2 !== nothing + _tuple_ix = parse.(Int, m2.captures) + return Tuple(val[_tuple_ix]) else error("String $(_v) not recognized for parsing") end @@ -466,7 +471,7 @@ specific generator components """ function _convert_argument_types_for_gen!(str::AbstractString, struct_args::Vector) - if str == "DEGOV1" + if (str == "DEGOV1") || (str == "PIDGOV") struct_args[1] = Int(struct_args[1]) end return diff --git a/src/parsers/psse_dynamic_mapping.yaml b/src/parsers/psse_dynamic_mapping.yaml index 626933948b..ee0596d759 100644 --- a/src/parsers/psse_dynamic_mapping.yaml +++ b/src/parsers/psse_dynamic_mapping.yaml @@ -135,6 +135,10 @@ DEGOV1: { TurbineGov: DEGOV1 }, +PIDGOV: +{ + TurbineGov: PIDGOV +}, ###################################### ###### Power System Stabilizers ###### @@ -257,6 +261,7 @@ parameter_mapping: SteamTurbineGov1: [1, 2, '(4, 3)', 5, 6, 7, 0.0, 0.0, 0.0], TGOV1DU: [1, 2, '(4, 3)', 5, 6, 7, 8, 9, 10], DEGOV1: [1, 2, 3, 4, 5, 6, 7, 8, 9, '(11, 10)', 12, 13], + PIDGOV: [1, 2, 3, 4, 5, 6, 7, 8, 9, '(10, 11, 13)', '(12, 14, 15)', '(17, 16)', 18, 19, '(21, 20)'], #PSSs: IEEEST: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, '(17, 16)', 18, 19], STAB1: [1, 2, 3, 4, 5, 6, 7], From 940132eef67d77097a05556e3a448541112de379 Mon Sep 17 00:00:00 2001 From: rodrigomha Date: Tue, 16 Jul 2024 20:46:31 -0700 Subject: [PATCH 5/5] add WPIDHY struct --- src/PowerSystems.jl | 1 + src/descriptors/power_system_structs.json | 183 +++++++++++++++++- src/models/generated/PIDGOV.jl | 2 +- src/models/generated/WPIDHY.jl | 216 ++++++++++++++++++++++ src/models/generated/includes.jl | 3 + src/parsers/psse_dynamic_mapping.yaml | 5 + 6 files changed, 408 insertions(+), 2 deletions(-) create mode 100644 src/models/generated/WPIDHY.jl diff --git a/src/PowerSystems.jl b/src/PowerSystems.jl index e632550aed..4f59df6121 100644 --- a/src/PowerSystems.jl +++ b/src/PowerSystems.jl @@ -190,6 +190,7 @@ export SteamTurbineGov1 export DEGOV export DEGOV1 export PIDGOV +export WPIDHY # Converter Exports export Converter diff --git a/src/descriptors/power_system_structs.json b/src/descriptors/power_system_structs.json index eac4509ad6..aa3db10041 100644 --- a/src/descriptors/power_system_structs.json +++ b/src/descriptors/power_system_structs.json @@ -12661,7 +12661,7 @@ }, { "struct_name": "PIDGOV", - "docstring": "Hydro Turbine-Governor with PID controller. 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", + "docstring": "Hydro Turbine-Governor with PID controller.", "fields": [ { "name": "feedback_flag", @@ -12856,6 +12856,187 @@ ], "supertype": "TurbineGov" }, + { + "struct_name": "WPIDHY", + "docstring": "Woodward PID Hydro Governor", + "fields": [ + { + "name": "T_reg", + "comment": "Input time constant of the governor in s", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "reg", + "comment": "Input governor gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Kp", + "comment": "Governor proportional gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Ki", + "comment": "Governor integral gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Kd", + "comment": "Governor derivative gain", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Ta", + "comment": "Governor derivative/high-frequency time constant", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "Tb", + "comment": "Gate-servo time constant", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "V_lim", + "comment": "Gate opening velocity limits `(G_min, G_max)`.", + "null_value": "(min=0.0, max=0.0)", + "data_type": "MinMax" + }, + { + "name": "G_lim", + "comment": "Minimum/Maximum Gate velocity `(G_min, G_max)`.", + "null_value": "(min=0.0, max=0.0)", + "data_type": "MinMax" + }, + { + "name": "Tw", + "comment": "Water inertia time constant, sec", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": "eps()", + "max": null + }, + "validation_action": "warn" + }, + { + "name": "P_lim", + "comment": "Minimum/Maximum Gate openings `(P_min, P_max)`.", + "null_value": "(min=0.0, max=0.0)", + "data_type": "MinMax" + }, + { + "name": "D", + "comment": "Turbine damping coefficient", + "null_value": 0, + "data_type": "Float64", + "valid_range": { + "min": 0, + "max": null + }, + "validation_action": "warn" + }, + { + "name": "gate_openings", + "comment": "Gate-opening speed at different loads", + "null_value": "(0.0, 0.0, 0.0)", + "data_type": "Tuple{Float64, Float64, Float64}" + }, + { + "name": "power_gate_openings", + "comment": "Power at gate_openings", + "null_value": "(0.0, 0.0, 0.0)", + "data_type": "Tuple{Float64, Float64, Float64}" + }, + { + "name": "P_ref", + "comment": "Reference Power 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 PIDGOV model are:\n\tx_g1: Filtered input measurement,\n\tx_g2: PI block internal state,\n\tx_g3: First regulator state, \n\tx_g4: Derivative block internal state, \n\tx_g5: Second regulator state, \n\tx_g6: Gate position state, \n\tx_g7: Water inertia state", + "internal_default": "[:x_g1, :x_g2, :x_g3, :x_g4, :x_g5, :x_g6, :x_g7]", + "data_type": "Vector{Symbol}" + }, + { + "name": "n_states", + "exclude_setter": true, + "comment": "(**Do not modify.**) PIDGOV has 7 states", + "internal_default": 7, + "data_type": "Int" + }, + { + "name": "states_types", + "comment": "(**Do not modify.**) PIDGOV has 7 [differential](@ref states_list) [states](@ref S)", + "internal_default": "[StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid]", + "data_type": "Vector{StateTypes}" + }, + { + "name": "internal", + "comment": "(**Do not modify.**) PowerSystems.jl internal reference", + "data_type": "InfrastructureSystemsInternal", + "internal_default": "InfrastructureSystemsInternal()", + "exclude_setter": true + } + ], + "supertype": "TurbineGov" + }, { "struct_name": "SteamTurbineGov1", "docstring": "Steam Turbine-Governor. This model considers both TGOV1 or TGOV1DU in PSS/E", diff --git a/src/models/generated/PIDGOV.jl b/src/models/generated/PIDGOV.jl index edaed063c9..6464e9b7ad 100644 --- a/src/models/generated/PIDGOV.jl +++ b/src/models/generated/PIDGOV.jl @@ -29,7 +29,7 @@ This file is auto-generated. Do not edit. internal::InfrastructureSystemsInternal end -Hydro Turbine-Governor with PID controller. 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 +Hydro Turbine-Governor with PID controller. # Arguments - `feedback_flag::Int`: Feedback signal for governor droop: 0 for electrical power, and 1 for gate position., validation range: `(0, 1)` diff --git a/src/models/generated/WPIDHY.jl b/src/models/generated/WPIDHY.jl new file mode 100644 index 0000000000..3ba1af216c --- /dev/null +++ b/src/models/generated/WPIDHY.jl @@ -0,0 +1,216 @@ +#= +This file is auto-generated. Do not edit. +=# + +#! format: off + +""" + mutable struct WPIDHY <: TurbineGov + T_reg::Float64 + reg::Float64 + Kp::Float64 + Ki::Float64 + Kd::Float64 + Ta::Float64 + Tb::Float64 + V_lim::MinMax + G_lim::MinMax + Tw::Float64 + P_lim::MinMax + D::Float64 + gate_openings::Tuple{Float64, Float64, Float64} + power_gate_openings::Tuple{Float64, Float64, Float64} + P_ref::Float64 + ext::Dict{String, Any} + states::Vector{Symbol} + n_states::Int + states_types::Vector{StateTypes} + internal::InfrastructureSystemsInternal + end + +Woodward PID Hydro Governor + +# Arguments +- `T_reg::Float64`: Input time constant of the governor in s, validation range: `(0, nothing)` +- `reg::Float64`: Input governor gain, validation range: `(0, nothing)` +- `Kp::Float64`: Governor proportional gain, validation range: `(0, nothing)` +- `Ki::Float64`: Governor integral gain, validation range: `(0, nothing)` +- `Kd::Float64`: Governor derivative gain, validation range: `(0, nothing)` +- `Ta::Float64`: Governor derivative/high-frequency time constant, validation range: `(0, nothing)` +- `Tb::Float64`: Gate-servo time constant, validation range: `(0, nothing)` +- `V_lim::MinMax`: Gate opening velocity limits `(G_min, G_max)`. +- `G_lim::MinMax`: Minimum/Maximum Gate velocity `(G_min, G_max)`. +- `Tw::Float64`: Water inertia time constant, sec, validation range: `(eps(), nothing)` +- `P_lim::MinMax`: Minimum/Maximum Gate openings `(P_min, P_max)`. +- `D::Float64`: Turbine damping coefficient, validation range: `(0, nothing)` +- `gate_openings::Tuple{Float64, Float64, Float64}`: Gate-opening speed at different loads +- `power_gate_openings::Tuple{Float64, Float64, Float64}`: Power at gate_openings +- `P_ref::Float64`: (default: `1.0`) Reference Power 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 PIDGOV model are: + x_g1: Filtered input measurement, + x_g2: PI block internal state, + x_g3: First regulator state, + x_g4: Derivative block internal state, + x_g5: Second regulator state, + x_g6: Gate position state, + x_g7: Water inertia state +- `n_states::Int`: (**Do not modify.**) PIDGOV has 7 states +- `states_types::Vector{StateTypes}`: (**Do not modify.**) PIDGOV has 7 [differential](@ref states_list) [states](@ref S) +- `internal::InfrastructureSystemsInternal`: (**Do not modify.**) PowerSystems.jl internal reference +""" +mutable struct WPIDHY <: TurbineGov + "Input time constant of the governor in s" + T_reg::Float64 + "Input governor gain" + reg::Float64 + "Governor proportional gain" + Kp::Float64 + "Governor integral gain" + Ki::Float64 + "Governor derivative gain" + Kd::Float64 + "Governor derivative/high-frequency time constant" + Ta::Float64 + "Gate-servo time constant" + Tb::Float64 + "Gate opening velocity limits `(G_min, G_max)`." + V_lim::MinMax + "Minimum/Maximum Gate velocity `(G_min, G_max)`." + G_lim::MinMax + "Water inertia time constant, sec" + Tw::Float64 + "Minimum/Maximum Gate openings `(P_min, P_max)`." + P_lim::MinMax + "Turbine damping coefficient" + D::Float64 + "Gate-opening speed at different loads" + gate_openings::Tuple{Float64, Float64, Float64} + "Power at gate_openings" + power_gate_openings::Tuple{Float64, Float64, Float64} + "Reference Power 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 PIDGOV model are: + x_g1: Filtered input measurement, + x_g2: PI block internal state, + x_g3: First regulator state, + x_g4: Derivative block internal state, + x_g5: Second regulator state, + x_g6: Gate position state, + x_g7: Water inertia state" + states::Vector{Symbol} + "(**Do not modify.**) PIDGOV has 7 states" + n_states::Int + "(**Do not modify.**) PIDGOV has 7 [differential](@ref states_list) [states](@ref S)" + states_types::Vector{StateTypes} + "(**Do not modify.**) PowerSystems.jl internal reference" + internal::InfrastructureSystemsInternal +end + +function WPIDHY(T_reg, reg, Kp, Ki, Kd, Ta, Tb, V_lim, G_lim, Tw, P_lim, D, gate_openings, power_gate_openings, P_ref=1.0, ext=Dict{String, Any}(), ) + WPIDHY(T_reg, reg, Kp, Ki, Kd, Ta, Tb, V_lim, G_lim, Tw, P_lim, D, gate_openings, power_gate_openings, P_ref, ext, [:x_g1, :x_g2, :x_g3, :x_g4, :x_g5, :x_g6, :x_g7], 7, [StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid], InfrastructureSystemsInternal(), ) +end + +function WPIDHY(; T_reg, reg, Kp, Ki, Kd, Ta, Tb, V_lim, G_lim, Tw, P_lim, D, gate_openings, power_gate_openings, P_ref=1.0, ext=Dict{String, Any}(), states=[:x_g1, :x_g2, :x_g3, :x_g4, :x_g5, :x_g6, :x_g7], n_states=7, states_types=[StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid, StateTypes.Hybrid], internal=InfrastructureSystemsInternal(), ) + WPIDHY(T_reg, reg, Kp, Ki, Kd, Ta, Tb, V_lim, G_lim, Tw, P_lim, D, gate_openings, power_gate_openings, P_ref, ext, states, n_states, states_types, internal, ) +end + +# Constructor for demo purposes; non-functional. +function WPIDHY(::Nothing) + WPIDHY(; + T_reg=0, + reg=0, + Kp=0, + Ki=0, + Kd=0, + Ta=0, + Tb=0, + V_lim=(min=0.0, max=0.0), + G_lim=(min=0.0, max=0.0), + Tw=0, + P_lim=(min=0.0, max=0.0), + D=0, + gate_openings=(0.0, 0.0, 0.0), + power_gate_openings=(0.0, 0.0, 0.0), + P_ref=0, + ext=Dict{String, Any}(), + ) +end + +"""Get [`WPIDHY`](@ref) `T_reg`.""" +get_T_reg(value::WPIDHY) = value.T_reg +"""Get [`WPIDHY`](@ref) `reg`.""" +get_reg(value::WPIDHY) = value.reg +"""Get [`WPIDHY`](@ref) `Kp`.""" +get_Kp(value::WPIDHY) = value.Kp +"""Get [`WPIDHY`](@ref) `Ki`.""" +get_Ki(value::WPIDHY) = value.Ki +"""Get [`WPIDHY`](@ref) `Kd`.""" +get_Kd(value::WPIDHY) = value.Kd +"""Get [`WPIDHY`](@ref) `Ta`.""" +get_Ta(value::WPIDHY) = value.Ta +"""Get [`WPIDHY`](@ref) `Tb`.""" +get_Tb(value::WPIDHY) = value.Tb +"""Get [`WPIDHY`](@ref) `V_lim`.""" +get_V_lim(value::WPIDHY) = value.V_lim +"""Get [`WPIDHY`](@ref) `G_lim`.""" +get_G_lim(value::WPIDHY) = value.G_lim +"""Get [`WPIDHY`](@ref) `Tw`.""" +get_Tw(value::WPIDHY) = value.Tw +"""Get [`WPIDHY`](@ref) `P_lim`.""" +get_P_lim(value::WPIDHY) = value.P_lim +"""Get [`WPIDHY`](@ref) `D`.""" +get_D(value::WPIDHY) = value.D +"""Get [`WPIDHY`](@ref) `gate_openings`.""" +get_gate_openings(value::WPIDHY) = value.gate_openings +"""Get [`WPIDHY`](@ref) `power_gate_openings`.""" +get_power_gate_openings(value::WPIDHY) = value.power_gate_openings +"""Get [`WPIDHY`](@ref) `P_ref`.""" +get_P_ref(value::WPIDHY) = value.P_ref +"""Get [`WPIDHY`](@ref) `ext`.""" +get_ext(value::WPIDHY) = value.ext +"""Get [`WPIDHY`](@ref) `states`.""" +get_states(value::WPIDHY) = value.states +"""Get [`WPIDHY`](@ref) `n_states`.""" +get_n_states(value::WPIDHY) = value.n_states +"""Get [`WPIDHY`](@ref) `states_types`.""" +get_states_types(value::WPIDHY) = value.states_types +"""Get [`WPIDHY`](@ref) `internal`.""" +get_internal(value::WPIDHY) = value.internal + +"""Set [`WPIDHY`](@ref) `T_reg`.""" +set_T_reg!(value::WPIDHY, val) = value.T_reg = val +"""Set [`WPIDHY`](@ref) `reg`.""" +set_reg!(value::WPIDHY, val) = value.reg = val +"""Set [`WPIDHY`](@ref) `Kp`.""" +set_Kp!(value::WPIDHY, val) = value.Kp = val +"""Set [`WPIDHY`](@ref) `Ki`.""" +set_Ki!(value::WPIDHY, val) = value.Ki = val +"""Set [`WPIDHY`](@ref) `Kd`.""" +set_Kd!(value::WPIDHY, val) = value.Kd = val +"""Set [`WPIDHY`](@ref) `Ta`.""" +set_Ta!(value::WPIDHY, val) = value.Ta = val +"""Set [`WPIDHY`](@ref) `Tb`.""" +set_Tb!(value::WPIDHY, val) = value.Tb = val +"""Set [`WPIDHY`](@ref) `V_lim`.""" +set_V_lim!(value::WPIDHY, val) = value.V_lim = val +"""Set [`WPIDHY`](@ref) `G_lim`.""" +set_G_lim!(value::WPIDHY, val) = value.G_lim = val +"""Set [`WPIDHY`](@ref) `Tw`.""" +set_Tw!(value::WPIDHY, val) = value.Tw = val +"""Set [`WPIDHY`](@ref) `P_lim`.""" +set_P_lim!(value::WPIDHY, val) = value.P_lim = val +"""Set [`WPIDHY`](@ref) `D`.""" +set_D!(value::WPIDHY, val) = value.D = val +"""Set [`WPIDHY`](@ref) `gate_openings`.""" +set_gate_openings!(value::WPIDHY, val) = value.gate_openings = val +"""Set [`WPIDHY`](@ref) `power_gate_openings`.""" +set_power_gate_openings!(value::WPIDHY, val) = value.power_gate_openings = val +"""Set [`WPIDHY`](@ref) `P_ref`.""" +set_P_ref!(value::WPIDHY, val) = value.P_ref = val +"""Set [`WPIDHY`](@ref) `ext`.""" +set_ext!(value::WPIDHY, val) = value.ext = val +"""Set [`WPIDHY`](@ref) `states_types`.""" +set_states_types!(value::WPIDHY, val) = value.states_types = val diff --git a/src/models/generated/includes.jl b/src/models/generated/includes.jl index 0c2648349d..685525a3b5 100644 --- a/src/models/generated/includes.jl +++ b/src/models/generated/includes.jl @@ -87,6 +87,7 @@ include("DEGOV.jl") include("DEGOV1.jl") include("GeneralGovModel.jl") include("PIDGOV.jl") +include("WPIDHY.jl") include("SteamTurbineGov1.jl") include("HydroTurbineGov.jl") include("IEEETurbineGov1.jl") @@ -610,6 +611,7 @@ export get_reactive_power_limits_to export get_rectifier_firing_angle export get_rectifier_tap_limits export get_rectifier_xrc +export get_reg export get_remote_bus_control export get_remote_bus_control_1 export get_remote_bus_control_2 @@ -1157,6 +1159,7 @@ export set_reactive_power_limits_to! export set_rectifier_firing_angle! export set_rectifier_tap_limits! export set_rectifier_xrc! +export set_reg! export set_remote_bus_control! export set_remote_bus_control_1! export set_remote_bus_control_2! diff --git a/src/parsers/psse_dynamic_mapping.yaml b/src/parsers/psse_dynamic_mapping.yaml index ee0596d759..da231443bf 100644 --- a/src/parsers/psse_dynamic_mapping.yaml +++ b/src/parsers/psse_dynamic_mapping.yaml @@ -139,6 +139,10 @@ PIDGOV: { TurbineGov: PIDGOV }, +WPIDHY: +{ + TurbineGov: WPIDHY +}, ###################################### ###### Power System Stabilizers ###### @@ -262,6 +266,7 @@ parameter_mapping: TGOV1DU: [1, 2, '(4, 3)', 5, 6, 7, 8, 9, 10], DEGOV1: [1, 2, 3, 4, 5, 6, 7, 8, 9, '(11, 10)', 12, 13], PIDGOV: [1, 2, 3, 4, 5, 6, 7, 8, 9, '(10, 11, 13)', '(12, 14, 15)', '(17, 16)', 18, 19, '(21, 20)'], + WPIDHY: [1, 2, 3, 4, 5, 6, 7, '(9, 8)', '(11, 10)', 12, '(14, 13)', 15, '(16, 17, 19)', '(18, 20, 21)'], #PSSs: IEEEST: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, '(17, 16)', 18, 19], STAB1: [1, 2, 3, 4, 5, 6, 7],