Skip to content

Conversation

@RKStrand
Copy link
Contributor

Pull request overview

Description of the purpose of this PR

A user file had a ZoneControl:Thermostat object which referred to a ThermostatSetpoint:* object that did not exist anywhere in the input file. As a result, the find index came back as zero which led to a hard crash due to an improper array index. The fix traps when this happens and issues a severe/fatal error describing what is wrong/what to fix while avoiding the hard crash. A unit test demonstrates this input situation and properly shows that this situation leads to the new error message. No differences are expected in the output since this fixes a bug that caused a hard crash and no files in the test suite actually crash.

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

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

RKStrand added 2 commits July 17, 2025 17:04
Added a trap/error to avoid a hard crash when a user either enters a blank or a non-valid control name in the ZoneControl:Thermostat object.  New code avoids the hard crash when the index is zero and provides users with an error message that points toward the path for correcting the issue.
A unit test was added to test the presence of an invalid thermostat object.  Here, an error is purposely put in the input where a ZoneControl:Thermostat tries to access a single heating setpoint definition that does not exist.  This verifies that an error is flagged.  Before the fix, this was simply a hard crash.
@RKStrand RKStrand added this to the EnergyPlus 25.2 milestone Jul 18, 2025
@RKStrand RKStrand requested review from Myoldmopar and mjwitte July 18, 2025 18:47
@RKStrand RKStrand self-assigned this Jul 18, 2025
@RKStrand RKStrand added the Defect Includes code to repair a defect in EnergyPlus label Jul 18, 2025
@rraustad
Copy link
Contributor

@RKStrand I took the liberty to expand on the warning message.

Copy link
Contributor

@rraustad rraustad left a comment

Choose a reason for hiding this comment

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

This looks good and works as expected.

@RKStrand
Copy link
Contributor Author

Thanks, @rraustad! Always open to improvements--this looks good. 😁


EXPECT_TRUE(compare_err_stream_substring("ZoneControl:Thermostat = ANOTHERZONE THERMOSTAT, control name = THISISINVALID was not found in "
"ThermostatSetpoint object type = ThermostatSetpoint:SingleHeating.",
true));
Copy link
Member

Choose a reason for hiding this comment

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

Yes yes yes, substring check! 💯

@Myoldmopar
Copy link
Member

This is a great little fix, thanks @RKStrand and @rraustad. The documentation issue is unrelated, I'm merging this.

@Myoldmopar Myoldmopar merged commit e3de1b5 into develop Aug 13, 2025
8 of 9 checks passed
@Myoldmopar Myoldmopar deleted the 11122ZoneControlThermostatMissingThermostatSetpointObject branch August 13, 2025 13:45
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.

User file crashes with ZoneControl:Thermostat but no ThermostatSetpoint:* objects

6 participants