Add units-aware getters/setters for power system components#1617
Add units-aware getters/setters for power system components#1617luke-kiernan wants to merge 5 commits intomainfrom
Conversation
- Add conversion methods in components.jl for get_value/set_value - MW conversion: device_base * base_power → MW - Mvar conversion: device_base * base_power → Mvar - DU conversion: returns RelativeQuantity with device base - SU conversion: converts to system base per-unit - Handle compound types (MinMax, UpDown) with recursive conversion - Regenerate all struct files with new accessor signatures - Update exports to include MW, Mvar, MVA, kV, OHMS, SIEMENS, DU, SU - Update test dependencies and add explicit units API tests - Dev InfrastructureSystems.jl dependency to local version Example usage: get_active_power(gen) # → 30.0 MW (default) get_active_power(gen, DU) # → 0.6 DU (device base) get_reactive_power(gen) # → 20.0 Mvar Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Where things currently stand:
Main problems I've noticed:
In PSY, the major places that use the old units system and will need overhaul are the ones we expected: parsing from edit: oh....an unfortunate side effect is that the getters now ignore the system's unit setting. That's not come up here in PSY--we don't manipulate units a whole lot here--but it will definitely cause issues in downstream packages. edit^2: the above "unfortunate side effect" is fixable. Make the single-argument |
Default getters now use _get_system_units() instead of hardcoded unit types, respecting the system's unit setting. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Prototype of units-aware getters and setters. Core functionality works: some tests fail, but I believe it's due to inter-package friction (e.g. PSB's systems aren't quite compatible).