Skip to content

filter aux vars#74

Merged
jd-lara merged 2 commits into
mainfrom
mb/filter-load-aux-vars
May 28, 2026
Merged

filter aux vars#74
jd-lara merged 2 commits into
mainfrom
mb/filter-load-aux-vars

Conversation

@m-bossart

Copy link
Copy Markdown
Contributor

Filter to only relevant aux variables in get_load_data. Avoids failures in processing power flow aux variables.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_keys to filter aux-variable keys to PSY.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.

Comment thread src/get_data.jl
Comment on lines 410 to 414
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)

Comment thread src/get_data.jl
Comment on lines +111 to +124
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

codecov Bot commented May 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.55%. Comparing base (45b665f) to head (3a4ac7a).

Files with missing lines Patch % Lines
src/get_data.jl 72.72% 3 Missing ⚠️
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     
Flag Coverage Δ
unittests 88.55% <72.72%> (-0.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@m-bossart m-bossart requested a review from jd-lara May 24, 2026 22:14
Comment thread src/get_data.jl
aux_variable_keys::Vector{T} = PSI.list_aux_variable_keys(results),
) where {T <: PSI.OptimizationContainerKey}
# TODO: add slacks
filter_keys = Vector{PSI.OptimizationContainerKey}()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why you are just capturing the load AuxVars

@jd-lara jd-lara merged commit a1d5c05 into main May 28, 2026
6 of 8 checks passed
@jd-lara jd-lara deleted the mb/filter-load-aux-vars branch May 28, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants