Skip to content

Commit

Permalink
add ESAC8B struct with parser
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigomha committed Jul 16, 2024
1 parent 32e024a commit d0810ef
Show file tree
Hide file tree
Showing 5 changed files with 386 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/PowerSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export ESDC1A
export ESDC2A
export ESAC1A
export ESAC6A
export ESAC8B
export EXAC1
export EXAC1A
export EXAC2
Expand Down
176 changes: 176 additions & 0 deletions src/descriptors/power_system_structs.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
203 changes: 203 additions & 0 deletions src/models/generated/ESAC8B.jl
Original file line number Diff line number Diff line change
@@ -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(), )

Check warning on line 105 in src/models/generated/ESAC8B.jl

View check run for this annotation

Codecov / codecov/patch

src/models/generated/ESAC8B.jl#L104-L105

Added lines #L104 - L105 were not covered by tests
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

Check warning on line 170 in src/models/generated/ESAC8B.jl

View check run for this annotation

Codecov / codecov/patch

src/models/generated/ESAC8B.jl#L170

Added line #L170 was not covered by tests

"""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
Loading

0 comments on commit d0810ef

Please sign in to comment.