Lk/units domain agnostic#574
Draft
luke-kiernan wants to merge 11 commits intoIS4from
Draft
Conversation
- Add units.jl with Unitful integration, RelativeQuantity type for DU/SU - Define custom Mvar and MVA units for reactive/apparent power - Update generate_structs.jl template to generate two-method accessors: - Default accessor returns natural units (MW, Mvar, etc.) - Optional second argument accepts explicit unit (DU, SU, MW, etc.) - Add get_natural_unit() to map conversion types to appropriate units (reactive power fields → Mvar, other power fields → MW) - Export unit types and Unitful re-exports from main module - Register custom Unitful units in __init__() Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The type parameter in repr() may or may not be module-qualified depending on what names are in scope, which differs between local and CI environments. Use occursin checks instead of exact string matching. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When exclude_getter is true, generates an internal _get_ prefixed accessor instead of the public get_ accessor. Suppresses the public getter export while keeping setter exports (since exclude_setter means hand-written, not nonexistent). Used by PSY to make get_base_power return unitful values while keeping _get_base_power as raw Float64 for internal conversion machinery. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The 1-arg getter now uses DEFAULT_UNITS (a constant) instead of the stateful _get_system_units, eliminating type instability and enabling full compiler optimization of the getter path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace inline units.jl with using/re-exporting from PowerSystemsUnits. Keep time_period_conversion in units.jl (unrelated to unit types). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Purge power-domain knowledge from generate_structs template (NATURAL_UNIT_MAP / get_natural_unit removed); template emits untyped `units` parameter for downstream packages to specialize. - Declare bare `get_value` / `set_value` interface; methods are now provided by domain packages (e.g. PowerSystems). - Drop PowerSystemsUnits and Unitful deps so IS has no knowledge of power-system-specific unit types. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## IS4 #574 +/- ##
==========================================
- Coverage 82.04% 81.81% -0.23%
==========================================
Files 74 75 +1
Lines 6238 6336 +98
==========================================
+ Hits 5118 5184 +66
- Misses 1120 1152 +32
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
- New relative_units.jl vendors AbstractRelativeUnit, DU/SU/NU, and
RelativeQuantity; power-specific types stay in PSY.
- Template drops the 1-arg getter emission — callers must specify units.
Emits a `display_units_arg(f, ::Type{T})` trait so consumers can dispatch
on whether a (getter, struct) pair takes units.
- `_make_time_array` now calls `multiplier(owner, SU)` so
`scaling_factor_multiplier = get_max_active_power` keeps working.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
|
One comment I see is that we need The five TimeSeries*Curve aliases to full parametric type. Please add overrides for symmetry and better printing. |
jd-lara
reviewed
Apr 17, 2026
Mirror the existing exclude_setter behavior so the public name is registered for export even when the generator emits a _-prefixed internal accessor. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backend for explicit units in getters and setters.