diff --git a/Project.toml b/Project.toml index 092c61cb8e..0f6ca7159e 100644 --- a/Project.toml +++ b/Project.toml @@ -12,7 +12,6 @@ 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" @@ -29,7 +28,6 @@ JSON = "^1.5" LinearAlgebra = "1" Logging = "1" PrettyTables = "3.1" -StructTypes = "^1.9" TimeSeries = "0.25" Unicode = "1" Unitful = "^1.12" diff --git a/README.md b/README.md index 6b39cf38e5..aaf0c5c362 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Main - CI](https://github.com/Sienna-Platform/PowerSystems.jl/workflows/Main%20-%20CI/badge.svg)](https://github.com/Sienna-Platform/PowerSystems.jl/actions/workflows/main-tests.yml) [![codecov](https://codecov.io/gh/Sienna-Platform/PowerSystems.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/Sienna-Platform/PowerSystems.jl) -[![Documentation](https://github.com/Sienna-Platform/PowerSystems.jl/actions/workflows/docs.yml/badge.svg)](https://github.com/Sienna-Platform/PowerSystems.jl/actions/workflows/docs.yml) +[![Documentation](https://github.com/Sienna-Platform/PowerSystems.jl/actions/workflows/docs.yml/badge.svg)](https://sienna-platform.github.io/PowerSystems.jl/stable/) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.17703517.svg)](https://doi.org/10.5281/zenodo.17703517) [](https://join.slack.com/t/core-sienna/shared_invite/zt-glam9vdu-o8A9TwZTZqqNTKHa7q3BpQ) [![PowerSystems.jl Downloads](https://img.shields.io/badge/dynamic/json?url=http%3A%2F%2Fjuliapkgstats.com%2Fapi%2Fv1%2Ftotal_downloads%2FPowerSystems&query=total_requests&label=Downloads)](http://juliapkgstats.com/pkg/PowerSystems) diff --git a/claude.md b/claude.md new file mode 100644 index 0000000000..cc682030a0 --- /dev/null +++ b/claude.md @@ -0,0 +1,462 @@ +# Units-Management Review — Integration Brief + +This file is an implementation work order for Claude Code. It integrates the findings of +a deep multi-agent review (Fable, max effort: 9 finder angles → adversarial verification → +gap sweep → security review) of the units-management rework spanning: + +- **InfrastructureSystems.jl, branch `IS4`** (diff vs `main`: 62 files) — the new + domain-agnostic `RelativeUnits` module, `U <: AbstractUnitSystem` cost-curve type + parameter, time-series-backed function data, and struct-codegen template. +- **PowerSystems.jl, branch `psy6`** (this repo) — `src/units/{types,conversions,serialization}.jl`, + the `get_value`/`set_value` machinery in `src/models/components.jl`, and the regenerated + 2-arg explicit-units getters with `_unitful` companions. + +Every item below was independently verified (standalone Julia repro, exact-signature +replica, or full dispatch-table enumeration). Still: **re-verify each item against the +current source before changing it** — line numbers drift, and a few items may have been +fixed since the review snapshot. Work through the phases in order; correctness first. + +--- + +## Ground rules + +1. **Never hand-edit `src/models/generated/*.jl`.** They are generated from + `src/descriptors/power_system_structs.json` by the IS template + (`InfrastructureSystems.jl/src/utils/generate_structs.jl`). Fix the template and/or the + descriptor, then regenerate: + ``` + julia --project=test -e "using InfrastructureSystems; InfrastructureSystems.generate_structs(\"./src/descriptors/power_system_structs.json\", \"./src/models/generated\")" + ``` +2. **Co-development**: PSY pins IS via `[sources]` → `rev = "IS4"`. IS-side fixes go on a + branch off `IS4` in InfrastructureSystems.jl; point PSY's `[sources]` at it while + developing, restore to `IS4` after merge. Template changes require regenerating PSY + structs in the same change set. +3. **Tests must stay green**: full PSY suite (`Pkg.test()`, ~5300 tests) and IS suite. + Run the formatter before committing: `julia scripts/formatter/formatter_code.jl`. +4. Several fixes change public behavior — record each in `CHANGELOG.md`. +5. Add a regression test with every fix. Where a test is suggested below, that is the + minimum bar. + +--- + +## Phase 0 — Release blockers (versioning) + +### 0.1 IS4 version / PSY compat are mutually inconsistent +- `PowerSystems.jl/Project.toml`: compat was **lowered** to `InfrastructureSystems = "^3.4"` + while psy6 source requires IS4-only API (`IS.AbstractUnitSystem`, `IS.NaturalUnit`, + `IS.display_units_arg`, `IS._strip_units`, `TimeSeriesPiecewiseIncrementalCurve`, …). + It only resolves locally because of the `[sources]` git pin, which is stripped on + registration. A registered build would fail at precompile + (first hit: `src/models/cost_functions/ReserveDemandCurve.jl`). +- `InfrastructureSystems.jl/Project.toml` on IS4 still says `version = "3.6.0"` — + byte-identical to the registered 3.6.0 despite breaking API removals/renames + (`Results`→`Outputs`, deleted Optimization types, `CostCurve` signature change, JSON3→JSON). +- **Fix**: bump IS4 to `4.0.0-DEV` (or `4.0.0`), set PSY compat to `^4.0` (and PSY itself + to its next major), keep `[sources]` for development only. + +--- + +## Phase 1 — Correctness: silent wrong numbers (highest priority) + +### 1.1 ThreeWindingTransformer: Unitful targets bypass winding bases (getters) +- `PSY src/models/components.jl` (~line 422): the winding-aware override is + `get_value(c::ThreeWindingTransformer, field::Val, cu::Val, units::IS.AbstractUnitSystem)`. + `MW`/`MVA`/`Ω`/`S` are `Unitful.Units`, *disjoint* from `IS.AbstractUnitSystem`, so those + calls fall to the generic `get_value(c::Component, …)`, which scales by `_get_base_power(c)` + — and `Transformer3W` has no `base_power` field, so that falls back to the **system** base. + - `get_rating_primary(t3w, MW)` and `get_rating_primary(t3w, NU)` return contradictory + values (system-base vs winding-base scaling) for the same field. + - `get_r_primary(t3w, OHMS)` crashes: the `Branch` fallback calls `get_arc(c)`, which has + no method for 3W types. + The generated docstrings explicitly advertise `MW` as a valid `units` argument. +- **Fix**: widen the 3W override to all unit targets (`units::UnitArg`), routing Unitful + targets through the winding-aware `convert_units(..., winding)` path (see 3.1 for the + deeper consolidation). Existing test `test/test_base_power.jl` covers only `DU/SU/NU` on + 3W — add `MW`, `OHMS`, `SIEMENS` target cases asserting agreement with the `NU` path. + +### 1.2 ThreeWindingTransformer: no winding-aware `set_value` at all (setters) +- All `set_value` methods in `components.jl:200-279` dispatch on `Component`/`Branch` only. + Generated 3W setters (`set_rating_primary!`, `set_r_12!`, `set_active_power_flow_primary!`, + also `PhaseShiftingTransformer3W`) route through them: + - power fields divide by `_get_base_power(c)` = **system base** instead of the winding + base → silently corrupted stored DU values (e.g. `base_power_12=15`, system 100: + `set_rating_primary!(t3w, 30.0u"MW")` stores `0.3` instead of `2.0`); + - Ω/S-valued setters crash at `get_arc(t3w)`. + Only `DU`-tagged input round-trips. Current tests dodge this by seeding 3W fields with + `setproperty!` directly (`test/test_base_power.jl:266`). +- **Fix**: add winding-aware `set_value` methods mirroring the winding `get_value` + (field → winding token map already exists: `_get_device_base_power(c, field::Val)` at + `components.jl:440`). Add set→get round-trip tests per winding for MW, SU, DU, Ω, S. + +### 1.3 `_du_to_su_ratio(::CurrentCategory)` is inverted +- `PSY src/units/conversions.jl:102-103` returns `sb/db`; the category's own + `base_value` (db/V) and `system_base_value` (sb/V) imply DU→SU multiplies by **db/sb**. + `convert_units(c, v, CURRENT, DU, Float64)` and `convert_units(c, v, CURRENT, DU, SU)` + return reciprocal-scaled answers today. +- **Fix**: delete the 5 hand-written methods and define once: + `_du_to_su_ratio(c, cat::UnitCategory) = base_value(c, cat) / system_base_value(c, cat)` + (makes this bug class impossible; see also 4.2 for the cheap power-ratio form). + Add a test asserting `convert_units(c, v, cat, DU, Float64) == IS.ustrip-equivalent of + convert_units(c, v, cat, DU, SU)` for **every** category. + +### 1.4 Time-series scaling-factor multipliers: arity break +- `IS src/time_series_interface.jl` (~line 999): `_make_time_array` now calls + `multiplier(owner, units)` (with a hard-coded `units = SU` default threaded through + ~10 signatures). Every 1-arg multiplier breaks at retrieval time with a MethodError: + user closures, multipliers in previously serialized systems, and PSY's own generated + 1-arg getters — e.g. the documented reserve pattern + `scaling_factor_multiplier = get_requirement` on `VariableReserve` (PSY generates only + `get_requirement(value::VariableReserve)`; IS's own tests needed 2-arg `get_val` shims). +- **Fix** (three parts): + 1. Restore 1-arg compatibility at the call boundary, e.g. + `_apply_multiplier(m, owner, units) = applicable(m, owner, units) ? m(owner, units) : m(owner)` + (resolve once per retrieval, not per row). + 2. Replace the literal `SU` default with a trait IS owns and PSY implements: + `default_units(owner)` (IS fallback: a no-conversion marker). Domain policy ("SU") + does not belong in domain-agnostic IS. + 3. PSY descriptor: `VariableReserve.requirement` is the only reserve `requirement` + lacking `needs_conversion` (siblings `ConstantReserve`, `ConstantReserveNonSpinning`, + `VariableReserveNonSpinning` all have it). Decide deliberately: if it should convert, + add the flag and regenerate; if not, document why. + Note the semantic change regardless: on `main`, scaling respected the system's dynamic + units base; on IS4 it is fixed. Document this in the IS4 migration notes. +- Tests: retrieval with a 1-arg closure multiplier; retrieval with a generated 2-arg + getter; a deserialized-system round-trip that exercises a stored multiplier name. + +### 1.5 `len` kwarg accepted and silently ignored in TS cost getters +- `PSY src/models/cost_function_timeseries.jl` (~line 107 and siblings: + `get_variable_cost`, `get_incremental/decremental_variable_cost`, + `get_import/export_variable_cost`, `get_no_load_cost`, `get_shut_down`, + `ReserveDemandTimeSeriesCurve.get_variable_cost`): the getter takes `len` but resolves + exactly one timestep via `IS.build_static_curve` (which supports only `len = 1`; IS + carries a TODO). A caller requesting a 24-period window silently gets hour-1 bids for + all 24 hours. +- **Fix**: until windowed resolution lands (see 4.1), make `len != 1` (or `!isnothing(len)` + beyond one step) **throw** `ArgumentError("windowed cost retrieval not yet supported")` + rather than silently truncate. Then implement the windowed path: one metadata resolution + + one HDF5 window read returning `Vector{<:ValueCurve}`. + +### 1.6 Branch admittance with missing base voltage: silent DU return +- `PSY src/models/components.jl:106-126`: the `:siemens` → `SIEMENS`/`NU` conversion, when + the from-bus base voltage is `nothing`, logs an un-throttled `@warn` and returns + `value * DU` — the caller asked for siemens and receives a device-base per-unit number + that `_strip_units` then silently unwraps. The `:ohm` twin **errors** in the same state. +- **Fix**: make `:siemens` error exactly like `:ohm` (consistent, type-stable, no per-call + warn). If a lenient mode is truly needed, it must return `missing`, never a mislabeled + number. + +### 1.7 2W transformer Ω/S set→get round-trip drift +- Setter (`components.jl:204-218`, `T <: Branch`) divides by `get_base_voltage(get_arc(c).from)`; + getter (`components.jl:98-126`, `T <: TwoWindingTransformer`) multiplies by + `get_base_voltage_primary(c)`. These coincide only as a construction-time snapshot; + `set_base_voltage_primary!`, `set_arc!`, constructor kwargs, or editing the bus voltage + desynchronize them → e.g. (230/115)² = 4× round-trip error. SU paths are consistent + (power-only); the drift is specific to Unitful Ω/S values. +- **Fix**: add `TwoWindingTransformer`-specific Quantity setters using + `get_base_voltage_primary`, or better, give both directions one base-voltage resolver + per component type (falls out of the 3.1 consolidation). Add a round-trip test with + `base_voltage_primary ≠ arc.from` voltage. + +### 1.8 `RelativeQuantity` is a leaky `Number` (IS `src/relative_units.jl`) +All verified by execution: +- `(0.6*DU)*SU` silently nests: `Base.:*(a::Number, b::AbstractRelativeUnit)` (line 75) + accepts `a::RelativeQuantity` → `RelativeQuantity{RelativeQuantity{…,DU},SU}`; downstream + `set_value`/`convert_units` then treat DU data as SU. **Fix**: add + `Base.:*(::RelativeQuantity, ::AbstractRelativeUnit)` (and the flipped order) that throws + `ArgumentError("value is already unit-tagged")`. +- `zero(q)`, `iszero(q)`, `isfinite(q)` MethodError on every instance (Base instance + fallback needs `oftype`/constructor from `Real`). **Fix**: define instance `zero`/`one`, + `iszero`, `isnan`, `isfinite`, `abs`, and unary ops on `q.value` directly. Do **not** + add `convert(::Type{RelativeQuantity}, ::Real)` — implicit unit-attachment is the bug + class this design exists to prevent. +- No `Base.hash` while `==` spans value types (`RQ(1,DU) == RQ(1.0,DU)`, + `0.0DU == -0.0DU`) → Dict/Set lookups raise KeyError for equal keys. **Fix**: + `Base.hash(q::RelativeQuantity{<:Any,U}, h::UInt) where {U} = hash(q.value, hash(U, h))`. +- Mixed-unit `==`/`isequal`/`in` throw a cryptic promotion `ErrorException` instead of + returning `false`. **Fix**: define cross-unit `==`/`isequal` returning `false`; keep + ordered comparisons (`<`, `<=`, arithmetic) as errors but with an informative + `ArgumentError` (mixing DU/SU is a user mistake worth a clear message). +- `isapprox(q, 0.6)` vs a plain `Real` throws (`MethodError` in `real`). Decide one + semantics and implement it: recommended — error with a clear message telling the user to + compare `ustrip`/same-tagged values; silent raw-value comparison would hide base mixups. +- Test: a dedicated `RelativeQuantity` Number-interface testset (hash/Dict/Set, zero/one, + iszero/isfinite, mixed-unit equality false, nested-tagging error, `q^2` error message). + +### 1.9 Detached-component display crashes (PSY `src/utils/print.jl:10-15`) +- `_show_accessor_value` catches the "not attached to a system" error from the SU getter + and retries `getter_func(ist, NU)` **outside the try** — for components without their own + `base_power` field (`Line`, `MonitoredLine`, HVDC lines, …) the NU path needs the system + base too and rethrows the same error uncaught. REPL display of any not-yet-attached + `Line` crashes immediately after warning "displaying in natural units". +- **Fix**: wrap the NU retry; on failure print the raw stored value annotated `(device base)` + — never error from `show`. Test: `repr(MIME"text/plain"(), Line(nothing))` (and inside a + vector) succeeds. + +### 1.10 `display_units_arg` trait never matches parametric structs +- IS template (`src/utils/generate_structs.jl`, ~line 71) emits + `display_units_arg(::typeof(get_X), ::Type{ {{struct_name}} })`. For parametric structs + this is the **UnionAll singleton** — `Type{ConstantReserve{ReserveUp}} <: Type{ConstantReserve}` + is false — so both call sites (`PSY print.jl:8`, `IS print_pt.jl:132` pass + `typeof(component)`) get `missing` and fall back to a 1-arg getter that no longer exists. + REPL display of any `ConstantReserve{T}` / `ConstantReserveGroup{T}` instance throws + MethodError; `show_components(sys, ConstantReserve{ReserveUp}, [:requirement])` too. +- **Fix in the template**: emit `::Type{<:{{struct_name}}}` and regenerate PSY structs. + Test: REPL repr of a `ConstantReserve{ReserveUp}` instance; `show_components` with a + units column over a parametric type. + +### 1.11 `ImportExportCost` compat constructor: infinite recursion +- `PSY src/models/cost_functions/ImportExportCost.jl:62-76`: the positional compat + constructor recursively calls `ImportExportCost(...)`, which re-selects itself whenever + the implicit constructor doesn't match — any concretely-typed services vector + (`[my_reserve]`) or mixed-`U` curves → StackOverflowError (replica-reproduced). It is + also dead for its stated purpose: deserialization goes through the kwarg constructor. +- **Fix**: delete it (preferred), or make it construct via the kwarg form with explicit + same-`U` validation. Test: `ImportExportCost(nothing, nothing, 1.0, 1.0, VariableReserve{ReserveUp}[])` + returns or throws an `ArgumentError` — never overflows. + +### 1.12 `is_import_export_curve` calls `iszero(::Nothing)` +- `ImportExportCost.jl` (~line 107): `iszero(get_initial_input(...))`/`iszero(get_input_at_zero(...))` + on `Union{Nothing, Float64}` fields — MethodError for any curve built with the documented + 3-arg `PiecewiseIncrementalCurve` form, **including the package's own `ZERO_OFFER_CURVE` + default**. +- **Fix**: treat `nothing` explicitly (`_iszero_or_nothing(x) = isnothing(x) || iszero(x)` — + pick the semantics intended for "is this a pure import/export curve" and test both arms). + +### 1.13 `set_variable_cost!` family vs `U`-pinned cost fields +- `PSY src/models/cost_function_timeseries.jl` (~lines 367-394, 414-451): + - `_check_power_units` validates the data against the caller's `power_units` **argument**, + never against the cost's own `U`; `MarketBidCost{NaturalUnit}` (the default, via + `ZERO_OFFER_CURVE`) then fails in `setproperty!` convert with a raw MethodError — + SU/DU bids can never be set on an existing cost. + - The same setters' validator deliberately admits `MarketBidTimeSeriesCost`, whose field + is `CostCurve{TimeSeriesPiecewiseIncrementalCurve,U}` — assignment can never succeed. +- **Fix**: decide the model. Recommended: setters **rebuild** the cost object with the new + `U` (costs are plain data; replace the whole `MarketBidCost{U}` on the component) and the + validator rejects `MarketBidTimeSeriesCost` for static-curve setters with an actionable + `ArgumentError`. Add tests: set SU bid data on a default cost; static setter on a + TS-cost component errors cleanly. + +### 1.14 `ThermalFuels.OTHEHR_BIOMASS_GAS` rename breaks old systems +- `PSY src/definitions.jl` (~line 379): renamed to `OTHER_BIOMASS_GAS` with no + deserialization alias. Scoped enums serialize by name → loading any system saved by a + prior release with that fuel throws `MethodError: no method matching + _name2value(::Val{:OTHEHR_BIOMASS_GAS})` (reproduced). +- **Fix**: add a deserialization-time alias (e.g. in the JSON→enum path or data-format + migration for the old name). Breaking renames need a migration entry, not just a PR note. + Test: deserialize a fixture containing the old string. + +### 1.15 IS enum `convert` calls an undefined function +- `IS src/Optimization/enums.jl:3` and `IS src/Simulation/enums.jl:13-14`: + `Base.convert(::Type{ModelBuildStatus|SimulationBuildStatus|RunStatus}, ::String)` call + `get_enum_value`, defined **nowhere in IS** (it lives in PSY) → `UndefVarError` on first + use. No test exercises them. +- **Fix**: `@scoped_enum` already provides a String constructor — the body is `T(val)`. + Add one conversion test per enum. + +### 1.16 IS trait methods return `ArgumentError` instead of throwing +- `IS src/Optimization/optimization_container_types.jl:15, 24`: + `convert_output_to_natural_units(::Type{<:InitialConditionType})` and + `should_write_resulting_value(::Type{<:InitialConditionType})` **return** the + `ArgumentError(...)` object. Boolean contexts then raise a confusing `TypeError`. +- **Fix**: `throw(...)`. Grep both files for the same pattern elsewhere. + +### 1.17 `ext` serialization validation regressions (IS `src/serialization.jl`) +- The new `_is_ext_value_basic` allowlist (~line 338) rejects `Char` and plain `Base.@enum` + values (`isstructtype` is false for primitives) that JSON3 happily serialized on `main` → + `to_json(sys)` now errors for previously valid systems. +- The recursion uses `getfield(x, name)` without an `isdefined` guard and runs **outside** + the `try` that wraps only `JSON.json` → an `ext` struct with an `#undef` field escapes as + a raw `UndefRefError` instead of the friendly "cannot be serialized" error (reproduced). +- **Fix**: accept `Char` and `Base.Enum` explicitly (they JSON-serialize as strings); + add `isdefined(x, name) || return false` in the recursion (or move it inside the try). + Tests: ext with `Char`, a plain `@enum`, and an incompletely-initialized mutable struct. + +### 1.18 Legacy `UnitSystem` enum bridge: positional only +- `IS src/production_variable_cost_curve.jl`: the compat bridge accepts the legacy enum + positionally (~line 292) but the kwarg constructors annotate + `power_units::AbstractUnitSystem` → `CostCurve(; value_curve = lc, + power_units = IS.UnitSystem.SYSTEM_BASE)` (worked on `main`) now throws `TypeError`. +- **Fix**: accept `Union{AbstractUnitSystem, UnitSystem}` in the kwarg constructors and + normalize, or delete the bridge entirely and migrate callers (it exists for + PowerSystemCaseBuilder fixtures — check before deleting). Test the kwarg+enum form. + +--- + +## Phase 2 — API hygiene (do after Phase 1; several overlap with Phase 3 refactors) + +### 2.1 `ustrip`: three mechanisms, one collision +- IS defines its own generic `ustrip` (only method: `RelativeQuantity`) *and* `_strip_units`; + PSY imports and **exports** IS's `ustrip` while also depending on Unitful, which exports + its own. Consequences: `using PowerSystems, Unitful` makes unqualified `ustrip` ambiguous, + and PSY's exported `ustrip` MethodErrors on the `Unitful.Quantity` values its own + `*_unitful` getters return. +- **Fix**: delete `RelativeUnits.ustrip`; keep `_strip_units` as IS's single internal strip + extension point; in PSY define `Unitful.ustrip(q::IS.RelativeQuantity) = q.value` so one + public generic handles both quantity kinds; stop exporting `ustrip` from PSY (Unitful's + works once PSY extends it). Migrate the internal call sites (set_value, set_base_power!). + +### 2.2 Orphaned IS `get_value`/`set_value` stubs +- `IS src/InfrastructureSystems.jl:14-17` declares and exports zero-method generics that + PSY does not extend (PSY defines its **own** functions of the same names). Two maximally + generic exported names with no methods invite clashes. +- **Fix**: either have PSY extend `IS.get_value`/`IS.set_value` (preferred — one shared + generic, and IS code could then call it) or delete the stubs and exports. + +### 2.3 `convert_cost_coefficient` (IS `src/relative_units.jl:148-177`) +- Exported, documented, 9-method ratio table — zero callers in IS src or PSY (only its own + tests), and its `system_base_power`/`device_base_power` arguments are power-domain + concepts inside the module whose header says "domain-agnostic". +- **Fix**: delete from IS4 (reintroduce where the first consumer lands, presumably PSI, in + terms of PSY's `_du_to_su_ratio`). If kept for an imminent consumer, un-export and move + the power-specific semantics to PSY. + +### 2.4 `RelativeQuantity` carries a redundant field +- `unit::U` is fully determined by the singleton type parameter (the file's own + `zero`/`one` already reconstruct it as `U()`). +- **Fix**: drop the field (`RelativeQuantity{T,U}(value)`; `unit(q) = U()` accessor). Purely + mechanical; do together with 1.8. + +### 2.5 Misc, quick +- `IS src/outputs.jl:30`: error message says `write_output`, method is `write_outputs`. +- PSY `Project.toml` + `src/PowerSystems.jl` + `src/units/serialization.jl`: `StructTypes` + dependency and imports are dead (zero uses) — remove. +- IS `AnyCostCurve{T}` / `AnyFuelCurve{T}` / `AnyProductionVariableCostCurve{T}` aliases + duplicate what plain `CostCurve{T}` already means; the latter two have zero users — delete. +- Hand-rolled `deserialize(::Type{CostCurve/FuelCurve}, …)` lists fields explicitly; a + future field would be silently dropped. Route through `deserialize_to_dict` + + `T(; vals..., power_units = …)` so field lists come from the struct. +- IS test files copy the same `ForecastKey` fixture ~8 times — add a helper. + +--- + +## Phase 3 — Consolidation refactors (design debt; sequence after Phases 1-2) + +### 3.1 One conversion engine, not two and a half +PSY currently has **two parallel implementations** of per-unit conversion that have already +diverged behaviorally (missing-voltage handling; CurrentCategory inversion): +- the `Val{:mva}/:ohm/:siemens` × target × component-type ladder in + `src/models/components.jl` (`_convert_from_device_base`, ~20 methods + the hand-written + inverse `set_value` family) — used by all generated getters; +- the category engine in `src/units/conversions.jl` (`convert_units`, `base_value`, + `system_base_value`, `natural_unit`) — exported, but reachable in production **only** + through the 3W winding path; its scalar form MethodErrors on real components because no + 1-arg `_get_device_base_power(::Component)` method exists (its own docstring example is + broken). + +**Target architecture** (incremental, keep tests green at each step): +1. Implement the engine's component interface once: + `_get_device_base_power(c::Component) = _get_base_power(c)`; + `get_base_voltage(c::Branch) = get_base_voltage(get_arc(c).from)` (already exists); + `get_base_voltage(c::TwoWindingTransformer) = get_base_voltage_primary(c)` — making the + getter/setter base-voltage choice single-sourced (fixes 1.7 structurally). +2. Map `Val{:mva}/:ohm/:siemens` → category via the existing `_unit_category` and make + `_convert_from_device_base(c, v, cu, units) = convert_units(c, v, _unit_category(cu), DU, units)` + a one-liner; same for the `set_value` inverse (add `convert_units(..., from_units, DU)` + coverage). Delete the ladder. +3. Generalize windings as a *base provider*, not a parallel method family: a lightweight + `WindingBase(c, winding)` view implementing the same three interface functions lets the + entire 5-arg engine and all setters work per-winding; delete the duplicated 6-arg family + (`conversions.jl:236-274`). +4. Derive, don't restate: `_du_to_su_ratio(c, cat) = base_value(c, cat) / system_base_value(c, cat)` + (see 1.3), and for SU↔DU short-circuit with the power-only ratio (see 4.2). Remove the + `::Type{Float64}` target special-case — "strip the default units" belongs to the getter + layer (`_strip_units` ∘ `convert_units(..., DEFAULT_UNITS)`), not the engine. +5. Triplicated base-power accessor family (Component `components.jl:19-56`, System + `base.jl`, 3W `@eval` loop `components.jl:349-381`): extract one helper over the raw + MVA value and delegate all three. + +### 3.2 Codegen: units metadata should be data, not template literals +- The template hardcodes `display_units_arg(...) = SU` for every converted accessor and + forces `exclude_getter/exclude_setter` + ~30 hand-written lines for every exception + (`base_power`, winding base powers, …). +- **Fix**: per-field descriptor keys (e.g. `"display_units"`, `"storage_units"`) with SU/DU + defaults; template emits the trait from the descriptor. Hand-written accessor families + shrink to genuinely special cases. (Do together with the 1.10 template fix to regenerate + once.) + +### 3.3 IS time-series additions: extend mechanisms instead of forking them +- `TupleTimeSeries` invents a bespoke `namedtuple_fields` serialization key while its + sibling `TimeSeriesFunctionData{T}` uses the existing `PARAMETERS_KEY` / + `CONSTRUCT_WITH_PARAMETERS_KEY` mechanism — generic tooling resolves one but not the + other. Unify on the shared mechanism (extend it to structured parameters once). +- The three `TimeSeries*Curve` types pair with static counterparts by naming convention: + three near-identical `build_static_curve` bodies, the valid-FunctionData Union restated + 5×. Add `static_curve_type(::Type{TimeSeriesIncrementalCurve}) = IncrementalCurve` (and + a shared valid-data Union per kind) with one generic `build_static_curve`. + +### 3.4 Two units paradigms coexist in PSY — write the deprecation story +- The legacy stateful system (`SystemUnitsSettings`, `set_units_base_system!`, + `with_units_base`, `get_units_base`) survives in `base.jl` while getters/setters moved to + explicit units. They interact only at the time-series boundary (see 1.4's semantic note). +- **Fix**: decide and document: which APIs the enum still governs, the deprecation timeline, + and a migration guide section ("stateful → explicit units") in the PSY docs. Don't leave + both as apparent peers. + +--- + +## Phase 4 — Performance (hot paths; benchmark before/after with a realistic system) + +### 4.1 Time-series-backed cost resolution does 3×(SQLite + HDF5) per lookup +- `IS build_static_curve` / `build_static_tuple` issue up to three independent + `get_time_series_values(...; len = 1)` calls (function data, `initial_input`, + `input_at_zero`); each runs a full metadata SQL query (`_execute_cached` caches only the + prepared statement, not results) plus a 1-element HDF5 read. The consumer pattern + (PowerSimulations: per component × per timestep) multiplies this into millions of round + trips per simulation. +- **Fix**: implement windowed resolution (one metadata hit + one window read → + `Vector{<:ValueCurve}`) — this is also the prerequisite for honoring `len` (1.5) — and/or + route repeated lookups through `TimeSeriesCache`. Merge the three reads when the keys + reference the same series. + +### 4.2 DU↔SU conversions recompute voltage terms that cancel +- `convert_units(..., DU, SU)` computes `base_value/system_base_value`, fetching and + squaring base voltages twice per call even though they cancel for + impedance/admittance/current; on the 3W path that's 12 redundant winding-voltage + dispatches per `get_series_admittances(t3w, SU)` during Y-bus assembly. Worse, + `get_base_voltage(line)` (`supplemental_accessors.jl`) allocates **two strings** per call + (`_select_fewer_significant_figures` uses `string`/`rstrip`) whenever endpoint voltages + differ within tolerance. +- **Fix**: short-circuit relative↔relative conversions through the power-only ratio + (= `_du_to_su_ratio` from 1.3/3.1.4); make the significant-figures tiebreak numeric + (no string round-trip), and stop re-deriving the line base voltage per conversion. + +### 4.3 Abstract-typed time-series-key fields +- `time_series_key::TimeSeriesKey` (IS `time_series_function_data.jl`, `tuple_time_series.jl`, + and the `Union{Nothing, TimeSeriesKey}` fields on the TS curves) forces boxed loads + + dynamic dispatch in the per-timestep resolution path and breaks isbits. +- **Fix**: parameterize on the concrete key type or declare + `Union{Nothing, StaticTimeSeriesKey, ForecastKey}` so union-splitting applies. + +### 4.4 `show_components` per-cell work +- IS `print_pt.jl` resolves `Symbol("get_$column")`, `parentmodule`, `hasproperty`, and the + `display_units_arg` double-dynamic dispatch **inside** the row loop (rows × columns). +- **Fix**: hoist a per-column vector of `(getter, units_arg)` before the loop. + +--- + +## Security review result + +A dedicated security pass (parsers, SQL construction, deserialization type resolution, +eval/codegen, path handling) found **no high-confidence vulnerabilities** in either branch: +SQL stays parameterized in the metadata store; unit-string parsing is a hardcoded +allowlist (no `eval`/`uparse` of data); the only new `@eval` iterates hardcoded symbols at +load time; psy6 removes the legacy parser tree (net attack-surface reduction); the new +`ext` validation is stricter than `main` (modulo the 1.17 bugs). No action items. + +--- + +## Suggested order & verification + +1. Phase 0 (version/compat) — small, unblocks everything else being releasable. +2. Phase 1 items 1.3, 1.6, 1.8, 1.11, 1.12, 1.15, 1.16, 1.17 (small, independent, test-backed). +3. Phase 1 items 1.1 + 1.2 + 1.7 together with the 3.1 consolidation steps 1-3 (they share + the winding/base-provider mechanics) — this is the core units-correctness milestone. +4. Phase 1 items 1.4, 1.5 with 4.1 (shared time-series boundary work), then 1.9, 1.10 (one + regeneration), 1.13, 1.14, 1.18. +5. Phase 2, then remaining Phase 3, then Phase 4 with benchmarks. + +After each milestone: full PSY + IS test suites, the formatter, and a CHANGELOG entry. +Definition of done for the units work: a single conversion engine; every getter/setter +target documented in docstrings actually dispatches (grep for `units` docstring claims and +test MW/Ω/S/DU/SU/NU per component family); `RelativeQuantity` passes a Number-interface +testset; old-system deserialization fixtures load. diff --git a/docs/Project.toml b/docs/Project.toml index a20210d259..e6e63d6fa5 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -17,6 +17,10 @@ PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" TimeSeries = "9e3dc215-6440-5c97-bce1-76c03772f85e" TypeTree = "04da0e3b-1cad-4b2c-a963-fc1602baf1af" +[sources] +InfrastructureSystems = {url = "https://github.com/Sienna-Platform/InfrastructureSystems.jl.git", rev = "IS4"} +PowerSystemCaseBuilder = {url = "https://github.com/NREL-Sienna/PowerSystemCaseBuilder.jl", rev = "psy6"} + [compat] CSV = "~0.10" Documenter = "=1.15.0" diff --git a/docs/src/explanation/per_unit.md b/docs/src/explanation/per_unit.md index 511adc445e..3bdc72248f 100644 --- a/docs/src/explanation/per_unit.md +++ b/docs/src/explanation/per_unit.md @@ -1,11 +1,11 @@ # [Per-unit Conventions](@id per_unit) It is often useful to express power systems data in relative terms using per-unit conventions. -`PowerSystems.jl` supports the automatic conversion of data between three different unit systems: +`PowerSystems.jl` supports conversion of data between three different unit systems: - 1. `"NATURAL_UNITS"`: The naturally defined units of each parameter (typically MW). - 2. `"SYSTEM_BASE"`: Parameter values are divided by the system `base_power`. - 3. `"DEVICE_BASE"`: Parameter values are divided by the device `base_power`. + 1. `NU` (natural units): The naturally defined units of each parameter (typically MW). + 2. `SU` (system base): Parameter values are divided by the system `base_power`. + 3. `DU` (device base): Parameter values are divided by the device `base_power`. `PowerSystems.jl` supports these unit systems because different power system tools and data sets use different units systems by convention, such as: @@ -15,39 +15,71 @@ sets use different units systems by convention, such as: - Production cost modeling data is often gathered from variety of data sources, which are typically defined in natural units -These three unit bases allow easy conversion between unit systems. -This allows `PowerSystems.jl` users to input data in the formats they have available, -as well as view data in the unit system that is most intuitive to them. - -You can get and set the unit system setting of a `System` with [`get_units_base`](@ref) and -[`set_units_base_system!`](@ref). To support a less stateful style of programming, -`PowerSystems.jl` provides the `Logging.with_logger`-inspired "context manager"-type -function [`with_units_base`](@ref), which sets the unit system to a particular value, -performs some action, then automatically sets the unit system back to its previous value. - -Conversion between unit systems does not change -the stored parameter values. Instead, unit system conversions are made when accessing -parameters using the [accessor functions](@ref dot_access), thus making it -imperative to utilize the accessor functions instead of the "dot" accessor methods to -ensure the return of the correct values. The units of the parameter values stored in each -struct are defined in `src/descriptors/power_system_structs.json`. - -There are some unit system conventions in `PowerSystems.jl` when defining new components. -Currently, when you define components that aren't attached to a `System`, -you must define all fields in `"DEVICE_BASE"`, except for certain components that don't -have their own `base_power` rating, such as [`Line`](@ref)s, where the `rating` must be -defined in `"SYSTEM_BASE"`. - -In the future, `PowerSystems.jl` hopes to support defining components in natural units. -For now, if you want to define data in natural units, you must first -set the system units to `"NATURAL_UNITS"`, define an empty component, and then use the -[accessor functions](@ref dot_access) (e.g., getters and setters), to define each field -within the component. The accessor functions will then do the data conversion from your -input data in natural units (e.g., MW or MVA) to per-unit. - -By default, `PowerSystems.jl` uses `"SYSTEM_BASE"` because many optimization problems won't -converge when using natural units. If you change the unit setting, it's suggested that you -switch back to `"SYSTEM_BASE"` before solving an optimization problem (for example in +## Explicit units in accessors + +As of PowerSystems 6, unit conversion is **explicit at every call site**: each unit-bearing +accessor takes a units argument, and each setter takes a unit-tagged value. There is no +system-wide mutable unit setting that changes what accessors return. + +```julia +get_active_power(gen, SU) # bare Float64, system-base per-unit +get_active_power(gen, DU) # bare Float64, device-base per-unit +get_active_power(gen, NU) # bare Float64, natural units (MW) +get_active_power(gen, MW) # bare Float64 in an explicit Unitful unit +get_active_power_unitful(gen, SU) # unit-bearing value (RelativeQuantity / Unitful.Quantity) + +set_active_power!(gen, 0.9 * SU) # values must carry their units +set_active_power!(gen, 90.0 * MW) +set_rating!(line, 1.2 * DU) +set_x!(transformer, 105.8 * OHMS) # impedance/admittance fields accept Ω / S +``` + +Conversion between unit systems does not change the stored parameter values — storage is +in device base (`DU`) for most fields. Conversions happen when accessing parameters +through the accessor functions, making it imperative to use the accessors instead of "dot" +field access. The units of the stored values for each struct are defined in +`src/descriptors/power_system_structs.json`. + +Bare `Float64` arguments to converted setters are rejected with an `ArgumentError`: the +caller must say what units the number is in (`val * SU`, `val * DU`, `val * MW`, …). The +unit-tagged per-unit values are [`RelativeQuantity`](@ref)s, whose unit marker is carried +in the type; mixing `DU`- and `SU`-tagged values in arithmetic or comparisons raises a +clear error instead of producing a silently wrong number. + +## Migration guide: stateful → explicit units + +Code written against PowerSystems 5 used a mutable system-wide unit setting: + +| PowerSystems 5 (stateful) | PowerSystems 6 (explicit) | +|:------------------------------------------------------------------------------- |:----------------------------------------------------------------------------------------------- | +| `set_units_base_system!(sys, "SYSTEM_BASE"); get_active_power(gen)` | `get_active_power(gen, SU)` | +| `with_units_base(sys, UnitSystem.NATURAL_UNITS) do; get_active_power(gen); end` | `get_active_power(gen, NU)` | +| `set_active_power!(gen, 0.9)` (interpreted via system setting) | `set_active_power!(gen, 0.9 * SU)` | +| `get_rating(line)` | `get_rating(line, SU)` | +| `scaling_factor_multiplier = get_max_active_power` (1-arg) | same name; the multiplier is invoked as `get_max_active_power(gen, units)` with `SU` by default | + +Notes: + + - Time-series retrieval passes a units argument to two-argument scaling-factor + multipliers; the default for PowerSystems components is `SU`. One-argument multipliers + (custom closures) are still invoked with the owner only. + - The `UnitSystem` enum (`get_units_base`, `set_units_base_system!`, + `with_units_base`) is system metadata only (shown in the `System` summary); it does + not affect any conversion. + - `CostCurve`/`FuelCurve` take the marker instances (`NaturalUnit()`, + `SystemBaseUnit()`, `DeviceBaseUnit()`) for `power_units`. + +## Defining components + +When you define components that aren't attached to a `System`, field values are stored as +given, in device base (`DU`), except for certain components that don't have their own +`base_power` rating, such as [`Line`](@ref)s, where values are relative to the system base +once attached. To define data in natural units, construct the component and then use the +explicit-units setters (e.g. `set_active_power!(gen, 90.0 * MW)`); the accessor does the +conversion to per-unit storage. + +By default, downstream optimization packages work in `SU` because many optimization +problems won't converge when using natural units (for example in [`PowerSimulations.jl`](https://sienna-platform.github.io/PowerSimulations.jl/stable/)). !!! note diff --git a/docs/src/explanation/power_concepts.md b/docs/src/explanation/power_concepts.md index 268ed720ac..27e09f5d71 100644 --- a/docs/src/explanation/power_concepts.md +++ b/docs/src/explanation/power_concepts.md @@ -27,7 +27,7 @@ Base power is a fundamental parameter for the per-unit system and represents the + Rotor field winding limits + Cooling system capacity - - **Access**: Retrieved using `get_rating(device)` + - **Access**: Retrieved using `get_rating(device, units)` (the `units` argument is required, e.g. `get_rating(device, DU)`) The rating is typically determined by the electrical design and thermal limits of the synchronous machine itself. It represents the maximum capability of the electrical generator, independent of the prime mover. @@ -46,7 +46,7 @@ The rating is typically determined by the electrical design and thermal limits o + Boiler capacity (for steam generators) + Fuel flow limitations - - **Access**: Retrieved using `get_max_active_power(device)` + - **Access**: Retrieved using `get_max_active_power(device, units)` (the `units` argument is required, e.g. `get_max_active_power(device, DU)`) The maximum active power is determined by the mechanical system that drives the generator. This is often less than the rating when considering only real power production. @@ -54,11 +54,11 @@ The maximum active power is determined by the mechanical system that drives the ### Storage Convention Summary -| Concept | Storage Units | Accessor Function | -|:---------------- |:------------------- |:------------------------ | -| Base Power | Natural units (MVA) | `get_base_power()` | -| Rating | Device base (p.u.) | `get_rating()` | -| Max Active Power | Device base (p.u.) | `get_max_active_power()` | +| Concept | Storage Units | Accessor Function | +|:---------------- |:------------------- |:------------------------------------- | +| Base Power | Natural units (MVA) | `get_base_power(device)` | +| Rating | Device base (p.u.) | `get_rating(device, units)` | +| Max Active Power | Device base (p.u.) | `get_max_active_power(device, units)` | ### Physical Interpretation @@ -84,38 +84,42 @@ In this example: ### Unit System Conversions -When you access these values through the PowerSystems.jl accessor functions, they are automatically converted based on the current unit system setting: +As of PowerSystems 6, unit conversion is **explicit at every call site**: each unit-bearing +accessor takes a `units` argument (`SU`, `DU`, `NU`, or an explicit `Unitful` unit such as +`MW`), and the value is converted accordingly. There is no system-wide mutable setting that +changes what accessors return. `base_power` is the exception — it is always in natural units +(MVA) and rejects per-unit (`SU`/`DU`) targets. ```julia -# Assuming base_power = 100 MVA, rating = 1.0 p.u., max_active_power = 0.95 p.u. +# Assuming base_power = 100 MVA, rating = 1.0 p.u. (device base), max_active_power = 0.95 p.u. (device base) sys = System(100.0) # System base power = 100 MVA gen = get_component(ThermalStandard, sys, "gen1") -# In DEVICE_BASE -set_units_base_system!(sys, "DEVICE_BASE") -get_base_power(gen) # Returns: 100.0 MVA (always natural units) -get_rating(gen) # Returns: 1.0 p.u. (on device base) -get_max_active_power(gen) # Returns: 0.95 p.u. (on device base) - -# In NATURAL_UNITS -set_units_base_system!(sys, "NATURAL_UNITS") -get_base_power(gen) # Returns: 100.0 MVA (always natural units) -get_rating(gen) # Returns: 100.0 MVA (converted from p.u.) -get_max_active_power(gen) # Returns: 95.0 MW (converted from p.u.) - -# In SYSTEM_BASE -set_units_base_system!(sys, "SYSTEM_BASE") -get_base_power(gen) # Returns: 100.0 MVA (always natural units) -get_rating(gen) # Returns: 1.0 p.u. (on system base, assuming system base = device base) -get_max_active_power(gen) # Returns: 0.95 p.u. (on system base) +# Base power is always natural units (MVA); it accepts only `NU` / power-Unitful targets +get_base_power(gen) # Returns: 100.0 (MVA, always natural units) +get_base_power(gen, NU) # Returns: 100.0 (MVA) +# get_base_power(gen, DU) # ERROR: per-unit bases are not valid for base_power + +# Device base (`DU`) +get_rating(gen, DU) # Returns: 1.0 (p.u. on device base) +get_max_active_power(gen, DU) # Returns: 0.95 (p.u. on device base) + +# Natural units (`NU`) +get_rating(gen, NU) # Returns: 100.0 (MVA) +get_max_active_power(gen, NU) # Returns: 95.0 (MW) + +# System base (`SU`) — here the system base equals the device base +get_rating(gen, SU) # Returns: 1.0 (p.u. on system base) +get_max_active_power(gen, SU) # Returns: 0.95 (p.u. on system base) ``` !!! note - Base power is **always** returned in natural units (MVA) regardless of the unit system setting. The rating and maximum active power are stored in device base but are automatically converted when accessed based on the current unit system setting. + `base_power` is **always** in natural units (MVA) and rejects `SU`/`DU` targets — it is the + anchor that every other field's per-unitization is defined against. Rating and maximum active + power are stored in device base and converted to whatever `units` you request at the call site. ## See Also - [Per-unit Conventions](@ref per_unit) - Detailed explanation of unit systems in PowerSystems.jl - [`ThermalStandard`](@ref) - Generator type with these power parameters - - [`get_units_base`](@ref) and [`set_units_base_system!`](@ref) - Functions for managing unit systems diff --git a/docs/src/how_to/add_component_natural_units.md b/docs/src/how_to/add_component_natural_units.md index 8a54c33f3b..bb9e26adfd 100644 --- a/docs/src/how_to/add_component_natural_units.md +++ b/docs/src/how_to/add_component_natural_units.md @@ -6,32 +6,23 @@ using PowerSystemCaseBuilder #hide system = build_system(PSISystems, "modified_RTS_GMLC_DA_sys"); #hide ``` -`PowerSystems.jl` has [three per-unitization options](@ref per_unit) for getting, setting -and displaying data. +`PowerSystems.jl` has [three per-unitization options](@ref per_unit) for getting and setting +data, selected explicitly at each call site by a units argument. -Currently, only one of these options -- `"DEVICE_BASE"` -- is supported when using a -constructor function define a component. You can see -[an example of the default capabilities using `"DEVICE_BASE"` here](@ref "Adding Loads and Generators"). +Constructors define a component's numeric fields in **device base** (`DU`): bare numbers +passed to a constructor are interpreted as per-unit on the device's own `base_power`. You can +see [an example of defining a component this way here](@ref "Adding Loads and Generators"). -We hope to add capability to define components in -`"NATURAL_UNITS"` with constructors in the future, but for now, below is a workaround -for users who prefer to define data using `"NATURAL_UNITS"` (e.g., MW, MVA, MVAR, or MW/min): +If you prefer to define data in **natural units** (e.g., MW, MVA, MVAR, or MW/min), pass +unit-tagged values to the "setter" functions after constructing the component — the setters +convert to the stored device-base representation for you. There is no longer a system-wide +unit setting to toggle (see [Per-unit Conventions](@ref per_unit)). -### Step 1: Set Units Base - -Set your (previously-defined) `System`'s units base to `"NATURAL_UNITS"`: - -```@repl add_in_nu -set_units_base_system!(system, "NATURAL_UNITS") -``` - -Now, the "setter" functions have been switched to define data using natural units (MW, MVA, -etc.), taking care of the necessary data conversions behind the scenes. - -### Step 2: Define Empty Component +### Step 1: Define Empty Component Define an empty component with `0.0` or `nothing` for all the power-related fields except -`base_power`, which is always in MVA. +`base_power`, which is always in MVA. (Bare numbers in the constructor are device-base +per-unit; here every power field starts at `0.0`.) For example: @@ -56,7 +47,7 @@ gas1 = ThermalStandard(; ); ``` -### Step 3: Attach the Component +### Step 2: Attach the Component Attach the component to your `System`: @@ -64,24 +55,26 @@ Attach the component to your `System`: add_component!(system, gas1) ``` -### Step 4: Add Data with "setter" Functions +### Step 3: Add Data with "setter" Functions -Use individual "setter" functions to set each the value of each numeric field in natural -units: +Use individual "setter" functions, passing **unit-tagged** natural-units values (`MW`, +`Mvar`, etc.). The setters convert each value to device base behind the scenes: ```@repl add_in_nu -set_rating!(gas1, 30.0) #MVA -set_active_power_limits!(gas1, (min = 6.0, max = 30.0)) # MW -set_reactive_power_limits!(gas1, (min = 6.0, max = 30.0)) # MVAR -set_ramp_limits!(gas1, (up = 6.0, down = 6.0)) #MW/min +set_rating!(gas1, 30.0 * MVA) +set_active_power_limits!(gas1, (min = 6.0 * MW, max = 30.0 * MW)) +set_reactive_power_limits!(gas1, (min = 6.0 * Mvar, max = 30.0 * Mvar)) +set_ramp_limits!(gas1, (up = 6.0 * MW, down = 6.0 * MW)) # ramp limits per-unitize by base_power ``` -Notice the return values are divided by the `base_power` of 30 MW, showing the setters have -done the per-unit conversion into `"DEVICE_BASE"` behind the scenes. +A bare number (e.g. `set_rating!(gas1, 30.0)`) is rejected with an `ArgumentError`: setters +require the value to carry its units. Reading the values back in device base +(`get_rating(gas1, DU)`) shows them divided by the `base_power` of 30 MVA — the per-unit +conversion the setters performed. !!! tip - Steps 2-4 can be called within a `for` loop to define many components at once (or step 3 + Steps 1-3 can be called within a `for` loop to define many components at once (or step 2 can be replaced with [`add_components!`](@ref) to add all components at once). #### See Also diff --git a/docs/src/how_to/create_hydro_datasets.md b/docs/src/how_to/create_hydro_datasets.md index 5886170385..d8bbd9f2af 100644 --- a/docs/src/how_to/create_hydro_datasets.md +++ b/docs/src/how_to/create_hydro_datasets.md @@ -28,7 +28,6 @@ import PowerSystems as PSY # Create a system sys = System(100.0) -set_units_base_system!(sys, "NATURAL_UNITS") # Create and add a bus bus = ACBus(; @@ -92,7 +91,6 @@ set_downstream_turbine!(reservoir, turbine) ```julia sys = System(100.0) -set_units_base_system!(sys, "NATURAL_UNITS") # Create and add a bus bus = ACBus(; diff --git a/docs/src/tutorials/creating_system.jl b/docs/src/tutorials/creating_system.jl index 2773fc259b..1fff3eb12b 100644 --- a/docs/src/tutorials/creating_system.jl +++ b/docs/src/tutorials/creating_system.jl @@ -227,62 +227,41 @@ get_bus(retrieved_component) # calculations that the getter functions will properly handle for you, as you'll see # below. -# ## Changing [`System`](@ref) Per-Unit Settings -# Now, let's use a getter function to look up the solar generator's `rating`: +# ## Per-Unit Conversions with Explicit Units +# Now, let's use a getter function to look up the solar generator's `rating`. As of +# PowerSystems 6, every unit-bearing accessor takes an explicit `units` argument; there is no +# system-wide setting that changes what getters return (see [Per-unit Conventions](@ref per_unit)). +# Ask for the rating in **system base** (`SU`): -get_rating(retrieved_component) +get_rating(retrieved_component, SU) # !!! tip "Important" -# When we defined the solar generator, we defined the rating -# as 1.0 per-unit with a device `base_power` of 5.0 MVA. Notice that the rating now reads -# 0.05. After we attached this component to our [`System`](@ref), its power data is being -# returned to us in the [`System`](@ref)'s units base. -# Let's double-check the [`System`](@ref)'s units base: - -get_units_base(sys) - -# `SYSTEM_BASE` means all power-related (MW, MVA, MVAR, MW/min) component data in -# the [`System`](@ref), except for each component's `base_power`, is per-unitized by the -# system base power for consistency. -# Check the [`System`](@ref)'s base_power again: +# We defined the solar generator with a rating of 1.0 per-unit on a device `base_power` +# of 5.0 MVA. In system base it reads 0.05 = (5 MVA) / (100 MVA): power-related data +# (MW, MVA, MVAR, MW/min) is per-unitized by the system's base power. +# Check the [`System`](@ref)'s base power: get_base_power(sys) -# Notice that when we called `get_rating` above, the solar generator's rating, 5.0 MW, -# is being returned as 0.05 = (5 MVA)/(100 MVA) using the system base power. -# Instead of using the [`System`](@ref) base power, let's view everything in MW or MVA -- or what we -# call "NATURAL_UNITS" in PowerSystems. -# Change the [`System`](@ref)'s unit system: - -set_units_base_system!(sys, "NATURAL_UNITS") +# View the same rating in **natural units** (`NU`, i.e. MW / MVA): -# Now retrieve the solar generator's rating again: +get_rating(retrieved_component, NU) -get_rating(retrieved_component) +# The value is now its "natural" value, 5.0 MVA. Finally, in **device base** (`DU`): -# Notice that the value is now its "natural" value, 5.0 MVA. -# Finally, let's change the [`System`](@ref)'s unit system to the final option, "DEVICE_BASE": +get_rating(retrieved_component, DU) -set_units_base_system!(sys, "DEVICE_BASE") +# This reads 1.0 — 5.0 MVA per-unitized by the device's own `base_power` of 5.0 MVA, which is +# the format we used to originally define the device. +# +# The legacy `UnitSystem` enum (`get_units_base`, `set_units_base_system!`, `with_units_base`) +# still exists, but it is now **system metadata only**: it is shown in the `System` summary and +# no longer changes what the accessors return. -# And retrieve the solar generator's rating once more: - -get_rating(retrieved_component) - -# See that now the data is now 1.0 (5.0 MVA per-unitized by the generator (i.e., the device's) -# `base_power` of 5.0 MVA), which is the format we used to originally define the device. -# As a shortcut to temporarily set the [`System`](@ref)'s unit system to a particular value, perform -# some action, and then automatically set it back to what it was before, we can use -# `with_units_base` and a [`do` block](https://docs.julialang.org/en/v1/manual/functions/#Do-Block-Syntax-for-Function-Arguments): - -with_units_base(sys, "NATURAL_UNITS") do - ## Everything inside this block will run as if the unit system were NATURAL_UNITS - get_rating(retrieved_component) -end -get_units_base(sys) # Unit system goes back to previous value when the block ends +get_units_base(sys) -# Recall that if you ever need to check a [`System`](@ref)'s settings, including the unit system being -# used by all the getter functions, you can always just print the [`System`](@ref): +# Recall that you can always print the [`System`](@ref) to check its settings, including this +# units-base metadata: sys diff --git a/docs/src/tutorials/manipulating_datasets.jl b/docs/src/tutorials/manipulating_datasets.jl index 1c3ef64722..71685e465d 100644 --- a/docs/src/tutorials/manipulating_datasets.jl +++ b/docs/src/tutorials/manipulating_datasets.jl @@ -63,15 +63,17 @@ set_fuel!(solitude, ThermalFuels.NATURAL_GAS) show_components(ThermalStandard, sys, [:fuel]) # Similarly, you can updated the `active_power` field using its specific `get_*` and `set_*` functions. -# We can access this field by using [`get_active_power`](@ref get_active_power(value::ThermalStandard)): +# Accessors take an explicit `units` argument; here we read it in natural units (MW) with +# [`get_active_power`](@ref get_active_power(value::ThermalStandard)): -get_active_power(solitude) +get_active_power(solitude, NU) -# We can then update it using [`set_active_power!`](@ref set_active_power!(value::ThermalStandard, val)): +# We can then update it with [`set_active_power!`](@ref set_active_power!(value::ThermalStandard, val)), +# passing a unit-tagged value (a bare number is rejected): -set_active_power!(solitude, 4.0) +set_active_power!(solitude, 4.0 * MW) -# We can see that our `active_power` field has been updated to 4.0. +# We can see that our `active_power` field has been updated to 4.0 MW. # ## Accessing and Updating Multiple Components in the System at Once # We can also update more than one component at a time using the [`get_components`](@ref get_components( @@ -158,7 +160,7 @@ thermal_not_solitude = get_components(x -> get_name(x) != "Solitude", ThermalSta # Now let's update the `active_power` field of these four thermal generators using the [`set_active_power!`](@ref) function. for i in thermal_not_solitude - set_active_power!(i, 0.0) + set_active_power!(i, 0.0 * MW) end # Let's check the update using [`show_components`](@ref): @@ -169,7 +171,7 @@ show_components(ThermalStandard, sys, [:active_power]) # We can filter on any component field. Similarly, let's filter all of the thermal generators # that now have an `active_power` of 0.0, and also set their availability to false. -for i in get_components(x -> get_active_power(x) == 0.0, ThermalStandard, sys) +for i in get_components(x -> get_active_power(x, NU) == 0.0, ThermalStandard, sys) set_available!(i, 0) end diff --git a/docs/src/tutorials/working_with_time_series.jl b/docs/src/tutorials/working_with_time_series.jl index 6d9d846920..6085149944 100644 --- a/docs/src/tutorials/working_with_time_series.jl +++ b/docs/src/tutorials/working_with_time_series.jl @@ -72,10 +72,8 @@ load2 = PowerLoad(; ); add_components!(system, [bus1, wind1, load1, load2]) -# Recall that we can also set the [`System`](@ref)'s unit base to natural units (MW) -# to make it easier to inspect results: - -set_units_base_system!(system, "NATURAL_UNITS") +# Recall that accessors take an explicit `units` argument, so we can inspect any value in the +# units we want (e.g. `get_max_active_power(load2, NU)` for MW) without changing global state. # Before we get started, print `wind1` to see its data: @@ -214,9 +212,9 @@ show_time_series(load1) get_time_series_array(SingleTimeSeries, load1, "max_active_power") # in MW # See that the normalized values have been scaled up by 10 MW. -# Now let's look at `load2`. First check its `max_active_power` parameter: +# Now let's look at `load2`. First check its `max_active_power` parameter in natural units (MW): -get_max_active_power(load2) +get_max_active_power(load2, NU) # This has a higher peak maximum demand of 30 MW. # Next, retrieve its `max_active_power` time series: @@ -371,9 +369,9 @@ for window in iterate_windows(forecast) end # Finally, use [`get_max_active_power`](@ref get_max_active_power(d::RenewableGen)) to -# check the expected maximum: +# check the expected maximum (in natural units, MW): -get_max_active_power(wind1) +get_max_active_power(wind1, NU) # See that the forecasts are not exceeding this maximum -- sanity check complete. # !!! tip diff --git a/src/PowerSystems.jl b/src/PowerSystems.jl index 066087d104..fae075af99 100644 --- a/src/PowerSystems.jl +++ b/src/PowerSystems.jl @@ -492,6 +492,9 @@ export get_time_series_array export get_time_series_resolutions export supports_time_series export supports_supplemental_attributes +export supports_active_power +export supports_reactive_power +export supports_voltage_control export get_time_series_timestamps export get_time_series_values export get_time_series_counts @@ -621,7 +624,6 @@ export UnitCategory, 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 @@ -659,11 +661,12 @@ import JSON import Base.to_index import PrettyTables import Unitful -using Unitful: @u_str, @unit, Quantity, Units, uconvert -import StructTypes +using Unitful: @u_str, @unit, Quantity, Units, uconvert, ustrip # Relative-unit primitives live in IS; PSY re-exports them for downstream # packages so that `PSY.DU`, `PSY.RelativeQuantity`, etc. keep working. +# `get_value`/`set_value` are IS's units-interface generics: PSY EXTENDS them +# (adds the power-domain methods) rather than defining its own functions. import InfrastructureSystems: AbstractRelativeUnit, DeviceBaseUnit, @@ -673,7 +676,8 @@ import InfrastructureSystems: DU, SU, NU, - ustrip + get_value, + set_value # Import InfrastructureSystems both as full module name (needed for internal macros like @forward) # and with alias for convenient usage throughout the codebase diff --git a/src/base.jl b/src/base.jl index 9652bc4ca8..f8ffd60600 100644 --- a/src/base.jl +++ b/src/base.jl @@ -517,7 +517,8 @@ _set_units_base!(system::System, settings::String) = _set_units_base!(system::System, UNIT_SYSTEM_MAPPING[uppercase(settings)]) """ -Sets the units base for the getter functions on the devices. It modifies the behavior of all getter functions +Set the system's stored [units base](@ref per_unit) setting. This is system +metadata only; the unit-aware getters and setters take their units explicitly. # Examples ```julia @@ -536,7 +537,7 @@ end _get_units_base(system::System) = system.units_settings.unit_system """ -Get the system's [unit base](@ref per_unit)) +Get the system's stored [units base](@ref per_unit) setting. """ function get_units_base(system::System) return string(_get_units_base(system)) diff --git a/src/definitions.jl b/src/definitions.jl index b7ba7f2d47..86f061c8cf 100644 --- a/src/definitions.jl +++ b/src/definitions.jl @@ -587,6 +587,11 @@ const BRANCH_BUS_VOLTAGE_DIFFERENCE_TOL = 0.01 const ZERO_IMPEDANCE_REACTANCE_THRESHOLD = 1e-4 +# Absolute threshold below which a shunt admittance component (conductance or +# susceptance) is treated as zero for capability detection, so negligible +# admittances do not force their host bus to be kept during network reduction. +const ZERO_ADMITTANCE_THRESHOLD = 1e-4 + const WINDING_NAMES = Dict( WindingCategory.PRIMARY_WINDING => "primary", WindingCategory.SECONDARY_WINDING => "secondary", diff --git a/src/descriptors/power_system_structs.json b/src/descriptors/power_system_structs.json index 01c0523579..fa9e74d06a 100644 --- a/src/descriptors/power_system_structs.json +++ b/src/descriptors/power_system_structs.json @@ -7559,9 +7559,11 @@ }, { "name": "requirement", - "comment": "the required quantity of the product should be scaled by a TimeSeriesData", + "comment": "the required quantity of the product in p.u. ([`SYSTEM_BASE`](@ref per_unit)), to be scaled by a TimeSeriesData", "null_value": "0.0", - "data_type": "Float64" + "data_type": "Float64", + "needs_conversion": true, + "conversion_unit": ":mva" }, { "name": "sustained_time", diff --git a/src/emissions_data.jl b/src/emissions_data.jl index 31712c3e69..8b2c748deb 100644 --- a/src/emissions_data.jl +++ b/src/emissions_data.jl @@ -1,7 +1,7 @@ """ EmissionsData(; name, pollutant, emission_rate, basis, energy_unit, ...) -A [`SupplementalAttribute`](@ref) describing the emission of a single pollutant from a +A [supplemental attribute](@ref supplemental_attributes) describing the emission of a single pollutant from a host component. Combines pollutant identity (CO2, NOx, etc.) with an emission rate expressed as a [`ValueCurve`](@ref) (supporting constant, linear, or piecewise relationships between fuel consumption / power output and emissions). One `EmissionsData` diff --git a/src/models/components.jl b/src/models/components.jl index 157bc5de6b..9648fb403a 100644 --- a/src/models/components.jl +++ b/src/models/components.jl @@ -11,6 +11,17 @@ field: the device base equals the system base. """ _get_base_power(c::Component) = _get_system_base_power(c) +# Conversion-engine component interface (see src/units/conversions.jl): the +# engine resolves bases through these three functions, so every getter and +# setter shares one base-power/base-voltage choice per component type. +_get_device_base_power(c::Component) = _get_base_power(c) +get_base_voltage(c::Branch) = get_base_voltage(get_arc(c).from) +get_base_voltage(c::TwoWindingTransformer) = get_base_voltage_primary(c) +get_base_voltage(c::ThreeWindingTransformer) = error( + "Three-winding transformers have per-winding base voltages; use " * + "get_base_voltage_primary/secondary/tertiary.", +) + # `base_power` is always stored and reported in natural units (MVA). It is the # anchor that every other field's per-unitization is defined against, so # expressing it in a per-unit base (`SU`/`DU`) is circular. Unlike every other @@ -54,8 +65,8 @@ set_base_power!(c::Component, val::Float64) = (c.base_power = val) # `ustrip(MVA, val)` converts power units and throws for non-power units. set_base_power!(c::Component, val::Unitful.Quantity) = (c.base_power = Unitful.ustrip(MVA, val)) -set_base_power!(::Component, val::RelativeQuantity) = - _base_power_units_error(val.unit) +set_base_power!(::Component, ::RelativeQuantity{<:Any, U}) where {U} = + _base_power_units_error(U()) """ Reject any attempt to read/write `base_power` in non-natural units. @@ -77,6 +88,11 @@ IS.display_units_arg(::typeof(set_base_power!), ::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 passed to 2-arg scaling-factor multipliers during time-series retrieval +# when the caller does not specify them: system base, matching what +# simulation/optimization consumers expect. +IS.default_units(::Component) = SU + ####################################################### # Units-aware get_value / set_value # @@ -94,170 +110,77 @@ 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} +function get_value(c::Component, field::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) - isnothing(base_voltage) && error("Base voltage is not defined for $(summary(c)).") - return value * (base_voltage^2 / _get_base_power(c)) * u"Ω" -end - -function _convert_from_device_base( - c::T, value::Number, ::Val{:ohm}, ::typeof(OHMS), -) where {T <: TwoWindingTransformer} - base_voltage = get_base_voltage_primary(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 _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 value * DU - end - return value * (_get_base_power(c) / base_voltage^2) * u"S" -end - -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 value * DU - end - return value * (_get_base_power(c) / base_voltage^2) * u"S" -end - -# ---- 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) - -# ---- DU → DU (identity; no system info needed) ---- -_convert_from_device_base(::Component, value::Number, ::Val, ::DeviceBaseUnit) = - value * DU - -# ---- 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 _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 + return _convert_from_device_base( + _conversion_base(c, field), + value, + conversion_unit, + units, + ) end -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 +# Base provider for the conversion engine: which object carries the bases for +# a given field. Components are their own provider; multi-winding components +# substitute a per-winding view (see `WindingBase` below). This single hook is +# what makes the generic getter/setter paths winding-aware — no per-type +# method mirrors. +_conversion_base(c::Component, ::Any) = c +_conversion_base(c::ThreeWindingTransformer, field::Val) = WindingBase(c, field) -# ---- 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 +# ---- DU → requested units: one delegation to the conversion engine. The +# field's conversion-unit token picks the physical category; the engine +# resolves bases through the component interface above. ---- +_convert_from_device_base(base, value::Number, cu::Val, units) = + convert_units(base, value, _unit_category(cu), DU, units) # ---- Nothing passthrough ---- -_convert_from_device_base(::Component, ::Nothing, ::Val, ::Any) = nothing +_convert_from_device_base(base, ::Nothing, ::Val, ::Any) = nothing # ---- 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), +_convert_from_device_base(base, v::MinMax, cu, u) = ( + min = _convert_from_device_base(base, v.min, cu, u), + max = _convert_from_device_base(base, v.max, cu, u), ) -_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), +_convert_from_device_base(base, v::UpDown, cu, u) = ( + up = _convert_from_device_base(base, v.up, cu, u), + down = _convert_from_device_base(base, v.down, cu, u), ) -_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), +_convert_from_device_base(base, v::FromTo_ToFrom, cu, u) = ( + from_to = _convert_from_device_base(base, v.from_to, cu, u), + to_from = _convert_from_device_base(base, v.to_from, cu, u), ) -_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), +_convert_from_device_base(base, v::FromTo, cu, u) = ( + from = _convert_from_device_base(base, v.from, cu, u), + to = _convert_from_device_base(base, v.to, cu, u), ) -_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), +_convert_from_device_base(base, v::StartUpShutDown, cu, u) = ( + startup = _convert_from_device_base(base, v.startup, cu, u), + shutdown = _convert_from_device_base(base, v.shutdown, cu, u), ) ####################################################### # set_value: accept Unitful.Quantity or RelativeQuantity; return DU scalar ####################################################### -# ---- 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::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::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 +# ---- From Unitful.Quantity (natural units): inverse engine conversion ---- +set_value(c::Component, field, val::Quantity, cu::Val) = IS._strip_units( + convert_units(_conversion_base(c, field), val, _unit_category(cu), NU, DU), +) # ---- From RelativeQuantity in DU (trivial) ---- set_value(::Component, field, val::RelativeQuantity{<:Any, DeviceBaseUnit}, ::Val) = ustrip(val) # ---- 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::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( - 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 +set_value(c::Component, field, val::RelativeQuantity{<:Any, SystemBaseUnit}, cu::Val) = + IS._strip_units( + convert_units(_conversion_base(c, field), ustrip(val), _unit_category(cu), SU, DU), + ) # ---- Bare Float64 is rejected: callers must attach units explicitly ---- set_value(::Component, ::Any, ::Float64, ::Val) = throw( @@ -386,7 +309,7 @@ for (pub, priv, field) in ( $setter(c::ThreeWindingTransformer, val::Unitful.Quantity) = (c.$field = Unitful.ustrip(u"MW", val)) $setter(c::ThreeWindingTransformer, val::RelativeQuantity{<:Any, SystemBaseUnit}) = - (c.$field = IS.ustrip(val) * _get_system_base_power(c)) + (c.$field = ustrip(val) * _get_system_base_power(c)) $setter(::ThreeWindingTransformer, ::RelativeQuantity{<:Any, DeviceBaseUnit}) = error( "Setting " * $(string(field)) * " in device base (DU) is ambiguous: " * @@ -432,31 +355,23 @@ function _get_winding_base_voltage( return base_voltage end -# Units-aware get_value for three-winding transformers. Each winding pair carries -# its own MVA and kV base, so the component-wide `_get_base_power`/`get_base_voltage` -# used by the generic `Branch` conversion are wrong here. We route through the -# `convert_units` engine instead, passing the field as the winding token; the engine -# pulls the per-winding bases from the accessors below. Dispatch is on the requested -# `units` type (not the system's mutable unit setting), keeping the hot path type-stable. -function get_value( - c::ThreeWindingTransformer, - field::Val{T}, - conversion_unit::Val, - units::IS.AbstractUnitSystem, -) where {T} - return convert_units( - c, Base.getproperty(c, T), _unit_category(conversion_unit), DU, units, field, - ) +# Each winding pair carries its own MVA and kV base, so the component-wide +# `_get_base_power`/`get_base_voltage` used by the generic conversion are wrong +# here. `WindingBase` is a lightweight per-winding *base provider*: it +# implements the conversion-engine component interface with the winding's +# bases (the field doubles as the winding token), so the entire 5-arg +# `convert_units` engine — getters and setters alike — works per-winding. +struct WindingBase{T <: ThreeWindingTransformer, F <: Val} + component::T + field::F end +_get_device_base_power(w::WindingBase) = _get_winding_base_power(w.component, w.field) +_get_system_base_power(w::WindingBase) = _get_system_base_power(w.component) +get_base_voltage(w::WindingBase) = _get_winding_base_voltage(w.component, w.field) +Base.summary(w::WindingBase) = summary(w.component) + # Physical category implied by a field's conversion unit. _unit_category(::Val{:mva}) = POWER _unit_category(::Val{:ohm}) = IMPEDANCE _unit_category(::Val{:siemens}) = ADMITTANCE - -# Per-winding base accessors consumed by `convert_units`. The field doubles as the -# winding token: it selects which winding's base power and base voltage apply. -_get_device_base_power(c::ThreeWindingTransformer, field::Val) = - _get_winding_base_power(c, field) -get_base_voltage(c::ThreeWindingTransformer, field::Val) = - _get_winding_base_voltage(c, field) diff --git a/src/models/cost_function_timeseries.jl b/src/models/cost_function_timeseries.jl index 639a2bac4e..e84644b11b 100644 --- a/src/models/cost_function_timeseries.jl +++ b/src/models/cost_function_timeseries.jl @@ -1,18 +1,4 @@ # VALIDATORS -function _validate_market_bid_cost(cost, context) - (cost isa MarketBidCost || cost isa MarketBidTimeSeriesCost) || throw( - ArgumentError( - "Expected MarketBidCost or MarketBidTimeSeriesCost for $context, got $(typeof(cost))", - )) -end - -function _validate_import_export_cost(cost, context) - (cost isa ImportExportCost || cost isa ImportExportTimeSeriesCost) || throw( - ArgumentError( - "Expected ImportExportCost or ImportExportTimeSeriesCost for $context, got $(typeof(cost))", - )) -end - function _validate_reserve_demand_curve( cost::CostCurve{PiecewiseIncrementalCurve, U}, name::String, @@ -88,18 +74,34 @@ get_decremental_variable_cost(::StaticInjection, cost::MarketBidCost; kwargs...) # ── TIME-SERIES MarketBidTimeSeriesCost GETTERS ───────────────────────────── """ -Resolve a time-series-backed `CostCurve` to a static `CostCurve{PiecewiseIncrementalCurve}` -at the given `start_time`. +Resolve a time-series-backed `CostCurve` over a window of `len` timesteps, +returning a `Vector` of static `CostCurve`s (one storage read per +time-series-backed field for the whole window). With `len = nothing`, resolve +a single timestep and return one static `CostCurve`. """ function _resolve_ts_cost_curve( component::Component, curve::CostCurve{TimeSeriesPiecewiseIncrementalCurve, U}, start_time::Dates.DateTime, + len::Int, ) 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)) + static_vcs = IS.build_static_curves(get_value_curve(curve), component, start_time, len) + power_units = get_power_units(curve) + vom_cost = get_vom_cost(curve) + return [CostCurve(vc, power_units, vom_cost) for vc in static_vcs] end +_resolve_ts_cost_curve(component::Component, curve, start_time::Dates.DateTime) = + only(_resolve_ts_cost_curve(component, curve, start_time, 1)) +_resolve_ts_cost_curve(component::Component, curve, start_time::Dates.DateTime, ::Nothing) = + _resolve_ts_cost_curve(component, curve, start_time) + +# Same len-arity dispatch for curves resolved directly through IS. +_build_static(curve, device, start_time, ::Nothing) = + IS.build_static_curve(curve, device, start_time) +_build_static(curve, device, start_time, len::Int) = + IS.build_static_curves(curve, device, start_time, len) + """ Retrieve the variable cost for a `StaticInjection` device with a `MarketBidTimeSeriesCost`. Resolves time series at `start_time`. @@ -113,7 +115,7 @@ function get_variable_cost( isnothing(start_time) && throw(ArgumentError("start_time is required for MarketBidTimeSeriesCost")) return _resolve_ts_cost_curve( - device, get_incremental_offer_curves(cost), start_time) + device, get_incremental_offer_curves(cost), start_time, len) end get_incremental_variable_cost( @@ -132,7 +134,7 @@ function get_decremental_variable_cost( isnothing(start_time) && throw(ArgumentError("start_time is required for MarketBidTimeSeriesCost")) return _resolve_ts_cost_curve( - device, get_decremental_offer_curves(cost), start_time) + device, get_decremental_offer_curves(cost), start_time, len) end # ── STATIC ImportExportCost GETTERS ───────────────────────────────────────── @@ -154,7 +156,7 @@ function get_import_variable_cost( isnothing(start_time) && throw(ArgumentError("start_time is required for ImportExportTimeSeriesCost")) return _resolve_ts_cost_curve( - device, get_import_offer_curves(cost), start_time) + device, get_import_offer_curves(cost), start_time, len) end function get_export_variable_cost( @@ -166,7 +168,7 @@ function get_export_variable_cost( isnothing(start_time) && throw(ArgumentError("start_time is required for ImportExportTimeSeriesCost")) return _resolve_ts_cost_curve( - device, get_export_offer_curves(cost), start_time) + device, get_export_offer_curves(cost), start_time, len) end # ── START-UP / SHUT-DOWN / NO-LOAD GETTERS (time-series variants) ────────── @@ -179,7 +181,7 @@ function get_no_load_cost( ) isnothing(start_time) && throw(ArgumentError("start_time is required for MarketBidTimeSeriesCost")) - return IS.build_static_curve(get_no_load_cost(cost), device, start_time) + return _build_static(get_no_load_cost(cost), device, start_time, len) end function get_shut_down( @@ -190,7 +192,7 @@ function get_shut_down( ) isnothing(start_time) && throw(ArgumentError("start_time is required for MarketBidTimeSeriesCost")) - return IS.build_static_curve(get_shut_down(cost), device, start_time) + return _build_static(get_shut_down(cost), device, start_time, len) end function get_start_up( @@ -216,7 +218,7 @@ function get_variable_cost( ) isnothing(start_time) && throw(ArgumentError("start_time is required for ReserveDemandTimeSeriesCurve")) - return _resolve_ts_cost_curve(service, get_variable(service), start_time) + return _resolve_ts_cost_curve(service, get_variable(service), start_time, len) end # ── Helpers for FuelCurve and service bids (still use _process_get_cost) ── @@ -377,8 +379,97 @@ function _check_power_units( end end +# Offer-curve fields pin the cost's unit-system parameter `U`, so changing +# units requires rebuilding the cost object rather than mutating the field. +# `_replace_offer_curve` is the single chokepoint for the static-curve setters: +# it validates the cost kind and slot, re-tags the sibling placeholder curve, +# and returns the rebuilt cost. + +# A placeholder offer curve carries no information (all-zero slopes with +# zero-or-unset offsets), so re-tagging it to a new unit system is lossless. +_is_placeholder_offer(curve::CostCurve) = + all(iszero, get_slopes(get_value_curve(curve))) && + _iszero_or_nothing(get_initial_input(get_value_curve(curve))) && + _iszero_or_nothing(get_input_at_zero(get_value_curve(curve))) + +_retag_placeholder(curve::CostCurve, ::Type{U}) where {U <: IS.AbstractUnitSystem} = + if _is_placeholder_offer(curve) + CostCurve(get_value_curve(curve), U(), get_vom_cost(curve)) + else + curve + end + +_throw_wrong_offer_slot(cost, slot) = throw( + ArgumentError("cannot set the $slot offer curve on a $(nameof(typeof(cost)))"), +) + +function _replace_offer_curve( + cost::MarketBidCost, + slot::Symbol, + data::CostCurve{PiecewiseIncrementalCurve, U}, +) where {U <: IS.AbstractUnitSystem} + slot in (:incremental, :decremental) || _throw_wrong_offer_slot(cost, slot) + inc = if slot === :incremental + data + else + _retag_placeholder(get_incremental_offer_curves(cost), U) + end + dec = if slot === :decremental + data + else + _retag_placeholder(get_decremental_offer_curves(cost), U) + end + return MarketBidCost(; + no_load_cost = get_no_load_cost(cost), + start_up = get_start_up(cost), + shut_down = get_shut_down(cost), + incremental_offer_curves = inc, + decremental_offer_curves = dec, + ancillary_service_offers = get_ancillary_service_offers(cost), + ) +end + +function _replace_offer_curve( + cost::ImportExportCost, + slot::Symbol, + data::CostCurve{PiecewiseIncrementalCurve, U}, +) where {U <: IS.AbstractUnitSystem} + slot in (:import, :export) || _throw_wrong_offer_slot(cost, slot) + imp = slot === :import ? data : _retag_placeholder(get_import_offer_curves(cost), U) + exp = slot === :export ? data : _retag_placeholder(get_export_offer_curves(cost), U) + return ImportExportCost(; + import_offer_curves = imp, + export_offer_curves = exp, + energy_import_weekly_limit = get_energy_import_weekly_limit(cost), + energy_export_weekly_limit = get_energy_export_weekly_limit(cost), + ancillary_service_offers = get_ancillary_service_offers(cost), + ) +end + +_replace_offer_curve( + cost::Union{MarketBidTimeSeriesCost, ImportExportTimeSeriesCost}, + ::Symbol, + ::CostCurve, +) = throw( + ArgumentError( + "the component's operation cost is $(typeof(cost)); static-curve " * + "setters cannot modify a time-series-backed cost — replace the " * + "operation cost instead", + ), +) + +_replace_offer_curve(cost, slot::Symbol, ::CostCurve) = throw( + ArgumentError( + "cannot set a $slot offer curve on an operation cost of type $(typeof(cost))", + ), +) + """ Set the variable cost for a `StaticInjection` device with a `MarketBidCost`. + +The component's `MarketBidCost` is rebuilt with the unit system of `data`; +a placeholder (all-zero) decremental curve is re-tagged to match, while a +real decremental curve in a different unit system raises an `ArgumentError`. """ function set_variable_cost!( ::System, @@ -386,10 +477,11 @@ function set_variable_cost!( 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) - set_incremental_offer_curves!(market_bid_cost, data) + set_operation_cost!( + component, + _replace_offer_curve(get_operation_cost(component), :incremental, data), + ) return end @@ -417,10 +509,11 @@ function set_decremental_variable_cost!( 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) - set_decremental_offer_curves!(market_bid_cost, data) + set_operation_cost!( + component, + _replace_offer_curve(get_operation_cost(component), :decremental, data), + ) return end @@ -430,10 +523,11 @@ function set_import_variable_cost!( 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) - set_import_offer_curves!(import_export_cost, data) + set_operation_cost!( + component, + _replace_offer_curve(get_operation_cost(component), :import, data), + ) return end @@ -443,10 +537,11 @@ function set_export_variable_cost!( 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) - set_export_offer_curves!(import_export_cost, data) + set_operation_cost!( + component, + _replace_offer_curve(get_operation_cost(component), :export, data), + ) return end diff --git a/src/models/cost_functions/ImportExportCost.jl b/src/models/cost_functions/ImportExportCost.jl index 32a6e4e426..1bf72cfa46 100644 --- a/src/models/cost_functions/ImportExportCost.jl +++ b/src/models/cost_functions/ImportExportCost.jl @@ -55,10 +55,9 @@ function ImportExportCost(::Nothing) ImportExportCost() end -# Claude: # Deserialization compatibility: import_offer_curves and export_offer_curves were -# serialized as Nothing in older PSY versions. Substitute ZERO_OFFER_CURVE for each -# Nothing field so that stale JSON files can still be loaded under PSY6. +# serialized as Nothing in older PSY versions. The kwarg constructor substitutes +# ZERO_OFFER_CURVE for Nothing and validates the shared unit system. function ImportExportCost( import_offer_curves::Union{Nothing, CostCurve{PiecewiseIncrementalCurve}}, export_offer_curves::Union{Nothing, CostCurve{PiecewiseIncrementalCurve}}, @@ -66,12 +65,12 @@ function ImportExportCost( energy_export_weekly_limit::Float64, ancillary_service_offers::Vector{<:Service}, ) - ImportExportCost( - something(import_offer_curves, ZERO_OFFER_CURVE), - something(export_offer_curves, ZERO_OFFER_CURVE), - energy_import_weekly_limit, - energy_export_weekly_limit, - ancillary_service_offers, + ImportExportCost(; + import_offer_curves = import_offer_curves, + export_offer_curves = export_offer_curves, + energy_import_weekly_limit = energy_import_weekly_limit, + energy_export_weekly_limit = energy_export_weekly_limit, + ancillary_service_offers = ancillary_service_offers, ) end @@ -102,10 +101,14 @@ set_energy_import_weekly_limit!(value::ImportExportCost, val) = set_energy_export_weekly_limit!(value::ImportExportCost, val) = value.energy_export_weekly_limit = val +# `initial_input` and `input_at_zero` are `Union{Nothing, Float64}`; an unset +# offset means "no offset", which qualifies the same as an explicit zero. +_iszero_or_nothing(x) = isnothing(x) || iszero(x) + function is_import_export_curve(curve::ProductionVariableCostCurve) return (curve isa IS.AnyCostCurve{PiecewiseIncrementalCurve}) && - iszero(get_initial_input(get_value_curve(curve))) && - iszero(get_input_at_zero(get_value_curve(curve))) && + _iszero_or_nothing(get_initial_input(get_value_curve(curve))) && + _iszero_or_nothing(get_input_at_zero(get_value_curve(curve))) && iszero(first(get_x_coords(get_value_curve(curve)))) end diff --git a/src/models/generated/Area.jl b/src/models/generated/Area.jl index 7a657567f6..1feedf2ad7 100644 --- a/src/models/generated/Area.jl +++ b/src/models/generated/Area.jl @@ -62,18 +62,18 @@ end """Get [`Area`](@ref) `name`.""" get_name(value::Area) = value.name -"""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 [`Area`](@ref) `peak_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 7e7040ab00..7113edc909 100644 --- a/src/models/generated/AreaInterchange.jl +++ b/src/models/generated/AreaInterchange.jl @@ -77,22 +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` 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 [`AreaInterchange`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`AreaInterchange`](@ref) `flow_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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/ConstantReserve.jl b/src/models/generated/ConstantReserve.jl index 63ac49520c..f9bdf18986 100644 --- a/src/models/generated/ConstantReserve.jl +++ b/src/models/generated/ConstantReserve.jl @@ -86,12 +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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_requirement_unitful`](@ref).""" +"""Get [`ConstantReserve`](@ref) `requirement` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +InfrastructureSystems.display_units_arg(::typeof(get_requirement), ::Type{ConstantReserve{T}}) where {T <: ReserveDirection} = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_requirement_unitful), ::Type{ConstantReserve{T}}) where {T <: ReserveDirection} = 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 492d438be8..1193f86a22 100644 --- a/src/models/generated/ConstantReserveGroup.jl +++ b/src/models/generated/ConstantReserveGroup.jl @@ -66,12 +66,12 @@ end get_name(value::ConstantReserveGroup) = value.name """Get [`ConstantReserveGroup`](@ref) `available`.""" get_available(value::ConstantReserveGroup) = value.available -"""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 [`ConstantReserveGroup`](@ref) `requirement` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +InfrastructureSystems.display_units_arg(::typeof(get_requirement), ::Type{ConstantReserveGroup{T}}) where {T <: ReserveDirection} = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_requirement_unitful), ::Type{ConstantReserveGroup{T}}) where {T <: ReserveDirection} = 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 eebd297a5d..61d0d3fb2c 100644 --- a/src/models/generated/ConstantReserveNonSpinning.jl +++ b/src/models/generated/ConstantReserveNonSpinning.jl @@ -86,12 +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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_requirement_unitful`](@ref).""" +"""Get [`ConstantReserveNonSpinning`](@ref) `requirement` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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/DiscreteControlledACBranch.jl b/src/models/generated/DiscreteControlledACBranch.jl index f10733287e..46e93b898d 100644 --- a/src/models/generated/DiscreteControlledACBranch.jl +++ b/src/models/generated/DiscreteControlledACBranch.jl @@ -92,38 +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` 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 [`DiscreteControlledACBranch`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_unitful`](@ref).""" +"""Get [`DiscreteControlledACBranch`](@ref) `r` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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/EnergyReservoirStorage.jl b/src/models/generated/EnergyReservoirStorage.jl index eef88654a8..2dfd48d538 100644 --- a/src/models/generated/EnergyReservoirStorage.jl +++ b/src/models/generated/EnergyReservoirStorage.jl @@ -160,54 +160,54 @@ 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` 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 [`EnergyReservoirStorage`](@ref) `storage_capacity` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +"""Get [`EnergyReservoirStorage`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`EnergyReservoirStorage`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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`.""" diff --git a/src/models/generated/ExponentialLoad.jl b/src/models/generated/ExponentialLoad.jl index 3a0a4d3e0a..62c5c3a8ed 100644 --- a/src/models/generated/ExponentialLoad.jl +++ b/src/models/generated/ExponentialLoad.jl @@ -111,36 +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` 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 [`ExponentialLoad`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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_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 [`ExponentialLoad`](@ref) `max_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 c483c6462b..5608517331 100644 --- a/src/models/generated/GenericArcImpedance.jl +++ b/src/models/generated/GenericArcImpedance.jl @@ -82,38 +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` 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 [`GenericArcImpedance`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_unitful`](@ref).""" +"""Get [`GenericArcImpedance`](@ref) `r` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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/HybridSystem.jl b/src/models/generated/HybridSystem.jl index 605edadae6..12b597686c 100644 --- a/src/models/generated/HybridSystem.jl +++ b/src/models/generated/HybridSystem.jl @@ -148,18 +148,18 @@ get_available(value::HybridSystem) = value.available get_status(value::HybridSystem) = value.status """Get [`HybridSystem`](@ref) `bus`.""" get_bus(value::HybridSystem) = value.bus -"""Get [`HybridSystem`](@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 [`HybridSystem`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. For the unit-bearing value see [`get_active_power_unitful`](@ref).""" get_active_power(value::HybridSystem, units) = InfrastructureSystems._strip_units(get_value(value, Val(:active_power), Val(:mva), units)) """Get [`HybridSystem`](@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::HybridSystem, units) = get_value(value, Val(:active_power), Val(:mva), units) -InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{ HybridSystem }) = InfrastructureSystems.SU -InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{ HybridSystem }) = InfrastructureSystems.SU -"""Get [`HybridSystem`](@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).""" +InfrastructureSystems.display_units_arg(::typeof(get_active_power), ::Type{HybridSystem}) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_active_power_unitful), ::Type{HybridSystem}) = InfrastructureSystems.SU +"""Get [`HybridSystem`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. For the unit-bearing value see [`get_reactive_power_unitful`](@ref).""" get_reactive_power(value::HybridSystem, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power), Val(:mva), units)) """Get [`HybridSystem`](@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::HybridSystem, units) = get_value(value, Val(:reactive_power), Val(:mva), units) -InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{ HybridSystem }) = InfrastructureSystems.SU -InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{ HybridSystem }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power), ::Type{HybridSystem}) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_unitful), ::Type{HybridSystem}) = InfrastructureSystems.SU _get_base_power(value::HybridSystem) = value.base_power """Get [`HybridSystem`](@ref) `operation_cost`.""" @@ -174,30 +174,30 @@ get_storage(value::HybridSystem) = value.storage get_renewable_unit(value::HybridSystem) = value.renewable_unit """Get [`HybridSystem`](@ref) `interconnection_impedance`.""" get_interconnection_impedance(value::HybridSystem) = value.interconnection_impedance -"""Get [`HybridSystem`](@ref) `interconnection_rating` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_interconnection_rating_unitful`](@ref).""" +"""Get [`HybridSystem`](@ref) `interconnection_rating` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. For the unit-bearing value see [`get_interconnection_rating_unitful`](@ref).""" get_interconnection_rating(value::HybridSystem, units) = InfrastructureSystems._strip_units(get_value(value, Val(:interconnection_rating), Val(:mva), units)) """Get [`HybridSystem`](@ref) `interconnection_rating` as a unit-bearing quantity in the requested `units` (e.g. `SU`, `DU`, `MW`). For a bare number see [`get_interconnection_rating`](@ref).""" get_interconnection_rating_unitful(value::HybridSystem, units) = get_value(value, Val(:interconnection_rating), Val(:mva), units) -InfrastructureSystems.display_units_arg(::typeof(get_interconnection_rating), ::Type{ HybridSystem }) = InfrastructureSystems.SU -InfrastructureSystems.display_units_arg(::typeof(get_interconnection_rating_unitful), ::Type{ HybridSystem }) = InfrastructureSystems.SU -"""Get [`HybridSystem`](@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).""" +InfrastructureSystems.display_units_arg(::typeof(get_interconnection_rating), ::Type{HybridSystem}) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_interconnection_rating_unitful), ::Type{HybridSystem}) = InfrastructureSystems.SU +"""Get [`HybridSystem`](@ref) `input_active_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. For the unit-bearing value see [`get_input_active_power_limits_unitful`](@ref).""" get_input_active_power_limits(value::HybridSystem, units) = InfrastructureSystems._strip_units(get_value(value, Val(:input_active_power_limits), Val(:mva), units)) """Get [`HybridSystem`](@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::HybridSystem, units) = get_value(value, Val(:input_active_power_limits), Val(:mva), units) -InfrastructureSystems.display_units_arg(::typeof(get_input_active_power_limits), ::Type{ HybridSystem }) = InfrastructureSystems.SU -InfrastructureSystems.display_units_arg(::typeof(get_input_active_power_limits_unitful), ::Type{ HybridSystem }) = InfrastructureSystems.SU -"""Get [`HybridSystem`](@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).""" +InfrastructureSystems.display_units_arg(::typeof(get_input_active_power_limits), ::Type{HybridSystem}) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_input_active_power_limits_unitful), ::Type{HybridSystem}) = InfrastructureSystems.SU +"""Get [`HybridSystem`](@ref) `output_active_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. For the unit-bearing value see [`get_output_active_power_limits_unitful`](@ref).""" get_output_active_power_limits(value::HybridSystem, units) = InfrastructureSystems._strip_units(get_value(value, Val(:output_active_power_limits), Val(:mva), units)) """Get [`HybridSystem`](@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::HybridSystem, units) = get_value(value, Val(:output_active_power_limits), Val(:mva), units) -InfrastructureSystems.display_units_arg(::typeof(get_output_active_power_limits), ::Type{ HybridSystem }) = InfrastructureSystems.SU -InfrastructureSystems.display_units_arg(::typeof(get_output_active_power_limits_unitful), ::Type{ HybridSystem }) = InfrastructureSystems.SU -"""Get [`HybridSystem`](@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).""" +InfrastructureSystems.display_units_arg(::typeof(get_output_active_power_limits), ::Type{HybridSystem}) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_output_active_power_limits_unitful), ::Type{HybridSystem}) = InfrastructureSystems.SU +"""Get [`HybridSystem`](@ref) `reactive_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. For the unit-bearing value see [`get_reactive_power_limits_unitful`](@ref).""" get_reactive_power_limits(value::HybridSystem, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits), Val(:mva), units)) """Get [`HybridSystem`](@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::HybridSystem, units) = get_value(value, Val(:reactive_power_limits), Val(:mva), units) -InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits), ::Type{ HybridSystem }) = InfrastructureSystems.SU -InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_unitful), ::Type{ HybridSystem }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits), ::Type{HybridSystem}) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_unitful), ::Type{HybridSystem}) = InfrastructureSystems.SU """Get [`HybridSystem`](@ref) `interconnection_efficiency`.""" get_interconnection_efficiency(value::HybridSystem) = value.interconnection_efficiency """Get [`HybridSystem`](@ref) `services`.""" diff --git a/src/models/generated/HydroDispatch.jl b/src/models/generated/HydroDispatch.jl index f8c2997d95..0bc126230c 100644 --- a/src/models/generated/HydroDispatch.jl +++ b/src/models/generated/HydroDispatch.jl @@ -131,44 +131,44 @@ 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` 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 [`HydroDispatch`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`HydroDispatch`](@ref) `active_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 diff --git a/src/models/generated/HydroPumpTurbine.jl b/src/models/generated/HydroPumpTurbine.jl index b1d0953e94..a6eadbe487 100644 --- a/src/models/generated/HydroPumpTurbine.jl +++ b/src/models/generated/HydroPumpTurbine.jl @@ -179,52 +179,52 @@ 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` 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 [`HydroPumpTurbine`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`HydroPumpTurbine`](@ref) `ramp_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 @@ -235,12 +235,12 @@ get_status(value::HydroPumpTurbine) = value.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` 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 [`HydroPumpTurbine`](@ref) `active_power_pump` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 fcfc0997ea..b0be53a410 100644 --- a/src/models/generated/HydroTurbine.jl +++ b/src/models/generated/HydroTurbine.jl @@ -149,48 +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` 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 [`HydroTurbine`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`HydroTurbine`](@ref) `ramp_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 b4e75f52e2..27d154148e 100644 --- a/src/models/generated/InterconnectingConverter.jl +++ b/src/models/generated/InterconnectingConverter.jl @@ -116,32 +116,32 @@ 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` 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 [`InterconnectingConverter`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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) `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 [`InterconnectingConverter`](@ref) `reactive_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. For the unit-bearing value see [`get_reactive_power_limits_unitful`](@ref).""" get_reactive_power_limits(value::InterconnectingConverter, units) = InfrastructureSystems._strip_units(get_value(value, Val(:reactive_power_limits), Val(:mva), units)) """Get [`InterconnectingConverter`](@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::InterconnectingConverter, units) = get_value(value, Val(:reactive_power_limits), Val(:mva), units) -InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits), ::Type{ InterconnectingConverter }) = InfrastructureSystems.SU -InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_unitful), ::Type{ InterconnectingConverter }) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits), ::Type{InterconnectingConverter}) = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_reactive_power_limits_unitful), ::Type{InterconnectingConverter}) = InfrastructureSystems.SU """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 11c70b7254..b8736d8a02 100644 --- a/src/models/generated/InterruptiblePowerLoad.jl +++ b/src/models/generated/InterruptiblePowerLoad.jl @@ -106,30 +106,30 @@ 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` 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 [`InterruptiblePowerLoad`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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`.""" diff --git a/src/models/generated/InterruptibleStandardLoad.jl b/src/models/generated/InterruptibleStandardLoad.jl index f34f09e001..8ca8f5c28b 100644 --- a/src/models/generated/InterruptibleStandardLoad.jl +++ b/src/models/generated/InterruptibleStandardLoad.jl @@ -154,78 +154,78 @@ _get_base_power(value::InterruptibleStandardLoad) = value.base_power get_operation_cost(value::InterruptibleStandardLoad) = value.operation_cost """Get [`InterruptibleStandardLoad`](@ref) `conformity`.""" get_conformity(value::InterruptibleStandardLoad) = value.conformity -"""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 [`InterruptibleStandardLoad`](@ref) `constant_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 1b2ce79d83..bcf70d084a 100644 --- a/src/models/generated/Line.jl +++ b/src/models/generated/Line.jl @@ -112,64 +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` 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 [`Line`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_unitful`](@ref).""" +"""Get [`Line`](@ref) `r` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`Line`](@ref) `rating_b` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 491fc6b78a..a0ac3ab0e9 100644 --- a/src/models/generated/LoadZone.jl +++ b/src/models/generated/LoadZone.jl @@ -57,18 +57,18 @@ end """Get [`LoadZone`](@ref) `name`.""" get_name(value::LoadZone) = value.name -"""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 [`LoadZone`](@ref) `peak_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 c26c2f1361..afd10db8be 100644 --- a/src/models/generated/MonitoredLine.jl +++ b/src/models/generated/MonitoredLine.jl @@ -119,70 +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` 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 [`MonitoredLine`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_unitful`](@ref).""" +"""Get [`MonitoredLine`](@ref) `r` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`MonitoredLine`](@ref) `rating_b` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 426291a194..a5972cd115 100644 --- a/src/models/generated/MotorLoad.jl +++ b/src/models/generated/MotorLoad.jl @@ -106,38 +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` 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 [`MotorLoad`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 [`MotorLoad`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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/PhaseShiftingTransformer.jl b/src/models/generated/PhaseShiftingTransformer.jl index 0ce3fb8737..b39956ec16 100644 --- a/src/models/generated/PhaseShiftingTransformer.jl +++ b/src/models/generated/PhaseShiftingTransformer.jl @@ -139,66 +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` 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 [`PhaseShiftingTransformer`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_unitful`](@ref).""" +"""Get [`PhaseShiftingTransformer`](@ref) `r` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +"""Get [`PhaseShiftingTransformer`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`PhaseShiftingTransformer`](@ref) `rating_b` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 5e4f39d8f1..cfb6f9d3fc 100644 --- a/src/models/generated/PhaseShiftingTransformer3W.jl +++ b/src/models/generated/PhaseShiftingTransformer3W.jl @@ -302,120 +302,120 @@ 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` 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 [`PhaseShiftingTransformer3W`](@ref) `active_power_flow_primary` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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`.""" @@ -434,18 +434,18 @@ get_base_voltage_primary(value::PhaseShiftingTransformer3W) = value.base_voltage 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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_g_unitful`](@ref).""" +"""Get [`PhaseShiftingTransformer3W`](@ref) `g` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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`.""" @@ -458,24 +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` 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 [`PhaseShiftingTransformer3W`](@ref) `rating_primary` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 719e3e23bf..cd5885822f 100644 --- a/src/models/generated/PowerLoad.jl +++ b/src/models/generated/PowerLoad.jl @@ -101,32 +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` 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 [`PowerLoad`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 [`PowerLoad`](@ref) `max_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 acadc02b7d..239fdb71a9 100644 --- a/src/models/generated/RenewableDispatch.jl +++ b/src/models/generated/RenewableDispatch.jl @@ -113,32 +113,32 @@ 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` 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 [`RenewableDispatch`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`RenewableDispatch`](@ref) `reactive_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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`.""" diff --git a/src/models/generated/RenewableNonDispatch.jl b/src/models/generated/RenewableNonDispatch.jl index ddb61c01cf..4967a6db9f 100644 --- a/src/models/generated/RenewableNonDispatch.jl +++ b/src/models/generated/RenewableNonDispatch.jl @@ -103,24 +103,24 @@ 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` 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 [`RenewableNonDispatch`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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`.""" diff --git a/src/models/generated/ShiftablePowerLoad.jl b/src/models/generated/ShiftablePowerLoad.jl index cc4c5a93bf..4e641732ac 100644 --- a/src/models/generated/ShiftablePowerLoad.jl +++ b/src/models/generated/ShiftablePowerLoad.jl @@ -111,36 +111,36 @@ 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` 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 [`ShiftablePowerLoad`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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`.""" diff --git a/src/models/generated/Source.jl b/src/models/generated/Source.jl index a38d7e7192..198e333e93 100644 --- a/src/models/generated/Source.jl +++ b/src/models/generated/Source.jl @@ -121,30 +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` 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 [`Source`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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`.""" diff --git a/src/models/generated/StandardLoad.jl b/src/models/generated/StandardLoad.jl index e9ba56f156..431de86f26 100644 --- a/src/models/generated/StandardLoad.jl +++ b/src/models/generated/StandardLoad.jl @@ -145,78 +145,78 @@ get_available(value::StandardLoad) = value.available get_bus(value::StandardLoad) = value.bus _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 [`StandardLoad`](@ref) `constant_active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 7a614bd8eb..e4e57c2f86 100644 --- a/src/models/generated/SynchronousCondenser.jl +++ b/src/models/generated/SynchronousCondenser.jl @@ -94,32 +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` 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 [`SynchronousCondenser`](@ref) `reactive_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 [`SynchronousCondenser`](@ref) `active_power_losses` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 b70d542178..89409ec86b 100644 --- a/src/models/generated/TModelHVDCLine.jl +++ b/src/models/generated/TModelHVDCLine.jl @@ -94,12 +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` 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 [`TModelHVDCLine`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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`.""" @@ -108,18 +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` 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 [`TModelHVDCLine`](@ref) `active_power_limits_from` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 a6183cf64f..9de62852f0 100644 --- a/src/models/generated/TapTransformer.jl +++ b/src/models/generated/TapTransformer.jl @@ -134,64 +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` 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 [`TapTransformer`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_unitful`](@ref).""" +"""Get [`TapTransformer`](@ref) `r` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_rating_unitful`](@ref).""" +"""Get [`TapTransformer`](@ref) `rating` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`TapTransformer`](@ref) `rating_b` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 d6f514a1b1..5d5a865f23 100644 --- a/src/models/generated/ThermalMultiStart.jl +++ b/src/models/generated/ThermalMultiStart.jl @@ -157,52 +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` 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 [`ThermalMultiStart`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`ThermalMultiStart`](@ref) `active_power_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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`.""" diff --git a/src/models/generated/ThermalStandard.jl b/src/models/generated/ThermalStandard.jl index eda49758ca..c1e9ecad3e 100644 --- a/src/models/generated/ThermalStandard.jl +++ b/src/models/generated/ThermalStandard.jl @@ -143,42 +143,42 @@ 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` 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 [`ThermalStandard`](@ref) `active_power` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 diff --git a/src/models/generated/Transformer2W.jl b/src/models/generated/Transformer2W.jl index 0cead8c510..04ac782565 100644 --- a/src/models/generated/Transformer2W.jl +++ b/src/models/generated/Transformer2W.jl @@ -124,62 +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` 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 [`Transformer2W`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_r_unitful`](@ref).""" +"""Get [`Transformer2W`](@ref) `r` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`Transformer2W`](@ref) `rating_b` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 4285ab4bee..1c3f84d0e6 100644 --- a/src/models/generated/Transformer3W.jl +++ b/src/models/generated/Transformer3W.jl @@ -297,120 +297,120 @@ 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` 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 [`Transformer3W`](@ref) `active_power_flow_primary` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 @@ -423,18 +423,18 @@ get_base_voltage_primary(value::Transformer3W) = value.base_voltage_primary 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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_g_unitful`](@ref).""" +"""Get [`Transformer3W`](@ref) `g` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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`.""" @@ -447,24 +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` 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 [`Transformer3W`](@ref) `rating_primary` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 227d3334f6..33b215b919 100644 --- a/src/models/generated/TransmissionInterface.jl +++ b/src/models/generated/TransmissionInterface.jl @@ -64,12 +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` 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 [`TransmissionInterface`](@ref) `active_power_flow_limits` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 72c58a55e5..04a66a2625 100644 --- a/src/models/generated/TwoTerminalGenericHVDCLine.jl +++ b/src/models/generated/TwoTerminalGenericHVDCLine.jl @@ -94,38 +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` 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 [`TwoTerminalGenericHVDCLine`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`TwoTerminalGenericHVDCLine`](@ref) `active_power_limits_from` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 0b26d97b0c..c114b3ed9e 100644 --- a/src/models/generated/TwoTerminalLCCLine.jl +++ b/src/models/generated/TwoTerminalLCCLine.jl @@ -241,12 +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` 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 [`TwoTerminalLCCLine`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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`.""" @@ -305,30 +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` 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 [`TwoTerminalLCCLine`](@ref) `active_power_limits_from` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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 637eed292d..a3638b4b7b 100644 --- a/src/models/generated/TwoTerminalVSCLine.jl +++ b/src/models/generated/TwoTerminalVSCLine.jl @@ -206,40 +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` 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 [`TwoTerminalVSCLine`](@ref) `active_power_flow` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`TwoTerminalVSCLine`](@ref) `reactive_power_from` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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`.""" @@ -252,28 +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` 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 [`TwoTerminalVSCLine`](@ref) `rating_from` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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` 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 [`TwoTerminalVSCLine`](@ref) `reactive_power_to` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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`.""" @@ -286,18 +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` 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 [`TwoTerminalVSCLine`](@ref) `rating_to` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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).""" +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`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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/VariableReserve.jl b/src/models/generated/VariableReserve.jl index 34f65c9023..edfd41ad52 100644 --- a/src/models/generated/VariableReserve.jl +++ b/src/models/generated/VariableReserve.jl @@ -26,7 +26,7 @@ This reserve product includes online generators that can respond right away afte - `name::String`: Name of the component. Components of the same type (e.g., `PowerLoad`) must have unique names, but components of different types (e.g., `PowerLoad` and `ACBus`) can have the same name - `available::Bool`: Indicator of whether the component is connected and online (`true`) or disconnected, offline, or down (`false`). Unavailable components are excluded during simulations - `time_frame::Float64`: the saturation time_frame in minutes to provide reserve contribution, validation range: `(0, nothing)` -- `requirement::Float64`: the required quantity of the product should be scaled by a TimeSeriesData +- `requirement::Float64`: the required quantity of the product in p.u. ([`SYSTEM_BASE`](@ref per_unit)), to be scaled by a TimeSeriesData - `sustained_time::Float64`: (default: `3600.0`) the time in seconds reserve contribution must sustained at a specified level, validation range: `(0, nothing)` - `max_output_fraction::Float64`: (default: `1.0`) the maximum fraction of each device's output that can be assigned to the service, validation range: `(0, 1)` - `max_participation_factor::Float64`: (default: `1.0`) the maximum portion [0, 1.0] of the reserve that can be contributed per device, validation range: `(0, 1)` @@ -41,7 +41,7 @@ mutable struct VariableReserve{T <: ReserveDirection} <: Reserve{T} available::Bool "the saturation time_frame in minutes to provide reserve contribution" time_frame::Float64 - "the required quantity of the product should be scaled by a TimeSeriesData" + "the required quantity of the product in p.u. ([`SYSTEM_BASE`](@ref per_unit)), to be scaled by a TimeSeriesData" requirement::Float64 "the time in seconds reserve contribution must sustained at a specified level" sustained_time::Float64 @@ -86,8 +86,12 @@ get_name(value::VariableReserve) = value.name get_available(value::VariableReserve) = value.available """Get [`VariableReserve`](@ref) `time_frame`.""" get_time_frame(value::VariableReserve) = value.time_frame -"""Get [`VariableReserve`](@ref) `requirement`.""" -get_requirement(value::VariableReserve) = value.requirement +"""Get [`VariableReserve`](@ref) `requirement` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. For the unit-bearing value see [`get_requirement_unitful`](@ref).""" +get_requirement(value::VariableReserve, units) = InfrastructureSystems._strip_units(get_value(value, Val(:requirement), Val(:mva), units)) +"""Get [`VariableReserve`](@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::VariableReserve, units) = get_value(value, Val(:requirement), Val(:mva), units) +InfrastructureSystems.display_units_arg(::typeof(get_requirement), ::Type{VariableReserve{T}}) where {T <: ReserveDirection} = InfrastructureSystems.SU +InfrastructureSystems.display_units_arg(::typeof(get_requirement_unitful), ::Type{VariableReserve{T}}) where {T <: ReserveDirection} = InfrastructureSystems.SU """Get [`VariableReserve`](@ref) `sustained_time`.""" get_sustained_time(value::VariableReserve) = value.sustained_time """Get [`VariableReserve`](@ref) `max_output_fraction`.""" @@ -106,7 +110,7 @@ set_available!(value::VariableReserve, val) = value.available = val """Set [`VariableReserve`](@ref) `time_frame`.""" set_time_frame!(value::VariableReserve, val) = value.time_frame = val """Set [`VariableReserve`](@ref) `requirement`.""" -set_requirement!(value::VariableReserve, val) = value.requirement = val +set_requirement!(value::VariableReserve, val) = value.requirement = set_value(value, Val(:requirement), val, Val(:mva)) """Set [`VariableReserve`](@ref) `sustained_time`.""" set_sustained_time!(value::VariableReserve, val) = value.sustained_time = val """Set [`VariableReserve`](@ref) `max_output_fraction`.""" diff --git a/src/models/generated/VariableReserveNonSpinning.jl b/src/models/generated/VariableReserveNonSpinning.jl index f27af0704a..e42e1a3f2f 100644 --- a/src/models/generated/VariableReserveNonSpinning.jl +++ b/src/models/generated/VariableReserveNonSpinning.jl @@ -88,12 +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` as a bare number in the requested `units` (e.g. `SU`, `DU`, `MW`). For the unit-bearing value see [`get_requirement_unitful`](@ref).""" +"""Get [`VariableReserveNonSpinning`](@ref) `requirement` as a bare number in the requested `units` (e.g. `SU`, `DU`; domain-provided units such as `MW` are also accepted when the owning domain package has registered a `_strip_units` method for the returned quantity type). Returns a bare number only when such a method is registered; otherwise returns the quantity wrapper. 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 +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/static_models.jl b/src/models/static_models.jl index 8d277087dc..f297a55107 100644 --- a/src/models/static_models.jl +++ b/src/models/static_models.jl @@ -26,6 +26,21 @@ function get_services(device::Device) return Vector{Service}() end +""" +Return `true` if the device has active power as a controllable parameter. +""" +supports_active_power(::StaticInjection) = true + +""" +Return `true` if the device has reactive power as a controllable parameter. +""" +supports_reactive_power(::StaticInjection) = true + +""" +Return `true` if the device can control voltage at its connected bus. +""" +supports_voltage_control(::StaticInjection) = false + get_dynamic_injector(d::StaticInjection) = nothing function get_frequency_droop(static_injector::StaticInjection) diff --git a/src/models/supplemental_accessors.jl b/src/models/supplemental_accessors.jl index e6bbabaabe..ce23378325 100644 --- a/src/models/supplemental_accessors.jl +++ b/src/models/supplemental_accessors.jl @@ -126,19 +126,28 @@ function get_base_voltage(line::Union{Line, MonitoredLine}) end """ -Select the value with fewer significant figures (the "rounder" number). -Uses trailing zeros after stripping the decimal point as a proxy. +Select the value with fewer significant figures (the "rounder" number), +comparing the coarsest decimal granularity at which each value is exactly +representable. Purely numeric — this sits on conversion paths, so no string +round-trips. """ function _select_fewer_significant_figures(a::Float64, b::Float64) - sa = rstrip(string(a), '0') - sb = rstrip(string(b), '0') - la = length(sa) - lb = length(sb) - la < lb && return a - lb < la && return b + ga = _decimal_granularity(a) + gb = _decimal_granularity(b) + ga < gb && return a + gb < ga && return b return max(a, b) end +# Smallest digit count `d` such that `round(v; digits = d) == v`; lower means +# coarser (rounder) numbers. +function _decimal_granularity(v::Float64) + for d in -6:10 + round(v; digits = d) == v && return d + end + return 11 +end + """ get_high_voltage(t::TwoWindingTransformer) @@ -394,6 +403,68 @@ function supports_services(::AreaInterchange) return true end +# supports_active_power overrides for types without controllable active power +supports_active_power(::SynchronousCondenser) = false + +# supports_reactive_power overrides for types without controllable reactive power +supports_reactive_power(::InterconnectingConverter) = false + +# A shunt-admittance component counts as power support only above an absolute +# threshold, so negligible admittances do not force their host bus to be kept. +_nonzero_admittance(x::Real) = abs(x) > ZERO_ADMITTANCE_THRESHOLD + +# FixedAdmittance / SwitchedAdmittance support active power via conductance +# (real(Y)) and reactive power via susceptance (imag(Y)), so capability is +# parameter-dependent rather than a fixed type property. +supports_active_power(d::FixedAdmittance) = _nonzero_admittance(real(get_Y(d))) +supports_reactive_power(d::FixedAdmittance) = _nonzero_admittance(imag(get_Y(d))) + +# SwitchedAdmittance can also shift admittance via per-block switchable steps, so +# capability includes the base Y and any block with steps and an above-threshold +# increment in the relevant component. +function supports_active_power(d::SwitchedAdmittance) + _nonzero_admittance(real(get_Y(d))) && return true + return any( + n > 0 && _nonzero_admittance(real(yi)) + for (n, yi) in zip(get_number_of_steps(d), get_Y_increase(d)) + ) +end + +function supports_reactive_power(d::SwitchedAdmittance) + _nonzero_admittance(imag(get_Y(d))) && return true + return any( + n > 0 && _nonzero_admittance(imag(yi)) + for (n, yi) in zip(get_number_of_steps(d), get_Y_increase(d)) + ) +end + +# FACTSControlDevice reactive power and voltage control depend on control_mode. +# control_mode is nothing for uninitialized devices (e.g. FACTSControlDevice(nothing)). +_facts_is_active(d::FACTSControlDevice) = + (mode = get_control_mode(d); !isnothing(mode) && mode != FACTSOperationModes.OOS) + +# In NML mode both Series and Shunt links operate, enabling active power control. +# In BYP mode the Series link is bypassed and the Shunt acts as a STATCOM (reactive only). +function supports_active_power(d::FACTSControlDevice) + mode = get_control_mode(d) + return !isnothing(mode) && mode == FACTSOperationModes.NML +end + +supports_reactive_power(d::FACTSControlDevice) = _facts_is_active(d) + +# supports_voltage_control overrides for types that can control voltage +supports_voltage_control(::Generator) = true +supports_voltage_control(::Source) = true +supports_voltage_control(::Storage) = true +supports_voltage_control(::StaticInjectionSubsystem) = true + +supports_voltage_control(d::FACTSControlDevice) = _facts_is_active(d) + +function supports_voltage_control(d::SynchronousCondenser) + bustype = get_bustype(get_bus(d)) + return bustype ∈ (ACBusTypes.PV, ACBusTypes.REF, ACBusTypes.SLACK) +end + function _get_components(value::HybridSystem) components = [value.thermal_unit, value.electric_load, value.storage, value.renewable_unit] @@ -401,14 +472,16 @@ function _get_components(value::HybridSystem) return components end -function set_units_setting!(value::HybridSystem, settings::Union{SystemUnitsSettings, Nothing}) +function set_units_setting!( + value::HybridSystem, + settings::Union{SystemUnitsSettings, Nothing}, +) set_units_info!(get_internal(value), settings) for component in _get_components(value) set_units_info!(get_internal(component), settings) end return end -end """ Return an iterator over the subcomponents in the HybridSystem. diff --git a/src/units/conversions.jl b/src/units/conversions.jl index a5d49d2a43..5f4bb2d34f 100644 --- a/src/units/conversions.jl +++ b/src/units/conversions.jl @@ -68,16 +68,26 @@ natural_unit(::AdmittanceCategory) = u"S" natural_unit(::VoltageCategory) = u"kV" natural_unit(::CurrentCategory) = u"kA" +# Voltage-dependent base values must fail loudly when the base voltage is +# unset; a silent fallback would mislabel the returned number. +function _checked_base_voltage(c) + base_voltage = get_base_voltage(c) + isnothing(base_voltage) && error("Base voltage is not defined for $(summary(c)).") + return base_voltage +end + """ 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) +base_value(c, ::ImpedanceCategory) = + _checked_base_voltage(c)^2 / _get_device_base_power(c) +base_value(c, ::AdmittanceCategory) = + _get_device_base_power(c) / _checked_base_voltage(c)^2 +base_value(c, ::VoltageCategory) = _checked_base_voltage(c) +base_value(c, ::CurrentCategory) = _get_device_base_power(c) / _checked_base_voltage(c) """ system_base_value(component, category) → Float64 @@ -86,21 +96,19 @@ base_value(c, ::CurrentCategory) = _get_device_base_power(c) / get_base_voltage( """ 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) + _checked_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) + _get_system_base_power(c) / _checked_base_voltage(c)^2 +system_base_value(c, ::VoltageCategory) = _checked_base_voltage(c) +system_base_value(c, ::CurrentCategory) = + _get_system_base_power(c) / _checked_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, ::Union{PowerCategory, AdmittanceCategory, CurrentCategory}) = + _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) @@ -134,6 +142,9 @@ function convert_units(c, value::Number, cat::UnitCategory, ::DeviceBaseUnit, un return uconvert(units, natural) end +# Relative↔relative conversions go through the power-only ratio: the voltage +# terms in base_value/system_base_value cancel exactly, so fetching them would +# be wasted work (and would wrongly require a base voltage to be defined). function convert_units( c, value::Number, @@ -141,8 +152,7 @@ function convert_units( ::DeviceBaseUnit, ::SystemBaseUnit, ) - ratio = base_value(c, cat) / system_base_value(c, cat) - return (value * ratio) * SU + return (value * _du_to_su_ratio(c, cat)) * SU end convert_units(::Any, value::Number, ::UnitCategory, ::DeviceBaseUnit, ::DeviceBaseUnit) = @@ -182,8 +192,7 @@ function convert_units( ::SystemBaseUnit, ::DeviceBaseUnit, ) - ratio = system_base_value(c, cat) / base_value(c, cat) - return (value * ratio) * DU + return (value / _du_to_su_ratio(c, cat)) * DU end convert_units(::Any, value::Number, ::UnitCategory, ::SystemBaseUnit, ::SystemBaseUnit) = @@ -221,54 +230,7 @@ end # --- nothing passthrough --- convert_units(::Any, ::Nothing, ::UnitCategory, ::Any, ::Any) = nothing -# ============================================================ -# Multi-winding components (e.g. three-winding transformers) -# -# Each winding carries its own device base power and base voltage, so the -# single-base functions above cannot be used. A `winding` token selects the -# per-winding bases; downstream implements the two-argument interface: -# - _get_device_base_power(c, winding) → Float64 (MVA) -# - get_base_voltage(c, winding) → Float64 (kV) -# Winding fields are stored in device base, so only DU-source conversions are -# provided. -# ============================================================ - -base_value(c, ::PowerCategory, winding) = _get_device_base_power(c, winding) -base_value(c, ::ImpedanceCategory, winding) = - get_base_voltage(c, winding)^2 / _get_device_base_power(c, winding) -base_value(c, ::AdmittanceCategory, winding) = - _get_device_base_power(c, winding) / get_base_voltage(c, winding)^2 - -system_base_value(c, ::PowerCategory, ::Any) = _get_system_base_power(c) -system_base_value(c, ::ImpedanceCategory, winding) = - get_base_voltage(c, winding)^2 / _get_system_base_power(c) -system_base_value(c, ::AdmittanceCategory, winding) = - _get_system_base_power(c) / get_base_voltage(c, winding)^2 - -# DU → natural units (any Unitful target) -convert_units(c, v::Number, cat::UnitCategory, ::DeviceBaseUnit, units::Units, winding) = - uconvert(units, v * base_value(c, cat, winding) * natural_unit(cat)) - -# DU → SU -function convert_units( - c, - v::Number, - cat::UnitCategory, - ::DeviceBaseUnit, - ::SystemBaseUnit, - winding, -) - ratio = base_value(c, cat, winding) / system_base_value(c, cat, winding) - return (v * ratio) * SU -end - -# DU → DU (identity) -convert_units(::Any, v::Number, ::UnitCategory, ::DeviceBaseUnit, ::DeviceBaseUnit, ::Any) = - v * DU - -# DU → NU (route through the category's natural unit) -convert_units(c, v::Number, cat::UnitCategory, du::DeviceBaseUnit, ::NaturalUnit, winding) = - convert_units(c, v, cat, du, natural_unit(cat), winding) - -# nothing passthrough -convert_units(::Any, ::Nothing, ::UnitCategory, ::Any, ::Any, ::Any) = nothing +# Multi-winding components (e.g. three-winding transformers) do not need a +# separate conversion family: a per-winding *base provider* view (see +# `WindingBase` in `src/models/components.jl`) implements the same three +# interface functions, so the full engine above works per-winding. diff --git a/src/units/serialization.jl b/src/units/serialization.jl index 2efa47d03a..933e2a281e 100644 --- a/src/units/serialization.jl +++ b/src/units/serialization.jl @@ -11,7 +11,6 @@ For complex values: =# import JSON -import StructTypes # ============================================================ # Unit string ↔ type mapping @@ -67,13 +66,13 @@ end 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)) + return Dict("value" => q.value, "unit" => unit_to_string(U())) 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), + "unit" => unit_to_string(U()), ) end diff --git a/src/units/types.jl b/src/units/types.jl index 813da7689d..c80f1007af 100644 --- a/src/units/types.jl +++ b/src/units/types.jl @@ -21,4 +21,8 @@ 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} +const UnitArg = Union{Unitful.Units, IS.AbstractUnitSystem} + +# One public strip generic for both quantity kinds: Unitful's `ustrip` works on +# `RelativeQuantity` too (IS deliberately does not define its own `ustrip`). +Unitful.ustrip(q::IS.RelativeQuantity) = IS._strip_units(q) diff --git a/src/utils/IO/branchdata_checks.jl b/src/utils/IO/branchdata_checks.jl index f6061c7115..9daf3d4f23 100644 --- a/src/utils/IO/branchdata_checks.jl +++ b/src/utils/IO/branchdata_checks.jl @@ -127,7 +127,7 @@ function line_rating_calculation(l::Union{Line, MonitoredLine}) to_voltage_limits = get_voltage_limits(get_arc(l).to) fr_vmin = isnothing(from_voltage_limits) ? 0.9 : from_voltage_limits.min - to_vmin = isnothing(to_voltage_limits) ? 0.9 : from_voltage_limits.min + to_vmin = isnothing(to_voltage_limits) ? 0.9 : to_voltage_limits.min c_max = sqrt(fr_vmin^2 + to_vmin^2 - 2 * fr_vmin * to_vmin * cos(theta_max)) new_rate = y_mag * max(fr_vmin, to_vmin) * c_max @@ -144,7 +144,9 @@ function correct_rate_limits!(branch::Union{Line, MonitoredLine}, basemva::Float continue end if rating_value < 0.0 - @error "PowerSystems does not support negative line rates. $(field): $(rating)" + @error "PowerSystems does not support negative line rates for \ + $(summary(branch)) $(field): $(rating_value)." _group = + IS.LOG_GROUP_PARSING maxlog = PS_MAX_LOG return false end if rating_value == INFINITE_BOUND @@ -204,6 +206,12 @@ function check_rating_values( @assert field ∈ [:rating_b, :rating_c] continue end + if rating_value < 0.0 + @error "PowerSystems does not support negative transformer rates for \ + $(summary(xfrm)) $(field): $(rating_value)." _group = + IS.LOG_GROUP_PARSING maxlog = PS_MAX_LOG + return false + end if (rating_value * device_base_power >= 2.0 * closest_rate_range.max) @warn "$(field) $(round(rating_value*device_base_power; digits=2)) MW for $(get_name(xfrm)) is 2x larger than the max expected rating $(closest_rate_range.max) MW for Transformer at a $(closest_v_level) kV Voltage level." _group = IS.LOG_GROUP_PARSING maxlog = PS_MAX_LOG diff --git a/src/utils/print.jl b/src/utils/print.jl index 04cbda9e25..12bea115e9 100644 --- a/src/utils/print.jl +++ b/src/utils/print.jl @@ -11,7 +11,16 @@ function _show_accessor_value(getter_func::Function, ist::Component) return getter_func(ist, arg) catch err err isa ErrorException && occursin("not attached", err.msg) || rethrow() - return getter_func(ist, NU) + # NU can also fail (it may need the system base or a base voltage). + # Display must never error: fall back to the raw stored value, which + # the DU conversion returns without touching any base. Only swallow + # the engine's own ErrorExceptions — a MethodError here is a bug. + try + return getter_func(ist, NU) + catch err2 + err2 isa ErrorException || rethrow() + return getter_func(ist, DU) + end end end diff --git a/test/common.jl b/test/common.jl index 2442c9896f..c81e81bb23 100644 --- a/test/common.jl +++ b/test/common.jl @@ -1,5 +1,8 @@ import InfrastructureSystems import Unitful +# PSY no longer exports `ustrip`; Unitful's generic handles both quantity kinds +# (PSY extends it for `RelativeQuantity`). +using Unitful: ustrip # Strip unit wrappers so accessor return values can be compared against the # raw struct field type. Compound values (NamedTuple of units) are unwrapped @@ -303,9 +306,14 @@ function test_accessors(component) # 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)) + # path — which needs system attachment — is skipped. Getters tagged `NU` + # (e.g. `get_base_power`, which is only meaningful in natural units and + # rejects `DU`/`SU`) are called with their own `NU` tag instead. + units_arg = IS.display_units_arg(func, ps_type) + val = if ismissing(units_arg) func(component) + elseif units_arg == NU + func(component, NU) else func(component, DU) end diff --git a/test/test_base_power.jl b/test/test_base_power.jl index 7c35005f85..b29e07b9f0 100644 --- a/test/test_base_power.jl +++ b/test/test_base_power.jl @@ -1,15 +1,12 @@ -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (PSB.build_system uses PSY.PowerSystemTableData internally for RTS_GMLC_DA_sys). -# @testset "Test zero base power correction" begin -# sys = @test_logs( -# (:warn, r".*changing device base power to match system base power.*"), -# match_mode = :any, -# build_system(PSISystems, "RTS_GMLC_DA_sys"; force_build = true) -# ) -# for comp in get_components(PSY.SynchronousCondenser, sys) -# @test abs(get_base_power(comp)) > eps() -# end -# end +@testset "Test zero base power correction" begin + # The zero-base-power correction (and its warning) now happens inside the + # parser packages; the invariant PSY cares about is that no component + # arrives with a zero device base. + sys = build_system(PSISystems, "RTS_GMLC_DA_sys"; force_build = true) + for comp in get_components(PSY.SynchronousCondenser, sys) + @test abs(get_base_power(comp, NU)) > eps() + end +end function thermal_with_base_power(bus::PSY.Bus, name::String, base_power::Float64) return ThermalStandard(; @@ -129,6 +126,36 @@ end @test get_ramp_limits_unitful(gen, NU) === nothing end +# Regression guard for the explicit-units performance contract (PR #1695): +# the internal per-unit conversions must compile away so that a literal unit +# argument yields a type-stable, allocation-free `Float64`, and `ustrip` of the +# `_unitful` companion must be a no-op equal to the bare getter. +@testset "Generated getters: type-stable and allocation-free" begin + sys, gen = _sys_with_thermal(; system_base = 100.0, device_base = 250.0) + + # (1)+(4) Conversions compile away: each literal unit arg infers to Float64. + for u in (SU, DU, NU, MW) + @test (@inferred get_active_power(gen, u)) isa Float64 + end + + # (2) `ustrip` is a no-op equal to the bare getter for relative-unit wrappers. + for u in (SU, DU, NU) + wrapped = get_active_power_unitful(gen, u) + @test (@inferred Unitful.ustrip(wrapped)) == get_active_power(gen, u) + end + + # (3) A sum loop over the getter is allocation-free once compiled. + gens = collect(get_components(ThermalStandard, sys)) + sum_strip(gs, u) = (s = 0.0; for g in gs + s += Unitful.ustrip(get_active_power_unitful(g, u)) + end; s) + for u in (SU, DU, NU) + sum_strip(gens, u) # warm up + @test (@inferred sum_strip(gens, u)) isa Float64 + @test (@allocated sum_strip(gens, u)) == 0 + end +end + @testset "Unit-aware set_base_power!" begin sys, gen = _sys_with_thermal(; system_base = 100.0, device_base = 250.0) system_base = PSY._get_base_power(sys) @@ -227,6 +254,22 @@ end end end +# Detached Transformer3W with seeded units_info (system base 100), distinct +# per-winding base powers (15/20/25 MVA), and base voltages (230/138/69 kV) — +# deliberately all different so a wrong-base selection is caught. +function _make_test_3w_xfmr(; system_base = 100.0) + xfmr = Transformer3W(nothing) + IS.get_internal(xfmr).units_info = + PSY.SystemUnitsSettings(system_base, IS.UnitSystem.SYSTEM_BASE) + set_base_power_12!(xfmr, 15.0) + set_base_power_23!(xfmr, 20.0) + set_base_power_13!(xfmr, 25.0) + set_base_voltage_primary!(xfmr, 230.0) + set_base_voltage_secondary!(xfmr, 138.0) + set_base_voltage_tertiary!(xfmr, 69.0) + return xfmr +end + @testset "Unit-aware winding impedance/admittance getters on ThreeWindingTransformer" begin # Regression guard for a silent units bug. The winding getters must honor the # explicit `units` argument. Previously `get_r_primary(c, SU)` fell through to @@ -238,16 +281,7 @@ end # base differs from the system base, so we set them deliberately apart — and # use distinct per-winding bases to also catch a wrong-winding base selection. system_base = 100.0 - xfmr = Transformer3W(nothing) - IS.get_internal(xfmr).units_info = - PSY.SystemUnitsSettings(system_base, IS.UnitSystem.SYSTEM_BASE) - - set_base_power_12!(xfmr, 15.0) - set_base_power_23!(xfmr, 20.0) - set_base_power_13!(xfmr, 25.0) - set_base_voltage_primary!(xfmr, 230.0) - set_base_voltage_secondary!(xfmr, 138.0) - set_base_voltage_tertiary!(xfmr, 69.0) + xfmr = _make_test_3w_xfmr(; system_base = system_base) # (device-base field, getter, stored DU value, winding base power, base voltage) cases = ( @@ -281,21 +315,97 @@ end @test get_b(xfmr, NU) ≈ 0.05 * (15.0 / 230.0^2) 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 -# sys = build_system(PSISystems, "RTS_GMLC_DA_sys") -# bus = first(get_components(PSY.Bus, sys)) -# gen = thermal_with_base_power(bus, "Test Gen with Zero Base Power", 0.0) -# @test_logs (:warn, "Invalid range") match_mode = :any add_component!(sys, gen) -# gen2 = thermal_with_base_power(bus, "Test Gen with Non-Zero Base Power", 100.0) -# @test_nowarn add_component!(sys, gen2) -# # uncomment if we correct to non-zero base power. -# #= -# with_units_base(sys, "SYSTEM_BASE") do -# gen_added = PSY.get_component(PSY.ThermalStandard, sys, "Test Gen with Zero Base Power") -# PSY.set_reactive_power!(gen_added, 0.0) -# @test !isnan(PSY.get_reactive_power(gen_added)) -# end -# =# -# end +@testset "ThreeWindingTransformer Unitful-target getters use winding bases" begin + system_base = 100.0 + xfmr = _make_test_3w_xfmr(; system_base = system_base) + + setproperty!(xfmr, :rating_primary, 2.0) + # MW must scale by the winding base (15), not the system base (100) + @test get_rating_primary(xfmr, MW) ≈ 2.0 * 15.0 + @test get_rating_primary(xfmr, MW) ≈ get_rating_primary(xfmr, NU) + @test get_rating_primary_unitful(xfmr, MW) isa Unitful.Quantity + + setproperty!(xfmr, :r_primary, 0.01) + # Ω target must agree with the NU path (and not crash looking for an arc) + @test get_r_primary(xfmr, OHMS) ≈ 0.01 * (230.0^2 / 15.0) + @test get_r_primary(xfmr, OHMS) ≈ get_r_primary(xfmr, NU) + + setproperty!(xfmr, :b, 0.05) + @test get_b(xfmr, SIEMENS) ≈ 0.05 * (15.0 / 230.0^2) + @test get_b(xfmr, SIEMENS) ≈ get_b(xfmr, NU) +end + +@testset "ThreeWindingTransformer winding-aware setters round-trip" begin + system_base = 100.0 + xfmr = _make_test_3w_xfmr(; system_base = system_base) + + # Power: MW input divides by the winding base, not the system base + set_rating_primary!(xfmr, 30.0 * MW) + @test xfmr.rating_primary ≈ 2.0 + @test get_rating_primary(xfmr, MW) ≈ 30.0 + # SU: 0.4 SU = 40 MW on the system base = 2.0 DU on the 20 MVA winding + set_rating_secondary!(xfmr, 0.4 * SU) + @test xfmr.rating_secondary ≈ 2.0 + @test get_rating_secondary(xfmr, SU) ≈ 0.4 + # DU input is identity + set_rating_tertiary!(xfmr, 1.5 * DU) + @test xfmr.rating_tertiary ≈ 1.5 + + # Impedance: Ω divides by the winding impedance base V²/S + z_base_12 = 230.0^2 / 15.0 + set_r_12!(xfmr, 0.01 * z_base_12 * OHMS) + @test xfmr.r_12 ≈ 0.01 + @test get_r_12(xfmr, OHMS) ≈ 0.01 * z_base_12 + # SU impedance: Z_du = Z_su * (winding_base / system_base) + set_x_23!(xfmr, 0.6 * SU) + @test xfmr.x_23 ≈ 0.6 * (20.0 / system_base) + @test get_x_23(xfmr, SU) ≈ 0.6 + + # Admittance (primary winding): S divides by the winding base S/V² + y_base_12 = 15.0 / 230.0^2 + set_b!(xfmr, 2.0 * y_base_12 * SIEMENS) + @test xfmr.b ≈ 2.0 + @test get_b(xfmr, SIEMENS) ≈ 2.0 * y_base_12 + # SU admittance round-trip + set_g!(xfmr, 0.3 * SU) + @test xfmr.g ≈ 0.3 * (system_base / 15.0) + @test get_g(xfmr, SU) ≈ 0.3 + + # Bare floats remain rejected + @test_throws ArgumentError set_rating_primary!(xfmr, 1.0) +end + +@testset "TwoWindingTransformer Ω/S set→get round-trip uses one base voltage" begin + t2w = Transformer2W(nothing) # base_power = 100.0 + set_base_voltage_primary!(t2w, 230.0) + # Arc endpoint voltage deliberately different from the primary base voltage: + # both conversion directions must resolve the same voltage or the round-trip + # drifts by (230/115)². + set_base_voltage!(get_arc(t2w).from, 115.0) + + set_x!(t2w, 105.8 * OHMS) + @test t2w.x ≈ 105.8 / (230.0^2 / 100.0) + @test get_x(t2w, OHMS) ≈ 105.8 + + y_nat = 3.0 * (100.0 / 230.0^2) + set_primary_shunt!(t2w, y_nat * SIEMENS) + @test t2w.primary_shunt ≈ 3.0 + @test get_primary_shunt(t2w, SIEMENS) ≈ y_nat +end + +@testset "Test adding component with zero base power" begin + sys = build_system(PSISystems, "RTS_GMLC_DA_sys") + bus = first(get_components(PSY.Bus, sys)) + gen = thermal_with_base_power(bus, "Test Gen with Zero Base Power", 0.0) + @test_logs (:warn, "Invalid range") match_mode = :any add_component!(sys, gen) + gen2 = thermal_with_base_power(bus, "Test Gen with Non-Zero Base Power", 100.0) + @test_nowarn add_component!(sys, gen2) + # uncomment if we correct to non-zero base power. + #= + with_units_base(sys, "SYSTEM_BASE") do + gen_added = PSY.get_component(PSY.ThermalStandard, sys, "Test Gen with Zero Base Power") + PSY.set_reactive_power!(gen_added, 0.0) + @test !isnan(PSY.get_reactive_power(gen_added)) + end + =# +end diff --git a/test/test_branchchecks_testing.jl b/test/test_branchchecks_testing.jl index 861b07669b..db70ad3675 100644 --- a/test/test_branchchecks_testing.jl +++ b/test/test_branchchecks_testing.jl @@ -178,3 +178,114 @@ end PowerSystems.sanitize_angle_limits!(bad_angle_limits) ) end + +@testset "Negative branch rating fails validation cleanly" begin + # Two buses at equal base voltage so the endpoint-voltage check passes and + # validation reaches correct_rate_limits!. + bus_from = ACBus( + 1, "from", true, ACBusTypes.REF, 0, 1.0, (min = 0.9, max = 1.05), 230, + nothing, nothing, + ) + bus_to = ACBus( + 2, "to", true, ACBusTypes.PQ, 0, 1.0, (min = 0.9, max = 1.05), 230, + nothing, nothing, + ) + sys = System(100.0; runchecks = false) + add_component!(sys, bus_from) + add_component!(sys, bus_to) + neg_line = Line( + "negline", + true, + 0.0, + 0.0, + Arc(; from = bus_from, to = bus_to), + 0.01, + 0.1, + (from = 0.00356, to = 0.00356), + -1.0, # negative rating + (min = -pi / 2, max = pi / 2), + ) + add_component!(sys, neg_line) + + # An IS.MultiLogger is enabled at Error and rethrows log-record-generation + # errors (catch_exceptions(::MultiLogger) == false), exactly like the loggers + # Sienna test suites install. Under such a logger the previous `$(rating)` + # typo raised UndefVarError instead of the intended IS.InvalidValue. A + # NullLogger would *not* catch this regression because Julia never evaluates a + # disabled log message. + test_logger = IS.MultiLogger([ConsoleLogger(devnull, Logging.Error)]) + Logging.with_logger(test_logger) do + @test_throws IS.InvalidValue PowerSystems.check_component(sys, neg_line) + end +end + +@testset "line_rating_calculation uses to-side minimum voltage" begin + # Asymmetric endpoint voltage limits expose whether the to-side minimum + # voltage is read from the correct bus. + bus_from = ACBus( + 1, "from", true, ACBusTypes.REF, 0, 1.0, (min = 0.9, max = 1.05), 230, + nothing, nothing, + ) + bus_to = ACBus( + 2, "to", true, ACBusTypes.PQ, 0, 1.0, (min = 0.5, max = 1.05), 230, + nothing, nothing, + ) + line = Line( + "l", + true, + 0.0, + 0.0, + Arc(; from = bus_from, to = bus_to), + 0.01, + 0.1, + (from = 0.00356, to = 0.00356), + 100.0, + (min = -0.2, max = 0.3), + ) + + r, x = 0.01, 0.1 + g = r / (r^2 + x^2) + b = -x / (r^2 + x^2) + y_mag = sqrt(g^2 + b^2) + fr_vmin, to_vmin = 0.9, 0.5 + theta_max = 0.3 + c_max = sqrt(fr_vmin^2 + to_vmin^2 - 2 * fr_vmin * to_vmin * cos(theta_max)) + expected = y_mag * max(fr_vmin, to_vmin) * c_max + + @test PowerSystems.line_rating_calculation(line) ≈ expected +end + +@testset "Negative transformer rating fails validation cleanly" begin + bus_from = ACBus( + 1, "from", true, ACBusTypes.REF, 0, 1.0, (min = 0.9, max = 1.05), 230, + nothing, nothing, + ) + bus_to = ACBus( + 2, "to", true, ACBusTypes.PQ, 0, 1.0, (min = 0.9, max = 1.05), 230, + nothing, nothing, + ) + sys = System(100.0; runchecks = false) + add_component!(sys, bus_from) + add_component!(sys, bus_to) + # rating_b has no descriptor valid_range, so only the PSY-level guard can + # reject a negative secondary rating. + xfrm = Transformer2W(; + name = "negxfrm", + available = true, + active_power_flow = 0.0, + reactive_power_flow = 0.0, + arc = Arc(; from = bus_from, to = bus_to), + r = 0.01, + x = 0.1, + primary_shunt = 0.0, + rating = 1.0, + base_power = 100.0, + rating_b = -1.0, # negative secondary rating + ) + add_component!(sys, xfrm) + + test_logger = IS.MultiLogger([ConsoleLogger(devnull, Logging.Error)]) + Logging.with_logger(test_logger) do + @test_throws IS.InvalidValue PowerSystems.check_component(sys, xfrm) + end +end diff --git a/test/test_busnumberchecks.jl b/test/test_busnumberchecks.jl index 4dd347e097..968682f4fe 100644 --- a/test/test_busnumberchecks.jl +++ b/test/test_busnumberchecks.jl @@ -1,91 +1,89 @@ -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (PSB.build_system uses PSY.PowerModelsData internally for matpower systems). -# -# base_dir = dirname(dirname(pathof(PowerSystems))) -# -# @testset "Check bus index" begin -# # This signature is used to capture expected error logs from parsing matpower -# test_bus_index = -# () -> begin -# sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_case5_re_sys") -# @test sort([b.number for b in collect(get_components(ACBus, sys))]) == -# [1, 2, 3, 4, 10] -# @test sort( -# collect( -# Set([b.arc.from.number for b in collect(get_components(Branch, sys))]), -# ), -# ) == [1, 2, 3, 4] -# @test sort( -# collect( -# Set([b.arc.to.number for b in collect(get_components(Branch, sys))]), -# ), -# ) == [2, 3, 4, 10] -# -# # TODO: add test for loadzones testing MAPPING_BUSNUMBER2INDEX -# end -# @test_logs min_level = Logging.Error match_mode = :any test_bus_index() -# end -# -# @testset "Test unique bus numbers" begin -# # This signature is used to capture expected error logs from parsing matpower -# test_bus_numbers = -# () -> begin -# sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_case5_re_sys") -# number = 100 -# bus1 = ACBus(; -# number = number, -# name = "bus100", -# available = true, -# bustype = ACBusTypes.PV, -# angle = 1.0, -# magnitude = 1.0, -# voltage_limits = (min = -1.0, max = 1.0), -# base_voltage = 1.0, -# ) -# bus2 = ACBus(; -# number = number, -# name = "bus101", -# available = true, -# bustype = ACBusTypes.PV, -# angle = 1.0, -# magnitude = 1.0, -# voltage_limits = (min = -1.0, max = 1.0), -# base_voltage = 1.0, -# area = nothing, -# load_zone = nothing, -# ) -# -# add_component!(sys, bus1) -# @test_throws ArgumentError add_component!(sys, bus2) -# end -# @test_logs min_level = Logging.Error match_mode = :any test_bus_numbers() -# end -# -# @testset "Test unique DCBus numbers" begin -# test_dcbus_numbers = -# () -> begin -# sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_case5_re_sys") -# number = 200 -# dcbus_defaults = (; -# available = true, -# magnitude = 1.0, -# voltage_limits = (min = -1.0, max = 1.0), -# base_voltage = 1.0, -# ) -# dcbus1 = DCBus(; number = number, name = "dcbus200", dcbus_defaults...) -# dcbus2 = DCBus(; number = number, name = "dcbus201", dcbus_defaults...) -# -# add_component!(sys, dcbus1) -# @test_throws ArgumentError add_component!(sys, dcbus2) -# -# # Also verify that a DCBus cannot share a number with an existing ACBus -# existing_ac_number = first(get_bus_numbers(sys)) -# dcbus3 = DCBus(; -# number = existing_ac_number, -# name = "dcbus_conflict", -# dcbus_defaults..., -# ) -# @test_throws ArgumentError add_component!(sys, dcbus3) -# end -# @test_logs min_level = Logging.Error match_mode = :any test_dcbus_numbers() -# end + +base_dir = dirname(dirname(pathof(PowerSystems))) + +@testset "Check bus index" begin + # This signature is used to capture expected error logs from parsing matpower + test_bus_index = + () -> begin + sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_case5_re_sys") + @test sort([b.number for b in collect(get_components(ACBus, sys))]) == + [1, 2, 3, 4, 10] + @test sort( + collect( + Set([b.arc.from.number for b in collect(get_components(Branch, sys))]), + ), + ) == [1, 2, 3, 4] + @test sort( + collect( + Set([b.arc.to.number for b in collect(get_components(Branch, sys))]), + ), + ) == [2, 3, 4, 10] + + # TODO: add test for loadzones testing MAPPING_BUSNUMBER2INDEX + end + @test_logs min_level = Logging.Error match_mode = :any test_bus_index() +end + +@testset "Test unique bus numbers" begin + # This signature is used to capture expected error logs from parsing matpower + test_bus_numbers = + () -> begin + sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_case5_re_sys") + number = 100 + bus1 = ACBus(; + number = number, + name = "bus100", + available = true, + bustype = ACBusTypes.PV, + angle = 1.0, + magnitude = 1.0, + voltage_limits = (min = -1.0, max = 1.0), + base_voltage = 1.0, + ) + bus2 = ACBus(; + number = number, + name = "bus101", + available = true, + bustype = ACBusTypes.PV, + angle = 1.0, + magnitude = 1.0, + voltage_limits = (min = -1.0, max = 1.0), + base_voltage = 1.0, + area = nothing, + load_zone = nothing, + ) + + add_component!(sys, bus1) + @test_throws ArgumentError add_component!(sys, bus2) + end + @test_logs min_level = Logging.Error match_mode = :any test_bus_numbers() +end + +@testset "Test unique DCBus numbers" begin + test_dcbus_numbers = + () -> begin + sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_case5_re_sys") + number = 200 + dcbus_defaults = (; + available = true, + magnitude = 1.0, + voltage_limits = (min = -1.0, max = 1.0), + base_voltage = 1.0, + ) + dcbus1 = DCBus(; number = number, name = "dcbus200", dcbus_defaults...) + dcbus2 = DCBus(; number = number, name = "dcbus201", dcbus_defaults...) + + add_component!(sys, dcbus1) + @test_throws ArgumentError add_component!(sys, dcbus2) + + # Also verify that a DCBus cannot share a number with an existing ACBus + existing_ac_number = first(get_bus_numbers(sys)) + dcbus3 = DCBus(; + number = existing_ac_number, + name = "dcbus_conflict", + dcbus_defaults..., + ) + @test_throws ArgumentError add_component!(sys, dcbus3) + end + @test_logs min_level = Logging.Error match_mode = :any test_dcbus_numbers() +end diff --git a/test/test_component_selector.jl b/test/test_component_selector.jl index da0c1b96e8..54b9234602 100644 --- a/test/test_component_selector.jl +++ b/test/test_component_selector.jl @@ -1,390 +1,385 @@ -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (PSB.build_system uses PSY.PowerSystemTableData internally). The entire file -# is wrapped in a `false` block so it loads without invoking the parser. -if false - test_sys = PSB.build_system(PSB.PSITestSystems, "c_sys5_all_components") - gen_solitude = PSY.get_component(ThermalStandard, test_sys, "Solitude")::Component # Error if `nothing` - gen_sundance = get_component(ThermalStandard, test_sys, "Sundance")::Component - set_available!(gen_sundance, false) - gen_wind = get_component(RenewableDispatch, test_sys, "WindBusA")::Component - - test_sys2 = PSB.build_system(PSB.PSISystems, "5_bus_hydro_uc_sys") - gen_sundance2 = get_component(ThermalStandard, test_sys2, "Sundance")::Component - set_available!(gen_sundance2, false) - - sort_name!(x) = sort!(collect(x); by = get_name) - - # NOTE we are not constraining the second type parameter - GCReturnType = IS.FlattenIteratorWrapper{<:IS.InfrastructureSystemsComponent, <:Any} - - "Helper function to test the return type of `get_components` whenever we call it" - function get_components_rt(args...; kwargs...) - result = get_components(args...; kwargs...) - @test result isa GCReturnType - return result - end - - @testset "Test helper functions" begin - @test subtype_to_string(ThermalStandard) == "ThermalStandard" - @test component_to_qualified_string(ThermalStandard, "Solitude") == - "ThermalStandard__Solitude" - @test component_to_qualified_string(gen_solitude) == "ThermalStandard__Solitude" - end - - @testset "Test NameComponentSelector" begin - test_gen_ent = PSY.NameComponentSelector(ThermalStandard, "Solitude", nothing) - named_test_gen_ent = - PSY.NameComponentSelector(ThermalStandard, "Solitude", "SolGen") - - # Equality - @test PSY.NameComponentSelector(ThermalStandard, "Solitude", nothing) == - test_gen_ent - @test PSY.NameComponentSelector(ThermalStandard, "Solitude", "SolGen") == - named_test_gen_ent - - # Construction - @test make_selector(ThermalStandard, "Solitude") == test_gen_ent - @test make_selector(ThermalStandard, "Solitude"; name = "SolGen") == - named_test_gen_ent - @test make_selector(gen_solitude) == test_gen_ent - - # Naming - @test get_name(test_gen_ent) == "ThermalStandard__Solitude" - @test get_name(named_test_gen_ent) == "SolGen" - - # Contents - @test collect( - get_components_rt(make_selector(NonexistentComponent, ""), test_sys), - ) == - Vector{Component}() - the_components = collect(get_components_rt(test_gen_ent, test_sys)) - @test length(the_components) == 1 - @test typeof(first(the_components)) == ThermalStandard - @test get_name(first(the_components)) == "Solitude" - @test collect( - get_components_rt( - get_available, - make_selector(gen_sundance), - test_sys, +test_sys = PSB.build_system(PSB.PSITestSystems, "c_sys5_all_components") +gen_solitude = PSY.get_component(ThermalStandard, test_sys, "Solitude")::Component # Error if `nothing` +gen_sundance = get_component(ThermalStandard, test_sys, "Sundance")::Component +set_available!(gen_sundance, false) +gen_wind = get_component(RenewableDispatch, test_sys, "WindBusA")::Component + +test_sys2 = PSB.build_system(PSB.PSISystems, "5_bus_hydro_uc_sys") +gen_sundance2 = get_component(ThermalStandard, test_sys2, "Sundance")::Component +set_available!(gen_sundance2, false) + +sort_name!(x) = sort!(collect(x); by = get_name) + +# NOTE we are not constraining the second type parameter +GCReturnType = IS.FlattenIteratorWrapper{<:IS.InfrastructureSystemsComponent, <:Any} + +"Helper function to test the return type of `get_components` whenever we call it" +function get_components_rt(args...; kwargs...) + result = get_components(args...; kwargs...) + @test result isa GCReturnType + return result +end + +@testset "Test helper functions" begin + @test subtype_to_string(ThermalStandard) == "ThermalStandard" + @test component_to_qualified_string(ThermalStandard, "Solitude") == + "ThermalStandard__Solitude" + @test component_to_qualified_string(gen_solitude) == "ThermalStandard__Solitude" +end + +@testset "Test NameComponentSelector" begin + test_gen_ent = PSY.NameComponentSelector(ThermalStandard, "Solitude", nothing) + named_test_gen_ent = + PSY.NameComponentSelector(ThermalStandard, "Solitude", "SolGen") + + # Equality + @test PSY.NameComponentSelector(ThermalStandard, "Solitude", nothing) == + test_gen_ent + @test PSY.NameComponentSelector(ThermalStandard, "Solitude", "SolGen") == + named_test_gen_ent + + # Construction + @test make_selector(ThermalStandard, "Solitude") == test_gen_ent + @test make_selector(ThermalStandard, "Solitude"; name = "SolGen") == + named_test_gen_ent + @test make_selector(gen_solitude) == test_gen_ent + + # Naming + @test get_name(test_gen_ent) == "ThermalStandard__Solitude" + @test get_name(named_test_gen_ent) == "SolGen" + + # Contents + @test collect( + get_components_rt(make_selector(NonexistentComponent, ""), test_sys), + ) == + Vector{Component}() + the_components = collect(get_components_rt(test_gen_ent, test_sys)) + @test length(the_components) == 1 + @test typeof(first(the_components)) == ThermalStandard + @test get_name(first(the_components)) == "Solitude" + @test collect( + get_components_rt( + get_available, + make_selector(gen_sundance), + test_sys, + ), + ) == + Vector{Component}() + @test collect(get_available_components(make_selector(gen_sundance), test_sys)) == + Vector{Component}() + @test get_component(x -> true, test_gen_ent, test_sys) == + first(the_components) + @test isnothing(get_component(x -> false, test_gen_ent, test_sys)) + @test isnothing(get_available_component(make_selector(gen_sundance), test_sys)) + + @test only(get_groups(test_gen_ent, test_sys)) == test_gen_ent +end + +@testset "Test ListComponentSelector" begin + comp_ent_1 = make_selector(ThermalStandard, "Sundance") + comp_ent_2 = make_selector(RenewableDispatch, "WindBusA") + test_list_ent = PSY.ListComponentSelector((comp_ent_1, comp_ent_2), nothing) + named_test_list_ent = + PSY.ListComponentSelector((comp_ent_1, comp_ent_2), "TwoComps") + + # Equality + @test PSY.ListComponentSelector((comp_ent_1, comp_ent_2), nothing) == test_list_ent + @test PSY.ListComponentSelector((comp_ent_1, comp_ent_2), "TwoComps") == + named_test_list_ent + + # Construction + @test make_selector(comp_ent_1, comp_ent_2;) == test_list_ent + @test make_selector(comp_ent_1, comp_ent_2; name = "TwoComps") == + named_test_list_ent + + # Naming + @test get_name(test_list_ent) == + "[ThermalStandard__Sundance, RenewableDispatch__WindBusA]" + @test get_name(named_test_list_ent) == "TwoComps" + + # Contents + @test collect(get_components_rt(make_selector(), test_sys)) == Vector{Component}() + the_components = collect(get_components_rt(test_list_ent, test_sys)) + @test length(the_components) == 2 + + @test collect(get_groups(make_selector(), test_sys)) == + Vector{ComponentSelector}() + the_groups = collect(get_groups(test_list_ent, test_sys)) + @test length(the_groups) == 2 +end + +@testset "Test TypeComponentSelector" begin + test_sub_ent = PSY.TypeComponentSelector(ThermalStandard, :all, nothing) + named_test_sub_ent = PSY.TypeComponentSelector(ThermalStandard, :all, "Thermals") + + # Equality + @test PSY.TypeComponentSelector(ThermalStandard, :all, nothing) == test_sub_ent + @test PSY.TypeComponentSelector(ThermalStandard, :all, "Thermals") == + named_test_sub_ent + + # Construction + @test make_selector(ThermalStandard) == + make_selector(ThermalStandard; groupby = :each) + @test make_selector(ThermalStandard; groupby = :all) == test_sub_ent + @test make_selector(ThermalStandard; groupby = :all, name = "Thermals") == + named_test_sub_ent + @test make_selector(ThermalStandard; groupby = string) isa PSY.TypeComponentSelector + + # Naming + @test get_name(test_sub_ent) == "ThermalStandard" + @test get_name(named_test_sub_ent) == "Thermals" + + # Contents + answer = sort_name!(get_components_rt(ThermalStandard, test_sys)) + + @test collect(get_components_rt(make_selector(NonexistentComponent), test_sys)) == + Vector{Component}() + the_components = sort_name!(get_components_rt(test_sub_ent, test_sys)) + @test all(the_components .== answer) + @test !( + gen_sundance in + collect(get_components_rt(get_available, test_sub_ent, test_sys))) + @test !(gen_sundance in collect(get_available_components(test_sub_ent, test_sys))) + + # Grouping inherits from `DynamicallyGroupedComponentSelector` and is tested elsewhere +end + +@testset "Test TopologyComponentSelector" begin + topo1 = get_component(Area, test_sys2, "1") + topo2 = get_component(LoadZone, test_sys2, "2") + @assert !isnothing(topo1) && !isnothing(topo2) "Relies on an out-of-date `5_bus_hydro_uc_sys` definition" + test_topo_ent1 = + PSY.TopologyComponentSelector(ThermalStandard, Area, "1", :all, nothing) + test_topo_ent2 = + PSY.TopologyComponentSelector(StaticInjection, LoadZone, "2", :all, "Zone_2") + + # Equality + @test PSY.TopologyComponentSelector(ThermalStandard, Area, "1", :all, nothing) == + test_topo_ent1 + @test PSY.TopologyComponentSelector( + StaticInjection, + LoadZone, + "2", + :all, + "Zone_2", + ) == + test_topo_ent2 + + # Construction + @test make_selector(ThermalStandard, Area, "1") == + make_selector(ThermalStandard, Area, "1"; groupby = :each) + @test make_selector(ThermalStandard, Area, "1"; groupby = :all) == test_topo_ent1 + @test make_selector( + StaticInjection, + LoadZone, + "2"; + groupby = :all, + name = "Zone_2", + ) == + test_topo_ent2 + @test make_selector(StaticInjection, LoadZone, "2"; groupby = string) isa + PSY.TopologyComponentSelector + + # Naming + @test get_name(test_topo_ent1) == "Area__1__ThermalStandard" + @test get_name(test_topo_ent2) == "Zone_2" + + # Contents + empty_topo_ent = make_selector(NonexistentComponent, Area, "1") + @test collect(get_components_rt(empty_topo_ent, test_sys2)) == Vector{Component}() + + nonexistent_topo_ent = make_selector(ThermalStandard, Area, "NonexistentArea") + @test collect(get_components_rt(nonexistent_topo_ent, test_sys2)) == + Vector{Component}() + + answers = + sort_name!.(( + get_components_in_aggregation_topology( + ThermalStandard, + test_sys2, + get_component(Area, test_sys2, "1"), ), + get_components_in_aggregation_topology( + StaticInjection, + test_sys2, + get_component(LoadZone, test_sys2, "2"), + ))) + for (ent, ans) in zip((test_topo_ent1, test_topo_ent2), answers) + @assert length(ans) > 0 "Relies on an out-of-date `5_bus_hydro_uc_sys` definition" + + the_components = get_components_rt(ent, test_sys2) + @test all(sort_name!(the_components) .== ans) + @test Set(collect(get_components_rt(x -> true, ent, test_sys2))) == + Set(the_components) + @test length( + collect(get_components_rt(x -> false, ent, test_sys2)), ) == - Vector{Component}() - @test collect(get_available_components(make_selector(gen_sundance), test_sys)) == - Vector{Component}() - @test get_component(x -> true, test_gen_ent, test_sys) == - first(the_components) - @test isnothing(get_component(x -> false, test_gen_ent, test_sys)) - @test isnothing(get_available_component(make_selector(gen_sundance), test_sys)) - - @test only(get_groups(test_gen_ent, test_sys)) == test_gen_ent - end - - @testset "Test ListComponentSelector" begin - comp_ent_1 = make_selector(ThermalStandard, "Sundance") - comp_ent_2 = make_selector(RenewableDispatch, "WindBusA") - test_list_ent = PSY.ListComponentSelector((comp_ent_1, comp_ent_2), nothing) - named_test_list_ent = - PSY.ListComponentSelector((comp_ent_1, comp_ent_2), "TwoComps") - - # Equality - @test PSY.ListComponentSelector((comp_ent_1, comp_ent_2), nothing) == test_list_ent - @test PSY.ListComponentSelector((comp_ent_1, comp_ent_2), "TwoComps") == - named_test_list_ent - - # Construction - @test make_selector(comp_ent_1, comp_ent_2;) == test_list_ent - @test make_selector(comp_ent_1, comp_ent_2; name = "TwoComps") == - named_test_list_ent - - # Naming - @test get_name(test_list_ent) == - "[ThermalStandard__Sundance, RenewableDispatch__WindBusA]" - @test get_name(named_test_list_ent) == "TwoComps" - - # Contents - @test collect(get_components_rt(make_selector(), test_sys)) == Vector{Component}() - the_components = collect(get_components_rt(test_list_ent, test_sys)) - @test length(the_components) == 2 - - @test collect(get_groups(make_selector(), test_sys)) == - Vector{ComponentSelector}() - the_groups = collect(get_groups(test_list_ent, test_sys)) - @test length(the_groups) == 2 - end - - @testset "Test TypeComponentSelector" begin - test_sub_ent = PSY.TypeComponentSelector(ThermalStandard, :all, nothing) - named_test_sub_ent = PSY.TypeComponentSelector(ThermalStandard, :all, "Thermals") - - # Equality - @test PSY.TypeComponentSelector(ThermalStandard, :all, nothing) == test_sub_ent - @test PSY.TypeComponentSelector(ThermalStandard, :all, "Thermals") == - named_test_sub_ent - - # Construction - @test make_selector(ThermalStandard) == - make_selector(ThermalStandard; groupby = :each) - @test make_selector(ThermalStandard; groupby = :all) == test_sub_ent - @test make_selector(ThermalStandard; groupby = :all, name = "Thermals") == - named_test_sub_ent - @test make_selector(ThermalStandard; groupby = string) isa PSY.TypeComponentSelector - - # Naming - @test get_name(test_sub_ent) == "ThermalStandard" - @test get_name(named_test_sub_ent) == "Thermals" - - # Contents - answer = sort_name!(get_components_rt(ThermalStandard, test_sys)) - - @test collect(get_components_rt(make_selector(NonexistentComponent), test_sys)) == - Vector{Component}() - the_components = sort_name!(get_components_rt(test_sub_ent, test_sys)) - @test all(the_components .== answer) - @test !( - gen_sundance in - collect(get_components_rt(get_available, test_sub_ent, test_sys))) - @test !(gen_sundance in collect(get_available_components(test_sub_ent, test_sys))) - - # Grouping inherits from `DynamicallyGroupedComponentSelector` and is tested elsewhere - end - - @testset "Test TopologyComponentSelector" begin - topo1 = get_component(Area, test_sys2, "1") - topo2 = get_component(LoadZone, test_sys2, "2") - @assert !isnothing(topo1) && !isnothing(topo2) "Relies on an out-of-date `5_bus_hydro_uc_sys` definition" - test_topo_ent1 = - PSY.TopologyComponentSelector(ThermalStandard, Area, "1", :all, nothing) - test_topo_ent2 = - PSY.TopologyComponentSelector(StaticInjection, LoadZone, "2", :all, "Zone_2") - - # Equality - @test PSY.TopologyComponentSelector(ThermalStandard, Area, "1", :all, nothing) == - test_topo_ent1 - @test PSY.TopologyComponentSelector( - StaticInjection, - LoadZone, - "2", - :all, - "Zone_2", - ) == - test_topo_ent2 - - # Construction - @test make_selector(ThermalStandard, Area, "1") == - make_selector(ThermalStandard, Area, "1"; groupby = :each) - @test make_selector(ThermalStandard, Area, "1"; groupby = :all) == test_topo_ent1 - @test make_selector( - StaticInjection, - LoadZone, - "2"; - groupby = :all, - name = "Zone_2", - ) == - test_topo_ent2 - @test make_selector(StaticInjection, LoadZone, "2"; groupby = string) isa - PSY.TopologyComponentSelector - - # Naming - @test get_name(test_topo_ent1) == "Area__1__ThermalStandard" - @test get_name(test_topo_ent2) == "Zone_2" - - # Contents - empty_topo_ent = make_selector(NonexistentComponent, Area, "1") - @test collect(get_components_rt(empty_topo_ent, test_sys2)) == Vector{Component}() - - nonexistent_topo_ent = make_selector(ThermalStandard, Area, "NonexistentArea") - @test collect(get_components_rt(nonexistent_topo_ent, test_sys2)) == - Vector{Component}() - - answers = - sort_name!.(( - get_components_in_aggregation_topology( - ThermalStandard, - test_sys2, - get_component(Area, test_sys2, "1"), - ), - get_components_in_aggregation_topology( - StaticInjection, - test_sys2, - get_component(LoadZone, test_sys2, "2"), - ))) - for (ent, ans) in zip((test_topo_ent1, test_topo_ent2), answers) - @assert length(ans) > 0 "Relies on an out-of-date `5_bus_hydro_uc_sys` definition" - - the_components = get_components_rt(ent, test_sys2) - @test all(sort_name!(the_components) .== ans) - @test Set(collect(get_components_rt(x -> true, ent, test_sys2))) == - Set(the_components) - @test length( - collect(get_components_rt(x -> false, ent, test_sys2)), - ) == - 0 - end - end - - @testset "Test FilterComponentSelector" begin - starts_with_s(x) = lowercase(first(get_name(x))) == 's' - test_filter_ent = - PSY.FilterComponentSelector(ThermalStandard, starts_with_s, :all, nothing) - named_test_filter_ent = PSY.FilterComponentSelector( - ThermalStandard, starts_with_s, :all, "ThermStartsWithS") - - # Equality - @test PSY.FilterComponentSelector(ThermalStandard, starts_with_s, :all, nothing) == - test_filter_ent - @test PSY.FilterComponentSelector( - ThermalStandard, starts_with_s, :all, "ThermStartsWithS") == named_test_filter_ent - - # Construction - @test make_selector(starts_with_s, ThermalStandard) == - make_selector(starts_with_s, ThermalStandard; groupby = :each) - @test make_selector(starts_with_s, ThermalStandard; groupby = :all) == - test_filter_ent - @test make_selector( - starts_with_s, - ThermalStandard; - groupby = :all, - name = "ThermStartsWithS", - ) == named_test_filter_ent - @test make_selector(starts_with_s, ThermalStandard; groupby = string) isa - PSY.FilterComponentSelector - - # Naming - @test get_name(test_filter_ent) == "starts_with_s__ThermalStandard" - @test get_name(named_test_filter_ent) == "ThermStartsWithS" - - # Contents - answer = - filter(starts_with_s, collect(get_components_rt(ThermalStandard, test_sys))) - - @test collect( - get_components_rt(make_selector(x -> true, NonexistentComponent), test_sys), - ) == - Vector{Component}() - @test collect(get_components_rt(make_selector(x -> false, Component), test_sys)) == - Vector{Component}() - @test all(collect(get_components_rt(test_filter_ent, test_sys)) .== answer) - @test !( - gen_sundance in - collect( - get_components_rt(get_available, test_filter_ent, test_sys), - )) - @test !( - gen_sundance in collect(get_available_components(test_filter_ent, test_sys)) - ) + 0 end - - @testset "Test RegroupedComponentSelector" begin - comp_ent_1 = make_selector(ThermalStandard, "Sundance") - comp_ent_2 = make_selector(RenewableDispatch, "WindBusA") - test_list_ent = PSY.ListComponentSelector((comp_ent_1, comp_ent_2), nothing) - test_sel = PSY.RegroupedComponentSelector(test_list_ent, :all) - - # Equality - @test PSY.RegroupedComponentSelector(test_list_ent, :all) == test_sel - - # Naming - @test get_name(test_sel) == get_name(test_list_ent) - - # Contents - @test Set(collect(get_components_rt(test_sel, test_sys))) == - Set(collect(get_components_rt(test_list_ent, test_sys))) - end - - @testset "Test DynamicallyGroupedComponentSelector grouping" begin - # We'll use TopologyComponentSelector as the token example - @assert PSY.TopologyComponentSelector <: DynamicallyGroupedComponentSelector - - all_selector = make_selector(ThermalStandard, Area, "1"; groupby = :all) - each_selector = make_selector(ThermalStandard, Area, "1"; groupby = :each) - @test make_selector(ThermalStandard, Area, "1") == each_selector - @test_throws ArgumentError make_selector( - ThermalStandard, - Area, - "1"; - groupby = :other, - ) - # @show get_name.(get_components_rt(all_selector, test_sys2)) - partition_selector = make_selector(ThermalStandard, Area, "1"; - groupby = x -> occursin(" ", get_name(x))) - - @test only(get_groups(all_selector, test_sys2)) == all_selector - @test Set(get_name.(get_groups(each_selector, test_sys2))) == - Set(( - component_to_qualified_string.(Ref(ThermalStandard), - get_name.(get_components_rt(each_selector, test_sys2))) +end + +@testset "Test FilterComponentSelector" begin + starts_with_s(x) = lowercase(first(get_name(x))) == 's' + test_filter_ent = + PSY.FilterComponentSelector(ThermalStandard, starts_with_s, :all, nothing) + named_test_filter_ent = PSY.FilterComponentSelector( + ThermalStandard, starts_with_s, :all, "ThermStartsWithS") + + # Equality + @test PSY.FilterComponentSelector(ThermalStandard, starts_with_s, :all, nothing) == + test_filter_ent + @test PSY.FilterComponentSelector( + ThermalStandard, starts_with_s, :all, "ThermStartsWithS") == named_test_filter_ent + + # Construction + @test make_selector(starts_with_s, ThermalStandard) == + make_selector(starts_with_s, ThermalStandard; groupby = :each) + @test make_selector(starts_with_s, ThermalStandard; groupby = :all) == + test_filter_ent + @test make_selector( + starts_with_s, + ThermalStandard; + groupby = :all, + name = "ThermStartsWithS", + ) == named_test_filter_ent + @test make_selector(starts_with_s, ThermalStandard; groupby = string) isa + PSY.FilterComponentSelector + + # Naming + @test get_name(test_filter_ent) == "starts_with_s__ThermalStandard" + @test get_name(named_test_filter_ent) == "ThermStartsWithS" + + # Contents + answer = + filter(starts_with_s, collect(get_components_rt(ThermalStandard, test_sys))) + + @test collect( + get_components_rt(make_selector(x -> true, NonexistentComponent), test_sys), + ) == + Vector{Component}() + @test collect(get_components_rt(make_selector(x -> false, Component), test_sys)) == + Vector{Component}() + @test all(collect(get_components_rt(test_filter_ent, test_sys)) .== answer) + @test !( + gen_sundance in + collect( + get_components_rt(get_available, test_filter_ent, test_sys), )) - @test length( - collect( - get_groups(x -> length(get_name(x)) == 8, each_selector, test_sys2), - ), - ) == 2 - @test Set(get_name.(get_groups(partition_selector, test_sys2))) == - Set(["true", "false"]) - @test length( - collect( - get_groups(x -> length(get_name(x)) == 8, partition_selector, test_sys2), - ), - ) == 1 - - # Also test briefly with something from IS - @assert PSY.TypeComponentSelector <: DynamicallyGroupedComponentSelector - @test length( - collect( - get_groups( - make_selector(ThermalStandard; - groupby = x -> length(get_name(x))), test_sys), - ), - ) == 3 - - # Test proper handling of availability - sel = make_selector(ThermalStandard; groupby = :each) - @test length(get_groups(sel, test_sys2)) > - length(get_available_groups(sel, test_sys2)) == - length(get_available_components(sel, test_sys2)) == - length(get_available_components(ThermalStandard, test_sys2)) == - length(get_components(get_available, ThermalStandard, test_sys2)) - end - - @testset "Test rebuild_selector" begin - @assert !(PSY.NameComponentSelector <: PSY.DynamicallyGroupedComponentSelector) - @assert PSY.TopologyComponentSelector <: PSY.DynamicallyGroupedComponentSelector - - sel1::PSY.NameComponentSelector = - make_selector(ThermalStandard, "Component1"; name = "oldname") - sel2::PSY.TypeComponentSelector = - make_selector(ThermalStandard; groupby = :all) - sel3::PSY.TopologyComponentSelector = - make_selector(ThermalStandard, Area, "1"; groupby = :all) - # TODO include sel3 when get_components is fixed -- see below - sel4::IS.ListComponentSelector = make_selector(sel1, sel2; name = "oldname") - - @test rebuild_selector(sel1; name = "newname") == - make_selector(ThermalStandard, "Component1"; name = "newname") - @test_throws Exception rebuild_selector(sel1; groupby = :each) - - @test rebuild_selector(sel2; name = "newname") == - make_selector(ThermalStandard; name = "newname", groupby = :all) - @test rebuild_selector(sel2; name = "newname", groupby = :each) == - make_selector(ThermalStandard; name = "newname", groupby = :each) - - @test rebuild_selector(sel3; name = "newname") == - make_selector(ThermalStandard, Area, "1"; name = "newname", groupby = :all) - @test rebuild_selector(sel3; name = "newname", groupby = :each) == - make_selector(ThermalStandard, Area, "1"; name = "newname", groupby = :each) - - @test rebuild_selector(sel4; name = "newname") == - make_selector(sel1, sel2; name = "newname") - regrouped = rebuild_selector(sel4; name = "newname", groupby = :all) - @test Set(collect(get_components_rt(regrouped, test_sys))) == - Set(collect(get_components_rt(sel4, test_sys))) - @test length(get_groups(regrouped, test_sys)) == 1 - end - - @testset "Test special cases" begin - # Can error if the `PSY.get_components` vs. `IS.get_components` stuff is not functioning correctly - agg_selectors = [make_selector(ThermalStandard, Area, "1"), - make_selector(ThermalStandard, Area, "1")] - get_components_rt(make_selector(agg_selectors...), test_sys) - end -end # if false (parsing-dependent tests disabled) + @test !( + gen_sundance in collect(get_available_components(test_filter_ent, test_sys)) + ) +end + +@testset "Test RegroupedComponentSelector" begin + comp_ent_1 = make_selector(ThermalStandard, "Sundance") + comp_ent_2 = make_selector(RenewableDispatch, "WindBusA") + test_list_ent = PSY.ListComponentSelector((comp_ent_1, comp_ent_2), nothing) + test_sel = PSY.RegroupedComponentSelector(test_list_ent, :all) + + # Equality + @test PSY.RegroupedComponentSelector(test_list_ent, :all) == test_sel + + # Naming + @test get_name(test_sel) == get_name(test_list_ent) + + # Contents + @test Set(collect(get_components_rt(test_sel, test_sys))) == + Set(collect(get_components_rt(test_list_ent, test_sys))) +end + +@testset "Test DynamicallyGroupedComponentSelector grouping" begin + # We'll use TopologyComponentSelector as the token example + @assert PSY.TopologyComponentSelector <: DynamicallyGroupedComponentSelector + + all_selector = make_selector(ThermalStandard, Area, "1"; groupby = :all) + each_selector = make_selector(ThermalStandard, Area, "1"; groupby = :each) + @test make_selector(ThermalStandard, Area, "1") == each_selector + @test_throws ArgumentError make_selector( + ThermalStandard, + Area, + "1"; + groupby = :other, + ) + # @show get_name.(get_components_rt(all_selector, test_sys2)) + partition_selector = make_selector(ThermalStandard, Area, "1"; + groupby = x -> occursin(" ", get_name(x))) + + @test only(get_groups(all_selector, test_sys2)) == all_selector + @test Set(get_name.(get_groups(each_selector, test_sys2))) == + Set(( + component_to_qualified_string.(Ref(ThermalStandard), + get_name.(get_components_rt(each_selector, test_sys2))) + )) + @test length( + collect( + get_groups(x -> length(get_name(x)) == 8, each_selector, test_sys2), + ), + ) == 2 + @test Set(get_name.(get_groups(partition_selector, test_sys2))) == + Set(["true", "false"]) + @test length( + collect( + get_groups(x -> length(get_name(x)) == 8, partition_selector, test_sys2), + ), + ) == 1 + + # Also test briefly with something from IS + @assert PSY.TypeComponentSelector <: DynamicallyGroupedComponentSelector + @test length( + collect( + get_groups( + make_selector(ThermalStandard; + groupby = x -> length(get_name(x))), test_sys), + ), + ) == 3 + + # Test proper handling of availability + sel = make_selector(ThermalStandard; groupby = :each) + @test length(get_groups(sel, test_sys2)) > + length(get_available_groups(sel, test_sys2)) == + length(get_available_components(sel, test_sys2)) == + length(get_available_components(ThermalStandard, test_sys2)) == + length(get_components(get_available, ThermalStandard, test_sys2)) +end + +@testset "Test rebuild_selector" begin + @assert !(PSY.NameComponentSelector <: PSY.DynamicallyGroupedComponentSelector) + @assert PSY.TopologyComponentSelector <: PSY.DynamicallyGroupedComponentSelector + + sel1::PSY.NameComponentSelector = + make_selector(ThermalStandard, "Component1"; name = "oldname") + sel2::PSY.TypeComponentSelector = + make_selector(ThermalStandard; groupby = :all) + sel3::PSY.TopologyComponentSelector = + make_selector(ThermalStandard, Area, "1"; groupby = :all) + # TODO include sel3 when get_components is fixed -- see below + sel4::IS.ListComponentSelector = make_selector(sel1, sel2; name = "oldname") + + @test rebuild_selector(sel1; name = "newname") == + make_selector(ThermalStandard, "Component1"; name = "newname") + @test_throws Exception rebuild_selector(sel1; groupby = :each) + + @test rebuild_selector(sel2; name = "newname") == + make_selector(ThermalStandard; name = "newname", groupby = :all) + @test rebuild_selector(sel2; name = "newname", groupby = :each) == + make_selector(ThermalStandard; name = "newname", groupby = :each) + + @test rebuild_selector(sel3; name = "newname") == + make_selector(ThermalStandard, Area, "1"; name = "newname", groupby = :all) + @test rebuild_selector(sel3; name = "newname", groupby = :each) == + make_selector(ThermalStandard, Area, "1"; name = "newname", groupby = :each) + + @test rebuild_selector(sel4; name = "newname") == + make_selector(sel1, sel2; name = "newname") + regrouped = rebuild_selector(sel4; name = "newname", groupby = :all) + @test Set(collect(get_components_rt(regrouped, test_sys))) == + Set(collect(get_components_rt(sel4, test_sys))) + @test length(get_groups(regrouped, test_sys)) == 1 +end + +@testset "Test special cases" begin + # Can error if the `PSY.get_components` vs. `IS.get_components` stuff is not functioning correctly + agg_selectors = [make_selector(ThermalStandard, Area, "1"), + make_selector(ThermalStandard, Area, "1")] + get_components_rt(make_selector(agg_selectors...), test_sys) +end diff --git a/test/test_cost_functions.jl b/test/test_cost_functions.jl index bdf606205e..c118142939 100644 --- a/test/test_cost_functions.jl +++ b/test/test_cost_functions.jl @@ -12,81 +12,79 @@ "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 -# (PSB.build_system uses PSY.PowerSystemTableData internally for test_RTS_GMLC_sys). -# @testset "Test MarketBidCost direct struct creation and some scalar cost_function_timeseries interface" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# generator = get_component(ThermalStandard, sys, "322_CT_6") -# #Update generator cost to MarketBidCost using Natural Units -# powers = [22.0, 33.0, 44.0, 55.0] # MW -# marginal_costs = [25.0, 26.0, 28.0] # $/MWh -# initial_input = 50.0 # $/h -# cc = CostCurve( -# PiecewiseIncrementalCurve( -# initial_input, -# powers, -# marginal_costs, -# ), -# ) -# mbc = MarketBidCost(; -# start_up = (hot = 0.0, warm = 0.0, cold = 0.0), -# shut_down = LinearCurve(0.0), -# incremental_offer_curves = cc, -# ) -# set_operation_cost!(generator, mbc) -# @test get_operation_cost(generator) isa MarketBidCost -# -# @test get_incremental_offer_curves(mbc) == cc -# @test get_decremental_offer_curves(mbc) == PSY.ZERO_OFFER_CURVE -# -# @test get_variable_cost(generator, mbc) == cc -# @test get_incremental_variable_cost(generator, mbc) == cc -# @test get_decremental_variable_cost(generator, mbc) == PSY.ZERO_OFFER_CURVE -# -# cc2 = CostCurve( -# PiecewiseIncrementalCurve( -# initial_input, -# powers, -# marginal_costs .* 1.5, -# ), -# ) -# set_incremental_variable_cost!(sys, generator, cc2, UnitSystem.NATURAL_UNITS) -# @test get_incremental_variable_cost(generator, mbc) == cc2 -# -# set_decremental_variable_cost!(sys, generator, cc2, UnitSystem.NATURAL_UNITS) -# @test get_decremental_offer_curves(mbc) == cc2 -# 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 Make market bid curve interface" begin -# mbc = make_market_bid_curve( -# [0.0, 100.0, 105.0, 120.0, 130.0], -# [25.0, 26.0, 28.0, 30.0], -# 10.0, -# ) -# @test is_market_bid_curve(mbc) -# @test is_market_bid_curve( -# make_market_bid_curve(get_function_data(mbc), get_initial_input(mbc)), -# ) -# @test_throws ArgumentError make_market_bid_curve( -# [100.0, 105.0, 120.0, 130.0], [26.0, 28.0, 30.0, 40.0], 10.0) -# -# mbc2 = make_market_bid_curve([1.0, 2.0, 3.0], [4.0, 6.0], 10.0; input_at_zero = 2.0) -# @test is_market_bid_curve(mbc2) -# @test is_market_bid_curve( -# make_market_bid_curve(get_function_data(mbc2), get_initial_input(mbc2)), -# ) -# -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# generator = get_component(ThermalStandard, sys, "322_CT_6") -# market_bid = MarketBidCost(nothing) -# mbc3 = make_market_bid_curve([22.0, 33.0, 44.0, 55.0], [25.0, 26.0, 28.0], 50.0) -# set_incremental_offer_curves!(market_bid, mbc3) -# set_start_up!(market_bid, 0.0) -# set_operation_cost!(generator, market_bid) -# @test get_operation_cost(generator) isa MarketBidCost -# end +@testset "Test MarketBidCost direct struct creation and some scalar cost_function_timeseries interface" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + generator = get_component(ThermalStandard, sys, "322_CT_6") + #Update generator cost to MarketBidCost using Natural Units + powers = [22.0, 33.0, 44.0, 55.0] # MW + marginal_costs = [25.0, 26.0, 28.0] # $/MWh + initial_input = 50.0 # $/h + cc = CostCurve( + PiecewiseIncrementalCurve( + initial_input, + powers, + marginal_costs, + ), + ) + mbc = MarketBidCost(; + start_up = (hot = 0.0, warm = 0.0, cold = 0.0), + shut_down = LinearCurve(0.0), + incremental_offer_curves = cc, + ) + set_operation_cost!(generator, mbc) + @test get_operation_cost(generator) isa MarketBidCost + + @test get_incremental_offer_curves(mbc) == cc + @test get_decremental_offer_curves(mbc) == PSY.ZERO_OFFER_CURVE + + @test get_variable_cost(generator, mbc) == cc + @test get_incremental_variable_cost(generator, mbc) == cc + @test get_decremental_variable_cost(generator, mbc) == PSY.ZERO_OFFER_CURVE + + cc2 = CostCurve( + PiecewiseIncrementalCurve( + initial_input, + powers, + marginal_costs .* 1.5, + ), + ) + # Setters take the explicit unit-system marker and rebuild the cost object, + # so assertions read the component's current cost. + set_incremental_variable_cost!(sys, generator, cc2, IS.NaturalUnit()) + @test get_incremental_variable_cost(generator, get_operation_cost(generator)) == cc2 + + set_decremental_variable_cost!(sys, generator, cc2, IS.NaturalUnit()) + @test get_decremental_offer_curves(get_operation_cost(generator)) == cc2 +end + +@testset "Test Make market bid curve interface" begin + mbc = make_market_bid_curve( + [0.0, 100.0, 105.0, 120.0, 130.0], + [25.0, 26.0, 28.0, 30.0], + 10.0, + ) + @test is_market_bid_curve(mbc) + @test is_market_bid_curve( + make_market_bid_curve(get_function_data(mbc), get_initial_input(mbc)), + ) + @test_throws ArgumentError make_market_bid_curve( + [100.0, 105.0, 120.0, 130.0], [26.0, 28.0, 30.0, 40.0], 10.0) + + mbc2 = make_market_bid_curve([1.0, 2.0, 3.0], [4.0, 6.0], 10.0; input_at_zero = 2.0) + @test is_market_bid_curve(mbc2) + @test is_market_bid_curve( + make_market_bid_curve(get_function_data(mbc2), get_initial_input(mbc2)), + ) + + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + generator = get_component(ThermalStandard, sys, "322_CT_6") + market_bid = MarketBidCost(nothing) + mbc3 = make_market_bid_curve([22.0, 33.0, 44.0, 55.0], [25.0, 26.0, 28.0], 50.0) + set_incremental_offer_curves!(market_bid, mbc3) + set_start_up!(market_bid, 0.0) + set_operation_cost!(generator, market_bid) + @test get_operation_cost(generator) isa MarketBidCost +end test_costs = Dict( IS.AnyCostCurve{QuadraticCurve} => @@ -283,13 +281,15 @@ end ie_cost2 = build_iec_sys() + # Setters rebuild the cost object (the unit system is a type parameter), + # so assertions read the component's current cost. new_import = make_import_curve([0.0, 50.0, 100.0], [10.0, 20.0]) set_import_variable_cost!(sys, source, new_import, IS.NaturalUnit()) - @test get_import_offer_curves(ie_cost) == new_import + @test get_import_offer_curves(get_operation_cost(source)) == 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, IS.NaturalUnit()) - @test get_export_offer_curves(ie_cost) == new_export + @test get_export_offer_curves(get_operation_cost(source)) == new_export # Test unit mismatch throws @test_throws ArgumentError set_import_variable_cost!( @@ -356,146 +356,246 @@ function _attach_linear_forecast(sys, component, name) return add_time_series!(sys, component, fcst) 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 "MarketBidTimeSeriesCost resolves variable cost at start_time" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# generator = get_component(ThermalStandard, sys, "322_CT_6") -# -# inc_key = _attach_pwl_forecast(sys, generator, "inc_offer") -# dec_key = _attach_pwl_forecast(sys, generator, "dec_offer") -# nl_key = _attach_linear_forecast(sys, generator, "no_load") -# sd_key = _attach_linear_forecast(sys, generator, "shut_down") -# -# timestamps = range(_TS_RESOLVE_INITIAL_TIME; step = _TS_RESOLVE_RESOLUTION, length = 24) -# su_ta = TimeSeries.TimeArray( -# collect(timestamps), -# fill((0.0, 0.0, 0.0), 24), -# ) -# su_key = add_time_series!( -# sys, generator, -# IS.SingleTimeSeries(; name = "start_up_stages_var", data = su_ta), -# ) -# -# mbtc = MarketBidTimeSeriesCost(; -# no_load_cost = IS.TimeSeriesLinearCurve(nl_key), -# start_up = TupleTimeSeries{PSY.StartUpStages}(su_key), -# shut_down = IS.TimeSeriesLinearCurve(sd_key), -# incremental_offer_curves = make_market_bid_ts_curve(inc_key), -# decremental_offer_curves = make_market_bid_ts_curve(dec_key), -# ) -# # NOTE: not calling set_operation_cost! because ThermalStandard.operation_cost -# # is typed Union{MarketBidCost, ThermalGenerationCost} and does not yet accept -# # MarketBidTimeSeriesCost. See PR follow-up about wiring TS cost types into -# # device unions. -# -# inc_resolved = get_variable_cost(generator, mbtc; start_time = _TS_RESOLVE_INITIAL_TIME) -# @test get_function_data(get_value_curve(inc_resolved)) == _TS_RESOLVE_PWL_DATA[1] -# -# dec_resolved = -# get_decremental_variable_cost( -# generator, -# mbtc; -# start_time = _TS_RESOLVE_INITIAL_TIME, -# ) -# @test get_function_data(get_value_curve(dec_resolved)) == _TS_RESOLVE_PWL_DATA[1] -# -# @test_throws ArgumentError get_variable_cost(generator, mbtc) -# @test_throws ArgumentError get_decremental_variable_cost(generator, mbtc) -# 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 "MarketBidTimeSeriesCost resolves start_up via TupleTimeSeries" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# generator = get_component(ThermalStandard, sys, "322_CT_6") -# -# inc_key = _attach_pwl_forecast(sys, generator, "inc_offer") -# dec_key = _attach_pwl_forecast(sys, generator, "dec_offer") -# nl_key = _attach_linear_forecast(sys, generator, "no_load") -# sd_key = _attach_linear_forecast(sys, generator, "shut_down") -# -# # Build a SingleTimeSeries of NTuple{3, Float64} distinct per timestamp so that -# # the resolved value at a chosen start_time is unambiguous. -# timestamps = range(_TS_RESOLVE_INITIAL_TIME; step = _TS_RESOLVE_RESOLUTION, length = 24) -# su_values = [(Float64(i), Float64(i) + 10.0, Float64(i) + 20.0) for i in 1:24] -# su_ta = TimeSeries.TimeArray(collect(timestamps), su_values) -# su_sts = IS.SingleTimeSeries(; name = "start_up_stages", data = su_ta) -# su_key = add_time_series!(sys, generator, su_sts) -# -# mbtc = MarketBidTimeSeriesCost(; -# no_load_cost = IS.TimeSeriesLinearCurve(nl_key), -# start_up = TupleTimeSeries{PSY.StartUpStages}(su_key), -# shut_down = IS.TimeSeriesLinearCurve(sd_key), -# incremental_offer_curves = make_market_bid_ts_curve(inc_key), -# decremental_offer_curves = make_market_bid_ts_curve(dec_key), -# ) -# -# @test get_start_up(mbtc) isa TupleTimeSeries{PSY.StartUpStages} -# -# resolved_first = -# get_start_up(generator, mbtc; start_time = _TS_RESOLVE_INITIAL_TIME) -# @test resolved_first isa PSY.StartUpStages -# @test resolved_first == (hot = 1.0, warm = 11.0, cold = 21.0) -# -# resolved_fifth = get_start_up( -# generator, mbtc; -# start_time = _TS_RESOLVE_INITIAL_TIME + Dates.Hour(4), -# ) -# @test resolved_fifth == (hot = 5.0, warm = 15.0, cold = 25.0) -# -# @test_throws ArgumentError get_start_up(generator, mbtc) -# 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 "ImportExportTimeSeriesCost resolves import/export costs at start_time" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# generator = get_component(ThermalStandard, sys, "322_CT_6") -# -# imp_key = _attach_pwl_forecast(sys, generator, "import_offer") -# exp_key = _attach_pwl_forecast(sys, generator, "export_offer") -# -# iec = ImportExportTimeSeriesCost(; -# import_offer_curves = make_import_export_ts_curve(imp_key), -# export_offer_curves = make_import_export_ts_curve(exp_key), -# ) -# # NOTE: not calling set_operation_cost! — see comment above. -# -# imp_resolved = -# get_import_variable_cost(generator, iec; start_time = _TS_RESOLVE_INITIAL_TIME) -# @test get_function_data(get_value_curve(imp_resolved)) == _TS_RESOLVE_PWL_DATA[1] -# -# exp_resolved = -# get_export_variable_cost(generator, iec; start_time = _TS_RESOLVE_INITIAL_TIME) -# @test get_function_data(get_value_curve(exp_resolved)) == _TS_RESOLVE_PWL_DATA[1] -# -# @test_throws ArgumentError get_import_variable_cost(generator, iec) -# @test_throws ArgumentError get_export_variable_cost(generator, iec) -# 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 "ReserveDemandTimeSeriesCurve resolves variable cost at start_time" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# # `ForecastKey` identifies a time series by name/type/timing — it does not -# # bind to a specific component, so we can bootstrap a key from a throwaway -# # generator and reuse it after attaching the same forecast to the reserve. -# bootstrap = get_component(ThermalStandard, sys, "322_CT_6") -# ts_key = _attach_pwl_forecast(sys, bootstrap, "ordc") -# -# curve = CostCurve(TimeSeriesPiecewiseIncrementalCurve(ts_key, nothing, nothing)) -# reserve = ReserveDemandTimeSeriesCurve{ReserveUp}(; -# variable = curve, -# name = "TestOrdc", -# available = true, -# time_frame = 10.0, -# ) -# add_component!(sys, reserve) -# _attach_pwl_forecast(sys, reserve, "ordc") -# -# resolved = get_variable_cost(reserve; start_time = _TS_RESOLVE_INITIAL_TIME) -# @test get_function_data(get_value_curve(resolved)) == _TS_RESOLVE_PWL_DATA[1] -# -# @test_throws ArgumentError get_variable_cost(reserve) -# end +@testset "MarketBidTimeSeriesCost resolves variable cost at start_time" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + generator = get_component(ThermalStandard, sys, "322_CT_6") + + inc_key = _attach_pwl_forecast(sys, generator, "inc_offer") + dec_key = _attach_pwl_forecast(sys, generator, "dec_offer") + nl_key = _attach_linear_forecast(sys, generator, "no_load") + sd_key = _attach_linear_forecast(sys, generator, "shut_down") + + timestamps = range(_TS_RESOLVE_INITIAL_TIME; step = _TS_RESOLVE_RESOLUTION, length = 24) + su_ta = TimeSeries.TimeArray( + collect(timestamps), + fill((0.0, 0.0, 0.0), 24), + ) + su_key = add_time_series!( + sys, generator, + IS.SingleTimeSeries(; name = "start_up_stages_var", data = su_ta), + ) + + mbtc = MarketBidTimeSeriesCost(; + no_load_cost = IS.TimeSeriesLinearCurve(nl_key), + start_up = TupleTimeSeries{PSY.StartUpStages}(su_key), + shut_down = IS.TimeSeriesLinearCurve(sd_key), + incremental_offer_curves = make_market_bid_ts_curve(inc_key), + decremental_offer_curves = make_market_bid_ts_curve(dec_key), + ) + # NOTE: not calling set_operation_cost! because ThermalStandard.operation_cost + # is typed Union{MarketBidCost, ThermalGenerationCost} and does not yet accept + # MarketBidTimeSeriesCost. See PR follow-up about wiring TS cost types into + # device unions. + + inc_resolved = get_variable_cost(generator, mbtc; start_time = _TS_RESOLVE_INITIAL_TIME) + @test get_function_data(get_value_curve(inc_resolved)) == _TS_RESOLVE_PWL_DATA[1] + + dec_resolved = + get_decremental_variable_cost( + generator, + mbtc; + start_time = _TS_RESOLVE_INITIAL_TIME, + ) + @test get_function_data(get_value_curve(dec_resolved)) == _TS_RESOLVE_PWL_DATA[1] + + @test_throws ArgumentError get_variable_cost(generator, mbtc) + @test_throws ArgumentError get_decremental_variable_cost(generator, mbtc) +end + +@testset "MarketBidTimeSeriesCost resolves start_up via TupleTimeSeries" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + generator = get_component(ThermalStandard, sys, "322_CT_6") + + inc_key = _attach_pwl_forecast(sys, generator, "inc_offer") + dec_key = _attach_pwl_forecast(sys, generator, "dec_offer") + nl_key = _attach_linear_forecast(sys, generator, "no_load") + sd_key = _attach_linear_forecast(sys, generator, "shut_down") + + # Build a SingleTimeSeries of NTuple{3, Float64} distinct per timestamp so that + # the resolved value at a chosen start_time is unambiguous. + timestamps = range(_TS_RESOLVE_INITIAL_TIME; step = _TS_RESOLVE_RESOLUTION, length = 24) + su_values = [(Float64(i), Float64(i) + 10.0, Float64(i) + 20.0) for i in 1:24] + su_ta = TimeSeries.TimeArray(collect(timestamps), su_values) + su_sts = IS.SingleTimeSeries(; name = "start_up_stages", data = su_ta) + su_key = add_time_series!(sys, generator, su_sts) + + mbtc = MarketBidTimeSeriesCost(; + no_load_cost = IS.TimeSeriesLinearCurve(nl_key), + start_up = TupleTimeSeries{PSY.StartUpStages}(su_key), + shut_down = IS.TimeSeriesLinearCurve(sd_key), + incremental_offer_curves = make_market_bid_ts_curve(inc_key), + decremental_offer_curves = make_market_bid_ts_curve(dec_key), + ) + + @test get_start_up(mbtc) isa TupleTimeSeries{PSY.StartUpStages} + + resolved_first = + get_start_up(generator, mbtc; start_time = _TS_RESOLVE_INITIAL_TIME) + @test resolved_first isa PSY.StartUpStages + @test resolved_first == (hot = 1.0, warm = 11.0, cold = 21.0) + + resolved_fifth = get_start_up( + generator, mbtc; + start_time = _TS_RESOLVE_INITIAL_TIME + Dates.Hour(4), + ) + @test resolved_fifth == (hot = 5.0, warm = 15.0, cold = 25.0) + + @test_throws ArgumentError get_start_up(generator, mbtc) +end + +@testset "ImportExportTimeSeriesCost resolves import/export costs at start_time" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + generator = get_component(ThermalStandard, sys, "322_CT_6") + + imp_key = _attach_pwl_forecast(sys, generator, "import_offer") + exp_key = _attach_pwl_forecast(sys, generator, "export_offer") + + iec = ImportExportTimeSeriesCost(; + import_offer_curves = make_import_export_ts_curve(imp_key), + export_offer_curves = make_import_export_ts_curve(exp_key), + ) + # NOTE: not calling set_operation_cost! — see comment above. + + imp_resolved = + get_import_variable_cost(generator, iec; start_time = _TS_RESOLVE_INITIAL_TIME) + @test get_function_data(get_value_curve(imp_resolved)) == _TS_RESOLVE_PWL_DATA[1] + + exp_resolved = + get_export_variable_cost(generator, iec; start_time = _TS_RESOLVE_INITIAL_TIME) + @test get_function_data(get_value_curve(exp_resolved)) == _TS_RESOLVE_PWL_DATA[1] + + @test_throws ArgumentError get_import_variable_cost(generator, iec) + @test_throws ArgumentError get_export_variable_cost(generator, iec) +end + +@testset "ReserveDemandTimeSeriesCurve resolves variable cost at start_time" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + # `ForecastKey` identifies a time series by name/type/timing — it does not + # bind to a specific component, so we can bootstrap a key from a throwaway + # generator and reuse it after attaching the same forecast to the reserve. + bootstrap = get_component(ThermalStandard, sys, "322_CT_6") + ts_key = _attach_pwl_forecast(sys, bootstrap, "ordc") + + curve = CostCurve(TimeSeriesPiecewiseIncrementalCurve(ts_key, nothing, nothing)) + reserve = ReserveDemandTimeSeriesCurve{ReserveUp}(; + variable = curve, + name = "TestOrdc", + available = true, + time_frame = 10.0, + ) + add_component!(sys, reserve) + _attach_pwl_forecast(sys, reserve, "ordc") + + resolved = get_variable_cost(reserve; start_time = _TS_RESOLVE_INITIAL_TIME) + @test get_function_data(get_value_curve(resolved)) == _TS_RESOLVE_PWL_DATA[1] + + @test_throws ArgumentError get_variable_cost(reserve) +end + +@testset "ImportExportCost positional compat constructor terminates" begin + iec = ImportExportCost(nothing, nothing, 1.0, 2.0, VariableReserve{ReserveUp}[]) + @test iec isa ImportExportCost + @test get_import_offer_curves(iec) == PSY.ZERO_OFFER_CURVE + @test get_export_offer_curves(iec) == PSY.ZERO_OFFER_CURVE + @test get_energy_import_weekly_limit(iec) == 1.0 + @test get_energy_export_weekly_limit(iec) == 2.0 + + iec2 = ImportExportCost(nothing, nothing, 1.0, 2.0, Service[]) + @test iec2 isa ImportExportCost +end + +@testset "is_import_export_curve tolerates nothing offsets" begin + # ZERO_OFFER_CURVE is built with the 3-arg PiecewiseIncrementalCurve form, + # which leaves input_at_zero = nothing + @test PowerSystems.is_import_export_curve(PSY.ZERO_OFFER_CURVE) + # explicit nonzero offsets disqualify a curve without throwing + nonzero = CostCurve(PiecewiseIncrementalCurve(5.0, 1.0, [0.0, 100.0], [10.0])) + @test !PowerSystems.is_import_export_curve(nonzero) +end + +# Minimal MarketBidTimeSeriesCost backed by forecasts attached to `component`. +function _build_min_mbtc(sys, component) + inc_key = _attach_pwl_forecast(sys, component, "inc_offer_len") + dec_key = _attach_pwl_forecast(sys, component, "dec_offer_len") + nl_key = _attach_linear_forecast(sys, component, "no_load_len") + sd_key = _attach_linear_forecast(sys, component, "shut_down_len") + timestamps = + range(_TS_RESOLVE_INITIAL_TIME; step = _TS_RESOLVE_RESOLUTION, length = 24) + su_ta = TimeSeries.TimeArray(collect(timestamps), fill((0.0, 0.0, 0.0), 24)) + su_key = add_time_series!( + sys, component, + IS.SingleTimeSeries(; name = "start_up_stages_len", data = su_ta), + ) + return MarketBidTimeSeriesCost(; + no_load_cost = IS.TimeSeriesLinearCurve(nl_key), + start_up = TupleTimeSeries{PSY.StartUpStages}(su_key), + shut_down = IS.TimeSeriesLinearCurve(sd_key), + incremental_offer_curves = make_market_bid_ts_curve(inc_key), + decremental_offer_curves = make_market_bid_ts_curve(dec_key), + ) +end + +@testset "TS cost getters resolve single timesteps and windows" begin + sys = PSB.build_system(PSITestSystems, "c_sys5_uc") + gen = first(get_components(ThermalStandard, sys)) + mbtc = _build_min_mbtc(sys, gen) + t0 = _TS_RESOLVE_INITIAL_TIME + + # len = nothing resolves a single static curve + resolved = get_variable_cost(gen, mbtc; start_time = t0) + @test get_function_data(get_value_curve(resolved)) == _TS_RESOLVE_PWL_DATA[1] + + # len resolves the whole window with one read per time-series-backed field + window = get_variable_cost(gen, mbtc; start_time = t0, len = 24) + @test window isa Vector + @test length(window) == 24 + @test get_function_data(get_value_curve(window[1])) == _TS_RESOLVE_PWL_DATA[1] + @test get_function_data(get_value_curve(window[2])) == _TS_RESOLVE_PWL_DATA[2] + @test only(get_variable_cost(gen, mbtc; start_time = t0, len = 1)) == resolved + + nl_window = get_no_load_cost(gen, mbtc; start_time = t0, len = 24) + @test nl_window isa Vector + @test length(nl_window) == 24 + + # static-curve setters refuse time-series-backed costs (the setter path is + # not reachable through set_operation_cost! yet — device cost unions do not + # accept TS cost types — so exercise the chokepoint directly) + @test_throws ArgumentError PSY._replace_offer_curve( + mbtc, :incremental, PSY.ZERO_OFFER_CURVE) +end + +@testset "set_variable_cost! rebuilds MarketBidCost with the data units" begin + sys = System(100.0) + gen = ThermalStandard(nothing) + set_operation_cost!(gen, MarketBidCost(nothing)) # MarketBidCost{NaturalUnit} + @test get_operation_cost(gen) isa MarketBidCost{IS.NaturalUnit} + + data = CostCurve( + PiecewiseIncrementalCurve(0.0, [0.0, 1.0], [10.0]), + IS.SystemBaseUnit(), + ) + set_variable_cost!(sys, gen, data, IS.SystemBaseUnit()) + new_cost = get_operation_cost(gen) + @test new_cost isa MarketBidCost{IS.SystemBaseUnit} + @test get_incremental_offer_curves(new_cost) == data + # untouched fields carry over + @test get_start_up(new_cost) == + (hot = PSY.START_COST, warm = PSY.START_COST, cold = PSY.START_COST) +end + +@testset "set_import/export_variable_cost! rebuild ImportExportCost units" begin + sys = System(100.0) + source = Source(nothing) + set_operation_cost!(source, ImportExportCost()) # both placeholders, NaturalUnit + new_import = make_import_curve([0.0, 0.5, 1.0], [10.0, 20.0], IS.SystemBaseUnit()) + set_import_variable_cost!(sys, source, new_import, IS.SystemBaseUnit()) + cost = get_operation_cost(source) + @test cost isa ImportExportCost{IS.SystemBaseUnit} + @test get_import_offer_curves(cost) == new_import + + # a real (non-placeholder) opposite-side curve in a different unit system + # cannot be silently re-tagged and is rejected + sysb, sourceb, = build_iec_sys() + @test_throws ArgumentError set_import_variable_cost!( + sysb, sourceb, new_import, IS.SystemBaseUnit()) +end diff --git a/test/test_devices.jl b/test/test_devices.jl index 498e5cbc7d..a8cc18894c 100644 --- a/test/test_devices.jl +++ b/test/test_devices.jl @@ -1,96 +1,249 @@ -# 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 special accessors" begin -# cdmsys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# th = first(get_components(ThermalStandard, cdmsys)) -# re = first(get_components(RenewableDispatch, cdmsys)) -# -# @test get_max_active_power(th) == get_active_power_limits(th).max -# @test get_max_active_power(re) <= get_rating(re) -# @test isa(get_max_reactive_power(re), Float64) -# -# @test_throws MethodError get_max_active_power(TestDevice("foo")) -# @test_throws ArgumentError get_max_active_power(TestInjector("foo")) -# @test_throws ArgumentError get_max_active_power(TestRenDevice("foo")) -# end +@testset "Test special accessors" begin + cdmsys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + th = first(get_components(ThermalStandard, cdmsys)) + re = first(get_components(RenewableDispatch, cdmsys)) -# 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 Remove Area with Interchanges" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# area1 = get_component(Area, sys, "1") -# area2 = get_component(Area, sys, "2") -# area3 = get_component(Area, sys, "3") -# area_interchange12 = AreaInterchange(; -# name = "interchange_a1_a2", -# available = true, -# active_power_flow = 0.0, -# from_area = area1, -# to_area = area2, -# flow_limits = (from_to = 100.0, to_from = 100.0), -# ) -# area_interchange13 = AreaInterchange(; -# name = "interchange_a1_a3", -# available = true, -# active_power_flow = 0.0, -# from_area = area1, -# to_area = area3, -# flow_limits = (from_to = 100.0, to_from = 100.0), -# ) -# add_component!(sys, area_interchange12) -# add_component!(sys, area_interchange13) -# @test_throws ArgumentError remove_component!(sys, area1) -# remove_component!(sys, area_interchange12) -# remove_component!(sys, area_interchange13) -# remove_component!(sys, area1) -# @test get_component(Area, sys, "1") === nothing -# end + @test get_max_active_power(th, SU) == get_active_power_limits(th, SU).max + @test get_max_active_power(re, SU) <= get_rating(re, SU) + @test isa(get_max_reactive_power(re, SU), Float64) -# 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 Shiftable Power Loads and Interruptible PowerLoads" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# buses = collect(get_components(ACBus, sys)) -# add_component!( -# sys, -# InterruptiblePowerLoad( -# "IloadBus", -# true, -# buses[1], -# 0.10, -# 0.0, -# 0.10, -# 0.0, -# 100.0, -# LoadCost(CostCurve(LinearCurve(150.0)), 2400.0), -# ), -# ) -# add_component!( -# sys, -# ShiftablePowerLoad( -# "ShiftableLoadBus4", -# true, -# buses[2], -# 0.10, -# (min = 0.03, max = 0.10), -# 0.0, -# 0.10, -# 0.0, -# 100.0, -# 24, -# LoadCost(CostCurve(LinearCurve(150.0)), 2400.0), -# ), -# ) -# dir_path = mktempdir() -# to_json(sys, joinpath(dir_path, "test_RTS_GMLC_sys.json")) -# sys2 = System(joinpath(dir_path, "test_RTS_GMLC_sys.json")) -# @test get_active_power(get_component(ShiftablePowerLoad, sys2, "ShiftableLoadBus4")) == -# 0.10 -# @test get_active_power(get_component(InterruptiblePowerLoad, sys2, "IloadBus")) == 0.10 -# @test get_active_power_limits( -# get_component(ShiftablePowerLoad, sys2, "ShiftableLoadBus4"), -# ).min == 0.03 -# @test get_active_power_limits( -# get_component(ShiftablePowerLoad, sys2, "ShiftableLoadBus4"), -# ).max == 0.10 -# end + @test_throws MethodError get_max_active_power(TestDevice("foo"), SU) + @test_throws ArgumentError get_max_active_power(TestInjector("foo"), SU) + @test_throws ArgumentError get_max_active_power(TestRenDevice("foo"), SU) +end + +@testset "Test Remove Area with Interchanges" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + area1 = get_component(Area, sys, "1") + area2 = get_component(Area, sys, "2") + area3 = get_component(Area, sys, "3") + area_interchange12 = AreaInterchange(; + name = "interchange_a1_a2", + available = true, + active_power_flow = 0.0, + from_area = area1, + to_area = area2, + flow_limits = (from_to = 100.0, to_from = 100.0), + ) + area_interchange13 = AreaInterchange(; + name = "interchange_a1_a3", + available = true, + active_power_flow = 0.0, + from_area = area1, + to_area = area3, + flow_limits = (from_to = 100.0, to_from = 100.0), + ) + add_component!(sys, area_interchange12) + add_component!(sys, area_interchange13) + @test_throws ArgumentError remove_component!(sys, area1) + remove_component!(sys, area_interchange12) + remove_component!(sys, area_interchange13) + remove_component!(sys, area1) + @test get_component(Area, sys, "1") === nothing +end + +@testset "Test Shiftable Power Loads and Interruptible PowerLoads" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + buses = collect(get_components(ACBus, sys)) + add_component!( + sys, + InterruptiblePowerLoad( + "IloadBus", + true, + buses[1], + 0.10, + 0.0, + 0.10, + 0.0, + 100.0, + LoadCost(CostCurve(LinearCurve(150.0)), 2400.0), + ), + ) + add_component!( + sys, + ShiftablePowerLoad( + "ShiftableLoadBus4", + true, + buses[2], + 0.10, + (min = 0.03, max = 0.10), + 0.0, + 0.10, + 0.0, + 100.0, + 24, + LoadCost(CostCurve(LinearCurve(150.0)), 2400.0), + ), + ) + dir_path = mktempdir() + to_json(sys, joinpath(dir_path, "test_RTS_GMLC_sys.json")) + sys2 = System(joinpath(dir_path, "test_RTS_GMLC_sys.json")) + @test get_active_power( + get_component(ShiftablePowerLoad, sys2, "ShiftableLoadBus4"), DU) == 0.10 + @test get_active_power( + get_component(InterruptiblePowerLoad, sys2, "IloadBus"), DU) == 0.10 + @test get_active_power_limits( + get_component(ShiftablePowerLoad, sys2, "ShiftableLoadBus4"), DU, + ).min == 0.03 + @test get_active_power_limits( + get_component(ShiftablePowerLoad, sys2, "ShiftableLoadBus4"), DU, + ).max == 0.10 +end + +@testset "Test static injection traits" begin + # supports_active_power + @test supports_active_power(ThermalStandard(nothing)) == true + @test supports_active_power(ThermalMultiStart(nothing)) == true + @test supports_active_power(RenewableDispatch(nothing)) == true + @test supports_active_power(RenewableNonDispatch(nothing)) == true + @test supports_active_power(HydroDispatch(nothing)) == true + @test supports_active_power(HydroTurbine(nothing)) == true + @test supports_active_power(HydroPumpTurbine(nothing)) == true + @test supports_active_power(Source(nothing)) == true + @test supports_active_power(InterconnectingConverter(nothing)) == true + @test supports_active_power(EnergyReservoirStorage(nothing)) == true + @test supports_active_power(PowerLoad(nothing)) == true + @test supports_active_power(StandardLoad(nothing)) == true + @test supports_active_power(ExponentialLoad(nothing)) == true + @test supports_active_power(InterruptiblePowerLoad(nothing)) == true + @test supports_active_power(ShiftablePowerLoad(nothing)) == true + @test supports_active_power(HybridSystem(nothing)) == true + @test supports_active_power(SynchronousCondenser(nothing)) == false + @test supports_active_power(FixedAdmittance(nothing)) == false # Y = 0 + @test supports_active_power( + FixedAdmittance(; name = "fa_g", available = true, bus = ACBus(nothing), + Y = 1.0 + 0.0im), + ) == true + @test supports_active_power( + FixedAdmittance(; name = "fa_b", available = true, bus = ACBus(nothing), + Y = 0.0 + 1.0im), + ) == false + # Below ZERO_ADMITTANCE_THRESHOLD (1e-4): treated as no support. + @test supports_active_power( + FixedAdmittance(; name = "fa_tiny", available = true, bus = ACBus(nothing), + Y = 1e-6 + 1e-6im), + ) == false + @test supports_active_power(SwitchedAdmittance(nothing)) == false # Y = 0, no blocks + @test supports_active_power( + SwitchedAdmittance(; name = "sa_g", available = true, bus = ACBus(nothing), + Y = 1.0 + 0.0im), + ) == true + # Zero base Y, but a switchable block adds real (active) admittance. + @test supports_active_power( + SwitchedAdmittance(; name = "sa_gstep", available = true, bus = ACBus(nothing), + Y = 0.0 + 0.0im, number_of_steps = [2], Y_increase = [1.0 + 0.0im]), + ) == true + @test supports_active_power( + SwitchedAdmittance(; name = "sa_bstep", available = true, bus = ACBus(nothing), + Y = 0.0 + 0.0im, number_of_steps = [2], Y_increase = [0.0 + 1.0im]), + ) == false + + # FACTSControlDevice active power depends on control_mode (true only for NML) + @test supports_active_power(FACTSControlDevice(nothing)) == false + facts_nml = FACTSControlDevice(nothing) + set_control_mode!(facts_nml, FACTSOperationModes.NML) + @test supports_active_power(facts_nml) == true + facts_byp = FACTSControlDevice(nothing) + set_control_mode!(facts_byp, FACTSOperationModes.BYP) + @test supports_active_power(facts_byp) == false + facts_oos = FACTSControlDevice(nothing) + set_control_mode!(facts_oos, FACTSOperationModes.OOS) + @test supports_active_power(facts_oos) == false + + # supports_reactive_power + @test supports_reactive_power(ThermalStandard(nothing)) == true + @test supports_reactive_power(RenewableDispatch(nothing)) == true + @test supports_reactive_power(Source(nothing)) == true + @test supports_reactive_power(SynchronousCondenser(nothing)) == true + @test supports_reactive_power(PowerLoad(nothing)) == true + @test supports_reactive_power(EnergyReservoirStorage(nothing)) == true + @test supports_reactive_power(HybridSystem(nothing)) == true + @test supports_reactive_power(InterconnectingConverter(nothing)) == false + @test supports_reactive_power(FixedAdmittance(nothing)) == false # Y = 0 + @test supports_reactive_power( + FixedAdmittance(; name = "fa_b2", available = true, bus = ACBus(nothing), + Y = 0.0 + 1.0im), + ) == true + @test supports_reactive_power( + FixedAdmittance(; name = "fa_g2", available = true, bus = ACBus(nothing), + Y = 1.0 + 0.0im), + ) == false + @test supports_reactive_power( + FixedAdmittance(; name = "fa_tiny2", available = true, bus = ACBus(nothing), + Y = 1e-6 + 1e-6im), + ) == false + @test supports_reactive_power(SwitchedAdmittance(nothing)) == false # Y = 0, no blocks + @test supports_reactive_power( + SwitchedAdmittance(; name = "sa_b", available = true, bus = ACBus(nothing), + Y = 0.0 + 1.0im), + ) == true + # Zero base Y, but a switchable block adds susceptance (reactive). + @test supports_reactive_power( + SwitchedAdmittance(; name = "sa_bstep2", available = true, bus = ACBus(nothing), + Y = 0.0 + 0.0im, number_of_steps = [2], Y_increase = [0.0 + 1.0im]), + ) == true + # A block with steps but a below-threshold increment does not count. + @test supports_reactive_power( + SwitchedAdmittance(; name = "sa_tinystep", available = true, bus = ACBus(nothing), + Y = 0.0 + 0.0im, number_of_steps = [2], Y_increase = [0.0 + 1e-6im]), + ) == false + + # FACTSControlDevice reactive power depends on control_mode + @test supports_reactive_power(FACTSControlDevice(nothing)) == false + facts_nml = FACTSControlDevice(nothing) + set_control_mode!(facts_nml, FACTSOperationModes.NML) + @test supports_reactive_power(facts_nml) == true + facts_byp = FACTSControlDevice(nothing) + set_control_mode!(facts_byp, FACTSOperationModes.BYP) + @test supports_reactive_power(facts_byp) == true + facts_oos = FACTSControlDevice(nothing) + set_control_mode!(facts_oos, FACTSOperationModes.OOS) + @test supports_reactive_power(facts_oos) == false + + # supports_voltage_control + @test supports_voltage_control(ThermalStandard(nothing)) == true + @test supports_voltage_control(ThermalMultiStart(nothing)) == true + @test supports_voltage_control(RenewableDispatch(nothing)) == true + @test supports_voltage_control(RenewableNonDispatch(nothing)) == true + @test supports_voltage_control(HydroDispatch(nothing)) == true + @test supports_voltage_control(Source(nothing)) == true + @test supports_voltage_control(EnergyReservoirStorage(nothing)) == true + @test supports_voltage_control(HybridSystem(nothing)) == true + @test supports_voltage_control(PowerLoad(nothing)) == false + @test supports_voltage_control(StandardLoad(nothing)) == false + @test supports_voltage_control(ExponentialLoad(nothing)) == false + @test supports_voltage_control(InterruptiblePowerLoad(nothing)) == false + @test supports_voltage_control(ShiftablePowerLoad(nothing)) == false + @test supports_voltage_control(InterconnectingConverter(nothing)) == false + @test supports_voltage_control(FixedAdmittance(nothing)) == false + @test supports_voltage_control(SwitchedAdmittance(nothing)) == false + + # FACTSControlDevice voltage control depends on control_mode + @test supports_voltage_control(FACTSControlDevice(nothing)) == false + @test supports_voltage_control(facts_nml) == true + @test supports_voltage_control(facts_byp) == true + @test supports_voltage_control(facts_oos) == false + + # SynchronousCondenser voltage control depends on bus type + sc_pv = SynchronousCondenser(nothing) + sc_pv.bus = ACBus(; + number = 1, name = "pv_bus", available = true, bustype = ACBusTypes.PV, + angle = 0.0, magnitude = 1.0, voltage_limits = (min = 0.9, max = 1.1), + base_voltage = 230.0, + ) + @test supports_voltage_control(sc_pv) == true + sc_ref = SynchronousCondenser(nothing) + sc_ref.bus = ACBus(; + number = 2, name = "ref_bus", available = true, bustype = ACBusTypes.REF, + angle = 0.0, magnitude = 1.0, voltage_limits = (min = 0.9, max = 1.1), + base_voltage = 230.0, + ) + @test supports_voltage_control(sc_ref) == true + sc_pq = SynchronousCondenser(nothing) + sc_pq.bus = ACBus(; + number = 2, name = "pq_bus", available = true, bustype = ACBusTypes.PQ, + angle = 0.0, magnitude = 1.0, voltage_limits = (min = 0.9, max = 1.1), + base_voltage = 230.0, + ) + @test supports_voltage_control(sc_pq) == false +end diff --git a/test/test_hybrid_system.jl b/test/test_hybrid_system.jl index a29d963a77..d1c339de4e 100644 --- a/test/test_hybrid_system.jl +++ b/test/test_hybrid_system.jl @@ -29,128 +29,124 @@ @test isa(ts, Deterministic) end -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (PSB.build_system uses PSY.PowerSystemTableData internally for test_RTS_GMLC_sys_with_hybrid). -# @testset "Hybrid System from parsed files" begin -# sys = PSB.build_system( -# PSB.PSITestSystems, -# "test_RTS_GMLC_sys_with_hybrid"; -# add_forecasts = true, -# force_build = true, -# ) -# hybrids = collect(get_components(HybridSystem, sys)) -# @test length(hybrids) == 1 -# h_sys = hybrids[1] -# -# electric_load = nothing -# thermal_unit = nothing -# subcomponents = collect(get_subcomponents(h_sys)) -# @test length(subcomponents) == 4 -# expected_time_series_names = Set{String}() -# num_time_series = 0 -# for subcomponent in subcomponents -# @test !PSY.is_attached(subcomponent, sys) -# @test IS.is_attached(subcomponent, sys.data.masked_components) -# if subcomponent isa PowerLoad -# electric_load = subcomponent -# elseif subcomponent isa ThermalStandard -# thermal_unit = subcomponent -# end -# for ts in get_time_series_multiple(subcomponent) -# push!( -# expected_time_series_names, -# PSY.make_subsystem_time_series_name(subcomponent, ts), -# ) -# num_time_series += 1 -# end -# end -# @test electric_load !== nothing -# @test thermal_unit !== nothing -# -# sts = collect(get_time_series_multiple(h_sys; type = SingleTimeSeries)) -# forecasts = -# collect(get_time_series_multiple(h_sys; type = DeterministicSingleTimeSeries)) -# @test length(sts) == 2 -# @test length(forecasts) == 2 -# @test issubset((get_name(x) for x in sts), expected_time_series_names) -# @test issubset((get_name(x) for x in forecasts), expected_time_series_names) -# -# @test get_time_series(SingleTimeSeries, electric_load, "max_active_power") isa -# SingleTimeSeries -# @test get_time_series(Deterministic, electric_load, "max_active_power") isa -# DeterministicSingleTimeSeries -# -# @test !has_time_series(thermal_unit) -# @test has_time_series(electric_load) -# remove_time_series!( -# sys, -# DeterministicSingleTimeSeries, -# electric_load, -# "max_active_power", -# ) -# @test !has_time_series(electric_load, DeterministicSingleTimeSeries, "max_active_power") -# -# # Can't set the units when the HybridSystem is attached to system. -# @test_throws ArgumentError PSY.set_thermal_unit!(h_sys, thermal_unit) -# 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 "Hybrid System from unattached subcomponents" begin -# sys = PSB.build_system(PSB.PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) -# thermal_unit = first(get_components(ThermalStandard, sys)) -# bus = get_bus(thermal_unit) -# electric_load = first(get_components(PowerLoad, sys)) -# storage = first(get_components(EnergyReservoirStorage, sys)) -# renewable_unit = first(get_components(RenewableDispatch, sys)) -# -# for subcomponent in (thermal_unit, electric_load, storage, renewable_unit) -# remove_component!(sys, subcomponent) -# end -# -# name = "Test H" -# h_sys = HybridSystem(; -# name = name, -# available = true, -# status = true, -# bus = bus, -# active_power = 1.0, -# reactive_power = 1.0, -# thermal_unit = thermal_unit, -# electric_load = electric_load, -# storage = storage, -# renewable_unit = renewable_unit, -# base_power = 100.0, -# operation_cost = MarketBidCost(nothing), -# ) -# add_component!(sys, h_sys) -# -# for subcomponent in (thermal_unit, electric_load, storage, renewable_unit) -# @test !PSY.is_attached(subcomponent, sys) -# @test !has_time_series(subcomponent) -# @test IS.is_attached(subcomponent, sys.data.masked_components) -# end -# -# @test length(IS.get_masked_components(Component, sys.data)) == 4 -# -# # Add time series for a subcomponent. -# initial_time = Dates.DateTime("2020-09-01") -# resolution = Dates.Hour(1) -# other_time = initial_time + resolution -# name = "test" -# horizon = 24 -# data = Dict(initial_time => rand(horizon), other_time => 5.0 * ones(horizon)) -# -# forecast = Deterministic(name, data, resolution) -# add_time_series!(sys, thermal_unit, forecast) -# @test get_time_series(Deterministic, thermal_unit, name) isa Deterministic -# copy_subcomponent_time_series!(h_sys, thermal_unit) -# @test get_time_series( -# Deterministic, -# h_sys, -# PSY.make_subsystem_time_series_name(thermal_unit, forecast), -# ) isa Deterministic -# end +@testset "Hybrid System from parsed files" begin + sys = PSB.build_system( + PSB.PSITestSystems, + "test_RTS_GMLC_sys_with_hybrid"; + add_forecasts = true, + force_build = true, + ) + hybrids = collect(get_components(HybridSystem, sys)) + @test length(hybrids) == 1 + h_sys = hybrids[1] + + electric_load = nothing + thermal_unit = nothing + subcomponents = collect(get_subcomponents(h_sys)) + @test length(subcomponents) == 4 + expected_time_series_names = Set{String}() + num_time_series = 0 + for subcomponent in subcomponents + @test !PSY.is_attached(subcomponent, sys) + @test IS.is_attached(subcomponent, sys.data.masked_components) + if subcomponent isa PowerLoad + electric_load = subcomponent + elseif subcomponent isa ThermalStandard + thermal_unit = subcomponent + end + for ts in get_time_series_multiple(subcomponent) + push!( + expected_time_series_names, + PSY.make_subsystem_time_series_name(subcomponent, ts), + ) + num_time_series += 1 + end + end + @test electric_load !== nothing + @test thermal_unit !== nothing + + sts = collect(get_time_series_multiple(h_sys; type = SingleTimeSeries)) + forecasts = + collect(get_time_series_multiple(h_sys; type = DeterministicSingleTimeSeries)) + @test length(sts) == 2 + @test length(forecasts) == 2 + @test issubset((get_name(x) for x in sts), expected_time_series_names) + @test issubset((get_name(x) for x in forecasts), expected_time_series_names) + + @test get_time_series(SingleTimeSeries, electric_load, "max_active_power") isa + SingleTimeSeries + @test get_time_series(Deterministic, electric_load, "max_active_power") isa + DeterministicSingleTimeSeries + + @test !has_time_series(thermal_unit) + @test has_time_series(electric_load) + remove_time_series!( + sys, + DeterministicSingleTimeSeries, + electric_load, + "max_active_power", + ) + @test !has_time_series(electric_load, DeterministicSingleTimeSeries, "max_active_power") + + # Can't set the units when the HybridSystem is attached to system. + @test_throws ArgumentError PSY.set_thermal_unit!(h_sys, thermal_unit) +end + +@testset "Hybrid System from unattached subcomponents" begin + sys = PSB.build_system(PSB.PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) + thermal_unit = first(get_components(ThermalStandard, sys)) + bus = get_bus(thermal_unit) + electric_load = first(get_components(PowerLoad, sys)) + storage = first(get_components(EnergyReservoirStorage, sys)) + renewable_unit = first(get_components(RenewableDispatch, sys)) + + for subcomponent in (thermal_unit, electric_load, storage, renewable_unit) + remove_component!(sys, subcomponent) + end + + name = "Test H" + h_sys = HybridSystem(; + name = name, + available = true, + status = true, + bus = bus, + active_power = 1.0, + reactive_power = 1.0, + thermal_unit = thermal_unit, + electric_load = electric_load, + storage = storage, + renewable_unit = renewable_unit, + base_power = 100.0, + operation_cost = MarketBidCost(nothing), + ) + add_component!(sys, h_sys) + + for subcomponent in (thermal_unit, electric_load, storage, renewable_unit) + @test !PSY.is_attached(subcomponent, sys) + @test !has_time_series(subcomponent) + @test IS.is_attached(subcomponent, sys.data.masked_components) + end + + @test length(IS.get_masked_components(Component, sys.data)) == 4 + + # Add time series for a subcomponent. + initial_time = Dates.DateTime("2020-09-01") + resolution = Dates.Hour(1) + other_time = initial_time + resolution + name = "test" + horizon = 24 + data = Dict(initial_time => rand(horizon), other_time => 5.0 * ones(horizon)) + + forecast = Deterministic(name, data, resolution) + add_time_series!(sys, thermal_unit, forecast) + @test get_time_series(Deterministic, thermal_unit, name) isa Deterministic + copy_subcomponent_time_series!(h_sys, thermal_unit) + @test get_time_series( + Deterministic, + h_sys, + PSY.make_subsystem_time_series_name(thermal_unit, forecast), + ) isa Deterministic +end @testset "get_fuel_cost for HybridSystem delegates to thermal subunit" begin # Hybrid with thermal: get_fuel_cost delegates to thermal subunit diff --git a/test/test_internal.jl b/test/test_internal.jl index a760b2784e..4701dd84aa 100644 --- a/test/test_internal.jl +++ b/test/test_internal.jl @@ -43,9 +43,7 @@ function validate_uuids(obj::T) where {T <: AbstractDict} return result 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 internal values" begin -# sys_rts = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# @test validate_uuids(sys_rts) -# end +@testset "Test internal values" begin + sys_rts = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + @test validate_uuids(sys_rts) +end diff --git a/test/test_printing.jl b/test/test_printing.jl index 898a91a301..dfd6eb7ab8 100644 --- a/test/test_printing.jl +++ b/test/test_printing.jl @@ -68,52 +68,50 @@ function are_type_and_fields_in_output(obj::T) where {T <: Component} return match 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 printing of system and components" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# @test are_type_and_fields_in_output(iterate(get_components(ACBus, sys))[1]) -# @test are_type_and_fields_in_output(iterate(get_components(Generator, sys))[1]) -# @test are_type_and_fields_in_output(iterate(get_components(ThermalGen, sys))[1]) -# @test are_type_and_fields_in_output(iterate(get_components(Branch, sys))[1]) -# @test are_type_and_fields_in_output(iterate(get_components(ElectricLoad, sys))[1]) -# -# io = IOBuffer() -# component = first(get_components(ThermalGen, sys)) -# show(io, "text/plain", component) -# text = String(take!(io)) -# expected_sa = string(has_supplemental_attributes(component)) -# expected_ts = string(has_time_series(component)) -# @test occursin("has_supplemental_attributes: $expected_sa", text) -# @test occursin("has_time_series: $expected_ts", text) -# -# # Just make sure nothing blows up. -# for component in iterate_components(sys) -# print(devnull, component) -# print(devnull, MIME"text/plain") -# @test !isempty(summary(component)) -# end -# for time_series in get_time_series_multiple(sys) -# show(devnull, time_series) -# show(devnull, MIME"text/plain") -# @test !isempty(summary(time_series)) -# end -# -# @test !isempty(summary(sys)) -# -# @test isnothing(show(IOBuffer(), "text/plain", sys)) -# @test isnothing(show(IOBuffer(), "text/html", sys)) -# @test isnothing(show_components(IOBuffer(), sys, RenewableNonDispatch)) -# @test isnothing(show_components(IOBuffer(), sys, RenewableNonDispatch, [:rating])) -# @test isnothing( -# show_components( -# IOBuffer(), -# sys, -# RenewableNonDispatch, -# Dict("ts" => x -> has_time_series(x)), -# ), -# ) -# end +@testset "Test printing of system and components" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + @test are_type_and_fields_in_output(iterate(get_components(ACBus, sys))[1]) + @test are_type_and_fields_in_output(iterate(get_components(Generator, sys))[1]) + @test are_type_and_fields_in_output(iterate(get_components(ThermalGen, sys))[1]) + @test are_type_and_fields_in_output(iterate(get_components(Branch, sys))[1]) + @test are_type_and_fields_in_output(iterate(get_components(ElectricLoad, sys))[1]) + + io = IOBuffer() + component = first(get_components(ThermalGen, sys)) + show(io, "text/plain", component) + text = String(take!(io)) + expected_sa = string(has_supplemental_attributes(component)) + expected_ts = string(has_time_series(component)) + @test occursin("has_supplemental_attributes: $expected_sa", text) + @test occursin("has_time_series: $expected_ts", text) + + # Just make sure nothing blows up. + for component in iterate_components(sys) + print(devnull, component) + print(devnull, MIME"text/plain") + @test !isempty(summary(component)) + end + for time_series in get_time_series_multiple(sys) + show(devnull, time_series) + show(devnull, MIME"text/plain") + @test !isempty(summary(time_series)) + end + + @test !isempty(summary(sys)) + + @test isnothing(show(IOBuffer(), "text/plain", sys)) + @test isnothing(show(IOBuffer(), "text/html", sys)) + @test isnothing(show_components(IOBuffer(), sys, RenewableNonDispatch)) + @test isnothing(show_components(IOBuffer(), sys, RenewableNonDispatch, [:rating])) + @test isnothing( + show_components( + IOBuffer(), + sys, + RenewableNonDispatch, + Dict("ts" => x -> has_time_series(x)), + ), + ) +end @testset "Test show units: attached vs detached component" begin # device_base=250, system_base=100, active_power=0.5 (stored in DU) gives @@ -187,3 +185,17 @@ end @test isnothing(show(IOBuffer(), component)) @test isnothing(show(IOBuffer(), "text/plain", component)) end + +@testset "REPL display of detached components never errors" begin + line = Line(nothing) + @test repr(MIME"text/plain"(), line) isa String + @test repr(MIME"text/plain"(), [line]) isa String + res = ConstantReserve{ReserveUp}(nothing) + @test repr(MIME"text/plain"(), res) isa String +end + +@testset "display_units_arg resolves for parametric struct types" begin + @test IS.display_units_arg(get_requirement, ConstantReserve{ReserveUp}) === IS.SU + @test IS.display_units_arg(get_requirement_unitful, ConstantReserve{ReserveUp}) === + IS.SU +end diff --git a/test/test_read_time_series.jl b/test/test_read_time_series.jl index c2ffa0545c..5d8b64b768 100644 --- a/test/test_read_time_series.jl +++ b/test/test_read_time_series.jl @@ -33,130 +33,124 @@ end end end -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (PSB.build_system uses PSY.PowerModelsData internally for matpower_RTS_GMLC_sys). -# @testset "Test time_series normalization" begin -# component_name = "122_HYDRO_1" -# timeseries_file = joinpath( -# RTS_GMLC_DIR, -# "RTS_GMLC_forecasts", -# "gen", -# "Hydro", -# "DAY_AHEAD_hydro.csv", -# ) -# gen = ThermalStandard(nothing) -# gen.name = component_name -# resolution = Dates.Hour(1) -# -# # Parse the file directly in order to compare values. -# ts_base = SingleTimeSeries(component_name, timeseries_file, gen, resolution) -# timeseries = get_data(ts_base) -# max_value = maximum(TimeSeries.values(timeseries)) -# -# file_metadata = IS.TimeSeriesFileMetadata(; -# simulation = "DAY_AHEAD", -# category = "Generator", -# component_name = "122_HYDRO_1", -# name = "active_power", -# normalization_factor = 1.0, -# data_file = timeseries_file, -# percentiles = [], -# resolution = resolution, -# time_series_type_module = "InfrastructureSystems", -# time_series_type = "SingleTimeSeries", -# ) -# -# # Test code path where no normalization occurs. -# sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_RTS_GMLC_sys") -# add_time_series!(sys, [file_metadata]) -# verify_time_series(sys, 1, 1, 24) -# time_series = collect(get_time_series_multiple(sys))[1] -# @test TimeSeries.values(time_series.data) == TimeSeries.values(timeseries) -# -# # Test code path where timeseries is normalized by dividing by the max value. -# file_metadata.normalization_factor = "Max" -# sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_RTS_GMLC_sys") -# add_time_series!(sys, [file_metadata]) -# verify_time_series(sys, 1, 1, 24) -# time_series = collect(get_time_series_multiple(sys))[1] -# @test TimeSeries.values(time_series.data) == TimeSeries.values(timeseries ./ max_value) -# -# # Test code path where timeseries is normalized by dividing by a custom value. -# nf = 95.0 -# file_metadata.normalization_factor = nf -# sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_RTS_GMLC_sys") -# add_time_series!(sys, [file_metadata]) -# verify_time_series(sys, 1, 1, 24) -# time_series = collect(get_time_series_multiple(sys))[1] -# @test TimeSeries.values(time_series.data) == TimeSeries.values(timeseries ./ nf) -# end - -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (PSB.build_system uses PSY.PowerModelsData internally for matpower_RTS_GMLC_sys). -# @testset "Test single time_series addition" begin -# component_name = "122_HYDRO_1" -# name = "active_power" -# timeseries_file = joinpath( -# RTS_GMLC_DIR, -# "RTS_GMLC_forecasts", -# "gen", -# "Hydro", -# "DAY_AHEAD_hydro.csv", -# ) -# resolution = Dates.Hour(1) -# -# # Test with a filename. -# sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_RTS_GMLC_sys") -# component = get_component(HydroDispatch, sys, component_name) -# ts = SingleTimeSeries( -# name, -# timeseries_file, -# component, -# resolution; -# normalization_factor = 1.0, -# ) -# ta = get_data(ts) -# add_time_series!(sys, component, ts) -# verify_time_series(sys, 1, 1, 24) -# time_series = collect(get_time_series_multiple(sys))[1] -# @test TimeSeries.timestamp(get_data(time_series)) == TimeSeries.timestamp(ta) -# @test TimeSeries.values(get_data(time_series)) == TimeSeries.values(ta) -# -# # Test with TimeSeries.TimeArray. -# sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_RTS_GMLC_sys") -# component = get_component(HydroDispatch, sys, component_name) -# ts = SingleTimeSeries(name, ta; normalization_factor = 1.0) -# add_time_series!(sys, component, ts) -# verify_time_series(sys, 1, 1, 24) -# time_series = collect(get_time_series_multiple(sys))[1] -# @test TimeSeries.values(get_data(time_series)) == TimeSeries.values(ta) -# -# # Test with DataFrames.DataFrame. -# sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_RTS_GMLC_sys") -# component = get_component(HydroDispatch, sys, component_name) -# df = DataFrames.DataFrame(ta) -# ts = SingleTimeSeries(name, df; normalization_factor = 1.0) -# add_time_series!(sys, component, ts) -# verify_time_series(sys, 1, 1, 24) -# time_series = collect(get_time_series_multiple(sys))[1] -# end - -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (PSB.build_system uses PSY.PowerModelsData internally for matpower_case5_re_sys). -# @testset "TimeSeriesData data matpower" begin -# sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_case5_re_sys") -# file_metadata = joinpath(DATA_DIR, "5-Bus", "5bus_ts", "timeseries_pointers_da.json") -# add_time_series!(sys, file_metadata) -# @test verify_time_series(sys, 1, 5, 24) -# -# # Add the same files. -# # This will fail because the component-name pairs will be duplicated. -# @test_throws ArgumentError add_time_series!(sys, file_metadata) -# -# file_metadata = joinpath(DATA_DIR, "5-Bus", "5bus_ts", "timeseries_pointers_rt.json") -# -# # sys = System(PowerFlowFileParser.PowerModelsData(joinpath(MATPOWER_DIR, "case5_re.m"))) -# sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_case5_re_sys") -# add_time_series!(sys, file_metadata) -# @test verify_time_series(sys, 1, 5, 288) -# end +@testset "Test time_series normalization" begin + component_name = "122_HYDRO_1" + timeseries_file = joinpath( + RTS_GMLC_DIR, + "RTS_GMLC_forecasts", + "gen", + "Hydro", + "DAY_AHEAD_hydro.csv", + ) + gen = ThermalStandard(nothing) + gen.name = component_name + resolution = Dates.Hour(1) + + # Parse the file directly in order to compare values. + ts_base = SingleTimeSeries(component_name, timeseries_file, gen, resolution) + timeseries = get_data(ts_base) + max_value = maximum(TimeSeries.values(timeseries)) + + file_metadata = IS.TimeSeriesFileMetadata(; + simulation = "DAY_AHEAD", + category = "Generator", + component_name = "122_HYDRO_1", + name = "active_power", + normalization_factor = 1.0, + data_file = timeseries_file, + percentiles = [], + resolution = resolution, + time_series_type_module = "InfrastructureSystems", + time_series_type = "SingleTimeSeries", + ) + + # Test code path where no normalization occurs. + sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_RTS_GMLC_sys") + add_time_series!(sys, [file_metadata]) + verify_time_series(sys, 1, 1, 24) + time_series = collect(get_time_series_multiple(sys))[1] + @test TimeSeries.values(time_series.data) == TimeSeries.values(timeseries) + + # Test code path where timeseries is normalized by dividing by the max value. + file_metadata.normalization_factor = "Max" + sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_RTS_GMLC_sys") + add_time_series!(sys, [file_metadata]) + verify_time_series(sys, 1, 1, 24) + time_series = collect(get_time_series_multiple(sys))[1] + @test TimeSeries.values(time_series.data) == TimeSeries.values(timeseries ./ max_value) + + # Test code path where timeseries is normalized by dividing by a custom value. + nf = 95.0 + file_metadata.normalization_factor = nf + sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_RTS_GMLC_sys") + add_time_series!(sys, [file_metadata]) + verify_time_series(sys, 1, 1, 24) + time_series = collect(get_time_series_multiple(sys))[1] + @test TimeSeries.values(time_series.data) == TimeSeries.values(timeseries ./ nf) +end + +@testset "Test single time_series addition" begin + component_name = "122_HYDRO_1" + name = "active_power" + timeseries_file = joinpath( + RTS_GMLC_DIR, + "RTS_GMLC_forecasts", + "gen", + "Hydro", + "DAY_AHEAD_hydro.csv", + ) + resolution = Dates.Hour(1) + + # Test with a filename. + sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_RTS_GMLC_sys") + component = get_component(HydroDispatch, sys, component_name) + ts = SingleTimeSeries( + name, + timeseries_file, + component, + resolution; + normalization_factor = 1.0, + ) + ta = get_data(ts) + add_time_series!(sys, component, ts) + verify_time_series(sys, 1, 1, 24) + time_series = collect(get_time_series_multiple(sys))[1] + @test TimeSeries.timestamp(get_data(time_series)) == TimeSeries.timestamp(ta) + @test TimeSeries.values(get_data(time_series)) == TimeSeries.values(ta) + + # Test with TimeSeries.TimeArray. + sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_RTS_GMLC_sys") + component = get_component(HydroDispatch, sys, component_name) + ts = SingleTimeSeries(name, ta; normalization_factor = 1.0) + add_time_series!(sys, component, ts) + verify_time_series(sys, 1, 1, 24) + time_series = collect(get_time_series_multiple(sys))[1] + @test TimeSeries.values(get_data(time_series)) == TimeSeries.values(ta) + + # Test with DataFrames.DataFrame. + sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_RTS_GMLC_sys") + component = get_component(HydroDispatch, sys, component_name) + df = DataFrames.DataFrame(ta) + ts = SingleTimeSeries(name, df; normalization_factor = 1.0) + add_time_series!(sys, component, ts) + verify_time_series(sys, 1, 1, 24) + time_series = collect(get_time_series_multiple(sys))[1] +end + +@testset "TimeSeriesData data matpower" begin + sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_case5_re_sys") + file_metadata = joinpath(DATA_DIR, "5-Bus", "5bus_ts", "timeseries_pointers_da.json") + add_time_series!(sys, file_metadata) + @test verify_time_series(sys, 1, 5, 24) + + # Add the same files. + # This will fail because the component-name pairs will be duplicated. + @test_throws ArgumentError add_time_series!(sys, file_metadata) + + file_metadata = joinpath(DATA_DIR, "5-Bus", "5bus_ts", "timeseries_pointers_rt.json") + + # sys = System(PowerFlowFileParser.PowerModelsData(joinpath(MATPOWER_DIR, "case5_re.m"))) + sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_case5_re_sys") + add_time_series!(sys, file_metadata) + @test verify_time_series(sys, 1, 5, 288) +end diff --git a/test/test_serialization.jl b/test/test_serialization.jl index 77641d5d9d..1816437fae 100644 --- a/test/test_serialization.jl +++ b/test/test_serialization.jl @@ -1,33 +1,29 @@ -# 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 JSON serialization of RTS data with immutable time series" begin -# sys = -# PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; time_series_read_only = true) -# sys2, result = validate_serialization(sys; time_series_read_only = true) -# @test result -# @test_throws ArgumentError clear_time_series!(sys2) -# # Full error checking is done in IS. -# end +@testset "Test JSON serialization of RTS data with immutable time series" begin + sys = + PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; time_series_read_only = true) + sys2, result = validate_serialization(sys; time_series_read_only = true) + @test result + @test_throws ArgumentError clear_time_series!(sys2) + # Full error checking is done in IS. +end -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (PSB.build_system uses PSY.PowerModelsData internally for matpower_case5_re_sys). -# @testset "Test JSON serialization of matpower data" begin -# sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_case5_re_sys") -# -# # Add a Probabilistic time_series to get coverage serializing it. -# bus = ACBus(nothing) -# bus.name = "Bus1234" -# add_component!(sys, bus) -# tg = RenewableNonDispatch(nothing) -# tg.bus = bus -# add_component!(sys, tg) -# # TODO 1.0 -# #ts = PSY.Probabilistic("scalingfactor", Hour(1), DateTime("01-01-01"), [0.5, 0.5], 24) -# #add_time_series!(sys, tg, ts) -# -# _, result = validate_serialization(sys) -# @test result -# end +@testset "Test JSON serialization of matpower data" begin + sys = PSB.build_system(PSB.MatpowerTestSystems, "matpower_case5_re_sys") + + # Add a Probabilistic time_series to get coverage serializing it. + bus = ACBus(nothing) + bus.name = "Bus1234" + add_component!(sys, bus) + tg = RenewableNonDispatch(nothing) + tg.bus = bus + add_component!(sys, tg) + # TODO 1.0 + #ts = PSY.Probabilistic("scalingfactor", Hour(1), DateTime("01-01-01"), [0.5, 0.5], 24) + #add_time_series!(sys, tg, ts) + + _, result = validate_serialization(sys) + @test result +end @testset "Test JSON serialization of dynamic inverter" begin sys = PSB.build_system(PSB.PSYTestSystems, "dynamic_inverter_sys") @@ -64,14 +60,12 @@ end @test result 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 deepcopy of a system" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# sys2 = deepcopy(sys) -# clear_time_series!(sys2) -# @test !isempty(collect(get_time_series_multiple(sys))) -# end +@testset "Test deepcopy of a system" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + sys2 = deepcopy(sys) + clear_time_series!(sys2) + @test !isempty(collect(get_time_series_multiple(sys))) +end @testset "Test JSON serialization of MarketBidCost" begin sys = System(100.0) @@ -160,40 +154,36 @@ end @test result end -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (PSB.build_system uses PSY.PowerSystemTableData internally for test_RTS_GMLC_sys_with_hybrid). -# @testset "Test JSON serialization of HybridSystem" begin -# sys = PSB.build_system( -# PSB.PSITestSystems, -# "test_RTS_GMLC_sys_with_hybrid"; -# add_forecasts = true, -# force_build = true, -# ) -# h_sys = first(get_components(HybridSystem, sys)) -# subcomponents = collect(get_subcomponents(h_sys)) -# @test length(subcomponents) == 4 -# sys2, result = validate_serialization(sys) -# @test result -# subcomponent = subcomponents[1] -# @test IS.get_masked_component( -# typeof(subcomponent), -# sys2.data, -# get_name(subcomponent), -# ) !== nothing -# end +@testset "Test JSON serialization of HybridSystem" begin + sys = PSB.build_system( + PSB.PSITestSystems, + "test_RTS_GMLC_sys_with_hybrid"; + add_forecasts = true, + force_build = true, + ) + h_sys = first(get_components(HybridSystem, sys)) + subcomponents = collect(get_subcomponents(h_sys)) + @test length(subcomponents) == 4 + sys2, result = validate_serialization(sys) + @test result + subcomponent = subcomponents[1] + @test IS.get_masked_component( + typeof(subcomponent), + sys2.data, + get_name(subcomponent), + ) !== nothing +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 deserialization with new UUIDs" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# sys2, result = validate_serialization(sys; assign_new_uuids = true) -# @test result -# @test IS.get_uuid(sys) != IS.get_uuid(sys2) -# for component1 in get_components(Component, sys) -# component2 = get_component(typeof(component1), sys2, get_name(component1)) -# @test IS.get_uuid(component1) != IS.get_uuid(component2) -# end -# end +@testset "Test deserialization with new UUIDs" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + sys2, result = validate_serialization(sys; assign_new_uuids = true) + @test result + @test IS.get_uuid(sys) != IS.get_uuid(sys2) + for component1 in get_components(Component, sys) + component2 = get_component(typeof(component1), sys2, get_name(component1)) + @test IS.get_uuid(component1) != IS.get_uuid(component2) + end +end @testset "Test serialization of supplemental attributes" begin sys = create_system_with_outages() @@ -201,30 +191,28 @@ end @test result 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 verification of invalid ext fields" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) -# gen = first(get_components(ThermalStandard, sys)) -# ext = get_ext(gen) -# -# struct MyType -# func::Function -# end -# val = MyType(println) -# ext["val"] = val -# -# tmpdir = mktempdir() -# filename = joinpath(tmpdir, "invalid_sys.json") -# @test_logs( -# (:error, r"only basic types are allowed"), -# match_mode = :any, -# @test_throws( -# ErrorException, -# to_json(sys, filename, force = true), -# ), -# ) -# end +@testset "Test verification of invalid ext fields" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) + gen = first(get_components(ThermalStandard, sys)) + ext = get_ext(gen) + + struct MyType + func::Function + end + val = MyType(println) + ext["val"] = val + + tmpdir = mktempdir() + filename = joinpath(tmpdir, "invalid_sys.json") + @test_logs( + (:error, r"only basic types are allowed"), + match_mode = :any, + @test_throws( + ErrorException, + to_json(sys, filename, force = true), + ), + ) +end @testset "Test serialization of System fields" begin frequency = 50.0 @@ -249,28 +237,24 @@ end @test sys2.metadata.description == description end -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (create_system_with_subsystems builds test_RTS_GMLC_sys via PSY.PowerSystemTableData). -# @testset "Test serialization of subsystems" begin -# sys = create_system_with_subsystems() -# sys2, result = validate_serialization(sys) -# @test result -# @test sort!(collect(get_subsystems(sys))) == ["subsystem_1"] -# end +@testset "Test serialization of subsystems" begin + sys = create_system_with_subsystems() + sys2, result = validate_serialization(sys) + @test result + @test sort!(collect(get_subsystems(sys))) == ["subsystem_1"] +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 serialization to JSON string" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# set_name!(sys, "test_RTS_GMLC_sys") -# set_description!(sys, "test description") -# @test !isempty(collect(IS.iterate_components_with_time_series(sys.data))) -# text = to_json(sys) -# sys2 = from_json(text, System) -# exclude = Set([:time_series_manager]) -# @test PSY.compare_values(sys2, sys, exclude = exclude) -# @test isempty(collect(IS.iterate_components_with_time_series(sys2.data))) -# end +@testset "Test serialization to JSON string" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + set_name!(sys, "test_RTS_GMLC_sys") + set_description!(sys, "test description") + @test !isempty(collect(IS.iterate_components_with_time_series(sys.data))) + text = to_json(sys) + sys2 = from_json(text, System) + exclude = Set([:time_series_manager]) + @test PSY.compare_values(sys2, sys, exclude = exclude) + @test isempty(collect(IS.iterate_components_with_time_series(sys2.data))) +end @testset "Test serialization of component with shared time series" begin for use_scaling_factor in (true, false) diff --git a/test/test_services.jl b/test/test_services.jl index f8aa397ad5..dcd99b37b5 100644 --- a/test/test_services.jl +++ b/test/test_services.jl @@ -380,83 +380,79 @@ end 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 Service Removal" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# res_up = PSY.get_component(PSY.VariableReserve{PSY.ReserveUp}, sys, "Flex_Up") -# res_dn = PSY.get_component(PSY.VariableReserve{PSY.ReserveDown}, sys, "Flex_Down") -# PSY.remove_component!(sys, res_dn) -# PSY.remove_component!(sys, res_up) -# @test isnothing(PSY.get_component(PSY.VariableReserve{PSY.ReserveUp}, sys, "Flex_Up")) -# @test isnothing( -# PSY.get_component(PSY.VariableReserve{PSY.ReserveDown}, sys, "Flex_Down"), -# ) -# 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 TransmissionInterface" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# lines = get_components(Line, sys) -# xfr = get_components(TapTransformer, sys) -# hvdc = collect(get_components(TwoTerminalGenericHVDCLine, sys)) -# some_lines = collect(lines)[1:2] -# other_lines_and_hvdc = vcat(collect(lines)[10:14], hvdc) -# lines_and_transformers = [some_lines; collect(xfr)[1:2]] -# -# interface1 = TransmissionInterface("foo1", true, (min = -10.0, max = 10.0)) -# interface2 = TransmissionInterface("foo2", true, (min = -10.0, max = 10.0)) -# interface3 = TransmissionInterface("foo3", true, (min = -10.0, max = 10.0)) -# add_service!(sys, interface1, some_lines) -# add_service!(sys, interface2, other_lines_and_hvdc) -# add_service!(sys, interface3, lines_and_transformers) -# for br in get_contributing_devices(sys, interface1) -# @test br ∈ some_lines -# end -# for br in get_contributing_devices(sys, interface2) -# @test br ∈ other_lines_and_hvdc -# end -# for br in get_contributing_devices(sys, interface3) -# @test br ∈ lines_and_transformers -# end -# tmp_path = joinpath(mktempdir(), "sys_with_interfaces.json") -# to_json(sys, tmp_path) -# sys = System(tmp_path) -# @test length(get_components(TransmissionInterface, sys)) == 3 -# -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# area1 = get_component(Area, sys, "1") -# area2 = get_component(Area, sys, "2") -# area3 = get_component(Area, sys, "3") -# area_interchange12 = AreaInterchange(; -# name = "interchange_a1_a2", -# available = true, -# active_power_flow = 0.0, -# from_area = area1, -# to_area = area2, -# flow_limits = (from_to = 100.0, to_from = 100.0), -# ) -# area_interchange13 = AreaInterchange(; -# name = "interchange_a1_a3", -# available = true, -# active_power_flow = 0.0, -# from_area = area1, -# to_area = area3, -# flow_limits = (from_to = 100.0, to_from = 100.0), -# ) -# line = first(get_components(Line, sys)) -# add_component!(sys, area_interchange12) -# add_component!(sys, area_interchange13) -# area_level_interface = TransmissionInterface("foo3", true, (min = -10.0, max = 10.0)) -# area_level_mixed = TransmissionInterface("foo4", true, (min = -10.0, max = 10.0)) -# add_service!(sys, area_level_interface, [area_interchange12, area_interchange13]) -# @test_throws ArgumentError add_service!( -# sys, -# area_level_mixed, -# [area_interchange12, area_interchange13, line], -# ) -# end +@testset "Test Service Removal" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + res_up = PSY.get_component(PSY.VariableReserve{PSY.ReserveUp}, sys, "Flex_Up") + res_dn = PSY.get_component(PSY.VariableReserve{PSY.ReserveDown}, sys, "Flex_Down") + PSY.remove_component!(sys, res_dn) + PSY.remove_component!(sys, res_up) + @test isnothing(PSY.get_component(PSY.VariableReserve{PSY.ReserveUp}, sys, "Flex_Up")) + @test isnothing( + PSY.get_component(PSY.VariableReserve{PSY.ReserveDown}, sys, "Flex_Down"), + ) +end + +@testset "Test TransmissionInterface" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + lines = get_components(Line, sys) + xfr = get_components(TapTransformer, sys) + hvdc = collect(get_components(TwoTerminalGenericHVDCLine, sys)) + some_lines = collect(lines)[1:2] + other_lines_and_hvdc = vcat(collect(lines)[10:14], hvdc) + lines_and_transformers = [some_lines; collect(xfr)[1:2]] + + interface1 = TransmissionInterface("foo1", true, (min = -10.0, max = 10.0)) + interface2 = TransmissionInterface("foo2", true, (min = -10.0, max = 10.0)) + interface3 = TransmissionInterface("foo3", true, (min = -10.0, max = 10.0)) + add_service!(sys, interface1, some_lines) + add_service!(sys, interface2, other_lines_and_hvdc) + add_service!(sys, interface3, lines_and_transformers) + for br in get_contributing_devices(sys, interface1) + @test br ∈ some_lines + end + for br in get_contributing_devices(sys, interface2) + @test br ∈ other_lines_and_hvdc + end + for br in get_contributing_devices(sys, interface3) + @test br ∈ lines_and_transformers + end + tmp_path = joinpath(mktempdir(), "sys_with_interfaces.json") + to_json(sys, tmp_path) + sys = System(tmp_path) + @test length(get_components(TransmissionInterface, sys)) == 3 + + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + area1 = get_component(Area, sys, "1") + area2 = get_component(Area, sys, "2") + area3 = get_component(Area, sys, "3") + area_interchange12 = AreaInterchange(; + name = "interchange_a1_a2", + available = true, + active_power_flow = 0.0, + from_area = area1, + to_area = area2, + flow_limits = (from_to = 100.0, to_from = 100.0), + ) + area_interchange13 = AreaInterchange(; + name = "interchange_a1_a3", + available = true, + active_power_flow = 0.0, + from_area = area1, + to_area = area3, + flow_limits = (from_to = 100.0, to_from = 100.0), + ) + line = first(get_components(Line, sys)) + add_component!(sys, area_interchange12) + add_component!(sys, area_interchange13) + area_level_interface = TransmissionInterface("foo3", true, (min = -10.0, max = 10.0)) + area_level_mixed = TransmissionInterface("foo4", true, (min = -10.0, max = 10.0)) + add_service!(sys, area_level_interface, [area_interchange12, area_interchange13]) + @test_throws ArgumentError add_service!( + sys, + area_level_mixed, + [area_interchange12, area_interchange13, line], + ) +end @testset "Test AGC" begin sys = PSB.build_system(PSITestSystems, "c_sys5_uc"; add_reserves = true) diff --git a/test/test_subsystems.jl b/test/test_subsystems.jl index bc74bb0d8f..09babbcf4e 100644 --- a/test/test_subsystems.jl +++ b/test/test_subsystems.jl @@ -179,94 +179,84 @@ end @test_throws "cannot exceed the number of buses" add_subsystem!(sys, "subsystem") end -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (create_system_with_subsystems builds test_RTS_GMLC_sys via PSY.PowerSystemTableData). -# @testset "Test valid subsystem" begin -# sys = create_system_with_subsystems() -# check_components(sys) -# end +@testset "Test valid subsystem" begin + sys = create_system_with_subsystems() + check_components(sys) +end @testset "Test inconsistent component-subsystem membership" begin sys, components = create_system_with_test_subsystems() @test_throws IS.InvalidValue check_components(sys) end -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (create_system_with_subsystems builds test_RTS_GMLC_sys via PSY.PowerSystemTableData). -# @testset "Test mismatch component-topological membership" begin -# sys = create_system_with_subsystems() -# add_subsystem!(sys, "incomplete_subsystem") -# gen = first(get_components(ThermalStandard, sys)) -# bus = get_bus(gen) -# remove_component_from_subsystem!(sys, "subsystem_1", bus) -# add_component_to_subsystem!(sys, "incomplete_subsystem", bus) -# @test_throws IS.InvalidValue PSY._check_topological_consistency(sys, gen) -# end - -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (create_system_with_subsystems builds test_RTS_GMLC_sys via PSY.PowerSystemTableData). -# @testset "Test mismatch branch-arc membership" begin -# sys = create_system_with_subsystems() -# add_subsystem!(sys, "incomplete_subsystem") -# branch = first(get_components(Branch, sys)) -# arc = get_arc(branch) -# remove_component_from_subsystem!(sys, "subsystem_1", arc) -# add_component_to_subsystem!(sys, "incomplete_subsystem", arc) -# @test_throws IS.InvalidValue PSY._check_branch_consistency(sys, branch) -# end - -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (create_system_with_subsystems builds test_RTS_GMLC_sys via PSY.PowerSystemTableData). -# @testset "Test service-contributing-device consistency" begin -# sys = create_system_with_subsystems() -# add_subsystem!(sys, "incomplete_subsystem") -# device = nothing -# service = nothing -# for dev in get_components(Device, sys) -# if !PSY.supports_services(dev) -# continue -# end -# services = get_services(dev) -# if !isempty(services) -# device = dev -# service = first(services) -# break -# end -# end -# @test !isnothing(device) && !isnothing(service) -# -# remove_component_from_subsystem!(sys, "subsystem_1", device) -# add_subsystem!(sys, "subsystem_2") -# add_component_to_subsystem!(sys, "subsystem_2", device) -# -# @test_throws IS.InvalidValue PSY._check_device_service_consistency(sys, device) -# end - -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (PSB.build_system uses PSY.PowerSystemTableData internally for test_RTS_GMLC_sys_with_hybrid). -# @testset "Test subsystems with HybridSystem" begin -# sys = PSB.build_system(PSB.PSITestSystems, "test_RTS_GMLC_sys_with_hybrid") -# h_sys = first(get_components(HybridSystem, sys)) -# subcomponents = collect(get_subcomponents(h_sys)) -# -# subsystem_name = "subsystem_1" -# add_subsystem!(sys, subsystem_name) -# add_component_to_subsystem!(sys, subsystem_name, h_sys) -# # Ensure that subcomponents get added automatically. -# for subcomponent in subcomponents -# @test is_assigned_to_subsystem(sys, subcomponent, subsystem_name) -# end -# -# remove_component_from_subsystem!(sys, subsystem_name, subcomponents[1]) -# @test_throws IS.InvalidValue PSY._check_subcomponent_consistency(sys, h_sys) -# -# add_component_to_subsystem!(sys, subsystem_name, subcomponents[1]) -# remove_component_from_subsystem!(sys, subsystem_name, h_sys) -# # Ensure that subcomponents get removed automatically. -# for subcomponent in subcomponents -# @test !is_assigned_to_subsystem(sys, subcomponent, subsystem_name) -# end -# end +@testset "Test mismatch component-topological membership" begin + sys = create_system_with_subsystems() + add_subsystem!(sys, "incomplete_subsystem") + gen = first(get_components(ThermalStandard, sys)) + bus = get_bus(gen) + remove_component_from_subsystem!(sys, "subsystem_1", bus) + add_component_to_subsystem!(sys, "incomplete_subsystem", bus) + @test_throws IS.InvalidValue PSY._check_topological_consistency(sys, gen) +end + +@testset "Test mismatch branch-arc membership" begin + sys = create_system_with_subsystems() + add_subsystem!(sys, "incomplete_subsystem") + branch = first(get_components(Branch, sys)) + arc = get_arc(branch) + remove_component_from_subsystem!(sys, "subsystem_1", arc) + add_component_to_subsystem!(sys, "incomplete_subsystem", arc) + @test_throws IS.InvalidValue PSY._check_branch_consistency(sys, branch) +end + +@testset "Test service-contributing-device consistency" begin + sys = create_system_with_subsystems() + add_subsystem!(sys, "incomplete_subsystem") + device = nothing + service = nothing + for dev in get_components(Device, sys) + if !PSY.supports_services(dev) + continue + end + services = get_services(dev) + if !isempty(services) + device = dev + service = first(services) + break + end + end + @test !isnothing(device) && !isnothing(service) + + remove_component_from_subsystem!(sys, "subsystem_1", device) + add_subsystem!(sys, "subsystem_2") + add_component_to_subsystem!(sys, "subsystem_2", device) + + @test_throws IS.InvalidValue PSY._check_device_service_consistency(sys, device) +end + +@testset "Test subsystems with HybridSystem" begin + sys = PSB.build_system(PSB.PSITestSystems, "test_RTS_GMLC_sys_with_hybrid") + h_sys = first(get_components(HybridSystem, sys)) + subcomponents = collect(get_subcomponents(h_sys)) + + subsystem_name = "subsystem_1" + add_subsystem!(sys, subsystem_name) + add_component_to_subsystem!(sys, subsystem_name, h_sys) + # Ensure that subcomponents get added automatically. + for subcomponent in subcomponents + @test is_assigned_to_subsystem(sys, subcomponent, subsystem_name) + end + + remove_component_from_subsystem!(sys, subsystem_name, subcomponents[1]) + @test_throws IS.InvalidValue PSY._check_subcomponent_consistency(sys, h_sys) + + add_component_to_subsystem!(sys, subsystem_name, subcomponents[1]) + remove_component_from_subsystem!(sys, subsystem_name, h_sys) + # Ensure that subcomponents get removed automatically. + for subcomponent in subcomponents + @test !is_assigned_to_subsystem(sys, subcomponent, subsystem_name) + end +end @testset "Test get subsystems and components for c_sys5" begin bus_c = ACBus( diff --git a/test/test_system.jl b/test/test_system.jl index f0f6d497f6..1abdf5ff66 100644 --- a/test/test_system.jl +++ b/test/test_system.jl @@ -1,202 +1,192 @@ -# 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 functionality of System" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) -# summary(devnull, sys) -# @test get_frequency(sys) == PSY.DEFAULT_SYSTEM_FREQUENCY -# -# generators = collect(get_components(ThermalStandard, sys)) -# generator = get_component(ThermalStandard, sys, get_name(generators[1])) -# @test IS.get_uuid(generator) == IS.get_uuid(generators[1]) -# @test_throws(IS.ArgumentError, add_component!(sys, generator)) -# @test get_available_component(ThermalStandard, sys, get_name(generators[1])) === -# generator -# set_available!(generator, false) -# @test isnothing(get_available_component(ThermalStandard, sys, get_name(generators[1]))) -# set_available!(generator, true) -# -# generators2 = get_components_by_name(ThermalGen, sys, get_name(generators[1])) -# @test length(generators2) == 1 -# @test IS.get_uuid(generators2[1]) == IS.get_uuid(generators[1]) -# @test !has_time_series(generators2[1]) -# -# @test isnothing(get_component(ThermalStandard, sys, "not-a-name")) -# @test isempty(get_components_by_name(ThermalGen, sys, "not-a-name")) -# @test_throws( -# IS.ArgumentError, -# get_components_by_name(ThermalStandard, sys, "not-a-name") -# ) -# @test isempty(get_components(x -> (!get_available(x)), ThermalStandard, sys)) -# @test !isempty(get_available_components(ThermalStandard, sys)) -# @test !isempty(get_available_components(x -> true, ThermalStandard, sys)) -# # Test get_bus* functionality. -# bus_numbers = Vector{Int}() -# for bus in get_components(ACBus, sys) -# push!(bus_numbers, bus.number) -# if length(bus_numbers) >= 2 -# break -# end -# end -# -# bus = PowerSystems.get_bus(sys, bus_numbers[1]) -# @test bus.number == bus_numbers[1] -# -# buses = PowerSystems.get_buses(sys, Set(bus_numbers)) -# sort!(bus_numbers) -# sort!(buses; by = x -> x.number) -# @test length(bus_numbers) == length(buses) -# for (bus_number, bus) in zip(bus_numbers, buses) -# @test bus_number == bus.number -# end -# -# @test get_forecast_initial_times(sys) == [] -# @test get_time_series_resolutions(sys)[1] == Dates.Hour(1) -# -# # Get time_series with a name and without. -# components = collect(get_components(HydroTurbine, sys)) -# @test !isempty(components) -# component = components[1] -# ts = get_time_series(SingleTimeSeries, component, "max_active_power") -# @test ts isa SingleTimeSeries -# -# components = collect(get_components(HydroReservoir, sys)) -# @test !isempty(components) -# -# returned_it, returned_len = check_time_series_consistency(sys, SingleTimeSeries) -# @test returned_it == first(TimeSeries.timestamp(get_data(ts))) -# @test returned_len == length(get_data(ts)) -# -# # Test all versions of get_time_series_[array|timestamps|values] -# values1 = get_time_series_array(component, ts) -# values2 = get_time_series_array(SingleTimeSeries, component, "max_active_power") -# @test values1 == values2 -# values3 = get_time_series_array(SingleTimeSeries, component, "max_active_power") -# @test values1 == values3 -# -# val = get_time_series_array(SingleTimeSeries, component, "max_active_power") -# @test val isa TimeSeries.TimeArray -# val = get_time_series_timestamps(SingleTimeSeries, component, "max_active_power") -# @test val isa Array -# @test val[1] isa Dates.DateTime -# val = get_time_series_values(SingleTimeSeries, component, "max_active_power") -# @test val isa Array -# @test val[1] isa AbstractFloat -# -# val = get_time_series_array(component, ts) -# @test val isa TimeSeries.TimeArray -# val = get_time_series_timestamps(component, ts) -# @test val isa Array -# @test val[1] isa Dates.DateTime -# val = get_time_series_values(component, ts) -# @test val isa Array -# @test val[1] isa AbstractFloat -# -# clear_time_series!(sys) -# @test length(collect(get_time_series_multiple(sys))) == 0 -# @test IS.get_internal(sys) isa IS.InfrastructureSystemsInternal -# 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 get_componets filter_func" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) -# gen = first(get_components(ThermalStandard, sys)) -# name = get_name(gen) -# generators = get_components(ThermalStandard, sys) do gen -# get_name(gen) == name && get_available(gen) -# end -# -# @test length(generators) == 1 && get_name(first(generators)) == name -# 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 handling of bus_numbers" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# -# @test length(sys.bus_numbers) > 0 -# buses = get_components(ACBus, sys) -# bus_numbers = sort!([get_number(bus) for bus in buses]) -# @test bus_numbers == get_bus_numbers(sys) -# -# # Remove some components -# remove_components!(x -> get_number(x) ∈ [101, 201], sys, ACBus) -# @test length(sys.bus_numbers) == length(bus_numbers) - 2 -# -# # Remove entire type -# remove_components!(sys, ACBus) -# @test length(sys.bus_numbers) == 0 -# -# # Remove individually. -# for bus in buses -# add_component!(sys, bus) -# end -# @test length(sys.bus_numbers) > 0 -# for bus in buses -# remove_component!(sys, bus) -# end -# @test length(sys.bus_numbers) == 0 -# -# # Remove by name. -# for bus in buses -# add_component!(sys, bus) -# end -# @test length(sys.bus_numbers) > 0 -# for bus in buses -# remove_component!(ACBus, sys, get_name(bus)) -# end -# @test length(sys.bus_numbers) == 0 -# 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 iterators" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# -# i = 0 -# for component in iterate_components(sys) -# i += 1 -# end -# -# components = get_components(Component, sys) -# @test i == length(components) -# -# # Test debugging functions. -# component = first(components) -# uuid = IS.get_uuid(component) -# @test get_name(get_component(sys, uuid)) == get_name(component) -# @test get_name(get_component(sys, string(uuid))) == get_name(component) -# 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 remove_component" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# generators = get_components(ThermalStandard, sys) -# initial_length = length(generators) -# @assert initial_length > 0 -# gen = collect(generators)[1] -# -# remove_component!(sys, gen) -# -# @test isnothing(get_component(typeof(gen), sys, get_name(gen))) -# generators = get_components(typeof(gen), sys) -# @test length(generators) == initial_length - 1 -# -# @test_throws(IS.ArgumentError, remove_component!(sys, gen)) -# -# add_component!(sys, gen) -# remove_component!(typeof(gen), sys, get_name(gen)) -# @test isnothing(get_component(typeof(gen), sys, get_name(gen))) -# -# @assert length(get_components(typeof(gen), sys)) > 0 -# remove_components!(sys, typeof(gen)) -# @test_throws(IS.ArgumentError, remove_components!(sys, typeof(gen))) -# -# remove_components!(sys, Area) -# @test isempty(get_components(Area, sys)) -# @test isnothing(get_area(collect(get_components(ACBus, sys))[1])) -# end +@testset "Test functionality of System" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) + summary(devnull, sys) + @test get_frequency(sys) == PSY.DEFAULT_SYSTEM_FREQUENCY + + generators = collect(get_components(ThermalStandard, sys)) + generator = get_component(ThermalStandard, sys, get_name(generators[1])) + @test IS.get_uuid(generator) == IS.get_uuid(generators[1]) + @test_throws(IS.ArgumentError, add_component!(sys, generator)) + @test get_available_component(ThermalStandard, sys, get_name(generators[1])) === + generator + set_available!(generator, false) + @test isnothing(get_available_component(ThermalStandard, sys, get_name(generators[1]))) + set_available!(generator, true) + + generators2 = get_components_by_name(ThermalGen, sys, get_name(generators[1])) + @test length(generators2) == 1 + @test IS.get_uuid(generators2[1]) == IS.get_uuid(generators[1]) + @test !has_time_series(generators2[1]) + + @test isnothing(get_component(ThermalStandard, sys, "not-a-name")) + @test isempty(get_components_by_name(ThermalGen, sys, "not-a-name")) + @test_throws( + IS.ArgumentError, + get_components_by_name(ThermalStandard, sys, "not-a-name") + ) + @test isempty(get_components(x -> (!get_available(x)), ThermalStandard, sys)) + @test !isempty(get_available_components(ThermalStandard, sys)) + @test !isempty(get_available_components(x -> true, ThermalStandard, sys)) + # Test get_bus* functionality. + bus_numbers = Vector{Int}() + for bus in get_components(ACBus, sys) + push!(bus_numbers, bus.number) + if length(bus_numbers) >= 2 + break + end + end + + bus = PowerSystems.get_bus(sys, bus_numbers[1]) + @test bus.number == bus_numbers[1] + + buses = PowerSystems.get_buses(sys, Set(bus_numbers)) + sort!(bus_numbers) + sort!(buses; by = x -> x.number) + @test length(bus_numbers) == length(buses) + for (bus_number, bus) in zip(bus_numbers, buses) + @test bus_number == bus.number + end + + @test get_forecast_initial_times(sys) == [] + @test get_time_series_resolutions(sys)[1] == Dates.Hour(1) + + # Get time_series with a name and without. + components = collect(get_components(HydroTurbine, sys)) + @test !isempty(components) + component = components[1] + ts = get_time_series(SingleTimeSeries, component, "max_active_power") + @test ts isa SingleTimeSeries + + components = collect(get_components(HydroReservoir, sys)) + @test !isempty(components) + + returned_it, returned_len = check_time_series_consistency(sys, SingleTimeSeries) + @test returned_it == first(TimeSeries.timestamp(get_data(ts))) + @test returned_len == length(get_data(ts)) + + # Test all versions of get_time_series_[array|timestamps|values] + values1 = get_time_series_array(component, ts) + values2 = get_time_series_array(SingleTimeSeries, component, "max_active_power") + @test values1 == values2 + values3 = get_time_series_array(SingleTimeSeries, component, "max_active_power") + @test values1 == values3 + + val = get_time_series_array(SingleTimeSeries, component, "max_active_power") + @test val isa TimeSeries.TimeArray + val = get_time_series_timestamps(SingleTimeSeries, component, "max_active_power") + @test val isa Array + @test val[1] isa Dates.DateTime + val = get_time_series_values(SingleTimeSeries, component, "max_active_power") + @test val isa Array + @test val[1] isa AbstractFloat + + val = get_time_series_array(component, ts) + @test val isa TimeSeries.TimeArray + val = get_time_series_timestamps(component, ts) + @test val isa Array + @test val[1] isa Dates.DateTime + val = get_time_series_values(component, ts) + @test val isa Array + @test val[1] isa AbstractFloat + + clear_time_series!(sys) + @test length(collect(get_time_series_multiple(sys))) == 0 + @test IS.get_internal(sys) isa IS.InfrastructureSystemsInternal +end + +@testset "Test get_componets filter_func" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) + gen = first(get_components(ThermalStandard, sys)) + name = get_name(gen) + generators = get_components(ThermalStandard, sys) do gen + get_name(gen) == name && get_available(gen) + end + + @test length(generators) == 1 && get_name(first(generators)) == name +end + +@testset "Test handling of bus_numbers" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + + @test length(sys.bus_numbers) > 0 + buses = get_components(ACBus, sys) + bus_numbers = sort!([get_number(bus) for bus in buses]) + @test bus_numbers == get_bus_numbers(sys) + + # Remove some components + remove_components!(x -> get_number(x) ∈ [101, 201], sys, ACBus) + @test length(sys.bus_numbers) == length(bus_numbers) - 2 + + # Remove entire type + remove_components!(sys, ACBus) + @test length(sys.bus_numbers) == 0 + + # Remove individually. + for bus in buses + add_component!(sys, bus) + end + @test length(sys.bus_numbers) > 0 + for bus in buses + remove_component!(sys, bus) + end + @test length(sys.bus_numbers) == 0 + + # Remove by name. + for bus in buses + add_component!(sys, bus) + end + @test length(sys.bus_numbers) > 0 + for bus in buses + remove_component!(ACBus, sys, get_name(bus)) + end + @test length(sys.bus_numbers) == 0 +end + +@testset "Test System iterators" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + + i = 0 + for component in iterate_components(sys) + i += 1 + end + + components = get_components(Component, sys) + @test i == length(components) + + # Test debugging functions. + component = first(components) + uuid = IS.get_uuid(component) + @test get_name(get_component(sys, uuid)) == get_name(component) + @test get_name(get_component(sys, string(uuid))) == get_name(component) +end + +@testset "Test remove_component" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + generators = get_components(ThermalStandard, sys) + initial_length = length(generators) + @assert initial_length > 0 + gen = collect(generators)[1] + + remove_component!(sys, gen) + + @test isnothing(get_component(typeof(gen), sys, get_name(gen))) + generators = get_components(typeof(gen), sys) + @test length(generators) == initial_length - 1 + + @test_throws(IS.ArgumentError, remove_component!(sys, gen)) + + add_component!(sys, gen) + remove_component!(typeof(gen), sys, get_name(gen)) + @test isnothing(get_component(typeof(gen), sys, get_name(gen))) + + @assert length(get_components(typeof(gen), sys)) > 0 + remove_components!(sys, typeof(gen)) + @test_throws(IS.ArgumentError, remove_components!(sys, typeof(gen))) + + remove_components!(sys, Area) + @test isempty(get_components(Area, sys)) + @test isnothing(get_area(collect(get_components(ACBus, sys))[1])) +end @testset "Test missing Arc bus" begin sys = System(100.0) @@ -576,73 +566,69 @@ end @test counts.forecast_count == 0 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 deepcopy with time series options" begin -# sys = PSB.build_system( -# PSITestSystems, -# "test_RTS_GMLC_sys"; -# time_series_in_memory = true, -# force_build = true, -# ) -# @test sys.data.time_series_manager.data_store isa IS.InMemoryTimeSeriesStorage -# sys2 = deepcopy(sys) -# @test sys2.data.time_series_manager.data_store isa IS.InMemoryTimeSeriesStorage -# @test IS.compare_values(sys, sys2) -# # Ensure that the storage references got updated correctly. -# for component in get_components(x -> has_time_series(x), Component, sys2) -# @test component.internal.shared_system_references.time_series_manager === -# sys2.data.time_series_manager -# end -# -# sys = PSB.build_system( -# PSITestSystems, -# "test_RTS_GMLC_sys"; -# time_series_in_memory = false, -# force_build = true, -# ) -# @test sys.data.time_series_manager.data_store isa IS.Hdf5TimeSeriesStorage -# sys2 = deepcopy(sys) -# @test sys2.data.time_series_manager.data_store isa IS.Hdf5TimeSeriesStorage -# @test sys.data.time_series_manager.data_store.file_path != -# sys2.data.time_series_manager.data_store.file_path -# @test IS.compare_values(sys, sys2) -# for component in get_components(x -> has_time_series(x), Component, sys2) -# @test component.internal.shared_system_references.time_series_manager === -# sys2.data.time_series_manager -# 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 fast deepcopy of system" begin -# systems = Dict( -# in_memory => PSB.build_system( -# PSITestSystems, -# "test_RTS_GMLC_sys"; -# time_series_in_memory = in_memory, -# force_build = true, -# ) for in_memory in (true, false) -# ) -# @testset for (in_memory, skip_ts, skip_sa) in # Iterate over all permutations -# Iterators.product(repeat([(true, false)], 3)...) -# sys = systems[in_memory] -# -# sys2 = IS.fast_deepcopy_system(sys; -# skip_time_series = skip_ts, skip_supplemental_attributes = skip_sa) -# @test IS.compare_values( -# sys, -# sys2; -# exclude = Set( -# [:time_series_manager, :supplemental_attribute_manager][[skip_ts, skip_sa]], -# ), -# ) -# -# # We copy the SystemData separately from the other System fields, so the egal-ity of these references could get broken -# generator = get_component(ThermalStandard, sys2, "322_CT_6") -# @test sys2.units_settings === generator.internal.units_info -# end -# end +@testset "Test deepcopy with time series options" begin + sys = PSB.build_system( + PSITestSystems, + "test_RTS_GMLC_sys"; + time_series_in_memory = true, + force_build = true, + ) + @test sys.data.time_series_manager.data_store isa IS.InMemoryTimeSeriesStorage + sys2 = deepcopy(sys) + @test sys2.data.time_series_manager.data_store isa IS.InMemoryTimeSeriesStorage + @test IS.compare_values(sys, sys2) + # Ensure that the storage references got updated correctly. + for component in get_components(x -> has_time_series(x), Component, sys2) + @test component.internal.shared_system_references.time_series_manager === + sys2.data.time_series_manager + end + + sys = PSB.build_system( + PSITestSystems, + "test_RTS_GMLC_sys"; + time_series_in_memory = false, + force_build = true, + ) + @test sys.data.time_series_manager.data_store isa IS.Hdf5TimeSeriesStorage + sys2 = deepcopy(sys) + @test sys2.data.time_series_manager.data_store isa IS.Hdf5TimeSeriesStorage + @test sys.data.time_series_manager.data_store.file_path != + sys2.data.time_series_manager.data_store.file_path + @test IS.compare_values(sys, sys2) + for component in get_components(x -> has_time_series(x), Component, sys2) + @test component.internal.shared_system_references.time_series_manager === + sys2.data.time_series_manager + end +end + +@testset "Test fast deepcopy of system" begin + systems = Dict( + in_memory => PSB.build_system( + PSITestSystems, + "test_RTS_GMLC_sys"; + time_series_in_memory = in_memory, + force_build = true, + ) for in_memory in (true, false) + ) + @testset for (in_memory, skip_ts, skip_sa) in # Iterate over all permutations + Iterators.product(repeat([(true, false)], 3)...) + sys = systems[in_memory] + + sys2 = IS.fast_deepcopy_system(sys; + skip_time_series = skip_ts, skip_supplemental_attributes = skip_sa) + @test IS.compare_values( + sys, + sys2; + exclude = Set( + [:time_series_manager, :supplemental_attribute_manager][[skip_ts, skip_sa]], + ), + ) + + # We copy the SystemData separately from the other System fields, so the egal-ity of these references could get broken + generator = get_component(ThermalStandard, sys2, "322_CT_6") + @test sys2.units_settings === generator.internal.units_info + end +end @testset "Test with compression enabled" begin @test get_compression_settings(System(100.0)) == CompressionSettings(; enabled = false) @@ -653,82 +639,78 @@ end CompressionSettings(; enabled = true) 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 compare_values" begin -# sys1 = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# sys2 = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# gen1 = first(get_components(ThermalStandard, sys1)) -# gen2 = first(get_components(ThermalStandard, sys2)) -# @test IS.compare_values(gen1, gen2) -# @test IS.compare_values(sys1, sys2) -# -# set_active_power!(gen1, get_active_power(gen1) + 0.1) -# @test( -# @test_logs( -# (:error, r"not match"), -# match_mode = :any, -# !IS.compare_values(gen1, gen2), -# ) -# ) -# @test( -# @test_logs( -# (:error, r"not match"), -# match_mode = :any, -# !IS.compare_values(sys1, sys2) -# ) -# ) -# -# my_match_fn(a::Float64, b::Float64) = -# isapprox(a, b; atol = 0.2) || IS.isequivalent(a, b) -# my_match_fn(a, b) = IS.isequivalent(a, b) -# @test IS.compare_values(my_match_fn, gen1, gen2) -# @test IS.compare_values(my_match_fn, sys1, sys2) -# 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 check_components" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) -# check_components(sys) -# check_components(sys, Component) -# check_components(sys, Generator) -# check_components(sys, ThermalStandard) -# check_components(sys, get_components(ThermalStandard, sys)) -# components = get_components(ThermalStandard, sys) -# gen = first(components) -# check_components(sys, components) -# check_component(sys, gen) -# -# # Invalid Bus base_voltage values throw errors. -# # Invalid ThermalStandard active_power logs warning messages. -# -# bus = first(get_components(ACBus, sys)) -# check_component(sys, bus) -# orig = get_base_voltage(bus) -# set_base_voltage!(bus, -1.0) -# try -# @test_logs( -# (:error, "Invalid range"), -# match_mode = :any, -# @test_throws IS.InvalidValue check_component(sys, bus) -# ) -# finally -# set_base_voltage!(bus, orig) -# end -# -# gen.active_power = 100.0 -# @test_logs :warn, "Invalid range" match_mode = :any check_component(sys, gen) -# @test_logs :warn, "Invalid range" match_mode = :any check_components( -# sys, -# ThermalStandard, -# ) -# -# # @test !(@test_logs :warn, r"is larger than the max expected in the" match_mode = :any check_ac_transmission_rate_values( -# # sys, -# # )) -# @test check_ac_transmission_rate_values(sys) -# end +@testset "Test compare_values" begin + sys1 = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + sys2 = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + gen1 = first(get_components(ThermalStandard, sys1)) + gen2 = first(get_components(ThermalStandard, sys2)) + @test IS.compare_values(gen1, gen2) + @test IS.compare_values(sys1, sys2) + + set_active_power!(gen1, (get_active_power(gen1, SU) + 0.1) * SU) + @test( + @test_logs( + (:error, r"not match"), + match_mode = :any, + !IS.compare_values(gen1, gen2), + ) + ) + @test( + @test_logs( + (:error, r"not match"), + match_mode = :any, + !IS.compare_values(sys1, sys2) + ) + ) + + my_match_fn(a::Float64, b::Float64) = + isapprox(a, b; atol = 0.2) || IS.isequivalent(a, b) + my_match_fn(a, b) = IS.isequivalent(a, b) + @test IS.compare_values(my_match_fn, gen1, gen2) + @test IS.compare_values(my_match_fn, sys1, sys2) +end + +@testset "Test check_components" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) + check_components(sys) + check_components(sys, Component) + check_components(sys, Generator) + check_components(sys, ThermalStandard) + check_components(sys, get_components(ThermalStandard, sys)) + components = get_components(ThermalStandard, sys) + gen = first(components) + check_components(sys, components) + check_component(sys, gen) + + # Invalid Bus base_voltage values throw errors. + # Invalid ThermalStandard active_power logs warning messages. + + bus = first(get_components(ACBus, sys)) + check_component(sys, bus) + orig = get_base_voltage(bus) + set_base_voltage!(bus, -1.0) + try + @test_logs( + (:error, "Invalid range"), + match_mode = :any, + @test_throws IS.InvalidValue check_component(sys, bus) + ) + finally + set_base_voltage!(bus, orig) + end + + gen.active_power = 100.0 + @test_logs :warn, "Invalid range" match_mode = :any check_component(sys, gen) + @test_logs :warn, "Invalid range" match_mode = :any check_components( + sys, + ThermalStandard, + ) + + # @test !(@test_logs :warn, r"is larger than the max expected in the" match_mode = :any check_ac_transmission_rate_values( + # sys, + # )) + @test check_ac_transmission_rate_values(sys) +end @testset "Test system name and description" begin name = "test_system" @@ -744,98 +726,90 @@ end @test get_description(sys) == description 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 metadata" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# name = "test_system" -# description = "a system description" -# set_name!(sys, name) -# set_description!(sys, description) -# -# tempdir = mktempdir() -# sys_file = joinpath(tempdir, "sys.json") -# to_json(sys, sys_file; user_data = Dict("author" => "test")) -# -# sys2 = System(sys_file) -# @test get_name(sys2) == name -# @test get_description(sys2) == description -# -# metadata_file = joinpath(tempdir, "sys_metadata.json") -# metadata = open(metadata_file) do io -# JSON3.read(io, Dict) -# end -# -# @test metadata["name"] == name -# @test metadata["description"] == description -# found_component_thermal = false -# found_component_condenser = false -# for item in metadata["component_counts"] -# if item["type"] == "ThermalStandard" -# @test item["count"] == 73 -# found_component_thermal = true -# end -# if item["type"] == "SynchronousCondenser" -# @test item["count"] == 3 -# found_component_condenser = true -# end -# end -# @test found_component_thermal -# @test found_component_condenser -# @test metadata["time_series_counts"][1]["type"] == "DeterministicSingleTimeSeries" -# @test metadata["time_series_counts"][1]["count"] == 182 -# @test metadata["time_series_counts"][2]["type"] == "SingleTimeSeries" -# @test metadata["time_series_counts"][2]["count"] == 182 -# @test metadata["user_data"]["author"] == "test" -# 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 addition of service to the wrong system" begin -# sys1 = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# sys2 = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# service1 = first(get_components(VariableReserve{ReserveDown}, sys1)) -# device2 = first(get_components(ThermalStandard, sys2)) -# @test_throws ArgumentError add_service!(device2, service1, sys2) -# 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 has_components" begin -# sys1 = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# @test has_components(sys1, ThermalStandard) -# @test !has_components(sys1, TransmissionInterface) -# 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 set_bus_number!" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") -# buses = collect(get_components(ACBus, sys)) -# bus1 = buses[1] -# bus2 = buses[2] -# orig = get_number(bus1) -# new_number = 9999999 -# @test orig != new_number -# set_bus_number!(sys, bus1, new_number) -# @test get_number(bus1) == new_number -# bus_numbers = get_bus_numbers(sys) -# @test new_number in bus_numbers -# @test !(orig in bus_numbers) -# -# # Ensure that the no-op case works. -# set_bus_number!(sys, bus1, new_number) -# @test get_number(bus1) == new_number -# @test new_number in get_bus_numbers(sys) -# -# # Ensure that duplicate numbers are blocked. -# @test_throws ArgumentError set_bus_number!(sys, bus1, get_number(bus2)) -# -# # Ensure that you can't change an unattached bus. -# remove_component!(sys, bus1) -# @test_throws ArgumentError set_bus_number!(sys, bus1, new_number + 1) -# -# # Ensure that this is exported. This can be deleted in PSY5. -# set_number!(bus1, new_number + 2) -# @test get_number(bus1) == new_number + 2 -# end +@testset "Test system metadata" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + name = "test_system" + description = "a system description" + set_name!(sys, name) + set_description!(sys, description) + + tempdir = mktempdir() + sys_file = joinpath(tempdir, "sys.json") + to_json(sys, sys_file; user_data = Dict("author" => "test")) + + sys2 = System(sys_file) + @test get_name(sys2) == name + @test get_description(sys2) == description + + metadata_file = joinpath(tempdir, "sys_metadata.json") + metadata = open(metadata_file) do io + JSON.parse(io) + end + + @test metadata["name"] == name + @test metadata["description"] == description + found_component_thermal = false + found_component_condenser = false + for item in metadata["component_counts"] + if item["type"] == "ThermalStandard" + @test item["count"] == 73 + found_component_thermal = true + end + if item["type"] == "SynchronousCondenser" + @test item["count"] == 3 + found_component_condenser = true + end + end + @test found_component_thermal + @test found_component_condenser + @test metadata["time_series_counts"][1]["type"] == "DeterministicSingleTimeSeries" + @test metadata["time_series_counts"][1]["count"] == 182 + @test metadata["time_series_counts"][2]["type"] == "SingleTimeSeries" + @test metadata["time_series_counts"][2]["count"] == 182 + @test metadata["user_data"]["author"] == "test" +end + +@testset "Test addition of service to the wrong system" begin + sys1 = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + sys2 = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + service1 = first(get_components(VariableReserve{ReserveDown}, sys1)) + device2 = first(get_components(ThermalStandard, sys2)) + @test_throws ArgumentError add_service!(device2, service1, sys2) +end + +@testset "Test has_components" begin + sys1 = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + @test has_components(sys1, ThermalStandard) + @test !has_components(sys1, TransmissionInterface) +end + +@testset "Test set_bus_number!" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys") + buses = collect(get_components(ACBus, sys)) + bus1 = buses[1] + bus2 = buses[2] + orig = get_number(bus1) + new_number = 9999999 + @test orig != new_number + set_bus_number!(sys, bus1, new_number) + @test get_number(bus1) == new_number + bus_numbers = get_bus_numbers(sys) + @test new_number in bus_numbers + @test !(orig in bus_numbers) + + # Ensure that the no-op case works. + set_bus_number!(sys, bus1, new_number) + @test get_number(bus1) == new_number + @test new_number in get_bus_numbers(sys) + + # Ensure that duplicate numbers are blocked. + @test_throws ArgumentError set_bus_number!(sys, bus1, get_number(bus2)) + + # Ensure that you can't change an unattached bus. + remove_component!(sys, bus1) + @test_throws ArgumentError set_bus_number!(sys, bus1, new_number + 1) + + # Ensure that this is exported. This can be deleted in PSY5. + set_number!(bus1, new_number + 2) + @test get_number(bus1) == new_number + 2 +end diff --git a/test/test_topology.jl b/test/test_topology.jl index ad06dce064..bde8b18c8a 100644 --- a/test/test_topology.jl +++ b/test/test_topology.jl @@ -38,46 +38,40 @@ function test_aggregation_topologies(sys::System, expected_areas, expected_zones 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 topology mappings" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) -# test_aggregation_topologies(sys, 3, 3) -# end +@testset "Test topology mappings" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) + test_aggregation_topologies(sys, 3, 3) +end + +@testset "Test PM areas and load zones" begin + sys = PSB.build_system(MatpowerTestSystems, "matpower_RTS_GMLC_sys") + test_aggregation_topologies(sys, 3, 21) +end -# TODO: re-enable once PowerSystemCaseBuilder no longer relies on PSY parsers -# (PSB.build_system uses PSY.PowerModelsData internally for matpower_RTS_GMLC_sys). -# @testset "Test PM areas and load zones" begin -# sys = PSB.build_system(MatpowerTestSystems, "matpower_RTS_GMLC_sys") -# test_aggregation_topologies(sys, 3, 21) -# end +@testset "Test get_components_in_aggregation_topology and is_component_in_aggregation_topology" begin + sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) + areas = collect(get_components(Area, sys)) + @test !isempty(areas) + zones = collect(get_components(LoadZone, sys)) + @test !isempty(zones) -# 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 get_components_in_aggregation_topology and is_component_in_aggregation_topology" begin -# sys = PSB.build_system(PSITestSystems, "test_RTS_GMLC_sys"; add_forecasts = false) -# areas = collect(get_components(Area, sys)) -# @test !isempty(areas) -# zones = collect(get_components(LoadZone, sys)) -# @test !isempty(zones) -# -# for (agg, accessor) in [(first(areas), get_area), (first(zones), get_load_zone)] -# all_generators = get_components(ThermalStandard, sys) -# in_generators = get_components_in_aggregation_topology(ThermalStandard, sys, agg) -# covered_in = covered_out = false # Invalid test if agg is empty or includes everything -# -# for gen in all_generators -# bus = get_bus(gen) -# if gen in in_generators -# @test IS.get_uuid(accessor(bus)) == IS.get_uuid(agg) -# @test is_component_in_aggregation_topology(gen, agg) -# covered_in = true -# else -# @test IS.get_uuid(accessor(bus)) != IS.get_uuid(agg) -# @test !is_component_in_aggregation_topology(gen, agg) -# covered_out = true -# end -# end -# @test covered_in && covered_out -# end -# end + for (agg, accessor) in [(first(areas), get_area), (first(zones), get_load_zone)] + all_generators = get_components(ThermalStandard, sys) + in_generators = get_components_in_aggregation_topology(ThermalStandard, sys, agg) + covered_in = covered_out = false # Invalid test if agg is empty or includes everything + + for gen in all_generators + bus = get_bus(gen) + if gen in in_generators + @test IS.get_uuid(accessor(bus)) == IS.get_uuid(agg) + @test is_component_in_aggregation_topology(gen, agg) + covered_in = true + else + @test IS.get_uuid(accessor(bus)) != IS.get_uuid(agg) + @test !is_component_in_aggregation_topology(gen, agg) + covered_out = true + end + end + @test covered_in && covered_out + end +end diff --git a/test/test_units.jl b/test/test_units.jl index e7401d43be..6970c81933 100644 --- a/test/test_units.jl +++ b/test/test_units.jl @@ -191,6 +191,23 @@ end @test PSY.deserialize_quantity(json) ≈ q end +@testset "_du_to_su_ratio agrees with base_value ratio for every category" begin + gen = MockGen(0.6, 50.0) # 50 MVA device base, 100 MVA system base, 230 kV + for cat in (POWER, IMPEDANCE, ADMITTANCE, VOLTAGE, CURRENT) + @test PSY._du_to_su_ratio(gen, cat) ≈ + base_value(gen, cat) / system_base_value(gen, cat) + # DU → Float64 must agree with the value of DU → SU + @test convert_units(gen, 0.6, cat, DU, Float64) ≈ + ustrip(convert_units(gen, 0.6, cat, DU, SU)) + end +end + +@testset "Ω/S getters error when base voltage is missing" begin + line = Line(nothing) # demo line: buses carry base_voltage = nothing + @test_throws ErrorException get_x(line, OHMS) + @test_throws ErrorException get_b(line, SIEMENS) +end + @testset "Custom Unitful units" begin @test 1.0Mvar == 1.0u"MW" # same dimension @test 1.0MVA == 1.0u"MW"