filter aux vars#74
Conversation
There was a problem hiding this comment.
Pull request overview
This PR narrows the auxiliary-variable keys used by get_load_data to only load-relevant entries, preventing failures when unrelated aux variables (e.g., power-flow related) are present in the results.
Changes:
- Added
get_load_aux_variable_keysto filter aux-variable keys toPSY.ElectricLoad+PSI.PowerOutput. - Updated
get_load_data(results::IS.Results, ...)to apply the new aux-variable filtering before reading aux-variable results.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| variable_keys = get_load_variable_keys(results; variable_keys = variable_keys) | ||
| parameter_keys = get_load_parameter_keys(results; parameter_keys = parameter_keys) | ||
| aux_variable_keys = | ||
| get_load_aux_variable_keys(results; aux_variable_keys = aux_variable_keys) | ||
|
|
| function get_load_aux_variable_keys( | ||
| results::IS.Results; | ||
| aux_variable_keys::Vector{T} = PSI.list_aux_variable_keys(results), | ||
| ) where {T <: PSI.OptimizationContainerKey} | ||
| # TODO: add slacks | ||
| filter_keys = Vector{PSI.OptimizationContainerKey}() | ||
| for k in aux_variable_keys | ||
| if PSI.get_component_type(k) <: PSY.ElectricLoad && | ||
| PSI.get_entry_type(k) == PSI.PowerOutput | ||
| push!(filter_keys, k) | ||
| end | ||
| end | ||
| return filter_keys | ||
| end |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #74 +/- ##
==========================================
- Coverage 88.79% 88.55% -0.25%
==========================================
Files 7 7
Lines 723 734 +11
==========================================
+ Hits 642 650 +8
- Misses 81 84 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| aux_variable_keys::Vector{T} = PSI.list_aux_variable_keys(results), | ||
| ) where {T <: PSI.OptimizationContainerKey} | ||
| # TODO: add slacks | ||
| filter_keys = Vector{PSI.OptimizationContainerKey}() |
There was a problem hiding this comment.
I don't understand why you are just capturing the load AuxVars
Filter to only relevant aux variables in
get_load_data. Avoids failures in processing power flow aux variables.