Skip to content

Fix for Hard Crash when Operative Temperature Controls are Combined with Kiva in a Single Simulation - #11772

Merged
mitchute merged 4 commits into
developfrom
11733OpTempKivaOutputVarConflict
Sep 9, 2026
Merged

Fix for Hard Crash when Operative Temperature Controls are Combined with Kiva in a Single Simulation#11772
mitchute merged 4 commits into
developfrom
11733OpTempKivaOutputVarConflict

Conversation

@RKStrand

Copy link
Copy Markdown
Contributor

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

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies
  • If adding/removing any output files (e.g., eplustbl.*)
    • Update ..\scripts\Epl-run.bat
    • Update ..\scripts\RunEPlus.bat
    • Update ..\src\EPLaunch\ MainModule.bas, epl-ui.frm, and epl.vbp (VersionComments)
    • Update ...github\workflows\energyplus.py

Reviewer

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

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.
@RKStrand
RKStrand requested a review from mitchute August 31, 2026 19:00
@RKStrand RKStrand self-assigned this Aug 31, 2026
@RKStrand RKStrand added the Defect Includes code to repair a defect in EnergyPlus label Aug 31, 2026

@mitchute mitchute left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @RKStrand. All good here.


// allocate the array the holds the predefined report data
state.dataHeatBal->ZonePreDefRep.allocate(state.dataGlobal->NumOfZones);
state.dataHeatBal->ZnAirRpt.allocate(state.dataGlobal->NumOfZones);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple enough.

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",
" ",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And testing that the right arrays are initialized is also good.

@mitchute

mitchute commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Thanks @RKStrand. All good here. Merging.

@mitchute
mitchute merged commit 26db718 into develop Sep 9, 2026
8 checks passed
@mitchute
mitchute deleted the 11733OpTempKivaOutputVarConflict branch September 9, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Defect Includes code to repair a defect in EnergyPlus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Operative Temperature Thermostat and Kiva Conflict Causing Crash

3 participants