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.
Purpose
Correct for a bug where calling
scenario.state.builder.change_table.scale_congested_mesh_branches(scenario)
will fail with a KeyError if themethod
is set to 'MW' or 'MWmiles' and there is an existing change table entry for a congested branch.What is the code doing
Previously, we detected if there was an entry for a branch in
ct['branch']['branch_id']
, and if there was we attempted to access the entry from the top level ofct
. Since there are no branch id entries in the top level of thect
, this will fail (and in fact this is how I found the bug, while trying to generate mesh scaling for Scenario 410).In
test_design_transmission.py
, I add a change table where every branch has an entry and is scaled by exactly 1. This should change nothing about the results of mesh branch upgrade identification, but it triggers the aforementioned bug.In
design_transmission.py
, I correct the bug so that the test passes: existing branch scaling factors for congested branches are looked up fromct['branch']['branch_id']
, not fromct
.Time to review
10-15 minutes. You can check out the commit with the test, see that it fails, and then check out the tip of the fix branch and see that it fixes the problem.