WIP: Helper Methods in SLC BaseClass - #816
Draft
elenya-grant wants to merge 48 commits into
Draft
Conversation
…d for dictionary, using a set instead)
…p_multi_commodity()
…nected between two techs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Helper Methods in SLC BaseClass
Added some hopefully useful helper methods in the SLC baseclass and intended to resolve Issue #741. I also view this as a pre-requisite to tackling Issue #747. These methods are intended to help future control development be more easily expanded to varying system architectures and make them more friendly to multi-commodity systems (systems that contain converters such as an electrolyzer or Haber Bosch system).
These methods probably have their limitations - but those will be best found and addressed as we test them with more complex system architectures.
This PR also includes some updates to the
DemandFollowingControlto show-case how to use some of the methods in the SLC baseclass. I am still working on adding all the necessary doc-strings and cleaning up the code.Please do not yet push any changes to this branch.
Section 1: Type of Contribution
Section 2: Draft PR Checklist
TODO:
Type of Reviewer Feedback Requested (on Draft PR)
Structural feedback:
Implementation feedback:
_post_setup_multi_commodity()be updated to have the format__method_name__? Or no?_method_nameor justmethod_name?Other feedback:
converter_upstreams, is a dictionary like: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
Intended to resolve Issue #741
Section 5: Impacted Areas of the Software
Section 5.1: New Files
h2integrate/control/control_strategies/system_level/test/test_slc_baseclass.py: new test file for some methods introduced in the SLC baseclassSection 5.2: Modified Files
h2integrate/core/h2integrate_model.py._classify_slc_technologies(): updated so that other inputs (such astech_control_classifiersandstorage_techs_to_control) only include technologies that are upstream of the demand component.h2integrate/control/control_strategies/system_level/demand_following_control.pyDemandFollowingControlConfig: new configuration class for the demand following controllerDemandFollowingControlcompute()in a method namedget_setpoints_for_commodity_subset()get_conversion_factors(): new methodcompute(): changed a bunchMany new methods were added to
h2integrate/control/control_strategies/system_level/system_level_control_base.py. Below is a summary of the major new methods and the other methods that they use_post_setup_multi_commodity(): called insetup()and uses the below methods_find_converter_techs: only called during_post_setup_multi_commodity()and uses the below methods_get_commodity_for_tech: called elsewhere - not specific to this methodget_upstream_techs_for_commodity: called elsewhere - not specific to this method_find_demand_tech_group: only called during_post_setup_multi_commodity()_check_demand_tech_group_connections:dict_values_to_flat_list: called elsewhere - not specific to the parent method_find_group_for_non_input_techs: only called during_post_setup_multi_commodity()_make_conversion_factor_recipes: only called during_post_setup_multi_commodity()simple_graphnon_converter_conversion_factor_keys:grouped_techs:converters:converter_upstreams:converter_tech_names: could perhaps removeconversion_recipes:New methods in the SLC baseclass that are used by the
DemandFollowingControl.compute()method are:_get_techs_to_demand_from_recipe_get_conversion_from_recipeget_converter_capacity_conversion_ratioget_converter_conversion_ratioSection 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