System level control framework#751
Conversation
…_control in storage baseclass setup()
…ontrol_classifiers models
Draft implementation of separate curtailment model
…stem_level_control
vijay092
left a comment
There was a problem hiding this comment.
Really nice work everyone! I mostly had some clarifying questions to make sure I understand things correctly.
| System-level control (SLC) within H2I is meant to operate to control the entire plant with performance and cost feedback driving the operation of the plant or system in a closed-loop. It acts as a supervisory controller meaning that it can work to coordinate the entire system and can work with other technology level controllers. | ||
|
|
||
| ```{note} | ||
| The SLC framework is *technology-agnostic* and works with any H2I technology (converters, storage, feedstocks, demand components, etc.). It only cares about a technology's [`_control_classifier`](control_classifier.md) and the commodity it produces. To opt a technology in, set `_control_classifier` on its performance model; for `flexible` models, also call `self.apply_curtailment(outputs)` at the end of `compute()`. See the [developer guide on adding a new technology](../../developer_guide/adding_a_new_technology.md) for the full checklist. |
There was a problem hiding this comment.
Just to clarify, what does flexible mean here?
There was a problem hiding this comment.
flexible means that the model outputs can be curtailed but otherwise cannot responded to a set point. The control classifiers are specific to the model as implemented in H2I so in reality a wind farm can respond to set points to adjust the turbines to better capture the wind, in H2I the pysam model will not change based on a setpoint received and the outputs of the wind farm simulation could be curtailed but that's it. Happy to chat more about this if that would be helpful. The classifiers were a big piece of discussion so it's certainly a bit confusing since they don't fully match with intuition.
Dismissing as we've discussed Jared's view in standups; can do further mods on this code as needed in the future
System level control framework
This work was also done by @kbrunik and @johnjasa :)
Introducing the initial framework for system level control. This PR introduces 3 system level controllers, which are simple controllers. The goal of this PR is to introduce the framework for system level control - which will be further developed in future PRs that address the issues listed in Section 4.
The three system level controllers are:
DemandFollowingControlCostMinimizationControlProfitMaximizationControlMany of the file changes in this PR are related to adding control classifiers for each technology performance model.
PR's that were pre-requisites to this are:
The information that the system level controller is input for each technology is:
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.md"A complete thought. [PR XYZ]((https://github.com/NatLabRockies/H2Integrate/pull/XYZ)", where
XYZshould be replaced with the actual number.Section 4: Related Issues
Issues related to this PR
Issues for planned follow-on work
Section 5: Impacted Areas of the Software
Section 5.1: New Files
h2integrate/control/control_strategies/system_level/solver_options.pySLCSolverOptionsConfig: configuration class for the non-linear solver options to specify for the system level controller. This is used to avoid usage of hard-coded defaults inH2IntegrateModel.h2integrate/control/control_strategies/system_level/system_level_control_base.pySystemLevelControlBase: baseclass for system level controllers. Includes methods to setup inputs and outputs and methods that may be useful for the controllers. Thesetup()method ensures that all commodity streams are defined with consistent units (aka - all hydrogen commodity streams are defined in kg/h and all electricity commodity streams are defined in kW, etc)h2integrate/control/control_strategies/system_level/cost_minimization_control.pyCostMinimizationControl:h2integrate/control/control_strategies/system_level/demand_following_control.pyDemandFollowingControl:h2integrate/control/control_strategies/system_level/profit_maximization_control.pyProfitMaximizationControl:ProfitMaximizationControlConfigSection 5.2: Modified Files (of importance)
h2integrate/core/h2integrate_model.py__init__(): Added attributeslcwhich is used to decide whether to call_classify_slc_technologies()andadd_system_level_controller._classify_slc_technologies(): new method that creates theslc_configdictionary used in the system level controller base class and is an input toadd_system_level_controller()add_system_level_controller(): new method that creates the system level control model and connects the corresponding inputs and outputs between technologies and the system level controllercreate_technology_models(): updated to populate the attributeself.tech_control_classifierswhich is a dictionary with keys as the technology names and values of the corresponding technology control classifier.h2integrate/core/supported_models.py: addedstrategy_mapdictionary which is the equivalent ofsupported_modelsbut specifically for system level controllersh2integrate/core/model_baseclasses.pyPerformanceModelBaseClassapply_curtailment(): new method that applies curtailment to the output of any technology that is classified as "flexible". This logic only happens if "system_level_control" is found as a top-level key in the plant configuration file.setup(): checks if control classifier is flexible and if so, adds input off"{self.commodity}_set_point"and output off"uncurtailed_{self.commodity}_out"CostModelBaseClasssetup(): added output of "marginal_cost".h2integrate/finances/profast_lco.pyProFastLCO.compute(): updated to not run profast if the capacity factor is zero and ifsystem_level_controlis found in the plant config. Warns the user that its setting the LCO output to a large number but that it was not actually calculated if the the capacity factor is zero andsystem_level_controlis found in the plant configSection 6: Additional Supporting Information
Section 7: Test Results, if applicable
Section 8 (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.ymlgenerate_class_hierarchy.pyto update the class hierarchy diagram indocs/developer_guide/class_structure.md