Skip to content

Commit

Permalink
Merge pull request #1173 from NREL-Sienna/rh/add_base_power_to_source
Browse files Browse the repository at this point in the history
add base power default to Source
  • Loading branch information
jd-lara authored Aug 6, 2024
2 parents 4a58191 + 9405461 commit c932c0b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/descriptors/power_system_structs.json
Original file line number Diff line number Diff line change
Expand Up @@ -16615,6 +16615,13 @@
"data_type": "Float64",
"default": "0.0"
},
{
"name": "base_power",
"comment": "Base Power in MVA",
"null_value": 0,
"data_type": "Float64",
"default": "100.0"
},
{
"name": "dynamic_injector",
"data_type": "Union{Nothing, DynamicInjection}",
Expand Down
17 changes: 13 additions & 4 deletions src/models/generated/Source.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This file is auto-generated. Do not edit.
X_th::Float64
internal_voltage::Float64
internal_angle::Float64
base_power::Float64
dynamic_injector::Union{Nothing, DynamicInjection}
services::Vector{Service}
ext::Dict{String, Any}
Expand All @@ -35,6 +36,7 @@ Commonly used in dynamics simulations to represent a very large machine on a sin
- `X_th::Float64`: Source Thevenin reactance, validation range: `(0, nothing)`
- `internal_voltage::Float64`: (default: `1.0`) Internal Voltage (pu), validation range: `(0, nothing)`
- `internal_angle::Float64`: (default: `0.0`) Internal Angle
- `base_power::Float64`: (default: `100.0`) Base Power in MVA
- `dynamic_injector::Union{Nothing, DynamicInjection}`: (default: `nothing`) corresponding dynamic injection device
- `services::Vector{Service}`: (default: `Device[]`) Services that this device contributes to
- `ext::Dict{String, Any}`: (default: `Dict{String, Any}()`) An [*ext*ra dictionary](@ref additional_fields) for users to add metadata that are not used in simulation, such as latitude and longitude.
Expand All @@ -59,6 +61,8 @@ mutable struct Source <: StaticInjection
internal_voltage::Float64
"Internal Angle"
internal_angle::Float64
"Base Power in MVA"
base_power::Float64
"corresponding dynamic injection device"
dynamic_injector::Union{Nothing, DynamicInjection}
"Services that this device contributes to"
Expand All @@ -69,12 +73,12 @@ mutable struct Source <: StaticInjection
internal::InfrastructureSystemsInternal
end

function Source(name, available, bus, active_power, reactive_power, R_th, X_th, internal_voltage=1.0, internal_angle=0.0, dynamic_injector=nothing, services=Device[], ext=Dict{String, Any}(), )
Source(name, available, bus, active_power, reactive_power, R_th, X_th, internal_voltage, internal_angle, dynamic_injector, services, ext, InfrastructureSystemsInternal(), )
function Source(name, available, bus, active_power, reactive_power, R_th, X_th, internal_voltage=1.0, internal_angle=0.0, base_power=100.0, dynamic_injector=nothing, services=Device[], ext=Dict{String, Any}(), )
Source(name, available, bus, active_power, reactive_power, R_th, X_th, internal_voltage, internal_angle, base_power, dynamic_injector, services, ext, InfrastructureSystemsInternal(), )
end

function Source(; name, available, bus, active_power, reactive_power, R_th, X_th, internal_voltage=1.0, internal_angle=0.0, dynamic_injector=nothing, services=Device[], ext=Dict{String, Any}(), internal=InfrastructureSystemsInternal(), )
Source(name, available, bus, active_power, reactive_power, R_th, X_th, internal_voltage, internal_angle, dynamic_injector, services, ext, internal, )
function Source(; name, available, bus, active_power, reactive_power, R_th, X_th, internal_voltage=1.0, internal_angle=0.0, base_power=100.0, dynamic_injector=nothing, services=Device[], ext=Dict{String, Any}(), internal=InfrastructureSystemsInternal(), )
Source(name, available, bus, active_power, reactive_power, R_th, X_th, internal_voltage, internal_angle, base_power, dynamic_injector, services, ext, internal, )
end

# Constructor for demo purposes; non-functional.
Expand All @@ -89,6 +93,7 @@ function Source(::Nothing)
X_th=0,
internal_voltage=0,
internal_angle=0,
base_power=0,
dynamic_injector=nothing,
services=Device[],
ext=Dict{String, Any}(),
Expand All @@ -113,6 +118,8 @@ get_X_th(value::Source) = value.X_th
get_internal_voltage(value::Source) = value.internal_voltage
"""Get [`Source`](@ref) `internal_angle`."""
get_internal_angle(value::Source) = value.internal_angle
"""Get [`Source`](@ref) `base_power`."""
get_base_power(value::Source) = value.base_power
"""Get [`Source`](@ref) `dynamic_injector`."""
get_dynamic_injector(value::Source) = value.dynamic_injector
"""Get [`Source`](@ref) `services`."""
Expand All @@ -138,6 +145,8 @@ set_X_th!(value::Source, val) = value.X_th = val
set_internal_voltage!(value::Source, val) = value.internal_voltage = val
"""Set [`Source`](@ref) `internal_angle`."""
set_internal_angle!(value::Source, val) = value.internal_angle = val
"""Set [`Source`](@ref) `base_power`."""
set_base_power!(value::Source, val) = value.base_power = val
"""Set [`Source`](@ref) `services`."""
set_services!(value::Source, val) = value.services = val
"""Set [`Source`](@ref) `ext`."""
Expand Down

0 comments on commit c932c0b

Please sign in to comment.