Skip to content

Fix #7806 - ExpandObjects error handling#11646

Open
jmarrec wants to merge 5 commits into
developfrom
7806_ExpandObjects_ErrorHandling
Open

Fix #7806 - ExpandObjects error handling#11646
jmarrec wants to merge 5 commits into
developfrom
7806_ExpandObjects_ErrorHandling

Conversation

@jmarrec

@jmarrec jmarrec commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Pull request overview

Description of the purpose of this PR

  • ExpandObjects return exit code 1 when a Severe is Issued
  • If E+ itself calls ExpandObjects via -x flag, terminate if it returns non zero
  • If calling E+ on an .idf that has Fatal Output:PreprocessorMessage, we issue those instead of terminating after the Schema Validation, by moving the preProcessorCheck into the InputProcessor instead of SimulationManager::PostIPProcessing

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

jmarrec added 5 commits June 18, 2026 15:07
errorCondition/hadSevereError booleans replaced with numErrors/numWarnings counters, and the exit message now mirrors EnergyPlus's own style — "ExpandObjects
  Completed Successfully-- N Warning; 0 Severe Errors. Time:" or "ExpandObjects Terminated--Error(s) Detected. N Warning; N Severe Errors. Time:", with exit code still driven by numErrors > 0
…an report them even if schema validation fails
@jmarrec jmarrec self-assigned this Jun 18, 2026
@jmarrec jmarrec added the Defect Includes code to repair a defect in EnergyPlus label Jun 18, 2026
@jmarrec

jmarrec commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

Live testing, using https://github.com/NatLabRockies/EnergyPlusDevSupport/blob/master/DefectFiles/7000s/7806/VAV_Sys_26_2_0.idf (I translated it from the original 9.2 IDF)

Before:

ExpandObjects returns 0, so E+ still tries to simulate it, and only the schema validation errors happen.

$ $ep_build_rel-develop/Products/energyplus -x -D -d out-ori VAV_Sys_26_2_0.idf 
ExpandObjects Started.
 Begin reading Energy+.idd file.
 Done reading Energy+.idd file.
ExpandObjects Finished with Error(s). Time:     0.040
EnergyPlus Starting
EnergyPlus, Version 26.2.0-7cfca988f9, YMD=2026.06.18 17:38
**FATAL:Errors occurred on processing input file. Preceding condition(s) cause termination.
EnergyPlus Run Time=00hr 00min  0.08sec
Program terminated: EnergyPlus Terminated--Error(s) Detected.

$ cat out-ori/eplusout.err 
Program Version,EnergyPlus, Version 26.2.0-7cfca988f9, YMD=2026.06.18 17:38,
   ** Severe  ** Line: 4459 Index: 10 - Field cannot be Autosize or Autocalculate
   ** Severe  ** Line: 4461 Index: 10 - Field cannot be Autosize or Autocalculate
   ** Severe  ** <root>[Connector:Splitter][Chiled Water Loop CndW Supply Splitter][branches][20] - Missing required property 'outlet_branch_name'.
   **  Fatal  ** Errors occurred on processing input file. Preceding condition(s) cause termination.
   ...Summary of Errors that led to program termination:
   ..... Reference severe error count=3
   ..... Last severe error=<root>[Connector:Splitter][Chiled Water Loop CndW Supply Splitter][branches][20] - Missing required property 'outlet_branch_name'.
   ************* Warning:  Node connection errors not checked - most system input has not been read (see previous warning).
   ************* Fatal error -- final processing.  Program exited before simulations began.  See previous error messages.
   ************* EnergyPlus Warmup Error Summary. During Warmup: 0 Warning; 0 Severe Errors.
   ************* EnergyPlus Sizing Error Summary. During Sizing: 0 Warning; 0 Severe Errors.
   ************* EnergyPlus Terminated--Fatal Error Detected. 0 Warning; 3 Severe Errors; Elapsed Time=00hr 00min  0.08se

Now:

ExpandObjects returned 1, so E+ stops there.

$ $ep_build_rel/Products/energyplus -x -D -d out-new VAV_Sys_26_2_0.idf 
ExpandObjects Started.
 Begin reading Energy+.idd file.
 Done reading Energy+.idd file.
ExpandObjects Terminated--Error(s) Detected. 1 Warning; 1 Severe Errors; Time:     0.048
ERROR: ExpandObjects failed to expand the HVACTemplate:* or GroundHeatTransfer:* objects in this input file.
See /home/julien/Software/Others/EnergyPlusDevSupport/DefectFiles/7000s/7806/out-new/eplusout.experr for details.

If I try to run the expidf anyways, I get the schema validation errors AND the Output:ProcessorMessage into the eplusout.err

$ cd out-new
$ $ep_build_rel/Products/energyplus -D -d out-force in.idf
EnergyPlus Starting
EnergyPlus, Version 26.2.0-24256e83e2, YMD=2026.06.18 17:42
**FATAL:Errors occurred on processing input file. Preceding condition(s) cause termination.
EnergyPlus Run Time=00hr 00min  0.07sec
Program terminated: EnergyPlus Terminated--Error(s) Detected.

$ cat out-force/eplusout.err 
Program Version,EnergyPlus, Version 26.2.0-24256e83e2, YMD=2026.06.18 17:42,
   ** Severe  ** Line: 4459 Index: 10 - Field cannot be Autosize or Autocalculate
   ** Severe  ** Line: 4461 Index: 10 - Field cannot be Autosize or Autocalculate
   ** Severe  ** <root>[Connector:Splitter][Chiled Water Loop CndW Supply Splitter][branches][20] - Missing required property 'outlet_branch_name'.
   ** Warning ** Output:PreprocessorMessage="ExpandObjects" has the following Warning conditions:
   **   ~~~   ** Warning:  In HVACTemplate:System:VAV "VAV" there is no Heating Coil and no
   **   ~~~   ** Preheat Coil. The Preheat Coil Design Setpoint will be used for the
   **   ~~~   ** Sizing:System Central Heating Design Supply Air Temperature. This will be
   **   ~~~   ** the inlet air temperature for sizing reheat coils.
   ** Severe  ** Output:PreprocessorMessage="ExpandObjects" has the following Fatal conditions:
   **   ~~~   ** Severe:  In HVACTemplate:Plant:ChilledWaterLoop "Chiled Water Loop" there
   **   ~~~   ** is one or more water cooled chiller(s) but there are no towers serving this
   **   ~~~   ** loop.
   **  Fatal  ** Errors occurred on processing input file. Preceding condition(s) cause termination.
   ...Summary of Errors that led to program termination:
   ..... Reference severe error count=4
   ..... Last severe error=Output:PreprocessorMessage="ExpandObjects" has the following Fatal conditions:
   ************* Warning:  Node connection errors not checked - most system input has not been read (see previous warning).
   ************* Fatal error -- final processing.  Program exited before simulations began.  See previous error messages.
   ************* EnergyPlus Warmup Error Summary. During Warmup: 0 Warning; 0 Severe Errors.
   ************* EnergyPlus Sizing Error Summary. During Sizing: 0 Warning; 0 Severe Errors.
   ************* EnergyPlus Terminated--Fatal Error Detected. 1 Warning; 4 Severe Errors; Elapsed Time=00hr 00min  0.07sec


if (!is_valid || hasErrors || unsupportedFound) {
ShowFatalError(state, "Errors occurred on processing input file. Preceding condition(s) cause termination.");
}

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.

Don't you still want to fatal out on these before proceeding? If the IDF/epJSON are bad, is there any need to continue processing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

    bool const PreP_Fatal = preProcessorCheck(state);

    if (!is_valid || hasErrors || unsupportedFound || PreP_Fatal) {
        ShowFatalError(state, "Errors occurred on processing input file. Preceding condition(s) cause termination.");
    }

is a few lines after, so it will throw, but just will also have issued the Output:ProcessorMessages (if any) beforehand anwyays.


if (!is_valid || hasErrors || unsupportedFound) {
ShowFatalError(state, "Errors occurred on processing input file. Preceding condition(s) cause termination.");
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

    bool const PreP_Fatal = preProcessorCheck(state);

    if (!is_valid || hasErrors || unsupportedFound || PreP_Fatal) {
        ShowFatalError(state, "Errors occurred on processing input file. Preceding condition(s) cause termination.");
    }

is a few lines after, so it will throw, but just will also have issued the Output:ProcessorMessages (if any) beforehand anwyays.

Comment on lines +311 to +318
// Check for Output:PreprocessorMessage objects here, before the fatal abort below, so that a
// preprocessor's actual root-cause message (e.g. from ExpandObjects) is shown to the user even
// when the preprocessor's malformed output also triggers epJSON schema validation errors.
bool const PreP_Fatal = preProcessorCheck(state);

if (!is_valid || hasErrors || unsupportedFound || PreP_Fatal) {
ShowFatalError(state, "Errors occurred on processing input file. Preceding condition(s) cause termination.");
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

New check is here. Will have issued the Output:PreProcessorMessage warnings anyways.

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.

ExpandObjects generates bad file and InputProcessor fails to parse

3 participants