Conversation
Is this #169? |
1bad06b to
db6db25
Compare
|
I can confirm that this solves #169. Using Using Using this branch rebased onto |
| from powersimdata.input.change_table import ChangeTable | ||
| from powersimdata.input.scaler import TransformGrid | ||
|
|
||
| warnings.filterwarnings("ignore", category=DeprecationWarning) |
There was a problem hiding this comment.
This seems a bit risky. Now that the Grid has been reverted to its classic form and we are no longer throwing DeprecationWarning, shouldn't we be willing to see DeprecationWarning errors from other packages?
Removing these does not show any additional warnings.
There was a problem hiding this comment.
Absolutely. I forgot to remove these lines after the revert.
|
Grid equality is useful for testing here: Hooray! |
|
What do you think about adding |
|
Grid equality confirms that equality between a new grid with a change table and a grid in |
|
Since we can now get the |
| :param dict ct: change table. | ||
| """ | ||
| self.grid = copy.deepcopy(grid) | ||
| self.ct = ct.copy() |
There was a problem hiding this comment.
Not sure whether it matters or not, just a reminder, dict.copy() creates a shadow copy only. I think we are safe here given we just read the info from ct and never modify it.
There was a problem hiding this comment.
I think you're right, we probably want copy.deepcopy on both grid and ct. We don't want any unintentional modifications!
There was a problem hiding this comment.
A deepcopy of the change table is used when instantiating the TransformGrid and ScaleProfile classes. Also, the get_ct method in the Create, Execute and Analyze classes return a deepcopy of the change table. See last commits.
I will do an interactive rebase to clean the commit history once all your comments are addresed.
|
Being able to inspect the Grid you are about to create is so, so nice. It just saved me from submitting a totally bogus offshore wind scenario. |
BainanXia
left a comment
There was a problem hiding this comment.
All my comments are resolved. All tests passed. Thanks for being patient and responsive. Great work!
db034a6 to
5736700
Compare
Purpose
This PR accomplishes three things:
Scalerclass. There are now two classes,TransformGridandScaleProfile(Create TransformGrid and ScaleProfile Class #189).TransformGridclass is instantiated via aGridobject and a change table and return aGridobject via theget_gridmethod that has been transformed according to the changes listed in the change table. Transformations incliude scaling opertations and additions of storage units and AC/DC lines. The object is fully tested.ScaleProfileclass is instantiated aparamiko.client.SSHClientobject, a scenario id, aGridobject and a change table. The first two parameters are needed to download the base profiles from the server. TheGridobject is needed to retrieve the plant id of a given type in a zone. Theget_demandandget_power_outputreturn a scaled profile using information in the change table for demand and clean energy generators, respectfully. Integration tests have been developed to test the scaling procedure.Gridobject and a change table are now returned via theget_gridandget_ctmethods of theCreateclass. If aScenarioobject is in theexecutestate,scenario.state.get_grid()andscenario.state.get_ct()will return a transformedGridobject and the change table for thisScenarioobject (Get grid in the create and execute states #190).Analyzeclass (Profiles are not returned properly for a scenario with fewer solar/wind plants #169). Profiles are now returned using aGridobject coming from the instantiation of theGridclass via the input.mat. Also, the class has now agridandctattributes.Where to look?
ChangeTableclass is noow instantiated via aGridobject. Previously, the constructor was taking a list of interconnect(s) and theGridclass was instantiated within the constructor of theChangeTableclass. Doing this, we avoid multiple instantiation of theChangeTableclass in the simulation framework since the same grid can be used to create aChangeTable,TransformGridandScaleProfileobjects.Scalerclass has been replaced by theTransformGridandScaleProfileclasses.TransformGridclass.ScaleProfileclass. These are integration tests that are very slow.unittestpackage-m integrationoption in thepytestcommand, only integration tests will be run. The or-m 'not integration'option will not run the integration tests. Pytest will automatically detect the file._Builderclass has now aget_gridmethod. TheCreateclass has now agridandctattributes that will be carried over when swithing from thecreateto theexecutestate.gridandctattributes are set. AScaleProfileobject is used in theSimulationInputclass.Gridclass is now instantiated only via the input.mat. Agridandctattributes are set during instantiation.gridandctattributes when switching from theanalyzetodeletestate.Visuals
I have placed the test_scenario_framework.ipynb notebook that you can look at (change the scenario name if you want to run it since the scenario has not been deleted). It performs a full integration test with checks every step of the way.
Time estimate
3h. It is long, sorry about that.
Tests
All tests pass.