Bugfix on storage so storage can't charge with unavailable input commodity#664
Open
elenya-grant wants to merge 5 commits intoNatLabRockies:developfrom
Open
Bugfix on storage so storage can't charge with unavailable input commodity#664elenya-grant wants to merge 5 commits intoNatLabRockies:developfrom
elenya-grant wants to merge 5 commits intoNatLabRockies:developfrom
Conversation
…_control in storage baseclass setup()
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.
Bugfix on storage so storage can't charge with unavailable input commodity
Storage performance models were not constrained to only charge with the available input commodity. If a controller were to tell the storage performance model to charge more than the available input commodity, then the storage would charge more than the available input commodity. This shouldn't be allowed to happen, storage performance models should only be able limited to only be able to charge with the commodity_in. This PR fixes that.
This PR also fixes some of the logic in the storage model baseclass to decide whether it's using feedback control. The previous logic was:
and was updated to:
Previously, if you had a technology named "battery" that uses a pyomo controller and another technology named "battery_1" that uses an open-loop controller. Then the logic in "battery_1" would have said it's using feedback control (when it isn't). Using
==instead ofinmakes it so that the logic inbattery_1will run as expected.Both of these changes have new tests!
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 3: Related Issues
Section 4: Impacted Areas of the Software
Section 4.1: New Files
Section 4.2: Modified Files
h2integrate/storage/battery/pysam_battery.py: modifiedPySAMBatteryPerformanceModelsimulate(): updated to take commodity_available as an input and constrain charge based on the available commodity.h2integrate/storage/storage_baseclass.py: modifiedStoragePerformanceBaserun_storage(): updated calls tosimulate()and addedcommodity_availableas a key in the kwargs dictionary to pass to feedback controllers.simulate(): updated to take commodity_available as an input and constrain charge based on the available commodity.setup(): minor change in logic for deciding whether using feedback control or notNew tests
h2integrate/control/test/test_multistorage_pyomo_openloop_control.py::test_battery_pyomo_battery_openloop: test that would've failed before this PR that tests the naming logic for deciding whether a technology has a feedback control strategy or not.h2integrate/storage/test/test_storage_performance_model.py::test_generic_storage_charge_more_than_available: test that would've failed before this PR. Tests when the commodity_set_point tells the storage to charge more than what's available.Section 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