feat: create change table to mimic existing grid when scaling new grid#174
feat: create change table to mimic existing grid when scaling new grid#174danielolsen merged 3 commits intodevelopfrom
Conversation
|
@dmuldrew here is the output from my clustering algorithm when matching Scenario 403. Between zone scaling and plant scaling, over 10000 individual plant scaling factors are represented by a combination of ~360 zone and plant scaling factors. Plant scaling factors are all zero, so I think this is the most compact it can be. There are plenty of potential clustering algorithms in the world, but in our applications, most of the plants in a zone/type are scaling by the same factor (subject to floating point precision), with only a few exceptions, so the median seems to work very well. |
f8d428c to
90da136
Compare
dmuldrew
left a comment
There was a problem hiding this comment.
Once the change table is generated using this method, are you still going to use the validation built in the change table scale_plant_capacity function?
|
@dmuldrew we would have to convert back from |
Purpose
Simplify scenario creation by automatically generating a change table to scale an arbitrary base grid to match a target grid (reference grid + clean capacity scale-up).
What is the code doing
The main logic is in a new
mimic_grid.pyfile, with a public functionmimic_generation_capacity(). This function calculates plant-level scaling factors to scale a base grid to a reference grid, and then passes these scaling factors to_calculate_common_zone_factors(), to allow a simplification of the generated change table by identifying scaling factors common to all plants in a zone. This function does a few things:In
scenario_info.py, we move the main logic forarea_to_loadzoneout of the ScenarioInfo object, since all it actually needs is a grid, and no more info from the scenario. There are no changes to any of the logic in this function.In
clean_capacity_scaling.py, we create a new methodcreate_change_table(), which creates a change table output. Scaling to get from base to ref is done viamimic_generation_capacity(), and then scale factors by target are applied on top of this scaling.Validation
All existing unit tests, still pass, so we didn't break anything here. We can validate that the change table generated by
mimic_generation_capacity()effective matches the existing change table from scenario 403 (with a different structure, and scaledown for offshore wind), via the following integration test:We create a custom function to validate this new output:
Let's run it on our new change table, against the existing change table (minus demand and branch scaling):
Integration for the entire feature can be demonstrated via the following test, which follows our current clean capacity calculation process:
We can also verify that this change table structure is compatible with the
ChangeTablemethods:The only outputs are for the case where we apply a scaling factor based on a state, but one zone in that state does not have at least one of the resources:
All relevant information makes it into the
ChangeTableobject.Time to review
One to two hours.