Split out Pyomo Controllers to separate files#549
Split out Pyomo Controllers to separate files#549elenya-grant wants to merge 8 commits intoNatLabRockies:developfrom
Conversation
kbrunik
left a comment
There was a problem hiding this comment.
I think this is helpful! It makes it easier to track, which will help with future dispatch development. Thanks!
jaredthomas68
left a comment
There was a problem hiding this comment.
Looks good to me.
genevievestarke
left a comment
There was a problem hiding this comment.
Really good work @elenya-grant, thank you for taking this on!
| control_strategy = self.options["tech_config"]["control_strategy"]["model"] | ||
|
|
||
| # TODO: implement optional kwargs for this method: maybe this will remove if statement here | ||
| if "Heuristic" in control_strategy: |
There was a problem hiding this comment.
There was a problem hiding this comment.
this is weird but this is what existed before... I think it'd be nice to remove this eventually
There was a problem hiding this comment.
I'm good with this logic as-is; it's pretty clear. I like that it's just calling initialize_parameters in each case, good parallelism there. If the method had the same args expected then we wouldn't need the split logic; I don't think we should refactor that here though.
Split out Pyomo Controllers to separate files
Split out the controllers in
h2integrate/control/control_strategies/pyomo_controllers.pyto separate files and removed some inheritance so that the logic is easier to follow. Also refactored theHeuristicLoadFollowingControllerto no longer inherit theSimpleBatteryControllerHeuristicclass (theSimpleBatteryControllerHeuristichas been removed and the functionality now exists in theHeuristicLoadFollowingController).These changes are intended to make further development of the pyomo controllers easier by making the individual control strategies easier to understand through the removal of inheritance and being able to look at a single file containing the entire control strategy of interest (the individual files also make it easier to determine which attributes are being used and which ones aren't).
Removed
n_horizon_windowfrom thePyomoControllerBaseConfigandPySAMBatteryPerformanceModelConfigbecause it was unused.Follow-on work may look at refactoring the
PyomoControllerBaseConfig,HeuristicLoadFollowingControllerConfig, andOptimizedDispatchControllerConfigto remove unused attributes.Section 1: Type of Contribution
Section 2: Draft PR Checklist
TODO:
Type of Reviewer Feedback Requested (on Draft PR)
Structural feedback:
Implementation feedback:
Other feedback:
Section 3: General PR Checklist
docs/files are up-to-date, or added when necessaryCHANGELOG.mdhas been updated to describe the changes made in this PRSection 3: Related Issues
Section 4: Impacted Areas of the Software
Section 4.1: New Files
h2integrate/control/control_strategies/optimized_pyomo_controller.py: new file containing theOptimizedDispatchControllerConfigandOptimizedDispatchControllerh2integrate/control/control_strategies/pyomo_controller_baseclass.py: new file containing thePyomoControllerBaseConfig,PyomoControllerBaseClass, andSolverOptionsh2integrate/control/control_strategies/heuristic_pyomo_controller.py: file containing theHeuristicLoadFollowingControllerConfigandHeuristicLoadFollowingControllerSection 4.2: Modified Files
h2integrate/control/test/test_heuristic_controllers.py: updated import statementh2integrate/control/control_strategies/passthrough_openloop_controller.py: no longer inheritsControllerBaseClass(theControllerBaseClasswas removed)h2integrate/core/supported_models.py: updated import statements for theOptimizedDispatchControllerandHeuristicLoadFollowingControllerSection 4.3: Removed Files
h2integrate/control/control_strategies/pyomo_controllers.py: old file containing the other controllers.h2integrate/control/control_strategies/controller_baseclass.py: removed this very simplistic baseclass, was only used for itsinitialize()methodSection 5: Additional Supporting Information
Section 6: Test Results, if applicable
Section 7 (Optional): New Model Checklist
docs/developer_guide/coding_guidelines.mdattrsclass to define theConfigto load in attributes for the modelBaseConfigorCostModelBaseConfiginitialize()method,setup()method,compute()methodCostModelBaseClasssupported_models.pycreate_financial_modelinh2integrate_model.pytest_all_examples.pydocs/user_guide/model_overview.mddocs/section<model_name>.mdis added to the_toc.yml