Fix for Hard Crash when Operative Temperature Controls are Combined with Kiva in a Single Simulation - #11772
Merged
Merged
Conversation
Using OpTemp control with Kiva and requesting the Zone Thermostat Operative Temperature output variable causes a hard crash because the ZnAirRpt structure has not been allocated yet. This solution moves the allocation up to right after the zones and spaces have been processed.
The initial solution moved multiple allocations, but this caused an issue in one of the spaces input files. The relocation of the spaceAirRpt was not necessary so it was put back to see if this resolves the issue.
This relatively simple unit test simple checks to see that the zone data was obtained and that the reporting arrays have been sized correctly. Pretty straightforward test for a fairly small, but important, fix.
mitchute
approved these changes
Sep 9, 2026
|
|
||
| // allocate the array the holds the predefined report data | ||
| state.dataHeatBal->ZonePreDefRep.allocate(state.dataGlobal->NumOfZones); | ||
| state.dataHeatBal->ZnAirRpt.allocate(state.dataGlobal->NumOfZones); |
Comment on lines
+562
to
+571
| "ZoneControl:Thermostat:OperativeTemperature,", | ||
| " Core_bottom Thermostat, !- Thermostat Name", | ||
| " Constant, !- Radiative Fraction Input Mode", | ||
| " 0.4; !- Fixed Radiative Fraction", | ||
| " ", | ||
| "Output:Variable,", | ||
| " *, !- Key Value", | ||
| " Zone Thermostat Operative Temperature, !- Variable Name", | ||
| " Hourly; !- Reporting Frequency", | ||
| " ", |
Collaborator
There was a problem hiding this comment.
Following the issue description, I added a bit to this test to check that this is working.
| EXPECT_EQ(construction.OutsideAbsorpThermal, emsThermalAbsorptance); | ||
| } | ||
|
|
||
| TEST_F(EnergyPlusFixture, GetZoneDataTest) |
Collaborator
There was a problem hiding this comment.
And testing that the right arrays are initialized is also good.
Collaborator
|
Thanks @RKStrand. All good here. Merging. |
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.
Pull request overview
Description of the purpose of this PR
When a user chooses to use operative temperature controls within an EnergyPlus simulation that also uses Kiva and requests the Zone Thermostat Operative Temperature output variable, a hard crash ensues because the ZnAirRpt array has not yet been allocated. This was happening in GetSimpleAirModelInputs, but this was after Kiva and also after the Zone Operative Temperature variable was set-up. So, the allocation of this array was moved up. Since it is only dependent on the number of zones and there was already another report variable like it that was based on the number of zones, the allocation statement was moved to that location at the end of GetZoneData where it more logically fits given the size of the array. Once this was done, the input file that was crashing successfully ran to completion. No diffs were noted in the test suite and none were expected. A new fairly simple unit test to ensure that this array is being size in GetZoneData was added. No changes to the documentation or the idf files was needed.
Pull Request Author
Reviewer