-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#7711 - Fix crash when using both WaterHeat:HeatPump:PumpedCondenser and WaterHeater:HeatPump:WrappedCondenser #7717
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
39e328e
Add Unit test for #7711. Will crash as per issue right now.
jmarrec 52e55d1
Fix #7711: Have to use the right index to query getObjectItem: we sto…
jmarrec e9fee91
Add test for #7720
jmarrec 473900b
Fix #7720
jmarrec 4d50326
Update docstring, and limit scope of HPNum variable
jmarrec 15289cd
Merge branch '7720_WaterHeater_Standalone_and_HPWH' into 7711_WaterTh…
jmarrec ac66cc5
Merge branch 'develop' into 7711_WaterThermalTanks_Crash
mitchute feaedff
sync up new unit test with OutputFiles changes
mitchute File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1035,6 +1035,9 @@ namespace WaterThermalTanks { | |
int nNumPossibleNumericArgs; // the number of possible numeric arguments in the idd | ||
int nNumPossibleAlphaArgs; // the number of possible numeric arguments in the idd | ||
|
||
// For looking up in IDF/epJSON, you need the index that corresponds to the actual object type (Pumped or Wrapped) | ||
int HPWaterHeaterNumOfSpecificType; | ||
|
||
for (int HPWaterHeaterNum = 1; HPWaterHeaterNum <= numHeatPumpWaterHeater; ++HPWaterHeaterNum) { | ||
|
||
// Create reference to current HPWH object in array. | ||
|
@@ -1043,25 +1046,30 @@ namespace WaterThermalTanks { | |
// Initialize the offsets to zero | ||
nAlphaOffset = 0; | ||
nNumericOffset = 0; | ||
|
||
if (HPWaterHeaterNum <= NumPumpedCondenser) { | ||
// Pumped Condenser | ||
DataIPShortCuts::cCurrentModuleObject = cHPWHPumpedCondenser; | ||
HPWH.TypeNum = DataPlant::TypeOf_HeatPumpWtrHeaterPumped; | ||
nNumPossibleAlphaArgs = 29; | ||
nNumPossibleNumericArgs = 9; | ||
// Actual index of Pumped type | ||
HPWaterHeaterNumOfSpecificType = HPWaterHeaterNum; | ||
} else { | ||
// Wrapped Condenser | ||
DataIPShortCuts::cCurrentModuleObject = cHPWHWrappedCondenser; | ||
HPWH.TypeNum = DataPlant::TypeOf_HeatPumpWtrHeaterWrapped; | ||
nNumPossibleAlphaArgs = 27; | ||
nNumPossibleNumericArgs = 10; | ||
// Actual index of Wrapped type | ||
HPWaterHeaterNumOfSpecificType = HPWaterHeaterNum - NumPumpedCondenser; | ||
} | ||
|
||
int NumAlphas; | ||
int NumNums; | ||
int IOStat; | ||
inputProcessor->getObjectItem(DataIPShortCuts::cCurrentModuleObject, | ||
HPWaterHeaterNum, | ||
HPWaterHeaterNumOfSpecificType, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Has to be an index specific to the type of object you want to get. |
||
DataIPShortCuts::cAlphaArgs, | ||
NumAlphas, | ||
DataIPShortCuts::rNumericArgs, | ||
|
@@ -11337,7 +11345,7 @@ namespace WaterThermalTanks { | |
|
||
// PURPOSE OF THIS SUBROUTINE: | ||
// Calculates the water heater standard ratings, such as Energy Factor and Recovery Efficiency. Results are written | ||
// to the EIO file. Standard ratings are not calculated for storage-only tanks, i.e., MaxCapacity = 0. | ||
// to the EIO file. Standard ratings are not calculated for storage-only tanks, i.e., MaxCapacity = 0, nor for Integrated Heat Pumps | ||
|
||
// METHODOLOGY EMPLOYED: | ||
// Water heater inputs are set to the specified test conditions. For HPWHs, the heating capacity and COP are assumed | ||
|
@@ -11378,7 +11386,6 @@ namespace WaterThermalTanks { | |
FirstTimeFlag = true; | ||
|
||
int TimeStepPerHour = int(1.0 / DataHVACGlobals::TimeStepSys); | ||
int HPNum = 0; | ||
// Simulate 24 hour test | ||
for (int Step = 1; Step <= TimeStepPerHour * 24; ++Step) { | ||
|
||
|
@@ -11417,7 +11424,7 @@ namespace WaterThermalTanks { | |
|
||
} else { | ||
|
||
HPNum = this->HeatPumpNum; | ||
int HPNum = this->HeatPumpNum; // Convenience variable | ||
Real64 AmbientHumRat = 0.00717; // Humidity ratio at 67.5 F / 50% RH | ||
|
||
// set the heat pump air- and water-side mass flow rate | ||
|
@@ -11679,7 +11686,8 @@ namespace WaterThermalTanks { | |
} else { | ||
RecoveryEfficiency = 0.0; | ||
EnergyFactor = 0.0; | ||
if (HPWaterHeater.empty() || !HPWaterHeater(HPNum).bIsIHP) { | ||
// If this a regular tank, or an HPWH that's not an Integrated one | ||
if ((this->HeatPumpNum == 0) || !HPWaterHeater(this->HeatPumpNum).bIsIHP) { | ||
ShowWarningError("Water heater = " + this->Name + | ||
": Recovery Efficiency and Energy Factor could not be calculated during the test for standard ratings"); | ||
ShowContinueError("Setpoint was never recovered and/or heater never turned on"); | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the actual fix basically.
Container
HPWaterHeater
stores both HPWH:Pumped and HPWH:Wrapped in that order. Before fix if you had 1 HPWH:Pumped and one HPWH:Wrapped it would call getObjectItem for the wrapped one passing an index of 2, which doesn't exist in InputProcessor since there's only one object of type HPWH:WrappedCondenser, so it would crash hard.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmarrec thanks for the fix. Having just worked through the refactor on this file, I can attest that there are several things like this in here that need to get cleaned up.