src/energyplus/ForwardTranslator/ForwardTranslateWaterHeaterMixed.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #include "../ForwardTranslator.hpp" | ||
| 7 | #include "../../model/Model.hpp" | ||
| 8 | #include "../../model/Schedule.hpp" | ||
| 9 | #include "../../model/Schedule_Impl.hpp" | ||
| 10 | #include "../../model/Node.hpp" | ||
| 11 | #include "../../model/Node_Impl.hpp" | ||
| 12 | #include "../../model/WaterHeaterMixed.hpp" | ||
| 13 | #include "../../model/WaterHeaterMixed_Impl.hpp" | ||
| 14 | #include "../../model/CurveCubic.hpp" | ||
| 15 | #include "../../model/CurveCubic_Impl.hpp" | ||
| 16 | #include "../../model/ThermalZone.hpp" | ||
| 17 | #include "../../model/ThermalZone_Impl.hpp" | ||
| 18 | #include "../../model/PlantLoop.hpp" | ||
| 19 | #include "../../model/PlantLoop_Impl.hpp" | ||
| 20 | #include "../../model/WaterHeaterSizing.hpp" | ||
| 21 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 22 | #include "../../utilities/core/Optional.hpp" | ||
| 23 | |||
| 24 | #include <utilities/idd/WaterHeater_Mixed_FieldEnums.hxx> | ||
| 25 | #include <utilities/idd/IddEnums.hxx> | ||
| 26 | #include <utilities/idd/IddFactory.hxx> | ||
| 27 | |||
| 28 | using namespace openstudio::model; | ||
| 29 | |||
| 30 | using namespace std; | ||
| 31 | |||
| 32 | namespace openstudio { | ||
| 33 | |||
| 34 | namespace energyplus { | ||
| 35 | |||
| 36 | 43 | boost::optional<IdfObject> ForwardTranslator::translateWaterHeaterMixed(WaterHeaterMixed& modelObject) { | |
| 37 | 43 | boost::optional<std::string> s; | |
| 38 | 43 | boost::optional<double> value; | |
| 39 | 43 | boost::optional<Schedule> schedule; | |
| 40 | |||
| 41 |
14/19✓ Branch 1 taken 43 times.
✓ Branch 4 taken 14 times.
✓ Branch 5 taken 29 times.
✓ Branch 7 taken 14 times.
✓ Branch 9 taken 2 times.
✓ Branch 10 taken 12 times.
✓ Branch 12 taken 2 times.
✓ Branch 15 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 17 taken 2 times.
✓ Branch 18 taken 41 times.
✓ Branch 20 taken 43 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 13 times.
✓ Branch 24 taken 30 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
102 | if (!(modelObject.plantLoop() || (modelObject.peakUseFlowRate() && modelObject.useFlowRateFractionSchedule()))) { |
| 42 |
7/7✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 13 times.
✓ Branch 10 taken 13 times.
✓ Branch 14 taken 13 times.
✓ Branch 17 taken 13 times.
✓ Branch 20 taken 13 times.
|
13 | LOG(Warn, |
| 43 | modelObject.briefDescription() << " will not be translated as it is not on a PlantLoop, and it does not have both a Peak Use Flow Rate " | ||
| 44 | "and a Use Flow Rate Fraction Schedule which is a required condition for stand-alone operation"); | ||
| 45 | 13 | return boost::none; | |
| 46 | } | ||
| 47 | |||
| 48 | // Name | ||
| 49 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::WaterHeater_Mixed, modelObject); |
| 50 | |||
| 51 | // Trigger translation of the WaterHeater:Sizing object, if any | ||
| 52 | 30 | bool hasWaterHeaterSizing = true; | |
| 53 | try { | ||
| 54 |
1/1✓ Branch 1 taken 30 times.
|
30 | auto siz = modelObject.waterHeaterSizing(); |
| 55 |
1/1✓ Branch 1 taken 30 times.
|
30 | translateAndMapModelObject(siz); |
| 56 | 30 | } catch (...) { | |
| 57 | ✗ | hasWaterHeaterSizing = false; | |
| 58 | ✗ | } | |
| 59 | |||
| 60 | // TankVolume | ||
| 61 | |||
| 62 |
2/3✓ Branch 1 taken 30 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 30 times.
|
30 | if (modelObject.isTankVolumeAutosized()) { |
| 63 | ✗ | idfObject.setString(WaterHeater_MixedFields::TankVolume, "Autosize"); | |
| 64 | ✗ | if (!hasWaterHeaterSizing) { | |
| 65 | ✗ | LOG(Error, modelObject.briefDescription() << " has its Tank Volume autosized but it does not have a WaterHeaterSizing object attached"); | |
| 66 | } | ||
| 67 | } else { | ||
| 68 |
1/1✓ Branch 1 taken 30 times.
|
30 | value = modelObject.tankVolume(); |
| 69 | |||
| 70 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 71 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::TankVolume, value.get()); |
| 72 | } | ||
| 73 | } | ||
| 74 | |||
| 75 | // SetpointTemperatureScheduleName | ||
| 76 | |||
| 77 |
1/1✓ Branch 1 taken 30 times.
|
30 | schedule = modelObject.setpointTemperatureSchedule(); |
| 78 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (schedule) { |
| 79 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | translateAndMapModelObject(schedule.get()); |
| 80 | |||
| 81 |
4/4✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
✓ Branch 7 taken 30 times.
✓ Branch 10 taken 30 times.
|
30 | idfObject.setString(WaterHeater_MixedFields::SetpointTemperatureScheduleName, schedule->name().get()); |
| 82 | } | ||
| 83 | |||
| 84 | // DeadbandTemperatureDifference | ||
| 85 | |||
| 86 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | value = modelObject.deadbandTemperatureDifference(); |
| 87 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 88 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::DeadbandTemperatureDifference, value.get()); |
| 89 | } | ||
| 90 | |||
| 91 | // MaximumTemperatureLimit | ||
| 92 | |||
| 93 |
1/1✓ Branch 1 taken 30 times.
|
30 | value = modelObject.maximumTemperatureLimit(); |
| 94 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 95 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::MaximumTemperatureLimit, value.get()); |
| 96 | } | ||
| 97 | |||
| 98 | // HeaterControlType | ||
| 99 | |||
| 100 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | s = modelObject.heaterControlType(); |
| 101 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (s) { |
| 102 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setString(WaterHeater_MixedFields::HeaterControlType, s.get()); |
| 103 | } | ||
| 104 | |||
| 105 | // HeaterMaximumCapacity | ||
| 106 | |||
| 107 |
2/3✓ Branch 1 taken 30 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 30 times.
|
30 | if (modelObject.isHeaterMaximumCapacityAutosized()) { |
| 108 | ✗ | idfObject.setString(WaterHeater_MixedFields::HeaterMaximumCapacity, "Autosize"); | |
| 109 | ✗ | if (!hasWaterHeaterSizing) { | |
| 110 | ✗ | LOG(Error, | |
| 111 | modelObject.briefDescription() << " has its Heater Maximum Capacity autosized but it does not have a WaterHeaterSizing object attached"); | ||
| 112 | } | ||
| 113 | } else { | ||
| 114 |
1/1✓ Branch 1 taken 30 times.
|
30 | value = modelObject.heaterMaximumCapacity(); |
| 115 | |||
| 116 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 117 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::HeaterMaximumCapacity, value.get()); |
| 118 | } | ||
| 119 | } | ||
| 120 | |||
| 121 | // HeaterMinimumCapacity | ||
| 122 | |||
| 123 |
1/1✓ Branch 1 taken 30 times.
|
30 | value = modelObject.heaterMinimumCapacity(); |
| 124 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
|
30 | if (value) { |
| 125 | ✗ | idfObject.setDouble(WaterHeater_MixedFields::HeaterMinimumCapacity, value.get()); | |
| 126 | } | ||
| 127 | |||
| 128 | // HeaterIgnitionMinimumFlowRate | ||
| 129 | |||
| 130 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | value = modelObject.heaterIgnitionMinimumFlowRate(); |
| 131 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 132 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::HeaterIgnitionMinimumFlowRate, value.get()); |
| 133 | } | ||
| 134 | |||
| 135 | // HeaterIgnitionDelay | ||
| 136 | |||
| 137 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | value = modelObject.heaterIgnitionDelay(); |
| 138 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 139 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::HeaterIgnitionDelay, value.get()); |
| 140 | } | ||
| 141 | |||
| 142 | // HeaterFuelType | ||
| 143 | |||
| 144 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | s = modelObject.heaterFuelType(); |
| 145 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (s) { |
| 146 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setString(WaterHeater_MixedFields::HeaterFuelType, s.get()); |
| 147 | } | ||
| 148 | |||
| 149 | // HeaterThermalEfficiency | ||
| 150 | |||
| 151 |
1/1✓ Branch 1 taken 30 times.
|
30 | value = modelObject.heaterThermalEfficiency(); |
| 152 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 153 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::HeaterThermalEfficiency, value.get()); |
| 154 | } | ||
| 155 | |||
| 156 | // PartLoadFactorCurveName | ||
| 157 | |||
| 158 |
2/3✓ Branch 1 taken 30 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 30 times.
|
60 | if (boost::optional<CurveCubic> c = modelObject.partLoadFactorCurve()) { |
| 159 | ✗ | boost::optional<IdfObject> _c = translateAndMapModelObject(c.get()); | |
| 160 | |||
| 161 | ✗ | if (_c) { | |
| 162 | ✗ | idfObject.setString(WaterHeater_MixedFields::PartLoadFactorCurveName, _c->name().get()); | |
| 163 | } | ||
| 164 | 30 | } | |
| 165 | |||
| 166 | // OffCycleParasiticFuelConsumptionRate | ||
| 167 | |||
| 168 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | value = modelObject.offCycleParasiticFuelConsumptionRate(); |
| 169 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 170 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::OffCycleParasiticFuelConsumptionRate, value.get()); |
| 171 | } | ||
| 172 | |||
| 173 | // OffCycleParasiticFuelType | ||
| 174 | |||
| 175 |
1/1✓ Branch 1 taken 30 times.
|
30 | s = modelObject.offCycleParasiticFuelType(); |
| 176 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (s) { |
| 177 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setString(WaterHeater_MixedFields::OffCycleParasiticFuelType, s.get()); |
| 178 | } | ||
| 179 | |||
| 180 | // OffCycleParasiticHeatFractiontoTank | ||
| 181 | |||
| 182 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | value = modelObject.offCycleParasiticHeatFractiontoTank(); |
| 183 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 184 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::OffCycleParasiticHeatFractiontoTank, value.get()); |
| 185 | } | ||
| 186 | |||
| 187 | // OnCycleParasiticFuelConsumptionRate | ||
| 188 | |||
| 189 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | value = modelObject.onCycleParasiticFuelConsumptionRate(); |
| 190 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 191 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::OnCycleParasiticFuelConsumptionRate, value.get()); |
| 192 | } | ||
| 193 | |||
| 194 | // OnCycleParasiticFuelType | ||
| 195 | |||
| 196 |
1/1✓ Branch 1 taken 30 times.
|
30 | s = modelObject.onCycleParasiticFuelType(); |
| 197 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (s) { |
| 198 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setString(WaterHeater_MixedFields::OnCycleParasiticFuelType, s.get()); |
| 199 | } | ||
| 200 | |||
| 201 | // OnCycleParasiticHeatFractiontoTank | ||
| 202 | |||
| 203 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | value = modelObject.onCycleParasiticHeatFractiontoTank(); |
| 204 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 205 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::OnCycleParasiticHeatFractiontoTank, value.get()); |
| 206 | } | ||
| 207 | |||
| 208 | // AmbientTemperatureIndicator | ||
| 209 | |||
| 210 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | s = modelObject.ambientTemperatureIndicator(); |
| 211 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (s) { |
| 212 |
4/5✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
✓ Branch 7 taken 30 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 30 times.
|
60 | if (istringEqual(s.get(), "ThermalZone")) { |
| 213 | ✗ | idfObject.setString(WaterHeater_MixedFields::AmbientTemperatureIndicator, "Zone"); | |
| 214 | } else { | ||
| 215 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setString(WaterHeater_MixedFields::AmbientTemperatureIndicator, s.get()); |
| 216 | } | ||
| 217 | |||
| 218 |
4/5✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
✓ Branch 7 taken 30 times.
✓ Branch 10 taken 30 times.
✗ Branch 11 not taken.
|
60 | if (istringEqual(s.get(), "Schedule")) { |
| 219 | // AmbientTemperatureScheduleName | ||
| 220 |
1/1✓ Branch 1 taken 30 times.
|
30 | schedule = modelObject.ambientTemperatureSchedule(); |
| 221 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (schedule) { |
| 222 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | translateAndMapModelObject(schedule.get()); |
| 223 | |||
| 224 |
4/4✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
✓ Branch 7 taken 30 times.
✓ Branch 10 taken 30 times.
|
30 | idfObject.setString(WaterHeater_MixedFields::AmbientTemperatureScheduleName, schedule->name().get()); |
| 225 | } | ||
| 226 | } | ||
| 227 | |||
| 228 |
4/5✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
✓ Branch 7 taken 30 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 30 times.
|
60 | if (istringEqual(s.get(), "Outdoors")) { |
| 229 | ✗ | if ((!modelObject.ambientTemperatureOutdoorAirNodeName()) || modelObject.ambientTemperatureOutdoorAirNodeName()->empty()) { | |
| 230 | ✗ | IdfObject oaNodeListIdf(openstudio::IddObjectType::OutdoorAir_NodeList); | |
| 231 | ✗ | auto name = modelObject.nameString() + " Outdoor Air Node"; | |
| 232 | ✗ | oaNodeListIdf.setString(0, name); | |
| 233 | ✗ | m_idfObjects.push_back(oaNodeListIdf); | |
| 234 | ✗ | idfObject.setString(WaterHeater_MixedFields::AmbientTemperatureOutdoorAirNodeName, name); | |
| 235 | ✗ | } | |
| 236 | } | ||
| 237 | } | ||
| 238 | |||
| 239 | // AmbientTemperatureZoneName | ||
| 240 | |||
| 241 |
2/3✓ Branch 1 taken 30 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 30 times.
|
60 | if (boost::optional<ThermalZone> zone = modelObject.ambientTemperatureThermalZone()) { |
| 242 | ✗ | if (zone) { | |
| 243 | ✗ | idfObject.setString(WaterHeater_MixedFields::AmbientTemperatureZoneName, zone->name().get()); | |
| 244 | } | ||
| 245 | 30 | } | |
| 246 | |||
| 247 | // AmbientTemperatureOutdoorAirNodeName | ||
| 248 |
1/1✓ Branch 1 taken 30 times.
|
30 | s = modelObject.ambientTemperatureOutdoorAirNodeName(); |
| 249 |
4/7✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 30 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 30 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 30 times.
|
30 | if (s && !s->empty()) { |
| 250 | ✗ | IdfObject oaNodeList(openstudio::IddObjectType::OutdoorAir_NodeList); | |
| 251 | ✗ | oaNodeList.setString(0, s.get()); | |
| 252 | ✗ | m_idfObjects.push_back(oaNodeList); | |
| 253 | ✗ | idfObject.setString(WaterHeater_MixedFields::AmbientTemperatureOutdoorAirNodeName, s.get()); | |
| 254 | ✗ | } else { | |
| 255 | // Even if there is no node defined, if user chooses the outdoor air indicator we need to make a node | ||
| 256 |
1/1✓ Branch 1 taken 30 times.
|
30 | auto indicator = modelObject.ambientTemperatureIndicator(); |
| 257 |
3/4✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 30 times.
|
60 | if (istringEqual(indicator, "Outdoors")) { |
| 258 | ✗ | std::string oaNodeName = modelObject.nameString() + " Ambient Temp OA Node"; | |
| 259 | ✗ | IdfObject oaNodeList(openstudio::IddObjectType::OutdoorAir_NodeList); | |
| 260 | ✗ | oaNodeList.setString(0, oaNodeName); | |
| 261 | ✗ | m_idfObjects.push_back(oaNodeList); | |
| 262 | ✗ | idfObject.setString(WaterHeater_MixedFields::AmbientTemperatureOutdoorAirNodeName, oaNodeName); | |
| 263 | ✗ | } | |
| 264 | 30 | } | |
| 265 | |||
| 266 | // OffCycleLossCoefficienttoAmbientTemperature | ||
| 267 | |||
| 268 |
1/1✓ Branch 1 taken 30 times.
|
30 | value = modelObject.offCycleLossCoefficienttoAmbientTemperature(); |
| 269 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 270 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::OffCycleLossCoefficienttoAmbientTemperature, value.get()); |
| 271 | } | ||
| 272 | |||
| 273 | // OffCycleLossFractiontoThermalZone | ||
| 274 | |||
| 275 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | value = modelObject.offCycleLossFractiontoThermalZone(); |
| 276 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 277 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::OffCycleLossFractiontoZone, value.get()); |
| 278 | } | ||
| 279 | |||
| 280 | // OnCycleLossCoefficienttoAmbientTemperature | ||
| 281 | |||
| 282 |
1/1✓ Branch 1 taken 30 times.
|
30 | value = modelObject.onCycleLossCoefficienttoAmbientTemperature(); |
| 283 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 284 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::OnCycleLossCoefficienttoAmbientTemperature, value.get()); |
| 285 | } | ||
| 286 | |||
| 287 | // OnCycleLossFractiontoThermalZone | ||
| 288 | |||
| 289 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | value = modelObject.onCycleLossFractiontoThermalZone(); |
| 290 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 291 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::OnCycleLossFractiontoZone, value.get()); |
| 292 | } | ||
| 293 | |||
| 294 | // PeakUseFlowRate | ||
| 295 | |||
| 296 |
1/1✓ Branch 1 taken 30 times.
|
30 | value = modelObject.peakUseFlowRate(); |
| 297 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 29 times.
|
30 | if (value) { |
| 298 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(WaterHeater_MixedFields::PeakUseFlowRate, value.get()); |
| 299 | } | ||
| 300 | |||
| 301 | // UseFlowRateFractionScheduleName | ||
| 302 | |||
| 303 |
1/1✓ Branch 1 taken 30 times.
|
30 | schedule = modelObject.useFlowRateFractionSchedule(); |
| 304 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 29 times.
|
30 | if (schedule) { |
| 305 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | translateAndMapModelObject(schedule.get()); |
| 306 | |||
| 307 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | idfObject.setString(WaterHeater_MixedFields::UseFlowRateFractionScheduleName, schedule->name().get()); |
| 308 | } | ||
| 309 | |||
| 310 | // ColdWaterSupplyTemperatureScheduleName | ||
| 311 | |||
| 312 |
1/1✓ Branch 1 taken 30 times.
|
30 | schedule = modelObject.coldWaterSupplyTemperatureSchedule(); |
| 313 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
|
30 | if (schedule) { |
| 314 | ✗ | translateAndMapModelObject(schedule.get()); | |
| 315 | |||
| 316 | ✗ | idfObject.setString(WaterHeater_MixedFields::ColdWaterSupplyTemperatureScheduleName, schedule->name().get()); | |
| 317 | } | ||
| 318 | |||
| 319 | // UseSideInletNodeName | ||
| 320 | |||
| 321 |
3/3✓ Branch 1 taken 30 times.
✓ Branch 3 taken 29 times.
✓ Branch 4 taken 1 time.
|
60 | if (boost::optional<ModelObject> mo = modelObject.supplyInletModelObject()) { |
| 322 |
3/4✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
✓ Branch 6 taken 29 times.
✗ Branch 7 not taken.
|
58 | if (boost::optional<Node> node = mo->optionalCast<Node>()) { |
| 323 |
2/2✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
|
29 | translateAndMapModelObject(node.get()); |
| 324 | |||
| 325 |
4/4✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
✓ Branch 7 taken 29 times.
✓ Branch 10 taken 29 times.
|
29 | idfObject.setString(WaterHeater_MixedFields::UseSideInletNodeName, node->name().get()); |
| 326 | 29 | } | |
| 327 | 30 | } | |
| 328 | |||
| 329 | // UseSideOutletNodeName | ||
| 330 | |||
| 331 |
3/3✓ Branch 1 taken 30 times.
✓ Branch 3 taken 29 times.
✓ Branch 4 taken 1 time.
|
60 | if (boost::optional<ModelObject> mo = modelObject.supplyOutletModelObject()) { |
| 332 |
3/4✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
✓ Branch 6 taken 29 times.
✗ Branch 7 not taken.
|
58 | if (boost::optional<Node> node = mo->optionalCast<Node>()) { |
| 333 |
2/2✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
|
29 | translateAndMapModelObject(node.get()); |
| 334 | |||
| 335 |
4/4✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
✓ Branch 7 taken 29 times.
✓ Branch 10 taken 29 times.
|
29 | idfObject.setString(WaterHeater_MixedFields::UseSideOutletNodeName, node->name().get()); |
| 336 | 29 | } | |
| 337 | 30 | } | |
| 338 | |||
| 339 | // UseSideEffectiveness | ||
| 340 | |||
| 341 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | value = modelObject.useSideEffectiveness(); |
| 342 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 343 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::UseSideEffectiveness, value.get()); |
| 344 | } | ||
| 345 | |||
| 346 | // SourceSideInletNodeName | ||
| 347 | |||
| 348 |
3/3✓ Branch 1 taken 30 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 28 times.
|
60 | if (boost::optional<ModelObject> mo = modelObject.demandInletModelObject()) { |
| 349 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Node> node = mo->optionalCast<Node>()) { |
| 350 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | translateAndMapModelObject(node.get()); |
| 351 | |||
| 352 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | idfObject.setString(WaterHeater_MixedFields::SourceSideInletNodeName, node->name().get()); |
| 353 | 2 | } | |
| 354 | 30 | } | |
| 355 | |||
| 356 | // SourceSideOutletNodeName | ||
| 357 | |||
| 358 |
3/3✓ Branch 1 taken 30 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 28 times.
|
60 | if (boost::optional<ModelObject> mo = modelObject.demandOutletModelObject()) { |
| 359 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
4 | if (boost::optional<Node> node = mo->optionalCast<Node>()) { |
| 360 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | translateAndMapModelObject(node.get()); |
| 361 | |||
| 362 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | idfObject.setString(WaterHeater_MixedFields::SourceSideOutletNodeName, node->name().get()); |
| 363 | 2 | } | |
| 364 | 30 | } | |
| 365 | |||
| 366 | // SourceSideEffectiveness | ||
| 367 | |||
| 368 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | value = modelObject.sourceSideEffectiveness(); |
| 369 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 370 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::SourceSideEffectiveness, value.get()); |
| 371 | } | ||
| 372 | |||
| 373 | // UseSideDesignFlowRate | ||
| 374 | |||
| 375 |
2/3✓ Branch 1 taken 30 times.
✓ Branch 3 taken 30 times.
✗ Branch 4 not taken.
|
30 | if (modelObject.isUseSideDesignFlowRateAutosized()) { |
| 376 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
60 | idfObject.setString(WaterHeater_MixedFields::UseSideDesignFlowRate, "Autosize"); |
| 377 | } else { | ||
| 378 | ✗ | value = modelObject.useSideDesignFlowRate(); | |
| 379 | |||
| 380 | ✗ | if (value) { | |
| 381 | ✗ | idfObject.setDouble(WaterHeater_MixedFields::UseSideDesignFlowRate, value.get()); | |
| 382 | } | ||
| 383 | } | ||
| 384 | |||
| 385 | // SourceSideDesignFlowRate | ||
| 386 | |||
| 387 |
2/3✓ Branch 1 taken 30 times.
✓ Branch 3 taken 30 times.
✗ Branch 4 not taken.
|
30 | if (modelObject.isSourceSideDesignFlowRateAutosized()) { |
| 388 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
60 | idfObject.setString(WaterHeater_MixedFields::SourceSideDesignFlowRate, "Autosize"); |
| 389 | } else { | ||
| 390 | ✗ | value = modelObject.sourceSideDesignFlowRate(); | |
| 391 | |||
| 392 | ✗ | if (value) { | |
| 393 | ✗ | idfObject.setDouble(WaterHeater_MixedFields::SourceSideDesignFlowRate, value.get()); | |
| 394 | } | ||
| 395 | } | ||
| 396 | |||
| 397 | // IndirectWaterHeatingRecoveryTime | ||
| 398 | |||
| 399 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | value = modelObject.indirectWaterHeatingRecoveryTime(); |
| 400 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (value) { |
| 401 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setDouble(WaterHeater_MixedFields::IndirectWaterHeatingRecoveryTime, value.get()); |
| 402 | } | ||
| 403 | |||
| 404 | // SourceSideFlowControlMode | ||
| 405 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | s = modelObject.sourceSideFlowControlMode(); |
| 406 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (s) { |
| 407 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setString(WaterHeater_MixedFields::SourceSideFlowControlMode, s.get()); |
| 408 | |||
| 409 |
4/5✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
✓ Branch 7 taken 30 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 30 times.
|
90 | if (openstudio::istringEqual("IndirectHeatAlternateSetpoint", s.get())) { |
| 410 | // IndirectAlternateSetpointTemperatureScheduleName | ||
| 411 | ✗ | schedule = modelObject.indirectAlternateSetpointTemperatureSchedule(); | |
| 412 | ✗ | if (schedule) { | |
| 413 | ✗ | translateAndMapModelObject(schedule.get()); | |
| 414 | ✗ | idfObject.setString(WaterHeater_MixedFields::IndirectAlternateSetpointTemperatureScheduleName, schedule->name().get()); | |
| 415 | } else { | ||
| 416 | ✗ | LOG(Error, "Something really wrong happened, the Source Side Control Mode is set to 'IndirectHeatAlternateSetpoint' yet " | |
| 417 | "there is no IndirectAlternateSetpointTemperatureScheduleName which is impossible per model logic for " | ||
| 418 | << modelObject.briefDescription()); | ||
| 419 | } | ||
| 420 | } | ||
| 421 | } | ||
| 422 | |||
| 423 | // EndUseSubcategory | ||
| 424 |
3/4✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
✓ Branch 8 taken 30 times.
✗ Branch 9 not taken.
|
60 | if ((s = modelObject.endUseSubcategory())) { |
| 425 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | idfObject.setString(WaterHeater_MixedFields::EndUseSubcategory, s.get()); |
| 426 | } | ||
| 427 | |||
| 428 |
1/1✓ Branch 1 taken 30 times.
|
30 | return boost::optional<IdfObject>(idfObject); |
| 429 | 43 | } | |
| 430 | |||
| 431 | } // namespace energyplus | ||
| 432 | |||
| 433 | } // namespace openstudio | ||
| 434 |