Repository navigation
Fix #5635 - ZoneHVACPackagedTerminalHeatPump writes a garbage DX Heating Coil Sizing Ratio - #5671
Open
PranaySiddharthBhange wants to merge 1 commit into
Conversation
…l Sizing Ratio dXHeatingCoilSizingRatio() called OS_ASSERT then .get() on the optional returned by getDouble(), which is undefined behavior when the field is unset and has no IDD default (it's a \required-field with no \default). In that case the model object silently returns whatever bytes happen to sit in the optional's internal storage, which the ForwardTranslator then writes straight into the IDF as a nonsensical value, causing EnergyPlus to reject the file. This field is normally always set by the constructor, so the unset case only shows up on objects built outside the normal constructor path (eg: a .clone() of a template that itself predates this field being set). Mirror the existing self-healing pattern used by supplyAirFanOperatingModeSchedule() just above it: log an error and fall back to the documented default of 1.0 instead of reading uninitialized memory. Fixes NatLabRockies#5635
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
ForwardTranslatorwrites an uninitialized/garbage double into "DXHeating Coil Sizing Ratio" for
ZoneHVAC:PackagedTerminalHeatPumpatscale (reported with 49+ such objects in one model).
Root cause
dXHeatingCoilSizingRatio()calledOS_ASSERTthen.get()on theboost::optional<double>returned bygetDouble(), which is undefinedbehavior when the field is unset and has no IDD default (it's a
\required-fieldwith no\default). In that case the model objectsilently returns whatever bytes happen to sit in the optional's internal
storage, which the ForwardTranslator then writes straight into the IDF as
a nonsensical value, causing EnergyPlus to reject the file.
This field is normally always set by the constructor, so the unset case
only shows up on objects built outside the normal constructor path (eg: a
.clone()of a template that itself predates this field being set).Fix
Mirror the existing self-healing pattern used by
supplyAirFanOperatingModeSchedule()just above it in the same file: logan error and fall back to the documented default of 1.0 instead of
reading uninitialized memory.
Pull Request Author
src/model/test)src/energyplus/Test)src/osversion/VersionTranslator.cpp)No API changes, no new/modified IDD fields, no VersionTranslation needed - this is a pure logic fix in the model accessor plus a regression test. Built locally (Conan2/CMake/Ninja, Release) and ran the full
openstudio_model_testssuite: 2245/2245 passed, no regressions. Did not build C# bindings locally.