diff --git a/Project.toml b/Project.toml index 745a2d4031..ea2617c0d1 100644 --- a/Project.toml +++ b/Project.toml @@ -12,8 +12,13 @@ JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" +StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4" TimeSeries = "9e3dc215-6440-5c97-bce1-76c03772f85e" Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" +Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" + +[sources] +InfrastructureSystems = {url = "https://github.com/NREL-Sienna/InfrastructureSystems.jl.git", rev = "lk/units-domain-agnostic-is4"} [compat] DataStructures = "^0.19" @@ -24,9 +29,8 @@ JSON = "^1.5" LinearAlgebra = "1" Logging = "1" PrettyTables = "3.1" +StructTypes = "^1.9" TimeSeries = "0.25" Unicode = "1" +Unitful = "^1.12" julia = "^1.10" - -[sources] -InfrastructureSystems = {url = "https://github.com/NREL-Sienna/InfrastructureSystems.jl", rev = "IS4"} diff --git a/src/PowerSystems.jl b/src/PowerSystems.jl index 777a61b9d5..18ce892638 100644 --- a/src/PowerSystems.jl +++ b/src/PowerSystems.jl @@ -517,7 +517,6 @@ export set_name! export get_component_uuids export get_description export set_description! -export get_base_power export get_frequency export get_frequency_droop export set_units_base_system! @@ -591,6 +590,20 @@ export StructDefinition export generate_struct_file export generate_struct_files export UnitSystem # internal.jl +# Unit types for explicit units in getters/setters +export MW, Mvar, MVA, kV, OHMS, SIEMENS +export DU, SU, NU, DeviceBaseUnit, SystemBaseUnit, NaturalUnit +export AbstractRelativeUnit, RelativeQuantity +export UnitCategory, + PowerCategory, ImpedanceCategory, AdmittanceCategory, + VoltageCategory, CurrentCategory +export POWER, IMPEDANCE, ADMITTANCE, VOLTAGE, CURRENT +export natural_unit, base_value, system_base_value, convert_units, DEFAULT_UNITS +export ustrip +# Hand-written unit-bearing companions for `exclude_getter` descriptor entries +# (their bare-number counterparts get exported via generated/includes.jl). +export get_base_power_unitful +export get_base_power_12_unitful, get_base_power_23_unitful, get_base_power_13_unitful # ComponentSelector export ComponentSelector @@ -623,6 +636,22 @@ import DataStructures: OrderedDict, SortedDict import JSON import Base.to_index import PrettyTables +import Unitful +using Unitful: @u_str, @unit, Quantity, Units, uconvert +import StructTypes + +# Relative-unit primitives live in IS; PSY re-exports them for downstream +# packages so that `PSY.DU`, `PSY.RelativeQuantity`, etc. keep working. +import InfrastructureSystems: + AbstractRelativeUnit, + DeviceBaseUnit, + SystemBaseUnit, + NaturalUnit, + RelativeQuantity, + DU, + SU, + NU, + ustrip # Import InfrastructureSystems both as full module name (needed for internal macros like @forward) # and with alias for convenient usage throughout the codebase @@ -819,6 +848,11 @@ include("utils/logging.jl") include("utils/IO/base_checks.jl") include("utils/generate_struct_files.jl") +# Units machinery (formerly PowerSystemsUnits.jl) +include("units/types.jl") +include("units/conversions.jl") +include("units/serialization.jl") + include("definitions.jl") include("models/static_models.jl") include("models/dynamic_models.jl") @@ -922,4 +956,8 @@ precompile( (TupleTimeSeries{StartUpStages}, ThermalStandard, Dates.DateTime), ) +function __init__() + Unitful.register(PowerSystems) +end + end # module diff --git a/src/base.jl b/src/base.jl index 187d6cbd52..a9e0aa486f 100644 --- a/src/base.jl +++ b/src/base.jl @@ -449,9 +449,24 @@ Return a user-modifiable dictionary to store extra information. get_ext(sys::System) = IS.get_ext(sys.internal) """ -Return the system's base power. +Unitless system base power (MVA) — internal anchor for unit conversion. """ -get_base_power(sys::System) = sys.units_settings.base_value +_get_base_power(sys::System) = sys.units_settings.base_value + +""" +Return the system's base power as a bare number in the requested units (e.g. +`NU`, `MW`, `SU`). For the unit-bearing value see [`get_base_power_unitful`](@ref). +""" +get_base_power(sys::System, u) = IS._strip_units(get_base_power_unitful(sys, u)) + +""" +Return the system's base power as a unit-bearing quantity. See +[`get_base_power`](@ref) for a bare number. +""" +get_base_power_unitful(sys::System, ::NaturalUnit) = _get_base_power(sys) * MVA +get_base_power_unitful(sys::System, u::Unitful.Units) = + Unitful.uconvert(u, _get_base_power(sys) * MVA) +get_base_power_unitful(sys::System, ::SystemBaseUnit) = 1.0 * SU """ Return the system's frequency. @@ -2341,7 +2356,7 @@ Returns `true` if all values are valid, `false` otherwise. """ function check_ac_transmission_rate_values(sys::System) is_valid = true - base_power = get_base_power(sys) + base_power = _get_base_power(sys) for line in Iterators.flatten((get_components(Line, sys), get_components(MonitoredLine, sys))) if !check_rating_values(line, base_power) @@ -2942,7 +2957,7 @@ end function handle_component_addition!(sys::System, dyn_injector::DynamicInjection; kwargs...) static_injector = kwargs[:static_injector] - static_base_power = get_base_power(static_injector) + static_base_power = _get_base_power(static_injector) set_base_power!(dyn_injector, static_base_power) set_dynamic_injector!(static_injector, dyn_injector) return @@ -3261,15 +3276,17 @@ function convert_component!( new_type::Type{StandardLoad}; kwargs..., ) + # Raw device-base values: struct fields are stored in device base (Float64); + # we copy the underlying field directly to avoid SU-conversion round-tripping. new_load = new_type(; name = get_name(old_load), available = get_available(old_load), bus = get_bus(old_load), - base_power = get_base_power(old_load), - constant_active_power = get_active_power(old_load), - constant_reactive_power = get_reactive_power(old_load), - max_constant_active_power = get_max_active_power(old_load), - max_constant_reactive_power = get_max_active_power(old_load), + base_power = _get_base_power(old_load), + constant_active_power = old_load.active_power, + constant_reactive_power = old_load.reactive_power, + max_constant_active_power = old_load.max_active_power, + max_constant_reactive_power = old_load.max_active_power, conformity = get_conformity(old_load), dynamic_injector = get_dynamic_injector(old_load), internal = _copy_internal_for_conversion(old_load), diff --git a/src/definitions.jl b/src/definitions.jl index e7c2846698..8f2cb0d83e 100644 --- a/src/definitions.jl +++ b/src/definitions.jl @@ -573,6 +573,12 @@ const POWER_SYSTEM_STRUCT_DESCRIPTOR_FILE = const DEFAULT_SYSTEM_FREQUENCY = 60.0 +const DEFAULT_BASE_MVA = 100.0 +# Accumulator type for MW-sum helpers in system_checks.jl. Bare `Float64` +# because unit-aware getters now return bare numbers; the `MW` arg merely +# selects the unit basis (see `_sum_or_zero`). +const MW_ACCUMULATOR_TYPE = Float64 + const INFINITE_TIME = 1e4 const START_COST = 1e8 const INFINITE_COST = 1e8 diff --git a/src/descriptors/power_system_structs.json b/src/descriptors/power_system_structs.json index d72f4aa5b9..2f2251e6d2 100644 --- a/src/descriptors/power_system_structs.json +++ b/src/descriptors/power_system_structs.json @@ -1014,6 +1014,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -1203,6 +1204,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -1381,6 +1383,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -1723,6 +1726,7 @@ }, { "name": "base_power_12", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit) for primary-secondary windings.", "null_value": "0.0", "data_type": "Float64", @@ -1734,6 +1738,7 @@ }, { "name": "base_power_23", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit) for secondary-tertiary windings.", "null_value": "0.0", "data_type": "Float64", @@ -1745,6 +1750,7 @@ }, { "name": "base_power_13", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit) for primary-tertiary windings.", "null_value": "0.0", "data_type": "Float64", @@ -2236,6 +2242,7 @@ }, { "name": "base_power_12", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit) for primary-secondary windings.", "null_value": "0.0", "data_type": "Float64", @@ -2247,6 +2254,7 @@ }, { "name": "base_power_23", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit) for secondary-tertiary windings.", "null_value": "0.0", "data_type": "Float64", @@ -2258,6 +2266,7 @@ }, { "name": "base_power_13", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit) for primary-tertiary windings.", "null_value": "0.0", "data_type": "Float64", @@ -3244,6 +3253,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -3322,6 +3332,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the load (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -3548,6 +3559,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -3875,6 +3887,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -3979,6 +3992,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -4082,6 +4096,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the load (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -4300,6 +4315,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -4456,6 +4472,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the unit (MVA) for [per unitization](@ref per_unit)", "null_value": 100.0, "data_type": "Float64", @@ -4618,6 +4635,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the unit (MVA) for [per unitization](@ref per_unit)", "null_value": 100.0, "data_type": "Float64", @@ -4773,6 +4791,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the load (MVA) for [per unitization](@ref per_unit)", "internal_default": "100.0", "data_type": "Float64" @@ -4944,6 +4963,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the unit (MVA) for [per unitization](@ref per_unit)", "null_value": 100.0, "data_type": "Float64", @@ -5075,6 +5095,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the converter in MVA", "null_value": 100.0, "data_type": "Float64", @@ -5250,6 +5271,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the unit (MVA) for [per unitization](@ref per_unit)", "null_value": 100.0, "data_type": "Float64", @@ -5409,6 +5431,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the unit (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -5549,6 +5572,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the unit (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -5816,6 +5840,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the unit (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -6139,6 +6164,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the unit (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -6251,6 +6277,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the unit (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -6396,6 +6423,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the unit (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -6533,6 +6561,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the unit (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -6739,6 +6768,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the unit (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -6937,6 +6967,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the unit (MVA) for [per unitization](@ref per_unit)", "null_value": "100.0", "data_type": "Float64", @@ -19585,6 +19616,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power (MVA) for [per unitization](@ref per_unit)", "null_value": 0, "data_type": "Float64", @@ -19723,6 +19755,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base Power in MVA", "null_value": 0, "data_type": "Float64", @@ -19846,6 +19879,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the source (MVA) for [per unitization](@ref per_unit)", "null_value": 0, "data_type": "Float64", @@ -20239,6 +20273,7 @@ }, { "name": "base_power", + "exclude_getter": true, "comment": "Base power of the unit (MVA) for [per unitization](@ref per_unit)", "null_value": 0, "data_type": "Float64", diff --git a/src/models/HybridSystem.jl b/src/models/HybridSystem.jl index 082c22661d..6050b82c46 100644 --- a/src/models/HybridSystem.jl +++ b/src/models/HybridSystem.jl @@ -189,9 +189,11 @@ get_status(value::HybridSystem) = value.status """Get [`HybridSystem`](@ref) `bus`.""" get_bus(value::HybridSystem) = value.bus """Get [`HybridSystem`](@ref) `active_power`.""" -get_active_power(value::HybridSystem) = get_value(value, Val(:active_power), Val(:mva)) +get_active_power(value::HybridSystem, units) = + get_value(value, Val(:active_power), Val(:mva), units) """Get [`HybridSystem`](@ref) `reactive_power`.""" -get_reactive_power(value::HybridSystem) = get_value(value, Val(:reactive_power), Val(:mva)) +get_reactive_power(value::HybridSystem, units) = + get_value(value, Val(:reactive_power), Val(:mva), units) """Get [`HybridSystem`](@ref) thermal unit""" get_thermal_unit(value::HybridSystem) = value.thermal_unit """Get [`HybridSystem`](@ref) load""" @@ -201,23 +203,23 @@ get_storage(value::HybridSystem) = value.storage """Get [`HybridSystem`](@ref) renewable unit""" get_renewable_unit(value::HybridSystem) = value.renewable_unit """Get [`HybridSystem`](@ref) `interconnection_rating`.""" -get_interconnection_rating(value::HybridSystem) = - get_value(value, Val(:interconnection_rating), Val(:mva)) +get_interconnection_rating(value::HybridSystem, units) = + get_value(value, Val(:interconnection_rating), Val(:mva), units) """get [`HybridSystem`](@ref) interconnection impedance""" get_interconnection_impedance(value::HybridSystem) = value.interconnection_impedance """Get [`HybridSystem`](@ref) `input_active_power_limits`.""" -get_input_active_power_limits(value::HybridSystem) = - get_value(value, Val(:input_active_power_limits), Val(:mva)) +get_input_active_power_limits(value::HybridSystem, units) = + get_value(value, Val(:input_active_power_limits), Val(:mva), units) """Get [`HybridSystem`](@ref) `output_active_power_limits`.""" -get_output_active_power_limits(value::HybridSystem) = - get_value(value, Val(:output_active_power_limits), Val(:mva)) +get_output_active_power_limits(value::HybridSystem, units) = + get_value(value, Val(:output_active_power_limits), Val(:mva), units) """Get [`HybridSystem`](@ref) `reactive_power_limits`.""" -get_reactive_power_limits(value::HybridSystem) = - get_value(value, Val(:reactive_power_limits), Val(:mva)) +get_reactive_power_limits(value::HybridSystem, units) = + get_value(value, Val(:reactive_power_limits), Val(:mva), units) """get [`HybridSystem`](@ref) interconnection efficiency""" get_interconnection_efficiency(value::HybridSystem) = value.interconnection_efficiency """Get [`HybridSystem`](@ref) `base_power`.""" -get_base_power(value::HybridSystem) = value.base_power +_get_base_power(value::HybridSystem) = value.base_power """Get [`HybridSystem`](@ref) `operation_cost`.""" get_operation_cost(value::HybridSystem) = value.operation_cost """Get [`HybridSystem`](@ref) `services`.""" diff --git a/src/models/components.jl b/src/models/components.jl index e9746a2810..a8662c3c68 100644 --- a/src/models/components.jl +++ b/src/models/components.jl @@ -1,234 +1,259 @@ -function get_system_base_power(c::Component) - return get_internal(c).units_info.base_value +@inline function _get_system_base_power(c::Component) + units_info = get_internal(c).units_info + isnothing(units_info) && error("Component $(get_name(c)) is not attached to a system.") + # Assert concrete type; units_info field is typed as abstract UnitsData. + return (units_info::IS.SystemUnitsSettings).base_value end """ -Default behavior of a component. If there is no base_power field, assume is in the system's base power. +Unitless device-base power (MVA). Fallback for components with no `base_power` +field: the device base equals the system base. """ -get_base_power(c::Component) = get_system_base_power(c) +_get_base_power(c::Component) = _get_system_base_power(c) -_get_multiplier(c::T, conversion_unit) where {T <: Component} = - _get_multiplier(c, get_internal(c).units_info, conversion_unit) +""" +Unit-aware `base_power` accessor returning a bare number. Unlike most field +accessors, storage is in MVA (natural units), not device-base per-unit — so +conversion is bespoke. For the unit-bearing value see [`get_base_power_unitful`](@ref). +""" +get_base_power(c::Component, u) = IS._strip_units(get_base_power_unitful(c, u)) -_get_multiplier(::T, ::Nothing, conversion_unit) where {T <: Component} = - 1.0 -_get_multiplier( - c::T, - setting::IS.SystemUnitsSettings, - conversion_unit, -) where {T <: Component} = - _get_multiplier(c, setting, Val(setting.unit_system), conversion_unit) - -# PERF: dispatching on the UnitSystem values instead of comparing with if/else avoids the -# performance hit associated with consulting the dictionary that backs the @scoped_enum -- -# i.e., IS.UnitSystem.NATURAL_UNITS by itself isn't treated as a constant, it's a dictionary -# lookup each time. -_get_multiplier( - ::T, - ::IS.SystemUnitsSettings, - ::Val{IS.UnitSystem.DEVICE_BASE}, - ::Any, -) where {T <: Component} = - 1.0 -############### -#### Power #### -############### -_get_multiplier( - c::T, - setting::IS.SystemUnitsSettings, - ::Val{IS.UnitSystem.SYSTEM_BASE}, - ::Val{:mva}, -) where {T <: Component} = - get_base_power(c) / setting.base_value -_get_multiplier( - c::T, - ::IS.SystemUnitsSettings, - ::Val{IS.UnitSystem.NATURAL_UNITS}, - ::Val{:mva}, -) where {T <: Component} = - get_base_power(c) - -############### -#### Ohms ##### -############### -# Z_device / Z_sys = (V_device^2 / S_device) / (V_device^2 / S_sys) = S_sys / S_device -_get_multiplier( - c::T, - setting::IS.SystemUnitsSettings, - ::Val{IS.UnitSystem.SYSTEM_BASE}, - ::Val{:ohm}, -) where {T <: Branch} = - setting.base_value / get_base_power(c) -function _get_multiplier( - c::T, - ::IS.SystemUnitsSettings, - ::Val{IS.UnitSystem.NATURAL_UNITS}, - ::Val{:ohm}, +""" +Unit-aware `base_power` accessor returning a unit-bearing quantity. See +[`get_base_power`](@ref) for a bare number. +""" +get_base_power_unitful(c::Component, ::NaturalUnit) = _get_base_power(c) * MVA +get_base_power_unitful(c::Component, u::Unitful.Units) = + Unitful.uconvert(u, _get_base_power(c) * MVA) +get_base_power_unitful(c::Component, ::SystemBaseUnit) = + (_get_base_power(c) / _get_system_base_power(c)) * SU +get_base_power_unitful(c::Component, ::DeviceBaseUnit) = 1.0 * DU + +IS.display_units_arg(::typeof(get_base_power), ::Type{<:Component}) = NU +IS.display_units_arg(::typeof(get_base_power_unitful), ::Type{<:Component}) = NU + +# Make `_strip_units` work for Unitful quantities; IS doesn't depend on Unitful. +IS._strip_units(q::Unitful.Quantity) = Unitful.ustrip(q) + +####################################################### +# Units-aware get_value / set_value +# +# Fields are stored internally in device base (DU). The 4-arg `get_value` +# converts from DU to a requested target (e.g., MW, SU). The 3-arg form +# delegates to the 4-arg with DEFAULT_UNITS (= SU, a RelativeQuantity +# carrying its unit in its type). +####################################################### + +""" + get_value(c::Component, field::Val, conversion_unit::Val, units) -> value + +Get `c`'s field value, converting from device-base storage to `units`. +Returns a `RelativeQuantity` (for DU/SU targets) or a `Unitful.Quantity` (for +natural units like MW). Public getters wrap this in `_strip_units` for the +bare-number form, with `_unitful` companions returning the wrapped value. +""" +function get_value(c::Component, ::Val{T}, conversion_unit, units) where {T} + value = Base.getproperty(c, T) + return _convert_from_device_base(c, value, conversion_unit, units) +end + +# ---- DU → natural power units ---- +_convert_from_device_base(c::Component, value::Float64, ::Val{:mva}, ::typeof(MW)) = + value * _get_base_power(c) * u"MW" + +_convert_from_device_base(c::Component, value::Float64, ::Val{:mva}, ::typeof(Mvar)) = + value * _get_base_power(c) * Mvar + +function _convert_from_device_base( + c::T, value::Number, ::Val{:ohm}, ::typeof(OHMS), ) where {T <: Branch} base_voltage = get_base_voltage(get_arc(c).from) - if isnothing(base_voltage) - error("Base voltage is not defined for $(summary(c)).") - end - return get_base_voltage(get_arc(c).from)^2 / get_base_power(c) + isnothing(base_voltage) && error("Base voltage is not defined for $(summary(c)).") + return value * (base_voltage^2 / _get_base_power(c)) * u"Ω" end -function _get_multiplier( - c::T, - ::IS.SystemUnitsSettings, - ::Val{IS.UnitSystem.NATURAL_UNITS}, - ::Val{:ohm}, + +function _convert_from_device_base( + c::T, value::Number, ::Val{:ohm}, ::typeof(OHMS), ) where {T <: TwoWindingTransformer} base_voltage = get_base_voltage_primary(c) - if isnothing(base_voltage) - error("Base voltage is not defined for $(summary(c)).") - end - return base_voltage^2 / get_base_power(c) + isnothing(base_voltage) && error("Base voltage is not defined for $(summary(c)).") + return value * (base_voltage^2 / _get_base_power(c)) * u"Ω" end -################## -#### Siemens ##### -################## -# Y_device / Y_sys = (S_device / V_device^2) / (S_sys / S_sys^2) = S_device / S_sys -_get_multiplier( - c::T, - setting::IS.SystemUnitsSettings, - ::Val{IS.UnitSystem.SYSTEM_BASE}, - ::Val{:siemens}, -) where {T <: Branch} = - get_base_power(c) / setting.base_value -function _get_multiplier( - c::T, - ::IS.SystemUnitsSettings, - ::Val{IS.UnitSystem.NATURAL_UNITS}, - ::Val{:siemens}, +function _convert_from_device_base( + c::T, value::Number, ::Val{:siemens}, ::typeof(SIEMENS), ) where {T <: Branch} base_voltage = get_base_voltage(get_arc(c).from) if isnothing(base_voltage) - @warn "Base voltage is not set for $(c.name). Returning in DEVICE_BASE units." - return 1.0 + @warn "Base voltage is not set for $(c.name). Returning in device base units." + return value * DU end - return get_base_power(c) / get_base_voltage(get_arc(c).from)^2 + return value * (_get_base_power(c) / base_voltage^2) * u"S" end -function _get_multiplier( - c::T, - ::IS.SystemUnitsSettings, - ::Val{IS.UnitSystem.NATURAL_UNITS}, - ::Val{:siemens}, + +function _convert_from_device_base( + c::T, value::Number, ::Val{:siemens}, ::typeof(SIEMENS), ) where {T <: TwoWindingTransformer} base_voltage = get_base_voltage_primary(c) if isnothing(base_voltage) - @warn "Base voltage is not set for $(c.name). Returning in DEVICE_BASE units." - return 1.0 + @warn "Base voltage is not set for $(c.name). Returning in device base units." + return value * DU end - return get_base_power(c) / base_voltage^2 + return value * (_get_base_power(c) / base_voltage^2) * u"S" end -_get_multiplier(::T, ::IS.SystemUnitsSettings, _, _) where {T <: Component} = - error("Undefined Conditional") +# ---- DU → NU (route to the conversion_unit's natural Unitful unit) ---- +_convert_from_device_base(c::Component, v::Float64, cu::Val{:mva}, ::NaturalUnit) = + _convert_from_device_base(c, v, cu, MW) +_convert_from_device_base(c::Component, v::Number, cu::Val{:ohm}, ::NaturalUnit) = + _convert_from_device_base(c, v, cu, OHMS) +_convert_from_device_base(c::Component, v::Number, cu::Val{:siemens}, ::NaturalUnit) = + _convert_from_device_base(c, v, cu, SIEMENS) -function get_value(c::Component, ::Val{T}, conversion_unit) where {T} - value = Base.getproperty(c, T) - return _get_value(c, value, conversion_unit) -end +# ---- DU → DU (identity; no system info needed) ---- +_convert_from_device_base(::Component, value::Number, ::Val, ::DeviceBaseUnit) = + value * DU -function _get_value(c::Component, value::Float64, conversion_unit)::Float64 - return _get_multiplier(c, conversion_unit) * value +# ---- DU → SU (RelativeQuantity{Float64, SystemBaseUnit}) ---- +function _convert_from_device_base( + c::Component, value::Float64, ::Val{:mva}, ::SystemBaseUnit, +) + return (value * (_get_base_power(c) / _get_system_base_power(c))) * SU end -function _get_value(c::Component, value::ComplexF64, conversion_unit)::ComplexF64 - return _get_multiplier(c, conversion_unit) * value +function _convert_from_device_base( + c::T, value::Number, ::Val{:ohm}, ::SystemBaseUnit, +) where {T <: Branch} + return (value * (_get_system_base_power(c) / _get_base_power(c))) * SU end -function _get_value(c::Component, value::MinMax, conversion_unit)::MinMax - m = _get_multiplier(c, conversion_unit) - return (min = value.min * m, max = value.max * m) +function _convert_from_device_base( + c::T, value::Number, ::Val{:siemens}, ::SystemBaseUnit, +) where {T <: Branch} + return (value * (_get_base_power(c) / _get_system_base_power(c))) * SU end -function _get_value( - c::Component, - value::StartUpShutDown, - conversion_unit, -)::StartUpShutDown - m = _get_multiplier(c, conversion_unit) - return (startup = value.startup * m, shutdown = value.shutdown * m) +# ---- Generic fallback: any Unitful target for :mva ---- +function _convert_from_device_base( + c::Component, value::Float64, ::Val{:mva}, units::Unitful.Units, +) + return Unitful.uconvert(units, value * _get_base_power(c) * u"MW") end -function _get_value(c::Component, value::UpDown, conversion_unit)::UpDown - m = _get_multiplier(c, conversion_unit) - return (up = value.up * m, down = value.down * m) -end +# ---- Nothing passthrough ---- +_convert_from_device_base(::Component, ::Nothing, ::Val, ::Any) = nothing -function _get_value(c::Component, value::FromTo_ToFrom, conversion_unit)::FromTo_ToFrom - m = _get_multiplier(c, conversion_unit) - return (from_to = value.from_to * m, to_from = value.to_from * m) -end +# ---- Compound field types ---- +_convert_from_device_base(c::Component, v::MinMax, cu, u) = ( + min = _convert_from_device_base(c, v.min, cu, u), + max = _convert_from_device_base(c, v.max, cu, u), +) -function _get_value(c::Component, value::FromTo, conversion_unit)::FromTo - m = _get_multiplier(c, conversion_unit) - return (from = value.from * m, to = value.to * m) -end +_convert_from_device_base(c::Component, v::UpDown, cu, u) = ( + up = _convert_from_device_base(c, v.up, cu, u), + down = _convert_from_device_base(c, v.down, cu, u), +) -function _get_value(::Component, ::Nothing, _) - return nothing -end +_convert_from_device_base(c::Component, v::FromTo_ToFrom, cu, u) = ( + from_to = _convert_from_device_base(c, v.from_to, cu, u), + to_from = _convert_from_device_base(c, v.to_from, cu, u), +) -function _get_value(::T, value::V, _) where {T <: Component, V} - @warn("conversion not implemented for $(V) in component $(T)") - return value::V -end +_convert_from_device_base(c::Component, v::FromTo, cu, u) = ( + from = _convert_from_device_base(c, v.from, cu, u), + to = _convert_from_device_base(c, v.to, cu, u), +) -function _get_value(::Nothing, _, _) - return -end +_convert_from_device_base(c::Component, v::StartUpShutDown, cu, u) = ( + startup = _convert_from_device_base(c, v.startup, cu, u), + shutdown = _convert_from_device_base(c, v.shutdown, cu, u), +) -function set_value(c::Component, _, val, conversion_unit) - return _set_value(c, val, conversion_unit) -end +####################################################### +# set_value: accept Unitful.Quantity or RelativeQuantity; return DU scalar +####################################################### -function _set_value(c::Component, value::Float64, conversion_unit)::Float64 - return (1 / _get_multiplier(c, conversion_unit)) * value +# ---- From Unitful.Quantity (natural units) ---- +function set_value(c::Component, field, val::Quantity, ::Val{:mva}) + return Unitful.ustrip(u"MW", val) / _get_base_power(c) end -function _set_value(c::Component, value::MinMax, conversion_unit)::MinMax - m = 1 / _get_multiplier(c, conversion_unit) - return (min = value.min * m, max = value.max * m) +function set_value( + c::T, field, val::Quantity, ::Val{:ohm}, +) where {T <: Branch} + base_voltage = get_base_voltage(get_arc(c).from) + isnothing(base_voltage) && error("Base voltage is not defined for $(summary(c)).") + return Unitful.ustrip(u"Ω", val) / (base_voltage^2 / _get_base_power(c)) end -function _set_value( - c::Component, - value::StartUpShutDown, - conversion_unit, -)::StartUpShutDown - m = 1 / _get_multiplier(c, conversion_unit) - return (startup = value.startup * m, shutdown = value.shutdown * m) +function set_value( + c::T, field, val::Quantity, ::Val{:siemens}, +) where {T <: Branch} + base_voltage = get_base_voltage(get_arc(c).from) + isnothing(base_voltage) && error("Base voltage is not defined for $(summary(c)).") + return Unitful.ustrip(u"S", val) / (_get_base_power(c) / base_voltage^2) end -function _set_value(c::Component, value::UpDown, conversion_unit)::UpDown - m = 1 / _get_multiplier(c, conversion_unit) - return (up = value.up * m, down = value.down * m) -end +# ---- From RelativeQuantity in DU (trivial) ---- +set_value(::Component, field, val::RelativeQuantity{<:Any, DeviceBaseUnit}, ::Val) = + ustrip(val) -function _set_value(c::Component, value::FromTo_ToFrom, conversion_unit)::FromTo_ToFrom - m = 1 / _get_multiplier(c, conversion_unit) - return (from_to = value.from_to * m, to_from = value.to_from * m) +# ---- From RelativeQuantity in SU ---- +function set_value( + c::Component, field, val::RelativeQuantity{<:Any, SystemBaseUnit}, ::Val{:mva}, +) + return ustrip(val) / (_get_base_power(c) / _get_system_base_power(c)) end -function _set_value(c::Component, value::FromTo, conversion_unit)::FromTo - m = 1 / _get_multiplier(c, conversion_unit) - return (from = value.from * m, to = value.to * m) +function set_value( + c::T, field, val::RelativeQuantity{<:Any, SystemBaseUnit}, ::Val{:ohm}, +) where {T <: Branch} + return ustrip(val) / (_get_system_base_power(c) / _get_base_power(c)) end -function _set_value(::Component, ::Nothing, _) - return nothing +function set_value( + c::T, field, val::RelativeQuantity{<:Any, SystemBaseUnit}, ::Val{:siemens}, +) where {T <: Branch} + return ustrip(val) / (_get_base_power(c) / _get_system_base_power(c)) end -function _set_value(c::T, value::V, _) where {T <: Component, V} - @warn("conversion not implemented for $(V) in component $(T)") - return value::V -end +# ---- Bare Float64 is rejected: callers must attach units explicitly ---- +set_value(::Component, ::Any, ::Float64, ::Val) = throw( + ArgumentError( + "setter requires explicit units (e.g. `val * SU`, `val * DU`, `val * MW`)", + ), +) -function _set_value(::Nothing, _, _) - return -end +# ---- Compound field types for setters ---- +_to_device_base(c::Component, val, cu) = set_value(c, nothing, val, cu) + +set_value(c::Component, field, val::NamedTuple{(:min, :max)}, cu::Val) = ( + min = _to_device_base(c, val.min, cu), + max = _to_device_base(c, val.max, cu), +) + +set_value(c::Component, field, val::NamedTuple{(:up, :down)}, cu::Val) = ( + up = _to_device_base(c, val.up, cu), + down = _to_device_base(c, val.down, cu), +) + +set_value(c::Component, field, val::NamedTuple{(:from_to, :to_from)}, cu::Val) = ( + from_to = _to_device_base(c, val.from_to, cu), + to_from = _to_device_base(c, val.to_from, cu), +) + +set_value(c::Component, field, val::NamedTuple{(:from, :to)}, cu::Val) = ( + from = _to_device_base(c, val.from, cu), + to = _to_device_base(c, val.to, cu), +) + +set_value(c::Component, field, val::NamedTuple{(:startup, :shutdown)}, cu::Val) = ( + startup = _to_device_base(c, val.startup, cu), + shutdown = _to_device_base(c, val.shutdown, cu), +) + +# ---- Nothing passthrough ---- +set_value(::Component, _, ::Nothing, ::Val) = nothing ###################################### ########### Transformer 3W ########### @@ -284,17 +309,40 @@ TertiaryPower = Union{ _get_winding_base_power( c::ThreeWindingTransformer, ::Union{PrimaryImpedances, PrimaryAdmittances, PrimaryPower}, -) = get_base_power_12(c) +) = _get_base_power_12(c) _get_winding_base_power( c::ThreeWindingTransformer, ::Union{SecondaryImpedances, SecondaryPower}, ) = - get_base_power_23(c) + _get_base_power_23(c) _get_winding_base_power( c::ThreeWindingTransformer, ::Union{TertiaryImpedances, TertiaryPower}, ) = - get_base_power_13(c) + _get_base_power_13(c) + +# Public unit-aware winding base_power accessors for ThreeWindingTransformer. +# Bare-number `$pub` plus unit-bearing `$pub_unitful` companion. +for (pub, priv) in ( + (:get_base_power_12, :_get_base_power_12), + (:get_base_power_23, :_get_base_power_23), + (:get_base_power_13, :_get_base_power_13), +) + pub_unitful = Symbol(pub, :_unitful) + @eval begin + $pub(c::ThreeWindingTransformer, u) = IS._strip_units($pub_unitful(c, u)) + + $pub_unitful(c::ThreeWindingTransformer, ::NaturalUnit) = $priv(c) * MVA + $pub_unitful(c::ThreeWindingTransformer, u::Unitful.Units) = + Unitful.uconvert(u, $priv(c) * MVA) + $pub_unitful(c::ThreeWindingTransformer, ::SystemBaseUnit) = + ($priv(c) / _get_system_base_power(c)) * SU + $pub_unitful(c::ThreeWindingTransformer, ::DeviceBaseUnit) = 1.0 * DU + + IS.display_units_arg(::typeof($pub), ::Type{<:ThreeWindingTransformer}) = NU + IS.display_units_arg(::typeof($pub_unitful), ::Type{<:ThreeWindingTransformer}) = NU + end +end function _get_winding_base_voltage( c::ThreeWindingTransformer, @@ -418,7 +466,7 @@ function _get_multiplier( return _get_winding_base_power(c, field) / _get_winding_base_voltage(c, field)^2 end -function get_value( +function _t3w_get_value( c::ThreeWindingTransformer, field::Val{T}, conversion_unit, @@ -437,7 +485,10 @@ function get_value( return value * multiplier end -function set_value( +get_value(c::ThreeWindingTransformer, field::Val{T}, conversion_unit::Val) where {T} = + _t3w_get_value(c, field, conversion_unit) + +function _t3w_set_value( c::ThreeWindingTransformer, field, val::Float64, @@ -452,3 +503,10 @@ function set_value( multiplier = _get_multiplier(c, field, Val(unit_system), base_mva, conversion_unit) return val / multiplier end + +set_value(c::ThreeWindingTransformer, field, val::Float64, cu::Val{:mva}) = + _t3w_set_value(c, field, val, cu) +set_value(c::ThreeWindingTransformer, field, val::Float64, cu::Val{:ohm}) = + _t3w_set_value(c, field, val, cu) +set_value(c::ThreeWindingTransformer, field, val::Float64, cu::Val{:siemens}) = + _t3w_set_value(c, field, val, cu) diff --git a/src/models/cost_function_timeseries.jl b/src/models/cost_function_timeseries.jl index 69f7e62355..639a2bac4e 100644 --- a/src/models/cost_function_timeseries.jl +++ b/src/models/cost_function_timeseries.jl @@ -14,9 +14,9 @@ function _validate_import_export_cost(cost, context) end function _validate_reserve_demand_curve( - cost::CostCurve{PiecewiseIncrementalCurve}, + cost::CostCurve{PiecewiseIncrementalCurve, U}, name::String, -) +) where {U <: IS.AbstractUnitSystem} value_curve = get_value_curve(cost) function_data = get_function_data(value_curve) x_coords = get_x_coords(function_data) @@ -93,9 +93,9 @@ at the given `start_time`. """ function _resolve_ts_cost_curve( component::Component, - curve::CostCurve{TimeSeriesPiecewiseIncrementalCurve}, + curve::CostCurve{TimeSeriesPiecewiseIncrementalCurve, U}, start_time::Dates.DateTime, -) +) where {U <: IS.AbstractUnitSystem} static_vc = IS.build_static_curve(get_value_curve(curve), component, start_time) return CostCurve(static_vc, get_power_units(curve), get_vom_cost(curve)) end @@ -264,7 +264,7 @@ Auxiliary make market bid curve for timeseries with nothing inputs. """ function _make_market_bid_curve(data::PiecewiseStepData; initial_input::Union{Nothing, Float64} = nothing, - power_units::UnitSystem = UnitSystem.NATURAL_UNITS, + power_units::IS.AbstractUnitSystem = IS.NaturalUnit(), input_at_zero::Union{Nothing, Float64} = nothing) cc = CostCurve(IncrementalCurve(data, initial_input, input_at_zero), power_units) @assert is_market_bid_curve(cc) @@ -364,7 +364,10 @@ end # ── SETTER IMPLEMENTATIONS ────────────────────────────────────────────────── -function _check_power_units(data::ProductionVariableCostCurve, power_units::UnitSystem) +function _check_power_units( + data::ProductionVariableCostCurve, + power_units::IS.AbstractUnitSystem, +) if get_power_units(data) != power_units throw( ArgumentError( @@ -380,9 +383,9 @@ Set the variable cost for a `StaticInjection` device with a `MarketBidCost`. function set_variable_cost!( ::System, component::StaticInjection, - data::CostCurve{PiecewiseIncrementalCurve}, - power_units::UnitSystem, -) + data::CostCurve{PiecewiseIncrementalCurve, U}, + power_units::IS.AbstractUnitSystem, +) where {U <: IS.AbstractUnitSystem} market_bid_cost = get_operation_cost(component) _validate_market_bid_cost(market_bid_cost, "get_operation_cost(component)") _check_power_units(data, power_units) @@ -393,26 +396,27 @@ end function set_variable_cost!( sys::System, component::StaticInjection, - data::CostCurve{PiecewiseIncrementalCurve}, -) - @warn "Variable Cost UnitSystem not specified for $(get_name(component)). set_variable_cost! assumes data is in UnitSystem.NATURAL_UNITS" - set_variable_cost!(sys, component, data, UnitSystem.NATURAL_UNITS) + data::CostCurve{PiecewiseIncrementalCurve, U}, +) where {U <: IS.AbstractUnitSystem} + @warn "Variable Cost UnitSystem not specified for $(get_name(component)). set_variable_cost! assumes data is in IS.NaturalUnit()" + set_variable_cost!(sys, component, data, IS.NaturalUnit()) return end set_incremental_variable_cost!( sys::System, component::StaticInjection, - data::CostCurve{PiecewiseIncrementalCurve}, - power_units::UnitSystem, -) = set_variable_cost!(sys, component, data, power_units) + data::CostCurve{PiecewiseIncrementalCurve, U}, + power_units::IS.AbstractUnitSystem, +) where {U <: IS.AbstractUnitSystem} = + set_variable_cost!(sys, component, data, power_units) function set_decremental_variable_cost!( ::System, component::StaticInjection, - data::CostCurve{PiecewiseIncrementalCurve}, - power_units::UnitSystem, -) + data::CostCurve{PiecewiseIncrementalCurve, U}, + power_units::IS.AbstractUnitSystem, +) where {U <: IS.AbstractUnitSystem} market_bid_cost = get_operation_cost(component) _validate_market_bid_cost(market_bid_cost, "get_operation_cost(component)") _check_power_units(data, power_units) @@ -423,9 +427,9 @@ end function set_import_variable_cost!( ::System, component::StaticInjection, - data::CostCurve{PiecewiseIncrementalCurve}, - power_units::UnitSystem, -) + data::CostCurve{PiecewiseIncrementalCurve, U}, + power_units::IS.AbstractUnitSystem, +) where {U <: IS.AbstractUnitSystem} import_export_cost = get_operation_cost(component) _validate_import_export_cost(import_export_cost, "get_operation_cost(component)") _check_power_units(data, power_units) @@ -436,9 +440,9 @@ end function set_export_variable_cost!( ::System, component::StaticInjection, - data::CostCurve{PiecewiseIncrementalCurve}, - power_units::UnitSystem, -) + data::CostCurve{PiecewiseIncrementalCurve, U}, + power_units::IS.AbstractUnitSystem, +) where {U <: IS.AbstractUnitSystem} import_export_cost = get_operation_cost(component) _validate_import_export_cost(import_export_cost, "get_operation_cost(component)") _check_power_units(data, power_units) @@ -451,8 +455,8 @@ end function set_variable_cost!( ::System, component::ReserveDemandCurve, - data::CostCurve{PiecewiseIncrementalCurve}, -) + data::CostCurve{PiecewiseIncrementalCurve, U}, +) where {U <: IS.AbstractUnitSystem} name = get_name(component) _validate_reserve_demand_curve(data, name) set_variable!(component, data) @@ -519,7 +523,7 @@ function set_service_bid!( component::StaticInjection, service::Service, time_series_data::IS.TimeSeriesData, - power_units::UnitSystem, + power_units::IS.AbstractUnitSystem, ) data_type = IS.eltype_data(time_series_data) !(data_type <: PiecewiseStepData) && @@ -533,7 +537,7 @@ function set_service_bid!( "Name provided in the TimeSeries Data $(get_name(time_series_data)), doesn't match the Service $(get_name(service)).", ) end - if power_units != UnitSystem.NATURAL_UNITS + if power_units != IS.NaturalUnit() throw( ArgumentError( "Power Unit specified for service market bids must be NATURAL_UNITS", diff --git a/src/models/cost_functions/ImportExportCost.jl b/src/models/cost_functions/ImportExportCost.jl index 1aa3093582..24db922096 100644 --- a/src/models/cost_functions/ImportExportCost.jl +++ b/src/models/cost_functions/ImportExportCost.jl @@ -7,14 +7,16 @@ $(TYPEDFIELDS) An operating cost for static (non-time-varying) imports/exports and ancillary services from neighboring areas. The data model employs a `CostCurve{PiecewiseIncrementalCurve}` -with an implied zero cost at zero power. +with an implied zero cost at zero power. The type parameter `U <: AbstractUnitSystem` +is the shared unit system of the two offer curves (propagated from +`CostCurve`'s `U` parameter); `ImportExportCost{NaturalUnit}` is the default. For time-varying bids, use [`ImportExportTimeSeriesCost`](@ref). """ -mutable struct ImportExportCost <: OfferCurveCost +mutable struct ImportExportCost{U <: IS.AbstractUnitSystem} <: OfferCurveCost "Buy Price Curves data to import power" - import_offer_curves::CostCurve{PiecewiseIncrementalCurve} + import_offer_curves::CostCurve{PiecewiseIncrementalCurve, U} "Sell Price Curves data to export power" - export_offer_curves::CostCurve{PiecewiseIncrementalCurve} + export_offer_curves::CostCurve{PiecewiseIncrementalCurve, U} "Weekly limit on the amount of energy that can be imported, defined in system base p.u-hours." energy_import_weekly_limit::Float64 "Weekly limit on the amount of energy that can be exported, defined in system base p.u-hours." @@ -23,19 +25,28 @@ mutable struct ImportExportCost <: OfferCurveCost ancillary_service_offers::Vector{Service} end -ImportExportCost(; +function ImportExportCost(; import_offer_curves = ZERO_OFFER_CURVE, export_offer_curves = ZERO_OFFER_CURVE, energy_import_weekly_limit = INFINITE_BOUND, energy_export_weekly_limit = INFINITE_BOUND, ancillary_service_offers = Vector{Service}(), -) = ImportExportCost( - import_offer_curves, - export_offer_curves, - energy_import_weekly_limit, - energy_export_weekly_limit, - ancillary_service_offers, ) + U_imp = typeof(get_power_units(import_offer_curves)) + U_exp = typeof(get_power_units(export_offer_curves)) + U_imp === U_exp || throw( + ArgumentError( + "import_offer_curves and export_offer_curves must share a unit system (got $(U_imp()) vs $(U_exp()))", + ), + ) + return ImportExportCost{U_imp}( + import_offer_curves, + export_offer_curves, + energy_import_weekly_limit, + energy_export_weekly_limit, + ancillary_service_offers, + ) +end # Constructor for demo purposes; non-functional. function ImportExportCost(::Nothing) @@ -90,7 +101,7 @@ set_energy_export_weekly_limit!(value::ImportExportCost, val) = value.energy_export_weekly_limit = val function is_import_export_curve(curve::ProductionVariableCostCurve) - return (curve isa CostCurve{PiecewiseIncrementalCurve}) && + return (curve isa IS.AnyCostCurve{PiecewiseIncrementalCurve}) && iszero(get_initial_input(get_value_curve(curve))) && iszero(get_input_at_zero(get_value_curve(curve))) && iszero(first(get_x_coords(get_value_curve(curve)))) @@ -99,7 +110,7 @@ end # Internal helper: build a static import/export `CostCurve` from validated step data. function make_import_export_curve( curve::PiecewiseStepData, - power_units::UnitSystem = UnitSystem.NATURAL_UNITS, + power_units::IS.AbstractUnitSystem = IS.NaturalUnit(), ) cc = CostCurve( PiecewiseIncrementalCurve(curve, 0.0, 0.0), @@ -123,7 +134,7 @@ import_curve = make_import_curve([0.0, 100.0, 105.0, 120.0, 200.0], [5.0, 10.0, function make_import_curve( power::Vector{Float64}, price::Vector{Float64}, - power_units::UnitSystem = UnitSystem.NATURAL_UNITS, + power_units::IS.AbstractUnitSystem = IS.NaturalUnit(), ) curve = PiecewiseStepData(power, price) is_convex(curve) || @@ -145,7 +156,7 @@ export_curve = make_export_curve([0.0, 100.0, 105.0, 120.0, 200.0], [40.0, 20.0, function make_export_curve( power::Vector{Float64}, price::Vector{Float64}, - power_units::UnitSystem = UnitSystem.NATURAL_UNITS, + power_units::IS.AbstractUnitSystem = IS.NaturalUnit(), ) curve = PiecewiseStepData(power, price) is_concave(curve) || diff --git a/src/models/cost_functions/ImportExportTimeSeriesCost.jl b/src/models/cost_functions/ImportExportTimeSeriesCost.jl index 0e0f6346b3..d29d22b91b 100644 --- a/src/models/cost_functions/ImportExportTimeSeriesCost.jl +++ b/src/models/cost_functions/ImportExportTimeSeriesCost.jl @@ -10,11 +10,11 @@ areas. All offer curve fields are backed by time series data via IS.jl's time-se ValueCurve types. For static (non-time-varying) bids, use [`ImportExportCost`](@ref). """ -mutable struct ImportExportTimeSeriesCost <: OfferCurveCost +mutable struct ImportExportTimeSeriesCost{U <: IS.AbstractUnitSystem} <: OfferCurveCost "Import price curves (time series)" - import_offer_curves::CostCurve{TimeSeriesPiecewiseIncrementalCurve} + import_offer_curves::CostCurve{TimeSeriesPiecewiseIncrementalCurve, U} "Export price curves (time series)" - export_offer_curves::CostCurve{TimeSeriesPiecewiseIncrementalCurve} + export_offer_curves::CostCurve{TimeSeriesPiecewiseIncrementalCurve, U} "Weekly limit on the amount of energy that can be imported, defined in system base p.u-hours." energy_import_weekly_limit::Float64 "Weekly limit on the amount of energy that can be exported, defined in system base p.u-hours." @@ -23,19 +23,28 @@ mutable struct ImportExportTimeSeriesCost <: OfferCurveCost ancillary_service_offers::Vector{Service} end -ImportExportTimeSeriesCost(; +function ImportExportTimeSeriesCost(; import_offer_curves, export_offer_curves, energy_import_weekly_limit = INFINITE_BOUND, energy_export_weekly_limit = INFINITE_BOUND, ancillary_service_offers = Vector{Service}(), -) = ImportExportTimeSeriesCost( - import_offer_curves, - export_offer_curves, - energy_import_weekly_limit, - energy_export_weekly_limit, - ancillary_service_offers, ) + U_imp = typeof(get_power_units(import_offer_curves)) + U_exp = typeof(get_power_units(export_offer_curves)) + U_imp === U_exp || throw( + ArgumentError( + "import_offer_curves and export_offer_curves must share a unit system (got $(U_imp()) vs $(U_exp()))", + ), + ) + return ImportExportTimeSeriesCost{U_imp}( + import_offer_curves, + export_offer_curves, + energy_import_weekly_limit, + energy_export_weekly_limit, + ancillary_service_offers, + ) +end """Get [`ImportExportTimeSeriesCost`](@ref) `import_offer_curves`.""" get_import_offer_curves(value::ImportExportTimeSeriesCost) = value.import_offer_curves @@ -74,7 +83,7 @@ an [`ImportExportTimeSeriesCost`](@ref). """ function make_import_export_ts_curve( ts_key::TimeSeriesKey, - power_units::UnitSystem = UnitSystem.NATURAL_UNITS, + power_units::IS.AbstractUnitSystem = IS.NaturalUnit(), ) vc = TimeSeriesPiecewiseIncrementalCurve(ts_key, nothing, nothing) return CostCurve(vc, power_units) diff --git a/src/models/cost_functions/MarketBidCost.jl b/src/models/cost_functions/MarketBidCost.jl index 4bd5f970df..29c3620e59 100644 --- a/src/models/cost_functions/MarketBidCost.jl +++ b/src/models/cost_functions/MarketBidCost.jl @@ -9,7 +9,7 @@ $(TYPEDFIELDS) An operating cost for static (non-time-varying) market bids of energy and ancillary services. For time-varying bids, use [`MarketBidTimeSeriesCost`](@ref). """ -mutable struct MarketBidCost <: OfferCurveCost +mutable struct MarketBidCost{U <: IS.AbstractUnitSystem} <: OfferCurveCost "No load cost" no_load_cost::LinearCurve "Start-up cost at different stages of the thermal cycle (hot, warm, cold)" @@ -17,27 +17,36 @@ mutable struct MarketBidCost <: OfferCurveCost "Shut-down cost" shut_down::LinearCurve "Sell Offer Curves data as a [`CostCurve`](@ref) of [`PiecewiseIncrementalCurve`](@ref)" - incremental_offer_curves::CostCurve{PiecewiseIncrementalCurve} + incremental_offer_curves::CostCurve{PiecewiseIncrementalCurve, U} "Buy Offer Curves data as a [`CostCurve`](@ref) of [`PiecewiseIncrementalCurve`](@ref)" - decremental_offer_curves::CostCurve{PiecewiseIncrementalCurve} + decremental_offer_curves::CostCurve{PiecewiseIncrementalCurve, U} "Bids for the ancillary services" ancillary_service_offers::Vector{Service} end const ZERO_OFFER_CURVE = CostCurve(PiecewiseIncrementalCurve(0.0, [0.0, 0.0], [0.0])) -MarketBidCost(; +function MarketBidCost(; no_load_cost = LinearCurve(0.0), start_up = (hot = 0.0, warm = 0.0, cold = 0.0), shut_down = LinearCurve(0.0), incremental_offer_curves = ZERO_OFFER_CURVE, decremental_offer_curves = ZERO_OFFER_CURVE, ancillary_service_offers = Vector{Service}(), -) = MarketBidCost( - no_load_cost, start_up, shut_down, - incremental_offer_curves, decremental_offer_curves, - ancillary_service_offers, ) + U_inc = typeof(get_power_units(incremental_offer_curves)) + U_dec = typeof(get_power_units(decremental_offer_curves)) + U_inc === U_dec || throw( + ArgumentError( + "incremental_offer_curves and decremental_offer_curves must share a unit system (got $(U_inc()) vs $(U_dec()))", + ), + ) + return MarketBidCost{U_inc}( + no_load_cost, start_up, shut_down, + incremental_offer_curves, decremental_offer_curves, + ancillary_service_offers, + ) +end # Constructor for demo purposes; non-functional. function MarketBidCost(::Nothing) @@ -109,7 +118,7 @@ Return `true` if the given [`ProductionVariableCostCurve`](@ref) is a market bid (a `CostCurve{PiecewiseIncrementalCurve}` as used in [`MarketBidCost`](@ref)). """ function is_market_bid_curve(curve::ProductionVariableCostCurve) - return (curve isa CostCurve{PiecewiseIncrementalCurve}) + return (curve isa IS.AnyCostCurve{PiecewiseIncrementalCurve}) end """ @@ -125,7 +134,7 @@ function make_market_bid_curve( powers::Vector{Float64}, marginal_costs::Vector{Float64}, initial_input::Float64; - power_units::UnitSystem = UnitSystem.NATURAL_UNITS, + power_units::IS.AbstractUnitSystem = IS.NaturalUnit(), input_at_zero::Union{Nothing, Float64} = nothing, ) if length(powers) == length(marginal_costs) + 1 @@ -151,7 +160,7 @@ Make a static `CostCurve{PiecewiseIncrementalCurve}` from `PiecewiseStepData`. function make_market_bid_curve( data::PiecewiseStepData, initial_input::Float64; - power_units::UnitSystem = UnitSystem.NATURAL_UNITS, + power_units::IS.AbstractUnitSystem = IS.NaturalUnit(), input_at_zero::Union{Nothing, Float64} = nothing, ) cc = CostCurve(IncrementalCurve(data, initial_input, input_at_zero), power_units) diff --git a/src/models/cost_functions/MarketBidTimeSeriesCost.jl b/src/models/cost_functions/MarketBidTimeSeriesCost.jl index 4d85a1a35b..d20e5dffa7 100644 --- a/src/models/cost_functions/MarketBidTimeSeriesCost.jl +++ b/src/models/cost_functions/MarketBidTimeSeriesCost.jl @@ -9,7 +9,7 @@ An operating cost for time-varying market bids of energy and ancillary services. All cost curve fields are backed by time series data via IS.jl's time-series ValueCurve types. For static (non-time-varying) bids, use [`MarketBidCost`](@ref). """ -mutable struct MarketBidTimeSeriesCost <: OfferCurveCost +mutable struct MarketBidTimeSeriesCost{U <: IS.AbstractUnitSystem} <: OfferCurveCost "No load cost (time series)" no_load_cost::TimeSeriesLinearCurve "Start-up cost stages (time series)" @@ -17,25 +17,34 @@ mutable struct MarketBidTimeSeriesCost <: OfferCurveCost "Shut-down cost (time series)" shut_down::TimeSeriesLinearCurve "Sell Offer Curves data (time series)" - incremental_offer_curves::CostCurve{TimeSeriesPiecewiseIncrementalCurve} + incremental_offer_curves::CostCurve{TimeSeriesPiecewiseIncrementalCurve, U} "Buy Offer Curves data (time series)" - decremental_offer_curves::CostCurve{TimeSeriesPiecewiseIncrementalCurve} + decremental_offer_curves::CostCurve{TimeSeriesPiecewiseIncrementalCurve, U} "Bids for the ancillary services" ancillary_service_offers::Vector{Service} end -MarketBidTimeSeriesCost(; +function MarketBidTimeSeriesCost(; no_load_cost, start_up, shut_down, incremental_offer_curves, decremental_offer_curves, ancillary_service_offers = Vector{Service}(), -) = MarketBidTimeSeriesCost( - no_load_cost, start_up, shut_down, - incremental_offer_curves, decremental_offer_curves, - ancillary_service_offers, ) + U_inc = typeof(get_power_units(incremental_offer_curves)) + U_dec = typeof(get_power_units(decremental_offer_curves)) + U_inc === U_dec || throw( + ArgumentError( + "incremental_offer_curves and decremental_offer_curves must share a unit system (got $(U_inc()) vs $(U_dec()))", + ), + ) + return MarketBidTimeSeriesCost{U_inc}( + no_load_cost, start_up, shut_down, + incremental_offer_curves, decremental_offer_curves, + ancillary_service_offers, + ) +end """Get [`MarketBidTimeSeriesCost`](@ref) `no_load_cost`.""" get_no_load_cost(value::MarketBidTimeSeriesCost) = value.no_load_cost @@ -77,7 +86,7 @@ Make a time-series-backed `CostCurve{TimeSeriesPiecewiseIncrementalCurve}` from function make_market_bid_ts_curve( ts_key::TimeSeriesKey, initial_input_key::Union{Nothing, TimeSeriesKey} = nothing, - power_units::UnitSystem = UnitSystem.NATURAL_UNITS; + power_units::IS.AbstractUnitSystem = IS.NaturalUnit(); input_at_zero_key::Union{Nothing, TimeSeriesKey} = nothing, ) vc = TimeSeriesPiecewiseIncrementalCurve(ts_key, initial_input_key, input_at_zero_key) diff --git a/src/models/cost_functions/ReserveDemandCurve.jl b/src/models/cost_functions/ReserveDemandCurve.jl index b2afd78ca7..2106efcbe7 100644 --- a/src/models/cost_functions/ReserveDemandCurve.jl +++ b/src/models/cost_functions/ReserveDemandCurve.jl @@ -14,9 +14,10 @@ For time-varying ORDCs, use [`ReserveDemandTimeSeriesCurve`](@ref). When defining the reserve, the `ReserveDirection` must be specified to define this as a [`ReserveUp`](@ref), [`ReserveDown`](@ref), or [`ReserveSymmetric`](@ref). """ -mutable struct ReserveDemandCurve{T <: ReserveDirection} <: Reserve{T} +mutable struct ReserveDemandCurve{T <: ReserveDirection, U <: IS.AbstractUnitSystem} <: + Reserve{T} "Operating reserve demand curve" - variable::CostCurve{PiecewiseIncrementalCurve} + variable::CostCurve{PiecewiseIncrementalCurve, U} "Name of the component" name::String "Indicator of whether the component is connected and online" @@ -45,7 +46,8 @@ function ReserveDemandCurve{T}( deployed_fraction = 0.0, ext = Dict{String, Any}(), ) where {T <: ReserveDirection} - ReserveDemandCurve{T}( + U = typeof(get_power_units(variable)) + ReserveDemandCurve{T, U}( variable, name, available, time_frame, sustained_time, max_participation_factor, deployed_fraction, ext, InfrastructureSystemsInternal(), @@ -63,7 +65,27 @@ function ReserveDemandCurve{T}(; ext = Dict{String, Any}(), internal = InfrastructureSystemsInternal(), ) where {T <: ReserveDirection} - ReserveDemandCurve{T}( + U = typeof(get_power_units(variable)) + ReserveDemandCurve{T, U}( + variable, name, available, time_frame, sustained_time, + max_participation_factor, deployed_fraction, ext, internal, + ) +end + +# Kwarg constructor on the fully-parameterized type — needed by deserialization, +# which resolves `ReserveDemandCurve{T, U}` from metadata and calls it with kwargs. +function ReserveDemandCurve{T, U}(; + variable, + name, + available, + time_frame, + sustained_time = 3600.0, + max_participation_factor = 1.0, + deployed_fraction = 0.0, + ext = Dict{String, Any}(), + internal = InfrastructureSystemsInternal(), +) where {T <: ReserveDirection, U <: IS.AbstractUnitSystem} + ReserveDemandCurve{T, U}( variable, name, available, time_frame, sustained_time, max_participation_factor, deployed_fraction, ext, internal, ) diff --git a/src/models/cost_functions/ReserveDemandTimeSeriesCurve.jl b/src/models/cost_functions/ReserveDemandTimeSeriesCurve.jl index 6d5a03f0be..4d4464de4a 100644 --- a/src/models/cost_functions/ReserveDemandTimeSeriesCurve.jl +++ b/src/models/cost_functions/ReserveDemandTimeSeriesCurve.jl @@ -15,9 +15,12 @@ For static (non-time-varying) ORDCs, use [`ReserveDemandCurve`](@ref). When defining the reserve, the `ReserveDirection` must be specified to define this as a [`ReserveUp`](@ref), [`ReserveDown`](@ref), or [`ReserveSymmetric`](@ref). """ -mutable struct ReserveDemandTimeSeriesCurve{T <: ReserveDirection} <: Reserve{T} +mutable struct ReserveDemandTimeSeriesCurve{ + T <: ReserveDirection, + U <: IS.AbstractUnitSystem, +} <: Reserve{T} "Operating reserve demand curve (time series)" - variable::CostCurve{TimeSeriesPiecewiseIncrementalCurve} + variable::CostCurve{TimeSeriesPiecewiseIncrementalCurve, U} "Name of the component" name::String "Indicator of whether the component is connected and online" @@ -46,7 +49,8 @@ function ReserveDemandTimeSeriesCurve{T}( deployed_fraction = 0.0, ext = Dict{String, Any}(), ) where {T <: ReserveDirection} - ReserveDemandTimeSeriesCurve{T}( + U = typeof(get_power_units(variable)) + ReserveDemandTimeSeriesCurve{T, U}( variable, name, available, time_frame, sustained_time, max_participation_factor, deployed_fraction, ext, InfrastructureSystemsInternal(), @@ -64,7 +68,26 @@ function ReserveDemandTimeSeriesCurve{T}(; ext = Dict{String, Any}(), internal = InfrastructureSystemsInternal(), ) where {T <: ReserveDirection} - ReserveDemandTimeSeriesCurve{T}( + U = typeof(get_power_units(variable)) + ReserveDemandTimeSeriesCurve{T, U}( + variable, name, available, time_frame, sustained_time, + max_participation_factor, deployed_fraction, ext, internal, + ) +end + +# Kwarg constructor on the fully-parameterized type — needed by deserialization. +function ReserveDemandTimeSeriesCurve{T, U}(; + variable, + name, + available, + time_frame, + sustained_time = 3600.0, + max_participation_factor = 1.0, + deployed_fraction = 0.0, + ext = Dict{String, Any}(), + internal = InfrastructureSystemsInternal(), +) where {T <: ReserveDirection, U <: IS.AbstractUnitSystem} + ReserveDemandTimeSeriesCurve{T, U}( variable, name, available, time_frame, sustained_time, max_participation_factor, deployed_fraction, ext, internal, ) diff --git a/src/models/dynamic_branch.jl b/src/models/dynamic_branch.jl index 2fa1511427..5d1f39dd57 100644 --- a/src/models/dynamic_branch.jl +++ b/src/models/dynamic_branch.jl @@ -54,25 +54,26 @@ get_name(value::DynamicBranch) = IS.get_name(value.branch) """Get DynamicBranch available.""" get_available(value::DynamicBranch) = get_available(value.branch) """Get DynamicBranch active_power_flow.""" -get_active_power_flow(value::DynamicBranch) = get_active_power(value.branch) +get_active_power_flow(value::DynamicBranch, units) = get_active_power(value.branch, units) """Get DynamicBranch reactive_power_flow.""" -get_reactive_power_flow(value::DynamicBranch) = get_reactive_power(value.branch) +get_reactive_power_flow(value::DynamicBranch, units) = + get_reactive_power(value.branch, units) """Get DynamicBranch arc.""" get_arc(value::DynamicBranch) = get_arc(value.branch) """Get DynamicBranch r.""" -get_r(value::DynamicBranch) = get_r(value.branch) +get_r(value::DynamicBranch, units) = get_r(value.branch, units) """Get DynamicBranch x.""" -get_x(value::DynamicBranch) = get_x(value.branch) +get_x(value::DynamicBranch, units) = get_x(value.branch, units) """Get DynamicBranch b.""" -get_b(value::DynamicBranch) = get_b(value.branch) +get_b(value::DynamicBranch, units) = get_b(value.branch, units) """Get DynamicBranch A rating.""" -get_rating(value::DynamicBranch) = get_rating(value.branch) +get_rating(value::DynamicBranch, units) = get_rating(value.branch, units) """Get DynamicBranch angle_limits.""" get_angle_limits(value::DynamicBranch) = get_angle_limits(value.branch) """Get DynamicBranch B rating.""" -get_rating_b(value::DynamicBranch) = get_rating_b(value.branch) +get_rating_b(value::DynamicBranch, units) = get_rating_b(value.branch, units) """Get DynamicBranch C rating.""" -get_rating_c(value::DynamicBranch) = get_rating_c(value.branch) +get_rating_c(value::DynamicBranch, units) = get_rating_c(value.branch, units) """Get DynamicBranch services.""" get_services(value::DynamicBranch) = get_services(value.branch) """Get DynamicBranch ext.""" diff --git a/src/models/dynamic_generator.jl b/src/models/dynamic_generator.jl index b690f88ca9..2eac252faa 100644 --- a/src/models/dynamic_generator.jl +++ b/src/models/dynamic_generator.jl @@ -144,7 +144,7 @@ get_avr(device::DynamicGenerator) = device.avr get_prime_mover(device::DynamicGenerator) = device.prime_mover """Get the [`PSS`](@ref) component of a [`DynamicGenerator`](@ref).""" get_pss(device::DynamicGenerator) = device.pss -get_base_power(device::DynamicGenerator) = device.base_power +_get_base_power(device::DynamicGenerator) = device.base_power get_ext(device::DynamicGenerator) = device.ext get_internal(device::DynamicGenerator) = device.internal get_V_ref(value::DynamicGenerator) = get_V_ref(get_avr(value)) diff --git a/src/models/dynamic_inverter.jl b/src/models/dynamic_inverter.jl index be7e6b595c..b4d19ba05d 100644 --- a/src/models/dynamic_inverter.jl +++ b/src/models/dynamic_inverter.jl @@ -245,7 +245,7 @@ get_freq_estimator(device::DynamicInverter) = device.freq_estimator """Get the [`Filter`](@ref) component of a [`DynamicInverter`](@ref).""" get_filter(device::DynamicInverter) = device.filter get_limiter(device::DynamicInverter) = device.limiter -get_base_power(device::DynamicInverter) = device.base_power +_get_base_power(device::DynamicInverter) = device.base_power get_internal(device::DynamicInverter) = device.internal get_P_ref(value::DynamicInverter) = get_P_ref(get_active_power_control(get_outer_control(value))) diff --git a/src/models/generated/ActiveConstantPowerLoad.jl b/src/models/generated/ActiveConstantPowerLoad.jl index 4a9e107931..3915bdfd19 100644 --- a/src/models/generated/ActiveConstantPowerLoad.jl +++ b/src/models/generated/ActiveConstantPowerLoad.jl @@ -160,7 +160,7 @@ function ActiveConstantPowerLoad(::Nothing) kiv=0, kpc=0, kic=0, - base_power=100, + base_power=100.0, ext=Dict{String, Any}(), ) end @@ -193,8 +193,8 @@ get_kiv(value::ActiveConstantPowerLoad) = value.kiv get_kpc(value::ActiveConstantPowerLoad) = value.kpc """Get [`ActiveConstantPowerLoad`](@ref) `kic`.""" get_kic(value::ActiveConstantPowerLoad) = value.kic -"""Get [`ActiveConstantPowerLoad`](@ref) `base_power`.""" -get_base_power(value::ActiveConstantPowerLoad) = value.base_power + +_get_base_power(value::ActiveConstantPowerLoad) = value.base_power """Get [`ActiveConstantPowerLoad`](@ref) `ext`.""" get_ext(value::ActiveConstantPowerLoad) = value.ext """Get [`ActiveConstantPowerLoad`](@ref) `P_ref`.""" diff --git a/src/models/generated/AggregateDistributedGenerationA.jl b/src/models/generated/AggregateDistributedGenerationA.jl index bdeba6ccb6..3cc96e381a 100644 --- a/src/models/generated/AggregateDistributedGenerationA.jl +++ b/src/models/generated/AggregateDistributedGenerationA.jl @@ -331,8 +331,8 @@ get_ω_ref(value::AggregateDistributedGenerationA) = value.ω_ref get_Q_ref(value::AggregateDistributedGenerationA) = value.Q_ref """Get [`AggregateDistributedGenerationA`](@ref) `P_ref`.""" get_P_ref(value::AggregateDistributedGenerationA) = value.P_ref -"""Get [`AggregateDistributedGenerationA`](@ref) `base_power`.""" -get_base_power(value::AggregateDistributedGenerationA) = value.base_power + +_get_base_power(value::AggregateDistributedGenerationA) = value.base_power """Get [`AggregateDistributedGenerationA`](@ref) `ext`.""" get_ext(value::AggregateDistributedGenerationA) = value.ext """Get [`AggregateDistributedGenerationA`](@ref) `states`.""" diff --git a/src/models/generated/Area.jl b/src/models/generated/Area.jl index dec3a1d236..7a657567f6 100644 --- a/src/models/generated/Area.jl +++ b/src/models/generated/Area.jl @@ -62,10 +62,18 @@ end """Get [`Area`](@ref) `name`.""" get_name(value::Area) = value.name -"""Get [`Area`](@ref) `peak_active_power`.""" -get_peak_active_power(value::Area) = get_value(value, Val(:peak_active_power), Val(:mva)) -"""Get [`Area`](@ref) `peak_reactive_power`.""" -get_peak_reactive_power(value::Area) = get_value(value, Val(:peak_reactive_power), Val(:mva)) +"""Get [`Area`](@ref) `peak_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_peak_active_power_unitful`](@ref).""" +get_peak_active_power(value::Area, units) = InfrastructureSystems._strip_units(get_value(value, Val(:peak_active_power), Val(:mva), units)) +"""Get [`Area`](@ref) `peak_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_peak_active_power`](@ref).""" +get_peak_active_power_unitful(value::Area, units) = get_value(value, Val(:peak_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_peak_active_power), ::Type{ Area }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_peak_active_power_unitful), ::Type{ Area }) = InfrastructureSystems.SU +"""Get [`Area`](@ref) `peak_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_peak_reactive_power_unitful`](@ref).""" +get_peak_reactive_power(value::Area, units) = InfrastructureSystems._strip_units(get_value(value, Val(:peak_reactive_power), Val(:mva), units)) +"""Get [`Area`](@ref) `peak_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_peak_reactive_power`](@ref).""" +get_peak_reactive_power_unitful(value::Area, units) = get_value(value, Val(:peak_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_peak_reactive_power), ::Type{ Area }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_peak_reactive_power_unitful), ::Type{ Area }) = InfrastructureSystems.SU """Get [`Area`](@ref) `load_response`.""" get_load_response(value::Area) = value.load_response """Get [`Area`](@ref) `ext`.""" diff --git a/src/models/generated/AreaInterchange.jl b/src/models/generated/AreaInterchange.jl index 287e89e088..7e7040ab00 100644 --- a/src/models/generated/AreaInterchange.jl +++ b/src/models/generated/AreaInterchange.jl @@ -77,14 +77,22 @@ end get_name(value::AreaInterchange) = value.name """Get [`AreaInterchange`](@ref) `available`.""" get_available(value::AreaInterchange) = value.available -"""Get [`AreaInterchange`](@ref) `active_power_flow`.""" -get_active_power_flow(value::AreaInterchange) = get_value(value, Val(:active_power_flow), Val(:mva)) +"""Get [`AreaInterchange`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_unitful`](@ref).""" +get_active_power_flow(value::AreaInterchange, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow), Val(:mva), units)) +"""Get [`AreaInterchange`](@ref) `active_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow`](@ref).""" +get_active_power_flow_unitful(value::AreaInterchange, units) = get_value(value, Val(:active_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow), ::Type{ AreaInterchange }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_unitful), ::Type{ AreaInterchange }) = InfrastructureSystems.SU """Get [`AreaInterchange`](@ref) `from_area`.""" get_from_area(value::AreaInterchange) = value.from_area """Get [`AreaInterchange`](@ref) `to_area`.""" get_to_area(value::AreaInterchange) = value.to_area -"""Get [`AreaInterchange`](@ref) `flow_limits`.""" -get_flow_limits(value::AreaInterchange) = get_value(value, Val(:flow_limits), Val(:mva)) +"""Get [`AreaInterchange`](@ref) `flow_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_flow_limits_unitful`](@ref).""" +get_flow_limits(value::AreaInterchange, units) = InfrastructureSystems._strip_units(get_value(value, Val(:flow_limits), Val(:mva), units)) +"""Get [`AreaInterchange`](@ref) `flow_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_flow_limits`](@ref).""" +get_flow_limits_unitful(value::AreaInterchange, units) = get_value(value, Val(:flow_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_flow_limits), ::Type{ AreaInterchange }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_flow_limits_unitful), ::Type{ AreaInterchange }) = InfrastructureSystems.SU """Get [`AreaInterchange`](@ref) `services`.""" get_services(value::AreaInterchange) = value.services """Get [`AreaInterchange`](@ref) `ext`.""" diff --git a/src/models/generated/CSVGN1.jl b/src/models/generated/CSVGN1.jl index 0a7315aa8c..2bffdcbe21 100644 --- a/src/models/generated/CSVGN1.jl +++ b/src/models/generated/CSVGN1.jl @@ -115,7 +115,7 @@ function CSVGN1(::Nothing) Vmax=0, Vmin=0, CBase=0, - base_power=100, + base_power=100.0, ext=Dict{String, Any}(), ) end @@ -142,8 +142,8 @@ get_Vmax(value::CSVGN1) = value.Vmax get_Vmin(value::CSVGN1) = value.Vmin """Get [`CSVGN1`](@ref) `CBase`.""" get_CBase(value::CSVGN1) = value.CBase -"""Get [`CSVGN1`](@ref) `base_power`.""" -get_base_power(value::CSVGN1) = value.base_power + +_get_base_power(value::CSVGN1) = value.base_power """Get [`CSVGN1`](@ref) `ext`.""" get_ext(value::CSVGN1) = value.ext """Get [`CSVGN1`](@ref) `R_th`.""" diff --git a/src/models/generated/ConstantReserve.jl b/src/models/generated/ConstantReserve.jl index 631a4658af..63ac49520c 100644 --- a/src/models/generated/ConstantReserve.jl +++ b/src/models/generated/ConstantReserve.jl @@ -86,8 +86,12 @@ get_name(value::ConstantReserve) = value.name get_available(value::ConstantReserve) = value.available """Get [`ConstantReserve`](@ref) `time_frame`.""" get_time_frame(value::ConstantReserve) = value.time_frame -"""Get [`ConstantReserve`](@ref) `requirement`.""" -get_requirement(value::ConstantReserve) = get_value(value, Val(:requirement), Val(:mva)) +"""Get [`ConstantReserve`](@ref) `requirement` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_requirement_unitful`](@ref).""" +get_requirement(value::ConstantReserve, units) = InfrastructureSystems._strip_units(get_value(value, Val(:requirement), Val(:mva), units)) +"""Get [`ConstantReserve`](@ref) `requirement` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_requirement`](@ref).""" +get_requirement_unitful(value::ConstantReserve, units) = get_value(value, Val(:requirement), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_requirement), ::Type{ ConstantReserve }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_requirement_unitful), ::Type{ ConstantReserve }) = InfrastructureSystems.SU """Get [`ConstantReserve`](@ref) `sustained_time`.""" get_sustained_time(value::ConstantReserve) = value.sustained_time """Get [`ConstantReserve`](@ref) `max_output_fraction`.""" diff --git a/src/models/generated/ConstantReserveGroup.jl b/src/models/generated/ConstantReserveGroup.jl index 2ca054bf76..97fcc86770 100644 --- a/src/models/generated/ConstantReserveGroup.jl +++ b/src/models/generated/ConstantReserveGroup.jl @@ -66,8 +66,12 @@ end get_name(value::ConstantReserveGroup) = value.name """Get [`ConstantReserveGroup`](@ref) `available`.""" get_available(value::ConstantReserveGroup) = value.available -"""Get [`ConstantReserveGroup`](@ref) `requirement`.""" -get_requirement(value::ConstantReserveGroup) = get_value(value, Val(:requirement), Val(:mva)) +"""Get [`ConstantReserveGroup`](@ref) `requirement` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_requirement_unitful`](@ref).""" +get_requirement(value::ConstantReserveGroup, units) = InfrastructureSystems._strip_units(get_value(value, Val(:requirement), Val(:mva), units)) +"""Get [`ConstantReserveGroup`](@ref) `requirement` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_requirement`](@ref).""" +get_requirement_unitful(value::ConstantReserveGroup, units) = get_value(value, Val(:requirement), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_requirement), ::Type{ ConstantReserveGroup }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_requirement_unitful), ::Type{ ConstantReserveGroup }) = InfrastructureSystems.SU """Get [`ConstantReserveGroup`](@ref) `ext`.""" get_ext(value::ConstantReserveGroup) = value.ext """Get [`ConstantReserveGroup`](@ref) `contributing_services`.""" diff --git a/src/models/generated/ConstantReserveNonSpinning.jl b/src/models/generated/ConstantReserveNonSpinning.jl index 986eb9f68a..eebd297a5d 100644 --- a/src/models/generated/ConstantReserveNonSpinning.jl +++ b/src/models/generated/ConstantReserveNonSpinning.jl @@ -86,8 +86,12 @@ get_name(value::ConstantReserveNonSpinning) = value.name get_available(value::ConstantReserveNonSpinning) = value.available """Get [`ConstantReserveNonSpinning`](@ref) `time_frame`.""" get_time_frame(value::ConstantReserveNonSpinning) = value.time_frame -"""Get [`ConstantReserveNonSpinning`](@ref) `requirement`.""" -get_requirement(value::ConstantReserveNonSpinning) = get_value(value, Val(:requirement), Val(:mva)) +"""Get [`ConstantReserveNonSpinning`](@ref) `requirement` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_requirement_unitful`](@ref).""" +get_requirement(value::ConstantReserveNonSpinning, units) = InfrastructureSystems._strip_units(get_value(value, Val(:requirement), Val(:mva), units)) +"""Get [`ConstantReserveNonSpinning`](@ref) `requirement` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_requirement`](@ref).""" +get_requirement_unitful(value::ConstantReserveNonSpinning, units) = get_value(value, Val(:requirement), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_requirement), ::Type{ ConstantReserveNonSpinning }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_requirement_unitful), ::Type{ ConstantReserveNonSpinning }) = InfrastructureSystems.SU """Get [`ConstantReserveNonSpinning`](@ref) `sustained_time`.""" get_sustained_time(value::ConstantReserveNonSpinning) = value.sustained_time """Get [`ConstantReserveNonSpinning`](@ref) `max_output_fraction`.""" diff --git a/src/models/generated/DEGOV.jl b/src/models/generated/DEGOV.jl index 846f990872..a5a8d232c4 100644 --- a/src/models/generated/DEGOV.jl +++ b/src/models/generated/DEGOV.jl @@ -25,14 +25,14 @@ This file is auto-generated. Do not edit. Parameters Woodward Diesel Governor Model. DEGOV in PowerWorld # Arguments -- `T1::Float64`: Governor mechanism time constant, validation range: `(eps(), 100)` -- `T2::Float64`: Turbine power time constant, validation range: `(eps(), 100)` -- `T3::Float64`: Turbine exhaust temperature time constant, validation range: `(eps(), 100)` -- `K::Float64`: Governor gain (reciprocal of droop), validation range: `(eps(), 100)` -- `T4::Float64`: Governor lead time constant, validation range: `(eps(), 100)` -- `T5::Float64`: Governor lag time constant, validation range: `(eps(), 100)` -- `T6::Float64`: Actuator time constant, validation range: `(eps(), 100)` -- `Td::Float64`: Engine time delay, validation range: `(eps(), 100)` +- `T1::Float64`: Governor mechanism time constant, validation range: `(eps(), 100.0)` +- `T2::Float64`: Turbine power time constant, validation range: `(eps(), 100.0)` +- `T3::Float64`: Turbine exhaust temperature time constant, validation range: `(eps(), 100.0)` +- `K::Float64`: Governor gain (reciprocal of droop), validation range: `(eps(), 100.0)` +- `T4::Float64`: Governor lead time constant, validation range: `(eps(), 100.0)` +- `T5::Float64`: Governor lag time constant, validation range: `(eps(), 100.0)` +- `T6::Float64`: Actuator time constant, validation range: `(eps(), 100.0)` +- `Td::Float64`: Engine time delay, validation range: `(eps(), 100.0)` - `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](@ref additional_fields) for users to add metadata that are not used in simulation. - `states::Vector{Symbol}`: (**Do not modify.**) The [states](@ref S) of the DEGOV model are: diff --git a/src/models/generated/DEGOV1.jl b/src/models/generated/DEGOV1.jl index f7b41615b0..a4da9ef0a7 100644 --- a/src/models/generated/DEGOV1.jl +++ b/src/models/generated/DEGOV1.jl @@ -29,17 +29,17 @@ 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)` +- `T1::Float64`: Governor mechanism time constant in s, validation range: `(0, 100.0)` +- `T2::Float64`: Turbine power time constant in s, validation range: `(0, 100.0)` +- `T3::Float64`: Turbine exhaust temperature time constant in s, validation range: `(0, 100.0)` +- `K::Float64`: Governor gain for actuator, validation range: `(0, 100.0)` +- `T4::Float64`: Governor lead time constant in s, validation range: `(0, 100.0)` +- `T5::Float64`: Governor lag time constant in s, validation range: `(0, 100.0)` +- `T6::Float64`: Actuator time constant in s, validation range: `(0, 100.0)` +- `Td::Float64`: Engine time delay in s, validation range: `(0, 100.0)` - `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)` +- `R::Float64`: Steady state droop parameter, validation range: `(0, 100.0)` +- `Te::Float64`: Power transducer time constant in s, validation range: `(0, 100.0)` - `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](@ref additional_fields) for users to add metadata that are not used in simulation. - `states::Vector{Symbol}`: (**Do not modify.**) The [states](@ref S) of the DEGOV1 model depends on the droop flag diff --git a/src/models/generated/DiscreteControlledACBranch.jl b/src/models/generated/DiscreteControlledACBranch.jl index cd33c55045..f10733287e 100644 --- a/src/models/generated/DiscreteControlledACBranch.jl +++ b/src/models/generated/DiscreteControlledACBranch.jl @@ -92,18 +92,38 @@ end get_name(value::DiscreteControlledACBranch) = value.name """Get [`DiscreteControlledACBranch`](@ref) `available`.""" get_available(value::DiscreteControlledACBranch) = value.available -"""Get [`DiscreteControlledACBranch`](@ref) `active_power_flow`.""" -get_active_power_flow(value::DiscreteControlledACBranch) = get_value(value, Val(:active_power_flow), Val(:mva)) -"""Get [`DiscreteControlledACBranch`](@ref) `reactive_power_flow`.""" -get_reactive_power_flow(value::DiscreteControlledACBranch) = get_value(value, Val(:reactive_power_flow), Val(:mva)) +"""Get [`DiscreteControlledACBranch`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_unitful`](@ref).""" +get_active_power_flow(value::DiscreteControlledACBranch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow), Val(:mva), units)) +"""Get [`DiscreteControlledACBranch`](@ref) `active_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow`](@ref).""" +get_active_power_flow_unitful(value::DiscreteControlledACBranch, units) = get_value(value, Val(:active_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow), ::Type{ DiscreteControlledACBranch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_unitful), ::Type{ DiscreteControlledACBranch }) = InfrastructureSystems.SU +"""Get [`DiscreteControlledACBranch`](@ref) `reactive_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_flow_unitful`](@ref).""" +get_reactive_power_flow(value::DiscreteControlledACBranch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_flow), Val(:mva), units)) +"""Get [`DiscreteControlledACBranch`](@ref) `reactive_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_flow`](@ref).""" +get_reactive_power_flow_unitful(value::DiscreteControlledACBranch, units) = get_value(value, Val(:reactive_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow), ::Type{ DiscreteControlledACBranch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_unitful), ::Type{ DiscreteControlledACBranch }) = InfrastructureSystems.SU """Get [`DiscreteControlledACBranch`](@ref) `arc`.""" get_arc(value::DiscreteControlledACBranch) = value.arc -"""Get [`DiscreteControlledACBranch`](@ref) `r`.""" -get_r(value::DiscreteControlledACBranch) = get_value(value, Val(:r), Val(:ohm)) -"""Get [`DiscreteControlledACBranch`](@ref) `x`.""" -get_x(value::DiscreteControlledACBranch) = get_value(value, Val(:x), Val(:ohm)) -"""Get [`DiscreteControlledACBranch`](@ref) `rating`.""" -get_rating(value::DiscreteControlledACBranch) = get_value(value, Val(:rating), Val(:mva)) +"""Get [`DiscreteControlledACBranch`](@ref) `r` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_unitful`](@ref).""" +get_r(value::DiscreteControlledACBranch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r), Val(:ohm), units)) +"""Get [`DiscreteControlledACBranch`](@ref) `r` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r`](@ref).""" +get_r_unitful(value::DiscreteControlledACBranch, units) = get_value(value, Val(:r), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r), ::Type{ DiscreteControlledACBranch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_unitful), ::Type{ DiscreteControlledACBranch }) = InfrastructureSystems.SU +"""Get [`DiscreteControlledACBranch`](@ref) `x` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_unitful`](@ref).""" +get_x(value::DiscreteControlledACBranch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x), Val(:ohm), units)) +"""Get [`DiscreteControlledACBranch`](@ref) `x` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x`](@ref).""" +get_x_unitful(value::DiscreteControlledACBranch, units) = get_value(value, Val(:x), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x), ::Type{ DiscreteControlledACBranch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_unitful), ::Type{ DiscreteControlledACBranch }) = InfrastructureSystems.SU +"""Get [`DiscreteControlledACBranch`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::DiscreteControlledACBranch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`DiscreteControlledACBranch`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::DiscreteControlledACBranch, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ DiscreteControlledACBranch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ DiscreteControlledACBranch }) = InfrastructureSystems.SU """Get [`DiscreteControlledACBranch`](@ref) `discrete_branch_type`.""" get_discrete_branch_type(value::DiscreteControlledACBranch) = value.discrete_branch_type """Get [`DiscreteControlledACBranch`](@ref) `branch_status`.""" diff --git a/src/models/generated/DynamicExponentialLoad.jl b/src/models/generated/DynamicExponentialLoad.jl index 80e537a171..6920030ddf 100644 --- a/src/models/generated/DynamicExponentialLoad.jl +++ b/src/models/generated/DynamicExponentialLoad.jl @@ -105,8 +105,8 @@ get_T_p(value::DynamicExponentialLoad) = value.T_p get_T_q(value::DynamicExponentialLoad) = value.T_q """Get [`DynamicExponentialLoad`](@ref) `ext`.""" get_ext(value::DynamicExponentialLoad) = value.ext -"""Get [`DynamicExponentialLoad`](@ref) `base_power`.""" -get_base_power(value::DynamicExponentialLoad) = value.base_power + +_get_base_power(value::DynamicExponentialLoad) = value.base_power """Get [`DynamicExponentialLoad`](@ref) `states`.""" get_states(value::DynamicExponentialLoad) = value.states """Get [`DynamicExponentialLoad`](@ref) `n_states`.""" diff --git a/src/models/generated/EnergyReservoirStorage.jl b/src/models/generated/EnergyReservoirStorage.jl index 23c03c3026..217c64f923 100644 --- a/src/models/generated/EnergyReservoirStorage.jl +++ b/src/models/generated/EnergyReservoirStorage.jl @@ -160,28 +160,56 @@ get_bus(value::EnergyReservoirStorage) = value.bus get_prime_mover_type(value::EnergyReservoirStorage) = value.prime_mover_type """Get [`EnergyReservoirStorage`](@ref) `storage_technology_type`.""" get_storage_technology_type(value::EnergyReservoirStorage) = value.storage_technology_type -"""Get [`EnergyReservoirStorage`](@ref) `storage_capacity`.""" -get_storage_capacity(value::EnergyReservoirStorage) = get_value(value, Val(:storage_capacity), Val(:mva)) +"""Get [`EnergyReservoirStorage`](@ref) `storage_capacity` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_storage_capacity_unitful`](@ref).""" +get_storage_capacity(value::EnergyReservoirStorage, units) = InfrastructureSystems._strip_units(get_value(value, Val(:storage_capacity), Val(:mva), units)) +"""Get [`EnergyReservoirStorage`](@ref) `storage_capacity` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_storage_capacity`](@ref).""" +get_storage_capacity_unitful(value::EnergyReservoirStorage, units) = get_value(value, Val(:storage_capacity), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_storage_capacity), ::Type{ EnergyReservoirStorage }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_storage_capacity_unitful), ::Type{ EnergyReservoirStorage }) = InfrastructureSystems.SU """Get [`EnergyReservoirStorage`](@ref) `storage_level_limits`.""" get_storage_level_limits(value::EnergyReservoirStorage) = value.storage_level_limits """Get [`EnergyReservoirStorage`](@ref) `initial_storage_capacity_level`.""" get_initial_storage_capacity_level(value::EnergyReservoirStorage) = value.initial_storage_capacity_level -"""Get [`EnergyReservoirStorage`](@ref) `rating`.""" -get_rating(value::EnergyReservoirStorage) = get_value(value, Val(:rating), Val(:mva)) -"""Get [`EnergyReservoirStorage`](@ref) `active_power`.""" -get_active_power(value::EnergyReservoirStorage) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`EnergyReservoirStorage`](@ref) `input_active_power_limits`.""" -get_input_active_power_limits(value::EnergyReservoirStorage) = get_value(value, Val(:input_active_power_limits), Val(:mva)) -"""Get [`EnergyReservoirStorage`](@ref) `output_active_power_limits`.""" -get_output_active_power_limits(value::EnergyReservoirStorage) = get_value(value, Val(:output_active_power_limits), Val(:mva)) +"""Get [`EnergyReservoirStorage`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::EnergyReservoirStorage, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`EnergyReservoirStorage`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::EnergyReservoirStorage, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ EnergyReservoirStorage }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ EnergyReservoirStorage }) = InfrastructureSystems.SU +"""Get [`EnergyReservoirStorage`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::EnergyReservoirStorage, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`EnergyReservoirStorage`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::EnergyReservoirStorage, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ EnergyReservoirStorage }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ EnergyReservoirStorage }) = InfrastructureSystems.SU +"""Get [`EnergyReservoirStorage`](@ref) `input_active_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_input_active_power_limits_unitful`](@ref).""" +get_input_active_power_limits(value::EnergyReservoirStorage, units) = InfrastructureSystems._strip_units(get_value(value, Val(:input_active_power_limits), Val(:mva), units)) +"""Get [`EnergyReservoirStorage`](@ref) `input_active_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_input_active_power_limits`](@ref).""" +get_input_active_power_limits_unitful(value::EnergyReservoirStorage, units) = get_value(value, Val(:input_active_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_input_active_power_limits), ::Type{ EnergyReservoirStorage }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_input_active_power_limits_unitful), ::Type{ EnergyReservoirStorage }) = InfrastructureSystems.SU +"""Get [`EnergyReservoirStorage`](@ref) `output_active_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_output_active_power_limits_unitful`](@ref).""" +get_output_active_power_limits(value::EnergyReservoirStorage, units) = InfrastructureSystems._strip_units(get_value(value, Val(:output_active_power_limits), Val(:mva), units)) +"""Get [`EnergyReservoirStorage`](@ref) `output_active_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_output_active_power_limits`](@ref).""" +get_output_active_power_limits_unitful(value::EnergyReservoirStorage, units) = get_value(value, Val(:output_active_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_output_active_power_limits), ::Type{ EnergyReservoirStorage }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_output_active_power_limits_unitful), ::Type{ EnergyReservoirStorage }) = InfrastructureSystems.SU """Get [`EnergyReservoirStorage`](@ref) `efficiency`.""" get_efficiency(value::EnergyReservoirStorage) = value.efficiency -"""Get [`EnergyReservoirStorage`](@ref) `reactive_power`.""" -get_reactive_power(value::EnergyReservoirStorage) = get_value(value, Val(:reactive_power), Val(:mva)) -"""Get [`EnergyReservoirStorage`](@ref) `reactive_power_limits`.""" -get_reactive_power_limits(value::EnergyReservoirStorage) = get_value(value, Val(:reactive_power_limits), Val(:mva)) -"""Get [`EnergyReservoirStorage`](@ref) `base_power`.""" -get_base_power(value::EnergyReservoirStorage) = value.base_power +"""Get [`EnergyReservoirStorage`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::EnergyReservoirStorage, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`EnergyReservoirStorage`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::EnergyReservoirStorage, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ EnergyReservoirStorage }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ EnergyReservoirStorage }) = InfrastructureSystems.SU +"""Get [`EnergyReservoirStorage`](@ref) `reactive_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_unitful`](@ref).""" +get_reactive_power_limits(value::EnergyReservoirStorage, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits), Val(:mva), units)) +"""Get [`EnergyReservoirStorage`](@ref) `reactive_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits`](@ref).""" +get_reactive_power_limits_unitful(value::EnergyReservoirStorage, units) = get_value(value, Val(:reactive_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits), ::Type{ EnergyReservoirStorage }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_unitful), ::Type{ EnergyReservoirStorage }) = InfrastructureSystems.SU + +_get_base_power(value::EnergyReservoirStorage) = value.base_power """Get [`EnergyReservoirStorage`](@ref) `operation_cost`.""" get_operation_cost(value::EnergyReservoirStorage) = value.operation_cost """Get [`EnergyReservoirStorage`](@ref) `conversion_factor`.""" diff --git a/src/models/generated/ExponentialLoad.jl b/src/models/generated/ExponentialLoad.jl index e3b8cccc31..2249631b03 100644 --- a/src/models/generated/ExponentialLoad.jl +++ b/src/models/generated/ExponentialLoad.jl @@ -111,20 +111,36 @@ get_name(value::ExponentialLoad) = value.name get_available(value::ExponentialLoad) = value.available """Get [`ExponentialLoad`](@ref) `bus`.""" get_bus(value::ExponentialLoad) = value.bus -"""Get [`ExponentialLoad`](@ref) `active_power`.""" -get_active_power(value::ExponentialLoad) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`ExponentialLoad`](@ref) `reactive_power`.""" -get_reactive_power(value::ExponentialLoad) = get_value(value, Val(:reactive_power), Val(:mva)) +"""Get [`ExponentialLoad`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::ExponentialLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`ExponentialLoad`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::ExponentialLoad, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ ExponentialLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ ExponentialLoad }) = InfrastructureSystems.SU +"""Get [`ExponentialLoad`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::ExponentialLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`ExponentialLoad`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::ExponentialLoad, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ ExponentialLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ ExponentialLoad }) = InfrastructureSystems.SU """Get [`ExponentialLoad`](@ref) `α`.""" get_α(value::ExponentialLoad) = value.α """Get [`ExponentialLoad`](@ref) `β`.""" get_β(value::ExponentialLoad) = value.β -"""Get [`ExponentialLoad`](@ref) `base_power`.""" -get_base_power(value::ExponentialLoad) = value.base_power -"""Get [`ExponentialLoad`](@ref) `max_active_power`.""" -get_max_active_power(value::ExponentialLoad) = get_value(value, Val(:max_active_power), Val(:mva)) -"""Get [`ExponentialLoad`](@ref) `max_reactive_power`.""" -get_max_reactive_power(value::ExponentialLoad) = get_value(value, Val(:max_reactive_power), Val(:mva)) + +_get_base_power(value::ExponentialLoad) = value.base_power +"""Get [`ExponentialLoad`](@ref) `max_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_active_power_unitful`](@ref).""" +get_max_active_power(value::ExponentialLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_active_power), Val(:mva), units)) +"""Get [`ExponentialLoad`](@ref) `max_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_active_power`](@ref).""" +get_max_active_power_unitful(value::ExponentialLoad, units) = get_value(value, Val(:max_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_active_power), ::Type{ ExponentialLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_active_power_unitful), ::Type{ ExponentialLoad }) = InfrastructureSystems.SU +"""Get [`ExponentialLoad`](@ref) `max_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_reactive_power_unitful`](@ref).""" +get_max_reactive_power(value::ExponentialLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_reactive_power), Val(:mva), units)) +"""Get [`ExponentialLoad`](@ref) `max_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_reactive_power`](@ref).""" +get_max_reactive_power_unitful(value::ExponentialLoad, units) = get_value(value, Val(:max_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_reactive_power), ::Type{ ExponentialLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_reactive_power_unitful), ::Type{ ExponentialLoad }) = InfrastructureSystems.SU """Get [`ExponentialLoad`](@ref) `conformity`.""" get_conformity(value::ExponentialLoad) = value.conformity """Get [`ExponentialLoad`](@ref) `services`.""" diff --git a/src/models/generated/GenericArcImpedance.jl b/src/models/generated/GenericArcImpedance.jl index fd34da8680..c483c6462b 100644 --- a/src/models/generated/GenericArcImpedance.jl +++ b/src/models/generated/GenericArcImpedance.jl @@ -82,18 +82,38 @@ end get_name(value::GenericArcImpedance) = value.name """Get [`GenericArcImpedance`](@ref) `available`.""" get_available(value::GenericArcImpedance) = value.available -"""Get [`GenericArcImpedance`](@ref) `active_power_flow`.""" -get_active_power_flow(value::GenericArcImpedance) = get_value(value, Val(:active_power_flow), Val(:mva)) -"""Get [`GenericArcImpedance`](@ref) `reactive_power_flow`.""" -get_reactive_power_flow(value::GenericArcImpedance) = get_value(value, Val(:reactive_power_flow), Val(:mva)) -"""Get [`GenericArcImpedance`](@ref) `max_flow`.""" -get_max_flow(value::GenericArcImpedance) = get_value(value, Val(:max_flow), Val(:mva)) +"""Get [`GenericArcImpedance`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_unitful`](@ref).""" +get_active_power_flow(value::GenericArcImpedance, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow), Val(:mva), units)) +"""Get [`GenericArcImpedance`](@ref) `active_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow`](@ref).""" +get_active_power_flow_unitful(value::GenericArcImpedance, units) = get_value(value, Val(:active_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow), ::Type{ GenericArcImpedance }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_unitful), ::Type{ GenericArcImpedance }) = InfrastructureSystems.SU +"""Get [`GenericArcImpedance`](@ref) `reactive_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_flow_unitful`](@ref).""" +get_reactive_power_flow(value::GenericArcImpedance, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_flow), Val(:mva), units)) +"""Get [`GenericArcImpedance`](@ref) `reactive_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_flow`](@ref).""" +get_reactive_power_flow_unitful(value::GenericArcImpedance, units) = get_value(value, Val(:reactive_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow), ::Type{ GenericArcImpedance }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_unitful), ::Type{ GenericArcImpedance }) = InfrastructureSystems.SU +"""Get [`GenericArcImpedance`](@ref) `max_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_flow_unitful`](@ref).""" +get_max_flow(value::GenericArcImpedance, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_flow), Val(:mva), units)) +"""Get [`GenericArcImpedance`](@ref) `max_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_flow`](@ref).""" +get_max_flow_unitful(value::GenericArcImpedance, units) = get_value(value, Val(:max_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_flow), ::Type{ GenericArcImpedance }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_flow_unitful), ::Type{ GenericArcImpedance }) = InfrastructureSystems.SU """Get [`GenericArcImpedance`](@ref) `arc`.""" get_arc(value::GenericArcImpedance) = value.arc -"""Get [`GenericArcImpedance`](@ref) `r`.""" -get_r(value::GenericArcImpedance) = get_value(value, Val(:r), Val(:ohm)) -"""Get [`GenericArcImpedance`](@ref) `x`.""" -get_x(value::GenericArcImpedance) = get_value(value, Val(:x), Val(:ohm)) +"""Get [`GenericArcImpedance`](@ref) `r` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_unitful`](@ref).""" +get_r(value::GenericArcImpedance, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r), Val(:ohm), units)) +"""Get [`GenericArcImpedance`](@ref) `r` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r`](@ref).""" +get_r_unitful(value::GenericArcImpedance, units) = get_value(value, Val(:r), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r), ::Type{ GenericArcImpedance }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_unitful), ::Type{ GenericArcImpedance }) = InfrastructureSystems.SU +"""Get [`GenericArcImpedance`](@ref) `x` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_unitful`](@ref).""" +get_x(value::GenericArcImpedance, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x), Val(:ohm), units)) +"""Get [`GenericArcImpedance`](@ref) `x` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x`](@ref).""" +get_x_unitful(value::GenericArcImpedance, units) = get_value(value, Val(:x), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x), ::Type{ GenericArcImpedance }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_unitful), ::Type{ GenericArcImpedance }) = InfrastructureSystems.SU """Get [`GenericArcImpedance`](@ref) `ext`.""" get_ext(value::GenericArcImpedance) = value.ext """Get [`GenericArcImpedance`](@ref) `internal`.""" diff --git a/src/models/generated/GenericDER.jl b/src/models/generated/GenericDER.jl index b8bfb2543a..30ce2da6d8 100644 --- a/src/models/generated/GenericDER.jl +++ b/src/models/generated/GenericDER.jl @@ -338,8 +338,8 @@ get_Pfa_ref(value::GenericDER) = value.Pfa_ref get_Q_ref(value::GenericDER) = value.Q_ref """Get [`GenericDER`](@ref) `P_ref`.""" get_P_ref(value::GenericDER) = value.P_ref -"""Get [`GenericDER`](@ref) `base_power`.""" -get_base_power(value::GenericDER) = value.base_power + +_get_base_power(value::GenericDER) = value.base_power """Get [`GenericDER`](@ref) `states`.""" get_states(value::GenericDER) = value.states """Get [`GenericDER`](@ref) `n_states`.""" diff --git a/src/models/generated/HydroDispatch.jl b/src/models/generated/HydroDispatch.jl index 0bcc153e9b..63505d0f9b 100644 --- a/src/models/generated/HydroDispatch.jl +++ b/src/models/generated/HydroDispatch.jl @@ -131,24 +131,48 @@ get_name(value::HydroDispatch) = value.name get_available(value::HydroDispatch) = value.available """Get [`HydroDispatch`](@ref) `bus`.""" get_bus(value::HydroDispatch) = value.bus -"""Get [`HydroDispatch`](@ref) `active_power`.""" -get_active_power(value::HydroDispatch) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`HydroDispatch`](@ref) `reactive_power`.""" -get_reactive_power(value::HydroDispatch) = get_value(value, Val(:reactive_power), Val(:mva)) -"""Get [`HydroDispatch`](@ref) `rating`.""" -get_rating(value::HydroDispatch) = get_value(value, Val(:rating), Val(:mva)) +"""Get [`HydroDispatch`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::HydroDispatch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`HydroDispatch`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::HydroDispatch, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ HydroDispatch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ HydroDispatch }) = InfrastructureSystems.SU +"""Get [`HydroDispatch`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::HydroDispatch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`HydroDispatch`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::HydroDispatch, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ HydroDispatch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ HydroDispatch }) = InfrastructureSystems.SU +"""Get [`HydroDispatch`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::HydroDispatch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`HydroDispatch`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::HydroDispatch, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ HydroDispatch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ HydroDispatch }) = InfrastructureSystems.SU """Get [`HydroDispatch`](@ref) `prime_mover_type`.""" get_prime_mover_type(value::HydroDispatch) = value.prime_mover_type -"""Get [`HydroDispatch`](@ref) `active_power_limits`.""" -get_active_power_limits(value::HydroDispatch) = get_value(value, Val(:active_power_limits), Val(:mva)) -"""Get [`HydroDispatch`](@ref) `reactive_power_limits`.""" -get_reactive_power_limits(value::HydroDispatch) = get_value(value, Val(:reactive_power_limits), Val(:mva)) -"""Get [`HydroDispatch`](@ref) `ramp_limits`.""" -get_ramp_limits(value::HydroDispatch) = get_value(value, Val(:ramp_limits), Val(:mva)) +"""Get [`HydroDispatch`](@ref) `active_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_unitful`](@ref).""" +get_active_power_limits(value::HydroDispatch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits), Val(:mva), units)) +"""Get [`HydroDispatch`](@ref) `active_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits`](@ref).""" +get_active_power_limits_unitful(value::HydroDispatch, units) = get_value(value, Val(:active_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits), ::Type{ HydroDispatch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_unitful), ::Type{ HydroDispatch }) = InfrastructureSystems.SU +"""Get [`HydroDispatch`](@ref) `reactive_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_unitful`](@ref).""" +get_reactive_power_limits(value::HydroDispatch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits), Val(:mva), units)) +"""Get [`HydroDispatch`](@ref) `reactive_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits`](@ref).""" +get_reactive_power_limits_unitful(value::HydroDispatch, units) = get_value(value, Val(:reactive_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits), ::Type{ HydroDispatch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_unitful), ::Type{ HydroDispatch }) = InfrastructureSystems.SU +"""Get [`HydroDispatch`](@ref) `ramp_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_ramp_limits_unitful`](@ref).""" +get_ramp_limits(value::HydroDispatch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:ramp_limits), Val(:mva), units)) +"""Get [`HydroDispatch`](@ref) `ramp_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_ramp_limits`](@ref).""" +get_ramp_limits_unitful(value::HydroDispatch, units) = get_value(value, Val(:ramp_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_ramp_limits), ::Type{ HydroDispatch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_ramp_limits_unitful), ::Type{ HydroDispatch }) = InfrastructureSystems.SU """Get [`HydroDispatch`](@ref) `time_limits`.""" get_time_limits(value::HydroDispatch) = value.time_limits -"""Get [`HydroDispatch`](@ref) `base_power`.""" -get_base_power(value::HydroDispatch) = value.base_power + +_get_base_power(value::HydroDispatch) = value.base_power """Get [`HydroDispatch`](@ref) `status`.""" get_status(value::HydroDispatch) = value.status """Get [`HydroDispatch`](@ref) `time_at_status`.""" diff --git a/src/models/generated/HydroPumpTurbine.jl b/src/models/generated/HydroPumpTurbine.jl index 3a6a68acfd..1391c39ed0 100644 --- a/src/models/generated/HydroPumpTurbine.jl +++ b/src/models/generated/HydroPumpTurbine.jl @@ -179,36 +179,68 @@ get_name(value::HydroPumpTurbine) = value.name get_available(value::HydroPumpTurbine) = value.available """Get [`HydroPumpTurbine`](@ref) `bus`.""" get_bus(value::HydroPumpTurbine) = value.bus -"""Get [`HydroPumpTurbine`](@ref) `active_power`.""" -get_active_power(value::HydroPumpTurbine) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`HydroPumpTurbine`](@ref) `reactive_power`.""" -get_reactive_power(value::HydroPumpTurbine) = get_value(value, Val(:reactive_power), Val(:mva)) -"""Get [`HydroPumpTurbine`](@ref) `rating`.""" -get_rating(value::HydroPumpTurbine) = get_value(value, Val(:rating), Val(:mva)) -"""Get [`HydroPumpTurbine`](@ref) `active_power_limits`.""" -get_active_power_limits(value::HydroPumpTurbine) = get_value(value, Val(:active_power_limits), Val(:mva)) -"""Get [`HydroPumpTurbine`](@ref) `reactive_power_limits`.""" -get_reactive_power_limits(value::HydroPumpTurbine) = get_value(value, Val(:reactive_power_limits), Val(:mva)) -"""Get [`HydroPumpTurbine`](@ref) `active_power_limits_pump`.""" -get_active_power_limits_pump(value::HydroPumpTurbine) = get_value(value, Val(:active_power_limits_pump), Val(:mva)) +"""Get [`HydroPumpTurbine`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::HydroPumpTurbine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`HydroPumpTurbine`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::HydroPumpTurbine, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU +"""Get [`HydroPumpTurbine`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::HydroPumpTurbine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`HydroPumpTurbine`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::HydroPumpTurbine, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU +"""Get [`HydroPumpTurbine`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::HydroPumpTurbine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`HydroPumpTurbine`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::HydroPumpTurbine, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU +"""Get [`HydroPumpTurbine`](@ref) `active_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_unitful`](@ref).""" +get_active_power_limits(value::HydroPumpTurbine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits), Val(:mva), units)) +"""Get [`HydroPumpTurbine`](@ref) `active_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits`](@ref).""" +get_active_power_limits_unitful(value::HydroPumpTurbine, units) = get_value(value, Val(:active_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_unitful), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU +"""Get [`HydroPumpTurbine`](@ref) `reactive_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_unitful`](@ref).""" +get_reactive_power_limits(value::HydroPumpTurbine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits), Val(:mva), units)) +"""Get [`HydroPumpTurbine`](@ref) `reactive_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits`](@ref).""" +get_reactive_power_limits_unitful(value::HydroPumpTurbine, units) = get_value(value, Val(:reactive_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_unitful), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU +"""Get [`HydroPumpTurbine`](@ref) `active_power_limits_pump` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_pump_unitful`](@ref).""" +get_active_power_limits_pump(value::HydroPumpTurbine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits_pump), Val(:mva), units)) +"""Get [`HydroPumpTurbine`](@ref) `active_power_limits_pump` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits_pump`](@ref).""" +get_active_power_limits_pump_unitful(value::HydroPumpTurbine, units) = get_value(value, Val(:active_power_limits_pump), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_pump), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_pump_unitful), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU """Get [`HydroPumpTurbine`](@ref) `outflow_limits`.""" get_outflow_limits(value::HydroPumpTurbine) = value.outflow_limits """Get [`HydroPumpTurbine`](@ref) `powerhouse_elevation`.""" get_powerhouse_elevation(value::HydroPumpTurbine) = value.powerhouse_elevation -"""Get [`HydroPumpTurbine`](@ref) `ramp_limits`.""" -get_ramp_limits(value::HydroPumpTurbine) = get_value(value, Val(:ramp_limits), Val(:mva)) +"""Get [`HydroPumpTurbine`](@ref) `ramp_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_ramp_limits_unitful`](@ref).""" +get_ramp_limits(value::HydroPumpTurbine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:ramp_limits), Val(:mva), units)) +"""Get [`HydroPumpTurbine`](@ref) `ramp_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_ramp_limits`](@ref).""" +get_ramp_limits_unitful(value::HydroPumpTurbine, units) = get_value(value, Val(:ramp_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_ramp_limits), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_ramp_limits_unitful), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU """Get [`HydroPumpTurbine`](@ref) `time_limits`.""" get_time_limits(value::HydroPumpTurbine) = value.time_limits -"""Get [`HydroPumpTurbine`](@ref) `base_power`.""" -get_base_power(value::HydroPumpTurbine) = value.base_power + +_get_base_power(value::HydroPumpTurbine) = value.base_power """Get [`HydroPumpTurbine`](@ref) `status`.""" get_status(value::HydroPumpTurbine) = value.status """Get [`HydroPumpTurbine`](@ref) `time_at_status`.""" get_time_at_status(value::HydroPumpTurbine) = value.time_at_status """Get [`HydroPumpTurbine`](@ref) `operation_cost`.""" get_operation_cost(value::HydroPumpTurbine) = value.operation_cost -"""Get [`HydroPumpTurbine`](@ref) `active_power_pump`.""" -get_active_power_pump(value::HydroPumpTurbine) = get_value(value, Val(:active_power_pump), Val(:mva)) +"""Get [`HydroPumpTurbine`](@ref) `active_power_pump` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_pump_unitful`](@ref).""" +get_active_power_pump(value::HydroPumpTurbine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_pump), Val(:mva), units)) +"""Get [`HydroPumpTurbine`](@ref) `active_power_pump` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_pump`](@ref).""" +get_active_power_pump_unitful(value::HydroPumpTurbine, units) = get_value(value, Val(:active_power_pump), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_pump), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_pump_unitful), ::Type{ HydroPumpTurbine }) = InfrastructureSystems.SU """Get [`HydroPumpTurbine`](@ref) `efficiency`.""" get_efficiency(value::HydroPumpTurbine) = value.efficiency """Get [`HydroPumpTurbine`](@ref) `transition_time`.""" diff --git a/src/models/generated/HydroTurbine.jl b/src/models/generated/HydroTurbine.jl index d4ac421a5c..83bcf3f653 100644 --- a/src/models/generated/HydroTurbine.jl +++ b/src/models/generated/HydroTurbine.jl @@ -149,24 +149,48 @@ get_name(value::HydroTurbine) = value.name get_available(value::HydroTurbine) = value.available """Get [`HydroTurbine`](@ref) `bus`.""" get_bus(value::HydroTurbine) = value.bus -"""Get [`HydroTurbine`](@ref) `active_power`.""" -get_active_power(value::HydroTurbine) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`HydroTurbine`](@ref) `reactive_power`.""" -get_reactive_power(value::HydroTurbine) = get_value(value, Val(:reactive_power), Val(:mva)) -"""Get [`HydroTurbine`](@ref) `rating`.""" -get_rating(value::HydroTurbine) = get_value(value, Val(:rating), Val(:mva)) -"""Get [`HydroTurbine`](@ref) `active_power_limits`.""" -get_active_power_limits(value::HydroTurbine) = get_value(value, Val(:active_power_limits), Val(:mva)) -"""Get [`HydroTurbine`](@ref) `reactive_power_limits`.""" -get_reactive_power_limits(value::HydroTurbine) = get_value(value, Val(:reactive_power_limits), Val(:mva)) -"""Get [`HydroTurbine`](@ref) `base_power`.""" -get_base_power(value::HydroTurbine) = value.base_power +"""Get [`HydroTurbine`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::HydroTurbine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`HydroTurbine`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::HydroTurbine, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ HydroTurbine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ HydroTurbine }) = InfrastructureSystems.SU +"""Get [`HydroTurbine`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::HydroTurbine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`HydroTurbine`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::HydroTurbine, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ HydroTurbine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ HydroTurbine }) = InfrastructureSystems.SU +"""Get [`HydroTurbine`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::HydroTurbine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`HydroTurbine`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::HydroTurbine, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ HydroTurbine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ HydroTurbine }) = InfrastructureSystems.SU +"""Get [`HydroTurbine`](@ref) `active_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_unitful`](@ref).""" +get_active_power_limits(value::HydroTurbine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits), Val(:mva), units)) +"""Get [`HydroTurbine`](@ref) `active_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits`](@ref).""" +get_active_power_limits_unitful(value::HydroTurbine, units) = get_value(value, Val(:active_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits), ::Type{ HydroTurbine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_unitful), ::Type{ HydroTurbine }) = InfrastructureSystems.SU +"""Get [`HydroTurbine`](@ref) `reactive_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_unitful`](@ref).""" +get_reactive_power_limits(value::HydroTurbine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits), Val(:mva), units)) +"""Get [`HydroTurbine`](@ref) `reactive_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits`](@ref).""" +get_reactive_power_limits_unitful(value::HydroTurbine, units) = get_value(value, Val(:reactive_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits), ::Type{ HydroTurbine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_unitful), ::Type{ HydroTurbine }) = InfrastructureSystems.SU + +_get_base_power(value::HydroTurbine) = value.base_power """Get [`HydroTurbine`](@ref) `operation_cost`.""" get_operation_cost(value::HydroTurbine) = value.operation_cost """Get [`HydroTurbine`](@ref) `powerhouse_elevation`.""" get_powerhouse_elevation(value::HydroTurbine) = value.powerhouse_elevation -"""Get [`HydroTurbine`](@ref) `ramp_limits`.""" -get_ramp_limits(value::HydroTurbine) = get_value(value, Val(:ramp_limits), Val(:mva)) +"""Get [`HydroTurbine`](@ref) `ramp_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_ramp_limits_unitful`](@ref).""" +get_ramp_limits(value::HydroTurbine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:ramp_limits), Val(:mva), units)) +"""Get [`HydroTurbine`](@ref) `ramp_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_ramp_limits`](@ref).""" +get_ramp_limits_unitful(value::HydroTurbine, units) = get_value(value, Val(:ramp_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_ramp_limits), ::Type{ HydroTurbine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_ramp_limits_unitful), ::Type{ HydroTurbine }) = InfrastructureSystems.SU """Get [`HydroTurbine`](@ref) `time_limits`.""" get_time_limits(value::HydroTurbine) = value.time_limits """Get [`HydroTurbine`](@ref) `outflow_limits`.""" diff --git a/src/models/generated/InterconnectingConverter.jl b/src/models/generated/InterconnectingConverter.jl index 7ac0c3ed04..4c91a2c789 100644 --- a/src/models/generated/InterconnectingConverter.jl +++ b/src/models/generated/InterconnectingConverter.jl @@ -93,7 +93,7 @@ function InterconnectingConverter(::Nothing) active_power=0.0, rating=0.0, active_power_limits=(min=0.0, max=0.0), - base_power=100, + base_power=100.0, dc_current=0.0, max_dc_current=0.0, loss_function=LinearCurve(0.0), @@ -111,14 +111,26 @@ get_available(value::InterconnectingConverter) = value.available get_bus(value::InterconnectingConverter) = value.bus """Get [`InterconnectingConverter`](@ref) `dc_bus`.""" get_dc_bus(value::InterconnectingConverter) = value.dc_bus -"""Get [`InterconnectingConverter`](@ref) `active_power`.""" -get_active_power(value::InterconnectingConverter) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`InterconnectingConverter`](@ref) `rating`.""" -get_rating(value::InterconnectingConverter) = get_value(value, Val(:rating), Val(:mva)) -"""Get [`InterconnectingConverter`](@ref) `active_power_limits`.""" -get_active_power_limits(value::InterconnectingConverter) = get_value(value, Val(:active_power_limits), Val(:mva)) -"""Get [`InterconnectingConverter`](@ref) `base_power`.""" -get_base_power(value::InterconnectingConverter) = value.base_power +"""Get [`InterconnectingConverter`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::InterconnectingConverter, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`InterconnectingConverter`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::InterconnectingConverter, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ InterconnectingConverter }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ InterconnectingConverter }) = InfrastructureSystems.SU +"""Get [`InterconnectingConverter`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::InterconnectingConverter, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`InterconnectingConverter`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::InterconnectingConverter, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ InterconnectingConverter }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ InterconnectingConverter }) = InfrastructureSystems.SU +"""Get [`InterconnectingConverter`](@ref) `active_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_unitful`](@ref).""" +get_active_power_limits(value::InterconnectingConverter, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits), Val(:mva), units)) +"""Get [`InterconnectingConverter`](@ref) `active_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits`](@ref).""" +get_active_power_limits_unitful(value::InterconnectingConverter, units) = get_value(value, Val(:active_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits), ::Type{ InterconnectingConverter }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_unitful), ::Type{ InterconnectingConverter }) = InfrastructureSystems.SU + +_get_base_power(value::InterconnectingConverter) = value.base_power """Get [`InterconnectingConverter`](@ref) `dc_current`.""" get_dc_current(value::InterconnectingConverter) = value.dc_current """Get [`InterconnectingConverter`](@ref) `max_dc_current`.""" diff --git a/src/models/generated/InterruptiblePowerLoad.jl b/src/models/generated/InterruptiblePowerLoad.jl index b7c0213eb0..193ff03ff2 100644 --- a/src/models/generated/InterruptiblePowerLoad.jl +++ b/src/models/generated/InterruptiblePowerLoad.jl @@ -106,16 +106,32 @@ get_name(value::InterruptiblePowerLoad) = value.name get_available(value::InterruptiblePowerLoad) = value.available """Get [`InterruptiblePowerLoad`](@ref) `bus`.""" get_bus(value::InterruptiblePowerLoad) = value.bus -"""Get [`InterruptiblePowerLoad`](@ref) `active_power`.""" -get_active_power(value::InterruptiblePowerLoad) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`InterruptiblePowerLoad`](@ref) `reactive_power`.""" -get_reactive_power(value::InterruptiblePowerLoad) = get_value(value, Val(:reactive_power), Val(:mva)) -"""Get [`InterruptiblePowerLoad`](@ref) `max_active_power`.""" -get_max_active_power(value::InterruptiblePowerLoad) = get_value(value, Val(:max_active_power), Val(:mva)) -"""Get [`InterruptiblePowerLoad`](@ref) `max_reactive_power`.""" -get_max_reactive_power(value::InterruptiblePowerLoad) = get_value(value, Val(:max_reactive_power), Val(:mva)) -"""Get [`InterruptiblePowerLoad`](@ref) `base_power`.""" -get_base_power(value::InterruptiblePowerLoad) = value.base_power +"""Get [`InterruptiblePowerLoad`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::InterruptiblePowerLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`InterruptiblePowerLoad`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::InterruptiblePowerLoad, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ InterruptiblePowerLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ InterruptiblePowerLoad }) = InfrastructureSystems.SU +"""Get [`InterruptiblePowerLoad`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::InterruptiblePowerLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`InterruptiblePowerLoad`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::InterruptiblePowerLoad, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ InterruptiblePowerLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ InterruptiblePowerLoad }) = InfrastructureSystems.SU +"""Get [`InterruptiblePowerLoad`](@ref) `max_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_active_power_unitful`](@ref).""" +get_max_active_power(value::InterruptiblePowerLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_active_power), Val(:mva), units)) +"""Get [`InterruptiblePowerLoad`](@ref) `max_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_active_power`](@ref).""" +get_max_active_power_unitful(value::InterruptiblePowerLoad, units) = get_value(value, Val(:max_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_active_power), ::Type{ InterruptiblePowerLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_active_power_unitful), ::Type{ InterruptiblePowerLoad }) = InfrastructureSystems.SU +"""Get [`InterruptiblePowerLoad`](@ref) `max_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_reactive_power_unitful`](@ref).""" +get_max_reactive_power(value::InterruptiblePowerLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_reactive_power), Val(:mva), units)) +"""Get [`InterruptiblePowerLoad`](@ref) `max_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_reactive_power`](@ref).""" +get_max_reactive_power_unitful(value::InterruptiblePowerLoad, units) = get_value(value, Val(:max_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_reactive_power), ::Type{ InterruptiblePowerLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_reactive_power_unitful), ::Type{ InterruptiblePowerLoad }) = InfrastructureSystems.SU + +_get_base_power(value::InterruptiblePowerLoad) = value.base_power """Get [`InterruptiblePowerLoad`](@ref) `operation_cost`.""" get_operation_cost(value::InterruptiblePowerLoad) = value.operation_cost """Get [`InterruptiblePowerLoad`](@ref) `conformity`.""" diff --git a/src/models/generated/InterruptibleStandardLoad.jl b/src/models/generated/InterruptibleStandardLoad.jl index b64ab9f46b..c299dc7b7c 100644 --- a/src/models/generated/InterruptibleStandardLoad.jl +++ b/src/models/generated/InterruptibleStandardLoad.jl @@ -148,36 +148,84 @@ get_name(value::InterruptibleStandardLoad) = value.name get_available(value::InterruptibleStandardLoad) = value.available """Get [`InterruptibleStandardLoad`](@ref) `bus`.""" get_bus(value::InterruptibleStandardLoad) = value.bus -"""Get [`InterruptibleStandardLoad`](@ref) `base_power`.""" -get_base_power(value::InterruptibleStandardLoad) = value.base_power + +_get_base_power(value::InterruptibleStandardLoad) = value.base_power """Get [`InterruptibleStandardLoad`](@ref) `operation_cost`.""" get_operation_cost(value::InterruptibleStandardLoad) = value.operation_cost """Get [`InterruptibleStandardLoad`](@ref) `conformity`.""" get_conformity(value::InterruptibleStandardLoad) = value.conformity -"""Get [`InterruptibleStandardLoad`](@ref) `constant_active_power`.""" -get_constant_active_power(value::InterruptibleStandardLoad) = get_value(value, Val(:constant_active_power), Val(:mva)) -"""Get [`InterruptibleStandardLoad`](@ref) `constant_reactive_power`.""" -get_constant_reactive_power(value::InterruptibleStandardLoad) = get_value(value, Val(:constant_reactive_power), Val(:mva)) -"""Get [`InterruptibleStandardLoad`](@ref) `impedance_active_power`.""" -get_impedance_active_power(value::InterruptibleStandardLoad) = get_value(value, Val(:impedance_active_power), Val(:mva)) -"""Get [`InterruptibleStandardLoad`](@ref) `impedance_reactive_power`.""" -get_impedance_reactive_power(value::InterruptibleStandardLoad) = get_value(value, Val(:impedance_reactive_power), Val(:mva)) -"""Get [`InterruptibleStandardLoad`](@ref) `current_active_power`.""" -get_current_active_power(value::InterruptibleStandardLoad) = get_value(value, Val(:current_active_power), Val(:mva)) -"""Get [`InterruptibleStandardLoad`](@ref) `current_reactive_power`.""" -get_current_reactive_power(value::InterruptibleStandardLoad) = get_value(value, Val(:current_reactive_power), Val(:mva)) -"""Get [`InterruptibleStandardLoad`](@ref) `max_constant_active_power`.""" -get_max_constant_active_power(value::InterruptibleStandardLoad) = get_value(value, Val(:max_constant_active_power), Val(:mva)) -"""Get [`InterruptibleStandardLoad`](@ref) `max_constant_reactive_power`.""" -get_max_constant_reactive_power(value::InterruptibleStandardLoad) = get_value(value, Val(:max_constant_reactive_power), Val(:mva)) -"""Get [`InterruptibleStandardLoad`](@ref) `max_impedance_active_power`.""" -get_max_impedance_active_power(value::InterruptibleStandardLoad) = get_value(value, Val(:max_impedance_active_power), Val(:mva)) -"""Get [`InterruptibleStandardLoad`](@ref) `max_impedance_reactive_power`.""" -get_max_impedance_reactive_power(value::InterruptibleStandardLoad) = get_value(value, Val(:max_impedance_reactive_power), Val(:mva)) -"""Get [`InterruptibleStandardLoad`](@ref) `max_current_active_power`.""" -get_max_current_active_power(value::InterruptibleStandardLoad) = get_value(value, Val(:max_current_active_power), Val(:mva)) -"""Get [`InterruptibleStandardLoad`](@ref) `max_current_reactive_power`.""" -get_max_current_reactive_power(value::InterruptibleStandardLoad) = get_value(value, Val(:max_current_reactive_power), Val(:mva)) +"""Get [`InterruptibleStandardLoad`](@ref) `constant_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_constant_active_power_unitful`](@ref).""" +get_constant_active_power(value::InterruptibleStandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:constant_active_power), Val(:mva), units)) +"""Get [`InterruptibleStandardLoad`](@ref) `constant_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_constant_active_power`](@ref).""" +get_constant_active_power_unitful(value::InterruptibleStandardLoad, units) = get_value(value, Val(:constant_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_constant_active_power), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_constant_active_power_unitful), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +"""Get [`InterruptibleStandardLoad`](@ref) `constant_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_constant_reactive_power_unitful`](@ref).""" +get_constant_reactive_power(value::InterruptibleStandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:constant_reactive_power), Val(:mva), units)) +"""Get [`InterruptibleStandardLoad`](@ref) `constant_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_constant_reactive_power`](@ref).""" +get_constant_reactive_power_unitful(value::InterruptibleStandardLoad, units) = get_value(value, Val(:constant_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_constant_reactive_power), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_constant_reactive_power_unitful), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +"""Get [`InterruptibleStandardLoad`](@ref) `impedance_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_impedance_active_power_unitful`](@ref).""" +get_impedance_active_power(value::InterruptibleStandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:impedance_active_power), Val(:mva), units)) +"""Get [`InterruptibleStandardLoad`](@ref) `impedance_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_impedance_active_power`](@ref).""" +get_impedance_active_power_unitful(value::InterruptibleStandardLoad, units) = get_value(value, Val(:impedance_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_impedance_active_power), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_impedance_active_power_unitful), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +"""Get [`InterruptibleStandardLoad`](@ref) `impedance_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_impedance_reactive_power_unitful`](@ref).""" +get_impedance_reactive_power(value::InterruptibleStandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:impedance_reactive_power), Val(:mva), units)) +"""Get [`InterruptibleStandardLoad`](@ref) `impedance_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_impedance_reactive_power`](@ref).""" +get_impedance_reactive_power_unitful(value::InterruptibleStandardLoad, units) = get_value(value, Val(:impedance_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_impedance_reactive_power), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_impedance_reactive_power_unitful), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +"""Get [`InterruptibleStandardLoad`](@ref) `current_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_current_active_power_unitful`](@ref).""" +get_current_active_power(value::InterruptibleStandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:current_active_power), Val(:mva), units)) +"""Get [`InterruptibleStandardLoad`](@ref) `current_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_current_active_power`](@ref).""" +get_current_active_power_unitful(value::InterruptibleStandardLoad, units) = get_value(value, Val(:current_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_current_active_power), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_current_active_power_unitful), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +"""Get [`InterruptibleStandardLoad`](@ref) `current_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_current_reactive_power_unitful`](@ref).""" +get_current_reactive_power(value::InterruptibleStandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:current_reactive_power), Val(:mva), units)) +"""Get [`InterruptibleStandardLoad`](@ref) `current_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_current_reactive_power`](@ref).""" +get_current_reactive_power_unitful(value::InterruptibleStandardLoad, units) = get_value(value, Val(:current_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_current_reactive_power), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_current_reactive_power_unitful), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +"""Get [`InterruptibleStandardLoad`](@ref) `max_constant_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_constant_active_power_unitful`](@ref).""" +get_max_constant_active_power(value::InterruptibleStandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_constant_active_power), Val(:mva), units)) +"""Get [`InterruptibleStandardLoad`](@ref) `max_constant_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_constant_active_power`](@ref).""" +get_max_constant_active_power_unitful(value::InterruptibleStandardLoad, units) = get_value(value, Val(:max_constant_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_constant_active_power), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_constant_active_power_unitful), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +"""Get [`InterruptibleStandardLoad`](@ref) `max_constant_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_constant_reactive_power_unitful`](@ref).""" +get_max_constant_reactive_power(value::InterruptibleStandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_constant_reactive_power), Val(:mva), units)) +"""Get [`InterruptibleStandardLoad`](@ref) `max_constant_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_constant_reactive_power`](@ref).""" +get_max_constant_reactive_power_unitful(value::InterruptibleStandardLoad, units) = get_value(value, Val(:max_constant_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_constant_reactive_power), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_constant_reactive_power_unitful), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +"""Get [`InterruptibleStandardLoad`](@ref) `max_impedance_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_impedance_active_power_unitful`](@ref).""" +get_max_impedance_active_power(value::InterruptibleStandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_impedance_active_power), Val(:mva), units)) +"""Get [`InterruptibleStandardLoad`](@ref) `max_impedance_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_impedance_active_power`](@ref).""" +get_max_impedance_active_power_unitful(value::InterruptibleStandardLoad, units) = get_value(value, Val(:max_impedance_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_impedance_active_power), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_impedance_active_power_unitful), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +"""Get [`InterruptibleStandardLoad`](@ref) `max_impedance_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_impedance_reactive_power_unitful`](@ref).""" +get_max_impedance_reactive_power(value::InterruptibleStandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_impedance_reactive_power), Val(:mva), units)) +"""Get [`InterruptibleStandardLoad`](@ref) `max_impedance_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_impedance_reactive_power`](@ref).""" +get_max_impedance_reactive_power_unitful(value::InterruptibleStandardLoad, units) = get_value(value, Val(:max_impedance_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_impedance_reactive_power), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_impedance_reactive_power_unitful), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +"""Get [`InterruptibleStandardLoad`](@ref) `max_current_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_current_active_power_unitful`](@ref).""" +get_max_current_active_power(value::InterruptibleStandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_current_active_power), Val(:mva), units)) +"""Get [`InterruptibleStandardLoad`](@ref) `max_current_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_current_active_power`](@ref).""" +get_max_current_active_power_unitful(value::InterruptibleStandardLoad, units) = get_value(value, Val(:max_current_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_current_active_power), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_current_active_power_unitful), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +"""Get [`InterruptibleStandardLoad`](@ref) `max_current_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_current_reactive_power_unitful`](@ref).""" +get_max_current_reactive_power(value::InterruptibleStandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_current_reactive_power), Val(:mva), units)) +"""Get [`InterruptibleStandardLoad`](@ref) `max_current_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_current_reactive_power`](@ref).""" +get_max_current_reactive_power_unitful(value::InterruptibleStandardLoad, units) = get_value(value, Val(:max_current_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_current_reactive_power), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_current_reactive_power_unitful), ::Type{ InterruptibleStandardLoad }) = InfrastructureSystems.SU """Get [`InterruptibleStandardLoad`](@ref) `services`.""" get_services(value::InterruptibleStandardLoad) = value.services """Get [`InterruptibleStandardLoad`](@ref) `dynamic_injector`.""" diff --git a/src/models/generated/Line.jl b/src/models/generated/Line.jl index f519006452..1b2ce79d83 100644 --- a/src/models/generated/Line.jl +++ b/src/models/generated/Line.jl @@ -112,28 +112,64 @@ end get_name(value::Line) = value.name """Get [`Line`](@ref) `available`.""" get_available(value::Line) = value.available -"""Get [`Line`](@ref) `active_power_flow`.""" -get_active_power_flow(value::Line) = get_value(value, Val(:active_power_flow), Val(:mva)) -"""Get [`Line`](@ref) `reactive_power_flow`.""" -get_reactive_power_flow(value::Line) = get_value(value, Val(:reactive_power_flow), Val(:mva)) +"""Get [`Line`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_unitful`](@ref).""" +get_active_power_flow(value::Line, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow), Val(:mva), units)) +"""Get [`Line`](@ref) `active_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow`](@ref).""" +get_active_power_flow_unitful(value::Line, units) = get_value(value, Val(:active_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow), ::Type{ Line }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_unitful), ::Type{ Line }) = InfrastructureSystems.SU +"""Get [`Line`](@ref) `reactive_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_flow_unitful`](@ref).""" +get_reactive_power_flow(value::Line, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_flow), Val(:mva), units)) +"""Get [`Line`](@ref) `reactive_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_flow`](@ref).""" +get_reactive_power_flow_unitful(value::Line, units) = get_value(value, Val(:reactive_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow), ::Type{ Line }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_unitful), ::Type{ Line }) = InfrastructureSystems.SU """Get [`Line`](@ref) `arc`.""" get_arc(value::Line) = value.arc -"""Get [`Line`](@ref) `r`.""" -get_r(value::Line) = get_value(value, Val(:r), Val(:ohm)) -"""Get [`Line`](@ref) `x`.""" -get_x(value::Line) = get_value(value, Val(:x), Val(:ohm)) -"""Get [`Line`](@ref) `b`.""" -get_b(value::Line) = get_value(value, Val(:b), Val(:siemens)) -"""Get [`Line`](@ref) `rating`.""" -get_rating(value::Line) = get_value(value, Val(:rating), Val(:mva)) +"""Get [`Line`](@ref) `r` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_unitful`](@ref).""" +get_r(value::Line, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r), Val(:ohm), units)) +"""Get [`Line`](@ref) `r` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r`](@ref).""" +get_r_unitful(value::Line, units) = get_value(value, Val(:r), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r), ::Type{ Line }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_unitful), ::Type{ Line }) = InfrastructureSystems.SU +"""Get [`Line`](@ref) `x` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_unitful`](@ref).""" +get_x(value::Line, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x), Val(:ohm), units)) +"""Get [`Line`](@ref) `x` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x`](@ref).""" +get_x_unitful(value::Line, units) = get_value(value, Val(:x), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x), ::Type{ Line }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_unitful), ::Type{ Line }) = InfrastructureSystems.SU +"""Get [`Line`](@ref) `b` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_b_unitful`](@ref).""" +get_b(value::Line, units) = InfrastructureSystems._strip_units(get_value(value, Val(:b), Val(:siemens), units)) +"""Get [`Line`](@ref) `b` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_b`](@ref).""" +get_b_unitful(value::Line, units) = get_value(value, Val(:b), Val(:siemens), units) +InfrastructureSystems.display_units_arg(::typeof(get_b), ::Type{ Line }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_b_unitful), ::Type{ Line }) = InfrastructureSystems.SU +"""Get [`Line`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::Line, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`Line`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::Line, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ Line }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ Line }) = InfrastructureSystems.SU """Get [`Line`](@ref) `angle_limits`.""" get_angle_limits(value::Line) = value.angle_limits -"""Get [`Line`](@ref) `rating_b`.""" -get_rating_b(value::Line) = get_value(value, Val(:rating_b), Val(:mva)) -"""Get [`Line`](@ref) `rating_c`.""" -get_rating_c(value::Line) = get_value(value, Val(:rating_c), Val(:mva)) -"""Get [`Line`](@ref) `g`.""" -get_g(value::Line) = get_value(value, Val(:g), Val(:siemens)) +"""Get [`Line`](@ref) `rating_b` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_b_unitful`](@ref).""" +get_rating_b(value::Line, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_b), Val(:mva), units)) +"""Get [`Line`](@ref) `rating_b` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_b`](@ref).""" +get_rating_b_unitful(value::Line, units) = get_value(value, Val(:rating_b), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_b), ::Type{ Line }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_b_unitful), ::Type{ Line }) = InfrastructureSystems.SU +"""Get [`Line`](@ref) `rating_c` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_c_unitful`](@ref).""" +get_rating_c(value::Line, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_c), Val(:mva), units)) +"""Get [`Line`](@ref) `rating_c` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_c`](@ref).""" +get_rating_c_unitful(value::Line, units) = get_value(value, Val(:rating_c), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_c), ::Type{ Line }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_c_unitful), ::Type{ Line }) = InfrastructureSystems.SU +"""Get [`Line`](@ref) `g` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_g_unitful`](@ref).""" +get_g(value::Line, units) = InfrastructureSystems._strip_units(get_value(value, Val(:g), Val(:siemens), units)) +"""Get [`Line`](@ref) `g` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_g`](@ref).""" +get_g_unitful(value::Line, units) = get_value(value, Val(:g), Val(:siemens), units) +InfrastructureSystems.display_units_arg(::typeof(get_g), ::Type{ Line }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_g_unitful), ::Type{ Line }) = InfrastructureSystems.SU """Get [`Line`](@ref) `services`.""" get_services(value::Line) = value.services """Get [`Line`](@ref) `ext`.""" diff --git a/src/models/generated/LoadZone.jl b/src/models/generated/LoadZone.jl index 6aa77060f8..491fc6b78a 100644 --- a/src/models/generated/LoadZone.jl +++ b/src/models/generated/LoadZone.jl @@ -57,10 +57,18 @@ end """Get [`LoadZone`](@ref) `name`.""" get_name(value::LoadZone) = value.name -"""Get [`LoadZone`](@ref) `peak_active_power`.""" -get_peak_active_power(value::LoadZone) = get_value(value, Val(:peak_active_power), Val(:mva)) -"""Get [`LoadZone`](@ref) `peak_reactive_power`.""" -get_peak_reactive_power(value::LoadZone) = get_value(value, Val(:peak_reactive_power), Val(:mva)) +"""Get [`LoadZone`](@ref) `peak_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_peak_active_power_unitful`](@ref).""" +get_peak_active_power(value::LoadZone, units) = InfrastructureSystems._strip_units(get_value(value, Val(:peak_active_power), Val(:mva), units)) +"""Get [`LoadZone`](@ref) `peak_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_peak_active_power`](@ref).""" +get_peak_active_power_unitful(value::LoadZone, units) = get_value(value, Val(:peak_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_peak_active_power), ::Type{ LoadZone }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_peak_active_power_unitful), ::Type{ LoadZone }) = InfrastructureSystems.SU +"""Get [`LoadZone`](@ref) `peak_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_peak_reactive_power_unitful`](@ref).""" +get_peak_reactive_power(value::LoadZone, units) = InfrastructureSystems._strip_units(get_value(value, Val(:peak_reactive_power), Val(:mva), units)) +"""Get [`LoadZone`](@ref) `peak_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_peak_reactive_power`](@ref).""" +get_peak_reactive_power_unitful(value::LoadZone, units) = get_value(value, Val(:peak_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_peak_reactive_power), ::Type{ LoadZone }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_peak_reactive_power_unitful), ::Type{ LoadZone }) = InfrastructureSystems.SU """Get [`LoadZone`](@ref) `ext`.""" get_ext(value::LoadZone) = value.ext """Get [`LoadZone`](@ref) `internal`.""" diff --git a/src/models/generated/MonitoredLine.jl b/src/models/generated/MonitoredLine.jl index 90b98a02a0..c26c2f1361 100644 --- a/src/models/generated/MonitoredLine.jl +++ b/src/models/generated/MonitoredLine.jl @@ -119,30 +119,70 @@ end get_name(value::MonitoredLine) = value.name """Get [`MonitoredLine`](@ref) `available`.""" get_available(value::MonitoredLine) = value.available -"""Get [`MonitoredLine`](@ref) `active_power_flow`.""" -get_active_power_flow(value::MonitoredLine) = get_value(value, Val(:active_power_flow), Val(:mva)) -"""Get [`MonitoredLine`](@ref) `reactive_power_flow`.""" -get_reactive_power_flow(value::MonitoredLine) = get_value(value, Val(:reactive_power_flow), Val(:mva)) +"""Get [`MonitoredLine`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_unitful`](@ref).""" +get_active_power_flow(value::MonitoredLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow), Val(:mva), units)) +"""Get [`MonitoredLine`](@ref) `active_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow`](@ref).""" +get_active_power_flow_unitful(value::MonitoredLine, units) = get_value(value, Val(:active_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_unitful), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +"""Get [`MonitoredLine`](@ref) `reactive_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_flow_unitful`](@ref).""" +get_reactive_power_flow(value::MonitoredLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_flow), Val(:mva), units)) +"""Get [`MonitoredLine`](@ref) `reactive_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_flow`](@ref).""" +get_reactive_power_flow_unitful(value::MonitoredLine, units) = get_value(value, Val(:reactive_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_unitful), ::Type{ MonitoredLine }) = InfrastructureSystems.SU """Get [`MonitoredLine`](@ref) `arc`.""" get_arc(value::MonitoredLine) = value.arc -"""Get [`MonitoredLine`](@ref) `r`.""" -get_r(value::MonitoredLine) = get_value(value, Val(:r), Val(:ohm)) -"""Get [`MonitoredLine`](@ref) `x`.""" -get_x(value::MonitoredLine) = get_value(value, Val(:x), Val(:ohm)) -"""Get [`MonitoredLine`](@ref) `b`.""" -get_b(value::MonitoredLine) = get_value(value, Val(:b), Val(:siemens)) -"""Get [`MonitoredLine`](@ref) `flow_limits`.""" -get_flow_limits(value::MonitoredLine) = get_value(value, Val(:flow_limits), Val(:mva)) -"""Get [`MonitoredLine`](@ref) `rating`.""" -get_rating(value::MonitoredLine) = get_value(value, Val(:rating), Val(:mva)) +"""Get [`MonitoredLine`](@ref) `r` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_unitful`](@ref).""" +get_r(value::MonitoredLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r), Val(:ohm), units)) +"""Get [`MonitoredLine`](@ref) `r` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r`](@ref).""" +get_r_unitful(value::MonitoredLine, units) = get_value(value, Val(:r), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_unitful), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +"""Get [`MonitoredLine`](@ref) `x` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_unitful`](@ref).""" +get_x(value::MonitoredLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x), Val(:ohm), units)) +"""Get [`MonitoredLine`](@ref) `x` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x`](@ref).""" +get_x_unitful(value::MonitoredLine, units) = get_value(value, Val(:x), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_unitful), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +"""Get [`MonitoredLine`](@ref) `b` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_b_unitful`](@ref).""" +get_b(value::MonitoredLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:b), Val(:siemens), units)) +"""Get [`MonitoredLine`](@ref) `b` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_b`](@ref).""" +get_b_unitful(value::MonitoredLine, units) = get_value(value, Val(:b), Val(:siemens), units) +InfrastructureSystems.display_units_arg(::typeof(get_b), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_b_unitful), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +"""Get [`MonitoredLine`](@ref) `flow_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_flow_limits_unitful`](@ref).""" +get_flow_limits(value::MonitoredLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:flow_limits), Val(:mva), units)) +"""Get [`MonitoredLine`](@ref) `flow_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_flow_limits`](@ref).""" +get_flow_limits_unitful(value::MonitoredLine, units) = get_value(value, Val(:flow_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_flow_limits), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_flow_limits_unitful), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +"""Get [`MonitoredLine`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::MonitoredLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`MonitoredLine`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::MonitoredLine, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ MonitoredLine }) = InfrastructureSystems.SU """Get [`MonitoredLine`](@ref) `angle_limits`.""" get_angle_limits(value::MonitoredLine) = value.angle_limits -"""Get [`MonitoredLine`](@ref) `rating_b`.""" -get_rating_b(value::MonitoredLine) = get_value(value, Val(:rating_b), Val(:mva)) -"""Get [`MonitoredLine`](@ref) `rating_c`.""" -get_rating_c(value::MonitoredLine) = get_value(value, Val(:rating_c), Val(:mva)) -"""Get [`MonitoredLine`](@ref) `g`.""" -get_g(value::MonitoredLine) = get_value(value, Val(:g), Val(:siemens)) +"""Get [`MonitoredLine`](@ref) `rating_b` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_b_unitful`](@ref).""" +get_rating_b(value::MonitoredLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_b), Val(:mva), units)) +"""Get [`MonitoredLine`](@ref) `rating_b` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_b`](@ref).""" +get_rating_b_unitful(value::MonitoredLine, units) = get_value(value, Val(:rating_b), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_b), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_b_unitful), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +"""Get [`MonitoredLine`](@ref) `rating_c` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_c_unitful`](@ref).""" +get_rating_c(value::MonitoredLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_c), Val(:mva), units)) +"""Get [`MonitoredLine`](@ref) `rating_c` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_c`](@ref).""" +get_rating_c_unitful(value::MonitoredLine, units) = get_value(value, Val(:rating_c), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_c), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_c_unitful), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +"""Get [`MonitoredLine`](@ref) `g` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_g_unitful`](@ref).""" +get_g(value::MonitoredLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:g), Val(:siemens), units)) +"""Get [`MonitoredLine`](@ref) `g` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_g`](@ref).""" +get_g_unitful(value::MonitoredLine, units) = get_value(value, Val(:g), Val(:siemens), units) +InfrastructureSystems.display_units_arg(::typeof(get_g), ::Type{ MonitoredLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_g_unitful), ::Type{ MonitoredLine }) = InfrastructureSystems.SU """Get [`MonitoredLine`](@ref) `services`.""" get_services(value::MonitoredLine) = value.services """Get [`MonitoredLine`](@ref) `ext`.""" diff --git a/src/models/generated/MotorLoad.jl b/src/models/generated/MotorLoad.jl index 2ad03b262e..fb56cfbbde 100644 --- a/src/models/generated/MotorLoad.jl +++ b/src/models/generated/MotorLoad.jl @@ -106,18 +106,38 @@ get_name(value::MotorLoad) = value.name get_available(value::MotorLoad) = value.available """Get [`MotorLoad`](@ref) `bus`.""" get_bus(value::MotorLoad) = value.bus -"""Get [`MotorLoad`](@ref) `active_power`.""" -get_active_power(value::MotorLoad) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`MotorLoad`](@ref) `reactive_power`.""" -get_reactive_power(value::MotorLoad) = get_value(value, Val(:reactive_power), Val(:mva)) -"""Get [`MotorLoad`](@ref) `base_power`.""" -get_base_power(value::MotorLoad) = value.base_power -"""Get [`MotorLoad`](@ref) `rating`.""" -get_rating(value::MotorLoad) = get_value(value, Val(:rating), Val(:mva)) -"""Get [`MotorLoad`](@ref) `max_active_power`.""" -get_max_active_power(value::MotorLoad) = get_value(value, Val(:max_active_power), Val(:mva)) -"""Get [`MotorLoad`](@ref) `reactive_power_limits`.""" -get_reactive_power_limits(value::MotorLoad) = get_value(value, Val(:reactive_power_limits), Val(:mva)) +"""Get [`MotorLoad`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::MotorLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`MotorLoad`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::MotorLoad, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ MotorLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ MotorLoad }) = InfrastructureSystems.SU +"""Get [`MotorLoad`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::MotorLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`MotorLoad`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::MotorLoad, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ MotorLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ MotorLoad }) = InfrastructureSystems.SU + +_get_base_power(value::MotorLoad) = value.base_power +"""Get [`MotorLoad`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::MotorLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`MotorLoad`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::MotorLoad, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ MotorLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ MotorLoad }) = InfrastructureSystems.SU +"""Get [`MotorLoad`](@ref) `max_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_active_power_unitful`](@ref).""" +get_max_active_power(value::MotorLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_active_power), Val(:mva), units)) +"""Get [`MotorLoad`](@ref) `max_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_active_power`](@ref).""" +get_max_active_power_unitful(value::MotorLoad, units) = get_value(value, Val(:max_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_active_power), ::Type{ MotorLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_active_power_unitful), ::Type{ MotorLoad }) = InfrastructureSystems.SU +"""Get [`MotorLoad`](@ref) `reactive_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_unitful`](@ref).""" +get_reactive_power_limits(value::MotorLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits), Val(:mva), units)) +"""Get [`MotorLoad`](@ref) `reactive_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits`](@ref).""" +get_reactive_power_limits_unitful(value::MotorLoad, units) = get_value(value, Val(:reactive_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits), ::Type{ MotorLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_unitful), ::Type{ MotorLoad }) = InfrastructureSystems.SU """Get [`MotorLoad`](@ref) `motor_technology`.""" get_motor_technology(value::MotorLoad) = value.motor_technology """Get [`MotorLoad`](@ref) `services`.""" diff --git a/src/models/generated/PeriodicVariableSource.jl b/src/models/generated/PeriodicVariableSource.jl index e0a7229194..0ce20cc2cf 100644 --- a/src/models/generated/PeriodicVariableSource.jl +++ b/src/models/generated/PeriodicVariableSource.jl @@ -114,8 +114,8 @@ get_internal_angle_bias(value::PeriodicVariableSource) = value.internal_angle_bi get_internal_angle_frequencies(value::PeriodicVariableSource) = value.internal_angle_frequencies """Get [`PeriodicVariableSource`](@ref) `internal_angle_coefficients`.""" get_internal_angle_coefficients(value::PeriodicVariableSource) = value.internal_angle_coefficients -"""Get [`PeriodicVariableSource`](@ref) `base_power`.""" -get_base_power(value::PeriodicVariableSource) = value.base_power + +_get_base_power(value::PeriodicVariableSource) = value.base_power """Get [`PeriodicVariableSource`](@ref) `states`.""" get_states(value::PeriodicVariableSource) = value.states """Get [`PeriodicVariableSource`](@ref) `n_states`.""" diff --git a/src/models/generated/PhaseShiftingTransformer.jl b/src/models/generated/PhaseShiftingTransformer.jl index 71aeb08842..8ba54422fc 100644 --- a/src/models/generated/PhaseShiftingTransformer.jl +++ b/src/models/generated/PhaseShiftingTransformer.jl @@ -139,34 +139,66 @@ end get_name(value::PhaseShiftingTransformer) = value.name """Get [`PhaseShiftingTransformer`](@ref) `available`.""" get_available(value::PhaseShiftingTransformer) = value.available -"""Get [`PhaseShiftingTransformer`](@ref) `active_power_flow`.""" -get_active_power_flow(value::PhaseShiftingTransformer) = get_value(value, Val(:active_power_flow), Val(:mva)) -"""Get [`PhaseShiftingTransformer`](@ref) `reactive_power_flow`.""" -get_reactive_power_flow(value::PhaseShiftingTransformer) = get_value(value, Val(:reactive_power_flow), Val(:mva)) +"""Get [`PhaseShiftingTransformer`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_unitful`](@ref).""" +get_active_power_flow(value::PhaseShiftingTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer`](@ref) `active_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow`](@ref).""" +get_active_power_flow_unitful(value::PhaseShiftingTransformer, units) = get_value(value, Val(:active_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_unitful), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer`](@ref) `reactive_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_flow_unitful`](@ref).""" +get_reactive_power_flow(value::PhaseShiftingTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_flow), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer`](@ref) `reactive_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_flow`](@ref).""" +get_reactive_power_flow_unitful(value::PhaseShiftingTransformer, units) = get_value(value, Val(:reactive_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_unitful), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU """Get [`PhaseShiftingTransformer`](@ref) `arc`.""" get_arc(value::PhaseShiftingTransformer) = value.arc -"""Get [`PhaseShiftingTransformer`](@ref) `r`.""" -get_r(value::PhaseShiftingTransformer) = get_value(value, Val(:r), Val(:ohm)) -"""Get [`PhaseShiftingTransformer`](@ref) `x`.""" -get_x(value::PhaseShiftingTransformer) = get_value(value, Val(:x), Val(:ohm)) -"""Get [`PhaseShiftingTransformer`](@ref) `primary_shunt`.""" -get_primary_shunt(value::PhaseShiftingTransformer) = get_value(value, Val(:primary_shunt), Val(:siemens)) +"""Get [`PhaseShiftingTransformer`](@ref) `r` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_unitful`](@ref).""" +get_r(value::PhaseShiftingTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r), Val(:ohm), units)) +"""Get [`PhaseShiftingTransformer`](@ref) `r` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r`](@ref).""" +get_r_unitful(value::PhaseShiftingTransformer, units) = get_value(value, Val(:r), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_unitful), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer`](@ref) `x` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_unitful`](@ref).""" +get_x(value::PhaseShiftingTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x), Val(:ohm), units)) +"""Get [`PhaseShiftingTransformer`](@ref) `x` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x`](@ref).""" +get_x_unitful(value::PhaseShiftingTransformer, units) = get_value(value, Val(:x), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_unitful), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer`](@ref) `primary_shunt` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_primary_shunt_unitful`](@ref).""" +get_primary_shunt(value::PhaseShiftingTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:primary_shunt), Val(:siemens), units)) +"""Get [`PhaseShiftingTransformer`](@ref) `primary_shunt` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_primary_shunt`](@ref).""" +get_primary_shunt_unitful(value::PhaseShiftingTransformer, units) = get_value(value, Val(:primary_shunt), Val(:siemens), units) +InfrastructureSystems.display_units_arg(::typeof(get_primary_shunt), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_primary_shunt_unitful), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU """Get [`PhaseShiftingTransformer`](@ref) `tap`.""" get_tap(value::PhaseShiftingTransformer) = value.tap """Get [`PhaseShiftingTransformer`](@ref) `α`.""" get_α(value::PhaseShiftingTransformer) = value.α -"""Get [`PhaseShiftingTransformer`](@ref) `rating`.""" -get_rating(value::PhaseShiftingTransformer) = get_value(value, Val(:rating), Val(:mva)) -"""Get [`PhaseShiftingTransformer`](@ref) `base_power`.""" -get_base_power(value::PhaseShiftingTransformer) = value.base_power +"""Get [`PhaseShiftingTransformer`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::PhaseShiftingTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::PhaseShiftingTransformer, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU + +_get_base_power(value::PhaseShiftingTransformer) = value.base_power """Get [`PhaseShiftingTransformer`](@ref) `base_voltage_primary`.""" get_base_voltage_primary(value::PhaseShiftingTransformer) = value.base_voltage_primary """Get [`PhaseShiftingTransformer`](@ref) `base_voltage_secondary`.""" get_base_voltage_secondary(value::PhaseShiftingTransformer) = value.base_voltage_secondary -"""Get [`PhaseShiftingTransformer`](@ref) `rating_b`.""" -get_rating_b(value::PhaseShiftingTransformer) = get_value(value, Val(:rating_b), Val(:mva)) -"""Get [`PhaseShiftingTransformer`](@ref) `rating_c`.""" -get_rating_c(value::PhaseShiftingTransformer) = get_value(value, Val(:rating_c), Val(:mva)) +"""Get [`PhaseShiftingTransformer`](@ref) `rating_b` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_b_unitful`](@ref).""" +get_rating_b(value::PhaseShiftingTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_b), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer`](@ref) `rating_b` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_b`](@ref).""" +get_rating_b_unitful(value::PhaseShiftingTransformer, units) = get_value(value, Val(:rating_b), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_b), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_b_unitful), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer`](@ref) `rating_c` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_c_unitful`](@ref).""" +get_rating_c(value::PhaseShiftingTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_c), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer`](@ref) `rating_c` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_c`](@ref).""" +get_rating_c_unitful(value::PhaseShiftingTransformer, units) = get_value(value, Val(:rating_c), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_c), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_c_unitful), ::Type{ PhaseShiftingTransformer }) = InfrastructureSystems.SU """Get [`PhaseShiftingTransformer`](@ref) `phase_angle_limits`.""" get_phase_angle_limits(value::PhaseShiftingTransformer) = value.phase_angle_limits """Get [`PhaseShiftingTransformer`](@ref) `control_objective`.""" diff --git a/src/models/generated/PhaseShiftingTransformer3W.jl b/src/models/generated/PhaseShiftingTransformer3W.jl index 934330cfee..d1aa310d9a 100644 --- a/src/models/generated/PhaseShiftingTransformer3W.jl +++ b/src/models/generated/PhaseShiftingTransformer3W.jl @@ -302,66 +302,150 @@ get_secondary_star_arc(value::PhaseShiftingTransformer3W) = value.secondary_star get_tertiary_star_arc(value::PhaseShiftingTransformer3W) = value.tertiary_star_arc """Get [`PhaseShiftingTransformer3W`](@ref) `star_bus`.""" get_star_bus(value::PhaseShiftingTransformer3W) = value.star_bus -"""Get [`PhaseShiftingTransformer3W`](@ref) `active_power_flow_primary`.""" -get_active_power_flow_primary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:active_power_flow_primary), Val(:mva)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `reactive_power_flow_primary`.""" -get_reactive_power_flow_primary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:reactive_power_flow_primary), Val(:mva)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `active_power_flow_secondary`.""" -get_active_power_flow_secondary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:active_power_flow_secondary), Val(:mva)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `reactive_power_flow_secondary`.""" -get_reactive_power_flow_secondary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:reactive_power_flow_secondary), Val(:mva)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `active_power_flow_tertiary`.""" -get_active_power_flow_tertiary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:active_power_flow_tertiary), Val(:mva)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `reactive_power_flow_tertiary`.""" -get_reactive_power_flow_tertiary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:reactive_power_flow_tertiary), Val(:mva)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `r_primary`.""" -get_r_primary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:r_primary), Val(:ohm)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `x_primary`.""" -get_x_primary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:x_primary), Val(:ohm)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `r_secondary`.""" -get_r_secondary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:r_secondary), Val(:ohm)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `x_secondary`.""" -get_x_secondary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:x_secondary), Val(:ohm)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `r_tertiary`.""" -get_r_tertiary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:r_tertiary), Val(:ohm)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `x_tertiary`.""" -get_x_tertiary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:x_tertiary), Val(:ohm)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `rating`.""" -get_rating(value::PhaseShiftingTransformer3W) = get_value(value, Val(:rating), Val(:mva)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `r_12`.""" -get_r_12(value::PhaseShiftingTransformer3W) = get_value(value, Val(:r_12), Val(:ohm)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `x_12`.""" -get_x_12(value::PhaseShiftingTransformer3W) = get_value(value, Val(:x_12), Val(:ohm)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `r_23`.""" -get_r_23(value::PhaseShiftingTransformer3W) = get_value(value, Val(:r_23), Val(:ohm)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `x_23`.""" -get_x_23(value::PhaseShiftingTransformer3W) = get_value(value, Val(:x_23), Val(:ohm)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `r_13`.""" -get_r_13(value::PhaseShiftingTransformer3W) = get_value(value, Val(:r_13), Val(:ohm)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `x_13`.""" -get_x_13(value::PhaseShiftingTransformer3W) = get_value(value, Val(:x_13), Val(:ohm)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `active_power_flow_primary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_primary_unitful`](@ref).""" +get_active_power_flow_primary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow_primary), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `active_power_flow_primary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow_primary`](@ref).""" +get_active_power_flow_primary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:active_power_flow_primary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_primary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_primary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `reactive_power_flow_primary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_flow_primary_unitful`](@ref).""" +get_reactive_power_flow_primary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_flow_primary), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `reactive_power_flow_primary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_flow_primary`](@ref).""" +get_reactive_power_flow_primary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:reactive_power_flow_primary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_primary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_primary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `active_power_flow_secondary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_secondary_unitful`](@ref).""" +get_active_power_flow_secondary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow_secondary), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `active_power_flow_secondary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow_secondary`](@ref).""" +get_active_power_flow_secondary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:active_power_flow_secondary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_secondary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_secondary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `reactive_power_flow_secondary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_flow_secondary_unitful`](@ref).""" +get_reactive_power_flow_secondary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_flow_secondary), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `reactive_power_flow_secondary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_flow_secondary`](@ref).""" +get_reactive_power_flow_secondary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:reactive_power_flow_secondary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_secondary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_secondary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `active_power_flow_tertiary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_tertiary_unitful`](@ref).""" +get_active_power_flow_tertiary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow_tertiary), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `active_power_flow_tertiary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow_tertiary`](@ref).""" +get_active_power_flow_tertiary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:active_power_flow_tertiary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_tertiary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_tertiary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `reactive_power_flow_tertiary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_flow_tertiary_unitful`](@ref).""" +get_reactive_power_flow_tertiary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_flow_tertiary), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `reactive_power_flow_tertiary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_flow_tertiary`](@ref).""" +get_reactive_power_flow_tertiary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:reactive_power_flow_tertiary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_tertiary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_tertiary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `r_primary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_primary_unitful`](@ref).""" +get_r_primary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r_primary), Val(:ohm), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `r_primary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r_primary`](@ref).""" +get_r_primary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:r_primary), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r_primary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_primary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `x_primary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_primary_unitful`](@ref).""" +get_x_primary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x_primary), Val(:ohm), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `x_primary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x_primary`](@ref).""" +get_x_primary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:x_primary), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x_primary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_primary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `r_secondary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_secondary_unitful`](@ref).""" +get_r_secondary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r_secondary), Val(:ohm), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `r_secondary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r_secondary`](@ref).""" +get_r_secondary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:r_secondary), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r_secondary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_secondary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `x_secondary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_secondary_unitful`](@ref).""" +get_x_secondary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x_secondary), Val(:ohm), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `x_secondary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x_secondary`](@ref).""" +get_x_secondary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:x_secondary), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x_secondary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_secondary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `r_tertiary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_tertiary_unitful`](@ref).""" +get_r_tertiary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r_tertiary), Val(:ohm), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `r_tertiary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r_tertiary`](@ref).""" +get_r_tertiary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:r_tertiary), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r_tertiary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_tertiary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `x_tertiary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_tertiary_unitful`](@ref).""" +get_x_tertiary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x_tertiary), Val(:ohm), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `x_tertiary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x_tertiary`](@ref).""" +get_x_tertiary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:x_tertiary), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x_tertiary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_tertiary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `r_12` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_12_unitful`](@ref).""" +get_r_12(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r_12), Val(:ohm), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `r_12` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r_12`](@ref).""" +get_r_12_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:r_12), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r_12), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_12_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `x_12` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_12_unitful`](@ref).""" +get_x_12(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x_12), Val(:ohm), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `x_12` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x_12`](@ref).""" +get_x_12_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:x_12), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x_12), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_12_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `r_23` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_23_unitful`](@ref).""" +get_r_23(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r_23), Val(:ohm), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `r_23` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r_23`](@ref).""" +get_r_23_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:r_23), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r_23), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_23_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `x_23` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_23_unitful`](@ref).""" +get_x_23(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x_23), Val(:ohm), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `x_23` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x_23`](@ref).""" +get_x_23_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:x_23), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x_23), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_23_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `r_13` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_13_unitful`](@ref).""" +get_r_13(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r_13), Val(:ohm), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `r_13` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r_13`](@ref).""" +get_r_13_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:r_13), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r_13), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_13_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `x_13` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_13_unitful`](@ref).""" +get_x_13(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x_13), Val(:ohm), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `x_13` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x_13`](@ref).""" +get_x_13_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:x_13), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x_13), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_13_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU """Get [`PhaseShiftingTransformer3W`](@ref) `α_primary`.""" get_α_primary(value::PhaseShiftingTransformer3W) = value.α_primary """Get [`PhaseShiftingTransformer3W`](@ref) `α_secondary`.""" get_α_secondary(value::PhaseShiftingTransformer3W) = value.α_secondary """Get [`PhaseShiftingTransformer3W`](@ref) `α_tertiary`.""" get_α_tertiary(value::PhaseShiftingTransformer3W) = value.α_tertiary -"""Get [`PhaseShiftingTransformer3W`](@ref) `base_power_12`.""" -get_base_power_12(value::PhaseShiftingTransformer3W) = value.base_power_12 -"""Get [`PhaseShiftingTransformer3W`](@ref) `base_power_23`.""" -get_base_power_23(value::PhaseShiftingTransformer3W) = value.base_power_23 -"""Get [`PhaseShiftingTransformer3W`](@ref) `base_power_13`.""" -get_base_power_13(value::PhaseShiftingTransformer3W) = value.base_power_13 + +_get_base_power_12(value::PhaseShiftingTransformer3W) = value.base_power_12 + +_get_base_power_23(value::PhaseShiftingTransformer3W) = value.base_power_23 + +_get_base_power_13(value::PhaseShiftingTransformer3W) = value.base_power_13 """Get [`PhaseShiftingTransformer3W`](@ref) `base_voltage_primary`.""" get_base_voltage_primary(value::PhaseShiftingTransformer3W) = value.base_voltage_primary """Get [`PhaseShiftingTransformer3W`](@ref) `base_voltage_secondary`.""" get_base_voltage_secondary(value::PhaseShiftingTransformer3W) = value.base_voltage_secondary """Get [`PhaseShiftingTransformer3W`](@ref) `base_voltage_tertiary`.""" get_base_voltage_tertiary(value::PhaseShiftingTransformer3W) = value.base_voltage_tertiary -"""Get [`PhaseShiftingTransformer3W`](@ref) `g`.""" -get_g(value::PhaseShiftingTransformer3W) = get_value(value, Val(:g), Val(:siemens)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `b`.""" -get_b(value::PhaseShiftingTransformer3W) = get_value(value, Val(:b), Val(:siemens)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `g` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_g_unitful`](@ref).""" +get_g(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:g), Val(:siemens), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `g` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_g`](@ref).""" +get_g_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:g), Val(:siemens), units) +InfrastructureSystems.display_units_arg(::typeof(get_g), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_g_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `b` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_b_unitful`](@ref).""" +get_b(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:b), Val(:siemens), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `b` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_b`](@ref).""" +get_b_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:b), Val(:siemens), units) +InfrastructureSystems.display_units_arg(::typeof(get_b), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_b_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU """Get [`PhaseShiftingTransformer3W`](@ref) `primary_turns_ratio`.""" get_primary_turns_ratio(value::PhaseShiftingTransformer3W) = value.primary_turns_ratio """Get [`PhaseShiftingTransformer3W`](@ref) `secondary_turns_ratio`.""" @@ -374,12 +458,24 @@ get_available_primary(value::PhaseShiftingTransformer3W) = value.available_prima get_available_secondary(value::PhaseShiftingTransformer3W) = value.available_secondary """Get [`PhaseShiftingTransformer3W`](@ref) `available_tertiary`.""" get_available_tertiary(value::PhaseShiftingTransformer3W) = value.available_tertiary -"""Get [`PhaseShiftingTransformer3W`](@ref) `rating_primary`.""" -get_rating_primary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:rating_primary), Val(:mva)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `rating_secondary`.""" -get_rating_secondary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:rating_secondary), Val(:mva)) -"""Get [`PhaseShiftingTransformer3W`](@ref) `rating_tertiary`.""" -get_rating_tertiary(value::PhaseShiftingTransformer3W) = get_value(value, Val(:rating_tertiary), Val(:mva)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `rating_primary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_primary_unitful`](@ref).""" +get_rating_primary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_primary), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `rating_primary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_primary`](@ref).""" +get_rating_primary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:rating_primary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_primary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_primary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `rating_secondary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_secondary_unitful`](@ref).""" +get_rating_secondary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_secondary), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `rating_secondary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_secondary`](@ref).""" +get_rating_secondary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:rating_secondary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_secondary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_secondary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +"""Get [`PhaseShiftingTransformer3W`](@ref) `rating_tertiary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_tertiary_unitful`](@ref).""" +get_rating_tertiary(value::PhaseShiftingTransformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_tertiary), Val(:mva), units)) +"""Get [`PhaseShiftingTransformer3W`](@ref) `rating_tertiary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_tertiary`](@ref).""" +get_rating_tertiary_unitful(value::PhaseShiftingTransformer3W, units) = get_value(value, Val(:rating_tertiary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_tertiary), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_tertiary_unitful), ::Type{ PhaseShiftingTransformer3W }) = InfrastructureSystems.SU """Get [`PhaseShiftingTransformer3W`](@ref) `phase_angle_limits`.""" get_phase_angle_limits(value::PhaseShiftingTransformer3W) = value.phase_angle_limits """Get [`PhaseShiftingTransformer3W`](@ref) `control_objective_primary`.""" diff --git a/src/models/generated/PowerLoad.jl b/src/models/generated/PowerLoad.jl index a7f2afb023..b40684c558 100644 --- a/src/models/generated/PowerLoad.jl +++ b/src/models/generated/PowerLoad.jl @@ -101,16 +101,32 @@ get_name(value::PowerLoad) = value.name get_available(value::PowerLoad) = value.available """Get [`PowerLoad`](@ref) `bus`.""" get_bus(value::PowerLoad) = value.bus -"""Get [`PowerLoad`](@ref) `active_power`.""" -get_active_power(value::PowerLoad) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`PowerLoad`](@ref) `reactive_power`.""" -get_reactive_power(value::PowerLoad) = get_value(value, Val(:reactive_power), Val(:mva)) -"""Get [`PowerLoad`](@ref) `base_power`.""" -get_base_power(value::PowerLoad) = value.base_power -"""Get [`PowerLoad`](@ref) `max_active_power`.""" -get_max_active_power(value::PowerLoad) = get_value(value, Val(:max_active_power), Val(:mva)) -"""Get [`PowerLoad`](@ref) `max_reactive_power`.""" -get_max_reactive_power(value::PowerLoad) = get_value(value, Val(:max_reactive_power), Val(:mva)) +"""Get [`PowerLoad`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::PowerLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`PowerLoad`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::PowerLoad, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ PowerLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ PowerLoad }) = InfrastructureSystems.SU +"""Get [`PowerLoad`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::PowerLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`PowerLoad`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::PowerLoad, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ PowerLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ PowerLoad }) = InfrastructureSystems.SU + +_get_base_power(value::PowerLoad) = value.base_power +"""Get [`PowerLoad`](@ref) `max_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_active_power_unitful`](@ref).""" +get_max_active_power(value::PowerLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_active_power), Val(:mva), units)) +"""Get [`PowerLoad`](@ref) `max_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_active_power`](@ref).""" +get_max_active_power_unitful(value::PowerLoad, units) = get_value(value, Val(:max_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_active_power), ::Type{ PowerLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_active_power_unitful), ::Type{ PowerLoad }) = InfrastructureSystems.SU +"""Get [`PowerLoad`](@ref) `max_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_reactive_power_unitful`](@ref).""" +get_max_reactive_power(value::PowerLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_reactive_power), Val(:mva), units)) +"""Get [`PowerLoad`](@ref) `max_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_reactive_power`](@ref).""" +get_max_reactive_power_unitful(value::PowerLoad, units) = get_value(value, Val(:max_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_reactive_power), ::Type{ PowerLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_reactive_power_unitful), ::Type{ PowerLoad }) = InfrastructureSystems.SU """Get [`PowerLoad`](@ref) `conformity`.""" get_conformity(value::PowerLoad) = value.conformity """Get [`PowerLoad`](@ref) `services`.""" diff --git a/src/models/generated/RenewableDispatch.jl b/src/models/generated/RenewableDispatch.jl index 9e3e18846b..1359646688 100644 --- a/src/models/generated/RenewableDispatch.jl +++ b/src/models/generated/RenewableDispatch.jl @@ -113,22 +113,38 @@ get_name(value::RenewableDispatch) = value.name get_available(value::RenewableDispatch) = value.available """Get [`RenewableDispatch`](@ref) `bus`.""" get_bus(value::RenewableDispatch) = value.bus -"""Get [`RenewableDispatch`](@ref) `active_power`.""" -get_active_power(value::RenewableDispatch) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`RenewableDispatch`](@ref) `reactive_power`.""" -get_reactive_power(value::RenewableDispatch) = get_value(value, Val(:reactive_power), Val(:mva)) -"""Get [`RenewableDispatch`](@ref) `rating`.""" -get_rating(value::RenewableDispatch) = get_value(value, Val(:rating), Val(:mva)) +"""Get [`RenewableDispatch`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::RenewableDispatch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`RenewableDispatch`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::RenewableDispatch, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ RenewableDispatch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ RenewableDispatch }) = InfrastructureSystems.SU +"""Get [`RenewableDispatch`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::RenewableDispatch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`RenewableDispatch`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::RenewableDispatch, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ RenewableDispatch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ RenewableDispatch }) = InfrastructureSystems.SU +"""Get [`RenewableDispatch`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::RenewableDispatch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`RenewableDispatch`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::RenewableDispatch, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ RenewableDispatch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ RenewableDispatch }) = InfrastructureSystems.SU """Get [`RenewableDispatch`](@ref) `prime_mover_type`.""" get_prime_mover_type(value::RenewableDispatch) = value.prime_mover_type -"""Get [`RenewableDispatch`](@ref) `reactive_power_limits`.""" -get_reactive_power_limits(value::RenewableDispatch) = get_value(value, Val(:reactive_power_limits), Val(:mva)) +"""Get [`RenewableDispatch`](@ref) `reactive_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_unitful`](@ref).""" +get_reactive_power_limits(value::RenewableDispatch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits), Val(:mva), units)) +"""Get [`RenewableDispatch`](@ref) `reactive_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits`](@ref).""" +get_reactive_power_limits_unitful(value::RenewableDispatch, units) = get_value(value, Val(:reactive_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits), ::Type{ RenewableDispatch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_unitful), ::Type{ RenewableDispatch }) = InfrastructureSystems.SU """Get [`RenewableDispatch`](@ref) `power_factor`.""" get_power_factor(value::RenewableDispatch) = value.power_factor """Get [`RenewableDispatch`](@ref) `operation_cost`.""" get_operation_cost(value::RenewableDispatch) = value.operation_cost -"""Get [`RenewableDispatch`](@ref) `base_power`.""" -get_base_power(value::RenewableDispatch) = value.base_power + +_get_base_power(value::RenewableDispatch) = value.base_power """Get [`RenewableDispatch`](@ref) `services`.""" get_services(value::RenewableDispatch) = value.services """Get [`RenewableDispatch`](@ref) `dynamic_injector`.""" diff --git a/src/models/generated/RenewableNonDispatch.jl b/src/models/generated/RenewableNonDispatch.jl index 8efed05546..10e0da3e1e 100644 --- a/src/models/generated/RenewableNonDispatch.jl +++ b/src/models/generated/RenewableNonDispatch.jl @@ -103,18 +103,30 @@ get_name(value::RenewableNonDispatch) = value.name get_available(value::RenewableNonDispatch) = value.available """Get [`RenewableNonDispatch`](@ref) `bus`.""" get_bus(value::RenewableNonDispatch) = value.bus -"""Get [`RenewableNonDispatch`](@ref) `active_power`.""" -get_active_power(value::RenewableNonDispatch) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`RenewableNonDispatch`](@ref) `reactive_power`.""" -get_reactive_power(value::RenewableNonDispatch) = get_value(value, Val(:reactive_power), Val(:mva)) -"""Get [`RenewableNonDispatch`](@ref) `rating`.""" -get_rating(value::RenewableNonDispatch) = get_value(value, Val(:rating), Val(:mva)) +"""Get [`RenewableNonDispatch`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::RenewableNonDispatch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`RenewableNonDispatch`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::RenewableNonDispatch, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ RenewableNonDispatch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ RenewableNonDispatch }) = InfrastructureSystems.SU +"""Get [`RenewableNonDispatch`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::RenewableNonDispatch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`RenewableNonDispatch`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::RenewableNonDispatch, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ RenewableNonDispatch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ RenewableNonDispatch }) = InfrastructureSystems.SU +"""Get [`RenewableNonDispatch`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::RenewableNonDispatch, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`RenewableNonDispatch`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::RenewableNonDispatch, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ RenewableNonDispatch }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ RenewableNonDispatch }) = InfrastructureSystems.SU """Get [`RenewableNonDispatch`](@ref) `prime_mover_type`.""" get_prime_mover_type(value::RenewableNonDispatch) = value.prime_mover_type """Get [`RenewableNonDispatch`](@ref) `power_factor`.""" get_power_factor(value::RenewableNonDispatch) = value.power_factor -"""Get [`RenewableNonDispatch`](@ref) `base_power`.""" -get_base_power(value::RenewableNonDispatch) = value.base_power + +_get_base_power(value::RenewableNonDispatch) = value.base_power """Get [`RenewableNonDispatch`](@ref) `services`.""" get_services(value::RenewableNonDispatch) = value.services """Get [`RenewableNonDispatch`](@ref) `dynamic_injector`.""" diff --git a/src/models/generated/ShiftablePowerLoad.jl b/src/models/generated/ShiftablePowerLoad.jl index 43de0b139b..6a367a4ff5 100644 --- a/src/models/generated/ShiftablePowerLoad.jl +++ b/src/models/generated/ShiftablePowerLoad.jl @@ -111,18 +111,38 @@ get_name(value::ShiftablePowerLoad) = value.name get_available(value::ShiftablePowerLoad) = value.available """Get [`ShiftablePowerLoad`](@ref) `bus`.""" get_bus(value::ShiftablePowerLoad) = value.bus -"""Get [`ShiftablePowerLoad`](@ref) `active_power`.""" -get_active_power(value::ShiftablePowerLoad) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`ShiftablePowerLoad`](@ref) `active_power_limits`.""" -get_active_power_limits(value::ShiftablePowerLoad) = get_value(value, Val(:active_power_limits), Val(:mva)) -"""Get [`ShiftablePowerLoad`](@ref) `reactive_power`.""" -get_reactive_power(value::ShiftablePowerLoad) = get_value(value, Val(:reactive_power), Val(:mva)) -"""Get [`ShiftablePowerLoad`](@ref) `max_active_power`.""" -get_max_active_power(value::ShiftablePowerLoad) = get_value(value, Val(:max_active_power), Val(:mva)) -"""Get [`ShiftablePowerLoad`](@ref) `max_reactive_power`.""" -get_max_reactive_power(value::ShiftablePowerLoad) = get_value(value, Val(:max_reactive_power), Val(:mva)) -"""Get [`ShiftablePowerLoad`](@ref) `base_power`.""" -get_base_power(value::ShiftablePowerLoad) = value.base_power +"""Get [`ShiftablePowerLoad`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::ShiftablePowerLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`ShiftablePowerLoad`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::ShiftablePowerLoad, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ ShiftablePowerLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ ShiftablePowerLoad }) = InfrastructureSystems.SU +"""Get [`ShiftablePowerLoad`](@ref) `active_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_unitful`](@ref).""" +get_active_power_limits(value::ShiftablePowerLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits), Val(:mva), units)) +"""Get [`ShiftablePowerLoad`](@ref) `active_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits`](@ref).""" +get_active_power_limits_unitful(value::ShiftablePowerLoad, units) = get_value(value, Val(:active_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits), ::Type{ ShiftablePowerLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_unitful), ::Type{ ShiftablePowerLoad }) = InfrastructureSystems.SU +"""Get [`ShiftablePowerLoad`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::ShiftablePowerLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`ShiftablePowerLoad`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::ShiftablePowerLoad, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ ShiftablePowerLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ ShiftablePowerLoad }) = InfrastructureSystems.SU +"""Get [`ShiftablePowerLoad`](@ref) `max_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_active_power_unitful`](@ref).""" +get_max_active_power(value::ShiftablePowerLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_active_power), Val(:mva), units)) +"""Get [`ShiftablePowerLoad`](@ref) `max_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_active_power`](@ref).""" +get_max_active_power_unitful(value::ShiftablePowerLoad, units) = get_value(value, Val(:max_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_active_power), ::Type{ ShiftablePowerLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_active_power_unitful), ::Type{ ShiftablePowerLoad }) = InfrastructureSystems.SU +"""Get [`ShiftablePowerLoad`](@ref) `max_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_reactive_power_unitful`](@ref).""" +get_max_reactive_power(value::ShiftablePowerLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_reactive_power), Val(:mva), units)) +"""Get [`ShiftablePowerLoad`](@ref) `max_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_reactive_power`](@ref).""" +get_max_reactive_power_unitful(value::ShiftablePowerLoad, units) = get_value(value, Val(:max_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_reactive_power), ::Type{ ShiftablePowerLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_reactive_power_unitful), ::Type{ ShiftablePowerLoad }) = InfrastructureSystems.SU + +_get_base_power(value::ShiftablePowerLoad) = value.base_power """Get [`ShiftablePowerLoad`](@ref) `load_balance_time_horizon`.""" get_load_balance_time_horizon(value::ShiftablePowerLoad) = value.load_balance_time_horizon """Get [`ShiftablePowerLoad`](@ref) `operation_cost`.""" diff --git a/src/models/generated/SimplifiedSingleCageInductionMachine.jl b/src/models/generated/SimplifiedSingleCageInductionMachine.jl index 3bbbdecd60..b1eb6bf703 100644 --- a/src/models/generated/SimplifiedSingleCageInductionMachine.jl +++ b/src/models/generated/SimplifiedSingleCageInductionMachine.jl @@ -121,7 +121,7 @@ function SimplifiedSingleCageInductionMachine(::Nothing) H=0, A=0.0, B=0.0, - base_power=100, + base_power=100.0, ext=Dict{String, Any}(), ) end @@ -144,8 +144,8 @@ get_H(value::SimplifiedSingleCageInductionMachine) = value.H get_A(value::SimplifiedSingleCageInductionMachine) = value.A """Get [`SimplifiedSingleCageInductionMachine`](@ref) `B`.""" get_B(value::SimplifiedSingleCageInductionMachine) = value.B -"""Get [`SimplifiedSingleCageInductionMachine`](@ref) `base_power`.""" -get_base_power(value::SimplifiedSingleCageInductionMachine) = value.base_power + +_get_base_power(value::SimplifiedSingleCageInductionMachine) = value.base_power """Get [`SimplifiedSingleCageInductionMachine`](@ref) `ext`.""" get_ext(value::SimplifiedSingleCageInductionMachine) = value.ext """Get [`SimplifiedSingleCageInductionMachine`](@ref) `C`.""" diff --git a/src/models/generated/SingleCageInductionMachine.jl b/src/models/generated/SingleCageInductionMachine.jl index 42d3893028..b1c04209f8 100644 --- a/src/models/generated/SingleCageInductionMachine.jl +++ b/src/models/generated/SingleCageInductionMachine.jl @@ -121,7 +121,7 @@ function SingleCageInductionMachine(::Nothing) H=0, A=0.0, B=0.0, - base_power=100, + base_power=100.0, ext=Dict{String, Any}(), ) end @@ -144,8 +144,8 @@ get_H(value::SingleCageInductionMachine) = value.H get_A(value::SingleCageInductionMachine) = value.A """Get [`SingleCageInductionMachine`](@ref) `B`.""" get_B(value::SingleCageInductionMachine) = value.B -"""Get [`SingleCageInductionMachine`](@ref) `base_power`.""" -get_base_power(value::SingleCageInductionMachine) = value.base_power + +_get_base_power(value::SingleCageInductionMachine) = value.base_power """Get [`SingleCageInductionMachine`](@ref) `ext`.""" get_ext(value::SingleCageInductionMachine) = value.ext """Get [`SingleCageInductionMachine`](@ref) `C`.""" diff --git a/src/models/generated/Source.jl b/src/models/generated/Source.jl index 450a4a977e..686d5f2b81 100644 --- a/src/models/generated/Source.jl +++ b/src/models/generated/Source.jl @@ -121,14 +121,30 @@ get_name(value::Source) = value.name get_available(value::Source) = value.available """Get [`Source`](@ref) `bus`.""" get_bus(value::Source) = value.bus -"""Get [`Source`](@ref) `active_power`.""" -get_active_power(value::Source) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`Source`](@ref) `reactive_power`.""" -get_reactive_power(value::Source) = get_value(value, Val(:reactive_power), Val(:mva)) -"""Get [`Source`](@ref) `active_power_limits`.""" -get_active_power_limits(value::Source) = get_value(value, Val(:active_power_limits), Val(:mva)) -"""Get [`Source`](@ref) `reactive_power_limits`.""" -get_reactive_power_limits(value::Source) = get_value(value, Val(:reactive_power_limits), Val(:mva)) +"""Get [`Source`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::Source, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`Source`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::Source, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ Source }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ Source }) = InfrastructureSystems.SU +"""Get [`Source`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::Source, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`Source`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::Source, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ Source }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ Source }) = InfrastructureSystems.SU +"""Get [`Source`](@ref) `active_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_unitful`](@ref).""" +get_active_power_limits(value::Source, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits), Val(:mva), units)) +"""Get [`Source`](@ref) `active_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits`](@ref).""" +get_active_power_limits_unitful(value::Source, units) = get_value(value, Val(:active_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits), ::Type{ Source }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_unitful), ::Type{ Source }) = InfrastructureSystems.SU +"""Get [`Source`](@ref) `reactive_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_unitful`](@ref).""" +get_reactive_power_limits(value::Source, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits), Val(:mva), units)) +"""Get [`Source`](@ref) `reactive_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits`](@ref).""" +get_reactive_power_limits_unitful(value::Source, units) = get_value(value, Val(:reactive_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits), ::Type{ Source }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_unitful), ::Type{ Source }) = InfrastructureSystems.SU """Get [`Source`](@ref) `R_th`.""" get_R_th(value::Source) = value.R_th """Get [`Source`](@ref) `X_th`.""" @@ -137,8 +153,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_base_power(value::Source) = value.base_power """Get [`Source`](@ref) `operation_cost`.""" get_operation_cost(value::Source) = value.operation_cost """Get [`Source`](@ref) `dynamic_injector`.""" diff --git a/src/models/generated/StandardLoad.jl b/src/models/generated/StandardLoad.jl index 4fc85c37c5..558f0e31dc 100644 --- a/src/models/generated/StandardLoad.jl +++ b/src/models/generated/StandardLoad.jl @@ -143,32 +143,80 @@ get_name(value::StandardLoad) = value.name get_available(value::StandardLoad) = value.available """Get [`StandardLoad`](@ref) `bus`.""" get_bus(value::StandardLoad) = value.bus -"""Get [`StandardLoad`](@ref) `base_power`.""" -get_base_power(value::StandardLoad) = value.base_power -"""Get [`StandardLoad`](@ref) `constant_active_power`.""" -get_constant_active_power(value::StandardLoad) = get_value(value, Val(:constant_active_power), Val(:mva)) -"""Get [`StandardLoad`](@ref) `constant_reactive_power`.""" -get_constant_reactive_power(value::StandardLoad) = get_value(value, Val(:constant_reactive_power), Val(:mva)) -"""Get [`StandardLoad`](@ref) `impedance_active_power`.""" -get_impedance_active_power(value::StandardLoad) = get_value(value, Val(:impedance_active_power), Val(:mva)) -"""Get [`StandardLoad`](@ref) `impedance_reactive_power`.""" -get_impedance_reactive_power(value::StandardLoad) = get_value(value, Val(:impedance_reactive_power), Val(:mva)) -"""Get [`StandardLoad`](@ref) `current_active_power`.""" -get_current_active_power(value::StandardLoad) = get_value(value, Val(:current_active_power), Val(:mva)) -"""Get [`StandardLoad`](@ref) `current_reactive_power`.""" -get_current_reactive_power(value::StandardLoad) = get_value(value, Val(:current_reactive_power), Val(:mva)) -"""Get [`StandardLoad`](@ref) `max_constant_active_power`.""" -get_max_constant_active_power(value::StandardLoad) = get_value(value, Val(:max_constant_active_power), Val(:mva)) -"""Get [`StandardLoad`](@ref) `max_constant_reactive_power`.""" -get_max_constant_reactive_power(value::StandardLoad) = get_value(value, Val(:max_constant_reactive_power), Val(:mva)) -"""Get [`StandardLoad`](@ref) `max_impedance_active_power`.""" -get_max_impedance_active_power(value::StandardLoad) = get_value(value, Val(:max_impedance_active_power), Val(:mva)) -"""Get [`StandardLoad`](@ref) `max_impedance_reactive_power`.""" -get_max_impedance_reactive_power(value::StandardLoad) = get_value(value, Val(:max_impedance_reactive_power), Val(:mva)) -"""Get [`StandardLoad`](@ref) `max_current_active_power`.""" -get_max_current_active_power(value::StandardLoad) = get_value(value, Val(:max_current_active_power), Val(:mva)) -"""Get [`StandardLoad`](@ref) `max_current_reactive_power`.""" -get_max_current_reactive_power(value::StandardLoad) = get_value(value, Val(:max_current_reactive_power), Val(:mva)) + +_get_base_power(value::StandardLoad) = value.base_power +"""Get [`StandardLoad`](@ref) `constant_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_constant_active_power_unitful`](@ref).""" +get_constant_active_power(value::StandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:constant_active_power), Val(:mva), units)) +"""Get [`StandardLoad`](@ref) `constant_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_constant_active_power`](@ref).""" +get_constant_active_power_unitful(value::StandardLoad, units) = get_value(value, Val(:constant_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_constant_active_power), ::Type{ StandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_constant_active_power_unitful), ::Type{ StandardLoad }) = InfrastructureSystems.SU +"""Get [`StandardLoad`](@ref) `constant_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_constant_reactive_power_unitful`](@ref).""" +get_constant_reactive_power(value::StandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:constant_reactive_power), Val(:mva), units)) +"""Get [`StandardLoad`](@ref) `constant_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_constant_reactive_power`](@ref).""" +get_constant_reactive_power_unitful(value::StandardLoad, units) = get_value(value, Val(:constant_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_constant_reactive_power), ::Type{ StandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_constant_reactive_power_unitful), ::Type{ StandardLoad }) = InfrastructureSystems.SU +"""Get [`StandardLoad`](@ref) `impedance_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_impedance_active_power_unitful`](@ref).""" +get_impedance_active_power(value::StandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:impedance_active_power), Val(:mva), units)) +"""Get [`StandardLoad`](@ref) `impedance_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_impedance_active_power`](@ref).""" +get_impedance_active_power_unitful(value::StandardLoad, units) = get_value(value, Val(:impedance_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_impedance_active_power), ::Type{ StandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_impedance_active_power_unitful), ::Type{ StandardLoad }) = InfrastructureSystems.SU +"""Get [`StandardLoad`](@ref) `impedance_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_impedance_reactive_power_unitful`](@ref).""" +get_impedance_reactive_power(value::StandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:impedance_reactive_power), Val(:mva), units)) +"""Get [`StandardLoad`](@ref) `impedance_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_impedance_reactive_power`](@ref).""" +get_impedance_reactive_power_unitful(value::StandardLoad, units) = get_value(value, Val(:impedance_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_impedance_reactive_power), ::Type{ StandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_impedance_reactive_power_unitful), ::Type{ StandardLoad }) = InfrastructureSystems.SU +"""Get [`StandardLoad`](@ref) `current_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_current_active_power_unitful`](@ref).""" +get_current_active_power(value::StandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:current_active_power), Val(:mva), units)) +"""Get [`StandardLoad`](@ref) `current_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_current_active_power`](@ref).""" +get_current_active_power_unitful(value::StandardLoad, units) = get_value(value, Val(:current_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_current_active_power), ::Type{ StandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_current_active_power_unitful), ::Type{ StandardLoad }) = InfrastructureSystems.SU +"""Get [`StandardLoad`](@ref) `current_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_current_reactive_power_unitful`](@ref).""" +get_current_reactive_power(value::StandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:current_reactive_power), Val(:mva), units)) +"""Get [`StandardLoad`](@ref) `current_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_current_reactive_power`](@ref).""" +get_current_reactive_power_unitful(value::StandardLoad, units) = get_value(value, Val(:current_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_current_reactive_power), ::Type{ StandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_current_reactive_power_unitful), ::Type{ StandardLoad }) = InfrastructureSystems.SU +"""Get [`StandardLoad`](@ref) `max_constant_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_constant_active_power_unitful`](@ref).""" +get_max_constant_active_power(value::StandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_constant_active_power), Val(:mva), units)) +"""Get [`StandardLoad`](@ref) `max_constant_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_constant_active_power`](@ref).""" +get_max_constant_active_power_unitful(value::StandardLoad, units) = get_value(value, Val(:max_constant_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_constant_active_power), ::Type{ StandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_constant_active_power_unitful), ::Type{ StandardLoad }) = InfrastructureSystems.SU +"""Get [`StandardLoad`](@ref) `max_constant_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_constant_reactive_power_unitful`](@ref).""" +get_max_constant_reactive_power(value::StandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_constant_reactive_power), Val(:mva), units)) +"""Get [`StandardLoad`](@ref) `max_constant_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_constant_reactive_power`](@ref).""" +get_max_constant_reactive_power_unitful(value::StandardLoad, units) = get_value(value, Val(:max_constant_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_constant_reactive_power), ::Type{ StandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_constant_reactive_power_unitful), ::Type{ StandardLoad }) = InfrastructureSystems.SU +"""Get [`StandardLoad`](@ref) `max_impedance_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_impedance_active_power_unitful`](@ref).""" +get_max_impedance_active_power(value::StandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_impedance_active_power), Val(:mva), units)) +"""Get [`StandardLoad`](@ref) `max_impedance_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_impedance_active_power`](@ref).""" +get_max_impedance_active_power_unitful(value::StandardLoad, units) = get_value(value, Val(:max_impedance_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_impedance_active_power), ::Type{ StandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_impedance_active_power_unitful), ::Type{ StandardLoad }) = InfrastructureSystems.SU +"""Get [`StandardLoad`](@ref) `max_impedance_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_impedance_reactive_power_unitful`](@ref).""" +get_max_impedance_reactive_power(value::StandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_impedance_reactive_power), Val(:mva), units)) +"""Get [`StandardLoad`](@ref) `max_impedance_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_impedance_reactive_power`](@ref).""" +get_max_impedance_reactive_power_unitful(value::StandardLoad, units) = get_value(value, Val(:max_impedance_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_impedance_reactive_power), ::Type{ StandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_impedance_reactive_power_unitful), ::Type{ StandardLoad }) = InfrastructureSystems.SU +"""Get [`StandardLoad`](@ref) `max_current_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_current_active_power_unitful`](@ref).""" +get_max_current_active_power(value::StandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_current_active_power), Val(:mva), units)) +"""Get [`StandardLoad`](@ref) `max_current_active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_current_active_power`](@ref).""" +get_max_current_active_power_unitful(value::StandardLoad, units) = get_value(value, Val(:max_current_active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_current_active_power), ::Type{ StandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_current_active_power_unitful), ::Type{ StandardLoad }) = InfrastructureSystems.SU +"""Get [`StandardLoad`](@ref) `max_current_reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_max_current_reactive_power_unitful`](@ref).""" +get_max_current_reactive_power(value::StandardLoad, units) = InfrastructureSystems._strip_units(get_value(value, Val(:max_current_reactive_power), Val(:mva), units)) +"""Get [`StandardLoad`](@ref) `max_current_reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_max_current_reactive_power`](@ref).""" +get_max_current_reactive_power_unitful(value::StandardLoad, units) = get_value(value, Val(:max_current_reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_max_current_reactive_power), ::Type{ StandardLoad }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_max_current_reactive_power_unitful), ::Type{ StandardLoad }) = InfrastructureSystems.SU """Get [`StandardLoad`](@ref) `conformity`.""" get_conformity(value::StandardLoad) = value.conformity """Get [`StandardLoad`](@ref) `services`.""" diff --git a/src/models/generated/SynchronousCondenser.jl b/src/models/generated/SynchronousCondenser.jl index f74c9ae611..1c80ab1640 100644 --- a/src/models/generated/SynchronousCondenser.jl +++ b/src/models/generated/SynchronousCondenser.jl @@ -94,16 +94,32 @@ get_name(value::SynchronousCondenser) = value.name get_available(value::SynchronousCondenser) = value.available """Get [`SynchronousCondenser`](@ref) `bus`.""" get_bus(value::SynchronousCondenser) = value.bus -"""Get [`SynchronousCondenser`](@ref) `reactive_power`.""" -get_reactive_power(value::SynchronousCondenser) = get_value(value, Val(:reactive_power), Val(:mva)) -"""Get [`SynchronousCondenser`](@ref) `rating`.""" -get_rating(value::SynchronousCondenser) = get_value(value, Val(:rating), Val(:mva)) -"""Get [`SynchronousCondenser`](@ref) `reactive_power_limits`.""" -get_reactive_power_limits(value::SynchronousCondenser) = get_value(value, Val(:reactive_power_limits), Val(:mva)) -"""Get [`SynchronousCondenser`](@ref) `base_power`.""" -get_base_power(value::SynchronousCondenser) = value.base_power -"""Get [`SynchronousCondenser`](@ref) `active_power_losses`.""" -get_active_power_losses(value::SynchronousCondenser) = get_value(value, Val(:active_power_losses), Val(:mva)) +"""Get [`SynchronousCondenser`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::SynchronousCondenser, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`SynchronousCondenser`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::SynchronousCondenser, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ SynchronousCondenser }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ SynchronousCondenser }) = InfrastructureSystems.SU +"""Get [`SynchronousCondenser`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::SynchronousCondenser, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`SynchronousCondenser`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::SynchronousCondenser, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ SynchronousCondenser }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ SynchronousCondenser }) = InfrastructureSystems.SU +"""Get [`SynchronousCondenser`](@ref) `reactive_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_unitful`](@ref).""" +get_reactive_power_limits(value::SynchronousCondenser, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits), Val(:mva), units)) +"""Get [`SynchronousCondenser`](@ref) `reactive_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits`](@ref).""" +get_reactive_power_limits_unitful(value::SynchronousCondenser, units) = get_value(value, Val(:reactive_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits), ::Type{ SynchronousCondenser }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_unitful), ::Type{ SynchronousCondenser }) = InfrastructureSystems.SU + +_get_base_power(value::SynchronousCondenser) = value.base_power +"""Get [`SynchronousCondenser`](@ref) `active_power_losses` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_losses_unitful`](@ref).""" +get_active_power_losses(value::SynchronousCondenser, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_losses), Val(:mva), units)) +"""Get [`SynchronousCondenser`](@ref) `active_power_losses` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_losses`](@ref).""" +get_active_power_losses_unitful(value::SynchronousCondenser, units) = get_value(value, Val(:active_power_losses), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_losses), ::Type{ SynchronousCondenser }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_losses_unitful), ::Type{ SynchronousCondenser }) = InfrastructureSystems.SU """Get [`SynchronousCondenser`](@ref) `services`.""" get_services(value::SynchronousCondenser) = value.services """Get [`SynchronousCondenser`](@ref) `dynamic_injector`.""" diff --git a/src/models/generated/TModelHVDCLine.jl b/src/models/generated/TModelHVDCLine.jl index 04e6f64e37..b70d542178 100644 --- a/src/models/generated/TModelHVDCLine.jl +++ b/src/models/generated/TModelHVDCLine.jl @@ -94,8 +94,12 @@ end get_name(value::TModelHVDCLine) = value.name """Get [`TModelHVDCLine`](@ref) `available`.""" get_available(value::TModelHVDCLine) = value.available -"""Get [`TModelHVDCLine`](@ref) `active_power_flow`.""" -get_active_power_flow(value::TModelHVDCLine) = get_value(value, Val(:active_power_flow), Val(:mva)) +"""Get [`TModelHVDCLine`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_unitful`](@ref).""" +get_active_power_flow(value::TModelHVDCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow), Val(:mva), units)) +"""Get [`TModelHVDCLine`](@ref) `active_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow`](@ref).""" +get_active_power_flow_unitful(value::TModelHVDCLine, units) = get_value(value, Val(:active_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow), ::Type{ TModelHVDCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_unitful), ::Type{ TModelHVDCLine }) = InfrastructureSystems.SU """Get [`TModelHVDCLine`](@ref) `arc`.""" get_arc(value::TModelHVDCLine) = value.arc """Get [`TModelHVDCLine`](@ref) `r`.""" @@ -104,10 +108,18 @@ get_r(value::TModelHVDCLine) = value.r get_l(value::TModelHVDCLine) = value.l """Get [`TModelHVDCLine`](@ref) `c`.""" get_c(value::TModelHVDCLine) = value.c -"""Get [`TModelHVDCLine`](@ref) `active_power_limits_from`.""" -get_active_power_limits_from(value::TModelHVDCLine) = get_value(value, Val(:active_power_limits_from), Val(:mva)) -"""Get [`TModelHVDCLine`](@ref) `active_power_limits_to`.""" -get_active_power_limits_to(value::TModelHVDCLine) = get_value(value, Val(:active_power_limits_to), Val(:mva)) +"""Get [`TModelHVDCLine`](@ref) `active_power_limits_from` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_from_unitful`](@ref).""" +get_active_power_limits_from(value::TModelHVDCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits_from), Val(:mva), units)) +"""Get [`TModelHVDCLine`](@ref) `active_power_limits_from` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits_from`](@ref).""" +get_active_power_limits_from_unitful(value::TModelHVDCLine, units) = get_value(value, Val(:active_power_limits_from), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_from), ::Type{ TModelHVDCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_from_unitful), ::Type{ TModelHVDCLine }) = InfrastructureSystems.SU +"""Get [`TModelHVDCLine`](@ref) `active_power_limits_to` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_to_unitful`](@ref).""" +get_active_power_limits_to(value::TModelHVDCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits_to), Val(:mva), units)) +"""Get [`TModelHVDCLine`](@ref) `active_power_limits_to` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits_to`](@ref).""" +get_active_power_limits_to_unitful(value::TModelHVDCLine, units) = get_value(value, Val(:active_power_limits_to), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_to), ::Type{ TModelHVDCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_to_unitful), ::Type{ TModelHVDCLine }) = InfrastructureSystems.SU """Get [`TModelHVDCLine`](@ref) `services`.""" get_services(value::TModelHVDCLine) = value.services """Get [`TModelHVDCLine`](@ref) `ext`.""" diff --git a/src/models/generated/TapTransformer.jl b/src/models/generated/TapTransformer.jl index 0dbbfc9499..5c21a58c5a 100644 --- a/src/models/generated/TapTransformer.jl +++ b/src/models/generated/TapTransformer.jl @@ -134,32 +134,64 @@ end get_name(value::TapTransformer) = value.name """Get [`TapTransformer`](@ref) `available`.""" get_available(value::TapTransformer) = value.available -"""Get [`TapTransformer`](@ref) `active_power_flow`.""" -get_active_power_flow(value::TapTransformer) = get_value(value, Val(:active_power_flow), Val(:mva)) -"""Get [`TapTransformer`](@ref) `reactive_power_flow`.""" -get_reactive_power_flow(value::TapTransformer) = get_value(value, Val(:reactive_power_flow), Val(:mva)) +"""Get [`TapTransformer`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_unitful`](@ref).""" +get_active_power_flow(value::TapTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow), Val(:mva), units)) +"""Get [`TapTransformer`](@ref) `active_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow`](@ref).""" +get_active_power_flow_unitful(value::TapTransformer, units) = get_value(value, Val(:active_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow), ::Type{ TapTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_unitful), ::Type{ TapTransformer }) = InfrastructureSystems.SU +"""Get [`TapTransformer`](@ref) `reactive_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_flow_unitful`](@ref).""" +get_reactive_power_flow(value::TapTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_flow), Val(:mva), units)) +"""Get [`TapTransformer`](@ref) `reactive_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_flow`](@ref).""" +get_reactive_power_flow_unitful(value::TapTransformer, units) = get_value(value, Val(:reactive_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow), ::Type{ TapTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_unitful), ::Type{ TapTransformer }) = InfrastructureSystems.SU """Get [`TapTransformer`](@ref) `arc`.""" get_arc(value::TapTransformer) = value.arc -"""Get [`TapTransformer`](@ref) `r`.""" -get_r(value::TapTransformer) = get_value(value, Val(:r), Val(:ohm)) -"""Get [`TapTransformer`](@ref) `x`.""" -get_x(value::TapTransformer) = get_value(value, Val(:x), Val(:ohm)) -"""Get [`TapTransformer`](@ref) `primary_shunt`.""" -get_primary_shunt(value::TapTransformer) = get_value(value, Val(:primary_shunt), Val(:siemens)) +"""Get [`TapTransformer`](@ref) `r` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_unitful`](@ref).""" +get_r(value::TapTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r), Val(:ohm), units)) +"""Get [`TapTransformer`](@ref) `r` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r`](@ref).""" +get_r_unitful(value::TapTransformer, units) = get_value(value, Val(:r), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r), ::Type{ TapTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_unitful), ::Type{ TapTransformer }) = InfrastructureSystems.SU +"""Get [`TapTransformer`](@ref) `x` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_unitful`](@ref).""" +get_x(value::TapTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x), Val(:ohm), units)) +"""Get [`TapTransformer`](@ref) `x` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x`](@ref).""" +get_x_unitful(value::TapTransformer, units) = get_value(value, Val(:x), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x), ::Type{ TapTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_unitful), ::Type{ TapTransformer }) = InfrastructureSystems.SU +"""Get [`TapTransformer`](@ref) `primary_shunt` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_primary_shunt_unitful`](@ref).""" +get_primary_shunt(value::TapTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:primary_shunt), Val(:siemens), units)) +"""Get [`TapTransformer`](@ref) `primary_shunt` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_primary_shunt`](@ref).""" +get_primary_shunt_unitful(value::TapTransformer, units) = get_value(value, Val(:primary_shunt), Val(:siemens), units) +InfrastructureSystems.display_units_arg(::typeof(get_primary_shunt), ::Type{ TapTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_primary_shunt_unitful), ::Type{ TapTransformer }) = InfrastructureSystems.SU """Get [`TapTransformer`](@ref) `tap`.""" get_tap(value::TapTransformer) = value.tap -"""Get [`TapTransformer`](@ref) `rating`.""" -get_rating(value::TapTransformer) = get_value(value, Val(:rating), Val(:mva)) -"""Get [`TapTransformer`](@ref) `base_power`.""" -get_base_power(value::TapTransformer) = value.base_power +"""Get [`TapTransformer`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::TapTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`TapTransformer`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::TapTransformer, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ TapTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ TapTransformer }) = InfrastructureSystems.SU + +_get_base_power(value::TapTransformer) = value.base_power """Get [`TapTransformer`](@ref) `base_voltage_primary`.""" get_base_voltage_primary(value::TapTransformer) = value.base_voltage_primary """Get [`TapTransformer`](@ref) `base_voltage_secondary`.""" get_base_voltage_secondary(value::TapTransformer) = value.base_voltage_secondary -"""Get [`TapTransformer`](@ref) `rating_b`.""" -get_rating_b(value::TapTransformer) = get_value(value, Val(:rating_b), Val(:mva)) -"""Get [`TapTransformer`](@ref) `rating_c`.""" -get_rating_c(value::TapTransformer) = get_value(value, Val(:rating_c), Val(:mva)) +"""Get [`TapTransformer`](@ref) `rating_b` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_b_unitful`](@ref).""" +get_rating_b(value::TapTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_b), Val(:mva), units)) +"""Get [`TapTransformer`](@ref) `rating_b` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_b`](@ref).""" +get_rating_b_unitful(value::TapTransformer, units) = get_value(value, Val(:rating_b), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_b), ::Type{ TapTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_b_unitful), ::Type{ TapTransformer }) = InfrastructureSystems.SU +"""Get [`TapTransformer`](@ref) `rating_c` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_c_unitful`](@ref).""" +get_rating_c(value::TapTransformer, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_c), Val(:mva), units)) +"""Get [`TapTransformer`](@ref) `rating_c` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_c`](@ref).""" +get_rating_c_unitful(value::TapTransformer, units) = get_value(value, Val(:rating_c), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_c), ::Type{ TapTransformer }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_c_unitful), ::Type{ TapTransformer }) = InfrastructureSystems.SU """Get [`TapTransformer`](@ref) `winding_group_number`.""" get_winding_group_number(value::TapTransformer) = value.winding_group_number """Get [`TapTransformer`](@ref) `control_objective`.""" diff --git a/src/models/generated/ThermalMultiStart.jl b/src/models/generated/ThermalMultiStart.jl index af65cc3da8..9e6012993b 100644 --- a/src/models/generated/ThermalMultiStart.jl +++ b/src/models/generated/ThermalMultiStart.jl @@ -157,24 +157,52 @@ get_available(value::ThermalMultiStart) = value.available get_status(value::ThermalMultiStart) = value.status """Get [`ThermalMultiStart`](@ref) `bus`.""" get_bus(value::ThermalMultiStart) = value.bus -"""Get [`ThermalMultiStart`](@ref) `active_power`.""" -get_active_power(value::ThermalMultiStart) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`ThermalMultiStart`](@ref) `reactive_power`.""" -get_reactive_power(value::ThermalMultiStart) = get_value(value, Val(:reactive_power), Val(:mva)) -"""Get [`ThermalMultiStart`](@ref) `rating`.""" -get_rating(value::ThermalMultiStart) = get_value(value, Val(:rating), Val(:mva)) +"""Get [`ThermalMultiStart`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::ThermalMultiStart, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`ThermalMultiStart`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::ThermalMultiStart, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ ThermalMultiStart }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ ThermalMultiStart }) = InfrastructureSystems.SU +"""Get [`ThermalMultiStart`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::ThermalMultiStart, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`ThermalMultiStart`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::ThermalMultiStart, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ ThermalMultiStart }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ ThermalMultiStart }) = InfrastructureSystems.SU +"""Get [`ThermalMultiStart`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::ThermalMultiStart, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`ThermalMultiStart`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::ThermalMultiStart, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ ThermalMultiStart }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ ThermalMultiStart }) = InfrastructureSystems.SU """Get [`ThermalMultiStart`](@ref) `prime_mover_type`.""" get_prime_mover_type(value::ThermalMultiStart) = value.prime_mover_type """Get [`ThermalMultiStart`](@ref) `fuel`.""" get_fuel(value::ThermalMultiStart) = value.fuel -"""Get [`ThermalMultiStart`](@ref) `active_power_limits`.""" -get_active_power_limits(value::ThermalMultiStart) = get_value(value, Val(:active_power_limits), Val(:mva)) -"""Get [`ThermalMultiStart`](@ref) `reactive_power_limits`.""" -get_reactive_power_limits(value::ThermalMultiStart) = get_value(value, Val(:reactive_power_limits), Val(:mva)) -"""Get [`ThermalMultiStart`](@ref) `ramp_limits`.""" -get_ramp_limits(value::ThermalMultiStart) = get_value(value, Val(:ramp_limits), Val(:mva)) -"""Get [`ThermalMultiStart`](@ref) `power_trajectory`.""" -get_power_trajectory(value::ThermalMultiStart) = get_value(value, Val(:power_trajectory), Val(:mva)) +"""Get [`ThermalMultiStart`](@ref) `active_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_unitful`](@ref).""" +get_active_power_limits(value::ThermalMultiStart, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits), Val(:mva), units)) +"""Get [`ThermalMultiStart`](@ref) `active_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits`](@ref).""" +get_active_power_limits_unitful(value::ThermalMultiStart, units) = get_value(value, Val(:active_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits), ::Type{ ThermalMultiStart }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_unitful), ::Type{ ThermalMultiStart }) = InfrastructureSystems.SU +"""Get [`ThermalMultiStart`](@ref) `reactive_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_unitful`](@ref).""" +get_reactive_power_limits(value::ThermalMultiStart, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits), Val(:mva), units)) +"""Get [`ThermalMultiStart`](@ref) `reactive_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits`](@ref).""" +get_reactive_power_limits_unitful(value::ThermalMultiStart, units) = get_value(value, Val(:reactive_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits), ::Type{ ThermalMultiStart }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_unitful), ::Type{ ThermalMultiStart }) = InfrastructureSystems.SU +"""Get [`ThermalMultiStart`](@ref) `ramp_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_ramp_limits_unitful`](@ref).""" +get_ramp_limits(value::ThermalMultiStart, units) = InfrastructureSystems._strip_units(get_value(value, Val(:ramp_limits), Val(:mva), units)) +"""Get [`ThermalMultiStart`](@ref) `ramp_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_ramp_limits`](@ref).""" +get_ramp_limits_unitful(value::ThermalMultiStart, units) = get_value(value, Val(:ramp_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_ramp_limits), ::Type{ ThermalMultiStart }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_ramp_limits_unitful), ::Type{ ThermalMultiStart }) = InfrastructureSystems.SU +"""Get [`ThermalMultiStart`](@ref) `power_trajectory` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_power_trajectory_unitful`](@ref).""" +get_power_trajectory(value::ThermalMultiStart, units) = InfrastructureSystems._strip_units(get_value(value, Val(:power_trajectory), Val(:mva), units)) +"""Get [`ThermalMultiStart`](@ref) `power_trajectory` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_power_trajectory`](@ref).""" +get_power_trajectory_unitful(value::ThermalMultiStart, units) = get_value(value, Val(:power_trajectory), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_power_trajectory), ::Type{ ThermalMultiStart }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_power_trajectory_unitful), ::Type{ ThermalMultiStart }) = InfrastructureSystems.SU """Get [`ThermalMultiStart`](@ref) `time_limits`.""" get_time_limits(value::ThermalMultiStart) = value.time_limits """Get [`ThermalMultiStart`](@ref) `start_time_limits`.""" @@ -183,8 +211,8 @@ get_start_time_limits(value::ThermalMultiStart) = value.start_time_limits get_start_types(value::ThermalMultiStart) = value.start_types """Get [`ThermalMultiStart`](@ref) `operation_cost`.""" get_operation_cost(value::ThermalMultiStart) = value.operation_cost -"""Get [`ThermalMultiStart`](@ref) `base_power`.""" -get_base_power(value::ThermalMultiStart) = value.base_power + +_get_base_power(value::ThermalMultiStart) = value.base_power """Get [`ThermalMultiStart`](@ref) `services`.""" get_services(value::ThermalMultiStart) = value.services """Get [`ThermalMultiStart`](@ref) `time_at_status`.""" diff --git a/src/models/generated/ThermalStandard.jl b/src/models/generated/ThermalStandard.jl index aa1bae316d..2ee01d1b1e 100644 --- a/src/models/generated/ThermalStandard.jl +++ b/src/models/generated/ThermalStandard.jl @@ -143,22 +143,46 @@ get_available(value::ThermalStandard) = value.available get_status(value::ThermalStandard) = value.status """Get [`ThermalStandard`](@ref) `bus`.""" get_bus(value::ThermalStandard) = value.bus -"""Get [`ThermalStandard`](@ref) `active_power`.""" -get_active_power(value::ThermalStandard) = get_value(value, Val(:active_power), Val(:mva)) -"""Get [`ThermalStandard`](@ref) `reactive_power`.""" -get_reactive_power(value::ThermalStandard) = get_value(value, Val(:reactive_power), Val(:mva)) -"""Get [`ThermalStandard`](@ref) `rating`.""" -get_rating(value::ThermalStandard) = get_value(value, Val(:rating), Val(:mva)) -"""Get [`ThermalStandard`](@ref) `active_power_limits`.""" -get_active_power_limits(value::ThermalStandard) = get_value(value, Val(:active_power_limits), Val(:mva)) -"""Get [`ThermalStandard`](@ref) `reactive_power_limits`.""" -get_reactive_power_limits(value::ThermalStandard) = get_value(value, Val(:reactive_power_limits), Val(:mva)) -"""Get [`ThermalStandard`](@ref) `ramp_limits`.""" -get_ramp_limits(value::ThermalStandard) = get_value(value, Val(:ramp_limits), Val(:mva)) +"""Get [`ThermalStandard`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_unitful`](@ref).""" +get_active_power(value::ThermalStandard, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) +"""Get [`ThermalStandard`](@ref) `active_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power`](@ref).""" +get_active_power_unitful(value::ThermalStandard, units) = get_value(value, Val(:active_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ ThermalStandard }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ ThermalStandard }) = InfrastructureSystems.SU +"""Get [`ThermalStandard`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" +get_reactive_power(value::ThermalStandard, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) +"""Get [`ThermalStandard`](@ref) `reactive_power` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power`](@ref).""" +get_reactive_power_unitful(value::ThermalStandard, units) = get_value(value, Val(:reactive_power), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ ThermalStandard }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ ThermalStandard }) = InfrastructureSystems.SU +"""Get [`ThermalStandard`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::ThermalStandard, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`ThermalStandard`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::ThermalStandard, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ ThermalStandard }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ ThermalStandard }) = InfrastructureSystems.SU +"""Get [`ThermalStandard`](@ref) `active_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_unitful`](@ref).""" +get_active_power_limits(value::ThermalStandard, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits), Val(:mva), units)) +"""Get [`ThermalStandard`](@ref) `active_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits`](@ref).""" +get_active_power_limits_unitful(value::ThermalStandard, units) = get_value(value, Val(:active_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits), ::Type{ ThermalStandard }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_unitful), ::Type{ ThermalStandard }) = InfrastructureSystems.SU +"""Get [`ThermalStandard`](@ref) `reactive_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_unitful`](@ref).""" +get_reactive_power_limits(value::ThermalStandard, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits), Val(:mva), units)) +"""Get [`ThermalStandard`](@ref) `reactive_power_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits`](@ref).""" +get_reactive_power_limits_unitful(value::ThermalStandard, units) = get_value(value, Val(:reactive_power_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits), ::Type{ ThermalStandard }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_unitful), ::Type{ ThermalStandard }) = InfrastructureSystems.SU +"""Get [`ThermalStandard`](@ref) `ramp_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_ramp_limits_unitful`](@ref).""" +get_ramp_limits(value::ThermalStandard, units) = InfrastructureSystems._strip_units(get_value(value, Val(:ramp_limits), Val(:mva), units)) +"""Get [`ThermalStandard`](@ref) `ramp_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_ramp_limits`](@ref).""" +get_ramp_limits_unitful(value::ThermalStandard, units) = get_value(value, Val(:ramp_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_ramp_limits), ::Type{ ThermalStandard }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_ramp_limits_unitful), ::Type{ ThermalStandard }) = InfrastructureSystems.SU """Get [`ThermalStandard`](@ref) `operation_cost`.""" get_operation_cost(value::ThermalStandard) = value.operation_cost -"""Get [`ThermalStandard`](@ref) `base_power`.""" -get_base_power(value::ThermalStandard) = value.base_power + +_get_base_power(value::ThermalStandard) = value.base_power """Get [`ThermalStandard`](@ref) `time_limits`.""" get_time_limits(value::ThermalStandard) = value.time_limits """Get [`ThermalStandard`](@ref) `must_run`.""" diff --git a/src/models/generated/Transformer2W.jl b/src/models/generated/Transformer2W.jl index 84e0ccc088..7c6009879c 100644 --- a/src/models/generated/Transformer2W.jl +++ b/src/models/generated/Transformer2W.jl @@ -124,30 +124,62 @@ end get_name(value::Transformer2W) = value.name """Get [`Transformer2W`](@ref) `available`.""" get_available(value::Transformer2W) = value.available -"""Get [`Transformer2W`](@ref) `active_power_flow`.""" -get_active_power_flow(value::Transformer2W) = get_value(value, Val(:active_power_flow), Val(:mva)) -"""Get [`Transformer2W`](@ref) `reactive_power_flow`.""" -get_reactive_power_flow(value::Transformer2W) = get_value(value, Val(:reactive_power_flow), Val(:mva)) +"""Get [`Transformer2W`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_unitful`](@ref).""" +get_active_power_flow(value::Transformer2W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow), Val(:mva), units)) +"""Get [`Transformer2W`](@ref) `active_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow`](@ref).""" +get_active_power_flow_unitful(value::Transformer2W, units) = get_value(value, Val(:active_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow), ::Type{ Transformer2W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_unitful), ::Type{ Transformer2W }) = InfrastructureSystems.SU +"""Get [`Transformer2W`](@ref) `reactive_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_flow_unitful`](@ref).""" +get_reactive_power_flow(value::Transformer2W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_flow), Val(:mva), units)) +"""Get [`Transformer2W`](@ref) `reactive_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_flow`](@ref).""" +get_reactive_power_flow_unitful(value::Transformer2W, units) = get_value(value, Val(:reactive_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow), ::Type{ Transformer2W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_unitful), ::Type{ Transformer2W }) = InfrastructureSystems.SU """Get [`Transformer2W`](@ref) `arc`.""" get_arc(value::Transformer2W) = value.arc -"""Get [`Transformer2W`](@ref) `r`.""" -get_r(value::Transformer2W) = get_value(value, Val(:r), Val(:ohm)) -"""Get [`Transformer2W`](@ref) `x`.""" -get_x(value::Transformer2W) = get_value(value, Val(:x), Val(:ohm)) -"""Get [`Transformer2W`](@ref) `primary_shunt`.""" -get_primary_shunt(value::Transformer2W) = get_value(value, Val(:primary_shunt), Val(:siemens)) -"""Get [`Transformer2W`](@ref) `rating`.""" -get_rating(value::Transformer2W) = get_value(value, Val(:rating), Val(:mva)) -"""Get [`Transformer2W`](@ref) `base_power`.""" -get_base_power(value::Transformer2W) = value.base_power +"""Get [`Transformer2W`](@ref) `r` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_unitful`](@ref).""" +get_r(value::Transformer2W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r), Val(:ohm), units)) +"""Get [`Transformer2W`](@ref) `r` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r`](@ref).""" +get_r_unitful(value::Transformer2W, units) = get_value(value, Val(:r), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r), ::Type{ Transformer2W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_unitful), ::Type{ Transformer2W }) = InfrastructureSystems.SU +"""Get [`Transformer2W`](@ref) `x` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_unitful`](@ref).""" +get_x(value::Transformer2W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x), Val(:ohm), units)) +"""Get [`Transformer2W`](@ref) `x` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x`](@ref).""" +get_x_unitful(value::Transformer2W, units) = get_value(value, Val(:x), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x), ::Type{ Transformer2W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_unitful), ::Type{ Transformer2W }) = InfrastructureSystems.SU +"""Get [`Transformer2W`](@ref) `primary_shunt` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_primary_shunt_unitful`](@ref).""" +get_primary_shunt(value::Transformer2W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:primary_shunt), Val(:siemens), units)) +"""Get [`Transformer2W`](@ref) `primary_shunt` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_primary_shunt`](@ref).""" +get_primary_shunt_unitful(value::Transformer2W, units) = get_value(value, Val(:primary_shunt), Val(:siemens), units) +InfrastructureSystems.display_units_arg(::typeof(get_primary_shunt), ::Type{ Transformer2W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_primary_shunt_unitful), ::Type{ Transformer2W }) = InfrastructureSystems.SU +"""Get [`Transformer2W`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::Transformer2W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`Transformer2W`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::Transformer2W, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ Transformer2W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ Transformer2W }) = InfrastructureSystems.SU + +_get_base_power(value::Transformer2W) = value.base_power """Get [`Transformer2W`](@ref) `base_voltage_primary`.""" get_base_voltage_primary(value::Transformer2W) = value.base_voltage_primary """Get [`Transformer2W`](@ref) `base_voltage_secondary`.""" get_base_voltage_secondary(value::Transformer2W) = value.base_voltage_secondary -"""Get [`Transformer2W`](@ref) `rating_b`.""" -get_rating_b(value::Transformer2W) = get_value(value, Val(:rating_b), Val(:mva)) -"""Get [`Transformer2W`](@ref) `rating_c`.""" -get_rating_c(value::Transformer2W) = get_value(value, Val(:rating_c), Val(:mva)) +"""Get [`Transformer2W`](@ref) `rating_b` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_b_unitful`](@ref).""" +get_rating_b(value::Transformer2W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_b), Val(:mva), units)) +"""Get [`Transformer2W`](@ref) `rating_b` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_b`](@ref).""" +get_rating_b_unitful(value::Transformer2W, units) = get_value(value, Val(:rating_b), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_b), ::Type{ Transformer2W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_b_unitful), ::Type{ Transformer2W }) = InfrastructureSystems.SU +"""Get [`Transformer2W`](@ref) `rating_c` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_c_unitful`](@ref).""" +get_rating_c(value::Transformer2W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_c), Val(:mva), units)) +"""Get [`Transformer2W`](@ref) `rating_c` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_c`](@ref).""" +get_rating_c_unitful(value::Transformer2W, units) = get_value(value, Val(:rating_c), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_c), ::Type{ Transformer2W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_c_unitful), ::Type{ Transformer2W }) = InfrastructureSystems.SU """Get [`Transformer2W`](@ref) `winding_group_number`.""" get_winding_group_number(value::Transformer2W) = value.winding_group_number """Get [`Transformer2W`](@ref) `services`.""" diff --git a/src/models/generated/Transformer3W.jl b/src/models/generated/Transformer3W.jl index c5d98dc334..0b124e9dff 100644 --- a/src/models/generated/Transformer3W.jl +++ b/src/models/generated/Transformer3W.jl @@ -297,60 +297,144 @@ get_secondary_star_arc(value::Transformer3W) = value.secondary_star_arc get_tertiary_star_arc(value::Transformer3W) = value.tertiary_star_arc """Get [`Transformer3W`](@ref) `star_bus`.""" get_star_bus(value::Transformer3W) = value.star_bus -"""Get [`Transformer3W`](@ref) `active_power_flow_primary`.""" -get_active_power_flow_primary(value::Transformer3W) = get_value(value, Val(:active_power_flow_primary), Val(:mva)) -"""Get [`Transformer3W`](@ref) `reactive_power_flow_primary`.""" -get_reactive_power_flow_primary(value::Transformer3W) = get_value(value, Val(:reactive_power_flow_primary), Val(:mva)) -"""Get [`Transformer3W`](@ref) `active_power_flow_secondary`.""" -get_active_power_flow_secondary(value::Transformer3W) = get_value(value, Val(:active_power_flow_secondary), Val(:mva)) -"""Get [`Transformer3W`](@ref) `reactive_power_flow_secondary`.""" -get_reactive_power_flow_secondary(value::Transformer3W) = get_value(value, Val(:reactive_power_flow_secondary), Val(:mva)) -"""Get [`Transformer3W`](@ref) `active_power_flow_tertiary`.""" -get_active_power_flow_tertiary(value::Transformer3W) = get_value(value, Val(:active_power_flow_tertiary), Val(:mva)) -"""Get [`Transformer3W`](@ref) `reactive_power_flow_tertiary`.""" -get_reactive_power_flow_tertiary(value::Transformer3W) = get_value(value, Val(:reactive_power_flow_tertiary), Val(:mva)) -"""Get [`Transformer3W`](@ref) `r_primary`.""" -get_r_primary(value::Transformer3W) = get_value(value, Val(:r_primary), Val(:ohm)) -"""Get [`Transformer3W`](@ref) `x_primary`.""" -get_x_primary(value::Transformer3W) = get_value(value, Val(:x_primary), Val(:ohm)) -"""Get [`Transformer3W`](@ref) `r_secondary`.""" -get_r_secondary(value::Transformer3W) = get_value(value, Val(:r_secondary), Val(:ohm)) -"""Get [`Transformer3W`](@ref) `x_secondary`.""" -get_x_secondary(value::Transformer3W) = get_value(value, Val(:x_secondary), Val(:ohm)) -"""Get [`Transformer3W`](@ref) `r_tertiary`.""" -get_r_tertiary(value::Transformer3W) = get_value(value, Val(:r_tertiary), Val(:ohm)) -"""Get [`Transformer3W`](@ref) `x_tertiary`.""" -get_x_tertiary(value::Transformer3W) = get_value(value, Val(:x_tertiary), Val(:ohm)) -"""Get [`Transformer3W`](@ref) `rating`.""" -get_rating(value::Transformer3W) = get_value(value, Val(:rating), Val(:mva)) -"""Get [`Transformer3W`](@ref) `r_12`.""" -get_r_12(value::Transformer3W) = get_value(value, Val(:r_12), Val(:ohm)) -"""Get [`Transformer3W`](@ref) `x_12`.""" -get_x_12(value::Transformer3W) = get_value(value, Val(:x_12), Val(:ohm)) -"""Get [`Transformer3W`](@ref) `r_23`.""" -get_r_23(value::Transformer3W) = get_value(value, Val(:r_23), Val(:ohm)) -"""Get [`Transformer3W`](@ref) `x_23`.""" -get_x_23(value::Transformer3W) = get_value(value, Val(:x_23), Val(:ohm)) -"""Get [`Transformer3W`](@ref) `r_13`.""" -get_r_13(value::Transformer3W) = get_value(value, Val(:r_13), Val(:ohm)) -"""Get [`Transformer3W`](@ref) `x_13`.""" -get_x_13(value::Transformer3W) = get_value(value, Val(:x_13), Val(:ohm)) -"""Get [`Transformer3W`](@ref) `base_power_12`.""" -get_base_power_12(value::Transformer3W) = value.base_power_12 -"""Get [`Transformer3W`](@ref) `base_power_23`.""" -get_base_power_23(value::Transformer3W) = value.base_power_23 -"""Get [`Transformer3W`](@ref) `base_power_13`.""" -get_base_power_13(value::Transformer3W) = value.base_power_13 +"""Get [`Transformer3W`](@ref) `active_power_flow_primary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_primary_unitful`](@ref).""" +get_active_power_flow_primary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow_primary), Val(:mva), units)) +"""Get [`Transformer3W`](@ref) `active_power_flow_primary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow_primary`](@ref).""" +get_active_power_flow_primary_unitful(value::Transformer3W, units) = get_value(value, Val(:active_power_flow_primary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_primary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_primary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `reactive_power_flow_primary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_flow_primary_unitful`](@ref).""" +get_reactive_power_flow_primary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_flow_primary), Val(:mva), units)) +"""Get [`Transformer3W`](@ref) `reactive_power_flow_primary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_flow_primary`](@ref).""" +get_reactive_power_flow_primary_unitful(value::Transformer3W, units) = get_value(value, Val(:reactive_power_flow_primary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_primary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_primary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `active_power_flow_secondary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_secondary_unitful`](@ref).""" +get_active_power_flow_secondary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow_secondary), Val(:mva), units)) +"""Get [`Transformer3W`](@ref) `active_power_flow_secondary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow_secondary`](@ref).""" +get_active_power_flow_secondary_unitful(value::Transformer3W, units) = get_value(value, Val(:active_power_flow_secondary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_secondary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_secondary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `reactive_power_flow_secondary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_flow_secondary_unitful`](@ref).""" +get_reactive_power_flow_secondary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_flow_secondary), Val(:mva), units)) +"""Get [`Transformer3W`](@ref) `reactive_power_flow_secondary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_flow_secondary`](@ref).""" +get_reactive_power_flow_secondary_unitful(value::Transformer3W, units) = get_value(value, Val(:reactive_power_flow_secondary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_secondary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_secondary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `active_power_flow_tertiary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_tertiary_unitful`](@ref).""" +get_active_power_flow_tertiary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow_tertiary), Val(:mva), units)) +"""Get [`Transformer3W`](@ref) `active_power_flow_tertiary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow_tertiary`](@ref).""" +get_active_power_flow_tertiary_unitful(value::Transformer3W, units) = get_value(value, Val(:active_power_flow_tertiary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_tertiary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_tertiary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `reactive_power_flow_tertiary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_flow_tertiary_unitful`](@ref).""" +get_reactive_power_flow_tertiary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_flow_tertiary), Val(:mva), units)) +"""Get [`Transformer3W`](@ref) `reactive_power_flow_tertiary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_flow_tertiary`](@ref).""" +get_reactive_power_flow_tertiary_unitful(value::Transformer3W, units) = get_value(value, Val(:reactive_power_flow_tertiary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_tertiary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_flow_tertiary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `r_primary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_primary_unitful`](@ref).""" +get_r_primary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r_primary), Val(:ohm), units)) +"""Get [`Transformer3W`](@ref) `r_primary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r_primary`](@ref).""" +get_r_primary_unitful(value::Transformer3W, units) = get_value(value, Val(:r_primary), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r_primary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_primary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `x_primary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_primary_unitful`](@ref).""" +get_x_primary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x_primary), Val(:ohm), units)) +"""Get [`Transformer3W`](@ref) `x_primary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x_primary`](@ref).""" +get_x_primary_unitful(value::Transformer3W, units) = get_value(value, Val(:x_primary), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x_primary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_primary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `r_secondary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_secondary_unitful`](@ref).""" +get_r_secondary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r_secondary), Val(:ohm), units)) +"""Get [`Transformer3W`](@ref) `r_secondary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r_secondary`](@ref).""" +get_r_secondary_unitful(value::Transformer3W, units) = get_value(value, Val(:r_secondary), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r_secondary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_secondary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `x_secondary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_secondary_unitful`](@ref).""" +get_x_secondary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x_secondary), Val(:ohm), units)) +"""Get [`Transformer3W`](@ref) `x_secondary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x_secondary`](@ref).""" +get_x_secondary_unitful(value::Transformer3W, units) = get_value(value, Val(:x_secondary), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x_secondary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_secondary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `r_tertiary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_tertiary_unitful`](@ref).""" +get_r_tertiary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r_tertiary), Val(:ohm), units)) +"""Get [`Transformer3W`](@ref) `r_tertiary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r_tertiary`](@ref).""" +get_r_tertiary_unitful(value::Transformer3W, units) = get_value(value, Val(:r_tertiary), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r_tertiary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_tertiary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `x_tertiary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_tertiary_unitful`](@ref).""" +get_x_tertiary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x_tertiary), Val(:ohm), units)) +"""Get [`Transformer3W`](@ref) `x_tertiary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x_tertiary`](@ref).""" +get_x_tertiary_unitful(value::Transformer3W, units) = get_value(value, Val(:x_tertiary), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x_tertiary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_tertiary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`Transformer3W`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::Transformer3W, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `r_12` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_12_unitful`](@ref).""" +get_r_12(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r_12), Val(:ohm), units)) +"""Get [`Transformer3W`](@ref) `r_12` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r_12`](@ref).""" +get_r_12_unitful(value::Transformer3W, units) = get_value(value, Val(:r_12), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r_12), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_12_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `x_12` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_12_unitful`](@ref).""" +get_x_12(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x_12), Val(:ohm), units)) +"""Get [`Transformer3W`](@ref) `x_12` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x_12`](@ref).""" +get_x_12_unitful(value::Transformer3W, units) = get_value(value, Val(:x_12), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x_12), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_12_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `r_23` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_23_unitful`](@ref).""" +get_r_23(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r_23), Val(:ohm), units)) +"""Get [`Transformer3W`](@ref) `r_23` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r_23`](@ref).""" +get_r_23_unitful(value::Transformer3W, units) = get_value(value, Val(:r_23), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r_23), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_23_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `x_23` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_23_unitful`](@ref).""" +get_x_23(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x_23), Val(:ohm), units)) +"""Get [`Transformer3W`](@ref) `x_23` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x_23`](@ref).""" +get_x_23_unitful(value::Transformer3W, units) = get_value(value, Val(:x_23), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x_23), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_23_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `r_13` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_13_unitful`](@ref).""" +get_r_13(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:r_13), Val(:ohm), units)) +"""Get [`Transformer3W`](@ref) `r_13` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_r_13`](@ref).""" +get_r_13_unitful(value::Transformer3W, units) = get_value(value, Val(:r_13), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_r_13), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_r_13_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `x_13` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_x_13_unitful`](@ref).""" +get_x_13(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:x_13), Val(:ohm), units)) +"""Get [`Transformer3W`](@ref) `x_13` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_x_13`](@ref).""" +get_x_13_unitful(value::Transformer3W, units) = get_value(value, Val(:x_13), Val(:ohm), units) +InfrastructureSystems.display_units_arg(::typeof(get_x_13), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_x_13_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU + +_get_base_power_12(value::Transformer3W) = value.base_power_12 + +_get_base_power_23(value::Transformer3W) = value.base_power_23 + +_get_base_power_13(value::Transformer3W) = value.base_power_13 """Get [`Transformer3W`](@ref) `base_voltage_primary`.""" get_base_voltage_primary(value::Transformer3W) = value.base_voltage_primary """Get [`Transformer3W`](@ref) `base_voltage_secondary`.""" get_base_voltage_secondary(value::Transformer3W) = value.base_voltage_secondary """Get [`Transformer3W`](@ref) `base_voltage_tertiary`.""" get_base_voltage_tertiary(value::Transformer3W) = value.base_voltage_tertiary -"""Get [`Transformer3W`](@ref) `g`.""" -get_g(value::Transformer3W) = get_value(value, Val(:g), Val(:siemens)) -"""Get [`Transformer3W`](@ref) `b`.""" -get_b(value::Transformer3W) = get_value(value, Val(:b), Val(:siemens)) +"""Get [`Transformer3W`](@ref) `g` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_g_unitful`](@ref).""" +get_g(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:g), Val(:siemens), units)) +"""Get [`Transformer3W`](@ref) `g` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_g`](@ref).""" +get_g_unitful(value::Transformer3W, units) = get_value(value, Val(:g), Val(:siemens), units) +InfrastructureSystems.display_units_arg(::typeof(get_g), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_g_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `b` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_b_unitful`](@ref).""" +get_b(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:b), Val(:siemens), units)) +"""Get [`Transformer3W`](@ref) `b` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_b`](@ref).""" +get_b_unitful(value::Transformer3W, units) = get_value(value, Val(:b), Val(:siemens), units) +InfrastructureSystems.display_units_arg(::typeof(get_b), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_b_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU """Get [`Transformer3W`](@ref) `primary_turns_ratio`.""" get_primary_turns_ratio(value::Transformer3W) = value.primary_turns_ratio """Get [`Transformer3W`](@ref) `secondary_turns_ratio`.""" @@ -363,12 +447,24 @@ get_available_primary(value::Transformer3W) = value.available_primary get_available_secondary(value::Transformer3W) = value.available_secondary """Get [`Transformer3W`](@ref) `available_tertiary`.""" get_available_tertiary(value::Transformer3W) = value.available_tertiary -"""Get [`Transformer3W`](@ref) `rating_primary`.""" -get_rating_primary(value::Transformer3W) = get_value(value, Val(:rating_primary), Val(:mva)) -"""Get [`Transformer3W`](@ref) `rating_secondary`.""" -get_rating_secondary(value::Transformer3W) = get_value(value, Val(:rating_secondary), Val(:mva)) -"""Get [`Transformer3W`](@ref) `rating_tertiary`.""" -get_rating_tertiary(value::Transformer3W) = get_value(value, Val(:rating_tertiary), Val(:mva)) +"""Get [`Transformer3W`](@ref) `rating_primary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_primary_unitful`](@ref).""" +get_rating_primary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_primary), Val(:mva), units)) +"""Get [`Transformer3W`](@ref) `rating_primary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_primary`](@ref).""" +get_rating_primary_unitful(value::Transformer3W, units) = get_value(value, Val(:rating_primary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_primary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_primary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `rating_secondary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_secondary_unitful`](@ref).""" +get_rating_secondary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_secondary), Val(:mva), units)) +"""Get [`Transformer3W`](@ref) `rating_secondary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_secondary`](@ref).""" +get_rating_secondary_unitful(value::Transformer3W, units) = get_value(value, Val(:rating_secondary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_secondary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_secondary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU +"""Get [`Transformer3W`](@ref) `rating_tertiary` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_tertiary_unitful`](@ref).""" +get_rating_tertiary(value::Transformer3W, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_tertiary), Val(:mva), units)) +"""Get [`Transformer3W`](@ref) `rating_tertiary` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_tertiary`](@ref).""" +get_rating_tertiary_unitful(value::Transformer3W, units) = get_value(value, Val(:rating_tertiary), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_tertiary), ::Type{ Transformer3W }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_tertiary_unitful), ::Type{ Transformer3W }) = InfrastructureSystems.SU """Get [`Transformer3W`](@ref) `primary_group_number`.""" get_primary_group_number(value::Transformer3W) = value.primary_group_number """Get [`Transformer3W`](@ref) `secondary_group_number`.""" diff --git a/src/models/generated/TransmissionInterface.jl b/src/models/generated/TransmissionInterface.jl index fb6e1125e1..227d3334f6 100644 --- a/src/models/generated/TransmissionInterface.jl +++ b/src/models/generated/TransmissionInterface.jl @@ -64,8 +64,12 @@ end get_name(value::TransmissionInterface) = value.name """Get [`TransmissionInterface`](@ref) `available`.""" get_available(value::TransmissionInterface) = value.available -"""Get [`TransmissionInterface`](@ref) `active_power_flow_limits`.""" -get_active_power_flow_limits(value::TransmissionInterface) = get_value(value, Val(:active_power_flow_limits), Val(:mva)) +"""Get [`TransmissionInterface`](@ref) `active_power_flow_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_limits_unitful`](@ref).""" +get_active_power_flow_limits(value::TransmissionInterface, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow_limits), Val(:mva), units)) +"""Get [`TransmissionInterface`](@ref) `active_power_flow_limits` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow_limits`](@ref).""" +get_active_power_flow_limits_unitful(value::TransmissionInterface, units) = get_value(value, Val(:active_power_flow_limits), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_limits), ::Type{ TransmissionInterface }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_limits_unitful), ::Type{ TransmissionInterface }) = InfrastructureSystems.SU """Get [`TransmissionInterface`](@ref) `violation_penalty`.""" get_violation_penalty(value::TransmissionInterface) = value.violation_penalty """Get [`TransmissionInterface`](@ref) `direction_mapping`.""" diff --git a/src/models/generated/TwoTerminalGenericHVDCLine.jl b/src/models/generated/TwoTerminalGenericHVDCLine.jl index 74777e5145..72c58a55e5 100644 --- a/src/models/generated/TwoTerminalGenericHVDCLine.jl +++ b/src/models/generated/TwoTerminalGenericHVDCLine.jl @@ -94,18 +94,38 @@ end get_name(value::TwoTerminalGenericHVDCLine) = value.name """Get [`TwoTerminalGenericHVDCLine`](@ref) `available`.""" get_available(value::TwoTerminalGenericHVDCLine) = value.available -"""Get [`TwoTerminalGenericHVDCLine`](@ref) `active_power_flow`.""" -get_active_power_flow(value::TwoTerminalGenericHVDCLine) = get_value(value, Val(:active_power_flow), Val(:mva)) +"""Get [`TwoTerminalGenericHVDCLine`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_unitful`](@ref).""" +get_active_power_flow(value::TwoTerminalGenericHVDCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow), Val(:mva), units)) +"""Get [`TwoTerminalGenericHVDCLine`](@ref) `active_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow`](@ref).""" +get_active_power_flow_unitful(value::TwoTerminalGenericHVDCLine, units) = get_value(value, Val(:active_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow), ::Type{ TwoTerminalGenericHVDCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_unitful), ::Type{ TwoTerminalGenericHVDCLine }) = InfrastructureSystems.SU """Get [`TwoTerminalGenericHVDCLine`](@ref) `arc`.""" get_arc(value::TwoTerminalGenericHVDCLine) = value.arc -"""Get [`TwoTerminalGenericHVDCLine`](@ref) `active_power_limits_from`.""" -get_active_power_limits_from(value::TwoTerminalGenericHVDCLine) = get_value(value, Val(:active_power_limits_from), Val(:mva)) -"""Get [`TwoTerminalGenericHVDCLine`](@ref) `active_power_limits_to`.""" -get_active_power_limits_to(value::TwoTerminalGenericHVDCLine) = get_value(value, Val(:active_power_limits_to), Val(:mva)) -"""Get [`TwoTerminalGenericHVDCLine`](@ref) `reactive_power_limits_from`.""" -get_reactive_power_limits_from(value::TwoTerminalGenericHVDCLine) = get_value(value, Val(:reactive_power_limits_from), Val(:mva)) -"""Get [`TwoTerminalGenericHVDCLine`](@ref) `reactive_power_limits_to`.""" -get_reactive_power_limits_to(value::TwoTerminalGenericHVDCLine) = get_value(value, Val(:reactive_power_limits_to), Val(:mva)) +"""Get [`TwoTerminalGenericHVDCLine`](@ref) `active_power_limits_from` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_from_unitful`](@ref).""" +get_active_power_limits_from(value::TwoTerminalGenericHVDCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits_from), Val(:mva), units)) +"""Get [`TwoTerminalGenericHVDCLine`](@ref) `active_power_limits_from` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits_from`](@ref).""" +get_active_power_limits_from_unitful(value::TwoTerminalGenericHVDCLine, units) = get_value(value, Val(:active_power_limits_from), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_from), ::Type{ TwoTerminalGenericHVDCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_from_unitful), ::Type{ TwoTerminalGenericHVDCLine }) = InfrastructureSystems.SU +"""Get [`TwoTerminalGenericHVDCLine`](@ref) `active_power_limits_to` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_to_unitful`](@ref).""" +get_active_power_limits_to(value::TwoTerminalGenericHVDCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits_to), Val(:mva), units)) +"""Get [`TwoTerminalGenericHVDCLine`](@ref) `active_power_limits_to` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits_to`](@ref).""" +get_active_power_limits_to_unitful(value::TwoTerminalGenericHVDCLine, units) = get_value(value, Val(:active_power_limits_to), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_to), ::Type{ TwoTerminalGenericHVDCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_to_unitful), ::Type{ TwoTerminalGenericHVDCLine }) = InfrastructureSystems.SU +"""Get [`TwoTerminalGenericHVDCLine`](@ref) `reactive_power_limits_from` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_from_unitful`](@ref).""" +get_reactive_power_limits_from(value::TwoTerminalGenericHVDCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits_from), Val(:mva), units)) +"""Get [`TwoTerminalGenericHVDCLine`](@ref) `reactive_power_limits_from` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits_from`](@ref).""" +get_reactive_power_limits_from_unitful(value::TwoTerminalGenericHVDCLine, units) = get_value(value, Val(:reactive_power_limits_from), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_from), ::Type{ TwoTerminalGenericHVDCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_from_unitful), ::Type{ TwoTerminalGenericHVDCLine }) = InfrastructureSystems.SU +"""Get [`TwoTerminalGenericHVDCLine`](@ref) `reactive_power_limits_to` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_to_unitful`](@ref).""" +get_reactive_power_limits_to(value::TwoTerminalGenericHVDCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits_to), Val(:mva), units)) +"""Get [`TwoTerminalGenericHVDCLine`](@ref) `reactive_power_limits_to` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits_to`](@ref).""" +get_reactive_power_limits_to_unitful(value::TwoTerminalGenericHVDCLine, units) = get_value(value, Val(:reactive_power_limits_to), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_to), ::Type{ TwoTerminalGenericHVDCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_to_unitful), ::Type{ TwoTerminalGenericHVDCLine }) = InfrastructureSystems.SU """Get [`TwoTerminalGenericHVDCLine`](@ref) `loss`.""" get_loss(value::TwoTerminalGenericHVDCLine) = value.loss """Get [`TwoTerminalGenericHVDCLine`](@ref) `services`.""" diff --git a/src/models/generated/TwoTerminalLCCLine.jl b/src/models/generated/TwoTerminalLCCLine.jl index 3ff7f2ef7e..0b26d97b0c 100644 --- a/src/models/generated/TwoTerminalLCCLine.jl +++ b/src/models/generated/TwoTerminalLCCLine.jl @@ -241,8 +241,12 @@ get_name(value::TwoTerminalLCCLine) = value.name get_available(value::TwoTerminalLCCLine) = value.available """Get [`TwoTerminalLCCLine`](@ref) `arc`.""" get_arc(value::TwoTerminalLCCLine) = value.arc -"""Get [`TwoTerminalLCCLine`](@ref) `active_power_flow`.""" -get_active_power_flow(value::TwoTerminalLCCLine) = get_value(value, Val(:active_power_flow), Val(:mva)) +"""Get [`TwoTerminalLCCLine`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_unitful`](@ref).""" +get_active_power_flow(value::TwoTerminalLCCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow), Val(:mva), units)) +"""Get [`TwoTerminalLCCLine`](@ref) `active_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow`](@ref).""" +get_active_power_flow_unitful(value::TwoTerminalLCCLine, units) = get_value(value, Val(:active_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow), ::Type{ TwoTerminalLCCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_unitful), ::Type{ TwoTerminalLCCLine }) = InfrastructureSystems.SU """Get [`TwoTerminalLCCLine`](@ref) `r`.""" get_r(value::TwoTerminalLCCLine) = value.r """Get [`TwoTerminalLCCLine`](@ref) `transfer_setpoint`.""" @@ -301,14 +305,30 @@ get_inverter_tap_step(value::TwoTerminalLCCLine) = value.inverter_tap_step get_inverter_extinction_angle(value::TwoTerminalLCCLine) = value.inverter_extinction_angle """Get [`TwoTerminalLCCLine`](@ref) `inverter_capacitor_reactance`.""" get_inverter_capacitor_reactance(value::TwoTerminalLCCLine) = value.inverter_capacitor_reactance -"""Get [`TwoTerminalLCCLine`](@ref) `active_power_limits_from`.""" -get_active_power_limits_from(value::TwoTerminalLCCLine) = get_value(value, Val(:active_power_limits_from), Val(:mva)) -"""Get [`TwoTerminalLCCLine`](@ref) `active_power_limits_to`.""" -get_active_power_limits_to(value::TwoTerminalLCCLine) = get_value(value, Val(:active_power_limits_to), Val(:mva)) -"""Get [`TwoTerminalLCCLine`](@ref) `reactive_power_limits_from`.""" -get_reactive_power_limits_from(value::TwoTerminalLCCLine) = get_value(value, Val(:reactive_power_limits_from), Val(:mva)) -"""Get [`TwoTerminalLCCLine`](@ref) `reactive_power_limits_to`.""" -get_reactive_power_limits_to(value::TwoTerminalLCCLine) = get_value(value, Val(:reactive_power_limits_to), Val(:mva)) +"""Get [`TwoTerminalLCCLine`](@ref) `active_power_limits_from` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_from_unitful`](@ref).""" +get_active_power_limits_from(value::TwoTerminalLCCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits_from), Val(:mva), units)) +"""Get [`TwoTerminalLCCLine`](@ref) `active_power_limits_from` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits_from`](@ref).""" +get_active_power_limits_from_unitful(value::TwoTerminalLCCLine, units) = get_value(value, Val(:active_power_limits_from), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_from), ::Type{ TwoTerminalLCCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_from_unitful), ::Type{ TwoTerminalLCCLine }) = InfrastructureSystems.SU +"""Get [`TwoTerminalLCCLine`](@ref) `active_power_limits_to` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_to_unitful`](@ref).""" +get_active_power_limits_to(value::TwoTerminalLCCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits_to), Val(:mva), units)) +"""Get [`TwoTerminalLCCLine`](@ref) `active_power_limits_to` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits_to`](@ref).""" +get_active_power_limits_to_unitful(value::TwoTerminalLCCLine, units) = get_value(value, Val(:active_power_limits_to), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_to), ::Type{ TwoTerminalLCCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_to_unitful), ::Type{ TwoTerminalLCCLine }) = InfrastructureSystems.SU +"""Get [`TwoTerminalLCCLine`](@ref) `reactive_power_limits_from` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_from_unitful`](@ref).""" +get_reactive_power_limits_from(value::TwoTerminalLCCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits_from), Val(:mva), units)) +"""Get [`TwoTerminalLCCLine`](@ref) `reactive_power_limits_from` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits_from`](@ref).""" +get_reactive_power_limits_from_unitful(value::TwoTerminalLCCLine, units) = get_value(value, Val(:reactive_power_limits_from), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_from), ::Type{ TwoTerminalLCCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_from_unitful), ::Type{ TwoTerminalLCCLine }) = InfrastructureSystems.SU +"""Get [`TwoTerminalLCCLine`](@ref) `reactive_power_limits_to` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_to_unitful`](@ref).""" +get_reactive_power_limits_to(value::TwoTerminalLCCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits_to), Val(:mva), units)) +"""Get [`TwoTerminalLCCLine`](@ref) `reactive_power_limits_to` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits_to`](@ref).""" +get_reactive_power_limits_to_unitful(value::TwoTerminalLCCLine, units) = get_value(value, Val(:reactive_power_limits_to), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_to), ::Type{ TwoTerminalLCCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_to_unitful), ::Type{ TwoTerminalLCCLine }) = InfrastructureSystems.SU """Get [`TwoTerminalLCCLine`](@ref) `loss`.""" get_loss(value::TwoTerminalLCCLine) = value.loss """Get [`TwoTerminalLCCLine`](@ref) `services`.""" diff --git a/src/models/generated/TwoTerminalVSCLine.jl b/src/models/generated/TwoTerminalVSCLine.jl index 5a5221bca9..637eed292d 100644 --- a/src/models/generated/TwoTerminalVSCLine.jl +++ b/src/models/generated/TwoTerminalVSCLine.jl @@ -206,20 +206,40 @@ get_name(value::TwoTerminalVSCLine) = value.name get_available(value::TwoTerminalVSCLine) = value.available """Get [`TwoTerminalVSCLine`](@ref) `arc`.""" get_arc(value::TwoTerminalVSCLine) = value.arc -"""Get [`TwoTerminalVSCLine`](@ref) `active_power_flow`.""" -get_active_power_flow(value::TwoTerminalVSCLine) = get_value(value, Val(:active_power_flow), Val(:mva)) -"""Get [`TwoTerminalVSCLine`](@ref) `rating`.""" -get_rating(value::TwoTerminalVSCLine) = get_value(value, Val(:rating), Val(:mva)) -"""Get [`TwoTerminalVSCLine`](@ref) `active_power_limits_from`.""" -get_active_power_limits_from(value::TwoTerminalVSCLine) = get_value(value, Val(:active_power_limits_from), Val(:mva)) -"""Get [`TwoTerminalVSCLine`](@ref) `active_power_limits_to`.""" -get_active_power_limits_to(value::TwoTerminalVSCLine) = get_value(value, Val(:active_power_limits_to), Val(:mva)) +"""Get [`TwoTerminalVSCLine`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_flow_unitful`](@ref).""" +get_active_power_flow(value::TwoTerminalVSCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_flow), Val(:mva), units)) +"""Get [`TwoTerminalVSCLine`](@ref) `active_power_flow` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_flow`](@ref).""" +get_active_power_flow_unitful(value::TwoTerminalVSCLine, units) = get_value(value, Val(:active_power_flow), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_flow_unitful), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +"""Get [`TwoTerminalVSCLine`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +get_rating(value::TwoTerminalVSCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating), Val(:mva), units)) +"""Get [`TwoTerminalVSCLine`](@ref) `rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating`](@ref).""" +get_rating_unitful(value::TwoTerminalVSCLine, units) = get_value(value, Val(:rating), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_unitful), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +"""Get [`TwoTerminalVSCLine`](@ref) `active_power_limits_from` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_from_unitful`](@ref).""" +get_active_power_limits_from(value::TwoTerminalVSCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits_from), Val(:mva), units)) +"""Get [`TwoTerminalVSCLine`](@ref) `active_power_limits_from` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits_from`](@ref).""" +get_active_power_limits_from_unitful(value::TwoTerminalVSCLine, units) = get_value(value, Val(:active_power_limits_from), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_from), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_from_unitful), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +"""Get [`TwoTerminalVSCLine`](@ref) `active_power_limits_to` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_active_power_limits_to_unitful`](@ref).""" +get_active_power_limits_to(value::TwoTerminalVSCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power_limits_to), Val(:mva), units)) +"""Get [`TwoTerminalVSCLine`](@ref) `active_power_limits_to` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_active_power_limits_to`](@ref).""" +get_active_power_limits_to_unitful(value::TwoTerminalVSCLine, units) = get_value(value, Val(:active_power_limits_to), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_to), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_limits_to_unitful), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU """Get [`TwoTerminalVSCLine`](@ref) `g`.""" get_g(value::TwoTerminalVSCLine) = value.g """Get [`TwoTerminalVSCLine`](@ref) `dc_current`.""" get_dc_current(value::TwoTerminalVSCLine) = value.dc_current -"""Get [`TwoTerminalVSCLine`](@ref) `reactive_power_from`.""" -get_reactive_power_from(value::TwoTerminalVSCLine) = get_value(value, Val(:reactive_power_from), Val(:mva)) +"""Get [`TwoTerminalVSCLine`](@ref) `reactive_power_from` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_from_unitful`](@ref).""" +get_reactive_power_from(value::TwoTerminalVSCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_from), Val(:mva), units)) +"""Get [`TwoTerminalVSCLine`](@ref) `reactive_power_from` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_from`](@ref).""" +get_reactive_power_from_unitful(value::TwoTerminalVSCLine, units) = get_value(value, Val(:reactive_power_from), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_from), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_from_unitful), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU """Get [`TwoTerminalVSCLine`](@ref) `dc_voltage_control_from`.""" get_dc_voltage_control_from(value::TwoTerminalVSCLine) = value.dc_voltage_control_from """Get [`TwoTerminalVSCLine`](@ref) `ac_voltage_control_from`.""" @@ -232,16 +252,28 @@ get_ac_setpoint_from(value::TwoTerminalVSCLine) = value.ac_setpoint_from get_converter_loss_from(value::TwoTerminalVSCLine) = value.converter_loss_from """Get [`TwoTerminalVSCLine`](@ref) `max_dc_current_from`.""" get_max_dc_current_from(value::TwoTerminalVSCLine) = value.max_dc_current_from -"""Get [`TwoTerminalVSCLine`](@ref) `rating_from`.""" -get_rating_from(value::TwoTerminalVSCLine) = get_value(value, Val(:rating_from), Val(:mva)) -"""Get [`TwoTerminalVSCLine`](@ref) `reactive_power_limits_from`.""" -get_reactive_power_limits_from(value::TwoTerminalVSCLine) = get_value(value, Val(:reactive_power_limits_from), Val(:mva)) +"""Get [`TwoTerminalVSCLine`](@ref) `rating_from` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_from_unitful`](@ref).""" +get_rating_from(value::TwoTerminalVSCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_from), Val(:mva), units)) +"""Get [`TwoTerminalVSCLine`](@ref) `rating_from` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_from`](@ref).""" +get_rating_from_unitful(value::TwoTerminalVSCLine, units) = get_value(value, Val(:rating_from), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_from), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_from_unitful), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +"""Get [`TwoTerminalVSCLine`](@ref) `reactive_power_limits_from` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_from_unitful`](@ref).""" +get_reactive_power_limits_from(value::TwoTerminalVSCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits_from), Val(:mva), units)) +"""Get [`TwoTerminalVSCLine`](@ref) `reactive_power_limits_from` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits_from`](@ref).""" +get_reactive_power_limits_from_unitful(value::TwoTerminalVSCLine, units) = get_value(value, Val(:reactive_power_limits_from), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_from), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_from_unitful), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU """Get [`TwoTerminalVSCLine`](@ref) `power_factor_weighting_fraction_from`.""" get_power_factor_weighting_fraction_from(value::TwoTerminalVSCLine) = value.power_factor_weighting_fraction_from """Get [`TwoTerminalVSCLine`](@ref) `voltage_limits_from`.""" get_voltage_limits_from(value::TwoTerminalVSCLine) = value.voltage_limits_from -"""Get [`TwoTerminalVSCLine`](@ref) `reactive_power_to`.""" -get_reactive_power_to(value::TwoTerminalVSCLine) = get_value(value, Val(:reactive_power_to), Val(:mva)) +"""Get [`TwoTerminalVSCLine`](@ref) `reactive_power_to` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_to_unitful`](@ref).""" +get_reactive_power_to(value::TwoTerminalVSCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_to), Val(:mva), units)) +"""Get [`TwoTerminalVSCLine`](@ref) `reactive_power_to` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_to`](@ref).""" +get_reactive_power_to_unitful(value::TwoTerminalVSCLine, units) = get_value(value, Val(:reactive_power_to), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_to), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_to_unitful), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU """Get [`TwoTerminalVSCLine`](@ref) `dc_voltage_control_to`.""" get_dc_voltage_control_to(value::TwoTerminalVSCLine) = value.dc_voltage_control_to """Get [`TwoTerminalVSCLine`](@ref) `ac_voltage_control_to`.""" @@ -254,10 +286,18 @@ get_ac_setpoint_to(value::TwoTerminalVSCLine) = value.ac_setpoint_to get_converter_loss_to(value::TwoTerminalVSCLine) = value.converter_loss_to """Get [`TwoTerminalVSCLine`](@ref) `max_dc_current_to`.""" get_max_dc_current_to(value::TwoTerminalVSCLine) = value.max_dc_current_to -"""Get [`TwoTerminalVSCLine`](@ref) `rating_to`.""" -get_rating_to(value::TwoTerminalVSCLine) = get_value(value, Val(:rating_to), Val(:mva)) -"""Get [`TwoTerminalVSCLine`](@ref) `reactive_power_limits_to`.""" -get_reactive_power_limits_to(value::TwoTerminalVSCLine) = get_value(value, Val(:reactive_power_limits_to), Val(:mva)) +"""Get [`TwoTerminalVSCLine`](@ref) `rating_to` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_to_unitful`](@ref).""" +get_rating_to(value::TwoTerminalVSCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:rating_to), Val(:mva), units)) +"""Get [`TwoTerminalVSCLine`](@ref) `rating_to` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_rating_to`](@ref).""" +get_rating_to_unitful(value::TwoTerminalVSCLine, units) = get_value(value, Val(:rating_to), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_rating_to), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_rating_to_unitful), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +"""Get [`TwoTerminalVSCLine`](@ref) `reactive_power_limits_to` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_reactive_power_limits_to_unitful`](@ref).""" +get_reactive_power_limits_to(value::TwoTerminalVSCLine, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits_to), Val(:mva), units)) +"""Get [`TwoTerminalVSCLine`](@ref) `reactive_power_limits_to` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_reactive_power_limits_to`](@ref).""" +get_reactive_power_limits_to_unitful(value::TwoTerminalVSCLine, units) = get_value(value, Val(:reactive_power_limits_to), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_to), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_to_unitful), ::Type{ TwoTerminalVSCLine }) = InfrastructureSystems.SU """Get [`TwoTerminalVSCLine`](@ref) `power_factor_weighting_fraction_to`.""" get_power_factor_weighting_fraction_to(value::TwoTerminalVSCLine) = value.power_factor_weighting_fraction_to """Get [`TwoTerminalVSCLine`](@ref) `voltage_limits_to`.""" diff --git a/src/models/generated/VariableReserveNonSpinning.jl b/src/models/generated/VariableReserveNonSpinning.jl index 74c369b671..f27af0704a 100644 --- a/src/models/generated/VariableReserveNonSpinning.jl +++ b/src/models/generated/VariableReserveNonSpinning.jl @@ -88,8 +88,12 @@ get_name(value::VariableReserveNonSpinning) = value.name get_available(value::VariableReserveNonSpinning) = value.available """Get [`VariableReserveNonSpinning`](@ref) `time_frame`.""" get_time_frame(value::VariableReserveNonSpinning) = value.time_frame -"""Get [`VariableReserveNonSpinning`](@ref) `requirement`.""" -get_requirement(value::VariableReserveNonSpinning) = get_value(value, Val(:requirement), Val(:mva)) +"""Get [`VariableReserveNonSpinning`](@ref) `requirement` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_requirement_unitful`](@ref).""" +get_requirement(value::VariableReserveNonSpinning, units) = InfrastructureSystems._strip_units(get_value(value, Val(:requirement), Val(:mva), units)) +"""Get [`VariableReserveNonSpinning`](@ref) `requirement` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_requirement`](@ref).""" +get_requirement_unitful(value::VariableReserveNonSpinning, units) = get_value(value, Val(:requirement), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_requirement), ::Type{ VariableReserveNonSpinning }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_requirement_unitful), ::Type{ VariableReserveNonSpinning }) = InfrastructureSystems.SU """Get [`VariableReserveNonSpinning`](@ref) `sustained_time`.""" get_sustained_time(value::VariableReserveNonSpinning) = value.sustained_time """Get [`VariableReserveNonSpinning`](@ref) `max_output_fraction`.""" diff --git a/src/models/generated/includes.jl b/src/models/generated/includes.jl index 07b81de264..8e143a1efb 100644 --- a/src/models/generated/includes.jl +++ b/src/models/generated/includes.jl @@ -485,15 +485,27 @@ export get_ac_voltage_control_to export get_active_power export get_active_power_flow export get_active_power_flow_limits +export get_active_power_flow_limits_unitful export get_active_power_flow_primary +export get_active_power_flow_primary_unitful export get_active_power_flow_secondary +export get_active_power_flow_secondary_unitful export get_active_power_flow_tertiary +export get_active_power_flow_tertiary_unitful +export get_active_power_flow_unitful export get_active_power_limits export get_active_power_limits_from +export get_active_power_limits_from_unitful export get_active_power_limits_pump +export get_active_power_limits_pump_unitful export get_active_power_limits_to +export get_active_power_limits_to_unitful +export get_active_power_limits_unitful export get_active_power_losses +export get_active_power_losses_unitful export get_active_power_pump +export get_active_power_pump_unitful +export get_active_power_unitful export get_admittance_limits export get_angle export get_angle_limits @@ -504,6 +516,7 @@ export get_available_primary export get_available_secondary export get_available_tertiary export get_b +export get_b_unitful export get_base_power export get_base_power_12 export get_base_power_13 @@ -526,7 +539,9 @@ export get_cf export get_compounding_resistance export get_conformity export get_constant_active_power +export get_constant_active_power_unitful export get_constant_reactive_power +export get_constant_reactive_power_unitful export get_contributing_services export get_control_mode export get_control_objective @@ -537,7 +552,9 @@ export get_conversion_factor export get_converter_loss_from export get_converter_loss_to export get_current_active_power +export get_current_active_power_unitful export get_current_reactive_power +export get_current_reactive_power_unitful export get_cycle_limits export get_d export get_dP_lim @@ -570,6 +587,7 @@ export get_feedback_flag export get_fh export get_fl export get_flow_limits +export get_flow_limits_unitful export get_frequency export get_from export get_from_area @@ -578,18 +596,22 @@ export get_fs export get_fuel export get_fuel_flag export get_g +export get_g_unitful export get_gate_openings export get_gate_position_limits export get_head_to_volume_factor export get_hysteresis_binary_logic export get_impedance_active_power +export get_impedance_active_power_unitful export get_impedance_reactive_power +export get_impedance_reactive_power_unitful export get_inflow export get_initial_ace export get_initial_level export get_initial_status export get_initial_storage_capacity_level export get_input_active_power_limits +export get_input_active_power_limits_unitful export get_input_code export get_input_code_1 export get_input_code_2 @@ -647,19 +669,28 @@ export get_loss_function export get_lv export get_magnitude export get_max_active_power +export get_max_active_power_unitful export get_max_constant_active_power +export get_max_constant_active_power_unitful export get_max_constant_reactive_power +export get_max_constant_reactive_power_unitful export get_max_current_active_power +export get_max_current_active_power_unitful export get_max_current_reactive_power +export get_max_current_reactive_power_unitful export get_max_dc_current export get_max_dc_current_from export get_max_dc_current_to export get_max_flow +export get_max_flow_unitful export get_max_impedance_active_power +export get_max_impedance_active_power_unitful export get_max_impedance_reactive_power +export get_max_impedance_reactive_power_unitful export get_max_output_fraction export get_max_participation_factor export get_max_reactive_power +export get_max_reactive_power_unitful export get_max_shunt_current export get_min_compounding_voltage export get_minimum_time @@ -673,8 +704,11 @@ export get_operation_cost export get_outflow export get_outflow_limits export get_output_active_power_limits +export get_output_active_power_limits_unitful export get_peak_active_power +export get_peak_active_power_unitful export get_peak_reactive_power +export get_peak_reactive_power_unitful export get_phase_angle_limits export get_power_factor export get_power_factor_weighting_fraction_from @@ -682,44 +716,72 @@ export get_power_factor_weighting_fraction_to export get_power_gate_openings export get_power_mode export get_power_trajectory +export get_power_trajectory_unitful export get_powerhouse_elevation export get_primary_group_number export get_primary_shunt +export get_primary_shunt_unitful export get_primary_star_arc export get_primary_turns_ratio export get_prime_mover_type export get_q_nl export get_r export get_r_12 +export get_r_12_unitful export get_r_13 +export get_r_13_unitful export get_r_23 +export get_r_23_unitful export get_r_load export get_r_primary +export get_r_primary_unitful export get_r_secondary +export get_r_secondary_unitful export get_r_tertiary +export get_r_tertiary_unitful +export get_r_unitful export get_ramp_limits +export get_ramp_limits_unitful export get_rated_current export get_rated_voltage export get_rating export get_rating_b +export get_rating_b_unitful export get_rating_c +export get_rating_c_unitful export get_rating_from +export get_rating_from_unitful export get_rating_primary +export get_rating_primary_unitful export get_rating_secondary +export get_rating_secondary_unitful export get_rating_tertiary +export get_rating_tertiary_unitful export get_rating_to +export get_rating_to_unitful +export get_rating_unitful export get_rc_rfd export get_reactive_power export get_reactive_power_flow export get_reactive_power_flow_primary +export get_reactive_power_flow_primary_unitful export get_reactive_power_flow_secondary +export get_reactive_power_flow_secondary_unitful export get_reactive_power_flow_tertiary +export get_reactive_power_flow_tertiary_unitful +export get_reactive_power_flow_unitful export get_reactive_power_from +export get_reactive_power_from_unitful export get_reactive_power_limits export get_reactive_power_limits_from +export get_reactive_power_limits_from_unitful export get_reactive_power_limits_to +export get_reactive_power_limits_to_unitful +export get_reactive_power_limits_unitful export get_reactive_power_required export get_reactive_power_to +export get_reactive_power_to_unitful +export get_reactive_power_unitful export get_rectifier_base_voltage export get_rectifier_bridges export get_rectifier_capacitor_reactance @@ -736,6 +798,7 @@ export get_remote_bus_control export get_remote_bus_control_1 export get_remote_bus_control_2 export get_requirement +export get_requirement_unitful export get_reserves export get_rf export get_rg @@ -756,6 +819,7 @@ export get_states export get_states_types export get_status export get_storage_capacity +export get_storage_capacity_unitful export get_storage_level_limits export get_storage_target export get_storage_technology_type @@ -794,11 +858,18 @@ export get_voltage_setpoint export get_winding_group_number export get_x export get_x_12 +export get_x_12_unitful export get_x_13 +export get_x_13_unitful export get_x_23 +export get_x_23_unitful export get_x_primary +export get_x_primary_unitful export get_x_secondary +export get_x_secondary_unitful export get_x_tertiary +export get_x_tertiary_unitful +export get_x_unitful export get_α export get_α_primary export get_α_secondary diff --git a/src/models/generation.jl b/src/models/generation.jl index f8be2dd13f..ebb5916580 100644 --- a/src/models/generation.jl +++ b/src/models/generation.jl @@ -30,13 +30,13 @@ end """ Return the max active power for the Renewable Generation calculated as the `rating` * `power_factor` """ -function get_max_active_power(d::T) where {T <: RenewableGen} - return get_rating(d) * get_power_factor(d) +function get_max_active_power(d::T, units) where {T <: RenewableGen} + return get_rating(d, units) * get_power_factor(d) end """ Return the max reactive power for the Renewable Generation calculated as the `rating` * sin(acos(`power_factor`)) """ -function get_max_reactive_power(d::T) where {T <: RenewableGen} - return get_rating(d) * sin(acos(get_power_factor(d))) +function get_max_reactive_power(d::T, units) where {T <: RenewableGen} + return get_rating(d, units) * sin(acos(get_power_factor(d))) end diff --git a/src/models/supplemental_accessors.jl b/src/models/supplemental_accessors.jl index 921871fac7..28857e8140 100644 --- a/src/models/supplemental_accessors.jl +++ b/src/models/supplemental_accessors.jl @@ -225,51 +225,50 @@ function get_series_admittance(::Union{PhaseShiftingTransformer3W, Transformer3W end """ -Return the max active power for a device as the max field in the named tuple returned by [`get_active_power_limits`](@ref). +Return the max active power for a device with explicit units specified. """ -function get_max_active_power(d::T) where {T <: StaticInjection} - return get_active_power_limits(d).max +function get_max_active_power(d::T, units) where {T <: StaticInjection} + return get_active_power_limits(d, units).max end """ -Return the max reactive power for a device as the max field in the named tuple returned by [`get_reactive_power_limits`](@ref). +Return the max reactive power for a device with explicit units specified. """ -function get_max_reactive_power(d::T)::Float64 where {T <: StaticInjection} - if isnothing(get_reactive_power_limits(d)) - return Inf - end - return get_reactive_power_limits(d).max +function get_max_reactive_power(d::T, units) where {T <: StaticInjection} + limits = get_reactive_power_limits(d, units) + isnothing(limits) && return Inf * units + return limits.max end """ Return the max reactive power for a [`RenewableDispatch`](@ref) generator calculated as the `rating` * `power_factor` if the field `reactive_power_limits` is `nothing` """ -function get_max_reactive_power(d::RenewableDispatch) - reactive_power_limits = get_reactive_power_limits(d) - if isnothing(reactive_power_limits) - return get_rating(d) * sin(acos(get_power_factor(d))) +function get_max_reactive_power(d::RenewableDispatch, units) + limits = get_reactive_power_limits(d, units) + if isnothing(limits) + return get_rating(d, units) * sin(acos(get_power_factor(d))) end - return reactive_power_limits.max + return limits.max end """ Generic fallback function for getting active power limits. Throws `ArgumentError` for devices that don't implement this function. """ -get_active_power_limits(::T) where {T <: Device} = +get_active_power_limits(::T, _) where {T <: Device} = throw(ArgumentError("get_active_power_limits not implemented for $T")) """ Generic fallback function for getting reactive power limits. Throws `ArgumentError` for devices that don't implement this function. """ -get_reactive_power_limits(::T) where {T <: Device} = +get_reactive_power_limits(::T, _) where {T <: Device} = throw(ArgumentError("get_reactive_power_limits not implemented for $T")) """ Generic fallback function for getting device rating. Throws `ArgumentError` for devices that don't implement this function. """ -get_rating(::T) where {T <: Device} = +get_rating(::T, _) where {T <: Device} = throw(ArgumentError("get_rating not implemented for $T")) """ Generic fallback function for getting power factor. Throws `ArgumentError` for devices @@ -280,12 +279,12 @@ get_power_factor(::T) where {T <: Device} = """ Calculate the maximum active power for a [`StandardLoad`](@ref) or [`InterruptibleStandardLoad`](@ref) - by summing the maximum constant, impedance, and current components assuming a 1.0 voltage magnitude at the bus. + with explicit units specified. """ -function get_max_active_power(d::Union{InterruptibleStandardLoad, StandardLoad}) - total_load = get_max_constant_active_power(d) - total_load += get_max_impedance_active_power(d) - total_load += get_max_current_active_power(d) +function get_max_active_power(d::Union{InterruptibleStandardLoad, StandardLoad}, units) + total_load = get_max_constant_active_power(d, units) + total_load += get_max_impedance_active_power(d, units) + total_load += get_max_current_active_power(d, units) return total_load end diff --git a/src/units/conversions.jl b/src/units/conversions.jl new file mode 100644 index 0000000000..b56112dc03 --- /dev/null +++ b/src/units/conversions.jl @@ -0,0 +1,222 @@ +#= +Unit conversion system for power systems components. + +Core abstraction: a UnitCategory defines a physical quantity (power, impedance, etc.) +with a natural unit and a way to compute the per-unit base value for any component. + +Downstream packages implement the interface functions: + - _get_device_base_power(c) → Float64 (MVA) + - _get_system_base_power(c) → Float64 (MVA) + - get_base_voltage(c) → Float64 (kV) +=# + +# ============================================================ +# Interface functions — implemented by downstream packages +# ============================================================ + +""" + _get_device_base_power(component) → Float64 + +Return the device's base power in MVA as a raw Float64. +""" +function _get_device_base_power end + +""" + _get_system_base_power(component) → Float64 + +Return the system's base power in MVA as a raw Float64. +""" +function _get_system_base_power end + +""" + get_base_voltage(component) → Float64 + +Return the base voltage in kV as a raw Float64. +""" +function get_base_voltage end + +# ============================================================ +# Unit categories +# ============================================================ + +abstract type UnitCategory end + +struct PowerCategory <: UnitCategory end +struct ImpedanceCategory <: UnitCategory end +struct AdmittanceCategory <: UnitCategory end +struct VoltageCategory <: UnitCategory end +struct CurrentCategory <: UnitCategory end + +const POWER = PowerCategory() +const IMPEDANCE = ImpedanceCategory() +const ADMITTANCE = AdmittanceCategory() +const VOLTAGE = VoltageCategory() +const CURRENT = CurrentCategory() + +# ============================================================ +# natural_unit, base_value, system_base_value +# ============================================================ + +""" + natural_unit(category) → Unitful.Units + +The natural (physical) unit for this category. +""" +natural_unit(::PowerCategory) = u"MW" +natural_unit(::ImpedanceCategory) = u"Ω" +natural_unit(::AdmittanceCategory) = u"S" +natural_unit(::VoltageCategory) = u"kV" +natural_unit(::CurrentCategory) = u"kA" + +""" + base_value(component, category) → Float64 + +1.0 DU of this category = `base_value(c, cat)` natural units. +""" +base_value(c, ::PowerCategory) = _get_device_base_power(c) +base_value(c, ::ImpedanceCategory) = get_base_voltage(c)^2 / _get_device_base_power(c) +base_value(c, ::AdmittanceCategory) = _get_device_base_power(c) / get_base_voltage(c)^2 +base_value(c, ::VoltageCategory) = get_base_voltage(c) +base_value(c, ::CurrentCategory) = _get_device_base_power(c) / get_base_voltage(c) + +""" + system_base_value(component, category) → Float64 + +1.0 SU of this category = `system_base_value(c, cat)` natural units. +""" +system_base_value(c, ::PowerCategory) = _get_system_base_power(c) +system_base_value(c, ::ImpedanceCategory) = + get_base_voltage(c)^2 / _get_system_base_power(c) +system_base_value(c, ::AdmittanceCategory) = + _get_system_base_power(c) / get_base_voltage(c)^2 +system_base_value(c, ::VoltageCategory) = get_base_voltage(c) +system_base_value(c, ::CurrentCategory) = _get_system_base_power(c) / get_base_voltage(c) + +# DU→SU ratio (voltage cancels, only power bases needed) +_du_to_su_ratio(c, ::PowerCategory) = _get_device_base_power(c) / _get_system_base_power(c) +_du_to_su_ratio(c, ::ImpedanceCategory) = + _get_system_base_power(c) / _get_device_base_power(c) +_du_to_su_ratio(c, ::AdmittanceCategory) = + _get_device_base_power(c) / _get_system_base_power(c) +_du_to_su_ratio(::Any, ::VoltageCategory) = 1.0 +_du_to_su_ratio(c, ::CurrentCategory) = + _get_system_base_power(c) / _get_device_base_power(c) + +# ============================================================ +# Default units for 1-arg getters (downstream convention) +# ============================================================ + +const DEFAULT_UNITS = SU + +# ============================================================ +# convert_units: value from one unit system to another +# ============================================================ + +""" + convert_units(component, value, category, from, to) + +Convert a value between unit systems. + +# Examples +```julia +convert_units(gen, 0.6, POWER, DU, MW) # → 30.0 MW +convert_units(gen, 30.0MW, POWER, MW, DU) # → 0.6 DU +convert_units(gen, 0.6, POWER, DU, SU) # → 0.3 SU +convert_units(gen, 0.6, POWER, DU, Float64) # → 0.3 (raw SU value) +``` +""" +function convert_units end + +# --- From DU --- + +function convert_units(c, value::Number, cat::UnitCategory, ::DeviceBaseUnit, units::Units) + natural = value * base_value(c, cat) * natural_unit(cat) + return uconvert(units, natural) +end + +function convert_units( + c, + value::Number, + cat::UnitCategory, + ::DeviceBaseUnit, + ::SystemBaseUnit, +) + ratio = base_value(c, cat) / system_base_value(c, cat) + return (value * ratio) * SU +end + +convert_units(::Any, value::Number, ::UnitCategory, ::DeviceBaseUnit, ::DeviceBaseUnit) = + value * DU + +function convert_units( + c, + value::Float64, + cat::UnitCategory, + ::DeviceBaseUnit, + ::Type{Float64}, +)::Float64 + return value * _du_to_su_ratio(c, cat) +end + +function convert_units( + c, + value::ComplexF64, + cat::UnitCategory, + ::DeviceBaseUnit, + ::Type{Float64}, +)::ComplexF64 + return value * _du_to_su_ratio(c, cat) +end + +# --- From SU --- + +function convert_units(c, value::Number, cat::UnitCategory, ::SystemBaseUnit, units::Units) + natural = value * system_base_value(c, cat) * natural_unit(cat) + return uconvert(units, natural) +end + +function convert_units( + c, + value::Number, + cat::UnitCategory, + ::SystemBaseUnit, + ::DeviceBaseUnit, +) + ratio = system_base_value(c, cat) / base_value(c, cat) + return (value * ratio) * DU +end + +convert_units(::Any, value::Number, ::UnitCategory, ::SystemBaseUnit, ::SystemBaseUnit) = + value * SU + +# --- From natural units --- + +function convert_units(c, val::Quantity, cat::UnitCategory, ::Units, ::DeviceBaseUnit) + natural_val = Unitful.ustrip(natural_unit(cat), val) + return RelativeQuantity(natural_val / base_value(c, cat), DU) +end + +function convert_units(c, val::Quantity, cat::UnitCategory, ::Units, ::SystemBaseUnit) + natural_val = Unitful.ustrip(natural_unit(cat), val) + return RelativeQuantity(natural_val / system_base_value(c, cat), SU) +end + +# --- To NU (natural units) — delegate to the category's natural unit --- + +function convert_units(c, value::Number, cat::UnitCategory, from, ::NaturalUnit) + return convert_units(c, value, cat, from, natural_unit(cat)) +end + +# --- From NU — delegate from the category's natural unit --- + +function convert_units(c, val::Quantity, cat::UnitCategory, ::NaturalUnit, to) + return convert_units(c, val, cat, natural_unit(cat), to) +end + +# NU → NU (identity, attach the natural unit) +function convert_units(c, val::Quantity, cat::UnitCategory, ::NaturalUnit, ::NaturalUnit) + return uconvert(natural_unit(cat), val) +end + +# --- nothing passthrough --- +convert_units(::Any, ::Nothing, ::UnitCategory, ::Any, ::Any) = nothing diff --git a/src/units/serialization.jl b/src/units/serialization.jl new file mode 100644 index 0000000000..2efa47d03a --- /dev/null +++ b/src/units/serialization.jl @@ -0,0 +1,128 @@ +#= +JSON serialization/deserialization for unit-bearing quantities. + +Format: + {"value": 0.6, "unit": "DU"} + {"value": 30.0, "unit": "MW"} + {"value": 529.0, "unit": "Ω"} + +For complex values: + {"value": {"re": 0.01, "im": 0.1}, "unit": "SU"} +=# + +import JSON +import StructTypes + +# ============================================================ +# Unit string ↔ type mapping +# ============================================================ + +# All known unit strings → unit objects (both relative and Unitful). +# Canonical names come from unit_to_string; aliases provide lenient parsing. +const STRING_TO_UNIT = Dict{String, Any}( + # Relative units + "DU" => DU, + "SU" => SU, + # Canonical Unitful (matches output of `string(unit)`) + "MW" => MW, + "Mvar" => Mvar, + "MVA" => MVA, + "kV" => kV, + "Ω" => OHMS, + "S" => SIEMENS, + "kA" => u"kA", + # Aliases + "ohm" => OHMS, + "siemens" => SIEMENS, +) + +""" + unit_to_string(unit) → String + +Convert a unit type to its string representation for serialization. +""" +unit_to_string(::DeviceBaseUnit) = "DU" +unit_to_string(::SystemBaseUnit) = "SU" +unit_to_string(u::Unitful.Units) = string(u) + +""" + string_to_unit(s::String) → unit + +Parse a unit string back to its type for deserialization. +Returns a `DeviceBaseUnit`, `SystemBaseUnit`, or `Unitful.Units`. +""" +function string_to_unit(s::String) + unit = get(STRING_TO_UNIT, s, nothing) + isnothing(unit) && error("Unknown unit string: \"$s\"") + return unit +end + +# ============================================================ +# Serialization +# ============================================================ + +""" + serialize_quantity(q::RelativeQuantity) → Dict + +Serialize a RelativeQuantity to a Dict suitable for JSON. +""" +function serialize_quantity(q::RelativeQuantity{T, U}) where {T <: Real, U} + return Dict("value" => q.value, "unit" => unit_to_string(q.unit)) +end + +function serialize_quantity(q::RelativeQuantity{T, U}) where {T <: Complex, U} + return Dict( + "value" => Dict("re" => real(q.value), "im" => imag(q.value)), + "unit" => unit_to_string(q.unit), + ) +end + +""" + serialize_quantity(q::Unitful.Quantity) → Dict + +Serialize a Unitful Quantity to a Dict suitable for JSON. +""" +function serialize_quantity(q::Unitful.Quantity{T}) where {T <: Real} + return Dict("value" => Unitful.ustrip(q), "unit" => unit_to_string(Unitful.unit(q))) +end + +function serialize_quantity(q::Unitful.Quantity{T}) where {T <: Complex} + v = Unitful.ustrip(q) + return Dict( + "value" => Dict("re" => real(v), "im" => imag(v)), + "unit" => unit_to_string(Unitful.unit(q)), + ) +end + +# ============================================================ +# Deserialization +# ============================================================ + +""" + deserialize_quantity(d::Dict) → RelativeQuantity or Unitful.Quantity + +Deserialize from a Dict (parsed JSON). +Note: inherently type-unstable (return type depends on the "unit" string). +This is expected for deserialization, which is not a hot path. +""" +function deserialize_quantity(d::AbstractDict) + value = _parse_value(d["value"]) + unit = string_to_unit(d["unit"]) + return _attach_unit(value, unit) +end + +""" + deserialize_quantity(s::AbstractString) → RelativeQuantity or Unitful.Quantity + +Deserialize from a JSON string. +""" +deserialize_quantity(s::AbstractString) = + deserialize_quantity(JSON.parse(s; dicttype = Dict{String, Any})) + +# Parse a JSON value into a numeric type +_parse_value(v::AbstractDict) = Complex(v["re"], v["im"]) +_parse_value(v) = Float64(v) + +# Attach unit to value via dispatch +_attach_unit(value, unit::AbstractRelativeUnit) = RelativeQuantity(value, unit) +_attach_unit(value, unit::Unitful.Units) = value * unit diff --git a/src/units/types.jl b/src/units/types.jl new file mode 100644 index 0000000000..813da7689d --- /dev/null +++ b/src/units/types.jl @@ -0,0 +1,24 @@ +############################### +# Power-domain unit types. +# +# Relative-unit markers (`DU`, `SU`, `NU`, `AbstractRelativeUnit`, +# `RelativeQuantity`) live in InfrastructureSystems and are re-exported from +# this package. This file adds the power-domain Unitful units and the +# `UnitArg` convenience union. +############################### + +# Power-system-specific natural units (same dimension as MW, different display) +@unit Mvar "Mvar" Mvar 1u"MW" false +@unit MVA "MVA" MVA 1u"MW" false + +# Re-export common Unitful units for power systems +const MW = u"MW" +const kV = u"kV" +const OHMS = u"Ω" +const SIEMENS = u"S" + +""" +Accepted target-unit argument for unit-aware getters/setters: a Unitful unit +(e.g. `MW`, `kV`) or a relative per-unit marker (`DU`, `SU`, `NU`). +""" +const UnitArg = Union{Unitful.Units, IS.AbstractRelativeUnit} diff --git a/src/utils/IO/branchdata_checks.jl b/src/utils/IO/branchdata_checks.jl index 2ef6eafb99..f6061c7115 100644 --- a/src/utils/IO/branchdata_checks.jl +++ b/src/utils/IO/branchdata_checks.jl @@ -8,7 +8,7 @@ function validate_component_with_system(line::Union{MonitoredLine, Line}, sys::S is_valid = true if !check_endpoint_voltages(line) is_valid = false - elseif !correct_rate_limits!(line, get_base_power(sys)) + elseif !correct_rate_limits!(line, _get_base_power(sys)) is_valid = false end return is_valid @@ -180,7 +180,7 @@ function validate_component_with_system( sys::System, ) is_valid_reactance = check_transformer_reactance(xfrm) - is_valid_rating = check_rating_values(xfrm, get_base_power(sys)) + is_valid_rating = check_rating_values(xfrm, _get_base_power(sys)) return is_valid_reactance && is_valid_rating end @@ -196,7 +196,7 @@ function check_rating_values( closestV_ix = findmin(abs.(voltage_levels .- vrated)) closest_v_level = voltage_levels[closestV_ix[2]] closest_rate_range = MVA_LIMITS_TRANSFORMERS[closest_v_level] - device_base_power = get_base_power(xfrm) + device_base_power = _get_base_power(xfrm) # The rate is in device pu for field in [:rating, :rating_b, :rating_c] rating_value = getproperty(xfrm, field) diff --git a/src/utils/IO/system_checks.jl b/src/utils/IO/system_checks.jl index 8ea7c46a1e..8a07ddc3a6 100644 --- a/src/utils/IO/system_checks.jl +++ b/src/utils/IO/system_checks.jl @@ -1,6 +1,17 @@ ### Utility Functions needed for the construction of the Power System, mostly used for consistency checking #### +""" +Sum a getter over components in MW, returning `zero(MW_ACCUMULATOR_TYPE)` if empty. +""" +function _sum_or_zero(getter::Function, components) + if isempty(components) + return zero(MW_ACCUMULATOR_TYPE) + else + return sum(c -> getter(c, MW), components) + end +end + ## Check that all the buses have a type defintion and that bus types are consistent with generator connections ## function buscheck(sys::System) @@ -87,18 +98,25 @@ Sum of load ratings. - `sys::System`: system """ function total_load_rating(sys::System) - # Assumes system is in system base - base_power = get_base_power(sys) - static_loads = get_available_components(StaticLoad, sys) - sl = isempty(static_loads) ? 0.0 : sum(get_max_active_power.(static_loads)) * base_power + sl = _sum_or_zero(get_max_active_power, get_available_components(StaticLoad, sys)) @debug "System has $sl MW of StaticLoad" _group = IS.LOG_GROUP_SYSTEM_CHECKS # Total load calculation for admittances assumes P = Real(V^2*Y) with V=1.0 fa_loads = get_available_components(FixedAdmittance, sys) - fa = isempty(fa_loads) ? 0.0 : sum(real.(1.0 .* get_Y.(fa_loads))) * base_power + fa = + if isempty(fa_loads) + zero(MW_ACCUMULATOR_TYPE) + else + sum(real.(1.0 .* get_Y.(fa_loads))) * _get_base_power(sys) * MW + end @debug "System has $fa MW of FixedAdmittance" _group = IS.LOG_GROUP_SYSTEM_CHECKS sa_loads = get_available_components(SwitchedAdmittance, sys) - sa = isempty(sa_loads) ? 0.0 : sum(real.(1.0 .* get_Y.(sa_loads))) * base_power - @debug "System has $fa MW of SwitchedAdmittance" _group = IS.LOG_GROUP_SYSTEM_CHECKS + sa = + if isempty(sa_loads) + zero(MW_ACCUMULATOR_TYPE) + else + sum(real.(1.0 .* get_Y.(sa_loads))) * _get_base_power(sys) * MW + end + @debug "System has $sa MW of SwitchedAdmittance" _group = IS.LOG_GROUP_SYSTEM_CHECKS total_load = sl + fa + sa @debug "Total System Load: $total_load" _group = IS.LOG_GROUP_SYSTEM_CHECKS return total_load @@ -113,15 +131,13 @@ Sum of system generator and storage ratings. - `sys::System`: system """ function total_capacity_rating(sys::System) - total = 0 + total = zero(MW_ACCUMULATOR_TYPE) for component_type in (Generator, Storage) - components = get_available_components(component_type, sys) - if !isempty(components) - component_total = sum(get_rating.(components)) * get_base_power(sys) - @debug "total rating for $component_type = $component_total" _group = - IS.LOG_GROUP_SYSTEM_CHECKS - total += component_total - end + component_total = + _sum_or_zero(get_rating, get_available_components(component_type, sys)) + @debug "total rating for $component_type = $component_total" _group = + IS.LOG_GROUP_SYSTEM_CHECKS + total += component_total end @debug "Total System capacity: $total" _group = IS.LOG_GROUP_SYSTEM_CHECKS diff --git a/src/utils/print.jl b/src/utils/print.jl index 13ac8f8d73..8f8270e794 100644 --- a/src/utils/print.jl +++ b/src/utils/print.jl @@ -1,7 +1,22 @@ # "smart" summary and REPL printing +# Getters for unit-bearing fields declare their display-units choice via the +# `IS.display_units_arg` trait (set by the struct-generator template, default +# `missing` for plain getters). Prefer the trait's unit (typically `SU`), +# falling back to `DU` if the component isn't system-attached. +function _show_accessor_value(getter_func::Function, ist::Component) + arg = IS.display_units_arg(getter_func, typeof(ist)) + ismissing(arg) && return getter_func(ist) + try + return getter_func(ist, arg) + catch err + err isa ErrorException && occursin("not attached", err.msg) || rethrow() + return getter_func(ist, DU) + end +end + function Base.summary(sys::System) - return "System (base power $(get_base_power(sys)))" + return "System (base power $(_get_base_power(sys)))" end function Base.show(io::IO, sys::System) @@ -56,7 +71,7 @@ function Base.show(io::IO, ist::Component) continue elseif hasproperty(PowerSystems, getter_name) getter_func = getproperty(PowerSystems, getter_name) - val = getter_func(ist) + val = _show_accessor_value(getter_func, ist) else val = getproperty(ist, name) end @@ -98,14 +113,7 @@ function Base.show(io::IO, ::MIME"text/plain", ist::Component) val = summary(getproperty(ist, name)) elseif hasproperty(PowerSystems, getter_name) getter_func = getproperty(PowerSystems, getter_name) - try - val = getter_func(ist) - catch e - @warn "$(e.msg) Printing in DEVICE_BASE instead." - val = with_units_base(ist, "DEVICE_BASE") do - getter_func(ist) - end - end + val = _show_accessor_value(getter_func, ist) else val = getproperty(ist, name) end diff --git a/src/utils/print_pt.jl b/src/utils/print_pt.jl index 6a482554ee..f94e5a186c 100644 --- a/src/utils/print_pt.jl +++ b/src/utils/print_pt.jl @@ -47,7 +47,7 @@ function show_system_table(io::IO, sys::System; kwargs...) "Name" isnothing(get_name(sys)) ? "" : get_name(sys) "Description" isnothing(get_description(sys)) ? "" : get_description(sys) "System Units Base" string(get_units_base(sys)) - "Base Power" string(get_base_power(sys)) + "Base Power" string(_get_base_power(sys)) "Base Frequency" string(get_frequency(sys)) "Num Components" string(num_components) ] diff --git a/test/Project.toml b/test/Project.toml index a7ba743f74..d4be0e9b4e 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -17,12 +17,13 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TimeSeries = "9e3dc215-6440-5c97-bce1-76c03772f85e" UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" +Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" + +[sources] +InfrastructureSystems = {url = "https://github.com/NREL-Sienna/InfrastructureSystems.jl.git", rev = "lk/units-domain-agnostic-is4"} +PowerSystemCaseBuilder = {url = "https://github.com/NREL-Sienna/PowerSystemCaseBuilder.jl", rev = "psy6"} [compat] InfrastructureSystems = "3" JSON = "^1.5" julia = "^1.10" - -[sources] -InfrastructureSystems = {url = "https://github.com/NREL-Sienna/InfrastructureSystems.jl", rev = "jd/drop_json3"} -PowerSystemCaseBuilder = {url = "https://github.com/NREL-Sienna/PowerSystemCaseBuilder.jl", rev = "psy6"} diff --git a/test/common.jl b/test/common.jl index 327e53fec5..2442c9896f 100644 --- a/test/common.jl +++ b/test/common.jl @@ -1,4 +1,14 @@ import InfrastructureSystems +import Unitful + +# Strip unit wrappers so accessor return values can be compared against the +# raw struct field type. Compound values (NamedTuple of units) are unwrapped +# element-wise. +_unwrap_units(x) = x +_unwrap_units(x::RelativeQuantity) = ustrip(x) +_unwrap_units(x::Unitful.Quantity) = Unitful.ustrip(x) +_unwrap_units(x::NamedTuple) = map(_unwrap_units, x) + mutable struct TestDevice <: Device name::String end @@ -13,6 +23,29 @@ end struct NonexistentComponent <: StaticInjection end +"""Build a minimal `System` + `ThermalStandard` with the requested device base +so unit-conversion tests don't depend on PSB-built fixtures.""" +function _sys_with_thermal(; system_base = 100.0, device_base = 250.0) + sys = System(system_base) + bus = ACBus(; + number = 1, name = "b1", available = true, + bustype = ACBusTypes.REF, angle = 0.0, magnitude = 1.0, + voltage_limits = (min = 0.9, max = 1.1), base_voltage = 138.0, + ) + add_component!(sys, bus) + gen = ThermalStandard(; + name = "g1", available = true, status = true, bus = bus, + active_power = 0.5, reactive_power = 0.1, rating = 1.0, + active_power_limits = (min = 0.0, max = 1.0), + reactive_power_limits = (min = -1.0, max = 1.0), + ramp_limits = nothing, + operation_cost = ThermalGenerationCost(nothing), + base_power = device_base, + ) + add_component!(sys, gen) + return sys, gen +end + """Return the first component of type component_type that matches the name of other.""" function get_component_by_name(sys::System, component_type, other::Component) for component in get_components(component_type, sys) @@ -268,8 +301,17 @@ function test_accessors(component) end end - val = func(component) - @test val isa field_type + # Unit-aware getters are tagged via `display_units_arg`. For unattached + # test components, call with `DU` (device base) so the SU conversion + # path — which needs system attachment — is skipped. + val = if ismissing(IS.display_units_arg(func, ps_type)) + func(component) + else + func(component, DU) + end + # Getters now wrap values (e.g. `0.5 SU` instead of raw `0.5`), so + # compare the unwrapped value's type to `field_type`. + @test _unwrap_units(val) isa field_type try if typeof(val) == Float64 || typeof(val) == Int if !isnan(val) diff --git a/test/runtests.jl b/test/runtests.jl index d955a33452..21148bf031 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -11,6 +11,7 @@ import PowerSystemCaseBuilder as PSB import InfrastructureSystems as IS using PowerSystems import PowerSystems as PSY +import Unitful import Aqua Aqua.test_unbound_args(PowerSystems) diff --git a/test/test_base_power.jl b/test/test_base_power.jl index 995cab5c02..b688f195ec 100644 --- a/test/test_base_power.jl +++ b/test/test_base_power.jl @@ -34,6 +34,99 @@ function thermal_with_base_power(bus::PSY.Bus, name::String, base_power::Float64 ) end +# Used to build via `PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys")` and pull +# `322_CT_6`, but PSB isn't compatible with the new units API yet. +@testset "Test unit-aware get_base_power" begin + sys, gen = _sys_with_thermal(; system_base = 100.0, device_base = 250.0) + device_base = PSY._get_base_power(gen) + system_base = PSY._get_base_power(sys) + @test device_base != system_base + + # 1-arg form is gone — public getter requires explicit units. + @test_throws MethodError get_base_power(gen) + + # Bare-number getter returns Float64 in the requested unit; companion + # `_unitful` keeps the Unitful/RelativeQuantity wrapper. + @test get_base_power(gen, NU) isa Float64 + @test get_base_power(gen, NU) ≈ device_base + bp_nu = get_base_power_unitful(gen, NU) + @test bp_nu isa Unitful.Quantity + @test Unitful.ustrip(bp_nu) ≈ device_base + # Not double-wrapped: no `device_base * MVA * MVA`. + @test Unitful.unit(bp_nu) == Unitful.unit(1.0 * MVA) + + @test get_base_power(gen, MW) isa Float64 + @test get_base_power(gen, MW) ≈ device_base + bp_mw = get_base_power_unitful(gen, MW) + @test bp_mw isa Unitful.Quantity + @test Unitful.ustrip(MW, bp_mw) ≈ device_base + + @test get_base_power(gen, SU) isa Float64 + @test get_base_power(gen, SU) ≈ device_base / system_base + bp_su = get_base_power_unitful(gen, SU) + @test bp_su isa RelativeQuantity + @test ustrip(bp_su) ≈ device_base / system_base + + # DU is self-referential: base_power in device-base pu is always 1. + @test get_base_power(gen, DU) == 1.0 + bp_du = get_base_power_unitful(gen, DU) + @test bp_du isa RelativeQuantity + @test ustrip(bp_du) == 1.0 + + # Components with no base_power field fall back to system base, so DU == SU == 1. + bus = first(get_components(ACBus, sys)) + @test get_base_power(bus, SU) ≈ 1.0 + @test get_base_power(bus, NU) ≈ system_base + @test get_base_power_unitful(bus, NU) isa Unitful.Quantity + + # System-level getter mirrors the component version. + @test_throws MethodError get_base_power(sys) + @test get_base_power(sys, NU) ≈ system_base + @test get_base_power_unitful(sys, NU) isa Unitful.Quantity + @test get_base_power(sys, SU) == 1.0 + @test get_base_power_unitful(sys, SU) isa RelativeQuantity +end + +# Used to build via `PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys")` and pull +# `322_CT_6`, but PSB isn't compatible with the new units API yet. +@testset "Generated getters: bare vs _unitful, NU path" begin + sys, gen = _sys_with_thermal(; system_base = 100.0, device_base = 250.0) + device_base = PSY._get_base_power(gen) + system_base = PSY._get_base_power(sys) + p_du = PSY.get_value(gen, Val(:active_power), Val(:mva), DU) |> ustrip + + # Plain Float64 across all unit args. + @test get_active_power(gen, NU) isa Float64 + @test get_active_power(gen, NU) ≈ p_du * device_base + @test get_active_power(gen, MW) isa Float64 + @test get_active_power(gen, MW) ≈ p_du * device_base + @test get_active_power(gen, SU) isa Float64 + @test get_active_power(gen, SU) ≈ p_du * device_base / system_base + @test get_active_power(gen, DU) isa Float64 + @test get_active_power(gen, DU) ≈ p_du + + # `_unitful` companions retain wrappers. + p_nu_u = get_active_power_unitful(gen, NU) + @test p_nu_u isa Unitful.Quantity + @test Unitful.unit(p_nu_u) == Unitful.unit(1.0 * MW) + @test Unitful.ustrip(MW, p_nu_u) ≈ p_du * device_base + + @test get_active_power_unitful(gen, MW) isa Unitful.Quantity + @test get_active_power_unitful(gen, SU) isa RelativeQuantity + @test get_active_power_unitful(gen, DU) isa RelativeQuantity + + # Compound NamedTuple field (MinMax): bare strips per-element, unitful keeps. + lim = get_active_power_limits(gen, NU) + @test lim.min isa Float64 && lim.max isa Float64 + lim_u = get_active_power_limits_unitful(gen, NU) + @test lim_u.min isa Unitful.Quantity && lim_u.max isa Unitful.Quantity + + # Nothing-valued field: both forms pass nothing through. + set_ramp_limits!(gen, nothing) + @test get_ramp_limits(gen, NU) === nothing + @test get_ramp_limits_unitful(gen, NU) === nothing +end + # TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers # (PSB.build_system uses PSY.PowerSystemTableData internally). # @testset "Test adding component with zero base power" begin diff --git a/test/test_cost_functions.jl b/test/test_cost_functions.jl index eed5afc5dc..bdf606205e 100644 --- a/test/test_cost_functions.jl +++ b/test/test_cost_functions.jl @@ -7,9 +7,9 @@ fc = FuelCurve(InputOutputCurve(IS.QuadraticFunctionData(1, 2, 3)), 4.0) @test sprint(show, "text/plain", fc) == sprint(show, "text/plain", fc; context = :compact => false) == - "FuelCurve:\n value_curve: QuadraticCurve (a type of InputOutputCurve) where function is: f(x) = 1.0 x^2 + 2.0 x + 3.0\n power_units: UnitSystem.NATURAL_UNITS = 2\n fuel_cost: 4.0\n startup_fuel_offtake: LinearCurve (a type of InputOutputCurve) where function is: f(x) = 0.0 x + 0.0\n vom_cost: LinearCurve (a type of InputOutputCurve) where function is: f(x) = 0.0 x + 0.0" + "FuelCurve:\n value_curve: QuadraticCurve (a type of InputOutputCurve) where function is: f(x) = 1.0 x^2 + 2.0 x + 3.0\n fuel_cost: 4.0\n startup_fuel_offtake: LinearCurve (a type of InputOutputCurve) where function is: f(x) = 0.0 x + 0.0\n vom_cost: LinearCurve (a type of InputOutputCurve) where function is: f(x) = 0.0 x + 0.0\n power_units: NU" @test sprint(show, "text/plain", fc; context = :compact => true) == - "FuelCurve with power_units UnitSystem.NATURAL_UNITS = 2, fuel_cost 4.0, startup_fuel_offtake LinearCurve(0.0, 0.0), vom_cost LinearCurve(0.0, 0.0), and value_curve:\n QuadraticCurve (a type of InputOutputCurve) where function is: f(x) = 1.0 x^2 + 2.0 x + 3.0" + "FuelCurve with power_units NU, fuel_cost 4.0, startup_fuel_offtake LinearCurve(0.0, 0.0), vom_cost LinearCurve(0.0, 0.0), and value_curve:\n QuadraticCurve (a type of InputOutputCurve) where function is: f(x) = 1.0 x^2 + 2.0 x + 3.0" end # TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers @@ -89,7 +89,7 @@ end # end test_costs = Dict( - CostCurve{QuadraticCurve} => + IS.AnyCostCurve{QuadraticCurve} => repeat([CostCurve(QuadraticCurve(999.0, 2.0, 1.0))], 24), PiecewiseStepData => repeat( @@ -142,7 +142,7 @@ end ) add_component!(sys, reserve) @test get_variable_cost(reserve) == cc - @test get_variable(reserve) isa CostCurve{PiecewiseIncrementalCurve} + @test get_variable(reserve) isa IS.AnyCostCurve{PiecewiseIncrementalCurve} # Test set_variable_cost! with validation cc2 = CostCurve( @@ -284,18 +284,18 @@ end build_iec_sys() new_import = make_import_curve([0.0, 50.0, 100.0], [10.0, 20.0]) - set_import_variable_cost!(sys, source, new_import, UnitSystem.NATURAL_UNITS) + set_import_variable_cost!(sys, source, new_import, IS.NaturalUnit()) @test get_import_offer_curves(ie_cost) == new_import new_export = make_export_curve([0.0, 50.0, 100.0], [20.0, 10.0]) - set_export_variable_cost!(sys, source, new_export, UnitSystem.NATURAL_UNITS) + set_export_variable_cost!(sys, source, new_export, IS.NaturalUnit()) @test get_export_offer_curves(ie_cost) == new_export # Test unit mismatch throws @test_throws ArgumentError set_import_variable_cost!( - sys, source, new_import, UnitSystem.SYSTEM_BASE) + sys, source, new_import, IS.SystemBaseUnit()) @test_throws ArgumentError set_export_variable_cost!( - sys, source, new_export, UnitSystem.SYSTEM_BASE) + sys, source, new_export, IS.SystemBaseUnit()) end @testset "Test HydroReservoirCost getters and setters" begin diff --git a/test/test_dynamic_generator.jl b/test/test_dynamic_generator.jl index 800609047d..6e0ca96f32 100644 --- a/test/test_dynamic_generator.jl +++ b/test/test_dynamic_generator.jl @@ -505,18 +505,18 @@ end @test length(dynamics) == 1 @test dynamics[1] == Gen1AVR @test get_dynamic_injector(static_gen) == Gen1AVR - @test get_base_power(static_gen) == get_base_power(Gen1AVR) + @test PSY._get_base_power(static_gen) == PSY._get_base_power(Gen1AVR) @test PSY.compare_values(static_gen, deepcopy(static_gen)) remove_component!(sys, Gen1AVR) @test isnothing(get_dynamic_injector(static_gen)) add_component!(sys, Gen2AVR, static_gen) @test get_dynamic_injector(static_gen) === Gen2AVR - @test get_base_power(static_gen) == get_base_power(Gen2AVR) + @test PSY._get_base_power(static_gen) == PSY._get_base_power(Gen2AVR) set_base_power!(static_gen, 1234.5) - @test get_base_power(static_gen) == 1234.5 - @test PSY.get_system_base_power(static_gen) == get_base_power(sys) + @test PSY._get_base_power(static_gen) == 1234.5 + @test PSY._get_system_base_power(static_gen) == PSY._get_base_power(sys) # Rule: Can't set the pair injector if the current injector is already set. @test_throws ArgumentError set_dynamic_injector!(static_gen, Gen1AVR) @@ -664,7 +664,7 @@ end # Replace the dynamic injector replace_dynamic_injector!(sys, static, Gen2) @test get_dynamic_injector(static) === Gen2 - @test get_base_power(static) == get_base_power(Gen2) + @test PSY._get_base_power(static) == PSY._get_base_power(Gen2) # Old dynamic injector should be removed from the system @test length(collect(get_components(DynamicGenerator, sys))) == 1 diff --git a/test/test_plant_attributes.jl b/test/test_plant_attributes.jl index 2b794aac2d..87733ca3c2 100644 --- a/test/test_plant_attributes.jl +++ b/test/test_plant_attributes.jl @@ -6,8 +6,6 @@ import JSON import PowerSystemCaseBuilder as PSB const PSY = PowerSystems -include("common.jl") - @testset "Test plant attributes" begin @testset "ThermalPowerPlant construction and basic accessors" begin plant = ThermalPowerPlant(name = "Coal Plant A") @@ -998,7 +996,7 @@ include("common.jl") sys_loaded = System(json_path) # Verify system loaded correctly - @test get_base_power(sys_loaded) == get_base_power(sys) + @test PSY._get_base_power(sys_loaded) == PSY._get_base_power(sys) @test length(get_components(ThermalStandard, sys_loaded)) == length(thermal_gens) @@ -1059,7 +1057,7 @@ include("common.jl") # Load the round-trip system sys_roundtrip = System(json_path2) - @test get_base_power(sys_roundtrip) == get_base_power(sys) + @test PSY._get_base_power(sys_roundtrip) == PSY._get_base_power(sys) # Verify plant still exists after round-trip gen1_rt = get_component( diff --git a/test/test_printing.jl b/test/test_printing.jl index e403ba1e10..47e42529d7 100644 --- a/test/test_printing.jl +++ b/test/test_printing.jl @@ -28,20 +28,39 @@ function are_type_and_fields_in_output(obj::T) where {T <: Component} continue end - # Account for the fact that type may be abstract. - actual_type = typeof(val) + # The show method uses getters, which may return unit-bearing values + # (e.g. "0.55 SU"). Call the getter (if any) for the displayed value + # and extract its numeric part for the occursin check. + getter_name = Symbol("get_$name") + display_val = if hasproperty(PowerSystems, getter_name) + getter_func = getproperty(PowerSystems, getter_name) + arg = IS.display_units_arg(getter_func, typeof(obj)) + try + ismissing(arg) ? getter_func(obj) : getter_func(obj, arg) + catch + val + end + else + val + end + + actual_type = typeof(display_val) if actual_type <: IS.InfrastructureSystemsType expected = string(actual_type) elseif actual_type <: Vector{<:Service} expected = string(actual_type) elseif actual_type <: Vector{<:IS.InfrastructureSystemsType} expected = string(actual_type) + elseif display_val isa Unitful.Quantity + expected = string(Unitful.ustrip(display_val)) + elseif display_val isa RelativeQuantity + expected = string(ustrip(display_val)) else - expected = string(val) + expected = string(display_val) end if !occursin(expected, custom) - @error "field's value is not in custom output" name custom + @error "field's value is not in custom output" name expected custom match = false end end diff --git a/test/test_serialization.jl b/test/test_serialization.jl index c4cce9ce6b..29a69a646e 100644 --- a/test/test_serialization.jl +++ b/test/test_serialization.jl @@ -109,7 +109,7 @@ end set_operation_cost!(gen, market_bid) add_component!(sys, gen) ta = TimeSeries.TimeArray(dates, data) - power_units = UnitSystem.NATURAL_UNITS + power_units = IS.NaturalUnit() service = ConstantReserve{ReserveDown}(; name = "init_$i", available = false, @@ -324,8 +324,11 @@ end ts2b = get_time_series(SingleTimeSeries, gen2, "max_reactive_power") @test ts1b.data == ts2b.data ta_vals = TimeSeries.values(ta) - expected1 = use_scaling_factor ? ta_vals * get_max_active_power(gen) : ta_vals - expected2 = use_scaling_factor ? ta_vals * get_max_reactive_power(gen) : ta_vals + expected1 = + use_scaling_factor ? ta_vals * get_max_active_power(gen, SU) : + ta_vals + expected2 = + use_scaling_factor ? ta_vals * get_max_reactive_power(gen, SU) : ta_vals @test get_time_series_values( gen2, ts1b, diff --git a/test/test_system.jl b/test/test_system.jl index bc795253c3..f0f6d497f6 100644 --- a/test/test_system.jl +++ b/test/test_system.jl @@ -229,72 +229,43 @@ end ) end -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (PSB.build_system uses PSY.PowerSystemTableData internally for test_RTS_GMLC_sys). -# @testset "Test system units" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) -# set_units_base_system!(sys, "DEVICE_BASE") -# @test get_units_base(sys) == "DEVICE_BASE" -# set_units_base_system!(sys, "SYSTEM_BASE") -# @test get_units_base(sys) == "SYSTEM_BASE" -# -# gen = get_component(ThermalStandard, sys, "322_CT_6") -# active_power_mw = with_units_base(sys, UnitSystem.NATURAL_UNITS) do -# get_active_power(gen) -# end -# @test get_units_base(sys) == "SYSTEM_BASE" -# set_units_base_system!(sys, UnitSystem.NATURAL_UNITS) -# @test active_power_mw == get_active_power(gen) -# end +# Used to build via `PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys")` and pull +# `322_CT_6`, but PSB isn't compatible with the new units API yet. +@testset "Test explicit units API" begin + sys, gen = _sys_with_thermal(; system_base = 100.0, device_base = 250.0) + device_base = PSY._get_base_power(gen) + system_base = PSY._get_base_power(sys) + raw_active = gen.active_power + + P_mw = get_active_power(gen, MW) + @test P_mw isa Float64 + @test P_mw ≈ raw_active * device_base + @test get_active_power_unitful(gen, MW) isa Unitful.Quantity + @test Unitful.ustrip(get_active_power_unitful(gen, MW)) ≈ raw_active * device_base + + P_du = get_active_power(gen, DU) + @test P_du isa Float64 + @test P_du ≈ raw_active + @test get_active_power_unitful(gen, DU) isa RelativeQuantity + + P_su = get_active_power(gen, SU) + @test P_su isa Float64 + @test P_su ≈ raw_active * device_base / system_base + @test get_active_power_unitful(gen, SU) isa RelativeQuantity +end -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (PSB.build_system uses PSY.PowerSystemTableData internally for test_RTS_GMLC_sys). -# @testset "Test with_units_base on component" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) -# set_units_base_system!(sys, "SYSTEM_BASE") -# gen = get_component(ThermalStandard, sys, "322_CT_6") -# base_power = get_base_power(sys) -# -# # Component shares system's units_settings initially -# @test sys.units_settings === PSY.get_internal(gen).units_info -# -# # with_units_base on component should work and preserve reference after -# P_pu = get_active_power(gen) -# P_natural = with_units_base(gen, "NATURAL_UNITS") do -# get_active_power(gen) -# end -# @test P_natural ≈ P_pu * base_power -# -# # Reference should be preserved after with_units_base(component, ...) -# @test sys.units_settings === PSY.get_internal(gen).units_info -# -# # System-level with_units_base should still work after component-level call -# P_natural_via_sys = with_units_base(sys, UnitSystem.NATURAL_UNITS) do -# get_active_power(gen) -# end -# @test P_natural ≈ P_natural_via_sys -# end +# Used to build via `PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys")` and pull +# `322_CT_6`, but PSB isn't compatible with the new units API yet. +@testset "Test explicit units setters" begin + sys, gen = _sys_with_thermal(; system_base = 100.0, device_base = 250.0) + device_base = PSY._get_base_power(gen) -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (PSB.build_system uses PSY.PowerSystemTableData internally for test_RTS_GMLC_sys). -# @testset "Test with_units_base on component removed during block" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) -# set_units_base_system!(sys, "SYSTEM_BASE") -# line = first(get_components(Line, sys)) -# -# # Component shares system's units_settings initially -# @test sys.units_settings === PSY.get_internal(line).units_info -# -# # Remove component during with_units_base block -# @test_throws ErrorException begin -# with_units_base(line, "NATURAL_UNITS") do -# remove_component!(sys, line) -# end -# end -# -# # After removal, units_info should be nothing (not restored to system's) -# @test isnothing(PSY.get_internal(line).units_info) -# end + set_active_power!(gen, 50.0 * MW) + @test gen.active_power ≈ 50.0 / device_base + + set_active_power!(gen, 0.6 * DU) + @test gen.active_power ≈ 0.6 +end @testset "Test add_time_series multiple components" begin sys = System(100.0) diff --git a/test/test_units.jl b/test/test_units.jl new file mode 100644 index 0000000000..e7401d43be --- /dev/null +++ b/test/test_units.jl @@ -0,0 +1,199 @@ +# Tests of the power-domain unit machinery: categories, convert_units across +# per-unit/natural-unit boundaries, serialization, and custom Unitful units. +# The RelativeQuantity arithmetic/comparison/display tests live in IS +# (test/test_relative_units.jl) since those types are domain-agnostic. + +import Unitful +using Unitful: @u_str + +# Mock components so we can exercise convert_units without building a full System. +struct MockGen + active_power::Float64 + base_power::Float64 +end + +struct MockLine + r::Float64 + x::Float64 +end + +PSY._get_device_base_power(g::MockGen) = g.base_power +PSY._get_system_base_power(::MockGen) = 100.0 +PSY.get_base_voltage(::MockGen) = 230.0 + +PSY._get_device_base_power(::MockLine) = 100.0 +PSY._get_system_base_power(::MockLine) = 100.0 +PSY.get_base_voltage(::MockLine) = 230.0 + +@testset "Unit categories" begin + @test natural_unit(POWER) == u"MW" + @test natural_unit(IMPEDANCE) == u"Ω" + @test natural_unit(ADMITTANCE) == u"S" + @test natural_unit(VOLTAGE) == u"kV" + @test natural_unit(CURRENT) == u"kA" +end + +@testset "base_value and system_base_value" begin + gen = MockGen(0.6, 50.0) # 50 MVA device, 100 MVA system + + @test base_value(gen, POWER) == 50.0 + @test system_base_value(gen, POWER) == 100.0 + + # Impedance: V² / S + @test base_value(gen, IMPEDANCE) ≈ 230.0^2 / 50.0 + @test system_base_value(gen, IMPEDANCE) ≈ 230.0^2 / 100.0 + + # Admittance: S / V² + @test base_value(gen, ADMITTANCE) ≈ 50.0 / 230.0^2 + @test system_base_value(gen, ADMITTANCE) ≈ 100.0 / 230.0^2 + + @test base_value(gen, VOLTAGE) == 230.0 + @test system_base_value(gen, VOLTAGE) == 230.0 +end + +@testset "convert_units: DU → other" begin + gen = MockGen(0.6, 50.0) + + result = convert_units(gen, 0.6, POWER, DU, MW) + @test result isa Unitful.Quantity + @test Unitful.ustrip(result) ≈ 30.0 + + result = convert_units(gen, 0.6, POWER, DU, SU) + @test result isa RelativeQuantity{Float64, SystemBaseUnit} + @test ustrip(result) ≈ 0.3 + + result = convert_units(gen, 0.6, POWER, DU, DU) + @test ustrip(result) ≈ 0.6 + + result = convert_units(gen, 0.6, POWER, DU, Float64) + @test result isa Float64 + @test result ≈ 0.3 +end + +@testset "convert_units: SU → other" begin + gen = MockGen(0.6, 50.0) + + result = convert_units(gen, 0.3, POWER, SU, MW) + @test Unitful.ustrip(result) ≈ 30.0 + + result = convert_units(gen, 0.3, POWER, SU, DU) + @test ustrip(result) ≈ 0.6 + + result = convert_units(gen, 0.3, POWER, SU, SU) + @test ustrip(result) ≈ 0.3 +end + +@testset "convert_units: natural → per-unit" begin + gen = MockGen(0.6, 50.0) + + result = convert_units(gen, 30.0MW, POWER, MW, DU) + @test ustrip(result) ≈ 0.6 + + result = convert_units(gen, 30.0MW, POWER, MW, SU) + @test ustrip(result) ≈ 0.3 +end + +@testset "convert_units: impedance" begin + line = MockLine(0.01, 0.1) + z_base = 230.0^2 / 100.0 + + result = convert_units(line, 0.01, IMPEDANCE, DU, OHMS) + @test Unitful.ustrip(result) ≈ 0.01 * z_base + + # device base == system base, so DU → Float64 ratio = 1.0 + result = convert_units(line, 0.01, IMPEDANCE, DU, Float64) + @test result ≈ 0.01 +end + +@testset "convert_units: nothing passthrough" begin + gen = MockGen(0.6, 50.0) + @test convert_units(gen, nothing, POWER, DU, MW) === nothing +end + +@testset "convert_units: round-trip consistency" begin + gen = MockGen(0.6, 50.0) + original = 0.6 + + mw = convert_units(gen, original, POWER, DU, MW) + back = convert_units(gen, mw, POWER, MW, DU) + @test ustrip(back) ≈ original + + su = convert_units(gen, original, POWER, DU, SU) + back = convert_units(gen, ustrip(su), POWER, SU, DU) + @test ustrip(back) ≈ original +end + +@testset "convert_units: ComplexF64 support" begin + line = MockLine(0.01, 0.1) + z = 0.01 + 0.1im + + result = convert_units(line, z, IMPEDANCE, DU, Float64) + @test result isa ComplexF64 + @test result ≈ z # ratio is 1.0 since device == system base +end + +@testset "convert_units: NU (natural units)" begin + gen = MockGen(0.6, 50.0) + + result = convert_units(gen, 0.6, POWER, DU, NU) + @test result isa Unitful.Quantity + @test Unitful.ustrip(result) ≈ 30.0 + + result = convert_units(gen, 0.01, IMPEDANCE, DU, NU) + @test Unitful.dimension(Unitful.unit(result)) == Unitful.dimension(u"Ω") + + result = convert_units(gen, 30.0MW, POWER, NU, DU) + @test ustrip(result) ≈ 0.6 +end + +@testset "Serialization: RelativeQuantity" begin + q = 0.6DU + d = PSY.serialize_quantity(q) + @test d["value"] == 0.6 + @test d["unit"] == "DU" + @test PSY.deserialize_quantity(d) == q + + q = 0.3SU + d = PSY.serialize_quantity(q) + @test d["value"] == 0.3 + @test d["unit"] == "SU" + @test PSY.deserialize_quantity(d) == q + + q = (0.01 + 0.1im) * SU + d = PSY.serialize_quantity(q) + @test d["value"]["re"] == 0.01 + @test d["value"]["im"] == 0.1 + @test d["unit"] == "SU" + @test PSY.deserialize_quantity(d) == q +end + +@testset "Serialization: Unitful Quantity" begin + q = 30.0MW + d = PSY.serialize_quantity(q) + @test d["value"] == 30.0 + @test d["unit"] == "MW" + @test PSY.deserialize_quantity(d) ≈ q + + q = 529.0OHMS + d = PSY.serialize_quantity(q) + @test d["value"] == 529.0 + @test d["unit"] == "Ω" + @test PSY.deserialize_quantity(d) ≈ q +end + +@testset "Serialization: JSON string round-trip" begin + q = 0.3SU + json = JSON.json(PSY.serialize_quantity(q)) + @test PSY.deserialize_quantity(json) == q + + q = 30.0MW + json = JSON.json(PSY.serialize_quantity(q)) + @test PSY.deserialize_quantity(json) ≈ q +end + +@testset "Custom Unitful units" begin + @test 1.0Mvar == 1.0u"MW" # same dimension + @test 1.0MVA == 1.0u"MW" + @test sprint(show, 1.0Mvar) == "1.0 Mvar" + @test sprint(show, 1.0MVA) == "1.0 MVA" +end