From 940132eef67d77097a05556e3a448541112de379 Mon Sep 17 00:00:00 2001 From: rodrigomha Date: Tue, 16 Jul 2024 20:46:31 -0700 Subject: [PATCH] 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],