feat: add module to 'design' scenarios, starting with renewable stub scaling#80
feat: add module to 'design' scenarios, starting with renewable stub scaling#80danielolsen merged 4 commits intodevelopfrom
Conversation
fix: ensure renewable stub scaling works starting with empty change table fix: ensure renewable stub scaling works starting with empty change table (for real) fix: ensure renewable stub scaling works starting with empty change table (for real for real)
|
I will look in more details tomorrow or, if I don't find the time, Thursday. Quick question, did you consider having |
|
@rouille do you mean where the method is invoked from, or where the code lives? I am agnostic on where it's invoked from, and it could be from change_table if you think that fits better. I see that the ChangeTable has a Grid object which we could use to do topology analysis. For where the code lives, I like having a new |
|
I am talking about where the method is invoked. Right now it is in the |
|
Okay, I will change it. |
|
Invocation has been moved. Bonus, it cuts down on the printing because we don't instantiate a new grid! Unit testing: Integration testing: |
|
Yes, I was expecting the printing to be reduced. So, if I read the code well, it seems that |
|
If you call |
|
I remember doing that. The idea behind was that if you make a mistake in the scaling, you can easily overwrite without having to manually pop entries in the dictionary. |
|
Maybe it would be worth adding an option to the |
|
Not a bad idea |
|
Demo: |
|
Looks good. Thanks. |
…ious scalings, add clear() method
8bd0439 to
3620e52
Compare
BainanXia
left a comment
There was a problem hiding this comment.
Using this for a while and finally I got a chance to give a pass of the code. Nice work.
This feature adds the automatic scaling of renewable stub branches that was used in the Western, Eastern, and USA Scenario runs. It analyzes the topology of the network, starting at each renewable generator and finding 'stub' branches--branches which are the only path between a given node and anywhere else in the network. In graph theory, these branches would be considered 'bridges', although this is currently a cruder implementation that will not detect when a stub is 'tree-shaped' rather than a series of singular links (this could be improved via the use of
networkxor a similar graph theory package).Once a builder is assigned, this feature is called via:
scenario.state.builder.scale_renewable_stubs(), with optional kwargs passed through to the implementation inpowersimdata/input/design.py.To support testing, I've created
mock_builder.pyandmock_change_table.pyto contain new mock objects used in the tests for the functions inpowersimdata/input/design.py.Unit tests:
Implementation test. First we start with a vanilla Western scenario. The change_table is initially empty, and remains functionally empty after stub scaling (since renewables haven't been overbuilt). Once we scale up renewables, calling the stub scaling again adds branch scaling to the change_table.