Add test for run_dwelling.py script and fix HPWH initialization bug#208
Open
Add test for run_dwelling.py script and fix HPWH initialization bug#208
Conversation
c60ff6a to
232bfef
Compare
- Add --no-show flag to bin/run_dwelling.py to support automated testing - Always save plots to disk (in addition to optional display) - Add TestRunDwellingScript class that runs the script as a subprocess - Fix bug in WaterHeater.py where self.hp_cop was used before being defined (affects HPWH with UniformEnergyFactor != 4.9)
232bfef to
51215e9
Compare
rajeee
commented
Feb 3, 2026
| else: | ||
| hp_power_nominal = kwargs.get("HPWH Power (W)", 500) # in W | ||
| self.hp_capacity_nominal = hp_power_nominal * self.hp_cop # in W | ||
| self.hp_capacity_nominal = hp_power_nominal * self.cop_nominal # in W |
Collaborator
Author
There was a problem hiding this comment.
This seemed like a bug and fixed it.
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.
Summary
--no-showCLI flag tobin/run_dwelling.pyfor automated testing supportTestRunDwellingScriptintegration test that runs the script as a subprocessWaterHeater.pywhereself.hp_copwas used before being definedDetails
New Test
The PR template requires "Test with run_dwelling.py or other script". This adds an automated test that validates
bin/run_dwelling.pyworks end-to-end by running it as a subprocess with--no-showflag.Bug Fix
Fixed an
AttributeErrorinHeatPumpWaterHeater.__init__whereself.hp_copwas referenced before assignment. This bug was triggered when:UniformEnergyFactor != 4.9(soHPWH Capacity (W)is not set)The fix changes
self.hp_coptoself.cop_nominalon line 438, which is equivalent sinceself.hp_copis later set toself.cop_nominalanyway.Testing
All 11 dwelling tests pass including the new
TestRunDwellingScript::test_run_dwelling_script.