Conversation
| scenario.print_scenario_info() # print scenario information | ||
|
|
||
| # prepare simulation inputs | ||
| scenario.state.prepare_simulation_input() |
There was a problem hiding this comment.
I'm thinking that it might be more natural to have methods "print_scenario_status()", "prepare_simulation_input()" and "launch_simulation()" be methods of the scenario object and not state, so then we'll have:
scenario.print_status()
scenario.launch_simulation()
There was a problem hiding this comment.
print_scenario_status() is currently a method of the Execute object since it tracks the execution process (created --> prepared --> running --> finished --> extracted). That said this functionality can easily be made state independent and be moved to the Scenario object. Perhaps, the method should be renamed print_execution_status() and stays where it is now.
The other two methods, prepare_simulation() and launch_simulation() are also part of the Execute object and by design they cannot be moved. We can talk about the design and see if we can improve it.
| @@ -0,0 +1,260 @@ | |||
| import os | |||
| import pickle | |||
There was a problem hiding this comment.
Maybe consider using hdf5 instead of pickle:
https://shocksolution.com/2010/01/10/storing-large-numpy-arrays-on-disk-python-pickle-vs-hdf5adsf/
There was a problem hiding this comment.
We need to evaluate pros and cons of using hdf5. If we decide to go this way we will have to convert the already produced output files and do some slight changes in the code. Nothing to completed. @dmuldrew can create an issue on ZenHub. This could a new PR.
| :param str resource: type of generator. | ||
| :raises ValueError: if resource cannot be changed. | ||
| """ | ||
| possible = ['coal', 'ng', 'nuclear', 'hydro', 'solar', 'wind'] |
There was a problem hiding this comment.
defining an enumerated types here will eliminate the need to have this possible matrix - it will just be built directly into the type
There was a problem hiding this comment.
That would be nice. I need to investigate enumerated types in Python. I am not sure this can be done for this CR. Can probably be its own PR.
| ['zone_name', 'type']).get_group( | ||
| (zone_name, resource)).index.values.tolist() | ||
| except KeyError: | ||
| pass |
There was a problem hiding this comment.
print out error here? what happens if the exception in the try block isn't a KeyError
| scaling factor for the increase/decrease in capacity of the | ||
| generator. | ||
| """ | ||
| self._check_resource(resource) |
There was a problem hiding this comment.
check resource raises an exception, not sure where it will be caught...
There was a problem hiding this comment.
The exception is caught as we saw yesterday. The full traceback is printed. We might want in the future to print the error and return. Believe that it does not hurt to have the full traceback since we are still developing the platform. We definitely want in the future to have a more user friendly handling of the error.
|
Please finish your reviews until tomorrow noon! |
| :return: (*dict*) -- keys are the interval number and the values are | ||
| the decrease in percent (%) applied to the original demand profile. | ||
| """ | ||
| field = self._scenario_info['infeasibilities'] |
There was a problem hiding this comment.
perhaps replace "field" name with "infeas" or some variant
| elif status.shape[0] == 1: | ||
| self.status = status.status.values[0] | ||
|
|
||
| def print_scenario_info(self): |
There was a problem hiding this comment.
seems like the implementation of this function can potentially moved out of state to here
| self.state.print_scenario_info() | ||
|
|
||
| def change(self, state): | ||
| """Changes state. |
There was a problem hiding this comment.
likewise perhaps move implentation of this function here
| self.__class__ = state | ||
| self._enter() | ||
| else: | ||
| print('State switching: %s -/-> %s' % (self, state.name)) |
There was a problem hiding this comment.
I think we can be more explicit that a particular state switch is no allowed
| name = "state" | ||
| allowed = [] | ||
|
|
||
| def switch(self, state): |
There was a problem hiding this comment.
what is state here? an instance of class State? the name of a state?
This the new framework to handle scenarios. Those can now be created, ran, analyzed and deleted from the local machine with Python only. This package also includes the Grid object that is used by other packages (PreREISE and PostREISE) to get information on the network used in this project (GPS coordinates of generators, charcteristics of transmission lines, ... See README for a description of the attributes).