Skip to content

Case sensitivity error in getWaterTankStratifiedInput #11289

@jmarrec

Description

@jmarrec

Issue overview

Case sensitivity error in getWaterTankStratifiedInput

ThermalStorage:ChilledWater:Stratified,
  Thermal Storage Chilled Water Stratified 1, !- Name
  50,                                     !- Tank Volume {m3}
  8,                                      !- Tank Height {m}
  VerticalCylinder,                       !- Tank Shape
  ,                                       !- Tank Perimeter {m}
  Schedule Ruleset 5,                     !- Setpoint Temperature Schedule Name
  2.5,                                    !- Deadband Temperature Difference {deltaC}
  ,                                       !- Temperature Sensor Height {m}
  ,                                       !- Minimum Temperature Limit {C}
  Autosize,                               !- Nominal Cooling Capacity {W}
  Outdoors,                               !- Ambient Temperature Indicator
  Schedule Ruleset 6,                     !- Ambient Temperature Schedule Name
  ,                                       !- Ambient Temperature Zone Name
  Thermal Storage Chilled Water Stratified 1 OA Node, !- Ambient Temperature Outdoor Air Node Name
  ,                                       !- Uniform Skin Loss Coefficient per Unit Area to Ambient Temperature {W/m2-K}
  Node 140,                               !- Use Side Inlet Node Name
  Node 141,                               !- Use Side Outlet Node Name
  1,                                      !- Use Side Heat Transfer Effectiveness
  ,                                       !- Use Side Availability Schedule Name
  Autocalculate,                          !- Use Side Inlet Height {m}
  0,                                      !- Use Side Outlet Height {m}
  Autosize,                               !- Use Side Design Flow Rate {m3/s}
  Node 51,                                !- Source Side Inlet Node Name
  Node 142,                               !- Source Side Outlet Node Name
  1,                                      !- Source Side Heat Transfer Effectiveness
  ,                                       !- Source Side Availability Schedule Name
  0,                                      !- Source Side Inlet Height {m}
  Autocalculate,                          !- Source Side Outlet Height {m}
  Autosize,                               !- Source Side Design Flow Rate {m3/s}
  4,                                      !- Tank Recovery Time {hr}
  Fixed,                                  !- Inlet Mode
  6,                                      !- Number of Nodes
  0,                                      !- Additional Destratification Conductivity {W/m-K}
  0,                                      !- Node 1 Additional Loss Coefficient {W/K}
  0,                                      !- Node 2 Additional Loss Coefficient {W/K}
  0,                                      !- Node 3 Additional Loss Coefficient {W/K}
  0,                                      !- Node 4 Additional Loss Coefficient {W/K}
  0,                                      !- Node 5 Additional Loss Coefficient {W/K}
  0,                                      !- Node 6 Additional Loss Coefficient {W/K}
  0,                                      !- Node 7 Additional Loss Coefficient {W/K}
  0,                                      !- Node 8 Additional Loss Coefficient {W/K}
  0,                                      !- Node 9 Additional Loss Coefficient {W/K}
  0;                                      !- Node 10 Additional Loss Coefficient {W/K}

Notice the casing "Autocalculate"

libc++abi: terminating due to uncaught exception of type nlohmann::json_abi_v3_12_0::detail::type_error: [json.exception.type_error.302] type must be number, but is string

(lldb) f 15
frame #15: 0x000000010798cba8 libenergyplusapi.25.2.0.dylib`EnergyPlus::WaterThermalTanks::getWaterTankStratifiedInput(state=0x000000016fdfbda8, objectType="ThermalStorage:ChilledWater:Stratified") at WaterThermalTanks.cc:3978:58
   3975          if (SourceOutletHeight == "AutoCalculate") {
   3976              Tank.SourceOutletHeight = Tank.Height;
   3977          } else {
-> 3978              Tank.SourceOutletHeight = SourceOutletHeight.get<Real64>();
   3979          }
   3980          if (Tank.SourceOutletHeight > Tank.Height) {
   3981              ShowSevereError(state,

(lldb) p SourceOutletHeight
(const nlohmann::basic_json<>::value_type) {
  m_data = {
    m_type = string
    m_value = {
      object = 0x0000000756076420 size=0
      array = 0x0000000756076420 size=error: Start of vector data begins after end pointer.
      string = "Autocalculate"
      binary = 0x0000000756076420
      boolean = true
      number_integer = 31508096032
      number_unsigned = 31508096032
      number_float = 1.5567067815278098E-313
    }
  }
}

Root cause:


Here this is field isn't even autocalculatable, so there should not be an if:

https://github.com/NREL/EnergyPlus/blob/0befe779fe9721745ba31a65f877cc05905ac6b3/src/EnergyPlus/WaterThermalTanks.cc#L3936-L3941

The field has a default, so getRealFieldValue should be used instead


Here you can see it correctly calls getRealFieldValue already on line 3972, so the block below is 1) pointless and 2) wrong.

https://github.com/NREL/EnergyPlus/blob/0befe779fe9721745ba31a65f877cc05905ac6b3/src/EnergyPlus/WaterThermalTanks.cc#L3972-L3979

Operating System (Multiple choices)

Any

Operating System Version

N/A

Version of EnergyPlus

v25.2.0-IOFreeze-RC2

Unmethours link or helpdesk ticket number

N/A

Defect file

  • DevSupport

Metadata

Metadata

Assignees

Labels

DefectIncludes code to repair a defect in EnergyPlus

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions