src/sdd/MapHVAC.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 "ReverseTranslator.hpp" | ||
| 7 | #include "ForwardTranslator.hpp" | ||
| 8 | #include "Helpers.hpp" | ||
| 9 | |||
| 10 | #include "../model/AirLoopHVAC.hpp" | ||
| 11 | #include "../model/AirLoopHVAC_Impl.hpp" | ||
| 12 | #include "../model/AirLoopHVACUnitarySystem.hpp" | ||
| 13 | #include "../model/AirLoopHVACUnitarySystem_Impl.hpp" | ||
| 14 | #include "../model/ControllerMechanicalVentilation.hpp" | ||
| 15 | #include "../model/ControllerMechanicalVentilation_Impl.hpp" | ||
| 16 | #include "../model/AirLoopHVACZoneSplitter.hpp" | ||
| 17 | #include "../model/AirLoopHVACZoneSplitter_Impl.hpp" | ||
| 18 | #include "../model/AirLoopHVACOutdoorAirSystem.hpp" | ||
| 19 | #include "../model/AirLoopHVACOutdoorAirSystem_Impl.hpp" | ||
| 20 | #include "../model/ControllerOutdoorAir.hpp" | ||
| 21 | #include "../model/FanConstantVolume.hpp" | ||
| 22 | #include "../model/FanConstantVolume_Impl.hpp" | ||
| 23 | #include "../model/FanVariableVolume.hpp" | ||
| 24 | #include "../model/FanVariableVolume_Impl.hpp" | ||
| 25 | #include "../model/FanOnOff.hpp" | ||
| 26 | #include "../model/FanOnOff_Impl.hpp" | ||
| 27 | #include "../model/FanZoneExhaust.hpp" | ||
| 28 | #include "../model/FanZoneExhaust_Impl.hpp" | ||
| 29 | #include "../model/CoilHeatingWaterToAirHeatPumpEquationFit.hpp" | ||
| 30 | #include "../model/CoilHeatingWaterToAirHeatPumpEquationFit_Impl.hpp" | ||
| 31 | #include "../model/CoilCoolingWaterToAirHeatPumpEquationFit.hpp" | ||
| 32 | #include "../model/CoilCoolingWaterToAirHeatPumpEquationFit_Impl.hpp" | ||
| 33 | #include "../model/CoilCoolingDXSingleSpeed.hpp" | ||
| 34 | #include "../model/CoilCoolingDXSingleSpeed_Impl.hpp" | ||
| 35 | #include "../model/CoilCoolingDXTwoSpeed.hpp" | ||
| 36 | #include "../model/CoilCoolingDXMultiSpeed.hpp" | ||
| 37 | #include "../model/CoilHeatingGas.hpp" | ||
| 38 | #include "../model/CoilHeatingGas_Impl.hpp" | ||
| 39 | #include "../model/CoilHeatingElectric.hpp" | ||
| 40 | #include "../model/CoilHeatingDXSingleSpeed.hpp" | ||
| 41 | #include "../model/CoilWaterHeatingAirToWaterHeatPump.hpp" | ||
| 42 | #include "../model/CoilWaterHeatingAirToWaterHeatPump_Impl.hpp" | ||
| 43 | #include "../model/ControllerWaterCoil.hpp" | ||
| 44 | #include "../model/ControllerWaterCoil_Impl.hpp" | ||
| 45 | #include "../model/CurveBiquadratic.hpp" | ||
| 46 | #include "../model/CurveBiquadratic_Impl.hpp" | ||
| 47 | #include "../model/CurveLinear.hpp" | ||
| 48 | #include "../model/CurveLinear_Impl.hpp" | ||
| 49 | #include "../model/CurveQuadLinear.hpp" | ||
| 50 | #include "../model/CurveQuadLinear_Impl.hpp" | ||
| 51 | #include "../model/CurveQuintLinear.hpp" | ||
| 52 | #include "../model/CurveQuintLinear_Impl.hpp" | ||
| 53 | #include "../model/CurveCubic.hpp" | ||
| 54 | #include "../model/CurveCubic_Impl.hpp" | ||
| 55 | #include "../model/CurveQuadratic.hpp" | ||
| 56 | #include "../model/CurveQuadratic_Impl.hpp" | ||
| 57 | #include "../model/Curve.hpp" | ||
| 58 | #include "../model/Curve_Impl.hpp" | ||
| 59 | #include "../model/TableLookup.hpp" | ||
| 60 | #include "../model/TableLookup_Impl.hpp" | ||
| 61 | #include "../model/TableIndependentVariable.hpp" | ||
| 62 | #include "../model/Duct.hpp" | ||
| 63 | #include "../model/Duct_Impl.hpp" | ||
| 64 | #include "../model/ScheduleRuleset.hpp" | ||
| 65 | #include "../model/ScheduleDay.hpp" | ||
| 66 | #include "../model/ScheduleDay_Impl.hpp" | ||
| 67 | #include "../model/ScheduleYear.hpp" | ||
| 68 | #include "../model/ScheduleYear_Impl.hpp" | ||
| 69 | #include "../model/ScheduleWeek.hpp" | ||
| 70 | #include "../model/ScheduleWeek_Impl.hpp" | ||
| 71 | #include "../model/SizingZone.hpp" | ||
| 72 | #include "../model/SizingZone_Impl.hpp" | ||
| 73 | #include "../model/Node.hpp" | ||
| 74 | #include "../model/Node_Impl.hpp" | ||
| 75 | #include "../model/Space.hpp" | ||
| 76 | #include "../model/Space_Impl.hpp" | ||
| 77 | #include "../model/AirConditionerVariableRefrigerantFlow.hpp" | ||
| 78 | #include "../model/AirConditionerVariableRefrigerantFlow_Impl.hpp" | ||
| 79 | #include "../model/AvailabilityManagerOptimumStart.hpp" | ||
| 80 | #include "../model/AvailabilityManagerOptimumStart_Impl.hpp" | ||
| 81 | #include "../model/AvailabilityManagerNightCycle.hpp" | ||
| 82 | #include "../model/AvailabilityManagerNightCycle_Impl.hpp" | ||
| 83 | #include "../model/CoilCoolingDXVariableRefrigerantFlow.hpp" | ||
| 84 | #include "../model/CoilCoolingDXVariableRefrigerantFlow_Impl.hpp" | ||
| 85 | #include "../model/CoilHeatingDXVariableRefrigerantFlow.hpp" | ||
| 86 | #include "../model/CoilHeatingDXVariableRefrigerantFlow_Impl.hpp" | ||
| 87 | #include "../model/DesignSpecificationOutdoorAir.hpp" | ||
| 88 | #include "../model/DesignSpecificationOutdoorAir_Impl.hpp" | ||
| 89 | #include "../model/CoolingTowerSingleSpeed.hpp" | ||
| 90 | #include "../model/CoolingTowerSingleSpeed_Impl.hpp" | ||
| 91 | #include "../model/CoolingTowerVariableSpeed.hpp" | ||
| 92 | #include "../model/CoolingTowerVariableSpeed_Impl.hpp" | ||
| 93 | #include "../model/SetpointManagerFollowOutdoorAirTemperature.hpp" | ||
| 94 | #include "../model/SetpointManagerFollowOutdoorAirTemperature_Impl.hpp" | ||
| 95 | #include "../model/SetpointManagerMixedAir.hpp" | ||
| 96 | #include "../model/SetpointManagerMixedAir_Impl.hpp" | ||
| 97 | #include "../model/SetpointManagerSingleZoneReheat.hpp" | ||
| 98 | #include "../model/SetpointManagerSingleZoneReheat_Impl.hpp" | ||
| 99 | #include "../model/SetpointManagerScheduled.hpp" | ||
| 100 | #include "../model/SetpointManagerScheduled_Impl.hpp" | ||
| 101 | #include "../model/SetpointManagerScheduledDualSetpoint.hpp" | ||
| 102 | #include "../model/SetpointManagerScheduledDualSetpoint_Impl.hpp" | ||
| 103 | #include "../model/SetpointManagerWarmest.hpp" | ||
| 104 | #include "../model/SetpointManagerWarmest_Impl.hpp" | ||
| 105 | #include "../model/SetpointManagerWarmestTemperatureFlow.hpp" | ||
| 106 | #include "../model/SetpointManagerWarmestTemperatureFlow_Impl.hpp" | ||
| 107 | #include "../model/SetpointManagerOutdoorAirReset.hpp" | ||
| 108 | #include "../model/SetpointManagerOutdoorAirReset_Impl.hpp" | ||
| 109 | #include "../model/ThermalZone.hpp" | ||
| 110 | #include "../model/ThermalZone_Impl.hpp" | ||
| 111 | #include "../model/ThermalStorageChilledWaterStratified.hpp" | ||
| 112 | #include "../model/ThermalStorageChilledWaterStratified_Impl.hpp" | ||
| 113 | #include "../model/AirTerminalSingleDuctConstantVolumeCooledBeam.hpp" | ||
| 114 | #include "../model/AirTerminalSingleDuctConstantVolumeNoReheat.hpp" | ||
| 115 | #include "../model/AirTerminalSingleDuctVAVReheat.hpp" | ||
| 116 | #include "../model/AirTerminalSingleDuctVAVNoReheat.hpp" | ||
| 117 | #include "../model/AirTerminalSingleDuctParallelPIUReheat.hpp" | ||
| 118 | #include "../model/AirTerminalSingleDuctParallelPIUReheat_Impl.hpp" | ||
| 119 | #include "../model/AirTerminalSingleDuctSeriesPIUReheat.hpp" | ||
| 120 | #include "../model/AirTerminalSingleDuctSeriesPIUReheat_Impl.hpp" | ||
| 121 | #include "../model/ThermostatSetpointDualSetpoint.hpp" | ||
| 122 | #include "../model/ThermostatSetpointDualSetpoint_Impl.hpp" | ||
| 123 | #include "../model/Schedule.hpp" | ||
| 124 | #include "../model/Schedule_Impl.hpp" | ||
| 125 | #include "../model/PumpConstantSpeed.hpp" | ||
| 126 | #include "../model/PumpConstantSpeed_Impl.hpp" | ||
| 127 | #include "../model/PumpVariableSpeed.hpp" | ||
| 128 | #include "../model/PumpVariableSpeed_Impl.hpp" | ||
| 129 | #include "../model/PlantEquipmentOperationHeatingLoad.hpp" | ||
| 130 | #include "../model/PlantEquipmentOperationHeatingLoad_Impl.hpp" | ||
| 131 | #include "../model/PlantEquipmentOperationCoolingLoad.hpp" | ||
| 132 | #include "../model/PlantEquipmentOperationCoolingLoad_Impl.hpp" | ||
| 133 | #include "../model/BoilerHotWater.hpp" | ||
| 134 | #include "../model/BoilerHotWater_Impl.hpp" | ||
| 135 | #include "../model/ChillerElectricEIR.hpp" | ||
| 136 | #include "../model/ChillerElectricEIR_Impl.hpp" | ||
| 137 | #include "../model/ChillerAbsorptionIndirect.hpp" | ||
| 138 | #include "../model/ChillerAbsorptionIndirect_Impl.hpp" | ||
| 139 | #include "../model/CoilCoolingCooledBeam.hpp" | ||
| 140 | #include "../model/CoilCoolingCooledBeam_Impl.hpp" | ||
| 141 | #include "../model/CoilCoolingWater.hpp" | ||
| 142 | #include "../model/CoilCoolingWater_Impl.hpp" | ||
| 143 | #include "../model/CoilHeatingWater.hpp" | ||
| 144 | #include "../model/CoilHeatingWater_Impl.hpp" | ||
| 145 | #include "../model/WaterToAirComponent.hpp" | ||
| 146 | #include "../model/WaterToAirComponent_Impl.hpp" | ||
| 147 | #include "../model/HeatExchangerAirToAirSensibleAndLatent.hpp" | ||
| 148 | #include "../model/HeatExchangerAirToAirSensibleAndLatent_Impl.hpp" | ||
| 149 | #include "../model/PlantLoop.hpp" | ||
| 150 | #include "../model/PlantLoop_Impl.hpp" | ||
| 151 | #include "../model/ZoneHVACComponent.hpp" | ||
| 152 | #include "../model/ZoneHVACComponent_Impl.hpp" | ||
| 153 | #include "../model/ZoneHVACTerminalUnitVariableRefrigerantFlow.hpp" | ||
| 154 | #include "../model/ZoneHVACTerminalUnitVariableRefrigerantFlow_Impl.hpp" | ||
| 155 | #include "../model/ZoneHVACPackagedTerminalAirConditioner.hpp" | ||
| 156 | #include "../model/ZoneHVACPackagedTerminalAirConditioner_Impl.hpp" | ||
| 157 | #include "../model/ZoneHVACPackagedTerminalHeatPump.hpp" | ||
| 158 | #include "../model/ZoneHVACPackagedTerminalHeatPump_Impl.hpp" | ||
| 159 | #include "../model/ZoneHVACWaterToAirHeatPump.hpp" | ||
| 160 | #include "../model/ZoneHVACWaterToAirHeatPump_Impl.hpp" | ||
| 161 | #include "../model/ZoneHVACFourPipeFanCoil.hpp" | ||
| 162 | #include "../model/ZoneHVACFourPipeFanCoil_Impl.hpp" | ||
| 163 | #include "../model/ZoneHVACBaseboardConvectiveElectric.hpp" | ||
| 164 | #include "../model/ZoneHVACBaseboardConvectiveElectric_Impl.hpp" | ||
| 165 | #include "../model/ZoneHVACBaseboardConvectiveWater.hpp" | ||
| 166 | #include "../model/ZoneHVACBaseboardConvectiveWater_Impl.hpp" | ||
| 167 | #include "../model/ZoneVentilationDesignFlowRate.hpp" | ||
| 168 | #include "../model/ZoneVentilationDesignFlowRate_Impl.hpp" | ||
| 169 | #include "../model/CoilHeatingWaterBaseboard.hpp" | ||
| 170 | #include "../model/CoilHeatingWaterBaseboard_Impl.hpp" | ||
| 171 | #include "../model/WaterHeaterMixed.hpp" | ||
| 172 | #include "../model/WaterHeaterMixed_Impl.hpp" | ||
| 173 | #include "../model/WaterHeaterHeatPump.hpp" | ||
| 174 | #include "../model/WaterHeaterHeatPump_Impl.hpp" | ||
| 175 | #include "../model/Model.hpp" | ||
| 176 | #include "../model/PortList.hpp" | ||
| 177 | #include "../model/SizingPlant.hpp" | ||
| 178 | #include "../model/SizingPlant_Impl.hpp" | ||
| 179 | #include "../model/SizingSystem.hpp" | ||
| 180 | #include "../model/SizingSystem_Impl.hpp" | ||
| 181 | #include "../model/AirTerminalSingleDuctVAVReheat_Impl.hpp" | ||
| 182 | #include "../model/PipeAdiabatic.hpp" | ||
| 183 | #include "../model/PipeAdiabatic_Impl.hpp" | ||
| 184 | #include "../model/Splitter.hpp" | ||
| 185 | #include "../model/Splitter_Impl.hpp" | ||
| 186 | #include "../model/Mixer.hpp" | ||
| 187 | #include "../model/Mixer_Impl.hpp" | ||
| 188 | #include "../model/EvaporativeCoolerDirectResearchSpecial.hpp" | ||
| 189 | #include "../model/EvaporativeCoolerDirectResearchSpecial_Impl.hpp" | ||
| 190 | #include "../model/EvaporativeCoolerIndirectResearchSpecial.hpp" | ||
| 191 | #include "../model/EvaporativeCoolerIndirectResearchSpecial_Impl.hpp" | ||
| 192 | #include "../model/HeatExchangerFluidToFluid.hpp" | ||
| 193 | #include "../model/HeatExchangerFluidToFluid_Impl.hpp" | ||
| 194 | #include "../model/DaylightingControl.hpp" | ||
| 195 | #include "../utilities/units/QuantityConverter.hpp" | ||
| 196 | #include "../utilities/units/Quantity.hpp" | ||
| 197 | #include "../utilities/units/IPUnit.hpp" | ||
| 198 | #include "../utilities/units/SIUnit.hpp" | ||
| 199 | #include "../utilities/units/BTUUnit.hpp" | ||
| 200 | #include "../utilities/units/CFMUnit.hpp" | ||
| 201 | #include "../utilities/units/FahrenheitUnit.hpp" | ||
| 202 | #include "../utilities/units/MPHUnit.hpp" | ||
| 203 | #include "../utilities/units/WhUnit.hpp" | ||
| 204 | #include "../utilities/core/Assert.hpp" | ||
| 205 | #include "../utilities/core/StringHelpers.hpp" | ||
| 206 | #include "../utilities/time/Time.hpp" | ||
| 207 | #include "../utilities/time/Date.hpp" | ||
| 208 | #include "../utilities/units/UnitFactory.hpp" | ||
| 209 | #include "../utilities/math/FloatCompare.hpp" | ||
| 210 | #include "../utilities/geometry/Geometry.hpp" | ||
| 211 | #include "../utilities/geometry/Point3d.hpp" | ||
| 212 | #include "../utilities/geometry/BoundingBox.hpp" | ||
| 213 | |||
| 214 | #include <cmath> | ||
| 215 | #include <functional> | ||
| 216 | |||
| 217 | #include <pugixml.hpp> | ||
| 218 | #include <fmt/format.h> | ||
| 219 | |||
| 220 | namespace openstudio { | ||
| 221 | namespace sdd { | ||
| 222 | |||
| 223 | constexpr double footToMeter = 0.3048; | ||
| 224 | constexpr double cpWater = 4180.0; | ||
| 225 | constexpr double densityWater = 1000.0; | ||
| 226 | |||
| 227 | // Adjust scheduleDay by delaying the start and stop by the respective offset | ||
| 228 | // This is used by the OA Controller ventilation schedule | ||
| 229 | 60 | void adjustScheduleDay(model::ScheduleDay& scheduleDay, int startOffset) { | |
| 230 |
1/1✓ Branch 1 taken 60 times.
|
60 | std::vector<double> values = scheduleDay.values(); |
| 231 |
1/1✓ Branch 1 taken 60 times.
|
60 | std::vector<Time> times = scheduleDay.times(); |
| 232 | |||
| 233 | 60 | std::vector<double>::iterator valueIt; | |
| 234 | 60 | std::vector<Time>::iterator timeIt; | |
| 235 | |||
| 236 | 60 | timeIt = times.begin() + 1; | |
| 237 |
2/2✓ Branch 6 taken 1380 times.
✓ Branch 7 taken 60 times.
|
1440 | for (valueIt = values.begin() + 1; valueIt < values.end(); ++valueIt) { |
| 238 |
6/6✓ Branch 2 taken 1035 times.
✓ Branch 3 taken 345 times.
✓ Branch 7 taken 50 times.
✓ Branch 8 taken 985 times.
✓ Branch 9 taken 50 times.
✓ Branch 10 taken 1330 times.
|
1380 | if (equal<double>(*valueIt, 1.0, 0.01) && equal<double>(*(valueIt - 1), 0.0, 0.01)) { |
| 239 |
1/1✓ Branch 1 taken 50 times.
|
50 | Time newStartTime; |
| 240 | |||
| 241 |
3/3✓ Branch 1 taken 50 times.
✓ Branch 6 taken 50 times.
✓ Branch 9 taken 50 times.
|
50 | newStartTime = *(timeIt - 1) + Time(0, startOffset); |
| 242 | |||
| 243 |
1/1✓ Branch 3 taken 50 times.
|
50 | scheduleDay.removeValue(*(timeIt - 1)); |
| 244 | |||
| 245 |
1/1✓ Branch 1 taken 50 times.
|
50 | scheduleDay.addValue(newStartTime, 0.0); |
| 246 | } | ||
| 247 | |||
| 248 | 1380 | ++timeIt; | |
| 249 | } | ||
| 250 | 60 | } | |
| 251 | |||
| 252 | 5 | void adjustSchedule(model::ScheduleYear& scheduleYear, int startOffset) { | |
| 253 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::vector<model::ScheduleWeek> scheduleWeeks = scheduleYear.scheduleWeeks(); |
| 254 | |||
| 255 |
2/2✓ Branch 5 taken 5 times.
✓ Branch 6 taken 5 times.
|
10 | for (const auto& scheduleWeek : scheduleWeeks) { |
| 256 | 5 | std::vector<boost::optional<model::ScheduleDay>> scheduleDays; | |
| 257 | |||
| 258 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | scheduleDays.push_back(scheduleWeek.sundaySchedule()); |
| 259 | |||
| 260 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | scheduleDays.push_back(scheduleWeek.mondaySchedule()); |
| 261 | |||
| 262 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | scheduleDays.push_back(scheduleWeek.tuesdaySchedule()); |
| 263 | |||
| 264 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | scheduleDays.push_back(scheduleWeek.wednesdaySchedule()); |
| 265 | |||
| 266 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | scheduleDays.push_back(scheduleWeek.thursdaySchedule()); |
| 267 | |||
| 268 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | scheduleDays.push_back(scheduleWeek.fridaySchedule()); |
| 269 | |||
| 270 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | scheduleDays.push_back(scheduleWeek.saturdaySchedule()); |
| 271 | |||
| 272 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | scheduleDays.push_back(scheduleWeek.holidaySchedule()); |
| 273 | |||
| 274 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | scheduleDays.push_back(scheduleWeek.summerDesignDaySchedule()); |
| 275 | |||
| 276 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | scheduleDays.push_back(scheduleWeek.winterDesignDaySchedule()); |
| 277 | |||
| 278 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | scheduleDays.push_back(scheduleWeek.customDay1Schedule()); |
| 279 | |||
| 280 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | scheduleDays.push_back(scheduleWeek.customDay2Schedule()); |
| 281 | |||
| 282 |
2/2✓ Branch 5 taken 60 times.
✓ Branch 6 taken 5 times.
|
65 | for (auto& scheduleDayIt : scheduleDays) { |
| 283 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if (scheduleDayIt) { |
| 284 |
2/2✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
|
60 | adjustScheduleDay(scheduleDayIt.get(), startOffset); |
| 285 | } | ||
| 286 | } | ||
| 287 | 5 | } | |
| 288 | 5 | } | |
| 289 | |||
| 290 | // Make a deep copy into same model as scheduleYear | ||
| 291 | 5 | model::ScheduleYear deepScheduleYearClone(const model::ScheduleYear& scheduleYear, const std::string& name) { | |
| 292 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::Model model = scheduleYear.model(); |
| 293 | |||
| 294 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | auto scheduleYearClone = scheduleYear.clone(model).cast<model::ScheduleYear>(); |
| 295 |
1/1✓ Branch 1 taken 5 times.
|
5 | scheduleYearClone.setName(name); |
| 296 |
1/1✓ Branch 1 taken 5 times.
|
5 | scheduleYearClone.clearScheduleWeeks(); |
| 297 | |||
| 298 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::vector<model::ScheduleWeek> scheduleWeeks = scheduleYear.scheduleWeeks(); |
| 299 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::vector<Date> dates = scheduleYear.dates(); |
| 300 | |||
| 301 | 5 | auto dateIt = dates.begin(); | |
| 302 | |||
| 303 | 5 | int i = 1; | |
| 304 | |||
| 305 |
2/2✓ Branch 5 taken 5 times.
✓ Branch 6 taken 5 times.
|
10 | for (const auto& scheduleWeek : scheduleWeeks) { |
| 306 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | auto scheduleWeekClone = scheduleWeek.clone(model).cast<model::ScheduleWeek>(); |
| 307 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | scheduleWeekClone.setName(name + " Week " + openstudio::string_conversions::number(i)); |
| 308 |
1/1✓ Branch 2 taken 5 times.
|
5 | scheduleYearClone.addScheduleWeek(*dateIt, scheduleWeekClone); |
| 309 | |||
| 310 | 5 | boost::optional<model::ScheduleDay> scheduleDay; | |
| 311 | |||
| 312 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((scheduleDay = scheduleWeek.sundaySchedule())) { |
| 313 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | auto s = scheduleDay->clone(model).cast<model::ScheduleDay>(); |
| 314 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
5 | s.setName(name + " Week " + openstudio::string_conversions::number(i) + " Sunday"); |
| 315 |
1/1✓ Branch 1 taken 5 times.
|
5 | scheduleWeekClone.setSundaySchedule(s); |
| 316 | 5 | } | |
| 317 | |||
| 318 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((scheduleDay = scheduleWeek.mondaySchedule())) { |
| 319 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | auto s = scheduleDay->clone(model).cast<model::ScheduleDay>(); |
| 320 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
5 | s.setName(name + " Week " + openstudio::string_conversions::number(i) + " Monday"); |
| 321 |
1/1✓ Branch 1 taken 5 times.
|
5 | scheduleWeekClone.setMondaySchedule(s); |
| 322 | 5 | } | |
| 323 | |||
| 324 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((scheduleDay = scheduleWeek.tuesdaySchedule())) { |
| 325 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | auto s = scheduleDay->clone(model).cast<model::ScheduleDay>(); |
| 326 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
5 | s.setName(name + " Week " + openstudio::string_conversions::number(i) + " Tuesday"); |
| 327 |
1/1✓ Branch 1 taken 5 times.
|
5 | scheduleWeekClone.setTuesdaySchedule(s); |
| 328 | 5 | } | |
| 329 | |||
| 330 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((scheduleDay = scheduleWeek.wednesdaySchedule())) { |
| 331 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | auto s = scheduleDay->clone(model).cast<model::ScheduleDay>(); |
| 332 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
5 | s.setName(name + " Week " + openstudio::string_conversions::number(i) + " Wednesday"); |
| 333 |
1/1✓ Branch 1 taken 5 times.
|
5 | scheduleWeekClone.setWednesdaySchedule(s); |
| 334 | 5 | } | |
| 335 | |||
| 336 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((scheduleDay = scheduleWeek.thursdaySchedule())) { |
| 337 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | auto s = scheduleDay->clone(model).cast<model::ScheduleDay>(); |
| 338 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
5 | s.setName(name + " Week " + openstudio::string_conversions::number(i) + " Thursday"); |
| 339 |
1/1✓ Branch 1 taken 5 times.
|
5 | scheduleWeekClone.setThursdaySchedule(s); |
| 340 | 5 | } | |
| 341 | |||
| 342 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((scheduleDay = scheduleWeek.fridaySchedule())) { |
| 343 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | auto s = scheduleDay->clone(model).cast<model::ScheduleDay>(); |
| 344 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
5 | s.setName(name + " Week " + openstudio::string_conversions::number(i) + " Friday"); |
| 345 |
1/1✓ Branch 1 taken 5 times.
|
5 | scheduleWeekClone.setFridaySchedule(s); |
| 346 | 5 | } | |
| 347 | |||
| 348 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((scheduleDay = scheduleWeek.saturdaySchedule())) { |
| 349 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | auto s = scheduleDay->clone(model).cast<model::ScheduleDay>(); |
| 350 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
5 | s.setName(name + " Week " + openstudio::string_conversions::number(i) + " Saturday"); |
| 351 |
1/1✓ Branch 1 taken 5 times.
|
5 | scheduleWeekClone.setSaturdaySchedule(s); |
| 352 | 5 | } | |
| 353 | |||
| 354 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((scheduleDay = scheduleWeek.holidaySchedule())) { |
| 355 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | auto s = scheduleDay->clone(model).cast<model::ScheduleDay>(); |
| 356 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
5 | s.setName(name + " Week " + openstudio::string_conversions::number(i) + " Holiday"); |
| 357 |
1/1✓ Branch 1 taken 5 times.
|
5 | scheduleWeekClone.setHolidaySchedule(s); |
| 358 | 5 | } | |
| 359 | |||
| 360 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((scheduleDay = scheduleWeek.summerDesignDaySchedule())) { |
| 361 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | auto s = scheduleDay->clone(model).cast<model::ScheduleDay>(); |
| 362 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
5 | s.setName(name + " Week " + openstudio::string_conversions::number(i) + " Summer"); |
| 363 |
1/1✓ Branch 1 taken 5 times.
|
5 | scheduleWeekClone.setSummerDesignDaySchedule(s); |
| 364 | 5 | } | |
| 365 | |||
| 366 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((scheduleDay = scheduleWeek.winterDesignDaySchedule())) { |
| 367 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | auto s = scheduleDay->clone(model).cast<model::ScheduleDay>(); |
| 368 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
5 | s.setName(name + " Week " + openstudio::string_conversions::number(i) + " Winter"); |
| 369 |
1/1✓ Branch 1 taken 5 times.
|
5 | scheduleWeekClone.setWinterDesignDaySchedule(s); |
| 370 | 5 | } | |
| 371 | |||
| 372 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((scheduleDay = scheduleWeek.customDay1Schedule())) { |
| 373 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | auto s = scheduleDay->clone(model).cast<model::ScheduleDay>(); |
| 374 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
5 | s.setName(name + " Week " + openstudio::string_conversions::number(i) + " Custom 1"); |
| 375 |
1/1✓ Branch 1 taken 5 times.
|
5 | scheduleWeekClone.setCustomDay1Schedule(s); |
| 376 | 5 | } | |
| 377 | |||
| 378 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
10 | if ((scheduleDay = scheduleWeek.customDay2Schedule())) { |
| 379 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | auto s = scheduleDay->clone(model).cast<model::ScheduleDay>(); |
| 380 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
5 | s.setName(name + " Week " + openstudio::string_conversions::number(i) + " Custom 2"); |
| 381 |
1/1✓ Branch 1 taken 5 times.
|
5 | scheduleWeekClone.setCustomDay2Schedule(s); |
| 382 | 5 | } | |
| 383 | |||
| 384 | 5 | ++dateIt; | |
| 385 | 5 | i++; | |
| 386 | 5 | } | |
| 387 | |||
| 388 | 10 | return scheduleYearClone; | |
| 389 | 5 | } | |
| 390 | |||
| 391 | ✗ | model::Schedule ReverseTranslator::defaultDeckTempSchedule(openstudio::model::Model& model) { | |
| 392 | ✗ | if (!m_defaultDeckTempSchedule) { | |
| 393 | ✗ | model::ScheduleRuleset scheduleRuleset = model::ScheduleRuleset(model); | |
| 394 | |||
| 395 | ✗ | scheduleRuleset.setName("Deck Temp"); | |
| 396 | |||
| 397 | ✗ | model::ScheduleDay scheduleDay = scheduleRuleset.defaultDaySchedule(); | |
| 398 | |||
| 399 | ✗ | scheduleDay.addValue(Time(1.0), 12.8); | |
| 400 | |||
| 401 | ✗ | m_defaultDeckTempSchedule = scheduleRuleset; | |
| 402 | ✗ | } | |
| 403 | |||
| 404 | ✗ | return m_defaultDeckTempSchedule.get(); | |
| 405 | } | ||
| 406 | |||
| 407 | ✗ | model::Schedule ReverseTranslator::hotWaterPlantSetpointSchedule(openstudio::model::Model& model) { | |
| 408 | ✗ | if (!m_hotWaterPlantSetpointSchedule) { | |
| 409 | ✗ | model::ScheduleRuleset scheduleRuleset = model::ScheduleRuleset(model); | |
| 410 | |||
| 411 | ✗ | scheduleRuleset.setName("Hot Water Plant Setpoint"); | |
| 412 | |||
| 413 | ✗ | model::ScheduleDay scheduleDay = scheduleRuleset.defaultDaySchedule(); | |
| 414 | |||
| 415 | ✗ | scheduleDay.addValue(Time(1.0), 67.0); | |
| 416 | |||
| 417 | ✗ | m_hotWaterPlantSetpointSchedule = scheduleRuleset; | |
| 418 | ✗ | } | |
| 419 | |||
| 420 | ✗ | return m_hotWaterPlantSetpointSchedule.get(); | |
| 421 | } | ||
| 422 | |||
| 423 | ✗ | model::Schedule ReverseTranslator::chilledWaterPlantSetpointSchedule(openstudio::model::Model& model) { | |
| 424 | ✗ | if (!m_chilledWaterPlantSetpointSchedule) { | |
| 425 | ✗ | model::ScheduleRuleset scheduleRuleset = model::ScheduleRuleset(model); | |
| 426 | |||
| 427 | ✗ | scheduleRuleset.setName("Chilled Water Plant Setpoint"); | |
| 428 | |||
| 429 | ✗ | model::ScheduleDay scheduleDay = scheduleRuleset.defaultDaySchedule(); | |
| 430 | |||
| 431 | ✗ | scheduleDay.addValue(Time(1.0), 6.7); | |
| 432 | |||
| 433 | ✗ | m_chilledWaterPlantSetpointSchedule = scheduleRuleset; | |
| 434 | ✗ | } | |
| 435 | |||
| 436 | ✗ | return m_chilledWaterPlantSetpointSchedule.get(); | |
| 437 | } | ||
| 438 | |||
| 439 | ✗ | model::Schedule ReverseTranslator::serviceHotWaterSetpointSchedule(openstudio::model::Model& model) { | |
| 440 | ✗ | if (!m_serviceHotWaterSetpointSchedule) { | |
| 441 | ✗ | model::ScheduleRuleset scheduleRuleset = model::ScheduleRuleset(model); | |
| 442 | |||
| 443 | ✗ | scheduleRuleset.setName("SHW Plant Setpoint"); | |
| 444 | |||
| 445 | ✗ | model::ScheduleDay scheduleDay = scheduleRuleset.defaultDaySchedule(); | |
| 446 | |||
| 447 | ✗ | scheduleDay.addValue(Time(1.0), 50.0); | |
| 448 | |||
| 449 | ✗ | m_serviceHotWaterSetpointSchedule = scheduleRuleset; | |
| 450 | ✗ | } | |
| 451 | |||
| 452 | ✗ | return m_serviceHotWaterSetpointSchedule.get(); | |
| 453 | } | ||
| 454 | |||
| 455 | ✗ | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateVRFSys(const pugi::xml_node& vrfSysElement, | |
| 456 | openstudio::model::Model& model) { | ||
| 457 | ✗ | boost::optional<openstudio::model::ModelObject> result; | |
| 458 | |||
| 459 | ✗ | model::AirConditionerVariableRefrigerantFlow vrf(model); | |
| 460 | ✗ | result = vrf; | |
| 461 | |||
| 462 | { | ||
| 463 | ✗ | std::string value = vrfSysElement.child("Name").text().as_string(); | |
| 464 | ✗ | vrf.setName(value); | |
| 465 | ✗ | } | |
| 466 | |||
| 467 | { | ||
| 468 | ✗ | pugi::xml_node element = vrfSysElement.child("AvailSchRef"); | |
| 469 | ✗ | std::string name = escapeName(element.text().as_string()); | |
| 470 | ✗ | if (auto schedule = model.getModelObjectByName<model::Schedule>(name)) { | |
| 471 | ✗ | vrf.setAvailabilitySchedule(schedule.get()); | |
| 472 | ✗ | } | |
| 473 | ✗ | } | |
| 474 | |||
| 475 | { | ||
| 476 | ✗ | auto element = vrfSysElement.child("HtRcvry"); | |
| 477 | ✗ | if (istringEqual(element.text().as_string(), "Yes")) { | |
| 478 | ✗ | vrf.setHeatPumpWasteHeatRecovery(true); | |
| 479 | } | ||
| 480 | } | ||
| 481 | |||
| 482 | //{ | ||
| 483 | // auto element = vrfSysElement.child("CndsrType"); | ||
| 484 | // vrf.setCondenserType(element.text().as_string()); | ||
| 485 | //} | ||
| 486 | |||
| 487 | { | ||
| 488 | ✗ | auto element = vrfSysElement.child("FuelType"); | |
| 489 | ✗ | vrf.setFuelType(element.text().as_string()); | |
| 490 | } | ||
| 491 | |||
| 492 | { | ||
| 493 | ✗ | auto element = vrfSysElement.child("PLRMin"); | |
| 494 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 495 | ✗ | if (_value) { | |
| 496 | ✗ | vrf.setMinimumHeatPumpPartLoadRatio(_value.get()); | |
| 497 | } | ||
| 498 | } | ||
| 499 | |||
| 500 | { | ||
| 501 | ✗ | auto element = vrfSysElement.child("CtrlPriority"); | |
| 502 | ✗ | vrf.setMasterThermostatPriorityControlType(element.text().as_string()); | |
| 503 | } | ||
| 504 | |||
| 505 | { | ||
| 506 | ✗ | auto element = vrfSysElement.child("CtrlZnRef"); | |
| 507 | ✗ | std::string text = element.text().as_string(); | |
| 508 | ✗ | if (!text.empty()) { | |
| 509 | ✗ | m_vrfSystemControlZones.insert(std::pair<std::string, model::AirConditionerVariableRefrigerantFlow>(text, vrf)); | |
| 510 | } | ||
| 511 | ✗ | } | |
| 512 | |||
| 513 | { | ||
| 514 | ✗ | auto element = vrfSysElement.child("CtrlSchRef"); | |
| 515 | ✗ | if (auto schedule = model.getModelObjectByName<model::Schedule>(element.text().as_string())) { | |
| 516 | ✗ | vrf.setThermostatPrioritySchedule(schedule.get()); | |
| 517 | ✗ | } | |
| 518 | } | ||
| 519 | |||
| 520 | ✗ | if (!autosize()) { | |
| 521 | ✗ | auto element = vrfSysElement.child("ClgCapGrossRtd"); | |
| 522 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 523 | ✗ | if (_value) { | |
| 524 | ✗ | double value = unitToUnit(_value.get(), "Btu/h", "W").get(); | |
| 525 | ✗ | vrf.setGrossRatedTotalCoolingCapacity(value); | |
| 526 | } | ||
| 527 | } | ||
| 528 | |||
| 529 | { | ||
| 530 | ✗ | auto element = vrfSysElement.child("ClgEIR"); | |
| 531 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 532 | ✗ | if (_value) { | |
| 533 | ✗ | vrf.setGrossRatedCoolingCOP(1.0 / _value.get()); | |
| 534 | } | ||
| 535 | } | ||
| 536 | |||
| 537 | ✗ | if (!autosize()) { | |
| 538 | ✗ | auto element = vrfSysElement.child("HtgCapGrossRtd"); | |
| 539 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 540 | ✗ | if (_value) { | |
| 541 | ✗ | double value = unitToUnit(_value.get(), "Btu/h", "W").get(); | |
| 542 | ✗ | vrf.setGrossRatedHeatingCapacity(value); | |
| 543 | } | ||
| 544 | } | ||
| 545 | |||
| 546 | { | ||
| 547 | ✗ | auto element = vrfSysElement.child("HtgEIR"); | |
| 548 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 549 | ✗ | if (_value) { | |
| 550 | ✗ | vrf.setRatedHeatingCOP(1.0 / _value.get()); | |
| 551 | } | ||
| 552 | } | ||
| 553 | |||
| 554 | { | ||
| 555 | ✗ | auto element = vrfSysElement.child("HtgToClgSizingRat"); | |
| 556 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 557 | ✗ | if (_value) { | |
| 558 | ✗ | vrf.setRatedHeatingCapacitySizingRatio(_value.get()); | |
| 559 | } | ||
| 560 | } | ||
| 561 | |||
| 562 | { | ||
| 563 | ✗ | auto element = vrfSysElement.child("ClgCprsrLockoutTempLow"); | |
| 564 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 565 | ✗ | if (_value) { | |
| 566 | ✗ | double value = unitToUnit(_value.get(), "F", "C").get(); | |
| 567 | ✗ | vrf.setMinimumOutdoorTemperatureinCoolingMode(value); | |
| 568 | } | ||
| 569 | } | ||
| 570 | |||
| 571 | { | ||
| 572 | ✗ | auto element = vrfSysElement.child("ClgCprsrLockoutTempHi"); | |
| 573 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 574 | ✗ | if (_value) { | |
| 575 | ✗ | double value = unitToUnit(_value.get(), "F", "C").get(); | |
| 576 | ✗ | vrf.setMaximumOutdoorTemperatureinCoolingMode(value); | |
| 577 | } | ||
| 578 | } | ||
| 579 | |||
| 580 | { | ||
| 581 | ✗ | auto element = vrfSysElement.child("HtgCprsrLockoutTempLow"); | |
| 582 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 583 | ✗ | if (_value) { | |
| 584 | ✗ | double value = unitToUnit(_value.get(), "F", "C").get(); | |
| 585 | ✗ | vrf.setMinimumOutdoorTemperatureinHeatingMode(value); | |
| 586 | } | ||
| 587 | } | ||
| 588 | |||
| 589 | { | ||
| 590 | ✗ | auto element = vrfSysElement.child("HtgCprsrLockoutTempHi"); | |
| 591 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 592 | ✗ | if (_value) { | |
| 593 | ✗ | double value = unitToUnit(_value.get(), "F", "C").get(); | |
| 594 | ✗ | vrf.setMaximumOutdoorTemperatureinHeatingMode(value); | |
| 595 | } | ||
| 596 | } | ||
| 597 | |||
| 598 | { | ||
| 599 | ✗ | auto element = vrfSysElement.child("HtRcvryCprsrLockoutTempLow"); | |
| 600 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 601 | ✗ | if (_value) { | |
| 602 | ✗ | double value = unitToUnit(_value.get(), "F", "C").get(); | |
| 603 | ✗ | vrf.setMinimumOutdoorTemperatureinHeatRecoveryMode(value); | |
| 604 | } | ||
| 605 | } | ||
| 606 | |||
| 607 | { | ||
| 608 | ✗ | auto element = vrfSysElement.child("HtRcvryCprsrLockoutTempHi"); | |
| 609 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 610 | ✗ | if (_value) { | |
| 611 | ✗ | double value = unitToUnit(_value.get(), "F", "C").get(); | |
| 612 | ✗ | vrf.setMaximumOutdoorTemperatureinHeatRecoveryMode(value); | |
| 613 | } | ||
| 614 | } | ||
| 615 | |||
| 616 | { | ||
| 617 | ✗ | auto element = vrfSysElement.child("HtRcvryInitialClgCapFrac"); | |
| 618 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 619 | ✗ | if (_value) { | |
| 620 | ✗ | vrf.setInitialHeatRecoveryCoolingCapacityFraction(_value.get()); | |
| 621 | } | ||
| 622 | } | ||
| 623 | |||
| 624 | { | ||
| 625 | ✗ | auto element = vrfSysElement.child("HtRcvryInitialClgEngyFrac"); | |
| 626 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 627 | ✗ | if (_value) { | |
| 628 | ✗ | vrf.setInitialHeatRecoveryCoolingEnergyFraction(_value.get()); | |
| 629 | } | ||
| 630 | } | ||
| 631 | |||
| 632 | { | ||
| 633 | ✗ | auto element = vrfSysElement.child("HtRcvryInitialClgTimeCnst"); | |
| 634 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 635 | ✗ | if (_value) { | |
| 636 | ✗ | vrf.setHeatRecoveryCoolingCapacityTimeConstant(_value.get()); | |
| 637 | ✗ | vrf.setHeatRecoveryCoolingEnergyTimeConstant(_value.get()); | |
| 638 | } | ||
| 639 | } | ||
| 640 | |||
| 641 | { | ||
| 642 | ✗ | auto element = vrfSysElement.child("HtRcvryInitialHtgCapFrac"); | |
| 643 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 644 | ✗ | if (_value) { | |
| 645 | ✗ | vrf.setInitialHeatRecoveryHeatingCapacityFraction(_value.get()); | |
| 646 | } | ||
| 647 | } | ||
| 648 | |||
| 649 | { | ||
| 650 | ✗ | auto element = vrfSysElement.child("HtRcvryInitialHtgTimeCnst"); | |
| 651 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 652 | ✗ | if (_value) { | |
| 653 | ✗ | vrf.setHeatRecoveryHeatingCapacityTimeConstant(_value.get()); | |
| 654 | ✗ | vrf.setHeatRecoveryHeatingEnergyTimeConstant(_value.get()); | |
| 655 | } | ||
| 656 | } | ||
| 657 | |||
| 658 | { | ||
| 659 | ✗ | auto element = vrfSysElement.child("HtRcvryInitialHtgEngyFrac"); | |
| 660 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 661 | ✗ | if (_value) { | |
| 662 | ✗ | vrf.setInitialHeatRecoveryHeatingEnergyFraction(_value.get()); | |
| 663 | } | ||
| 664 | } | ||
| 665 | |||
| 666 | { | ||
| 667 | ✗ | const auto* value = vrfSysElement.child("DefHtSrc").text().as_string(); | |
| 668 | ✗ | if (istringEqual("HotGas", value)) { | |
| 669 | ✗ | vrf.setDefrostStrategy("ReverseCycle"); | |
| 670 | ✗ | } else if (istringEqual("Electric", value)) { | |
| 671 | ✗ | vrf.setDefrostStrategy("Resistive"); | |
| 672 | } | ||
| 673 | } | ||
| 674 | |||
| 675 | { | ||
| 676 | ✗ | const auto* value = vrfSysElement.child("DefCtrl").text().as_string(); | |
| 677 | ✗ | if (istringEqual("OnDemand", value)) { | |
| 678 | ✗ | vrf.setDefrostControl("OnDemand"); | |
| 679 | ✗ | } else if (istringEqual("TimedCycle", value)) { | |
| 680 | ✗ | vrf.setDefrostControl("Timed"); | |
| 681 | } | ||
| 682 | } | ||
| 683 | |||
| 684 | { | ||
| 685 | ✗ | auto element = vrfSysElement.child("DefTimeFrac"); | |
| 686 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 687 | ✗ | if (_value) { | |
| 688 | ✗ | vrf.setDefrostTimePeriodFraction(_value.get()); | |
| 689 | } | ||
| 690 | } | ||
| 691 | |||
| 692 | ✗ | if (!autosize()) { | |
| 693 | ✗ | auto element = vrfSysElement.child("DefHtrCap"); | |
| 694 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 695 | ✗ | if (_value) { | |
| 696 | ✗ | double value = unitToUnit(_value.get(), "Btu/h", "W").get(); | |
| 697 | ✗ | vrf.setResistiveDefrostHeaterCapacity(value); | |
| 698 | } | ||
| 699 | } | ||
| 700 | |||
| 701 | { | ||
| 702 | ✗ | auto element = vrfSysElement.child("DefCtrlTemp"); | |
| 703 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 704 | ✗ | if (_value) { | |
| 705 | ✗ | double value = unitToUnit(_value.get(), "F", "C").get(); | |
| 706 | ✗ | vrf.setMaximumOutdoorDrybulbTemperatureforDefrostOperation(value); | |
| 707 | } | ||
| 708 | } | ||
| 709 | |||
| 710 | ✗ | if (!autosize()) { | |
| 711 | ✗ | auto element = vrfSysElement.child("CprsrCrankcaseHtrCap"); | |
| 712 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 713 | ✗ | if (_value) { | |
| 714 | ✗ | double value = unitToUnit(_value.get(), "Btu/h", "W").get(); | |
| 715 | ✗ | vrf.setCrankcaseHeaterPowerperCompressor(value); | |
| 716 | } | ||
| 717 | } | ||
| 718 | |||
| 719 | { | ||
| 720 | ✗ | auto element = vrfSysElement.child("CprsrQty"); | |
| 721 | ✗ | boost::optional<int> _value = lexicalCastToInt(element); | |
| 722 | ✗ | if (_value) { | |
| 723 | ✗ | vrf.setNumberofCompressors(_value.get()); | |
| 724 | } | ||
| 725 | } | ||
| 726 | |||
| 727 | { | ||
| 728 | ✗ | auto element = vrfSysElement.child("CrankcaseCtrlTemp"); | |
| 729 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 730 | ✗ | if (_value) { | |
| 731 | ✗ | double value = unitToUnit(_value.get(), "F", "C").get(); | |
| 732 | ✗ | vrf.setMaximumOutdoorDrybulbTemperatureforCrankcaseHeater(value); | |
| 733 | } | ||
| 734 | } | ||
| 735 | |||
| 736 | { | ||
| 737 | ✗ | auto element = vrfSysElement.child("EquivalentPipeLen"); | |
| 738 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 739 | ✗ | if (_value) { | |
| 740 | ✗ | double value = unitToUnit(_value.get(), "ft", "m").get(); | |
| 741 | ✗ | vrf.setEquivalentPipingLengthusedforPipingCorrectionFactorinCoolingMode(value); | |
| 742 | ✗ | vrf.setEquivalentPipingLengthusedforPipingCorrectionFactorinHeatingMode(value); | |
| 743 | } | ||
| 744 | } | ||
| 745 | |||
| 746 | { | ||
| 747 | ✗ | auto element = vrfSysElement.child("MaxDeltaHgt"); | |
| 748 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 749 | ✗ | if (_value) { | |
| 750 | ✗ | double value = unitToUnit(_value.get(), "ft", "m").get(); | |
| 751 | ✗ | vrf.setVerticalHeightusedforPipingCorrectionFactor(value); | |
| 752 | } | ||
| 753 | } | ||
| 754 | |||
| 755 | { | ||
| 756 | ✗ | const auto* value = vrfSysElement.child("HtgCrvOutdoorTempType").text().as_string(); | |
| 757 | ✗ | if (istringEqual(value, "WetBulb")) { | |
| 758 | ✗ | vrf.setHeatingPerformanceCurveOutdoorTemperatureType("WetBulbTemperature"); | |
| 759 | ✗ | } else if (istringEqual(value, "DryBulb")) { | |
| 760 | ✗ | vrf.setHeatingPerformanceCurveOutdoorTemperatureType("DryBulbTemperature"); | |
| 761 | } | ||
| 762 | } | ||
| 763 | |||
| 764 | ✗ | auto setCurve = [&](const std::string& elementName, | |
| 765 | const std::function<bool(model::AirConditionerVariableRefrigerantFlow&, const model::Curve&)>& osSetter, | ||
| 766 | const std::function<boost::optional<model::Curve>(model::AirConditionerVariableRefrigerantFlow&)>& osGetter) { | ||
| 767 | ✗ | std::string value = vrfSysElement.child(elementName.c_str()).text().as_string(); | |
| 768 | ✗ | auto newcurve = model.getModelObjectByName<model::Curve>(value); | |
| 769 | ✗ | if (newcurve) { | |
| 770 | ✗ | if (auto oldcurve = osGetter(vrf)) { | |
| 771 | ✗ | if (oldcurve.get() != newcurve.get()) { | |
| 772 | ✗ | oldcurve->remove(); | |
| 773 | } | ||
| 774 | ✗ | } | |
| 775 | ✗ | osSetter(vrf, newcurve.get()); | |
| 776 | } | ||
| 777 | ✗ | }; | |
| 778 | |||
| 779 | ✗ | setCurve("HtgCap_fTempLowCrvRef", | |
| 780 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setHeatingCapacityRatioModifierFunctionofLowTemperatureCurve), | |
| 781 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::heatingCapacityRatioModifierFunctionofLowTemperatureCurve)); | |
| 782 | |||
| 783 | ✗ | setCurve("HtgCapBndry_fTempCrvRef", std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setHeatingCapacityRatioBoundaryCurve), | |
| 784 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::heatingCapacityRatioBoundaryCurve)); | |
| 785 | |||
| 786 | ✗ | setCurve("HtgCap_fTempHiCrvRef", | |
| 787 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setHeatingCapacityRatioModifierFunctionofHighTemperatureCurve), | |
| 788 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::heatingCapacityRatioModifierFunctionofHighTemperatureCurve)); | |
| 789 | |||
| 790 | ✗ | setCurve("HtgEIR_fTempLowCrvRef", | |
| 791 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setHeatingEnergyInputRatioModifierFunctionofLowTemperatureCurve), | |
| 792 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::heatingEnergyInputRatioModifierFunctionofLowTemperatureCurve)); | |
| 793 | |||
| 794 | ✗ | setCurve("HtgEIRBndry_fTempCrvRef", std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setHeatingEnergyInputRatioBoundaryCurve), | |
| 795 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::heatingEnergyInputRatioBoundaryCurve)); | |
| 796 | |||
| 797 | ✗ | setCurve("HtgEIR_fTempHiCrvRef", | |
| 798 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setHeatingEnergyInputRatioModifierFunctionofHighTemperatureCurve), | |
| 799 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::heatingEnergyInputRatioModifierFunctionofHighTemperatureCurve)); | |
| 800 | |||
| 801 | ✗ | setCurve("HtgEIR_fPLRLowCrvRef", | |
| 802 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setHeatingEnergyInputRatioModifierFunctionofLowPartLoadRatioCurve), | |
| 803 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::heatingEnergyInputRatioModifierFunctionofLowPartLoadRatioCurve)); | |
| 804 | |||
| 805 | ✗ | setCurve("HtgEIR_fPLRHiCrvRef", | |
| 806 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setHeatingEnergyInputRatioModifierFunctionofHighPartLoadRatioCurve), | |
| 807 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::heatingEnergyInputRatioModifierFunctionofHighPartLoadRatioCurve)); | |
| 808 | |||
| 809 | ✗ | setCurve("HtgCap_fCombRatCrvRef", std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setHeatingCombinationRatioCorrectionFactorCurve), | |
| 810 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::heatingCombinationRatioCorrectionFactorCurve)); | |
| 811 | |||
| 812 | ✗ | setCurve("HtRcvryHtgCap_fTempCrvRef", std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setHeatRecoveryHeatingCapacityModifierCurve), | |
| 813 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::heatRecoveryHeatingCapacityModifierCurve)); | |
| 814 | |||
| 815 | ✗ | setCurve("HtRcvryHtgEIR_fTempCrvRef", std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setHeatRecoveryHeatingEnergyModifierCurve), | |
| 816 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::heatRecoveryHeatingEnergyModifierCurve)); | |
| 817 | |||
| 818 | ✗ | setCurve("ClgCap_fTempLowCrvRef", | |
| 819 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setCoolingCapacityRatioModifierFunctionofLowTemperatureCurve), | |
| 820 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::coolingCapacityRatioModifierFunctionofLowTemperatureCurve)); | |
| 821 | |||
| 822 | ✗ | setCurve("ClgCapBndry_fTempCrvRef", std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setCoolingCapacityRatioBoundaryCurve), | |
| 823 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::coolingCapacityRatioBoundaryCurve)); | |
| 824 | |||
| 825 | ✗ | setCurve("ClgCap_fTempHiCrvRef", | |
| 826 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setCoolingCapacityRatioModifierFunctionofHighTemperatureCurve), | |
| 827 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::coolingCapacityRatioModifierFunctionofHighTemperatureCurve)); | |
| 828 | |||
| 829 | ✗ | setCurve("ClgEIR_fTempLowCrvRef", | |
| 830 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setCoolingEnergyInputRatioModifierFunctionofLowTemperatureCurve), | |
| 831 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::coolingEnergyInputRatioModifierFunctionofLowTemperatureCurve)); | |
| 832 | |||
| 833 | ✗ | setCurve("ClgEIRBndry_fTempCrvRef", std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setCoolingEnergyInputRatioBoundaryCurve), | |
| 834 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::coolingEnergyInputRatioBoundaryCurve)); | |
| 835 | |||
| 836 | ✗ | setCurve("ClgEIR_fTempHiCrvRef", | |
| 837 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setCoolingEnergyInputRatioModifierFunctionofHighTemperatureCurve), | |
| 838 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::coolingEnergyInputRatioModifierFunctionofHighTemperatureCurve)); | |
| 839 | |||
| 840 | ✗ | setCurve("ClgEIR_fPLRLowCrvRef", | |
| 841 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setCoolingEnergyInputRatioModifierFunctionofLowPartLoadRatioCurve), | |
| 842 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::coolingEnergyInputRatioModifierFunctionofLowPartLoadRatioCurve)); | |
| 843 | |||
| 844 | ✗ | setCurve("ClgEIR_fPLRHiCrvRef", | |
| 845 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setCoolingEnergyInputRatioModifierFunctionofHighPartLoadRatioCurve), | |
| 846 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::coolingEnergyInputRatioModifierFunctionofHighPartLoadRatioCurve)); | |
| 847 | |||
| 848 | ✗ | setCurve("ClgEIR_fPLRHiCrvRef", | |
| 849 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setCoolingEnergyInputRatioModifierFunctionofHighPartLoadRatioCurve), | |
| 850 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::coolingEnergyInputRatioModifierFunctionofHighPartLoadRatioCurve)); | |
| 851 | |||
| 852 | ✗ | setCurve("ClgCap_fCombRatCrvRef", std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setCoolingCombinationRatioCorrectionFactorCurve), | |
| 853 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::coolingCombinationRatioCorrectionFactorCurve)); | |
| 854 | |||
| 855 | ✗ | setCurve("ClgEIR_fCyclingRatCrvRef", std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setCoolingPartLoadFractionCorrelationCurve), | |
| 856 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::coolingPartLoadFractionCorrelationCurve)); | |
| 857 | |||
| 858 | ✗ | setCurve("HtRcvryClgCap_fTempCrvRef", std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setHeatRecoveryCoolingCapacityModifierCurve), | |
| 859 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::heatRecoveryCoolingCapacityModifierCurve)); | |
| 860 | |||
| 861 | ✗ | setCurve("HtRcvryClgEIR_fTempCrvRef", std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setHeatRecoveryCoolingEnergyModifierCurve), | |
| 862 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::heatRecoveryCoolingEnergyModifierCurve)); | |
| 863 | |||
| 864 | ✗ | setCurve("ClgPipeLoss_fPipeLenCrvRef", | |
| 865 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setPipingCorrectionFactorforLengthinCoolingModeCurve), | |
| 866 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::pipingCorrectionFactorforLengthinCoolingModeCurve)); | |
| 867 | |||
| 868 | ✗ | setCurve("HtgPipeLoss_fPipeLenCrvRef", | |
| 869 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setPipingCorrectionFactorforLengthinHeatingModeCurve), | |
| 870 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::pipingCorrectionFactorforLengthinHeatingModeCurve)); | |
| 871 | |||
| 872 | ✗ | setCurve("DefEIR_fTempCrvRef", | |
| 873 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setDefrostEnergyInputRatioModifierFunctionofTemperatureCurve), | |
| 874 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::defrostEnergyInputRatioModifierFunctionofTemperatureCurve)); | |
| 875 | |||
| 876 | ✗ | setCurve("HtgEIR_fCyclingRatCrvRef", std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::setHeatingPartLoadFractionCorrelationCurve), | |
| 877 | ✗ | std::mem_fn(&model::AirConditionerVariableRefrigerantFlow::heatingPartLoadFractionCorrelationCurve)); | |
| 878 | |||
| 879 | { | ||
| 880 | ✗ | auto element = vrfSysElement.child("ClgPipeLoss_fPipeHgtCoeff"); | |
| 881 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 882 | ✗ | if (_value) { | |
| 883 | ✗ | double value = unitToUnit(_value.get(), "1/ft", "1/m").get(); | |
| 884 | ✗ | vrf.setPipingCorrectionFactorforHeightinCoolingModeCoefficient(value); | |
| 885 | } | ||
| 886 | } | ||
| 887 | |||
| 888 | { | ||
| 889 | ✗ | auto element = vrfSysElement.child("HtgPipeLoss_fPipeHgtCoeff"); | |
| 890 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element); | |
| 891 | ✗ | if (_value) { | |
| 892 | ✗ | double value = unitToUnit(_value.get(), "1/ft", "1/m").get(); | |
| 893 | ✗ | vrf.setPipingCorrectionFactorforHeightinHeatingModeCoefficient(value); | |
| 894 | } | ||
| 895 | } | ||
| 896 | |||
| 897 | ✗ | return result; | |
| 898 | ✗ | } | |
| 899 | |||
| 900 | 5 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateAirSystem(const pugi::xml_node& airSystemElement, | |
| 901 | openstudio::model::Model& model) { | ||
| 902 | 5 | boost::optional<openstudio::model::ModelObject> result; | |
| 903 | |||
| 904 |
5/6✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 5 times.
|
20 | if (!istringEqual(airSystemElement.name(), "AirSys")) { |
| 905 | ✗ | return result; | |
| 906 | } | ||
| 907 | |||
| 908 | // Type | ||
| 909 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node airSystemTypeElement = airSystemElement.child("TypeSim"); |
| 910 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5 times.
|
15 | if (openstudio::istringEqual(airSystemTypeElement.text().as_string(), "Exhaust")) { |
| 911 | ✗ | return boost::none; | |
| 912 | } | ||
| 913 | |||
| 914 | // Name | ||
| 915 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node nameElement = airSystemElement.child("Name"); |
| 916 | |||
| 917 | // Air System | ||
| 918 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::AirLoopHVAC airLoopHVAC(model); |
| 919 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | airLoopHVAC.setName(nameElement.text().as_string()); |
| 920 |
1/1✓ Branch 1 taken 5 times.
|
5 | result = airLoopHVAC; |
| 921 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::Node supplyOutletNode = airLoopHVAC.supplyOutletNode(); |
| 922 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::Node supplyInletNode = airLoopHVAC.supplyInletNode(); |
| 923 | |||
| 924 | // TODO: this is unused! | ||
| 925 |
1/1✓ Branch 1 taken 5 times.
|
5 | [[maybe_unused]] pugi::xml_node airSystemClgCtrlElement = airSystemElement.child("ClgCtrl"); |
| 926 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node airHndlrAvailSchElement = airSystemElement.child("AvailSchRef"); |
| 927 | |||
| 928 | // Availability Schedule | ||
| 929 | 5 | boost::optional<model::Schedule> availabilitySchedule; | |
| 930 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
5 | if (airHndlrAvailSchElement) { |
| 931 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | availabilitySchedule = model.getModelObjectByName<model::Schedule>(airHndlrAvailSchElement.text().as_string()); |
| 932 | } | ||
| 933 | |||
| 934 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (availabilitySchedule) { |
| 935 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | airLoopHVAC.setAvailabilitySchedule(availabilitySchedule.get()); |
| 936 | } | ||
| 937 | |||
| 938 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | const auto* controlZone = airSystemElement.child("CtrlZnRef").text().as_string(); |
| 939 | |||
| 940 | // Optimum Start | ||
| 941 |
1/1✓ Branch 1 taken 5 times.
|
5 | auto optStartElement = airSystemElement.child("OptStart"); |
| 942 |
2/3✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
|
5 | if (optStartElement) { |
| 943 | ✗ | model::AvailabilityManagerOptimumStart optimumStart(model); | |
| 944 | |||
| 945 | ✗ | auto optStartCtrlElement = airSystemElement.child("OptStartCtrl"); | |
| 946 | ✗ | if (istringEqual(optStartCtrlElement.text().as_string(), "ControlZone")) { | |
| 947 | ✗ | optimumStart.setControlType("ControlZone"); | |
| 948 | ✗ | auto pair = std::pair<std::string, model::AvailabilityManagerOptimumStart>(controlZone, optimumStart); | |
| 949 | ✗ | m_optimumStartControlZones.insert(pair); | |
| 950 | ✗ | } else { | |
| 951 | ✗ | optimumStart.setControlType("MaximumZoneList"); | |
| 952 | } | ||
| 953 | |||
| 954 | ✗ | auto optStartMaxValElement = airSystemElement.child("OptStartMaxVal"); | |
| 955 | ✗ | boost::optional<double> _optStartMaxValElement = lexicalCastToDouble(optStartMaxValElement); | |
| 956 | ✗ | if (_optStartMaxValElement) { | |
| 957 | ✗ | optimumStart.setMaximumValueforOptimumStartTime(_optStartMaxValElement.get()); | |
| 958 | } | ||
| 959 | |||
| 960 | ✗ | optimumStart.setControlAlgorithm("AdaptiveTemperatureGradient"); | |
| 961 | |||
| 962 | ✗ | auto optStartClgGradientElement = airSystemElement.child("OptStartClgGradient"); | |
| 963 | ✗ | boost::optional<double> _optStartClgGradient = lexicalCastToDouble(optStartClgGradientElement); | |
| 964 | ✗ | if (_optStartClgGradient) { | |
| 965 | // Convert dF to dC, these are delta temperatures | ||
| 966 | ✗ | optimumStart.setInitialTemperatureGradientduringCooling(_optStartClgGradient.get() * 5.0 / 9.0); | |
| 967 | } | ||
| 968 | |||
| 969 | ✗ | auto optStartHtgGradientElement = airSystemElement.child("OptStartHtgGradient"); | |
| 970 | ✗ | boost::optional<double> _optStartHtgGradient = lexicalCastToDouble(optStartHtgGradientElement); | |
| 971 | ✗ | if (_optStartHtgGradient) { | |
| 972 | // Convert dF to dC, these are delta temperatures | ||
| 973 | ✗ | optimumStart.setInitialTemperatureGradientduringHeating(_optStartHtgGradient.get() * 5.0 / 9.0); | |
| 974 | } | ||
| 975 | |||
| 976 | ✗ | auto optStartNumDaysElement = airSystemElement.child("OptStartNumDays"); | |
| 977 | ✗ | boost::optional<int> _optStartNumDays = lexicalCastToInt(optStartNumDaysElement); | |
| 978 | ✗ | if (_optStartNumDays) { | |
| 979 | ✗ | optimumStart.setNumberofPreviousDays(_optStartNumDays.get()); | |
| 980 | } | ||
| 981 | ✗ | } else { | |
| 982 | // Night Cycle | ||
| 983 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node nightCycleFanCtrlElement = airSystemElement.child("NightCycleFanCtrl"); |
| 984 | |||
| 985 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 17 taken 5 times.
✗ Branch 18 not taken.
|
15 | if (istringEqual(nightCycleFanCtrlElement.text().as_string(), "CycleOnCallAnyZone")) { |
| 986 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
10 | airLoopHVAC.setNightCycleControlType("CycleOnAny"); |
| 987 | ✗ | } else if (istringEqual(nightCycleFanCtrlElement.text().as_string(), "CycleOnCallPrimaryZone")) { | |
| 988 | ✗ | model::AvailabilityManagerNightCycle nightCycle(model); | |
| 989 | ✗ | nightCycle.setControlType("CycleOnControlZone"); | |
| 990 | |||
| 991 | ✗ | airLoopHVAC.addAvailabilityManager(nightCycle); | |
| 992 | |||
| 993 | ✗ | auto pair = std::pair<std::string, model::AvailabilityManagerNightCycle>(controlZone, nightCycle); | |
| 994 | ✗ | m_nightCycleControlZones.insert(pair); | |
| 995 | ✗ | } else if (istringEqual(nightCycleFanCtrlElement.text().as_string(), "CycleZoneFansOnly")) { | |
| 996 | ✗ | airLoopHVAC.setNightCycleControlType("CycleOnAnyZoneFansOnly"); | |
| 997 | } | ||
| 998 | |||
| 999 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
|
5 | if (!airLoopHVAC.availabilityManagers().empty()) { |
| 1000 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 5 taken 5 times.
|
5 | auto avm = airLoopHVAC.availabilityManagers().front(); |
| 1001 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
10 | if (auto nightCycle = avm.optionalCast<model::AvailabilityManagerNightCycle>()) { |
| 1002 |
1/1✓ Branch 1 taken 5 times.
|
5 | auto nightCycleTstatToleranceElement = airSystemElement.child("NightCycleTstatTolerance"); |
| 1003 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _nightCycleTstatTolerance = lexicalCastToDouble(nightCycleTstatToleranceElement); |
| 1004 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_nightCycleTstatTolerance) { |
| 1005 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | nightCycle->setThermostatTolerance(_nightCycleTstatTolerance.get() * 5.0 / 9.0); |
| 1006 | } | ||
| 1007 | |||
| 1008 |
1/1✓ Branch 1 taken 5 times.
|
5 | auto nightCycleRunTimeElement = airSystemElement.child("NightCycleRunTime"); |
| 1009 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _nightCycleRunTime = lexicalCastToDouble(nightCycleRunTimeElement); |
| 1010 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_nightCycleRunTime) { |
| 1011 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | nightCycle->setCyclingRunTime(_nightCycleRunTime.get()); |
| 1012 | } | ||
| 1013 | 5 | } | |
| 1014 | 5 | } | |
| 1015 | } | ||
| 1016 | |||
| 1017 | // Adjust Sizing:System Object | ||
| 1018 | |||
| 1019 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::SizingSystem sizingSystem = airLoopHVAC.sizingSystem(); |
| 1020 | |||
| 1021 | // clgDsgnSupAirTemp | ||
| 1022 | 5 | double clgDsgnSupAirTemp = 12.8; | |
| 1023 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node clgSupAirTempElement = airSystemElement.child("ClgDsgnSupAirTemp"); |
| 1024 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _clgSupAirTempElement = lexicalCastToDouble(clgSupAirTempElement); |
| 1025 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_clgSupAirTempElement) { |
| 1026 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
20 | clgDsgnSupAirTemp = unitToUnit(_clgSupAirTempElement.get(), "F", "C").get(); |
| 1027 | } | ||
| 1028 |
1/1✓ Branch 1 taken 5 times.
|
5 | sizingSystem.setCentralCoolingDesignSupplyAirTemperature(clgDsgnSupAirTemp); |
| 1029 | |||
| 1030 | // HtgDsgnSupAirTemp | ||
| 1031 | 5 | double htgDsgnSupAirTemp = 40.0; | |
| 1032 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node htgSupAirTempElement = airSystemElement.child("HtgDsgnSupAirTemp"); |
| 1033 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _htgSupAirTemp = lexicalCastToDouble(htgSupAirTempElement); |
| 1034 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_htgSupAirTemp) { |
| 1035 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
20 | htgDsgnSupAirTemp = unitToUnit(_htgSupAirTemp.get(), "F", "C").get(); |
| 1036 | } | ||
| 1037 |
1/1✓ Branch 1 taken 5 times.
|
5 | sizingSystem.setCentralHeatingDesignSupplyAirTemperature(htgDsgnSupAirTemp); |
| 1038 | |||
| 1039 | // DsgnAirFlowMinRat | ||
| 1040 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node dsgnAirFlowMinRatElement = airSystemElement.child("DsgnAirFlowMinRat"); |
| 1041 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _dsgnAirFlowMinRat = lexicalCastToDouble(dsgnAirFlowMinRatElement); |
| 1042 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_dsgnAirFlowMinRat) { |
| 1043 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | sizingSystem.setCentralHeatingMaximumSystemAirFlowRatio(_dsgnAirFlowMinRat.get()); |
| 1044 | } else { | ||
| 1045 | ✗ | sizingSystem.setCentralHeatingMaximumSystemAirFlowRatio(0.3); | |
| 1046 | } | ||
| 1047 | |||
| 1048 | // DsgnPrehtTemp | ||
| 1049 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node dsgnPrehtTempElement = airSystemElement.child("DsgnPrehtTemp"); |
| 1050 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _dsgnPrehtTemp = lexicalCastToDouble(dsgnPrehtTempElement); |
| 1051 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_dsgnPrehtTemp) { |
| 1052 |
6/6✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 16 taken 5 times.
|
20 | sizingSystem.setPreheatDesignTemperature(unitToUnit(_dsgnPrehtTemp.get(), "F", "C").get()); |
| 1053 | } else { | ||
| 1054 | ✗ | sizingSystem.setPreheatDesignTemperature(7.0); | |
| 1055 | } | ||
| 1056 | |||
| 1057 | // DsgnPrehtHumidityRat | ||
| 1058 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node dsgnPrehtHumidityRatElement = airSystemElement.child("DsgnPrehtHumidityRat"); |
| 1059 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _dsgnPrehtHumidityRat = lexicalCastToDouble(dsgnPrehtHumidityRatElement); |
| 1060 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_dsgnPrehtHumidityRat) { |
| 1061 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | sizingSystem.setPreheatDesignHumidityRatio(_dsgnPrehtHumidityRat.get()); |
| 1062 | } else { | ||
| 1063 | ✗ | sizingSystem.setPreheatDesignHumidityRatio(0.008); | |
| 1064 | } | ||
| 1065 | |||
| 1066 | // DsgnPreclTemp | ||
| 1067 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node dsgnPreclTempElement = airSystemElement.child("DsgnPreclTemp"); |
| 1068 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _dsgnPreclTemp = lexicalCastToDouble(dsgnPreclTempElement); |
| 1069 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_dsgnPreclTemp) { |
| 1070 |
6/6✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 16 taken 5 times.
|
20 | sizingSystem.setPrecoolDesignTemperature(unitToUnit(_dsgnPreclTemp.get(), "F", "C").get()); |
| 1071 | } else { | ||
| 1072 | ✗ | sizingSystem.setPrecoolDesignTemperature(12.8); | |
| 1073 | } | ||
| 1074 | |||
| 1075 | // DsgnPreclHumidityRat | ||
| 1076 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node dsgnPreclHumidityRatElement = airSystemElement.child("DsgnPreclHumidityRat"); |
| 1077 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _dsgnPreclHumidityRat = lexicalCastToDouble(dsgnPreclHumidityRatElement); |
| 1078 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_dsgnPreclHumidityRat) { |
| 1079 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | sizingSystem.setPrecoolDesignHumidityRatio(_dsgnPreclHumidityRat.get()); |
| 1080 | } else { | ||
| 1081 | ✗ | sizingSystem.setPrecoolDesignHumidityRatio(0.008); | |
| 1082 | } | ||
| 1083 | |||
| 1084 | // SizingOption | ||
| 1085 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node sizingOptionElement = airSystemElement.child("SizingOption"); |
| 1086 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5 times.
|
15 | if (openstudio::istringEqual(sizingOptionElement.text().as_string(), "NonCoincident")) { |
| 1087 | ✗ | sizingSystem.setSizingOption("NonCoincident"); | |
| 1088 | } else { | ||
| 1089 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
10 | sizingSystem.setSizingOption("Coincident"); |
| 1090 | } | ||
| 1091 | |||
| 1092 | // ClgFullOutsdAir | ||
| 1093 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node clgFullOutsdAirElement = airSystemElement.child("ClgFullOutsdAir"); |
| 1094 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5 times.
|
15 | if (openstudio::istringEqual(clgFullOutsdAirElement.text().as_string(), "Yes")) { |
| 1095 | ✗ | sizingSystem.setAllOutdoorAirinCooling(true); | |
| 1096 | } else { | ||
| 1097 |
1/1✓ Branch 1 taken 5 times.
|
5 | sizingSystem.setAllOutdoorAirinCooling(false); |
| 1098 | } | ||
| 1099 | |||
| 1100 | // HtgFullOutsdAir | ||
| 1101 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node htgFullOutsdAirElement = airSystemElement.child("HtgFullOutsdAir"); |
| 1102 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5 times.
|
15 | if (openstudio::istringEqual(htgFullOutsdAirElement.text().as_string(), "Yes")) { |
| 1103 | ✗ | sizingSystem.setAllOutdoorAirinHeating(true); | |
| 1104 | } else { | ||
| 1105 |
1/1✓ Branch 1 taken 5 times.
|
5 | sizingSystem.setAllOutdoorAirinHeating(false); |
| 1106 | } | ||
| 1107 | |||
| 1108 | // ClgDsgnHumidityRat | ||
| 1109 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node clgDsgnHumidityRatElement = airSystemElement.child("ClgDsgnHumidityRat"); |
| 1110 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _clgDsgnHumidityRat = lexicalCastToDouble(clgDsgnHumidityRatElement); |
| 1111 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_clgDsgnHumidityRat) { |
| 1112 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | sizingSystem.setCentralCoolingDesignSupplyAirHumidityRatio(_clgDsgnHumidityRat.get()); |
| 1113 | } else { | ||
| 1114 | ✗ | sizingSystem.setCentralCoolingDesignSupplyAirHumidityRatio(0.008); | |
| 1115 | } | ||
| 1116 | |||
| 1117 | // HtgDsgnHumidityRat | ||
| 1118 | |||
| 1119 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node htgDsgnHumidityRatElement = airSystemElement.child("HtgDsgnHumidityRat"); |
| 1120 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _htgDsgnHumidityRat = lexicalCastToDouble(htgDsgnHumidityRatElement); |
| 1121 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_htgDsgnHumidityRat) { |
| 1122 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | sizingSystem.setCentralHeatingDesignSupplyAirHumidityRatio(_htgDsgnHumidityRat.get()); |
| 1123 | } else { | ||
| 1124 | ✗ | sizingSystem.setCentralHeatingDesignSupplyAirHumidityRatio(0.008); | |
| 1125 | } | ||
| 1126 | |||
| 1127 | // FanPos | ||
| 1128 | |||
| 1129 | 5 | bool isFanDrawthrough = false; | |
| 1130 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node fanPosElement = airSystemElement.child("FanPos"); |
| 1131 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 17 taken 5 times.
✗ Branch 18 not taken.
|
15 | if (openstudio::istringEqual(fanPosElement.text().as_string(), "DrawThrough")) { |
| 1132 | 5 | isFanDrawthrough = true; | |
| 1133 | } | ||
| 1134 | |||
| 1135 | // Save Evap Cooler to draw from return air | ||
| 1136 | 5 | boost::optional<model::EvaporativeCoolerIndirectResearchSpecial> indirectEvapUsingReturn; | |
| 1137 | |||
| 1138 | // Air Segments | ||
| 1139 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::vector<pugi::xml_node> airSegmentElements = makeVectorOfChildren(airSystemElement, "AirSeg"); |
| 1140 | |||
| 1141 | // Save the fan to add last | ||
| 1142 | 5 | boost::optional<model::Node> dropNode; | |
| 1143 | |||
| 1144 | 5 | std::vector<model::ModelObject> coolingComponents; | |
| 1145 | 5 | std::vector<model::ModelObject> heatingComponents; | |
| 1146 | |||
| 1147 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 2 taken 5 times.
|
15 | for (std::vector<pugi::xml_node>::size_type i = 0; i < airSegmentElements.size(); i++) { |
| 1148 | 10 | pugi::xml_node airSegmentElement = airSegmentElements[i]; | |
| 1149 | |||
| 1150 |
1/1✓ Branch 1 taken 10 times.
|
10 | pugi::xml_node airSegmentTypeElement = airSegmentElement.child("Type"); |
| 1151 | |||
| 1152 | // Supply Segments | ||
| 1153 |
7/7✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
✓ Branch 13 taken 10 times.
✓ Branch 17 taken 5 times.
✓ Branch 18 taken 5 times.
|
30 | if (istringEqual(airSegmentTypeElement.text().as_string(), "Supply")) { |
| 1154 | // Get all children | ||
| 1155 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::vector<pugi::xml_node> airSegmentChildElements = makeVectorOfChildren(airSegmentElement); |
| 1156 | |||
| 1157 | // Locate and add the fan first | ||
| 1158 | // This is so we don't mess up control nodes | ||
| 1159 | |||
| 1160 |
1/2✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
|
30 | for (std::vector<pugi::xml_node>::size_type j = 0; j < airSegmentChildElements.size(); j++) { |
| 1161 | 30 | pugi::xml_node airSegmentChildElement = airSegmentChildElements[j]; | |
| 1162 | |||
| 1163 | // Fan | ||
| 1164 |
6/6✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
✓ Branch 7 taken 30 times.
✓ Branch 10 taken 30 times.
✓ Branch 14 taken 5 times.
✓ Branch 15 taken 25 times.
|
120 | if ((istringEqual(airSegmentChildElement.name(), "Fan"))) { |
| 1165 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
10 | if (boost::optional<model::ModelObject> mo = translateFan(airSegmentChildElement, model)) { |
| 1166 |
3/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
|
10 | if (boost::optional<model::StraightComponent> hvacComponent = mo->optionalCast<model::StraightComponent>()) { |
| 1167 | // Determine fan position | ||
| 1168 | |||
| 1169 | // TODO: unused | ||
| 1170 | // pugi::xml_node posElement = airSegmentChildElement.child("Pos"); | ||
| 1171 | |||
| 1172 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | hvacComponent->addToNode(supplyOutletNode); |
| 1173 | |||
| 1174 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (isFanDrawthrough) { |
| 1175 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
5 | dropNode = hvacComponent->inletModelObject()->cast<model::Node>(); |
| 1176 | } else { | ||
| 1177 | ✗ | dropNode = supplyOutletNode; | |
| 1178 | } | ||
| 1179 | |||
| 1180 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (availabilitySchedule) { |
| 1181 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 1 time.
✓ Branch 7 taken 4 times.
|
10 | if (boost::optional<model::FanConstantVolume> fan = hvacComponent->optionalCast<model::FanConstantVolume>()) { |
| 1182 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
1 | if (!fan->isMaximumFlowRateAutosized()) { |
| 1183 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | airLoopHVAC.setDesignSupplyAirFlowRate(fan->maximumFlowRate().get()); |
| 1184 | } | ||
| 1185 |
3/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
|
8 | } else if (boost::optional<model::FanVariableVolume> fan = hvacComponent->optionalCast<model::FanVariableVolume>()) { |
| 1186 |
3/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
|
4 | if (!fan->isMaximumFlowRateAutosized()) { |
| 1187 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
4 | airLoopHVAC.setDesignSupplyAirFlowRate(fan->maximumFlowRate().get()); |
| 1188 | } | ||
| 1189 | 9 | } | |
| 1190 | } | ||
| 1191 | 5 | } | |
| 1192 | 5 | break; | |
| 1193 | 5 | } | |
| 1194 | } | ||
| 1195 | } | ||
| 1196 | |||
| 1197 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
|
5 | if (!dropNode) { |
| 1198 | ✗ | dropNode = supplyOutletNode; | |
| 1199 | } | ||
| 1200 | |||
| 1201 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 2 taken 5 times.
|
35 | for (int j = (airSegmentChildElements.size() - 1); j > -1; j--) { |
| 1202 | 30 | pugi::xml_node airSegmentChildElement = airSegmentChildElements[j]; | |
| 1203 | |||
| 1204 | 30 | boost::optional<model::ModelObject> lastComponent = boost::none; | |
| 1205 | |||
| 1206 | // CoilCooling | ||
| 1207 |
6/6✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
✓ Branch 7 taken 30 times.
✓ Branch 10 taken 30 times.
✓ Branch 14 taken 5 times.
✓ Branch 15 taken 25 times.
|
120 | if (istringEqual(airSegmentChildElement.name(), "CoilClg")) { |
| 1208 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
10 | if (boost::optional<model::ModelObject> mo = translateCoilCooling(airSegmentChildElement, model)) { |
| 1209 |
1/1✓ Branch 1 taken 5 times.
|
5 | lastComponent = mo; |
| 1210 | |||
| 1211 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | auto hvacComponent = mo->cast<model::HVACComponent>(); |
| 1212 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | hvacComponent.addToNode(dropNode.get()); |
| 1213 | |||
| 1214 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | coolingComponents.push_back(mo.get()); |
| 1215 | |||
| 1216 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
10 | if (boost::optional<model::CoilCoolingWater> coilCoolingWater = hvacComponent.optionalCast<model::CoilCoolingWater>()) { |
| 1217 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | boost::optional<model::ControllerWaterCoil> controller = coilCoolingWater->controllerWaterCoil(); |
| 1218 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(controller); |
| 1219 | |||
| 1220 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | controller->setMinimumActuatedFlow(0.0); |
| 1221 | |||
| 1222 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
5 | if (!autosize()) { |
| 1223 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | controller->setControllerConvergenceTolerance(0.1); |
| 1224 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | boost::optional<double> maxFlow = coilCoolingWater->designWaterFlowRate(); |
| 1225 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(maxFlow); |
| 1226 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | controller->setMaximumActuatedFlow(maxFlow.get() * 1.25); |
| 1227 | } | ||
| 1228 | 10 | } | |
| 1229 | 10 | } | |
| 1230 | } | ||
| 1231 | // CoilHeating | ||
| 1232 |
6/6✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
✓ Branch 7 taken 25 times.
✓ Branch 10 taken 25 times.
✓ Branch 14 taken 5 times.
✓ Branch 15 taken 20 times.
|
100 | else if (istringEqual(airSegmentChildElement.name(), "CoilHtg")) { |
| 1233 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
10 | if (auto mo = translateCoilHeating(airSegmentChildElement, model)) { |
| 1234 |
1/1✓ Branch 1 taken 5 times.
|
5 | lastComponent = mo; |
| 1235 | |||
| 1236 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | auto hvacComponent = mo->cast<model::HVACComponent>(); |
| 1237 |
3/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5 times.
|
5 | if (!hvacComponent.addToNode(dropNode.get())) { |
| 1238 | ✗ | LOG(Error, "Cannot add HVACComponent named '" << hvacComponent.nameString() << "' to node '" << dropNode->nameString() | |
| 1239 | << "' on AirLoopHVAC '" << airLoopHVAC.nameString()); | ||
| 1240 | } | ||
| 1241 | |||
| 1242 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | heatingComponents.push_back(mo.get()); |
| 1243 | |||
| 1244 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
10 | if (boost::optional<model::CoilHeatingWater> coilHeatingWater = hvacComponent.optionalCast<model::CoilHeatingWater>()) { |
| 1245 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | boost::optional<model::ControllerWaterCoil> controller = coilHeatingWater->controllerWaterCoil(); |
| 1246 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(controller); |
| 1247 | |||
| 1248 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | controller->setControllerConvergenceTolerance(0.1); |
| 1249 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | controller->setMinimumActuatedFlow(0.0); |
| 1250 | |||
| 1251 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
5 | if (!autosize()) { |
| 1252 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | boost::optional<double> capacity = coilHeatingWater->ratedCapacity(); |
| 1253 | |||
| 1254 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | boost::optional<double> inletTemp = coilHeatingWater->ratedInletWaterTemperature(); |
| 1255 | |||
| 1256 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | boost::optional<double> outletTemp = coilHeatingWater->ratedOutletWaterTemperature(); |
| 1257 | |||
| 1258 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(capacity); |
| 1259 | |||
| 1260 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(inletTemp); |
| 1261 | |||
| 1262 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(outletTemp); |
| 1263 | |||
| 1264 | 5 | double density = 1000.0; | |
| 1265 | |||
| 1266 | 5 | double cp = 4180.0; | |
| 1267 | |||
| 1268 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | double maxFlow = capacity.get() / (density * cp * std::abs(inletTemp.get() - outletTemp.get())); |
| 1269 | |||
| 1270 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | controller->setMaximumActuatedFlow(maxFlow * 1.25); |
| 1271 | } | ||
| 1272 | 10 | } | |
| 1273 | 10 | } | |
| 1274 | } | ||
| 1275 | // EvapClr | ||
| 1276 |
5/6✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
✓ Branch 10 taken 20 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 20 times.
|
80 | else if (istringEqual(airSegmentChildElement.name(), "EvapClr")) { |
| 1277 | ✗ | if (boost::optional<model::ModelObject> mo = translateEvapClr(airSegmentChildElement, model)) { | |
| 1278 | ✗ | lastComponent = mo; | |
| 1279 | |||
| 1280 | ✗ | auto hvacComponent = mo->cast<model::HVACComponent>(); | |
| 1281 | ✗ | hvacComponent.addToNode(dropNode.get()); | |
| 1282 | |||
| 1283 | ✗ | coolingComponents.push_back(mo.get()); | |
| 1284 | |||
| 1285 | ✗ | if (boost::optional<model::EvaporativeCoolerIndirectResearchSpecial> evap = | |
| 1286 | ✗ | hvacComponent.optionalCast<model::EvaporativeCoolerIndirectResearchSpecial>()) { | |
| 1287 | ✗ | pugi::xml_node secAirSrcElement = airSegmentChildElement.first_child(); | |
| 1288 | ✗ | if (openstudio::istringEqual(secAirSrcElement.text().as_string(), "Return")) { | |
| 1289 | ✗ | indirectEvapUsingReturn = evap; | |
| 1290 | } | ||
| 1291 | ✗ | } | |
| 1292 | ✗ | } | |
| 1293 | } | ||
| 1294 | |||
| 1295 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 20 times.
|
30 | if (lastComponent) { |
| 1296 |
3/4✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 10 times.
|
20 | if (boost::optional<model::StraightComponent> straightComponent = lastComponent->optionalCast<model::StraightComponent>()) { |
| 1297 | ✗ | dropNode = straightComponent->inletModelObject()->cast<model::Node>(); | |
| 1298 |
3/4✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 6 taken 10 times.
✗ Branch 7 not taken.
|
20 | } else if (boost::optional<model::WaterToAirComponent> waterToAirComponent = lastComponent->optionalCast<model::WaterToAirComponent>()) { |
| 1299 |
5/5✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
✓ Branch 13 taken 10 times.
|
10 | dropNode = waterToAirComponent->airInletModelObject()->cast<model::Node>(); |
| 1300 | 20 | } | |
| 1301 | } | ||
| 1302 | 30 | } | |
| 1303 | 5 | } | |
| 1304 | } | ||
| 1305 | |||
| 1306 | // OACtrl | ||
| 1307 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node airSystemOACtrlElement = airSystemElement.child("OACtrl"); |
| 1308 | 5 | boost::optional<model::AirLoopHVACOutdoorAirSystem> oaSystem; | |
| 1309 | |||
| 1310 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
5 | if (airSystemOACtrlElement) { |
| 1311 |
1/1✓ Branch 1 taken 5 times.
|
5 | oaSystem = airLoopHVAC.airLoopHVACOutdoorAirSystem(); |
| 1312 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | if (!oaSystem) { |
| 1313 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::ControllerOutdoorAir oaController(model); |
| 1314 | |||
| 1315 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::AirLoopHVACOutdoorAirSystem newOASystem(model, oaController); |
| 1316 | |||
| 1317 |
1/1✓ Branch 1 taken 5 times.
|
5 | newOASystem.addToNode(supplyInletNode); |
| 1318 | |||
| 1319 | // Name | ||
| 1320 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node nameElement = airSystemOACtrlElement.child("Name"); |
| 1321 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | std::string name = nameElement.text().as_string(); |
| 1322 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | if (!name.empty()) { |
| 1323 |
1/1✓ Branch 1 taken 5 times.
|
5 | oaController.setName(name); |
| 1324 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | newOASystem.setName(name + " OA System"); |
| 1325 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | oaController.controllerMechanicalVentilation().setName(name + " Mech Vent Controller"); |
| 1326 | } | ||
| 1327 | |||
| 1328 | // MinOAFracSchRef | ||
| 1329 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node minOAFracSchRefElement = airSystemOACtrlElement.child("MinOAFracSchRef"); |
| 1330 |
5/6✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 5 times.
|
10 | if (boost::optional<model::Schedule> schedule = model.getModelObjectByName<model::Schedule>(minOAFracSchRefElement.text().as_string())) { |
| 1331 | ✗ | oaController.setMinimumFractionofOutdoorAirSchedule(schedule.get()); | |
| 1332 | 5 | } | |
| 1333 | |||
| 1334 | // MaxOAFracSchRef | ||
| 1335 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node maxOAFracSchRefElement = airSystemOACtrlElement.child("MaxOAFracSchRef"); |
| 1336 |
5/6✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 5 times.
|
10 | if (boost::optional<model::Schedule> schedule = model.getModelObjectByName<model::Schedule>(maxOAFracSchRefElement.text().as_string())) { |
| 1337 | ✗ | oaController.setMaximumFractionofOutdoorAirSchedule(schedule.get()); | |
| 1338 | } else { | ||
| 1339 | // MaxOARat | ||
| 1340 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node maxOARatElement = airSystemOACtrlElement.child("MaxOARat"); |
| 1341 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _maxOARat = lexicalCastToDouble(maxOARatElement); |
| 1342 |
6/10✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 5 times.
✓ Branch 10 taken 5 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 5 times.
✗ Branch 13 not taken.
|
5 | if (_maxOARat && _maxOARat.get() > 0.0 && _maxOARat.get() <= 1.0) { |
| 1343 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::ScheduleRuleset maxOARatSchedule(model); |
| 1344 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | maxOARatSchedule.setName(oaController.name().get() + " Max OA Schedule"); |
| 1345 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::ScheduleDay scheduleDay = maxOARatSchedule.defaultDaySchedule(); |
| 1346 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | scheduleDay.addValue(Time(1.0), _maxOARat.get()); |
| 1347 |
1/1✓ Branch 1 taken 5 times.
|
5 | oaController.setMaximumFractionofOutdoorAirSchedule(maxOARatSchedule); |
| 1348 | 5 | } | |
| 1349 | 5 | } | |
| 1350 | |||
| 1351 | // CtrlType | ||
| 1352 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | const auto* ctrlType = airSystemOACtrlElement.child("CtrlType").text().as_string(); |
| 1353 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | oaController.setEconomizerControlActionType(ctrlType); |
| 1354 | |||
| 1355 | // MinLimitType | ||
| 1356 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | const auto* minLimitType = airSystemOACtrlElement.child("MinLimitType").text().as_string(); |
| 1357 |
4/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 11 taken 5 times.
✗ Branch 12 not taken.
|
20 | if (istringEqual(minLimitType, "Fixed")) { |
| 1358 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
10 | oaController.setMinimumLimitType("FixedMinimum"); |
| 1359 | ✗ | } else if (istringEqual(minLimitType, "Proportional")) { | |
| 1360 | ✗ | oaController.setMinimumLimitType("ProportionalMinimum"); | |
| 1361 | } | ||
| 1362 | |||
| 1363 | // HtRcvryBypassCtrlType | ||
| 1364 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | const auto* htRcvryBypassCtrlType = airSystemOACtrlElement.child("HtRcvryBypassCtrlType").text().as_string(); |
| 1365 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | oaController.setHeatRecoveryBypassControlType(htRcvryBypassCtrlType); |
| 1366 | |||
| 1367 | // EconoAvailSchRef | ||
| 1368 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | const auto* econoAvailSchRef = airSystemOACtrlElement.child("EconoAvailSchRef").text().as_string(); |
| 1369 |
3/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 5 times.
|
15 | if (auto schedule = model.getModelObjectByName<model::Schedule>(econoAvailSchRef)) { |
| 1370 | ✗ | oaController.setTimeofDayEconomizerControlSchedule(schedule.get()); | |
| 1371 | 5 | } | |
| 1372 | |||
| 1373 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | boost::optional<double> _minOAFlow = lexicalCastToDouble(airSystemOACtrlElement.child("MinOAFlow")); |
| 1374 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if (_minOAFlow) { |
| 1375 | ✗ | double value = unitToUnit(_minOAFlow.get(), "cfm", "m^3/s").get(); | |
| 1376 | ✗ | oaController.setMinimumOutdoorAirFlowRate(value); | |
| 1377 | } | ||
| 1378 | |||
| 1379 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | boost::optional<double> _maxOAFlow = lexicalCastToDouble(airSystemOACtrlElement.child("MaxOAFlow")); |
| 1380 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if (_maxOAFlow) { |
| 1381 | ✗ | double value = unitToUnit(_maxOAFlow.get(), "cfm", "m^3/s").get(); | |
| 1382 | ✗ | oaController.setMaximumOutdoorAirFlowRate(value); | |
| 1383 | } | ||
| 1384 | |||
| 1385 | // OASchMthd | ||
| 1386 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node oaSchMthdElement = airSystemOACtrlElement.child("OASchMthd"); |
| 1387 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5 times.
|
15 | if (istringEqual(oaSchMthdElement.text().as_string(), "Constant")) { |
| 1388 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 1389 | ✗ | oaController.setMinimumOutdoorAirSchedule(schedule); | |
| 1390 |
12/27✓ Branch 2 taken 5 times.
✓ Branch 5 taken 5 times.
✓ Branch 8 taken 5 times.
✓ Branch 11 taken 5 times.
✓ Branch 14 taken 5 times.
✓ Branch 16 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 5 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 5 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 5 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 5 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 5 times.
✗ Branch 31 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
|
30 | } else if (istringEqual(oaSchMthdElement.text().as_string(), "FollowHVACAvailability") && availabilitySchedule) { |
| 1391 |
3/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
|
10 | if (boost::optional<model::ScheduleYear> availabilityScheduleYear = availabilitySchedule->optionalCast<model::ScheduleYear>()) { |
| 1392 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | model::ScheduleYear schedule = deepScheduleYearClone(availabilityScheduleYear.get(), name + " Schedule"); |
| 1393 | |||
| 1394 | 5 | int startOffset = 0; | |
| 1395 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node availSchOffsetStartElement = airSystemOACtrlElement.child("StartUpDelay"); |
| 1396 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<int> _offsetValue = lexicalCastToInt(availSchOffsetStartElement); |
| 1397 | |||
| 1398 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_offsetValue) { |
| 1399 |
1/1✓ Branch 1 taken 5 times.
|
5 | startOffset = _offsetValue.get(); |
| 1400 | } | ||
| 1401 | |||
| 1402 |
1/1✓ Branch 1 taken 5 times.
|
5 | adjustSchedule(schedule, startOffset); |
| 1403 | |||
| 1404 |
1/1✓ Branch 1 taken 5 times.
|
5 | oaController.setMinimumOutdoorAirSchedule(schedule); |
| 1405 | 10 | } | |
| 1406 | ✗ | } else if (istringEqual(oaSchMthdElement.text().as_string(), "Scheduled")) { | |
| 1407 | ✗ | pugi::xml_node oaSchRefElement = airSystemOACtrlElement.child("OASchRef"); | |
| 1408 | |||
| 1409 | ✗ | boost::optional<model::Schedule> schedule; | |
| 1410 | ✗ | schedule = model.getModelObjectByName<model::Schedule>(oaSchRefElement.text().as_string()); | |
| 1411 | |||
| 1412 | ✗ | if (schedule) { | |
| 1413 | ✗ | oaController.setMinimumOutdoorAirSchedule(schedule.get()); | |
| 1414 | } | ||
| 1415 | ✗ | } | |
| 1416 | |||
| 1417 | // EconoCtrlMthd | ||
| 1418 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node econoCtrlMthdElement = airSystemOACtrlElement.child("EconoCtrlMthd"); |
| 1419 | |||
| 1420 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5 times.
|
15 | if (istringEqual(econoCtrlMthdElement.text().as_string(), "FixedDryBulb")) { |
| 1421 | ✗ | oaController.setEconomizerControlType("FixedDryBulb"); | |
| 1422 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 17 taken 5 times.
✗ Branch 18 not taken.
|
15 | } else if (istringEqual(econoCtrlMthdElement.text().as_string(), "DifferentialDryBulb")) { |
| 1423 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
10 | oaController.setEconomizerControlType("DifferentialDryBulb"); |
| 1424 | ✗ | } else if (istringEqual(econoCtrlMthdElement.text().as_string(), "DifferentialEnthalpy")) { | |
| 1425 | ✗ | oaController.setEconomizerControlType("DifferentialEnthalpy"); | |
| 1426 | ✗ | } else if (istringEqual(econoCtrlMthdElement.text().as_string(), "DifferentialDryBulbAndEnthalpy")) { | |
| 1427 | ✗ | oaController.setEconomizerControlType("DifferentialEnthalpy"); | |
| 1428 | } | ||
| 1429 | |||
| 1430 | // EconoIntegration | ||
| 1431 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node econoIntegrationElement = airSystemOACtrlElement.child("EconoIntegration"); |
| 1432 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5 times.
|
15 | if (istringEqual(econoIntegrationElement.text().as_string(), "LockoutWithHeating")) { |
| 1433 | ✗ | oaController.setLockoutType("LockoutWithHeating"); | |
| 1434 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5 times.
|
15 | } else if (istringEqual(econoIntegrationElement.text().as_string(), "NonIntegrated")) { |
| 1435 | ✗ | oaController.setLockoutType("LockoutWithCompressor"); | |
| 1436 | } else { | ||
| 1437 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
10 | oaController.setLockoutType("NoLockout"); |
| 1438 | } | ||
| 1439 | |||
| 1440 | // EconoHiTempLockout | ||
| 1441 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node econoHiTempLockoutElement = airSystemOACtrlElement.child("EconoHiTempLockout"); |
| 1442 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _econoHiTempLockout = lexicalCastToDouble(econoHiTempLockoutElement); |
| 1443 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 time.
|
5 | if (_econoHiTempLockout) { |
| 1444 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | Quantity valueIP(_econoHiTempLockout.get(), createFahrenheitTemperature()); |
| 1445 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | OptionalQuantity valueSI = QuantityConverter::instance().convert(valueIP, UnitSystem(UnitSystem::Celsius)); |
| 1446 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
|
4 | OS_ASSERT(valueSI); |
| 1447 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | oaController.setEconomizerMaximumLimitDryBulbTemperature(valueSI->value()); |
| 1448 | 4 | } else { | |
| 1449 |
1/1✓ Branch 1 taken 1 time.
|
1 | oaController.resetEconomizerMaximumLimitDryBulbTemperature(); |
| 1450 | } | ||
| 1451 | |||
| 1452 | // EconolowTempLockout | ||
| 1453 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node econoLowTempLockoutElement = airSystemOACtrlElement.child("EconoLowTempLockout"); |
| 1454 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _econoLowTempLockout = lexicalCastToDouble(econoLowTempLockoutElement); |
| 1455 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if (_econoLowTempLockout) { |
| 1456 | ✗ | Quantity valueIP(_econoLowTempLockout.get(), createFahrenheitTemperature()); | |
| 1457 | ✗ | OptionalQuantity valueSI = QuantityConverter::instance().convert(valueIP, UnitSystem(UnitSystem::Celsius)); | |
| 1458 | ✗ | OS_ASSERT(valueSI); | |
| 1459 | ✗ | oaController.setEconomizerMinimumLimitDryBulbTemperature(valueSI->value()); | |
| 1460 | ✗ | } else { | |
| 1461 |
1/1✓ Branch 1 taken 5 times.
|
5 | oaController.resetEconomizerMinimumLimitDryBulbTemperature(); |
| 1462 | } | ||
| 1463 | |||
| 1464 | // TODO Remove this in the future, but for now play it safe and use legacy OpenStudio default. | ||
| 1465 |
8/20✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 5 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 5 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 5 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
|
25 | if (openstudio::istringEqual(airSystemTypeElement.text().as_string(), "SZVAVAC") |
| 1466 |
13/28✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 5 times.
✓ Branch 9 taken 5 times.
✓ Branch 12 taken 5 times.
✓ Branch 15 taken 5 times.
✓ Branch 18 taken 5 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 5 times.
✓ Branch 22 taken 5 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 5 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 5 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 5 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 5 times.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
|
35 | || openstudio::istringEqual(airSystemTypeElement.text().as_string(), "SZVAVHP")) { |
| 1467 | ✗ | oaController.setHeatRecoveryBypassControlType("BypassWhenOAFlowGreaterThanMinimum"); | |
| 1468 | } | ||
| 1469 | |||
| 1470 |
1/1✓ Branch 1 taken 5 times.
|
5 | oaSystem = newOASystem; |
| 1471 | 5 | } | |
| 1472 | // Attach IDEC | ||
| 1473 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if (indirectEvapUsingReturn) { |
| 1474 | ✗ | if (boost::optional<model::Node> outboardReliefNode = oaSystem->outboardReliefNode()) { | |
| 1475 | ✗ | indirectEvapUsingReturn->getImpl<model::detail::EvaporativeCoolerIndirectResearchSpecial_Impl>()->setReliefAirInletNode( | |
| 1476 | ✗ | outboardReliefNode.get()); | |
| 1477 | ✗ | } | |
| 1478 | } | ||
| 1479 | |||
| 1480 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(oaSystem); |
| 1481 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | auto outboardOANode = oaSystem->outboardOANode().get(); |
| 1482 | |||
| 1483 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 2 taken 5 times.
|
15 | for (std::vector<pugi::xml_node>::size_type i = 0; i < airSegmentElements.size(); i++) { |
| 1484 | 10 | auto airSegmentElement = airSegmentElements[i]; | |
| 1485 |
1/1✓ Branch 1 taken 10 times.
|
10 | auto airSegmentTypeElement = airSegmentElement.child("Type"); |
| 1486 | |||
| 1487 |
6/7✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
✓ Branch 13 taken 10 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 10 times.
|
30 | if (istringEqual(airSegmentTypeElement.text().as_string(), "OutdoorAir")) { |
| 1488 | |||
| 1489 | ✗ | for (auto it = airSegmentElement.end(); it != airSegmentElement.begin(); --it) { | |
| 1490 | ✗ | pugi::xml_node airSegmentChildElement = *it; | |
| 1491 | ✗ | if ((istringEqual(airSegmentChildElement.name(), "Fan"))) { | |
| 1492 | ✗ | if (auto mo = translateFan(airSegmentChildElement, model)) { | |
| 1493 | ✗ | mo->cast<model::HVACComponent>().addToNode(outboardOANode); | |
| 1494 | ✗ | } | |
| 1495 | ✗ | } else if (istringEqual(airSegmentChildElement.name(), "CoilHtg")) { | |
| 1496 | ✗ | if (auto mo = translateCoilHeating(airSegmentChildElement, model)) { | |
| 1497 | ✗ | mo->cast<model::HVACComponent>().addToNode(outboardOANode); | |
| 1498 | ✗ | } | |
| 1499 | ✗ | } else if (istringEqual(airSegmentChildElement.name(), "CoilClg")) { | |
| 1500 | ✗ | if (auto mo = translateCoilCooling(airSegmentChildElement, model)) { | |
| 1501 | ✗ | mo->cast<model::HVACComponent>().addToNode(outboardOANode); | |
| 1502 | ✗ | } | |
| 1503 | ✗ | } else if (istringEqual(airSegmentChildElement.name(), "EvapClr")) { | |
| 1504 | ✗ | if (auto mo = translateEvapClr(airSegmentChildElement, model)) { | |
| 1505 | ✗ | mo->cast<model::HVACComponent>().addToNode(outboardOANode); | |
| 1506 | ✗ | } | |
| 1507 | } | ||
| 1508 | } | ||
| 1509 | } | ||
| 1510 | } | ||
| 1511 | |||
| 1512 | // HtRecvryRef | ||
| 1513 | // TODO: this is unused! | ||
| 1514 |
1/1✓ Branch 1 taken 5 times.
|
5 | [[maybe_unused]] auto htRcvryRefElement = airSystemOACtrlElement.child("HtRcvryRef"); |
| 1515 | |||
| 1516 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::vector<pugi::xml_node> htRcvryElements = makeVectorOfChildren(airSystemElement, "HtRcvry"); |
| 1517 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
|
5 | for (std::vector<pugi::xml_node>::size_type i = 0; i < htRcvryElements.size(); i++) { |
| 1518 | ✗ | auto htRcvryElement = htRcvryElements[i]; | |
| 1519 | ✗ | if (auto mo = translateHtRcvry(htRcvryElement, model)) { | |
| 1520 | ✗ | auto hx = mo->cast<model::HeatExchangerAirToAirSensibleAndLatent>(); | |
| 1521 | ✗ | hx.addToNode(outboardOANode); | |
| 1522 | |||
| 1523 | // TempCtrl | ||
| 1524 | ✗ | const auto* tempCtrl = htRcvryElement.child("TempCtrl").text().as_string(); | |
| 1525 | ✗ | if (istringEqual(tempCtrl, "None")) { | |
| 1526 | ✗ | hx.setSupplyAirOutletTemperatureControl(false); | |
| 1527 | ✗ | } else if (istringEqual(tempCtrl, "Fixed")) { | |
| 1528 | ✗ | hx.setSupplyAirOutletTemperatureControl(true); | |
| 1529 | ✗ | boost::optional<double> _FixedSupTemp = lexicalCastToDouble(htRcvryElement.child("FixedSupTemp")); | |
| 1530 | ✗ | if (_FixedSupTemp) { | |
| 1531 | ✗ | double value = unitToUnit(_FixedSupTemp.get(), "F", "C").get(); | |
| 1532 | ✗ | model::ScheduleRuleset schedule(model); | |
| 1533 | ✗ | schedule.setName(hx.nameString() + " Setpoint"); | |
| 1534 | ✗ | model::ScheduleDay scheduleDay = schedule.defaultDaySchedule(); | |
| 1535 | ✗ | scheduleDay.addValue(Time(1.0), value); | |
| 1536 | |||
| 1537 | ✗ | model::SetpointManagerScheduled spm(model, schedule); | |
| 1538 | ✗ | spm.setName(hx.nameString() + " Setpoint"); | |
| 1539 | ✗ | auto nodeMO = hx.primaryAirOutletModelObject(); | |
| 1540 | ✗ | OS_ASSERT(nodeMO); | |
| 1541 | ✗ | auto node = nodeMO->cast<model::Node>(); | |
| 1542 | ✗ | spm.addToNode(node); | |
| 1543 | ✗ | } | |
| 1544 | ✗ | } else if (istringEqual(tempCtrl, "Scheduled")) { | |
| 1545 | ✗ | hx.setSupplyAirOutletTemperatureControl(true); | |
| 1546 | ✗ | const auto* schRef = htRcvryElement.child("TempSetptSchRef").text().as_string(); | |
| 1547 | ✗ | auto sch = model.getModelObjectByName<model::Schedule>(schRef); | |
| 1548 | ✗ | if (sch) { | |
| 1549 | ✗ | model::SetpointManagerScheduled spm(model, sch.get()); | |
| 1550 | ✗ | spm.setName(hx.nameString() + " Setpoint"); | |
| 1551 | ✗ | auto nodeMO = hx.primaryAirOutletModelObject(); | |
| 1552 | ✗ | OS_ASSERT(nodeMO); | |
| 1553 | ✗ | auto node = nodeMO->cast<model::Node>(); | |
| 1554 | ✗ | spm.addToNode(node); | |
| 1555 | ✗ | } | |
| 1556 | ✗ | } | |
| 1557 | ✗ | } | |
| 1558 | } | ||
| 1559 | 5 | } | |
| 1560 | |||
| 1561 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 2 taken 5 times.
|
15 | for (std::vector<pugi::xml_node>::size_type i = 0; i < airSegmentElements.size(); i++) { |
| 1562 | 10 | pugi::xml_node airSegmentElement = airSegmentElements[i]; | |
| 1563 |
1/1✓ Branch 1 taken 10 times.
|
10 | pugi::xml_node airSegmentTypeElement = airSegmentElement.child("Type"); |
| 1564 | |||
| 1565 |
7/7✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
✓ Branch 13 taken 10 times.
✓ Branch 17 taken 5 times.
✓ Branch 18 taken 5 times.
|
30 | if (istringEqual(airSegmentTypeElement.text().as_string(), "Return")) { |
| 1566 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node fanElement = airSegmentElement.child("Fan"); |
| 1567 |
2/3✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
|
5 | if (fanElement) { |
| 1568 | ✗ | if (auto mo = translateFan(fanElement, model)) { | |
| 1569 | ✗ | if (auto fan = mo->optionalCast<model::HVACComponent>()) { | |
| 1570 | ✗ | fan->addToNode(supplyInletNode); | |
| 1571 | ✗ | } | |
| 1572 | ✗ | } | |
| 1573 | } | ||
| 1574 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5 times.
|
15 | } else if (istringEqual(airSegmentTypeElement.text().as_string(), "Relief")) { |
| 1575 | ✗ | pugi::xml_node fanElement = airSegmentElement.child("Fan"); | |
| 1576 | ✗ | if (fanElement) { | |
| 1577 | ✗ | if (boost::optional<model::ModelObject> mo = translateFan(fanElement, model)) { | |
| 1578 | ✗ | if (oaSystem) { | |
| 1579 | ✗ | if (boost::optional<model::Node> outboardReliefNode = oaSystem->outboardReliefNode()) { | |
| 1580 | ✗ | if (auto fan = mo->optionalCast<model::HVACComponent>()) { | |
| 1581 | ✗ | fan->addToNode(outboardReliefNode.get()); | |
| 1582 | ✗ | } | |
| 1583 | ✗ | } | |
| 1584 | } | ||
| 1585 | ✗ | } | |
| 1586 | } | ||
| 1587 | } | ||
| 1588 | } | ||
| 1589 | |||
| 1590 | // Add Setpoint managers | ||
| 1591 | |||
| 1592 | // Preheat Control | ||
| 1593 |
1/1✓ Branch 1 taken 5 times.
|
5 | auto prehtCtrlElement = airSystemElement.child("PrehtCtrl"); |
| 1594 |
2/3✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
|
5 | if (prehtCtrlElement) { |
| 1595 | ✗ | if (istringEqual(prehtCtrlElement.text().as_string(), "Fixed")) { | |
| 1596 | ✗ | auto prehtFixedSupTempElement = airSystemElement.child("PrehtFixedSupTemp"); | |
| 1597 | ✗ | if (prehtFixedSupTempElement) { | |
| 1598 | ✗ | boost::optional<double> _prehtFixedSupTemp = lexicalCastToDouble(prehtFixedSupTempElement); | |
| 1599 | ✗ | if (_prehtFixedSupTemp) { | |
| 1600 | ✗ | double value = unitToUnit(_prehtFixedSupTemp.get(), "F", "C").get(); | |
| 1601 | ✗ | for (auto& comp : heatingComponents) { | |
| 1602 | ✗ | auto nextcomps = airLoopHVAC.supplyComponents(comp.cast<model::HVACComponent>(), supplyOutletNode); | |
| 1603 | ✗ | OS_ASSERT(nextcomps.size() > 1u); | |
| 1604 | ✗ | auto mo = nextcomps[1]; | |
| 1605 | ✗ | auto outletNode = mo.optionalCast<model::Node>(); | |
| 1606 | ✗ | OS_ASSERT(outletNode); | |
| 1607 | ✗ | if (outletNode.get() != supplyOutletNode) { | |
| 1608 | ✗ | model::ScheduleRuleset schedule(model); | |
| 1609 | ✗ | schedule.setName(comp.name().get() + " Preheat Schedule"); | |
| 1610 | ✗ | auto scheduleDay = schedule.defaultDaySchedule(); | |
| 1611 | ✗ | scheduleDay.addValue(Time(1.0), value); | |
| 1612 | ✗ | model::SetpointManagerScheduled spm(model, schedule); | |
| 1613 | ✗ | spm.setName(comp.name().get() + " Preheat SPM"); | |
| 1614 | ✗ | spm.addToNode(outletNode.get()); | |
| 1615 | ✗ | } else { | |
| 1616 | ✗ | LOG(Warn, "Ignoring \"PrehtCtrl\" for " + comp.name().get() + ", because it is the last component on the system"); | |
| 1617 | } | ||
| 1618 | ✗ | } | |
| 1619 | } | ||
| 1620 | } | ||
| 1621 | } | ||
| 1622 | } | ||
| 1623 | |||
| 1624 | // Establish deck temperature | ||
| 1625 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node clgCtrlElement = airSystemElement.child("ClgCtrl"); |
| 1626 | |||
| 1627 | // Lambda for OACtrl types FixedDualSetpoint and ScheduledDualSetpoint | ||
| 1628 | ✗ | auto createDualSetpoints = [&](model::Schedule& coolingSchedule, model::Schedule& heatingSchedule) { | |
| 1629 | ✗ | model::SetpointManagerScheduled spm(model, coolingSchedule); | |
| 1630 | ✗ | spm.addToNode(supplyOutletNode); | |
| 1631 | |||
| 1632 | ✗ | std::vector<model::ModelObject> downstreamComps; | |
| 1633 | ✗ | auto fan = airLoopHVAC.supplyFan(); | |
| 1634 | ✗ | if (fan) { | |
| 1635 | ✗ | downstreamComps = airLoopHVAC.supplyComponents(fan.get(), airLoopHVAC.supplyOutletNode()); | |
| 1636 | } | ||
| 1637 | |||
| 1638 | // Do this so there is "something" between the supplyOutletNode (which already has an SPM) and the | ||
| 1639 | // other components where we are about to add a different SPM. | ||
| 1640 | // Don't want to squash the existing spm. | ||
| 1641 | ✗ | if (downstreamComps.size() > 2u) { | |
| 1642 | ✗ | model::Duct duct(model); | |
| 1643 | ✗ | duct.setName(airLoopHVAC.name().get() + " OS Generated Outlet Duct"); | |
| 1644 | ✗ | duct.addToNode(supplyOutletNode); | |
| 1645 | ✗ | } | |
| 1646 | |||
| 1647 | ✗ | std::vector<model::SetpointManagerMixedAir> newMixedAirSPMs; | |
| 1648 | |||
| 1649 | ✗ | auto addDualSPMs = [&](const std::vector<model::ModelObject>& comps, model::Schedule& schedule) { | |
| 1650 | ✗ | for (const auto& comp : comps) { | |
| 1651 | ✗ | boost::optional<model::Node> outletNode; | |
| 1652 | { | ||
| 1653 | ✗ | auto nextcomps = airLoopHVAC.supplyComponents(comp.cast<model::HVACComponent>(), supplyOutletNode); | |
| 1654 | ✗ | OS_ASSERT(nextcomps.size() > 1u); | |
| 1655 | ✗ | auto mo = nextcomps[1]; | |
| 1656 | ✗ | outletNode = mo.optionalCast<model::Node>(); | |
| 1657 | ✗ | } | |
| 1658 | ✗ | OS_ASSERT(outletNode); | |
| 1659 | ✗ | if (outletNode->setpointManagers().empty()) { | |
| 1660 | // Figure out if comp is before or after the fan | ||
| 1661 | ✗ | if (std::find(downstreamComps.begin(), downstreamComps.end(), comp) == downstreamComps.end()) { | |
| 1662 | // Before fan | ||
| 1663 | ✗ | model::Duct duct(model); | |
| 1664 | ✗ | duct.setName(comp.name().get() + " OS Generated Outlet Duct"); | |
| 1665 | ✗ | auto ok = duct.addToNode(outletNode.get()); | |
| 1666 | ✗ | OS_ASSERT(ok); | |
| 1667 | ✗ | model::SetpointManagerScheduled spm(model, schedule); | |
| 1668 | ✗ | auto ductOutletNode = duct.outletModelObject()->cast<model::Node>(); | |
| 1669 | ✗ | spm.addToNode(ductOutletNode); | |
| 1670 | ✗ | model::SetpointManagerMixedAir spmMixedAir(model); | |
| 1671 | ✗ | newMixedAirSPMs.push_back(spmMixedAir); | |
| 1672 | ✗ | auto ductInletNode = duct.inletModelObject()->cast<model::Node>(); | |
| 1673 | ✗ | spmMixedAir.addToNode(ductInletNode); | |
| 1674 | ✗ | spmMixedAir.setReferenceSetpointNode(ductOutletNode); | |
| 1675 | ✗ | } else { | |
| 1676 | // After fan | ||
| 1677 | ✗ | model::SetpointManagerScheduled spm(model, schedule); | |
| 1678 | ✗ | spm.addToNode(outletNode.get()); | |
| 1679 | ✗ | } | |
| 1680 | } | ||
| 1681 | ✗ | } | |
| 1682 | ✗ | }; | |
| 1683 | |||
| 1684 | ✗ | addDualSPMs(coolingComponents, coolingSchedule); | |
| 1685 | ✗ | addDualSPMs(heatingComponents, heatingSchedule); | |
| 1686 | |||
| 1687 | // Fixup the fan reference nodes because adding ducts might have messed up the nodes around the fan | ||
| 1688 | ✗ | if (fan) { | |
| 1689 | ✗ | if (auto straightComponentFan = fan->optionalCast<model::StraightComponent>()) { | |
| 1690 | ✗ | auto fanInletNode = straightComponentFan->inletModelObject()->cast<model::Node>(); | |
| 1691 | ✗ | auto fanOutletNode = straightComponentFan->outletModelObject()->cast<model::Node>(); | |
| 1692 | ✗ | for (auto& spm : newMixedAirSPMs) { | |
| 1693 | ✗ | spm.setFanInletNode(fanInletNode); | |
| 1694 | ✗ | spm.setFanOutletNode(fanOutletNode); | |
| 1695 | } | ||
| 1696 | ✗ | } | |
| 1697 | } | ||
| 1698 | ✗ | }; | |
| 1699 | |||
| 1700 | 5 | boost::optional<model::HVACComponent> deckSPM; | |
| 1701 | |||
| 1702 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5 times.
|
15 | if (istringEqual(clgCtrlElement.text().as_string(), "Fixed")) { |
| 1703 | ✗ | model::ScheduleRuleset schedule(model); | |
| 1704 | |||
| 1705 | ✗ | schedule.setName(airLoopHVAC.name().get() + " Supply Air Temp Schedule"); | |
| 1706 | |||
| 1707 | ✗ | pugi::xml_node clgFixedSupTempElement = airSystemElement.child("ClgFixedSupTemp"); | |
| 1708 | ✗ | boost::optional<double> _clgFixedSupTemp = lexicalCastToDouble(clgFixedSupTempElement); | |
| 1709 | ✗ | if (_clgFixedSupTemp) { | |
| 1710 | ✗ | model::ScheduleDay scheduleDay = schedule.defaultDaySchedule(); | |
| 1711 | ✗ | double value = unitToUnit(_clgFixedSupTemp.get(), "F", "C").get(); | |
| 1712 | ✗ | scheduleDay.addValue(Time(1.0), value); | |
| 1713 | ✗ | } else { | |
| 1714 | ✗ | model::ScheduleDay scheduleDay = schedule.defaultDaySchedule(); | |
| 1715 | |||
| 1716 | ✗ | scheduleDay.addValue(Time(1.0), 12.8); | |
| 1717 | ✗ | } | |
| 1718 | |||
| 1719 | ✗ | model::SetpointManagerScheduled spm(model, schedule); | |
| 1720 | |||
| 1721 | ✗ | deckSPM = spm; | |
| 1722 | |||
| 1723 | ✗ | spm.addToNode(supplyOutletNode); | |
| 1724 |
6/7✓ Branch 3 taken 5 times.
✓ Branch 6 taken 5 times.
✓ Branch 9 taken 5 times.
✓ Branch 12 taken 5 times.
✓ Branch 15 taken 5 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 5 times.
|
15 | } else if (istringEqual(clgCtrlElement.text().as_string(), "NoSATControl")) { |
| 1725 | ✗ | model::SetpointManagerSingleZoneReheat spm(model); | |
| 1726 | |||
| 1727 | ✗ | deckSPM = spm; | |
| 1728 | |||
| 1729 | ✗ | spm.addToNode(supplyOutletNode); | |
| 1730 | |||
| 1731 | ✗ | if (istringEqual("SZVAVAC", airSystemTypeElement.text().as_string()) || istringEqual("SZVAVHP", airSystemTypeElement.text().as_string())) { | |
| 1732 | ✗ | spm.setMaximumSupplyAirTemperature(htgDsgnSupAirTemp); | |
| 1733 | ✗ | spm.setMinimumSupplyAirTemperature(clgDsgnSupAirTemp); | |
| 1734 | } | ||
| 1735 |
6/7✓ Branch 2 taken 5 times.
✓ Branch 5 taken 5 times.
✓ Branch 8 taken 5 times.
✓ Branch 11 taken 5 times.
✓ Branch 14 taken 5 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 5 times.
|
15 | } else if (istringEqual(clgCtrlElement.text().as_string(), "WarmestResetFlowFirst")) { |
| 1736 | ✗ | model::SetpointManagerWarmestTemperatureFlow spm(model); | |
| 1737 | ✗ | spm.setStrategy("FlowFirst"); | |
| 1738 | ✗ | deckSPM = spm; | |
| 1739 | ✗ | spm.addToNode(supplyOutletNode); | |
| 1740 | |||
| 1741 | ✗ | pugi::xml_node clRstSupHiElement = airSystemElement.child("ClRstSupHi"); | |
| 1742 | ✗ | boost::optional<double> _clRstSupHi = lexicalCastToDouble(clRstSupHiElement); | |
| 1743 | ✗ | if (_clRstSupHi) { | |
| 1744 | ✗ | double value = unitToUnit(_clRstSupHi.get(), "F", "C").get(); | |
| 1745 | ✗ | spm.setMaximumSetpointTemperature(value); | |
| 1746 | } | ||
| 1747 | |||
| 1748 | ✗ | pugi::xml_node clRstSupLowElement = airSystemElement.child("ClRstSupLow"); | |
| 1749 | ✗ | boost::optional<double> _clRstSupLow = lexicalCastToDouble(clRstSupLowElement); | |
| 1750 | ✗ | if (_clRstSupLow) { | |
| 1751 | ✗ | double value = unitToUnit(_clRstSupLow.get(), "F", "C").get(); | |
| 1752 | ✗ | spm.setMinimumSetpointTemperature(value); | |
| 1753 | } | ||
| 1754 | |||
| 1755 | ✗ | auto dsgnAirFlowMinElement = airSystemElement.child("DsgnAirFlowMin"); | |
| 1756 | ✗ | boost::optional<double> _dsgnAirFlowMin = lexicalCastToDouble(dsgnAirFlowMinElement); | |
| 1757 | ✗ | if (_dsgnAirFlowMin) { | |
| 1758 | ✗ | spm.setMinimumTurndownRatio(_dsgnAirFlowMin.get()); | |
| 1759 | } | ||
| 1760 |
6/7✓ Branch 2 taken 5 times.
✓ Branch 5 taken 5 times.
✓ Branch 8 taken 5 times.
✓ Branch 11 taken 5 times.
✓ Branch 14 taken 5 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 5 times.
|
15 | } else if (istringEqual(clgCtrlElement.text().as_string(), "WarmestResetTemperatureFirst")) { |
| 1761 | ✗ | model::SetpointManagerWarmestTemperatureFlow spm(model); | |
| 1762 | ✗ | spm.setStrategy("TemperatureFirst"); | |
| 1763 | ✗ | deckSPM = spm; | |
| 1764 | ✗ | spm.addToNode(supplyOutletNode); | |
| 1765 | |||
| 1766 | ✗ | pugi::xml_node clRstSupHiElement = airSystemElement.child("ClRstSupHi"); | |
| 1767 | ✗ | boost::optional<double> _clRstSupHi = lexicalCastToDouble(clRstSupHiElement); | |
| 1768 | ✗ | if (_clRstSupHi) { | |
| 1769 | ✗ | double value = unitToUnit(_clRstSupHi.get(), "F", "C").get(); | |
| 1770 | ✗ | spm.setMaximumSetpointTemperature(value); | |
| 1771 | } | ||
| 1772 | |||
| 1773 | ✗ | pugi::xml_node clRstSupLowElement = airSystemElement.child("ClRstSupLow"); | |
| 1774 | ✗ | boost::optional<double> _clRstSupLow = lexicalCastToDouble(clRstSupLowElement); | |
| 1775 | ✗ | if (_clRstSupLow) { | |
| 1776 | ✗ | double value = unitToUnit(_clRstSupLow.get(), "F", "C").get(); | |
| 1777 | ✗ | spm.setMinimumSetpointTemperature(value); | |
| 1778 | } | ||
| 1779 | |||
| 1780 | ✗ | auto dsgnAirFlowMinElement = airSystemElement.child("DsgnAirFlowMin"); | |
| 1781 | ✗ | boost::optional<double> _dsgnAirFlowMin = lexicalCastToDouble(dsgnAirFlowMinElement); | |
| 1782 | ✗ | if (_dsgnAirFlowMin) { | |
| 1783 | ✗ | spm.setMinimumTurndownRatio(_dsgnAirFlowMin.get()); | |
| 1784 | } | ||
| 1785 |
6/7✓ Branch 2 taken 5 times.
✓ Branch 5 taken 5 times.
✓ Branch 8 taken 5 times.
✓ Branch 11 taken 5 times.
✓ Branch 14 taken 5 times.
✓ Branch 18 taken 5 times.
✗ Branch 19 not taken.
|
15 | } else if (istringEqual(clgCtrlElement.text().as_string(), "WarmestReset")) { |
| 1786 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::SetpointManagerWarmest spm(model); |
| 1787 |
1/1✓ Branch 1 taken 5 times.
|
5 | deckSPM = spm; |
| 1788 |
1/1✓ Branch 1 taken 5 times.
|
5 | spm.addToNode(supplyOutletNode); |
| 1789 | |||
| 1790 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node clRstSupHiElement = airSystemElement.child("ClRstSupHi"); |
| 1791 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _clRstSupHi = lexicalCastToDouble(clRstSupHiElement); |
| 1792 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_clRstSupHi) { |
| 1793 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
15 | double value = unitToUnit(_clRstSupHi.get(), "F", "C").get(); |
| 1794 |
1/1✓ Branch 1 taken 5 times.
|
5 | spm.setMaximumSetpointTemperature(value); |
| 1795 | } | ||
| 1796 | |||
| 1797 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node clRstSupLowElement = airSystemElement.child("ClRstSupLow"); |
| 1798 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _clRstSupLow = lexicalCastToDouble(clRstSupLowElement); |
| 1799 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_clRstSupLow) { |
| 1800 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
15 | double value = unitToUnit(_clRstSupLow.get(), "F", "C").get(); |
| 1801 |
1/1✓ Branch 1 taken 5 times.
|
5 | spm.setMinimumSetpointTemperature(value); |
| 1802 | } | ||
| 1803 |
0/7✗ Branch 2 not taken.
✗ Branch 5 not taken.
✗ Branch 8 not taken.
✗ Branch 11 not taken.
✗ Branch 14 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
5 | } else if (istringEqual(clgCtrlElement.text().as_string(), "Scheduled")) { |
| 1804 | ✗ | pugi::xml_node clgSetPtSchRefElement = airSystemElement.child("ClgSetptSchRef"); | |
| 1805 | |||
| 1806 | ✗ | boost::optional<model::Schedule> schedule = model.getModelObjectByName<model::Schedule>(clgSetPtSchRefElement.text().as_string()); | |
| 1807 | |||
| 1808 | ✗ | if (!schedule) { | |
| 1809 | ✗ | model::ScheduleRuleset schedule(model); | |
| 1810 | |||
| 1811 | ✗ | schedule.setName(airLoopHVAC.name().get() + " Supply Air Temp Schedule"); | |
| 1812 | |||
| 1813 | ✗ | model::ScheduleDay scheduleDay = schedule.defaultDaySchedule(); | |
| 1814 | |||
| 1815 | ✗ | scheduleDay.addValue(Time(1.0), 12.8); | |
| 1816 | ✗ | } | |
| 1817 | |||
| 1818 | ✗ | model::SetpointManagerScheduled spm(model, schedule.get()); | |
| 1819 | |||
| 1820 | ✗ | deckSPM = spm; | |
| 1821 | |||
| 1822 | ✗ | spm.addToNode(supplyOutletNode); | |
| 1823 | ✗ | } else if (istringEqual(clgCtrlElement.text().as_string(), "OutsideAirReset")) { | |
| 1824 | ✗ | model::SetpointManagerOutdoorAirReset spm(model); | |
| 1825 | |||
| 1826 | ✗ | deckSPM = spm; | |
| 1827 | |||
| 1828 | ✗ | spm.addToNode(supplyOutletNode); | |
| 1829 | |||
| 1830 | ✗ | boost::optional<double> rstSupHi; | |
| 1831 | ✗ | boost::optional<double> rstSupLow; | |
| 1832 | ✗ | boost::optional<double> rstOutdrHi; | |
| 1833 | ✗ | boost::optional<double> rstOutdrLow; | |
| 1834 | |||
| 1835 | ✗ | pugi::xml_node clRstSupHiElement = airSystemElement.child("ClRstSupHi"); | |
| 1836 | ✗ | boost::optional<double> _clRstSupHi = lexicalCastToDouble(clRstSupHiElement); | |
| 1837 | ✗ | if (_clRstSupHi) { | |
| 1838 | ✗ | rstSupHi = unitToUnit(_clRstSupHi.get(), "F", "C").get(); | |
| 1839 | } | ||
| 1840 | |||
| 1841 | ✗ | pugi::xml_node clRstSupLowElement = airSystemElement.child("ClRstSupLow"); | |
| 1842 | ✗ | boost::optional<double> _clRstSupLow = lexicalCastToDouble(clRstSupLowElement); | |
| 1843 | ✗ | if (_clRstSupLow) { | |
| 1844 | ✗ | rstSupLow = unitToUnit(_clRstSupLow.get(), "F", "C").get(); | |
| 1845 | } | ||
| 1846 | |||
| 1847 | ✗ | pugi::xml_node clRstOutdrHiElement = airSystemElement.child("ClRstOutdrHi"); | |
| 1848 | ✗ | boost::optional<double> _clRstOutdrHi = lexicalCastToDouble(clRstOutdrHiElement); | |
| 1849 | ✗ | if (_clRstOutdrHi) { | |
| 1850 | ✗ | rstOutdrHi = unitToUnit(_clRstOutdrHi.get(), "F", "C").get(); | |
| 1851 | } | ||
| 1852 | |||
| 1853 | ✗ | pugi::xml_node clRstOutdrLowElement = airSystemElement.child("ClRstOutdrLow"); | |
| 1854 | ✗ | boost::optional<double> _clRstOutdrLow = lexicalCastToDouble(clRstOutdrLowElement); | |
| 1855 | ✗ | if (_clRstOutdrLow) { | |
| 1856 | ✗ | rstOutdrLow = unitToUnit(_clRstOutdrLow.get(), "F", "C").get(); | |
| 1857 | } | ||
| 1858 | |||
| 1859 | ✗ | if (rstSupHi && rstSupLow && rstOutdrHi && rstOutdrLow) { | |
| 1860 | ✗ | if (rstOutdrHi > rstOutdrLow) { | |
| 1861 | ✗ | spm.setOutdoorHighTemperature(rstOutdrHi.get()); | |
| 1862 | ✗ | spm.setSetpointatOutdoorHighTemperature(rstSupHi.get()); | |
| 1863 | ✗ | spm.setOutdoorLowTemperature(rstOutdrLow.get()); | |
| 1864 | ✗ | spm.setSetpointatOutdoorLowTemperature(rstSupLow.get()); | |
| 1865 | } else { | ||
| 1866 | ✗ | spm.setOutdoorHighTemperature(rstOutdrLow.get()); | |
| 1867 | ✗ | spm.setSetpointatOutdoorHighTemperature(rstSupLow.get()); | |
| 1868 | ✗ | spm.setOutdoorLowTemperature(rstOutdrHi.get()); | |
| 1869 | ✗ | spm.setSetpointatOutdoorLowTemperature(rstSupHi.get()); | |
| 1870 | } | ||
| 1871 | } else { | ||
| 1872 | ✗ | LOG(Warn, nameElement.text().as_string() << " requests OA reset control, but does not define setpoints." << " Using OpenStudio defaults."); | |
| 1873 | |||
| 1874 | ✗ | spm.setOutdoorLowTemperature(10.0); | |
| 1875 | ✗ | spm.setSetpointatOutdoorLowTemperature(22.0); | |
| 1876 | ✗ | spm.setOutdoorHighTemperature(24.0); | |
| 1877 | ✗ | spm.setSetpointatOutdoorHighTemperature(10.0); | |
| 1878 | } | ||
| 1879 | ✗ | } else if (istringEqual(clgCtrlElement.text().as_string(), "FixedDualSetpoint")) { | |
| 1880 | ✗ | double clgFixedSupTemp = 23.89; | |
| 1881 | ✗ | double htgFixedSupTemp = 15.56; | |
| 1882 | |||
| 1883 | ✗ | pugi::xml_node clgFixedSupTempElement = airSystemElement.child("ClgFixedSupTemp"); | |
| 1884 | ✗ | boost::optional<double> _clgFixedSupTemp = lexicalCastToDouble(clgFixedSupTempElement); | |
| 1885 | ✗ | if (_clgFixedSupTemp) { | |
| 1886 | ✗ | clgFixedSupTemp = unitToUnit(_clgFixedSupTemp.get(), "F", "C").get(); | |
| 1887 | } else { | ||
| 1888 | ✗ | LOG(Warn, nameElement.text().as_string() << " requests fixed dual setpoint control, but does not define setpoints." | |
| 1889 | << " Using OpenStudio defaults."); | ||
| 1890 | } | ||
| 1891 | |||
| 1892 | ✗ | pugi::xml_node htgFixedSupTempElement = airSystemElement.child("HtgFixedSupTemp"); | |
| 1893 | ✗ | boost::optional<double> _htgFixedSupTemp = lexicalCastToDouble(htgFixedSupTempElement); | |
| 1894 | ✗ | if (_htgFixedSupTemp) { | |
| 1895 | ✗ | htgFixedSupTemp = unitToUnit(_htgFixedSupTemp.get(), "F", "C").get(); | |
| 1896 | } else { | ||
| 1897 | ✗ | LOG(Warn, nameElement.text().as_string() << " requests fixed dual setpoint control, but does not define setpoints." | |
| 1898 | << " Using OpenStudio defaults."); | ||
| 1899 | } | ||
| 1900 | |||
| 1901 | ✗ | model::ScheduleRuleset coolingSchedule(model); | |
| 1902 | ✗ | coolingSchedule.setName(airLoopHVAC.name().get() + " Cooling SP Schedule"); | |
| 1903 | ✗ | coolingSchedule.defaultDaySchedule().addValue(Time(1.0), clgFixedSupTemp); | |
| 1904 | |||
| 1905 | ✗ | model::ScheduleRuleset heatingSchedule(model); | |
| 1906 | ✗ | heatingSchedule.setName(airLoopHVAC.name().get() + " Heating SP Schedule"); | |
| 1907 | ✗ | heatingSchedule.defaultDaySchedule().addValue(Time(1.0), htgFixedSupTemp); | |
| 1908 | |||
| 1909 | ✗ | createDualSetpoints(coolingSchedule, heatingSchedule); | |
| 1910 | ✗ | } else if (istringEqual(clgCtrlElement.text().as_string(), "ScheduledDualSetPoint")) { | |
| 1911 | ✗ | boost::optional<model::Schedule> coolingSchedule; | |
| 1912 | ✗ | boost::optional<model::Schedule> heatingSchedule; | |
| 1913 | |||
| 1914 | ✗ | double clgFixedSupTemp = 23.89; | |
| 1915 | ✗ | double htgFixedSupTemp = 15.56; | |
| 1916 | |||
| 1917 | ✗ | pugi::xml_node clgSetptSchRefElement = airSystemElement.child("ClgSetptSchRef"); | |
| 1918 | ✗ | std::string clgSetptSchRef = escapeName(clgSetptSchRefElement.text().as_string()); | |
| 1919 | ✗ | coolingSchedule = model.getModelObjectByName<model::Schedule>(clgSetptSchRef); | |
| 1920 | |||
| 1921 | ✗ | if (!coolingSchedule) { | |
| 1922 | ✗ | LOG(Warn, nameElement.text().as_string() << " requests scheduled dual setpoint control, but does not define schedules." | |
| 1923 | << " Using OpenStudio defaults."); | ||
| 1924 | |||
| 1925 | ✗ | model::ScheduleRuleset schedule(model); | |
| 1926 | ✗ | schedule.setName(airLoopHVAC.name().get() + " Cooling SP Schedule"); | |
| 1927 | ✗ | schedule.defaultDaySchedule().addValue(Time(1.0), clgFixedSupTemp); | |
| 1928 | ✗ | coolingSchedule = schedule; | |
| 1929 | ✗ | } | |
| 1930 | |||
| 1931 | ✗ | pugi::xml_node htgSetptSchRefElement = airSystemElement.child("HtgSetptSchRef"); | |
| 1932 | ✗ | std::string htgSetptSchRef = escapeName(htgSetptSchRefElement.text().as_string()); | |
| 1933 | ✗ | heatingSchedule = model.getModelObjectByName<model::Schedule>(htgSetptSchRef); | |
| 1934 | |||
| 1935 | ✗ | if (!heatingSchedule) { | |
| 1936 | ✗ | LOG(Warn, nameElement.text().as_string() << " requests scheduled dual setpoint control, but does not define schedules." | |
| 1937 | << " Using OpenStudio defaults."); | ||
| 1938 | |||
| 1939 | ✗ | model::ScheduleRuleset schedule(model); | |
| 1940 | ✗ | schedule.setName(airLoopHVAC.name().get() + " Heating SP Schedule"); | |
| 1941 | ✗ | schedule.defaultDaySchedule().addValue(Time(1.0), htgFixedSupTemp); | |
| 1942 | ✗ | heatingSchedule = schedule; | |
| 1943 | ✗ | } | |
| 1944 | |||
| 1945 | ✗ | OS_ASSERT(coolingSchedule); | |
| 1946 | ✗ | OS_ASSERT(heatingSchedule); | |
| 1947 | |||
| 1948 | ✗ | createDualSetpoints(coolingSchedule.get(), heatingSchedule.get()); | |
| 1949 | ✗ | } | |
| 1950 | |||
| 1951 | 5 | return result; | |
| 1952 | 5 | } | |
| 1953 | |||
| 1954 | 26 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateCoilHeating(const pugi::xml_node& heatingCoilElement, | |
| 1955 | openstudio::model::Model& model) { | ||
| 1956 | 26 | boost::optional<model::ModelObject> result; | |
| 1957 | |||
| 1958 |
5/6✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
✓ Branch 10 taken 26 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 26 times.
|
104 | if (!istringEqual(heatingCoilElement.name(), "CoilHtg")) { |
| 1959 | ✗ | return result; | |
| 1960 | } | ||
| 1961 | |||
| 1962 | 26 | bool znSys = false; | |
| 1963 |
6/7✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
✓ Branch 10 taken 26 times.
✓ Branch 13 taken 26 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 26 times.
|
78 | if (openstudio::istringEqual(heatingCoilElement.parent().name(), "ZnSys")) { |
| 1964 | ✗ | znSys = true; | |
| 1965 | } | ||
| 1966 | |||
| 1967 | // Type | ||
| 1968 |
1/1✓ Branch 1 taken 26 times.
|
26 | pugi::xml_node coilHeatingTypeElement = heatingCoilElement.child("Type"); |
| 1969 |
1/1✓ Branch 1 taken 26 times.
|
26 | pugi::xml_node nameElement = heatingCoilElement.child("Name"); |
| 1970 |
3/3✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
|
26 | std::string coilName = nameElement.text().as_string(); |
| 1971 |
1/1✓ Branch 1 taken 26 times.
|
26 | pugi::xml_node capTotRtdElement = heatingCoilElement.child("CapTotGrossRtdSim"); |
| 1972 | |||
| 1973 | // CapTotGrossRtd | ||
| 1974 | 26 | boost::optional<double> capTotGrossRtd; | |
| 1975 | |||
| 1976 |
2/3✓ Branch 1 taken 26 times.
✓ Branch 3 taken 26 times.
✗ Branch 4 not taken.
|
26 | if (!autosize()) { |
| 1977 |
1/1✓ Branch 1 taken 26 times.
|
26 | boost::optional<double> _capTotRtd = lexicalCastToDouble(capTotRtdElement); |
| 1978 | |||
| 1979 |
1/2✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
|
26 | if (_capTotRtd) { |
| 1980 |
3/3✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
|
26 | Quantity valueIP(_capTotRtd.get(), createBTUPower()); |
| 1981 |
3/3✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
|
26 | OptionalQuantity valueSI = QuantityConverter::instance().convert(valueIP, UnitSystem(UnitSystem::SI)); |
| 1982 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
✗ Branch 4 not taken.
|
26 | OS_ASSERT(valueSI); |
| 1983 |
3/3✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
|
26 | capTotGrossRtd = valueSI->value(); |
| 1984 | 26 | } | |
| 1985 | } | ||
| 1986 | |||
| 1987 | // Flow Capacity | ||
| 1988 | // Look for a sibling fan to figure out what the flow capacity should be | ||
| 1989 | 26 | boost::optional<double> _flowCap; | |
| 1990 | |||
| 1991 |
2/3✓ Branch 1 taken 26 times.
✓ Branch 3 taken 26 times.
✗ Branch 4 not taken.
|
26 | if (!autosize()) { |
| 1992 |
1/1✓ Branch 1 taken 26 times.
|
26 | pugi::xml_node flowCapElement; |
| 1993 | |||
| 1994 |
1/1✓ Branch 1 taken 26 times.
|
26 | pugi::xml_node airSegElement = heatingCoilElement.parent(); |
| 1995 | |||
| 1996 |
2/3✓ Branch 1 taken 26 times.
✓ Branch 3 taken 26 times.
✗ Branch 4 not taken.
|
26 | if (airSegElement) { |
| 1997 |
1/1✓ Branch 1 taken 26 times.
|
26 | pugi::xml_node fanElement = airSegElement.child("Fan"); |
| 1998 | |||
| 1999 |
3/3✓ Branch 1 taken 26 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 21 times.
|
26 | if (fanElement) { |
| 2000 |
1/1✓ Branch 1 taken 5 times.
|
5 | flowCapElement = fanElement.child("FlowCapSim"); |
| 2001 | |||
| 2002 |
1/1✓ Branch 1 taken 5 times.
|
5 | _flowCap = lexicalCastToDouble(flowCapElement); |
| 2003 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_flowCap) { |
| 2004 |
6/6✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 16 taken 5 times.
|
20 | _flowCap = unitToUnit(_flowCap.get(), "cfm", "m^3/s").get(); |
| 2005 | } | ||
| 2006 | } | ||
| 2007 | } | ||
| 2008 | } | ||
| 2009 | |||
| 2010 | // Furnace | ||
| 2011 |
6/7✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
✓ Branch 10 taken 26 times.
✓ Branch 13 taken 26 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 26 times.
|
78 | if (istringEqual(coilHeatingTypeElement.text().as_string(), "Furnace")) { |
| 2012 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 2013 | |||
| 2014 | ✗ | model::CoilHeatingGas coil(model, schedule); | |
| 2015 | |||
| 2016 | ✗ | coil.setName(coilName); | |
| 2017 | |||
| 2018 | // CapTotGrossRtd | ||
| 2019 | ✗ | if (capTotGrossRtd) { | |
| 2020 | ✗ | coil.setNominalCapacity(capTotGrossRtd.get()); | |
| 2021 | } | ||
| 2022 | |||
| 2023 | // FurnHIR_fPLRCrvRef | ||
| 2024 | ✗ | boost::optional<model::Curve> hirCurve; | |
| 2025 | ✗ | pugi::xml_node hirCurveElement = heatingCoilElement.child("FurnHIR_fPLRCrvRef"); | |
| 2026 | ✗ | hirCurve = model.getModelObjectByName<model::Curve>(hirCurveElement.text().as_string()); | |
| 2027 | ✗ | if (hirCurve) { | |
| 2028 | ✗ | coil.setPartLoadFractionCorrelationCurve(hirCurve.get()); | |
| 2029 | } | ||
| 2030 | |||
| 2031 | // FurnThrmlEff | ||
| 2032 | ✗ | pugi::xml_node furnThrmlEffElement = heatingCoilElement.child("FurnThrmlEff"); | |
| 2033 | ✗ | boost::optional<double> _furnThrmlEff = lexicalCastToDouble(furnThrmlEffElement); | |
| 2034 | ✗ | if (_furnThrmlEff) { | |
| 2035 | ✗ | coil.setGasBurnerEfficiency(_furnThrmlEff.get()); | |
| 2036 | } | ||
| 2037 | |||
| 2038 | // FurnPilotFuelInp | ||
| 2039 | ✗ | pugi::xml_node furnPilotFuelInpElement = heatingCoilElement.child("FurnPilotFuelInp"); | |
| 2040 | ✗ | boost::optional<double> _furnPilotFuelInp = lexicalCastToDouble(furnPilotFuelInpElement); | |
| 2041 | ✗ | if (_furnPilotFuelInp) { | |
| 2042 | ✗ | double value = unitToUnit(_furnPilotFuelInp.get(), "Btu/h", "W").get(); | |
| 2043 | ✗ | coil.setOffCycleParasiticGasLoad(value); | |
| 2044 | } | ||
| 2045 | |||
| 2046 | ✗ | result = coil; | |
| 2047 |
6/7✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
✓ Branch 10 taken 26 times.
✓ Branch 13 taken 26 times.
✓ Branch 16 taken 26 times.
✓ Branch 20 taken 26 times.
✗ Branch 21 not taken.
|
78 | } else if (istringEqual(coilHeatingTypeElement.text().as_string(), "HotWater")) { |
| 2048 |
1/1✓ Branch 1 taken 26 times.
|
26 | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); |
| 2049 | |||
| 2050 |
1/1✓ Branch 1 taken 26 times.
|
26 | model::CoilHeatingWater coil(model, schedule); |
| 2051 | |||
| 2052 |
1/1✓ Branch 1 taken 26 times.
|
26 | coil.setName(coilName); |
| 2053 | |||
| 2054 |
1/1✓ Branch 1 taken 26 times.
|
26 | pugi::xml_node fluidSegInRefElement = heatingCoilElement.child("FluidSegInRef"); |
| 2055 | |||
| 2056 | 26 | boost::optional<model::PlantLoop> plant; | |
| 2057 |
2/3✓ Branch 1 taken 26 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 26 times.
|
26 | if (!fluidSegInRefElement) { |
| 2058 | ✗ | LOG(Error, "CoilHeatingWater '" << coilName << "' doesn't have a FluidSegInRef element! It will not be connected."); | |
| 2059 | } else { | ||
| 2060 |
1/1✓ Branch 1 taken 26 times.
|
26 | boost::optional<model::PlantLoop> plant = loopForSupplySegment(fluidSegInRefElement, model); |
| 2061 | |||
| 2062 |
1/2✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
|
26 | if (plant) { |
| 2063 |
3/3✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
|
26 | plant->addDemandBranchForComponent(coil); |
| 2064 | // Figure out if this is connected to a ServiceHotWater system | ||
| 2065 | // If it is then make sure any supply segment pumps go on the branch, | ||
| 2066 | // as opposed to the demand side inlet branch | ||
| 2067 |
1/1✓ Branch 1 taken 26 times.
|
26 | auto supplySegmentElement = supplySegment(fluidSegInRefElement); |
| 2068 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | auto fluidSysTypeElment = supplySegmentElement.parent().child("Type"); |
| 2069 |
6/7✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
✓ Branch 10 taken 26 times.
✓ Branch 13 taken 26 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 26 times.
|
78 | if (openstudio::istringEqual(fluidSysTypeElment.text().as_string(), "ServiceHotWater")) { |
| 2070 | ✗ | auto pumpElement = supplySegmentElement.child("Pump"); | |
| 2071 | ✗ | if (pumpElement) { | |
| 2072 | ✗ | if (auto modelObject = translatePump(pumpElement, model)) { | |
| 2073 | ✗ | auto hvacComponent = modelObject->cast<model::HVACComponent>(); | |
| 2074 | ✗ | auto inletNode = coil.waterInletModelObject()->cast<model::Node>(); | |
| 2075 | ✗ | hvacComponent.addToNode(inletNode); | |
| 2076 | ✗ | } | |
| 2077 | } | ||
| 2078 | } | ||
| 2079 | } else { | ||
| 2080 | ✗ | LOG(Error, "CoilHeatingWater '" << coilName << "' has a FluidSegInRef of '" << fluidSegInRefElement.text().as_string() | |
| 2081 | << "' but we couldn't find a plantLoop that matches."); | ||
| 2082 | } | ||
| 2083 | 26 | } | |
| 2084 | |||
| 2085 |
1/2✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
|
26 | if (capTotGrossRtd) { |
| 2086 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | coil.setPerformanceInputMethod("NominalCapacity"); |
| 2087 | |||
| 2088 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | coil.setRatedCapacity(capTotGrossRtd.get()); |
| 2089 | |||
| 2090 |
1/1✓ Branch 1 taken 26 times.
|
26 | coil.setRatedInletWaterTemperature(82.2); |
| 2091 | |||
| 2092 |
1/1✓ Branch 1 taken 26 times.
|
26 | coil.setRatedInletAirTemperature(16.6); |
| 2093 | |||
| 2094 |
1/1✓ Branch 1 taken 26 times.
|
26 | coil.setRatedOutletWaterTemperature(71.1); |
| 2095 | |||
| 2096 |
1/1✓ Branch 1 taken 26 times.
|
26 | coil.setRatedOutletAirTemperature(32.2); |
| 2097 | |||
| 2098 | // Find related/containing systems (aka figure out the context of the coil) | ||
| 2099 | |||
| 2100 |
1/1✓ Branch 1 taken 26 times.
|
26 | pugi::xml_node sysElement; |
| 2101 | |||
| 2102 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | pugi::xml_node airSysElement = heatingCoilElement.parent().parent(); |
| 2103 | |||
| 2104 |
1/1✓ Branch 1 taken 26 times.
|
26 | pugi::xml_node znSysElement = heatingCoilElement.parent(); |
| 2105 | |||
| 2106 |
5/6✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
✓ Branch 10 taken 26 times.
✓ Branch 14 taken 26 times.
✗ Branch 15 not taken.
|
104 | if (openstudio::istringEqual(airSysElement.name(), "AirSys")) { |
| 2107 | 26 | sysElement = airSysElement; | |
| 2108 | ✗ | } else if (openstudio::istringEqual(airSysElement.name(), "ZnSys")) { | |
| 2109 | ✗ | sysElement = znSysElement; | |
| 2110 | } | ||
| 2111 | |||
| 2112 | //pugi::xml_node htgDsgnSupAirTempElement = sysElement.child("HtgDsgnSupAirTemp"); | ||
| 2113 | |||
| 2114 | //boost::optional<double> _htgDsgnSupAirTemp = lexicalCastToDouble(htgDsgnSupAirTempElement); | ||
| 2115 | |||
| 2116 | //if( ok ) | ||
| 2117 | //{ | ||
| 2118 | // coil.setRatedOutletAirTemperature(unitToUnit(value,"F","C").get()); | ||
| 2119 | //} | ||
| 2120 | |||
| 2121 | //if( plant ) | ||
| 2122 | //{ | ||
| 2123 | // model::SizingPlant sizingPlant = plant->sizingPlant(); | ||
| 2124 | |||
| 2125 | // coil.setRatedInletWaterTemperature(sizingPlant.designLoopExitTemperature()); | ||
| 2126 | |||
| 2127 | // coil.setRatedOutletWaterTemperature(sizingPlant.designLoopExitTemperature() - sizingPlant.loopDesignTemperatureDifference()); | ||
| 2128 | //} | ||
| 2129 | } | ||
| 2130 | |||
| 2131 |
1/1✓ Branch 1 taken 26 times.
|
26 | result = coil; |
| 2132 |
0/7✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
|
26 | } else if (istringEqual(coilHeatingTypeElement.text().as_string(), "Resistance")) { |
| 2133 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 2134 | |||
| 2135 | ✗ | model::CoilHeatingElectric coil(model, schedule); | |
| 2136 | |||
| 2137 | ✗ | coil.setName(coilName); | |
| 2138 | |||
| 2139 | // CapTotGrossRtd | ||
| 2140 | ✗ | if (capTotGrossRtd) { | |
| 2141 | ✗ | coil.setNominalCapacity(capTotGrossRtd.get()); | |
| 2142 | } | ||
| 2143 | |||
| 2144 | ✗ | result = coil; | |
| 2145 | ✗ | } else if (istringEqual(coilHeatingTypeElement.text().as_string(), "HeatPump")) { | |
| 2146 | ✗ | pugi::xml_node cndsrTypeElement = heatingCoilElement.child("CndsrType"); | |
| 2147 | ✗ | if (openstudio::istringEqual(cndsrTypeElement.text().as_string(), "WaterSource")) { | |
| 2148 | ✗ | model::CoilHeatingWaterToAirHeatPumpEquationFit coil(model); | |
| 2149 | ✗ | coil.setName(coilName); | |
| 2150 | ✗ | boost::optional<model::AirLoopHVACUnitarySystem> unitary; | |
| 2151 | ✗ | if (znSys) { | |
| 2152 | ✗ | result = coil; | |
| 2153 | } else { | ||
| 2154 | ✗ | unitary = model::AirLoopHVACUnitarySystem(model); | |
| 2155 | ✗ | unitary->setName(coilName + " Unitary"); | |
| 2156 | ✗ | unitary->getImpl<model::detail::AirLoopHVACUnitarySystem_Impl>()->setControlType("SetPoint"); | |
| 2157 | ✗ | unitary->setHeatingCoil(coil); | |
| 2158 | ✗ | result = unitary.get(); | |
| 2159 | } | ||
| 2160 | |||
| 2161 | // Plant | ||
| 2162 | ✗ | pugi::xml_node fluidSegInRefElement = heatingCoilElement.child("FluidSegInRef"); | |
| 2163 | ✗ | if (!fluidSegInRefElement) { | |
| 2164 | ✗ | LOG(Error, "CoilHeatingWaterToAirHeatPumpEquationFit '" << coilName << "' doesn't have a FluidSegInRef element! It will not be connected."); | |
| 2165 | } else { | ||
| 2166 | ✗ | boost::optional<model::PlantLoop> plant = loopForSupplySegment(fluidSegInRefElement, model); | |
| 2167 | ✗ | if (plant) { | |
| 2168 | ✗ | plant->addDemandBranchForComponent(coil); | |
| 2169 | } | ||
| 2170 | ✗ | } | |
| 2171 | |||
| 2172 | ✗ | if (!autosize()) { | |
| 2173 | // Look for a sibling fan to figure out what the flow capacity should be | ||
| 2174 | ✗ | pugi::xml_node flowCapElement; | |
| 2175 | ✗ | pugi::xml_node airSegElement = heatingCoilElement.parent(); | |
| 2176 | ✗ | if (airSegElement) { | |
| 2177 | ✗ | pugi::xml_node fanElement = airSegElement.child("Fan"); | |
| 2178 | ✗ | if (fanElement) { | |
| 2179 | ✗ | flowCapElement = fanElement.child("FlowCapSim"); | |
| 2180 | } | ||
| 2181 | } | ||
| 2182 | |||
| 2183 | ✗ | _flowCap = lexicalCastToDouble(flowCapElement); | |
| 2184 | ✗ | if (_flowCap) { | |
| 2185 | ✗ | double value = unitToUnit(_flowCap.get(), "cfm", "m^3/s").get(); | |
| 2186 | ✗ | coil.setRatedAirFlowRate(value); | |
| 2187 | ✗ | if (unitary) { | |
| 2188 | ✗ | unitary->setSupplyAirFlowRateDuringHeatingOperation(value); | |
| 2189 | } | ||
| 2190 | } | ||
| 2191 | } | ||
| 2192 | |||
| 2193 | ✗ | if (!autosize()) { | |
| 2194 | ✗ | pugi::xml_node fluidFlowRtDsgnSimElement = heatingCoilElement.child("FluidFlowRtDsgnSim"); | |
| 2195 | ✗ | boost::optional<double> _fluidFlowRtDsgnSim = lexicalCastToDouble(fluidFlowRtDsgnSimElement); | |
| 2196 | ✗ | if (_fluidFlowRtDsgnSim) { | |
| 2197 | ✗ | double value = unitToUnit(_fluidFlowRtDsgnSim.get(), "gal/min", "m^3/s").get(); | |
| 2198 | ✗ | coil.setRatedWaterFlowRate(value); | |
| 2199 | } | ||
| 2200 | } | ||
| 2201 | |||
| 2202 | ✗ | if (!autosize()) { | |
| 2203 | ✗ | pugi::xml_node capTotRtdSimElement = heatingCoilElement.child("CapTotGrossRtdSim"); | |
| 2204 | ✗ | boost::optional<double> _capTotRtdSim = lexicalCastToDouble(capTotRtdSimElement); | |
| 2205 | ✗ | if (_capTotRtdSim) { | |
| 2206 | ✗ | double value = unitToUnit(_capTotRtdSim.get(), "Btu/h", "W").get(); | |
| 2207 | ✗ | coil.setRatedHeatingCapacity(value); | |
| 2208 | } | ||
| 2209 | } | ||
| 2210 | |||
| 2211 | ✗ | pugi::xml_node htPumpCOPElement = heatingCoilElement.child("HtPumpCOP"); | |
| 2212 | ✗ | boost::optional<double> _htPumpCOP = lexicalCastToDouble(htPumpCOPElement); | |
| 2213 | ✗ | if (_htPumpCOP) { | |
| 2214 | ✗ | coil.setRatedHeatingCoefficientofPerformance(_htPumpCOP.get()); | |
| 2215 | } | ||
| 2216 | |||
| 2217 | ✗ | pugi::xml_node htPumpEIRElement = heatingCoilElement.child("HtPumpEIR"); | |
| 2218 | ✗ | boost::optional<double> _htPumpEIR = lexicalCastToDouble(htPumpEIRElement); | |
| 2219 | ✗ | if (_htPumpEIR) { | |
| 2220 | ✗ | coil.setRatedHeatingCoefficientofPerformance(1.0 / _htPumpEIR.get()); | |
| 2221 | } | ||
| 2222 | |||
| 2223 | ✗ | model::Curve _heatingCapacityCurve = coil.heatingCapacityCurve(); | |
| 2224 | ✗ | model::CurveQuadLinear heatingCapacityCurve = _heatingCapacityCurve.cast<model::CurveQuadLinear>(); | |
| 2225 | ✗ | heatingCapacityCurve.setCoefficient1Constant(-1.361311959); | |
| 2226 | ✗ | heatingCapacityCurve.setCoefficient2w(-2.471798046); | |
| 2227 | ✗ | heatingCapacityCurve.setCoefficient3x(4.173164514); | |
| 2228 | ✗ | heatingCapacityCurve.setCoefficient4y(0.640757401); | |
| 2229 | ✗ | heatingCapacityCurve.setCoefficient5z(0.0); | |
| 2230 | |||
| 2231 | ✗ | model::Curve _heatingPowerConsumptionCurve = coil.heatingPowerConsumptionCurve(); | |
| 2232 | ✗ | model::CurveQuadLinear heatingPowerConsumptionCurve = _heatingPowerConsumptionCurve.cast<model::CurveQuadLinear>(); | |
| 2233 | ✗ | heatingPowerConsumptionCurve.setCoefficient1Constant(-2.176941116); | |
| 2234 | ✗ | heatingPowerConsumptionCurve.setCoefficient2w(0.832114286); | |
| 2235 | ✗ | heatingPowerConsumptionCurve.setCoefficient3x(1.570743399); | |
| 2236 | ✗ | heatingPowerConsumptionCurve.setCoefficient4y(0.690793651); | |
| 2237 | ✗ | heatingPowerConsumptionCurve.setCoefficient5z(0.0); | |
| 2238 | |||
| 2239 | ✗ | } else { | |
| 2240 | // HtPumpCap_fTempCrvRef | ||
| 2241 | ✗ | boost::optional<model::Curve> totalHeatingCapacityFunctionofTemperatureCurve; | |
| 2242 | ✗ | pugi::xml_node totalHeatingCapacityFunctionofTemperatureCurveElement = heatingCoilElement.child("HtPumpCap_fTempCrvRef"); | |
| 2243 | totalHeatingCapacityFunctionofTemperatureCurve = | ||
| 2244 | ✗ | model.getModelObjectByName<model::Curve>(totalHeatingCapacityFunctionofTemperatureCurveElement.text().as_string()); | |
| 2245 | |||
| 2246 | ✗ | if (!totalHeatingCapacityFunctionofTemperatureCurve) { | |
| 2247 | ✗ | model::CurveCubic _totalHeatingCapacityFunctionofTemperatureCurve(model); | |
| 2248 | ✗ | _totalHeatingCapacityFunctionofTemperatureCurve.setCoefficient1Constant(0.758746); | |
| 2249 | ✗ | _totalHeatingCapacityFunctionofTemperatureCurve.setCoefficient2x(0.027626); | |
| 2250 | ✗ | _totalHeatingCapacityFunctionofTemperatureCurve.setCoefficient3xPOW2(0.000148716); | |
| 2251 | ✗ | _totalHeatingCapacityFunctionofTemperatureCurve.setCoefficient4xPOW3(0.0000034992); | |
| 2252 | ✗ | _totalHeatingCapacityFunctionofTemperatureCurve.setMinimumValueofx(-20.0); | |
| 2253 | ✗ | _totalHeatingCapacityFunctionofTemperatureCurve.setMaximumValueofx(20.0); | |
| 2254 | |||
| 2255 | ✗ | totalHeatingCapacityFunctionofTemperatureCurve = _totalHeatingCapacityFunctionofTemperatureCurve; | |
| 2256 | ✗ | } | |
| 2257 | |||
| 2258 | // HtPumpCap_fFlowCrvRef | ||
| 2259 | ✗ | boost::optional<model::Curve> totalHeatingCapacityFunctionofFlowFractionCurve; | |
| 2260 | ✗ | pugi::xml_node totalHeatingCapacityFunctionofFlowFractionCurveElement = heatingCoilElement.child("HtPumpCap_fFlowCrvRef"); | |
| 2261 | totalHeatingCapacityFunctionofFlowFractionCurve = | ||
| 2262 | ✗ | model.getModelObjectByName<model::Curve>(totalHeatingCapacityFunctionofFlowFractionCurveElement.text().as_string()); | |
| 2263 | |||
| 2264 | ✗ | if (!totalHeatingCapacityFunctionofFlowFractionCurve) { | |
| 2265 | ✗ | model::CurveCubic _totalHeatingCapacityFunctionofFlowFractionCurve(model); | |
| 2266 | ✗ | _totalHeatingCapacityFunctionofFlowFractionCurve.setCoefficient1Constant(0.84); | |
| 2267 | ✗ | _totalHeatingCapacityFunctionofFlowFractionCurve.setCoefficient2x(0.16); | |
| 2268 | ✗ | _totalHeatingCapacityFunctionofFlowFractionCurve.setCoefficient3xPOW2(0.0); | |
| 2269 | ✗ | _totalHeatingCapacityFunctionofFlowFractionCurve.setCoefficient4xPOW3(0.0); | |
| 2270 | ✗ | _totalHeatingCapacityFunctionofFlowFractionCurve.setMinimumValueofx(0.5); | |
| 2271 | ✗ | _totalHeatingCapacityFunctionofFlowFractionCurve.setMaximumValueofx(1.5); | |
| 2272 | |||
| 2273 | ✗ | totalHeatingCapacityFunctionofFlowFractionCurve = _totalHeatingCapacityFunctionofFlowFractionCurve; | |
| 2274 | ✗ | } | |
| 2275 | |||
| 2276 | // HtPumpEIR_fTempCrvRef | ||
| 2277 | ✗ | boost::optional<model::Curve> energyInputRatioFunctionofTemperatureCurve; | |
| 2278 | ✗ | pugi::xml_node energyInputRatioFunctionofTemperatureCurveElement = heatingCoilElement.child("HtPumpEIR_fTempCrvRef"); | |
| 2279 | energyInputRatioFunctionofTemperatureCurve = | ||
| 2280 | ✗ | model.getModelObjectByName<model::Curve>(energyInputRatioFunctionofTemperatureCurveElement.text().as_string()); | |
| 2281 | |||
| 2282 | ✗ | if (!energyInputRatioFunctionofTemperatureCurve) { | |
| 2283 | ✗ | model::CurveCubic _energyInputRatioFunctionofTemperatureCurve(model); | |
| 2284 | ✗ | _energyInputRatioFunctionofTemperatureCurve.setCoefficient1Constant(1.19248); | |
| 2285 | ✗ | _energyInputRatioFunctionofTemperatureCurve.setCoefficient2x(-0.0300438); | |
| 2286 | ✗ | _energyInputRatioFunctionofTemperatureCurve.setCoefficient3xPOW2(0.00103745); | |
| 2287 | ✗ | _energyInputRatioFunctionofTemperatureCurve.setCoefficient4xPOW3(-0.000023328); | |
| 2288 | ✗ | _energyInputRatioFunctionofTemperatureCurve.setMinimumValueofx(-20.0); | |
| 2289 | ✗ | _energyInputRatioFunctionofTemperatureCurve.setMaximumValueofx(20.0); | |
| 2290 | |||
| 2291 | ✗ | energyInputRatioFunctionofTemperatureCurve = _energyInputRatioFunctionofTemperatureCurve; | |
| 2292 | ✗ | } | |
| 2293 | |||
| 2294 | // HtPumpEIR_fFlowCrvRef | ||
| 2295 | ✗ | boost::optional<model::Curve> energyInputRatioFunctionofFlowFractionCurve; | |
| 2296 | ✗ | pugi::xml_node energyInputRatioFunctionofFlowFractionCurveElement = heatingCoilElement.child("HtPumpEIR_fFlowCrvRef"); | |
| 2297 | energyInputRatioFunctionofFlowFractionCurve = | ||
| 2298 | ✗ | model.getModelObjectByName<model::Curve>(energyInputRatioFunctionofFlowFractionCurveElement.text().as_string()); | |
| 2299 | |||
| 2300 | ✗ | if (!energyInputRatioFunctionofFlowFractionCurve) { | |
| 2301 | ✗ | model::CurveQuadratic _energyInputRatioFunctionofFlowFractionCurve(model); | |
| 2302 | ✗ | _energyInputRatioFunctionofFlowFractionCurve.setCoefficient1Constant(1.3824); | |
| 2303 | ✗ | _energyInputRatioFunctionofFlowFractionCurve.setCoefficient2x(-0.4336); | |
| 2304 | ✗ | _energyInputRatioFunctionofFlowFractionCurve.setCoefficient3xPOW2(0.0512); | |
| 2305 | ✗ | _energyInputRatioFunctionofFlowFractionCurve.setMinimumValueofx(0.0); | |
| 2306 | ✗ | _energyInputRatioFunctionofFlowFractionCurve.setMaximumValueofx(1.0); | |
| 2307 | |||
| 2308 | ✗ | energyInputRatioFunctionofFlowFractionCurve = _energyInputRatioFunctionofFlowFractionCurve; | |
| 2309 | ✗ | } | |
| 2310 | |||
| 2311 | // HtPumpEIR_fPLFCrvRef | ||
| 2312 | ✗ | boost::optional<model::Curve> partLoadFractionCorrelationCurve; | |
| 2313 | ✗ | pugi::xml_node partLoadFractionCorrelationCurveElement = heatingCoilElement.child("HtPumpEIR_fPLFCrvRef"); | |
| 2314 | ✗ | partLoadFractionCorrelationCurve = model.getModelObjectByName<model::Curve>(partLoadFractionCorrelationCurveElement.text().as_string()); | |
| 2315 | |||
| 2316 | ✗ | if (!partLoadFractionCorrelationCurve) { | |
| 2317 | ✗ | model::CurveQuadratic _partLoadFractionCorrelationCurve(model); | |
| 2318 | ✗ | _partLoadFractionCorrelationCurve.setCoefficient1Constant(0.75); | |
| 2319 | ✗ | _partLoadFractionCorrelationCurve.setCoefficient2x(0.25); | |
| 2320 | ✗ | _partLoadFractionCorrelationCurve.setCoefficient3xPOW2(0.0); | |
| 2321 | ✗ | _partLoadFractionCorrelationCurve.setMinimumValueofx(0.0); | |
| 2322 | ✗ | _partLoadFractionCorrelationCurve.setMaximumValueofx(1.0); | |
| 2323 | |||
| 2324 | ✗ | partLoadFractionCorrelationCurve = _partLoadFractionCorrelationCurve; | |
| 2325 | ✗ | } | |
| 2326 | |||
| 2327 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 2328 | |||
| 2329 | ✗ | model::CoilHeatingDXSingleSpeed heatingCoil(model, schedule, totalHeatingCapacityFunctionofTemperatureCurve.get(), | |
| 2330 | ✗ | totalHeatingCapacityFunctionofFlowFractionCurve.get(), | |
| 2331 | ✗ | energyInputRatioFunctionofTemperatureCurve.get(), | |
| 2332 | ✗ | energyInputRatioFunctionofFlowFractionCurve.get(), partLoadFractionCorrelationCurve.get()); | |
| 2333 | |||
| 2334 | // Name | ||
| 2335 | ✗ | heatingCoil.setName(coilName); | |
| 2336 | |||
| 2337 | // FlowCapSim | ||
| 2338 | ✗ | if (_flowCap) { | |
| 2339 | ✗ | heatingCoil.setRatedAirFlowRate(_flowCap.get()); | |
| 2340 | } | ||
| 2341 | |||
| 2342 | // CapTotGrossRtdSim | ||
| 2343 | ✗ | if (capTotGrossRtd) { | |
| 2344 | ✗ | heatingCoil.setRatedTotalHeatingCapacity(capTotGrossRtd.get()); | |
| 2345 | } | ||
| 2346 | |||
| 2347 | // HtPumpEIR | ||
| 2348 | ✗ | pugi::xml_node htPumpEIRElement = heatingCoilElement.child("HtPumpEIR"); | |
| 2349 | ✗ | boost::optional<double> _htPumpEIR = lexicalCastToDouble(htPumpEIRElement); | |
| 2350 | ✗ | if (_htPumpEIR) { | |
| 2351 | ✗ | heatingCoil.setRatedCOP(1.0 / _htPumpEIR.get()); | |
| 2352 | } | ||
| 2353 | |||
| 2354 | // HtPumpCprsrLockoutTemp | ||
| 2355 | ✗ | pugi::xml_node htPumpCprsrLockoutTempElement = heatingCoilElement.child("HtPumpCprsrLockoutTemp"); | |
| 2356 | ✗ | boost::optional<double> _htPumpCprsrLockoutTemp = lexicalCastToDouble(htPumpCprsrLockoutTempElement); | |
| 2357 | ✗ | if (_htPumpCprsrLockoutTemp) { | |
| 2358 | ✗ | double value = unitToUnit(_htPumpCprsrLockoutTemp.get(), "F", "C").get(); | |
| 2359 | ✗ | heatingCoil.setMinimumOutdoorDryBulbTemperatureforCompressorOperation(value); | |
| 2360 | } | ||
| 2361 | |||
| 2362 | // HtPumpCrankcaseHtCap | ||
| 2363 | ✗ | pugi::xml_node htPumpCrankcaseHtCapElement = heatingCoilElement.child("HtPumpCrankcaseHtrCapSim"); | |
| 2364 | ✗ | boost::optional<double> _htPumpCrankcaseHtCap = lexicalCastToDouble(htPumpCrankcaseHtCapElement); | |
| 2365 | ✗ | if (_htPumpCrankcaseHtCap) { | |
| 2366 | ✗ | double value = unitToUnit(_htPumpCrankcaseHtCap.get(), "Btu/h", "W").get(); | |
| 2367 | ✗ | heatingCoil.setCrankcaseHeaterCapacity(value); | |
| 2368 | } | ||
| 2369 | |||
| 2370 | // HtPumpCrankcaseCtrlTemp | ||
| 2371 | ✗ | pugi::xml_node htPumpCrankcaseCtrlTempElement = heatingCoilElement.child("HtPumpCrankcaseCtrlTemp"); | |
| 2372 | ✗ | boost::optional<double> _htPumpCrankcaseCtrlTemp = lexicalCastToDouble(htPumpCrankcaseCtrlTempElement); | |
| 2373 | ✗ | if (_htPumpCrankcaseCtrlTemp) { | |
| 2374 | ✗ | double value = unitToUnit(_htPumpCrankcaseCtrlTemp.get(), "F", "C").get(); | |
| 2375 | ✗ | heatingCoil.setMaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation(value); | |
| 2376 | } | ||
| 2377 | |||
| 2378 | // HtPumpDefHtSrc | ||
| 2379 | ✗ | pugi::xml_node htPumpDefHtSrcElement = heatingCoilElement.child("HtPumpDefHtSrc"); | |
| 2380 | ✗ | if (istringEqual(htPumpDefHtSrcElement.text().as_string(), "Electric")) { | |
| 2381 | ✗ | heatingCoil.setDefrostStrategy("Resistive"); | |
| 2382 | ✗ | } else if (istringEqual(htPumpDefHtSrcElement.text().as_string(), "HotGas")) { | |
| 2383 | ✗ | heatingCoil.setDefrostStrategy("ReverseCycle"); | |
| 2384 | |||
| 2385 | ✗ | model::CurveBiquadratic defrostCurve(model); | |
| 2386 | ✗ | defrostCurve.setName(heatingCoil.name().get() + " Defrost Curve"); | |
| 2387 | ✗ | defrostCurve.setCoefficient1Constant(1.0); | |
| 2388 | ✗ | heatingCoil.setDefrostEnergyInputRatioFunctionofTemperatureCurve(defrostCurve); | |
| 2389 | ✗ | } | |
| 2390 | |||
| 2391 | // HtPumpDefHtrCapSim | ||
| 2392 | ✗ | if (!autosize()) { | |
| 2393 | ✗ | pugi::xml_node htPumpDefHtCapElement = heatingCoilElement.child("HtPumpDefHtrCapSim"); | |
| 2394 | ✗ | boost::optional<double> _htPumpDefHtCap = lexicalCastToDouble(htPumpDefHtCapElement); | |
| 2395 | ✗ | if (_htPumpDefHtCap) { | |
| 2396 | ✗ | double value = unitToUnit(_htPumpDefHtCap.get(), "Btu/h", "W").get(); | |
| 2397 | ✗ | heatingCoil.setResistiveDefrostHeaterCapacity(value); | |
| 2398 | } | ||
| 2399 | } else { | ||
| 2400 | ✗ | heatingCoil.autosizeResistiveDefrostHeaterCapacity(); | |
| 2401 | } | ||
| 2402 | |||
| 2403 | // HtPumpDefCtrl | ||
| 2404 | ✗ | pugi::xml_node htPumpDefCtrlElement = heatingCoilElement.child("HtPumpDefCtrl"); | |
| 2405 | ✗ | if (istringEqual(htPumpDefCtrlElement.text().as_string(), "OnDemand")) { | |
| 2406 | ✗ | heatingCoil.setDefrostControl("OnDemand"); | |
| 2407 | ✗ | } else if (istringEqual(htPumpDefCtrlElement.text().as_string(), "TimedCycle")) { | |
| 2408 | ✗ | heatingCoil.setDefrostControl("Timed"); | |
| 2409 | } | ||
| 2410 | |||
| 2411 | // HtPumpDefCtrlTemp | ||
| 2412 | ✗ | pugi::xml_node htPumpDefCtrlTempElement = heatingCoilElement.child("HtPumpDefCtrlTemp"); | |
| 2413 | ✗ | boost::optional<double> _htPumpDefCtrlTemp = lexicalCastToDouble(htPumpDefCtrlTempElement); | |
| 2414 | ✗ | if (_htPumpDefCtrlTemp) { | |
| 2415 | ✗ | double value = unitToUnit(_htPumpDefCtrlTemp.get(), "F", "C").get(); | |
| 2416 | ✗ | heatingCoil.setMaximumOutdoorDryBulbTemperatureforDefrostOperation(value); | |
| 2417 | } | ||
| 2418 | |||
| 2419 | // DefrostTimePeriodFraction | ||
| 2420 | ✗ | heatingCoil.setDefrostTimePeriodFraction(0.058333); | |
| 2421 | |||
| 2422 | ✗ | result = heatingCoil; | |
| 2423 | ✗ | } | |
| 2424 | } else { | ||
| 2425 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 2426 | |||
| 2427 | ✗ | model::CoilHeatingElectric coil(model, schedule); | |
| 2428 | |||
| 2429 | ✗ | coil.setName(coilName); | |
| 2430 | |||
| 2431 | // CapTotGrossRtd | ||
| 2432 | ✗ | if (capTotGrossRtd) { | |
| 2433 | ✗ | coil.setNominalCapacity(capTotGrossRtd.get()); | |
| 2434 | } | ||
| 2435 | |||
| 2436 | ✗ | result = coil; | |
| 2437 | ✗ | } | |
| 2438 | |||
| 2439 | 26 | return result; | |
| 2440 | 26 | } | |
| 2441 | |||
| 2442 | 5 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateFan(const pugi::xml_node& fanElement, openstudio::model::Model& model) { | |
| 2443 | 5 | boost::optional<model::ModelObject> result; | |
| 2444 | |||
| 2445 |
5/6✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 5 times.
|
20 | if (!istringEqual(fanElement.name(), "Fan")) { |
| 2446 | ✗ | return result; | |
| 2447 | } | ||
| 2448 | |||
| 2449 | //AvailSchRef | ||
| 2450 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node availSchRefElement = fanElement.child("AvailSchRef"); |
| 2451 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | std::string availSchRef = escapeName(availSchRefElement.text().as_string()); |
| 2452 |
1/1✓ Branch 1 taken 5 times.
|
5 | auto availSch = model.getModelObjectByName<model::Schedule>(availSchRef); |
| 2453 | |||
| 2454 | // FanControlMethod | ||
| 2455 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node fanControlMethodElement = fanElement.child("CtrlMthdSim"); |
| 2456 | |||
| 2457 | // Name | ||
| 2458 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node nameElement = fanElement.child("Name"); |
| 2459 | |||
| 2460 | // TotEff | ||
| 2461 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node totEffElement = fanElement.child("TotEff"); |
| 2462 | |||
| 2463 | // MtrfEff | ||
| 2464 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node mtrEffElement = fanElement.child("MtrEff"); |
| 2465 | |||
| 2466 | // FlowCap | ||
| 2467 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node flowCapElement = fanElement.child("FlowCapSim"); |
| 2468 | |||
| 2469 | // TotStaticPress | ||
| 2470 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node totStaticPressElement = fanElement.child("TotStaticPress"); |
| 2471 | |||
| 2472 | // MtrPos | ||
| 2473 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node mtrPosElement = fanElement.child("MtrPos"); |
| 2474 | 5 | bool motorInAirstream = false; | |
| 2475 |
7/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 17 taken 4 times.
✓ Branch 18 taken 1 time.
|
15 | if (istringEqual(mtrPosElement.text().as_string(), "InAirStream")) { |
| 2476 | 4 | motorInAirstream = true; | |
| 2477 | } | ||
| 2478 | |||
| 2479 | 5 | boost::optional<double> flowCap; | |
| 2480 | |||
| 2481 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
5 | if (!autosize()) { |
| 2482 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _flowCap = lexicalCastToDouble(flowCapElement); |
| 2483 | |||
| 2484 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_flowCap) { |
| 2485 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | Quantity flowRateIP(_flowCap.get(), createCFMVolumetricFlowrate()); |
| 2486 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | OptionalQuantity flowRateSI = QuantityConverter::instance().convert(flowRateIP, UnitSystem(UnitSystem::SI)); |
| 2487 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(flowRateSI); |
| 2488 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | flowCap = flowRateSI->value(); |
| 2489 | 5 | } | |
| 2490 | } | ||
| 2491 | |||
| 2492 | // ConstantVolume | ||
| 2493 |
9/20✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 5 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 5 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 1 time.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
|
25 | if (istringEqual(fanControlMethodElement.text().as_string(), "ConstantVolume") |
| 2494 |
18/28✓ Branch 1 taken 5 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 4 times.
✓ Branch 9 taken 4 times.
✓ Branch 12 taken 4 times.
✓ Branch 15 taken 4 times.
✓ Branch 18 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 4 times.
✓ Branch 22 taken 4 times.
✓ Branch 23 taken 1 time.
✓ Branch 25 taken 4 times.
✓ Branch 26 taken 1 time.
✓ Branch 27 taken 4 times.
✓ Branch 28 taken 1 time.
✓ Branch 30 taken 4 times.
✓ Branch 31 taken 1 time.
✓ Branch 32 taken 5 times.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
|
31 | || istringEqual(fanControlMethodElement.text().as_string(), "TwoSpeed")) { |
| 2495 | // The type of fan is dependent on the context. We use FanOnOff for cycling zone systems, FanConstantVolume for everything else | ||
| 2496 |
1/1✓ Branch 1 taken 1 time.
|
1 | pugi::xml_node parentElement = fanElement.parent(); |
| 2497 | |||
| 2498 |
5/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 time.
|
4 | if (openstudio::istringEqual(parentElement.name(), "ZnSys")) { |
| 2499 | // Type | ||
| 2500 | |||
| 2501 | ✗ | pugi::xml_node znSysTypeElement = parentElement.child("TypeSim"); | |
| 2502 | ✗ | pugi::xml_node znSysFanCtrlElement = parentElement.child("FanCtrl"); | |
| 2503 | |||
| 2504 | ✗ | if (istringEqual(znSysTypeElement.text().as_string(), "FPFC") || istringEqual(znSysTypeElement.text().as_string(), "PTHP") | |
| 2505 | ✗ | || istringEqual(znSysTypeElement.text().as_string(), "WSHP") | |
| 2506 | ✗ | || (istringEqual(znSysTypeElement.text().as_string(), "SZAC") && istringEqual(znSysFanCtrlElement.text().as_string(), "Cycling")) | |
| 2507 | ✗ | || (istringEqual(znSysTypeElement.text().as_string(), "SZHP") && istringEqual(znSysFanCtrlElement.text().as_string(), "Cycling")) | |
| 2508 | ✗ | || (istringEqual(znSysTypeElement.text().as_string(), "VRF") && istringEqual(znSysFanCtrlElement.text().as_string(), "Continuous") | |
| 2509 | ✗ | && istringEqual(fanControlMethodElement.text().as_string(), "TwoSpeed")) | |
| 2510 | ✗ | || (istringEqual(znSysTypeElement.text().as_string(), "VRF") && istringEqual(znSysFanCtrlElement.text().as_string(), "Cycling"))) { | |
| 2511 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 2512 | |||
| 2513 | ✗ | model::FanOnOff fan(model, schedule); | |
| 2514 | |||
| 2515 | ✗ | fan.setName(nameElement.text().as_string()); | |
| 2516 | |||
| 2517 | ✗ | if (availSch) { | |
| 2518 | ✗ | fan.setAvailabilitySchedule(availSch.get()); | |
| 2519 | } | ||
| 2520 | |||
| 2521 | // TotEff | ||
| 2522 | ✗ | boost::optional<double> _totEff = lexicalCastToDouble(totEffElement); | |
| 2523 | ✗ | if (_totEff) { | |
| 2524 | ✗ | fan.setFanEfficiency(_totEff.get()); | |
| 2525 | } | ||
| 2526 | |||
| 2527 | // MtrEff | ||
| 2528 | ✗ | boost::optional<double> _mtrEff = lexicalCastToDouble(mtrEffElement); | |
| 2529 | ✗ | if (_mtrEff) { | |
| 2530 | ✗ | fan.setMotorEfficiency(_mtrEff.get()); | |
| 2531 | } | ||
| 2532 | |||
| 2533 | // FlowCap | ||
| 2534 | ✗ | if (flowCap) { | |
| 2535 | ✗ | fan.setMaximumFlowRate(flowCap.get()); | |
| 2536 | } | ||
| 2537 | |||
| 2538 | // TotStaticPress | ||
| 2539 | ✗ | boost::optional<double> _totStaticPress = lexicalCastToDouble(totStaticPressElement); | |
| 2540 | ✗ | if (_totStaticPress) { | |
| 2541 | // Convert in WC to Pa | ||
| 2542 | ✗ | fan.setPressureRise(_totStaticPress.get() * 249.0889); | |
| 2543 | } | ||
| 2544 | |||
| 2545 | // MtrPos | ||
| 2546 | ✗ | if (motorInAirstream) { | |
| 2547 | ✗ | fan.setMotorInAirstreamFraction(1.0); | |
| 2548 | } else { | ||
| 2549 | ✗ | fan.setMotorInAirstreamFraction(0.0); | |
| 2550 | } | ||
| 2551 | |||
| 2552 | // Pwr_fPLRCrvRef | ||
| 2553 | ✗ | pugi::xml_node pwr_fPLRCrvElement = fanElement.child("Pwr_fPLRCrvRef"); | |
| 2554 | ✗ | boost::optional<model::Curve> pwr_fPLRCrv; | |
| 2555 | ✗ | pwr_fPLRCrv = model.getModelObjectByName<model::Curve>(pwr_fPLRCrvElement.text().as_string()); | |
| 2556 | ✗ | if (pwr_fPLRCrv) { | |
| 2557 | ✗ | fan.setFanPowerRatioFunctionofSpeedRatioCurve(pwr_fPLRCrv.get()); | |
| 2558 | } | ||
| 2559 | |||
| 2560 | // End Use Subcategory | ||
| 2561 | ✗ | fan.setEndUseSubcategory("Interior Fans"); | |
| 2562 | |||
| 2563 | ✗ | result = fan; | |
| 2564 | ✗ | } | |
| 2565 | } | ||
| 2566 | |||
| 2567 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (!result) { |
| 2568 |
1/1✓ Branch 1 taken 1 time.
|
1 | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); |
| 2569 | |||
| 2570 |
1/1✓ Branch 1 taken 1 time.
|
1 | model::FanConstantVolume fan(model, schedule); |
| 2571 | |||
| 2572 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | fan.setName(nameElement.text().as_string()); |
| 2573 | |||
| 2574 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (availSch) { |
| 2575 | ✗ | fan.setAvailabilitySchedule(availSch.get()); | |
| 2576 | } | ||
| 2577 | |||
| 2578 | // TotEff | ||
| 2579 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> _totEff = lexicalCastToDouble(totEffElement); |
| 2580 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_totEff) { |
| 2581 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | fan.setFanEfficiency(_totEff.get()); |
| 2582 | } | ||
| 2583 | |||
| 2584 | // MtrEff | ||
| 2585 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> _mtrEff = lexicalCastToDouble(mtrEffElement); |
| 2586 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_mtrEff) { |
| 2587 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | fan.setMotorEfficiency(_mtrEff.get()); |
| 2588 | } | ||
| 2589 | |||
| 2590 | // FlowCap | ||
| 2591 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (flowCap) { |
| 2592 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | fan.setMaximumFlowRate(flowCap.get()); |
| 2593 | } | ||
| 2594 | |||
| 2595 | // TotStaticPress | ||
| 2596 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> _totStaticPress = lexicalCastToDouble(totStaticPressElement); |
| 2597 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_totStaticPress) { |
| 2598 | // Convert in WC to Pa | ||
| 2599 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | fan.setPressureRise(_totStaticPress.get() * 249.0889); |
| 2600 | } | ||
| 2601 | |||
| 2602 | // MtrPos | ||
| 2603 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (motorInAirstream) { |
| 2604 | ✗ | fan.setMotorInAirstreamFraction(1.0); | |
| 2605 | } else { | ||
| 2606 |
1/1✓ Branch 1 taken 1 time.
|
1 | fan.setMotorInAirstreamFraction(0.0); |
| 2607 | } | ||
| 2608 | |||
| 2609 |
1/1✓ Branch 1 taken 1 time.
|
1 | result = fan; |
| 2610 | 1 | } | |
| 2611 | } | ||
| 2612 | // Variable Volume | ||
| 2613 |
6/7✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 4 times.
✓ Branch 17 taken 4 times.
✗ Branch 18 not taken.
|
12 | else if (istringEqual(fanControlMethodElement.text().as_string(), "VariableSpeedDrive")) { |
| 2614 |
1/1✓ Branch 1 taken 4 times.
|
4 | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); |
| 2615 | |||
| 2616 |
1/1✓ Branch 1 taken 4 times.
|
4 | model::FanVariableVolume fan(model, schedule); |
| 2617 | |||
| 2618 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
4 | fan.setName(nameElement.text().as_string()); |
| 2619 | |||
| 2620 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if (availSch) { |
| 2621 | ✗ | fan.setAvailabilitySchedule(availSch.get()); | |
| 2622 | } | ||
| 2623 | |||
| 2624 | // TotEff | ||
| 2625 |
1/1✓ Branch 1 taken 4 times.
|
4 | boost::optional<double> _totEff = lexicalCastToDouble(totEffElement); |
| 2626 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (_totEff) { |
| 2627 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | fan.setFanEfficiency(_totEff.get()); |
| 2628 | } | ||
| 2629 | |||
| 2630 | // MtrEff | ||
| 2631 |
1/1✓ Branch 1 taken 4 times.
|
4 | boost::optional<double> _mtrEff = lexicalCastToDouble(mtrEffElement); |
| 2632 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (_mtrEff) { |
| 2633 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | fan.setMotorEfficiency(_mtrEff.get()); |
| 2634 | } | ||
| 2635 | |||
| 2636 | // FlowCap | ||
| 2637 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (flowCap) { |
| 2638 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | fan.setMaximumFlowRate(flowCap.get()); |
| 2639 | } | ||
| 2640 | |||
| 2641 | // TotStaticPress | ||
| 2642 |
1/1✓ Branch 1 taken 4 times.
|
4 | boost::optional<double> _totStaticPress = lexicalCastToDouble(totStaticPressElement); |
| 2643 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (_totStaticPress) { |
| 2644 | // Convert in WC to Pa | ||
| 2645 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | fan.setPressureRise(_totStaticPress.get() * 249.0889); |
| 2646 | } | ||
| 2647 | |||
| 2648 | // Pwr_fPLRCrvRef | ||
| 2649 |
1/1✓ Branch 1 taken 4 times.
|
4 | pugi::xml_node pwr_fPLRCrvElement = fanElement.child("Pwr_fPLRCrvRef"); |
| 2650 | 4 | boost::optional<model::Curve> pwr_fPLRCrv; | |
| 2651 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
4 | pwr_fPLRCrv = model.getModelObjectByName<model::Curve>(pwr_fPLRCrvElement.text().as_string()); |
| 2652 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (pwr_fPLRCrv) { |
| 2653 |
3/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
|
8 | if (boost::optional<model::CurveCubic> curveCubic = pwr_fPLRCrv->optionalCast<model::CurveCubic>()) { |
| 2654 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | fan.setFanPowerCoefficient1(curveCubic->coefficient1Constant()); |
| 2655 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | fan.setFanPowerCoefficient2(curveCubic->coefficient2x()); |
| 2656 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | fan.setFanPowerCoefficient3(curveCubic->coefficient3xPOW2()); |
| 2657 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | fan.setFanPowerCoefficient4(curveCubic->coefficient4xPOW3()); |
| 2658 |
1/1✓ Branch 1 taken 4 times.
|
4 | fan.setFanPowerCoefficient5(0.0); |
| 2659 | } else { | ||
| 2660 | ✗ | LOG(Warn, "Fan: " << fan.name().get() << " references an unsupported curve type."); | |
| 2661 | 4 | } | |
| 2662 | } | ||
| 2663 | |||
| 2664 | // MtrPos | ||
| 2665 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (motorInAirstream) { |
| 2666 |
1/1✓ Branch 1 taken 4 times.
|
4 | fan.setMotorInAirstreamFraction(1.0); |
| 2667 | } else { | ||
| 2668 | ✗ | fan.setMotorInAirstreamFraction(0.0); | |
| 2669 | } | ||
| 2670 | |||
| 2671 |
1/1✓ Branch 1 taken 4 times.
|
4 | pugi::xml_node flowMinSimElement = fanElement.child("FlowMinSim"); |
| 2672 |
1/1✓ Branch 1 taken 4 times.
|
4 | boost::optional<double> _flowMinSim = lexicalCastToDouble(flowMinSimElement); |
| 2673 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (_flowMinSim) { |
| 2674 |
5/5✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 4 times.
|
12 | double value = unitToUnit(_flowMinSim.get(), "cfm", "m^3/s").get(); |
| 2675 |
1/1✓ Branch 1 taken 4 times.
|
4 | fan.setFanPowerMinimumAirFlowRate(value); |
| 2676 | } | ||
| 2677 | |||
| 2678 |
1/1✓ Branch 1 taken 4 times.
|
4 | result = fan; |
| 2679 | 4 | } | |
| 2680 | |||
| 2681 | 5 | return result; | |
| 2682 | 5 | } | |
| 2683 | |||
| 2684 | ✗ | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateHtRcvry(const pugi::xml_node& element, | |
| 2685 | openstudio::model::Model& model) { | ||
| 2686 | ✗ | if (!istringEqual(element.name(), "HtRcvry")) { | |
| 2687 | ✗ | return boost::none; | |
| 2688 | } | ||
| 2689 | |||
| 2690 | ✗ | model::HeatExchangerAirToAirSensibleAndLatent hx(model); | |
| 2691 | |||
| 2692 | ✗ | auto nameElement = element.child("Name"); | |
| 2693 | ✗ | hx.setName(nameElement.text().as_string()); | |
| 2694 | |||
| 2695 | // AvailSchRef | ||
| 2696 | ✗ | auto availSchRefElement = element.child("AvailSchRef"); | |
| 2697 | ✗ | auto availSchRef = escapeName(availSchRefElement.text().as_string()); | |
| 2698 | ✗ | auto availSch = model.getModelObjectByName<model::Schedule>(availSchRef); | |
| 2699 | ✗ | if (availSch) { | |
| 2700 | ✗ | hx.setAvailabilitySchedule(availSch.get()); | |
| 2701 | } | ||
| 2702 | |||
| 2703 | // SupFlowRtd | ||
| 2704 | ✗ | auto supFlowRtdElement = element.child("SupFlowRtdSim"); | |
| 2705 | ✗ | boost::optional<double> _supFlowRtd = lexicalCastToDouble(supFlowRtdElement); | |
| 2706 | ✗ | if (_supFlowRtd) { | |
| 2707 | ✗ | double value = unitToUnit(_supFlowRtd.get(), "cfm", "m^3/s").get(); | |
| 2708 | ✗ | hx.setNominalSupplyAirFlowRate(value); | |
| 2709 | } | ||
| 2710 | |||
| 2711 | // HtgSensEff100 | ||
| 2712 | ✗ | auto htgSensEff100Element = element.child("HtgSensEff100"); | |
| 2713 | ✗ | boost::optional<double> _htgSensEff100 = lexicalCastToDouble(htgSensEff100Element); | |
| 2714 | ✗ | if (_htgSensEff100) { | |
| 2715 | ✗ | hx.setSensibleEffectivenessat100HeatingAirFlow(_htgSensEff100.get()); | |
| 2716 | } | ||
| 2717 | |||
| 2718 | // HtgLatEff100 | ||
| 2719 | ✗ | auto htgLatEff100Element = element.child("HtgLatEff100"); | |
| 2720 | ✗ | boost::optional<double> _htgLatEff100 = lexicalCastToDouble(htgLatEff100Element); | |
| 2721 | ✗ | if (_htgLatEff100) { | |
| 2722 | ✗ | hx.setLatentEffectivenessat100HeatingAirFlow(_htgLatEff100.get()); | |
| 2723 | } | ||
| 2724 | |||
| 2725 | // ClgSensEff100 | ||
| 2726 | ✗ | auto clgSensEff100Element = element.child("ClgSensEff100"); | |
| 2727 | ✗ | boost::optional<double> _clgSensEff100 = lexicalCastToDouble(clgSensEff100Element); | |
| 2728 | ✗ | if (_clgSensEff100) { | |
| 2729 | ✗ | hx.setSensibleEffectivenessat100CoolingAirFlow(_clgSensEff100.get()); | |
| 2730 | } | ||
| 2731 | |||
| 2732 | // ClgLatEff100 | ||
| 2733 | ✗ | auto clgLatEff100Element = element.child("ClgLatEff100"); | |
| 2734 | ✗ | boost::optional<double> _clgLatEff100 = lexicalCastToDouble(clgLatEff100Element); | |
| 2735 | ✗ | if (_clgLatEff100) { | |
| 2736 | ✗ | hx.setLatentEffectivenessat100CoolingAirFlow(_clgLatEff100.get()); | |
| 2737 | } | ||
| 2738 | |||
| 2739 | // DEPRECATED 75% fields | ||
| 2740 | ✗ | auto htgSensEff75Element = element.child("HtgSensEff75"); | |
| 2741 | ✗ | boost::optional<double> _htgSensEff75 = lexicalCastToDouble(htgSensEff75Element); | |
| 2742 | |||
| 2743 | ✗ | auto htgLatEff75Element = element.child("HtgLatEff75"); | |
| 2744 | ✗ | boost::optional<double> _htgLatEff75 = lexicalCastToDouble(htgLatEff75Element); | |
| 2745 | |||
| 2746 | ✗ | auto clgSensEff75Element = element.child("ClgSensEff75"); | |
| 2747 | ✗ | boost::optional<double> _clgSensEff75 = lexicalCastToDouble(clgSensEff75Element); | |
| 2748 | |||
| 2749 | ✗ | auto clgLatEff75Element = element.child("ClgLatEff75"); | |
| 2750 | ✗ | boost::optional<double> _clgLatEff75 = lexicalCastToDouble(clgLatEff75Element); | |
| 2751 | |||
| 2752 | ✗ | if (_htgSensEff75 || _htgLatEff75 || _clgSensEff75 || _clgLatEff75) { | |
| 2753 | |||
| 2754 | ✗ | model::TableIndependentVariable var(model); | |
| 2755 | ✗ | var.setName(hx.nameString() + "_IndependentVariable"); | |
| 2756 | ✗ | var.setInterpolationMethod("Linear"); | |
| 2757 | ✗ | var.setExtrapolationMethod("Linear"); | |
| 2758 | ✗ | var.setMinimumValue(0.0); | |
| 2759 | ✗ | var.setMaximumValue(10.0); | |
| 2760 | ✗ | var.setUnitType("Dimensionless"); | |
| 2761 | ✗ | var.addValue(0.75); | |
| 2762 | ✗ | var.addValue(1.0); | |
| 2763 | |||
| 2764 | ✗ | if (_htgSensEff75) { | |
| 2765 | ✗ | auto val100 = _htgSensEff100.get_value_or(1.0); | |
| 2766 | |||
| 2767 | ✗ | model::TableLookup table(model); | |
| 2768 | ✗ | table.setName(fmt::format("{}_SensHeatEff", hx.nameString())); | |
| 2769 | ✗ | table.addIndependentVariable(var); | |
| 2770 | |||
| 2771 | ✗ | table.setNormalizationMethod("DivisorOnly"); | |
| 2772 | ✗ | table.setNormalizationDivisor(val100); | |
| 2773 | ✗ | table.setMinimumOutput(0.0); | |
| 2774 | ✗ | table.setMaximumOutput(10.0); | |
| 2775 | ✗ | table.setOutputUnitType("Dimensionless"); | |
| 2776 | ✗ | table.addOutputValue(*_htgSensEff75); | |
| 2777 | ✗ | table.addOutputValue(val100); | |
| 2778 | |||
| 2779 | ✗ | hx.setSensibleEffectivenessofHeatingAirFlowCurve(table); | |
| 2780 | ✗ | } | |
| 2781 | |||
| 2782 | ✗ | if (_htgLatEff75) { | |
| 2783 | ✗ | auto val100 = _htgLatEff100.get_value_or(1.0); | |
| 2784 | |||
| 2785 | ✗ | model::TableLookup table(model); | |
| 2786 | ✗ | table.setName(fmt::format("{}_LatHeatEff", hx.nameString())); | |
| 2787 | ✗ | table.addIndependentVariable(var); | |
| 2788 | |||
| 2789 | ✗ | table.setNormalizationMethod("DivisorOnly"); | |
| 2790 | ✗ | table.setNormalizationDivisor(val100); | |
| 2791 | ✗ | table.setMinimumOutput(0.0); | |
| 2792 | ✗ | table.setMaximumOutput(10.0); | |
| 2793 | ✗ | table.setOutputUnitType("Dimensionless"); | |
| 2794 | ✗ | table.addOutputValue(*_htgLatEff75); | |
| 2795 | ✗ | table.addOutputValue(val100); | |
| 2796 | |||
| 2797 | ✗ | hx.setLatentEffectivenessofHeatingAirFlowCurve(table); | |
| 2798 | ✗ | } | |
| 2799 | |||
| 2800 | ✗ | if (_clgSensEff75) { | |
| 2801 | ✗ | auto val100 = _clgSensEff100.get_value_or(1.0); | |
| 2802 | |||
| 2803 | ✗ | model::TableLookup table(model); | |
| 2804 | ✗ | table.setName(fmt::format("{}_SensCoolEff", hx.nameString())); | |
| 2805 | ✗ | table.addIndependentVariable(var); | |
| 2806 | |||
| 2807 | ✗ | table.setNormalizationMethod("DivisorOnly"); | |
| 2808 | ✗ | table.setNormalizationDivisor(val100); | |
| 2809 | ✗ | table.setMinimumOutput(0.0); | |
| 2810 | ✗ | table.setMaximumOutput(10.0); | |
| 2811 | ✗ | table.setOutputUnitType("Dimensionless"); | |
| 2812 | ✗ | table.addOutputValue(*_clgSensEff75); | |
| 2813 | ✗ | table.addOutputValue(val100); | |
| 2814 | |||
| 2815 | ✗ | hx.setSensibleEffectivenessofCoolingAirFlowCurve(table); | |
| 2816 | ✗ | } | |
| 2817 | |||
| 2818 | ✗ | if (_clgLatEff75) { | |
| 2819 | ✗ | auto val100 = _clgLatEff100.get_value_or(1.0); | |
| 2820 | |||
| 2821 | ✗ | model::TableLookup table(model); | |
| 2822 | ✗ | table.setName(fmt::format("{}_LatCoolEff", hx.nameString())); | |
| 2823 | ✗ | table.addIndependentVariable(var); | |
| 2824 | |||
| 2825 | ✗ | table.setNormalizationMethod("DivisorOnly"); | |
| 2826 | ✗ | table.setNormalizationDivisor(val100); | |
| 2827 | ✗ | table.setMinimumOutput(0.0); | |
| 2828 | ✗ | table.setMaximumOutput(10.0); | |
| 2829 | ✗ | table.setOutputUnitType("Dimensionless"); | |
| 2830 | ✗ | table.addOutputValue(*_clgLatEff75); | |
| 2831 | ✗ | table.addOutputValue(val100); | |
| 2832 | |||
| 2833 | ✗ | hx.setLatentEffectivenessofCoolingAirFlowCurve(table); | |
| 2834 | ✗ | } | |
| 2835 | ✗ | } | |
| 2836 | |||
| 2837 | // AuxPwr | ||
| 2838 | ✗ | auto auxPwrElement = element.child("AuxPwr"); | |
| 2839 | ✗ | boost::optional<double> _auxPwr = lexicalCastToDouble(auxPwrElement); | |
| 2840 | ✗ | if (_auxPwr) { | |
| 2841 | ✗ | hx.setNominalElectricPower(_auxPwr.get()); | |
| 2842 | } | ||
| 2843 | |||
| 2844 | ✗ | const auto* type = element.child("Type").text().as_string(); | |
| 2845 | ✗ | if (istringEqual(type, "Plate")) { | |
| 2846 | ✗ | hx.setHeatExchangerType("Plate"); | |
| 2847 | ✗ | } else if (istringEqual(type, "Wheel")) { | |
| 2848 | ✗ | hx.setHeatExchangerType("Rotary"); | |
| 2849 | } | ||
| 2850 | |||
| 2851 | ✗ | const auto* defrostCtrl = element.child("DefrostCtrl").text().as_string(); | |
| 2852 | ✗ | hx.setFrostControlType(defrostCtrl); | |
| 2853 | |||
| 2854 | ✗ | auto defrostCtrlTempElement = element.child("DefrostCtrlTemp"); | |
| 2855 | ✗ | boost::optional<double> _defrostCtrlTemp = lexicalCastToDouble(defrostCtrlTempElement); | |
| 2856 | ✗ | if (_defrostCtrlTemp) { | |
| 2857 | ✗ | double value = unitToUnit(_defrostCtrlTemp.get(), "F", "C").get(); | |
| 2858 | ✗ | hx.setThresholdTemperature(value); | |
| 2859 | } | ||
| 2860 | |||
| 2861 | // DefrostTimeFrac | ||
| 2862 | ✗ | auto defrostTimeFracElement = element.child("DefrostTimeFrac"); | |
| 2863 | ✗ | boost::optional<double> _defrostTimeFrac = lexicalCastToDouble(defrostTimeFracElement); | |
| 2864 | ✗ | if (_defrostTimeFrac) { | |
| 2865 | ✗ | hx.setInitialDefrostTimeFraction(_defrostTimeFrac.get()); | |
| 2866 | } | ||
| 2867 | |||
| 2868 | // DefrostTimeFracRt | ||
| 2869 | ✗ | auto defrostTimeFracRtElement = element.child("DefrostTimeFracRt"); | |
| 2870 | ✗ | boost::optional<double> _defrostTimeFracRt = lexicalCastToDouble(defrostTimeFracRtElement); | |
| 2871 | ✗ | if (_defrostTimeFracRt) { | |
| 2872 | ✗ | hx.setRateofDefrostTimeFractionIncrease(_defrostTimeFracRt.get()); | |
| 2873 | } | ||
| 2874 | |||
| 2875 | // EconoLockout | ||
| 2876 | ✗ | const auto* econoLockout = element.child("EconoLockout").text().as_string(); | |
| 2877 | ✗ | if (istringEqual(econoLockout, "No")) { | |
| 2878 | ✗ | hx.setEconomizerLockout(false); | |
| 2879 | } else { | ||
| 2880 | ✗ | hx.setEconomizerLockout(true); | |
| 2881 | } | ||
| 2882 | |||
| 2883 | ✗ | return hx; | |
| 2884 | ✗ | } | |
| 2885 | |||
| 2886 | ✗ | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateEvapClr(const pugi::xml_node& element, | |
| 2887 | openstudio::model::Model& model) { | ||
| 2888 | ✗ | boost::optional<model::ModelObject> result; | |
| 2889 | |||
| 2890 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 2891 | |||
| 2892 | ✗ | if (!istringEqual(element.name(), "EvapClr")) { | |
| 2893 | ✗ | return result; | |
| 2894 | } | ||
| 2895 | |||
| 2896 | ✗ | pugi::xml_node typeElement = element.child("Type"); | |
| 2897 | ✗ | pugi::xml_node nameElement = element.child("Name"); | |
| 2898 | |||
| 2899 | ✗ | if (openstudio::istringEqual(typeElement.text().as_string(), "Direct")) { | |
| 2900 | ✗ | model::EvaporativeCoolerDirectResearchSpecial evap(model, schedule); | |
| 2901 | |||
| 2902 | ✗ | evap.setName(nameElement.text().as_string()); | |
| 2903 | |||
| 2904 | ✗ | pugi::xml_node effElement = element.child("Eff"); | |
| 2905 | ✗ | boost::optional<double> _eff = lexicalCastToDouble(effElement); | |
| 2906 | ✗ | if (_eff) { | |
| 2907 | ✗ | evap.setCoolerEffectiveness(_eff.get()); | |
| 2908 | } | ||
| 2909 | |||
| 2910 | ✗ | pugi::xml_node pumpPwrElement = element.child("PumpPwr"); | |
| 2911 | ✗ | boost::optional<double> _pumpPwr = lexicalCastToDouble(pumpPwrElement); | |
| 2912 | ✗ | if (_pumpPwr) { | |
| 2913 | ✗ | double value = unitToUnit(_pumpPwr.get(), "Btu/h", "W").get(); | |
| 2914 | ✗ | evap.setRecirculatingWaterPumpPowerConsumption(value); | |
| 2915 | } | ||
| 2916 | |||
| 2917 | ✗ | evap.setBlowdownConcentrationRatio(3.0); | |
| 2918 | |||
| 2919 | ✗ | result = evap; | |
| 2920 | ✗ | } else if (openstudio::istringEqual(typeElement.text().as_string(), "Indirect")) { | |
| 2921 | ✗ | model::EvaporativeCoolerIndirectResearchSpecial evap(model); | |
| 2922 | |||
| 2923 | ✗ | evap.setName(nameElement.text().as_string()); | |
| 2924 | |||
| 2925 | ✗ | pugi::xml_node effElement = element.child("Eff"); | |
| 2926 | ✗ | boost::optional<double> _eff = lexicalCastToDouble(effElement); | |
| 2927 | ✗ | if (_eff) { | |
| 2928 | ✗ | evap.setCoolerMaximumEffectiveness(_eff.get()); | |
| 2929 | } | ||
| 2930 | |||
| 2931 | ✗ | pugi::xml_node pumpPwrElement = element.child("PumpPwr"); | |
| 2932 | ✗ | boost::optional<double> _pumpPwr = lexicalCastToDouble(pumpPwrElement); | |
| 2933 | ✗ | if (_pumpPwr) { | |
| 2934 | ✗ | double value = unitToUnit(_pumpPwr.get(), "Btu/h", "W").get(); | |
| 2935 | ✗ | evap.setRecirculatingWaterPumpPowerConsumption(value); | |
| 2936 | } | ||
| 2937 | |||
| 2938 | ✗ | pugi::xml_node secFanFlowCapElement = element.child("SecFanFlowCap"); | |
| 2939 | ✗ | boost::optional<double> _secFanFlowCap = lexicalCastToDouble(secFanFlowCapElement); | |
| 2940 | ✗ | if (_secFanFlowCap) { | |
| 2941 | ✗ | double value = unitToUnit(_secFanFlowCap.get(), "cfm", "m^3/s").get(); | |
| 2942 | ✗ | evap.setSecondaryFanFlowRate(value); | |
| 2943 | } | ||
| 2944 | |||
| 2945 | ✗ | pugi::xml_node secFanTotEffElemenet = element.child("SecFanTotEff"); | |
| 2946 | ✗ | boost::optional<double> _secFanTotEff = lexicalCastToDouble(secFanTotEffElemenet); | |
| 2947 | ✗ | if (_secFanTotEff) { | |
| 2948 | ✗ | evap.setSecondaryFanTotalEfficiency(_secFanTotEff.get()); | |
| 2949 | } | ||
| 2950 | |||
| 2951 | ✗ | pugi::xml_node secFanTotStaticPressElement = element.child("SecFanTotStaticPress"); | |
| 2952 | ✗ | boost::optional<double> _secFanTotStaticPress = lexicalCastToDouble(secFanTotStaticPressElement); | |
| 2953 | ✗ | if (_secFanTotStaticPress) { | |
| 2954 | // Convert in WC to Pa | ||
| 2955 | ✗ | evap.setSecondaryFanDeltaPressure(_secFanTotStaticPress.get() * 249.0889); | |
| 2956 | } | ||
| 2957 | |||
| 2958 | ✗ | pugi::xml_node indirectDewPtEffElement = element.child("IndirectDewPtEff"); | |
| 2959 | ✗ | boost::optional<double> _indirectDewPtEff = lexicalCastToDouble(indirectDewPtEffElement); | |
| 2960 | ✗ | if (_indirectDewPtEff) { | |
| 2961 | ✗ | evap.setDewpointEffectivenessFactor(_indirectDewPtEff.get()); | |
| 2962 | } | ||
| 2963 | // TODO: reset dewpoint effectiveness | ||
| 2964 | |||
| 2965 | ✗ | evap.setBlowdownConcentrationRatio(3.0); | |
| 2966 | |||
| 2967 | // TODO: Unused | ||
| 2968 | // pugi::xml_node secAirSrcElement = element.child("SecAirSrc"); | ||
| 2969 | |||
| 2970 | ✗ | evap.resetDriftLossFraction(); | |
| 2971 | |||
| 2972 | ✗ | result = evap; | |
| 2973 | ✗ | } else { | |
| 2974 | ✗ | LOG(Error, nameElement.text().as_string() << " is an unsupported type: defaulting to direct evaporative cooling"); | |
| 2975 | ✗ | model::EvaporativeCoolerDirectResearchSpecial evap(model, schedule); | |
| 2976 | ✗ | result = evap; | |
| 2977 | ✗ | } | |
| 2978 | |||
| 2979 | ✗ | return result; | |
| 2980 | ✗ | } | |
| 2981 | |||
| 2982 | 5 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateCoilCooling(const pugi::xml_node& coolingCoilElement, | |
| 2983 | openstudio::model::Model& model) { | ||
| 2984 | 5 | boost::optional<model::ModelObject> result; | |
| 2985 | |||
| 2986 |
5/6✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 5 times.
|
20 | if (!istringEqual(coolingCoilElement.name(), "CoilClg")) { |
| 2987 | ✗ | return result; | |
| 2988 | } | ||
| 2989 | |||
| 2990 | 5 | bool znSys = false; | |
| 2991 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5 times.
|
15 | if (istringEqual(coolingCoilElement.parent().name(), "ZnSys")) { |
| 2992 | ✗ | znSys = true; | |
| 2993 | } | ||
| 2994 | |||
| 2995 | // Look for a sibling fan to figure out what the flow capacity should be | ||
| 2996 | |||
| 2997 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node flowCapElement; |
| 2998 | |||
| 2999 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node airSegElement = coolingCoilElement.parent(); |
| 3000 | |||
| 3001 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
5 | if (airSegElement) { |
| 3002 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node fanElement = airSegElement.child("Fan"); |
| 3003 | |||
| 3004 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
5 | if (fanElement) { |
| 3005 |
1/1✓ Branch 1 taken 5 times.
|
5 | flowCapElement = fanElement.child("FlowCapSim"); |
| 3006 | } | ||
| 3007 | } | ||
| 3008 | |||
| 3009 | // CapTotRtd | ||
| 3010 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node capTotRtdElement = coolingCoilElement.child("CapTotGrossRtdSim"); |
| 3011 | |||
| 3012 | // CapSensRtd | ||
| 3013 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node capSensRtdElement = coolingCoilElement.child("CapSensGrossRtdSim"); |
| 3014 | |||
| 3015 | // Type | ||
| 3016 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node coilCoolingTypeElement = coolingCoilElement.child("Type"); |
| 3017 | |||
| 3018 | // DirectExpansion | ||
| 3019 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 5 times.
|
15 | if (istringEqual(coilCoolingTypeElement.text().as_string(), "DirectExpansion")) { |
| 3020 | // Name | ||
| 3021 | ✗ | pugi::xml_node nameElement = coolingCoilElement.child("Name"); | |
| 3022 | ✗ | std::string coilName = nameElement.text().as_string(); | |
| 3023 | // NumClgStages | ||
| 3024 | ✗ | pugi::xml_node numClgStagesElement = coolingCoilElement.child("NumClgStages"); | |
| 3025 | |||
| 3026 | // CndsrType | ||
| 3027 | ✗ | pugi::xml_node cndsrTypeElement = coolingCoilElement.child("CndsrType"); | |
| 3028 | |||
| 3029 | ✗ | if (istringEqual(cndsrTypeElement.text().as_string(), "WaterSource")) { | |
| 3030 | ✗ | boost::optional<model::AirLoopHVACUnitarySystem> unitary; | |
| 3031 | ✗ | model::CoilCoolingWaterToAirHeatPumpEquationFit coil(model); | |
| 3032 | ✗ | coil.setName(nameElement.text().as_string()); | |
| 3033 | ✗ | if (znSys) { | |
| 3034 | ✗ | result = coil; | |
| 3035 | } else { | ||
| 3036 | ✗ | unitary = model::AirLoopHVACUnitarySystem(model); | |
| 3037 | ✗ | unitary->setName(coilName + " Unitary"); | |
| 3038 | ✗ | unitary->getImpl<model::detail::AirLoopHVACUnitarySystem_Impl>()->setControlType("SetPoint"); | |
| 3039 | ✗ | unitary->setCoolingCoil(coil); | |
| 3040 | ✗ | result = unitary.get(); | |
| 3041 | } | ||
| 3042 | |||
| 3043 | // Plant | ||
| 3044 | ✗ | pugi::xml_node fluidSegInRefElement = coolingCoilElement.child("FluidSegInRef"); | |
| 3045 | ✗ | if (!fluidSegInRefElement) { | |
| 3046 | ✗ | LOG(Error, "CoilCoolingWaterToAirHeatPumpEquationFit '" << coilName << "' doesn't have a FluidSegInRef element! It will not be connected."); | |
| 3047 | } else { | ||
| 3048 | ✗ | boost::optional<model::PlantLoop> plant = loopForSupplySegment(fluidSegInRefElement, model); | |
| 3049 | ✗ | if (plant) { | |
| 3050 | ✗ | plant->addDemandBranchForComponent(coil); | |
| 3051 | } | ||
| 3052 | ✗ | } | |
| 3053 | ✗ | if (!autosize()) { | |
| 3054 | ✗ | boost::optional<double> _flowCap = lexicalCastToDouble(flowCapElement); | |
| 3055 | ✗ | if (_flowCap) { | |
| 3056 | ✗ | double value = unitToUnit(_flowCap.get(), "cfm", "m^3/s").get(); | |
| 3057 | ✗ | coil.setRatedAirFlowRate(value); | |
| 3058 | ✗ | if (unitary) { | |
| 3059 | ✗ | unitary->setSupplyAirFlowRateDuringCoolingOperation(value); | |
| 3060 | } | ||
| 3061 | } | ||
| 3062 | } | ||
| 3063 | |||
| 3064 | ✗ | if (!autosize()) { | |
| 3065 | ✗ | pugi::xml_node fluidFlowRtDsgnSimElement = coolingCoilElement.child("FluidFlowRtDsgnSim"); | |
| 3066 | ✗ | boost::optional<double> _fluidFlowRtDsgnSim = lexicalCastToDouble(fluidFlowRtDsgnSimElement); | |
| 3067 | ✗ | if (_fluidFlowRtDsgnSim) { | |
| 3068 | ✗ | double value = unitToUnit(_fluidFlowRtDsgnSim.get(), "gal/min", "m^3/s").get(); | |
| 3069 | ✗ | coil.setRatedWaterFlowRate(value); | |
| 3070 | } | ||
| 3071 | } | ||
| 3072 | |||
| 3073 | ✗ | if (!autosize()) { | |
| 3074 | ✗ | pugi::xml_node capTotGrossRtdSimElement = coolingCoilElement.child("CapTotGrossRtdSim"); | |
| 3075 | ✗ | boost::optional<double> _capTotGrossRtdSim = lexicalCastToDouble(capTotGrossRtdSimElement); | |
| 3076 | ✗ | if (_capTotGrossRtdSim) { | |
| 3077 | ✗ | double value = unitToUnit(_capTotGrossRtdSim.get(), "Btu/h", "W").get(); | |
| 3078 | ✗ | coil.setRatedTotalCoolingCapacity(value); | |
| 3079 | } | ||
| 3080 | } | ||
| 3081 | |||
| 3082 | ✗ | if (!autosize()) { | |
| 3083 | ✗ | pugi::xml_node capSensGrossRtdSimElement = coolingCoilElement.child("CapSensGrossRtdSim"); | |
| 3084 | ✗ | boost::optional<double> _capSensGrossRtdSim = lexicalCastToDouble(capSensGrossRtdSimElement); | |
| 3085 | ✗ | if (_capSensGrossRtdSim) { | |
| 3086 | ✗ | double value = unitToUnit(_capSensGrossRtdSim.get(), "Btu/h", "W").get(); | |
| 3087 | ✗ | coil.setRatedSensibleCoolingCapacity(value); | |
| 3088 | } | ||
| 3089 | } | ||
| 3090 | |||
| 3091 | ✗ | pugi::xml_node dxEIRElement = coolingCoilElement.child("DXEIR"); | |
| 3092 | ✗ | boost::optional<double> _dxEIR = lexicalCastToDouble(dxEIRElement); | |
| 3093 | ✗ | if (_dxEIR) { | |
| 3094 | ✗ | coil.setRatedCoolingCoefficientofPerformance(1.0 / _dxEIR.get()); | |
| 3095 | } | ||
| 3096 | |||
| 3097 | ✗ | model::Curve _totalCoolingCapacityCurve = coil.totalCoolingCapacityCurve(); | |
| 3098 | ✗ | model::CurveQuadLinear totalCoolingCapacityCurve = _totalCoolingCapacityCurve.cast<model::CurveQuadLinear>(); | |
| 3099 | ✗ | totalCoolingCapacityCurve.setCoefficient1Constant(-9.149069561); | |
| 3100 | ✗ | totalCoolingCapacityCurve.setCoefficient2w(10.87814026); | |
| 3101 | ✗ | totalCoolingCapacityCurve.setCoefficient3x(-1.718780157); | |
| 3102 | ✗ | totalCoolingCapacityCurve.setCoefficient4y(0.746414818); | |
| 3103 | ✗ | totalCoolingCapacityCurve.setCoefficient5z(0.0); | |
| 3104 | |||
| 3105 | ✗ | model::Curve _sensibleCoolingCapacityCurve = coil.sensibleCoolingCapacityCurve(); | |
| 3106 | ✗ | model::CurveQuintLinear sensibleCoolingCapacityCurve = _sensibleCoolingCapacityCurve.cast<model::CurveQuintLinear>(); | |
| 3107 | ✗ | sensibleCoolingCapacityCurve.setCoefficient1Constant(-5.462690012); | |
| 3108 | ✗ | sensibleCoolingCapacityCurve.setCoefficient2v(17.95968138); | |
| 3109 | ✗ | sensibleCoolingCapacityCurve.setCoefficient3w(-11.87818402); | |
| 3110 | ✗ | sensibleCoolingCapacityCurve.setCoefficient4x(-0.980163419); | |
| 3111 | ✗ | sensibleCoolingCapacityCurve.setCoefficient5y(0.767285761); | |
| 3112 | ✗ | sensibleCoolingCapacityCurve.setCoefficient6z(0.0); | |
| 3113 | |||
| 3114 | ✗ | model::Curve _coolingPowerConsumptionCurve = coil.coolingPowerConsumptionCurve(); | |
| 3115 | ✗ | model::CurveQuadLinear coolingPowerConsumptionCurve = _coolingPowerConsumptionCurve.cast<model::CurveQuadLinear>(); | |
| 3116 | ✗ | coolingPowerConsumptionCurve.setCoefficient1Constant(-3.20456384); | |
| 3117 | ✗ | coolingPowerConsumptionCurve.setCoefficient2w(-0.976409399); | |
| 3118 | ✗ | coolingPowerConsumptionCurve.setCoefficient3x(3.97892546); | |
| 3119 | ✗ | coolingPowerConsumptionCurve.setCoefficient4y(0.938181818); | |
| 3120 | ✗ | coolingPowerConsumptionCurve.setCoefficient5z(-0.0); | |
| 3121 | |||
| 3122 | ✗ | coil.setNominalTimeforCondensateRemovaltoBegin(0.0); | |
| 3123 | ✗ | coil.setRatioofInitialMoistureEvaporationRateandSteadyStateLatentCapacity(0.0); | |
| 3124 | |||
| 3125 | ✗ | } | |
| 3126 | // Unspecified=assume 1, or specified as 1 stage | ||
| 3127 | ✗ | else if (!numClgStagesElement || (numClgStagesElement.text().as_int() == 1)) { | |
| 3128 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 3129 | |||
| 3130 | // Cap_fTempCrvRef | ||
| 3131 | |||
| 3132 | ✗ | boost::optional<model::Curve> coolingCurveFofTemp; | |
| 3133 | ✗ | pugi::xml_node cap_fTempCrvRefElement = coolingCoilElement.child("Cap_fTempCrvRef"); | |
| 3134 | ✗ | coolingCurveFofTemp = model.getModelObjectByName<model::Curve>(cap_fTempCrvRefElement.text().as_string()); | |
| 3135 | ✗ | if (!coolingCurveFofTemp) { | |
| 3136 | ✗ | LOG(Error, "Coil: " << nameElement.text().as_string() << "Broken Cap_fTempCrvRef"); | |
| 3137 | |||
| 3138 | // Provide default curves | ||
| 3139 | ✗ | model::CurveBiquadratic _coolingCurveFofTemp(model); | |
| 3140 | ✗ | _coolingCurveFofTemp.setCoefficient1Constant(0.942587793); | |
| 3141 | ✗ | _coolingCurveFofTemp.setCoefficient2x(0.009543347); | |
| 3142 | ✗ | _coolingCurveFofTemp.setCoefficient3xPOW2(0.000683770); | |
| 3143 | ✗ | _coolingCurveFofTemp.setCoefficient4y(-0.011042676); | |
| 3144 | ✗ | _coolingCurveFofTemp.setCoefficient5yPOW2(0.000005249); | |
| 3145 | ✗ | _coolingCurveFofTemp.setCoefficient6xTIMESY(-0.000009720); | |
| 3146 | ✗ | _coolingCurveFofTemp.setMinimumValueofx(17.0); | |
| 3147 | ✗ | _coolingCurveFofTemp.setMaximumValueofx(22.0); | |
| 3148 | ✗ | _coolingCurveFofTemp.setMinimumValueofy(13.0); | |
| 3149 | ✗ | _coolingCurveFofTemp.setMaximumValueofy(46.0); | |
| 3150 | ✗ | coolingCurveFofTemp = _coolingCurveFofTemp; | |
| 3151 | ✗ | } | |
| 3152 | |||
| 3153 | // Cap_fFlowCrvRef | ||
| 3154 | |||
| 3155 | ✗ | boost::optional<model::Curve> coolingCurveFofFlow; | |
| 3156 | ✗ | pugi::xml_node cap_fFlowCrvRefElement = coolingCoilElement.child("Cap_fFlowCrvRef"); | |
| 3157 | ✗ | coolingCurveFofFlow = model.getModelObjectByName<model::Curve>(cap_fFlowCrvRefElement.text().as_string()); | |
| 3158 | ✗ | if (!coolingCurveFofFlow) { | |
| 3159 | ✗ | LOG(Error, "Coil: " << nameElement.text().as_string() << "Broken Cap_fFlowCrvRef"); | |
| 3160 | |||
| 3161 | // Provide default curves | ||
| 3162 | ✗ | model::CurveQuadratic _coolingCurveFofFlow(model); | |
| 3163 | ✗ | _coolingCurveFofFlow.setCoefficient1Constant(0.8); | |
| 3164 | ✗ | _coolingCurveFofFlow.setCoefficient2x(0.2); | |
| 3165 | ✗ | _coolingCurveFofFlow.setCoefficient3xPOW2(0.0); | |
| 3166 | ✗ | _coolingCurveFofFlow.setMinimumValueofx(0.5); | |
| 3167 | ✗ | _coolingCurveFofFlow.setMaximumValueofx(1.5); | |
| 3168 | ✗ | coolingCurveFofFlow = _coolingCurveFofFlow; | |
| 3169 | ✗ | } | |
| 3170 | |||
| 3171 | // DXEIR_fTempCrvRef | ||
| 3172 | |||
| 3173 | ✗ | boost::optional<model::Curve> energyInputRatioFofTemp; | |
| 3174 | ✗ | pugi::xml_node dxEIR_fTempCrvRefElement = coolingCoilElement.child("DXEIR_fTempCrvRef"); | |
| 3175 | ✗ | energyInputRatioFofTemp = model.getModelObjectByName<model::Curve>(dxEIR_fTempCrvRefElement.text().as_string()); | |
| 3176 | ✗ | if (!energyInputRatioFofTemp) { | |
| 3177 | ✗ | LOG(Error, "Coil: " << nameElement.text().as_string() << "Broken DXEIR_fTempCrvRef"); | |
| 3178 | |||
| 3179 | // Provide default curves | ||
| 3180 | ✗ | model::CurveBiquadratic _energyInputRatioFofTemp(model); | |
| 3181 | ✗ | _energyInputRatioFofTemp.setCoefficient1Constant(0.342414409); | |
| 3182 | ✗ | _energyInputRatioFofTemp.setCoefficient2x(0.034885008); | |
| 3183 | ✗ | _energyInputRatioFofTemp.setCoefficient3xPOW2(-0.000623700); | |
| 3184 | ✗ | _energyInputRatioFofTemp.setCoefficient4y(0.004977216); | |
| 3185 | ✗ | _energyInputRatioFofTemp.setCoefficient5yPOW2(0.000437951); | |
| 3186 | ✗ | _energyInputRatioFofTemp.setCoefficient6xTIMESY(-0.000728028); | |
| 3187 | ✗ | _energyInputRatioFofTemp.setMinimumValueofx(17.0); | |
| 3188 | ✗ | _energyInputRatioFofTemp.setMaximumValueofx(22.0); | |
| 3189 | ✗ | _energyInputRatioFofTemp.setMinimumValueofy(13.0); | |
| 3190 | ✗ | _energyInputRatioFofTemp.setMaximumValueofy(46.0); | |
| 3191 | ✗ | energyInputRatioFofTemp = _energyInputRatioFofTemp; | |
| 3192 | ✗ | } | |
| 3193 | |||
| 3194 | // DX EIR function of Flow | ||
| 3195 | |||
| 3196 | ✗ | boost::optional<model::Curve> energyInputRatioFofFlow; | |
| 3197 | ✗ | pugi::xml_node dxEIR_fFlowCrvRefElement = coolingCoilElement.child("DXEIR_fFlowCrvRef"); | |
| 3198 | ✗ | energyInputRatioFofFlow = model.getModelObjectByName<model::Curve>(dxEIR_fFlowCrvRefElement.text().as_string()); | |
| 3199 | ✗ | if (!energyInputRatioFofFlow) { | |
| 3200 | ✗ | model::CurveQuadratic _energyInputRatioFofFlow(model); | |
| 3201 | ✗ | _energyInputRatioFofFlow.setCoefficient1Constant(1.20550); | |
| 3202 | ✗ | _energyInputRatioFofFlow.setCoefficient2x(-0.32953); | |
| 3203 | ✗ | _energyInputRatioFofFlow.setCoefficient3xPOW2(0.12308); | |
| 3204 | ✗ | _energyInputRatioFofFlow.setMinimumValueofx(0.75918); | |
| 3205 | ✗ | _energyInputRatioFofFlow.setMaximumValueofx(1.13877); | |
| 3206 | ✗ | energyInputRatioFofFlow = _energyInputRatioFofFlow; | |
| 3207 | ✗ | } | |
| 3208 | |||
| 3209 | // DXEIR_fPLRCrvRef | ||
| 3210 | |||
| 3211 | ✗ | boost::optional<model::Curve> partLoadFraction; | |
| 3212 | ✗ | pugi::xml_node dxEIR_fPLFCrvRefElement = coolingCoilElement.child("DXEIR_fPLFCrvRef"); | |
| 3213 | ✗ | partLoadFraction = model.getModelObjectByName<model::Curve>(dxEIR_fPLFCrvRefElement.text().as_string()); | |
| 3214 | ✗ | if (!partLoadFraction) { | |
| 3215 | ✗ | LOG(Error, "Coil: " << nameElement.text().as_string() << "Broken DXEIR_fPLFCrvRef"); | |
| 3216 | |||
| 3217 | // Provide default curves | ||
| 3218 | ✗ | model::CurveQuadratic _partLoadFraction(model); | |
| 3219 | ✗ | _partLoadFraction.setCoefficient1Constant(0.85); | |
| 3220 | ✗ | _partLoadFraction.setCoefficient2x(0.15); | |
| 3221 | ✗ | _partLoadFraction.setCoefficient3xPOW2(0.0); | |
| 3222 | ✗ | _partLoadFraction.setMinimumValueofx(0.0); | |
| 3223 | ✗ | _partLoadFraction.setMaximumValueofx(1.0); | |
| 3224 | ✗ | partLoadFraction = _partLoadFraction; | |
| 3225 | ✗ | } | |
| 3226 | |||
| 3227 | ✗ | model::CoilCoolingDXSingleSpeed coilCooling(model, schedule, coolingCurveFofTemp.get(), coolingCurveFofFlow.get(), | |
| 3228 | ✗ | energyInputRatioFofTemp.get(), energyInputRatioFofFlow.get(), partLoadFraction.get()); | |
| 3229 | |||
| 3230 | ✗ | coilCooling.setName(nameElement.text().as_string()); | |
| 3231 | |||
| 3232 | // FlowCap | ||
| 3233 | ✗ | if (!autosize()) { | |
| 3234 | ✗ | boost::optional<double> _flowCap = lexicalCastToDouble(flowCapElement); | |
| 3235 | |||
| 3236 | ✗ | if (_flowCap) { | |
| 3237 | ✗ | Quantity flowRateIP(_flowCap.get(), createCFMVolumetricFlowrate()); | |
| 3238 | ✗ | OptionalQuantity flowRateSI = QuantityConverter::instance().convert(flowRateIP, UnitSystem(UnitSystem::SI)); | |
| 3239 | ✗ | OS_ASSERT(flowRateSI); | |
| 3240 | ✗ | coilCooling.setRatedAirFlowRate(flowRateSI->value()); | |
| 3241 | ✗ | } | |
| 3242 | } | ||
| 3243 | |||
| 3244 | ✗ | boost::optional<double> totalCapacity; | |
| 3245 | ✗ | boost::optional<double> sensibleCapacity; | |
| 3246 | |||
| 3247 | // CapTotRtd | ||
| 3248 | ✗ | if (!autosize()) { | |
| 3249 | ✗ | boost::optional<double> _capTotRtd = lexicalCastToDouble(capTotRtdElement); | |
| 3250 | |||
| 3251 | ✗ | if (_capTotRtd) { | |
| 3252 | ✗ | Quantity valueIP(_capTotRtd.get(), createBTUPower()); | |
| 3253 | ✗ | OptionalQuantity valueSI = QuantityConverter::instance().convert(valueIP, UnitSystem(UnitSystem::SI)); | |
| 3254 | ✗ | OS_ASSERT(valueSI); | |
| 3255 | ✗ | coilCooling.setRatedTotalCoolingCapacity(valueSI->value()); | |
| 3256 | ✗ | totalCapacity = _capTotRtd.get(); | |
| 3257 | ✗ | } | |
| 3258 | } | ||
| 3259 | |||
| 3260 | // CapSensRtd | ||
| 3261 | ✗ | if (!autosize()) { | |
| 3262 | ✗ | boost::optional<double> _capSensRtd = lexicalCastToDouble(capSensRtdElement); | |
| 3263 | |||
| 3264 | ✗ | if (_capSensRtd) { | |
| 3265 | ✗ | sensibleCapacity = _capSensRtd.get(); | |
| 3266 | } | ||
| 3267 | } | ||
| 3268 | |||
| 3269 | ✗ | if (totalCapacity && sensibleCapacity) { | |
| 3270 | ✗ | coilCooling.setRatedSensibleHeatRatio(sensibleCapacity.get() / totalCapacity.get()); | |
| 3271 | } | ||
| 3272 | |||
| 3273 | // DXEIR | ||
| 3274 | ✗ | pugi::xml_node dxEIRElement = coolingCoilElement.child("DXEIR"); | |
| 3275 | ✗ | boost::optional<double> _dxEIR = lexicalCastToDouble(dxEIRElement); | |
| 3276 | ✗ | if (_dxEIR) { | |
| 3277 | ✗ | coilCooling.setRatedCOP(1.0 / _dxEIR.get()); | |
| 3278 | } | ||
| 3279 | |||
| 3280 | // DXCrankcaseHtCap | ||
| 3281 | ✗ | pugi::xml_node dxCrankcaseHtCapElement = coolingCoilElement.child("DXCrankcaseHtrCapSim"); | |
| 3282 | ✗ | boost::optional<double> _dxCrankcaseHtCap = lexicalCastToDouble(dxCrankcaseHtCapElement); | |
| 3283 | ✗ | if (_dxCrankcaseHtCap) { | |
| 3284 | ✗ | double value = unitToUnit(_dxCrankcaseHtCap.get(), "Btu/h", "W").get(); | |
| 3285 | ✗ | coilCooling.setCrankcaseHeaterCapacity(value); | |
| 3286 | } | ||
| 3287 | |||
| 3288 | // DXCrankcaseCtrlTemp | ||
| 3289 | ✗ | pugi::xml_node dxCrankcaseCtrlTempElement = coolingCoilElement.child("DXCrankcaseCtrlTemp"); | |
| 3290 | ✗ | boost::optional<double> _dxCrankcaseCtrlTemp = lexicalCastToDouble(dxCrankcaseCtrlTempElement); | |
| 3291 | ✗ | if (_dxCrankcaseCtrlTemp) { | |
| 3292 | ✗ | double value = unitToUnit(_dxCrankcaseCtrlTemp.get(), "F", "C").get(); | |
| 3293 | ✗ | coilCooling.setMaximumOutdoorDryBulbTemperatureForCrankcaseHeaterOperation(value); | |
| 3294 | } | ||
| 3295 | |||
| 3296 | ✗ | result = coilCooling; | |
| 3297 | ✗ | } else if (numClgStagesElement.text().as_int() == 2) { | |
| 3298 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 3299 | |||
| 3300 | // Cap_fTempCrvRef | ||
| 3301 | |||
| 3302 | ✗ | boost::optional<model::Curve> coolingCurveFofTemp; | |
| 3303 | ✗ | pugi::xml_node cap_fTempCrvRefElement = coolingCoilElement.child("Cap_fTempCrvRef"); | |
| 3304 | ✗ | coolingCurveFofTemp = model.getModelObjectByName<model::Curve>(cap_fTempCrvRefElement.text().as_string()); | |
| 3305 | ✗ | if (!coolingCurveFofTemp) { | |
| 3306 | ✗ | LOG(Error, "Coil: " << nameElement.text().as_string() << "Broken Cap_fTempCrvRef"); | |
| 3307 | |||
| 3308 | // Provide default curves | ||
| 3309 | ✗ | model::CurveBiquadratic _coolingCurveFofTemp(model); | |
| 3310 | ✗ | _coolingCurveFofTemp.setCoefficient1Constant(0.942587793); | |
| 3311 | ✗ | _coolingCurveFofTemp.setCoefficient2x(0.009543347); | |
| 3312 | ✗ | _coolingCurveFofTemp.setCoefficient3xPOW2(0.000683770); | |
| 3313 | ✗ | _coolingCurveFofTemp.setCoefficient4y(-0.011042676); | |
| 3314 | ✗ | _coolingCurveFofTemp.setCoefficient5yPOW2(0.000005249); | |
| 3315 | ✗ | _coolingCurveFofTemp.setCoefficient6xTIMESY(-0.000009720); | |
| 3316 | ✗ | _coolingCurveFofTemp.setMinimumValueofx(17.0); | |
| 3317 | ✗ | _coolingCurveFofTemp.setMaximumValueofx(22.0); | |
| 3318 | ✗ | _coolingCurveFofTemp.setMinimumValueofy(13.0); | |
| 3319 | ✗ | _coolingCurveFofTemp.setMaximumValueofy(46.0); | |
| 3320 | ✗ | coolingCurveFofTemp = _coolingCurveFofTemp; | |
| 3321 | ✗ | } | |
| 3322 | |||
| 3323 | // Cap_fFlowCrvRef | ||
| 3324 | |||
| 3325 | ✗ | boost::optional<model::Curve> coolingCurveFofFlow; | |
| 3326 | ✗ | pugi::xml_node cap_fFlowCrvRefElement = coolingCoilElement.child("Cap_fFlowCrvRef"); | |
| 3327 | ✗ | coolingCurveFofFlow = model.getModelObjectByName<model::Curve>(cap_fFlowCrvRefElement.text().as_string()); | |
| 3328 | ✗ | if (!coolingCurveFofFlow) { | |
| 3329 | ✗ | LOG(Error, "Coil: " << nameElement.text().as_string() << "Broken Cap_fFlowCrvRef"); | |
| 3330 | |||
| 3331 | // Provide default curves | ||
| 3332 | ✗ | model::CurveQuadratic _coolingCurveFofFlow(model); | |
| 3333 | ✗ | _coolingCurveFofFlow.setCoefficient1Constant(0.8); | |
| 3334 | ✗ | _coolingCurveFofFlow.setCoefficient2x(0.2); | |
| 3335 | ✗ | _coolingCurveFofFlow.setCoefficient3xPOW2(0.0); | |
| 3336 | ✗ | _coolingCurveFofFlow.setMinimumValueofx(0.5); | |
| 3337 | ✗ | _coolingCurveFofFlow.setMaximumValueofx(1.5); | |
| 3338 | ✗ | coolingCurveFofFlow = _coolingCurveFofFlow; | |
| 3339 | ✗ | } | |
| 3340 | |||
| 3341 | // DXEIR_fTempCrvRef | ||
| 3342 | |||
| 3343 | ✗ | boost::optional<model::Curve> energyInputRatioFofTemp; | |
| 3344 | ✗ | pugi::xml_node dxEIR_fTempCrvRefElement = coolingCoilElement.child("DXEIR_fTempCrvRef"); | |
| 3345 | ✗ | energyInputRatioFofTemp = model.getModelObjectByName<model::Curve>(dxEIR_fTempCrvRefElement.text().as_string()); | |
| 3346 | ✗ | if (!energyInputRatioFofTemp) { | |
| 3347 | ✗ | LOG(Error, "Coil: " << nameElement.text().as_string() << "Broken DXEIR_fTempCrvRef"); | |
| 3348 | |||
| 3349 | // Provide default curves | ||
| 3350 | ✗ | model::CurveBiquadratic _energyInputRatioFofTemp(model); | |
| 3351 | ✗ | _energyInputRatioFofTemp.setCoefficient1Constant(0.342414409); | |
| 3352 | ✗ | _energyInputRatioFofTemp.setCoefficient2x(0.034885008); | |
| 3353 | ✗ | _energyInputRatioFofTemp.setCoefficient3xPOW2(-0.000623700); | |
| 3354 | ✗ | _energyInputRatioFofTemp.setCoefficient4y(0.004977216); | |
| 3355 | ✗ | _energyInputRatioFofTemp.setCoefficient5yPOW2(0.000437951); | |
| 3356 | ✗ | _energyInputRatioFofTemp.setCoefficient6xTIMESY(-0.000728028); | |
| 3357 | ✗ | _energyInputRatioFofTemp.setMinimumValueofx(17.0); | |
| 3358 | ✗ | _energyInputRatioFofTemp.setMaximumValueofx(22.0); | |
| 3359 | ✗ | _energyInputRatioFofTemp.setMinimumValueofy(13.0); | |
| 3360 | ✗ | _energyInputRatioFofTemp.setMaximumValueofy(46.0); | |
| 3361 | ✗ | energyInputRatioFofTemp = _energyInputRatioFofTemp; | |
| 3362 | ✗ | } | |
| 3363 | |||
| 3364 | // DX EIR function of Flow | ||
| 3365 | |||
| 3366 | ✗ | boost::optional<model::Curve> energyInputRatioFofFlow; | |
| 3367 | ✗ | pugi::xml_node dxEIR_fFlowCrvRefElement = coolingCoilElement.child("DXEIR_fFlowCrvRef"); | |
| 3368 | ✗ | energyInputRatioFofFlow = model.getModelObjectByName<model::Curve>(dxEIR_fFlowCrvRefElement.text().as_string()); | |
| 3369 | ✗ | if (!energyInputRatioFofFlow) { | |
| 3370 | ✗ | model::CurveQuadratic _energyInputRatioFofFlow(model); | |
| 3371 | ✗ | _energyInputRatioFofFlow.setCoefficient1Constant(1.20550); | |
| 3372 | ✗ | _energyInputRatioFofFlow.setCoefficient2x(-0.32953); | |
| 3373 | ✗ | _energyInputRatioFofFlow.setCoefficient3xPOW2(0.12308); | |
| 3374 | ✗ | _energyInputRatioFofFlow.setMinimumValueofx(0.75918); | |
| 3375 | ✗ | _energyInputRatioFofFlow.setMaximumValueofx(1.13877); | |
| 3376 | ✗ | energyInputRatioFofFlow = _energyInputRatioFofFlow; | |
| 3377 | ✗ | } | |
| 3378 | |||
| 3379 | // DXEIR_fPLRCrvRef | ||
| 3380 | |||
| 3381 | ✗ | boost::optional<model::Curve> partLoadFraction; | |
| 3382 | ✗ | pugi::xml_node dxEIR_fPLFCrvRefElement = coolingCoilElement.child("DXEIR_fPLFCrvRef"); | |
| 3383 | ✗ | partLoadFraction = model.getModelObjectByName<model::Curve>(dxEIR_fPLFCrvRefElement.text().as_string()); | |
| 3384 | ✗ | if (!partLoadFraction) { | |
| 3385 | ✗ | LOG(Error, "Coil: " << nameElement.text().as_string() << "Broken DXEIR_fPLFCrvRef"); | |
| 3386 | |||
| 3387 | // Provide default curves | ||
| 3388 | ✗ | model::CurveQuadratic _partLoadFraction(model); | |
| 3389 | ✗ | _partLoadFraction.setCoefficient1Constant(0.85); | |
| 3390 | ✗ | _partLoadFraction.setCoefficient2x(0.15); | |
| 3391 | ✗ | _partLoadFraction.setCoefficient3xPOW2(0.0); | |
| 3392 | ✗ | _partLoadFraction.setMinimumValueofx(0.0); | |
| 3393 | ✗ | _partLoadFraction.setMaximumValueofx(1.0); | |
| 3394 | ✗ | partLoadFraction = _partLoadFraction; | |
| 3395 | ✗ | } | |
| 3396 | |||
| 3397 | model::CoilCoolingDXTwoSpeed coilCooling( | ||
| 3398 | ✗ | model, schedule, coolingCurveFofTemp.get(), coolingCurveFofFlow.get(), energyInputRatioFofTemp.get(), energyInputRatioFofFlow.get(), | |
| 3399 | ✗ | partLoadFraction.get(), coolingCurveFofTemp->clone(model).cast<model::Curve>(), energyInputRatioFofTemp->clone(model).cast<model::Curve>()); | |
| 3400 | |||
| 3401 | ✗ | coilCooling.setName(nameElement.text().as_string()); | |
| 3402 | |||
| 3403 | ✗ | boost::optional<double> totalCapacity; | |
| 3404 | ✗ | boost::optional<double> sensibleCapacity; | |
| 3405 | ✗ | boost::optional<double> lowSpeedCapacityFraction; | |
| 3406 | |||
| 3407 | // CapTotRtdStageFrac | ||
| 3408 | ✗ | for (const pugi::xml_node& capTotRtdStageFracElement : coolingCoilElement.children("CapTotRtdStageFrac")) { | |
| 3409 | ✗ | std::string indexAttribute = capTotRtdStageFracElement.attribute("index").value(); | |
| 3410 | ✗ | if (istringEqual(indexAttribute, "0")) { | |
| 3411 | ✗ | lowSpeedCapacityFraction = lexicalCastToDouble(capTotRtdStageFracElement); | |
| 3412 | ✗ | break; | |
| 3413 | } | ||
| 3414 | ✗ | } | |
| 3415 | |||
| 3416 | // FlowCap | ||
| 3417 | ✗ | if (!autosize()) { | |
| 3418 | ✗ | boost::optional<double> _flowCap = lexicalCastToDouble(flowCapElement); | |
| 3419 | |||
| 3420 | ✗ | if (_flowCap) { | |
| 3421 | ✗ | Quantity flowRateIP(_flowCap.get(), createCFMVolumetricFlowrate()); | |
| 3422 | ✗ | OptionalQuantity flowRateSI = QuantityConverter::instance().convert(flowRateIP, UnitSystem(UnitSystem::SI)); | |
| 3423 | ✗ | OS_ASSERT(flowRateSI); | |
| 3424 | ✗ | coilCooling.setRatedHighSpeedAirFlowRate(flowRateSI->value()); | |
| 3425 | ✗ | if (lowSpeedCapacityFraction) { | |
| 3426 | ✗ | coilCooling.setRatedLowSpeedAirFlowRate(flowRateSI->value() * lowSpeedCapacityFraction.get()); | |
| 3427 | } | ||
| 3428 | ✗ | } | |
| 3429 | } | ||
| 3430 | |||
| 3431 | // CapTotRtd | ||
| 3432 | ✗ | if (!autosize()) { | |
| 3433 | ✗ | boost::optional<double> _capTotRtd = lexicalCastToDouble(capTotRtdElement); | |
| 3434 | |||
| 3435 | ✗ | if (_capTotRtd) { | |
| 3436 | ✗ | Quantity valueIP(_capTotRtd.get(), createBTUPower()); | |
| 3437 | ✗ | OptionalQuantity valueSI = QuantityConverter::instance().convert(valueIP, UnitSystem(UnitSystem::SI)); | |
| 3438 | ✗ | OS_ASSERT(valueSI); | |
| 3439 | ✗ | coilCooling.setRatedHighSpeedTotalCoolingCapacity(valueSI->value()); | |
| 3440 | ✗ | if (lowSpeedCapacityFraction) { | |
| 3441 | ✗ | coilCooling.setRatedLowSpeedTotalCoolingCapacity(valueSI->value() * lowSpeedCapacityFraction.get()); | |
| 3442 | } | ||
| 3443 | |||
| 3444 | ✗ | totalCapacity = _capTotRtd.get(); | |
| 3445 | ✗ | } | |
| 3446 | } | ||
| 3447 | |||
| 3448 | // CapSensRtd | ||
| 3449 | ✗ | if (!autosize()) { | |
| 3450 | ✗ | boost::optional<double> _capSensRtd = lexicalCastToDouble(capSensRtdElement); | |
| 3451 | |||
| 3452 | ✗ | if (_capSensRtd) { | |
| 3453 | ✗ | sensibleCapacity = _capSensRtd; | |
| 3454 | } | ||
| 3455 | } | ||
| 3456 | |||
| 3457 | ✗ | if (totalCapacity && sensibleCapacity) { | |
| 3458 | ✗ | coilCooling.setRatedHighSpeedSensibleHeatRatio(sensibleCapacity.get() / totalCapacity.get()); | |
| 3459 | |||
| 3460 | // CapSensRtdStageFrac | ||
| 3461 | ✗ | if (lowSpeedCapacityFraction) { | |
| 3462 | ✗ | for (const pugi::xml_node& capSensRtdStageFracElement : coolingCoilElement.children("CapSensRtdStageFrac")) { | |
| 3463 | ✗ | std::string indexAttribute = capSensRtdStageFracElement.attribute("index").value(); | |
| 3464 | ✗ | if (istringEqual(indexAttribute, "0")) { | |
| 3465 | ✗ | boost::optional<double> _fraction = lexicalCastToDouble(capSensRtdStageFracElement); | |
| 3466 | ✗ | if (_fraction) { | |
| 3467 | ✗ | double lowSHR = (sensibleCapacity.get() * _fraction.get()) / (totalCapacity.get() * lowSpeedCapacityFraction.get()); | |
| 3468 | ✗ | coilCooling.setRatedLowSpeedSensibleHeatRatio(lowSHR); | |
| 3469 | } | ||
| 3470 | ✗ | break; | |
| 3471 | } | ||
| 3472 | ✗ | } | |
| 3473 | } | ||
| 3474 | } | ||
| 3475 | |||
| 3476 | // DXEIR | ||
| 3477 | |||
| 3478 | ✗ | pugi::xml_node dxEIRElement = coolingCoilElement.child("DXEIR"); | |
| 3479 | |||
| 3480 | ✗ | boost::optional<double> _dxEIR = lexicalCastToDouble(dxEIRElement); | |
| 3481 | |||
| 3482 | ✗ | if (_dxEIR) { | |
| 3483 | ✗ | double cop = 1.0 / _dxEIR.get(); | |
| 3484 | ✗ | coilCooling.setRatedHighSpeedCOP(cop); | |
| 3485 | ✗ | coilCooling.setRatedLowSpeedCOP(cop); | |
| 3486 | } | ||
| 3487 | |||
| 3488 | ✗ | result = coilCooling; | |
| 3489 | ✗ | } else if (numClgStagesElement.text().as_int() > 2) { | |
| 3490 | ✗ | LOG(Error, "DX cooling coils with more than two stages are not yet supported. See coil named " << coilName); | |
| 3491 | } | ||
| 3492 | ✗ | } | |
| 3493 | // ChilledWater | ||
| 3494 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 17 taken 5 times.
✗ Branch 18 not taken.
|
15 | if (istringEqual(coilCoolingTypeElement.text().as_string(), "ChilledWater")) { |
| 3495 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); |
| 3496 | |||
| 3497 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::CoilCoolingWater coilCooling(model, schedule); |
| 3498 | |||
| 3499 | // Name | ||
| 3500 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node nameElement = coolingCoilElement.child("Name"); |
| 3501 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | std::string coilName = nameElement.text().as_string(); |
| 3502 | |||
| 3503 |
1/1✓ Branch 1 taken 5 times.
|
5 | coilCooling.setName(coilName); |
| 3504 | |||
| 3505 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | coilCooling.setTypeOfAnalysis("DetailedAnalysis"); |
| 3506 | |||
| 3507 | // Plant | ||
| 3508 | 5 | boost::optional<model::PlantLoop> plant; | |
| 3509 | |||
| 3510 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node fluidSegInRefElement = coolingCoilElement.child("FluidSegInRef"); |
| 3511 |
2/3✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
|
5 | if (!fluidSegInRefElement) { |
| 3512 | ✗ | LOG(Error, "CoilCoolingWater '" << coilName << "' doesn't have a FluidSegInRef element! It will not be connected."); | |
| 3513 | } else { | ||
| 3514 |
1/1✓ Branch 1 taken 5 times.
|
5 | plant = loopForSupplySegment(fluidSegInRefElement, model); |
| 3515 | |||
| 3516 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (plant) { |
| 3517 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | plant->addDemandBranchForComponent(coilCooling); |
| 3518 | } | ||
| 3519 | } | ||
| 3520 | |||
| 3521 |
1/1✓ Branch 1 taken 5 times.
|
5 | coilCooling.autosizeDesignInletAirTemperature(); |
| 3522 |
1/1✓ Branch 1 taken 5 times.
|
5 | coilCooling.autosizeDesignOutletAirTemperature(); |
| 3523 |
1/1✓ Branch 1 taken 5 times.
|
5 | coilCooling.autosizeDesignInletAirHumidityRatio(); |
| 3524 |
1/1✓ Branch 1 taken 5 times.
|
5 | coilCooling.autosizeDesignOutletAirHumidityRatio(); |
| 3525 | |||
| 3526 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
5 | if (!autosize()) { |
| 3527 | // Design Water Volum Flow Rate of Coil | ||
| 3528 | |||
| 3529 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node fluidFlowRtDsgnElement = coolingCoilElement.child("FluidFlowRtDsgnSim"); |
| 3530 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _fluidFlowRtDsgn = lexicalCastToDouble(fluidFlowRtDsgnElement); |
| 3531 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_fluidFlowRtDsgn) { |
| 3532 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | coilCooling.setDesignWaterFlowRate(_fluidFlowRtDsgn.get() * 0.00006309); |
| 3533 | } | ||
| 3534 | |||
| 3535 | // Design defaults | ||
| 3536 | |||
| 3537 |
1/1✓ Branch 1 taken 5 times.
|
5 | coilCooling.setDesignInletWaterTemperature(7.22); // From Sizing Plant |
| 3538 | |||
| 3539 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (plant) { |
| 3540 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | coilCooling.setDesignInletWaterTemperature(plant->sizingPlant().designLoopExitTemperature()); |
| 3541 | } | ||
| 3542 | |||
| 3543 | // FlowCap | ||
| 3544 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _flowCap = lexicalCastToDouble(flowCapElement); |
| 3545 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_flowCap) { |
| 3546 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | Quantity flowRateIP(_flowCap.get(), createCFMVolumetricFlowrate()); |
| 3547 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | OptionalQuantity flowRateSI = QuantityConverter::instance().convert(flowRateIP, UnitSystem(UnitSystem::SI)); |
| 3548 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(flowRateSI); |
| 3549 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | coilCooling.setDesignAirFlowRate(flowRateSI->value()); |
| 3550 | 5 | } | |
| 3551 | } | ||
| 3552 | |||
| 3553 |
1/1✓ Branch 1 taken 5 times.
|
5 | result = coilCooling; |
| 3554 | 5 | } | |
| 3555 | |||
| 3556 | 5 | return result; | |
| 3557 | ✗ | } | |
| 3558 | |||
| 3559 | 25 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateThermalZone(const pugi::xml_node& thermalZoneElement, | |
| 3560 | openstudio::model::Model& model) { | ||
| 3561 |
1/1✓ Branch 1 taken 25 times.
|
25 | UnitSystem siSys(UnitSystem::SI); |
| 3562 |
1/1✓ Branch 1 taken 25 times.
|
25 | UnitSystem whSys(UnitSystem::Wh); |
| 3563 | |||
| 3564 | 25 | boost::optional<openstudio::model::ModelObject> result; | |
| 3565 | |||
| 3566 |
5/6✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
✓ Branch 7 taken 25 times.
✓ Branch 10 taken 25 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 25 times.
|
100 | if (!istringEqual(thermalZoneElement.name(), "ThrmlZn")) { |
| 3567 | ✗ | return result; | |
| 3568 | } | ||
| 3569 | |||
| 3570 | 25 | boost::optional<model::ThermalZone> optionalThermalZone; | |
| 3571 | 25 | boost::optional<model::ThermostatSetpointDualSetpoint> optionalThermostat; | |
| 3572 | |||
| 3573 | // Name | ||
| 3574 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node nameElement = thermalZoneElement.child("Name"); |
| 3575 |
3/3✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
✓ Branch 7 taken 25 times.
|
25 | std::string name = nameElement.text().as_string(); |
| 3576 |
1/1✓ Branch 1 taken 25 times.
|
25 | optionalThermalZone = model.getConcreteModelObjectByName<model::ThermalZone>(name); |
| 3577 | |||
| 3578 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
|
25 | if (!optionalThermalZone) { |
| 3579 | ✗ | return result; | |
| 3580 | } | ||
| 3581 | |||
| 3582 |
2/2✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
|
25 | model::ThermalZone thermalZone = optionalThermalZone.get(); |
| 3583 |
1/1✓ Branch 1 taken 25 times.
|
25 | result = thermalZone; |
| 3584 | |||
| 3585 | // Type | ||
| 3586 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node typeElement = thermalZoneElement.child("Type"); |
| 3587 |
2/3✓ Branch 1 taken 25 times.
✓ Branch 3 taken 25 times.
✗ Branch 4 not taken.
|
25 | if (typeElement) { |
| 3588 |
7/7✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
✓ Branch 7 taken 25 times.
✓ Branch 10 taken 25 times.
✓ Branch 13 taken 25 times.
✓ Branch 17 taken 21 times.
✓ Branch 18 taken 4 times.
|
75 | if (istringEqual(typeElement.text().as_string(), "Conditioned")) { |
| 3589 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | optionalThermostat = model::ThermostatSetpointDualSetpoint(model); |
| 3590 |
3/3✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
|
21 | optionalThermostat->setName(name + " Thermostat"); |
| 3591 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | thermalZone.setThermostatSetpointDualSetpoint(*optionalThermostat); |
| 3592 |
6/7✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 4 times.
✓ Branch 17 taken 4 times.
✗ Branch 18 not taken.
|
12 | } else if (istringEqual(typeElement.text().as_string(), "Unconditioned")) { |
| 3593 | // no thermostat | ||
| 3594 |
6/7✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 4 times.
|
12 | } else if (istringEqual(typeElement.text().as_string(), "Plenum")) { |
| 3595 | // no thermostat | ||
| 3596 | } else { | ||
| 3597 | ✗ | LOG(Error, "Unknown thermal zone type '" << typeElement.text().as_string() << "'"); | |
| 3598 | } | ||
| 3599 | } | ||
| 3600 | |||
| 3601 | // Volume | ||
| 3602 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node volElement = thermalZoneElement.child("VolSim"); |
| 3603 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> _vol = lexicalCastToDouble(volElement); |
| 3604 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
|
25 | if (_vol) { |
| 3605 | // sdd units = ft^3, os units = m^3 | ||
| 3606 | ✗ | Quantity thermalZoneVolumeIP(_vol.get(), BTUUnit(BTUExpnt(0, 3, 0, 0))); | |
| 3607 | ✗ | OptionalQuantity thermalZoneVolumeSI = QuantityConverter::instance().convert(thermalZoneVolumeIP, UnitSystem(UnitSystem::Wh)); | |
| 3608 | ✗ | OS_ASSERT(thermalZoneVolumeSI); | |
| 3609 | ✗ | OS_ASSERT(thermalZoneVolumeSI->units() == WhUnit(WhExpnt(0, 0, 3, 0))); | |
| 3610 | ✗ | thermalZone.setVolume(thermalZoneVolumeSI->value()); | |
| 3611 | ✗ | } | |
| 3612 | |||
| 3613 | // Sizing | ||
| 3614 | |||
| 3615 | 25 | double clgDsgnSupAirTemp = 14.0; | |
| 3616 | 25 | double clgDsgnSizingFac = 1.0; | |
| 3617 | 25 | double htgDsgnSupAirTemp = 40.0; | |
| 3618 | 25 | double htgDsgnSizingFac = 1.0; | |
| 3619 | |||
| 3620 |
1/1✓ Branch 1 taken 25 times.
|
25 | model::SizingZone sizingZone = thermalZone.sizingZone(); |
| 3621 | |||
| 3622 | { | ||
| 3623 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node clgDsgnSupAirTempElement = thermalZoneElement.child("ClgDsgnSupAirTemp"); |
| 3624 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> _clgDsgnSupAirTemp = lexicalCastToDouble(clgDsgnSupAirTempElement); |
| 3625 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
|
25 | if (_clgDsgnSupAirTemp) { |
| 3626 | ✗ | double value = unitToUnit(_clgDsgnSupAirTemp.get(), "F", "C").get(); | |
| 3627 | ✗ | sizingZone.setZoneCoolingDesignSupplyAirTemperature(value); | |
| 3628 | ✗ | sizingZone.setZoneCoolingDesignSupplyAirTemperatureInputMethod("SupplyAirTemperature"); | |
| 3629 | } | ||
| 3630 | } | ||
| 3631 | |||
| 3632 | { | ||
| 3633 |
1/1✓ Branch 1 taken 25 times.
|
25 | auto clgDsgnSupAirTempDiffElement = thermalZoneElement.child("ClgDsgnSupAirTempDiff"); |
| 3634 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> _clgDsgnSupAirTempDiff = lexicalCastToDouble(clgDsgnSupAirTempDiffElement); |
| 3635 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 4 times.
|
25 | if (_clgDsgnSupAirTempDiff) { |
| 3636 |
1/1✓ Branch 1 taken 21 times.
|
21 | double value = _clgDsgnSupAirTempDiff.get() * 5.0 / 9.0; // delta F to C |
| 3637 |
1/1✓ Branch 1 taken 21 times.
|
21 | sizingZone.setZoneCoolingDesignSupplyAirTemperatureDifference(value); |
| 3638 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
42 | sizingZone.setZoneCoolingDesignSupplyAirTemperatureInputMethod("TemperatureDifference"); |
| 3639 | } | ||
| 3640 | } | ||
| 3641 | |||
| 3642 | { | ||
| 3643 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node clgDsgnSizingFacElement = thermalZoneElement.child("ClgDsgnSizingFac"); |
| 3644 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> _clgDsgnSizingFac = lexicalCastToDouble(clgDsgnSizingFacElement); |
| 3645 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 4 times.
|
25 | if (_clgDsgnSizingFac) { |
| 3646 |
1/1✓ Branch 1 taken 21 times.
|
21 | clgDsgnSizingFac = _clgDsgnSizingFac.get(); |
| 3647 | } | ||
| 3648 | } | ||
| 3649 | |||
| 3650 | { | ||
| 3651 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node htgDsgnSupAirTempElement = thermalZoneElement.child("HtgDsgnSupAirTemp"); |
| 3652 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> _htgDsgnSupAirTemp = lexicalCastToDouble(htgDsgnSupAirTempElement); |
| 3653 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
|
25 | if (_htgDsgnSupAirTemp) { |
| 3654 | ✗ | double value = unitToUnit(_htgDsgnSupAirTemp.get(), "F", "C").get(); | |
| 3655 | ✗ | sizingZone.setZoneHeatingDesignSupplyAirTemperature(value); | |
| 3656 | ✗ | sizingZone.setZoneHeatingDesignSupplyAirTemperatureInputMethod("SupplyAirTemperature"); | |
| 3657 | } | ||
| 3658 | } | ||
| 3659 | |||
| 3660 | { | ||
| 3661 |
1/1✓ Branch 1 taken 25 times.
|
25 | auto htgDsgnSupAirTempDiffElement = thermalZoneElement.child("HtgDsgnSupAirTempDiff"); |
| 3662 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> _htgDsgnSupAirTempDiff = lexicalCastToDouble(htgDsgnSupAirTempDiffElement); |
| 3663 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 4 times.
|
25 | if (_htgDsgnSupAirTempDiff) { |
| 3664 |
1/1✓ Branch 1 taken 21 times.
|
21 | double value = _htgDsgnSupAirTempDiff.get() * 5.0 / 9.0; // delta F to C |
| 3665 |
1/1✓ Branch 1 taken 21 times.
|
21 | sizingZone.setZoneHeatingDesignSupplyAirTemperatureDifference(value); |
| 3666 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
42 | sizingZone.setZoneHeatingDesignSupplyAirTemperatureInputMethod("TemperatureDifference"); |
| 3667 | } | ||
| 3668 | } | ||
| 3669 | |||
| 3670 | { | ||
| 3671 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node htgDsgnSizingFacElement = thermalZoneElement.child("HtgDsgnSizingFac"); |
| 3672 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> _htgDsgnSizingFac = lexicalCastToDouble(htgDsgnSizingFacElement); |
| 3673 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 4 times.
|
25 | if (_htgDsgnSizingFac) { |
| 3674 |
1/1✓ Branch 1 taken 21 times.
|
21 | htgDsgnSizingFac = _htgDsgnSizingFac.get(); |
| 3675 | } | ||
| 3676 | } | ||
| 3677 | |||
| 3678 |
1/1✓ Branch 1 taken 25 times.
|
25 | sizingZone.setZoneCoolingDesignSupplyAirTemperature(clgDsgnSupAirTemp); |
| 3679 |
1/1✓ Branch 1 taken 25 times.
|
25 | sizingZone.setZoneHeatingDesignSupplyAirTemperature(htgDsgnSupAirTemp); |
| 3680 |
1/1✓ Branch 1 taken 25 times.
|
25 | sizingZone.setZoneCoolingSizingFactor(clgDsgnSizingFac); |
| 3681 |
1/1✓ Branch 1 taken 25 times.
|
25 | sizingZone.setZoneHeatingSizingFactor(htgDsgnSizingFac); |
| 3682 | |||
| 3683 |
1/1✓ Branch 1 taken 25 times.
|
25 | sizingZone.setCoolingMinimumAirFlowperZoneFloorArea(0.0); |
| 3684 |
1/1✓ Branch 1 taken 25 times.
|
25 | sizingZone.setCoolingMinimumAirFlow(0.0); |
| 3685 |
1/1✓ Branch 1 taken 25 times.
|
25 | sizingZone.setCoolingMinimumAirFlowFraction(0.0); |
| 3686 |
2/2✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
|
25 | sizingZone.setCoolingDesignAirFlowMethod("DesignDay"); |
| 3687 | |||
| 3688 |
1/1✓ Branch 1 taken 25 times.
|
25 | sizingZone.setHeatingMaximumAirFlowperZoneFloorArea(0.0); |
| 3689 |
1/1✓ Branch 1 taken 25 times.
|
25 | sizingZone.setHeatingMaximumAirFlow(0.0); |
| 3690 |
1/1✓ Branch 1 taken 25 times.
|
25 | sizingZone.setHeatingMaximumAirFlowFraction(0.0); |
| 3691 |
2/2✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
|
25 | sizingZone.setHeatingDesignAirFlowMethod("DesignDay"); |
| 3692 | |||
| 3693 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node htgDsgnMaxFlowFracElement = thermalZoneElement.child("HtgDsgnMaxFlowFrac"); |
| 3694 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> _htgDsgnMaxFlowFrac = lexicalCastToDouble(htgDsgnMaxFlowFracElement); |
| 3695 |
6/7✓ Branch 0 taken 21 times.
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 21 times.
✓ Branch 5 taken 21 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 21 times.
✓ Branch 8 taken 4 times.
|
25 | if (_htgDsgnMaxFlowFrac && _htgDsgnMaxFlowFrac.get() > 0.0) { |
| 3696 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | sizingZone.setHeatingDesignAirFlowMethod("DesignDayWithLimit"); |
| 3697 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | sizingZone.setHeatingMaximumAirFlowFraction(_htgDsgnMaxFlowFrac.get()); |
| 3698 | } | ||
| 3699 | |||
| 3700 | // Ventilation | ||
| 3701 | |||
| 3702 | 25 | double ventPerPersonSim = 0.0; | |
| 3703 | 25 | double ventPerAreaSim = 0.0; | |
| 3704 | |||
| 3705 |
1/1✓ Branch 1 taken 25 times.
|
25 | std::string ventSpecMthdSim = "Maximum"; |
| 3706 | |||
| 3707 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node ventPerPersonSimElement = thermalZoneElement.child("VentPerPersonSim"); |
| 3708 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> _ventPerPersonSim = lexicalCastToDouble(ventPerPersonSimElement); |
| 3709 |
1/2✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
|
25 | if (_ventPerPersonSim) { |
| 3710 | // cfm / person -> m^3/s / person | ||
| 3711 |
5/5✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
✓ Branch 7 taken 25 times.
✓ Branch 10 taken 25 times.
✓ Branch 13 taken 25 times.
|
100 | ventPerPersonSim = unitToUnit(_ventPerPersonSim.get(), "cfm", "m^3/s").get(); |
| 3712 | } | ||
| 3713 | |||
| 3714 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node ventPerAreaSimElement = thermalZoneElement.child("VentPerAreaSim"); |
| 3715 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> _ventPerAreaSim = lexicalCastToDouble(ventPerAreaSimElement); |
| 3716 |
1/2✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
|
25 | if (_ventPerAreaSim) { |
| 3717 | // cfm / ft^2 -> m^3/s / m^2 | ||
| 3718 |
1/1✓ Branch 1 taken 25 times.
|
25 | ventPerAreaSim = _ventPerAreaSim.get() * 0.00508; |
| 3719 | } | ||
| 3720 | |||
| 3721 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node ventSpecMthdSimElement = thermalZoneElement.child("VentSpecMthdSim"); |
| 3722 |
6/7✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
✓ Branch 7 taken 25 times.
✓ Branch 10 taken 25 times.
✓ Branch 13 taken 25 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 25 times.
|
75 | if (istringEqual(ventSpecMthdSimElement.text().as_string(), "Sum")) { |
| 3723 | ✗ | ventSpecMthdSim = "Sum"; | |
| 3724 | } | ||
| 3725 | |||
| 3726 |
1/1✓ Branch 1 taken 25 times.
|
25 | openstudio::model::DesignSpecificationOutdoorAir designSpecificationOutdoorAir(model); |
| 3727 |
2/2✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
|
25 | designSpecificationOutdoorAir.setName(name + " Design Specification Outdoor Air"); |
| 3728 |
1/1✓ Branch 1 taken 25 times.
|
25 | designSpecificationOutdoorAir.setOutdoorAirFlowperPerson(ventPerPersonSim); |
| 3729 |
1/1✓ Branch 1 taken 25 times.
|
25 | designSpecificationOutdoorAir.setOutdoorAirFlowperFloorArea(ventPerAreaSim); |
| 3730 |
1/1✓ Branch 1 taken 25 times.
|
25 | designSpecificationOutdoorAir.setOutdoorAirMethod(ventSpecMthdSim); |
| 3731 | |||
| 3732 |
1/1✓ Branch 1 taken 25 times.
|
25 | std::vector<model::Space> spaces = thermalZone.spaces(); |
| 3733 | |||
| 3734 |
2/2✓ Branch 5 taken 25 times.
✓ Branch 6 taken 25 times.
|
50 | for (auto& space : spaces) { |
| 3735 |
1/1✓ Branch 1 taken 25 times.
|
25 | space.setDesignSpecificationOutdoorAir(designSpecificationOutdoorAir); |
| 3736 | } | ||
| 3737 | |||
| 3738 | // Exhaust Fan(s) | ||
| 3739 | |||
| 3740 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node exhFlowRtSimElement = thermalZoneElement.child("ExhFlowSim"); |
| 3741 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node exhFanNameElement = thermalZoneElement.child("ExhFanName"); |
| 3742 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node exhFanEndUseCatElement = thermalZoneElement.child("ExhFanEndUseCat"); |
| 3743 | |||
| 3744 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> _exhFlowRtSim = lexicalCastToDouble(exhFlowRtSimElement); |
| 3745 |
2/7✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 25 times.
|
25 | if (_exhFlowRtSim && exhFanNameElement) { |
| 3746 | ✗ | model::FanZoneExhaust exhaustFan(model); | |
| 3747 | ✗ | exhaustFan.setName(exhFanNameElement.text().as_string()); | |
| 3748 | |||
| 3749 | ✗ | std::string exhFanEndUseCat = exhFanEndUseCatElement.text().as_string(); | |
| 3750 | ✗ | if (!exhFanEndUseCat.empty()) { | |
| 3751 | ✗ | exhaustFan.setEndUseSubcategory(exhFanEndUseCat); | |
| 3752 | } | ||
| 3753 | |||
| 3754 | ✗ | double value = unitToUnit(_exhFlowRtSim.get(), "cfm", "m^3/s").get(); | |
| 3755 | ✗ | exhaustFan.setMaximumFlowRate(value); | |
| 3756 | |||
| 3757 | ✗ | pugi::xml_node exhAvailSchRefElement = thermalZoneElement.child("ExhAvailSchRef"); | |
| 3758 | ✗ | std::string exhAvailSchRef = escapeName(exhAvailSchRefElement.text().as_string()); | |
| 3759 | ✗ | boost::optional<model::Schedule> exhAvailSch = model.getModelObjectByName<model::Schedule>(exhAvailSchRef); | |
| 3760 | ✗ | if (exhAvailSch) { | |
| 3761 | ✗ | exhaustFan.setAvailabilitySchedule(exhAvailSch.get()); | |
| 3762 | } | ||
| 3763 | |||
| 3764 | ✗ | pugi::xml_node exhTotEffElement = thermalZoneElement.child("ExhTotEff"); | |
| 3765 | ✗ | boost::optional<double> _exhTotEff = lexicalCastToDouble(exhTotEffElement); | |
| 3766 | ✗ | if (_exhTotEff) { | |
| 3767 | ✗ | exhaustFan.setFanEfficiency(_exhTotEff.get()); | |
| 3768 | } | ||
| 3769 | |||
| 3770 | ✗ | pugi::xml_node exhTotStaticPressElement = thermalZoneElement.child("ExhTotStaticPress"); | |
| 3771 | ✗ | boost::optional<double> _exhTotStaticPress = lexicalCastToDouble(exhTotStaticPressElement); | |
| 3772 | ✗ | if (_exhTotStaticPress) { | |
| 3773 | // Convert in WC to Pa | ||
| 3774 | ✗ | exhaustFan.setPressureRise(_exhTotStaticPress.get() * 249.0889); | |
| 3775 | } | ||
| 3776 | |||
| 3777 | ✗ | pugi::xml_node exhFlowSchRefElement = thermalZoneElement.child("ExhFlowSchRef"); | |
| 3778 | ✗ | std::string exhFlowSchRef = escapeName(exhFlowSchRefElement.text().as_string()); | |
| 3779 | ✗ | boost::optional<model::Schedule> exhFlowSch = model.getModelObjectByName<model::Schedule>(exhFlowSchRef); | |
| 3780 | ✗ | if (exhFlowSch) { | |
| 3781 | ✗ | exhaustFan.setFlowFractionSchedule(exhFlowSch.get()); | |
| 3782 | } | ||
| 3783 | |||
| 3784 | ✗ | pugi::xml_node exhOperModeElement = thermalZoneElement.child("ExhOperMode"); | |
| 3785 | ✗ | if (openstudio::istringEqual(exhOperModeElement.text().as_string(), "DecoupledFromSystem")) { | |
| 3786 | ✗ | exhaustFan.setSystemAvailabilityManagerCouplingMode("Decoupled"); | |
| 3787 | ✗ | } else if (openstudio::istringEqual(exhOperModeElement.text().as_string(), "CoupledToSystem")) { | |
| 3788 | ✗ | exhaustFan.setSystemAvailabilityManagerCouplingMode("Coupled"); | |
| 3789 | } | ||
| 3790 | |||
| 3791 | ✗ | pugi::xml_node exhMinTempSchRefElement = thermalZoneElement.child("ExhMinTempSchRef"); | |
| 3792 | ✗ | std::string exhMinTempSchRef = escapeName(exhMinTempSchRefElement.text().as_string()); | |
| 3793 | ✗ | boost::optional<model::Schedule> exhMinTempSch = model.getModelObjectByName<model::Schedule>(exhMinTempSchRef); | |
| 3794 | ✗ | if (exhMinTempSch) { | |
| 3795 | ✗ | exhaustFan.setMinimumZoneTemperatureLimitSchedule(exhMinTempSch.get()); | |
| 3796 | } | ||
| 3797 | |||
| 3798 | ✗ | pugi::xml_node exhBalancedSchRefElement = thermalZoneElement.child("ExhBalancedSchRef"); | |
| 3799 | ✗ | std::string exhBalancedSchRef = escapeName(exhBalancedSchRefElement.text().as_string()); | |
| 3800 | ✗ | boost::optional<model::Schedule> exhBalancedSch = model.getModelObjectByName<model::Schedule>(exhBalancedSchRef); | |
| 3801 | ✗ | if (exhBalancedSch) { | |
| 3802 | ✗ | exhaustFan.setBalancedExhaustFractionSchedule(exhBalancedSch.get()); | |
| 3803 | } | ||
| 3804 | |||
| 3805 | ✗ | exhaustFan.addToThermalZone(thermalZone); | |
| 3806 | ✗ | } | |
| 3807 | |||
| 3808 | // Daylighting | ||
| 3809 |
1/1✓ Branch 1 taken 25 times.
|
25 | std::vector<pugi::xml_node> daylighting1CoordElements = makeVectorOfChildren(thermalZoneElement, "DayltgIllumRefPt1Coord"); |
| 3810 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node daylighting1SetpointElement = thermalZoneElement.child("DayltgIllumSetpt1"); |
| 3811 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node daylighting1FractionElement = thermalZoneElement.child("DayltgCtrlLtgFrac1"); |
| 3812 | |||
| 3813 |
1/1✓ Branch 1 taken 25 times.
|
25 | std::vector<pugi::xml_node> daylighting2CoordElements = makeVectorOfChildren(thermalZoneElement, "DayltgIllumRefPt2Coord"); |
| 3814 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node daylighting2SetpointElement = thermalZoneElement.child("DayltgIllumSetpt2"); |
| 3815 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node daylighting2FractionElement = thermalZoneElement.child("DayltgCtrlLtgFrac2"); |
| 3816 | |||
| 3817 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node daylightingMinLightingElement = thermalZoneElement.child("DayltgMinDimLtgFrac"); |
| 3818 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node daylightingMinPowerElement = thermalZoneElement.child("DayltgMinDimPwrFrac"); |
| 3819 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node daylightingGlareAzimuthElement = thermalZoneElement.child("DayltgGlrAz"); |
| 3820 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node daylightingMaxGlareElement = thermalZoneElement.child("DayltgMaxGlrIdx"); |
| 3821 | |||
| 3822 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node daylightingControlTypeElement = thermalZoneElement.child("DayltgCtrlType"); |
| 3823 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node daylightingNumberOfControlStepsElement = thermalZoneElement.child("DayltgNumOfCtrlSteps"); |
| 3824 | |||
| 3825 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> daylightingMinLighting = lexicalCastToDouble(daylightingMinLightingElement); |
| 3826 | |||
| 3827 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> daylightingMinPower = lexicalCastToDouble(daylightingMinPowerElement); |
| 3828 | |||
| 3829 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> daylightingGlareAzimuth = lexicalCastToDouble(daylightingGlareAzimuthElement); |
| 3830 | |||
| 3831 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<double> daylightingMaxGlare = lexicalCastToDouble(daylightingMaxGlareElement); |
| 3832 | |||
| 3833 | 25 | boost::optional<std::string> daylightingControlType; | |
| 3834 |
3/3✓ Branch 1 taken 25 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 9 times.
|
25 | if (daylightingControlTypeElement) { |
| 3835 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | daylightingControlType = daylightingControlTypeElement.text().as_string(); |
| 3836 | } | ||
| 3837 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<int> daylightingNumberOfControlSteps = lexicalCastToInt(daylightingNumberOfControlStepsElement); |
| 3838 | |||
| 3839 | // first point | ||
| 3840 | 25 | boost::optional<model::DaylightingControl> daylightingControl1; | |
| 3841 |
8/10✓ Branch 1 taken 16 times.
✓ Branch 2 taken 9 times.
✓ Branch 4 taken 16 times.
✓ Branch 6 taken 16 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 16 times.
✓ Branch 11 taken 16 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 16 times.
✓ Branch 14 taken 9 times.
|
25 | if (daylighting1CoordElements.size() == 3 && daylighting1SetpointElement && daylighting1FractionElement) { |
| 3842 |
2/2✓ Branch 2 taken 16 times.
✓ Branch 5 taken 16 times.
|
16 | double x = footToMeter * daylighting1CoordElements[0].text().as_double(); |
| 3843 |
2/2✓ Branch 2 taken 16 times.
✓ Branch 5 taken 16 times.
|
16 | double y = footToMeter * daylighting1CoordElements[1].text().as_double(); |
| 3844 |
2/2✓ Branch 2 taken 16 times.
✓ Branch 5 taken 16 times.
|
16 | double z = footToMeter * daylighting1CoordElements[2].text().as_double(); |
| 3845 | |||
| 3846 | // DLM: units in SDD are in lux | ||
| 3847 | //double setpoint = footCandleToLux*daylighting1SetpointElement.text().as_double(); | ||
| 3848 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | double setpoint = daylighting1SetpointElement.text().as_double(); |
| 3849 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | double fraction = daylighting1FractionElement.text().as_double(); |
| 3850 | |||
| 3851 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | daylightingControl1 = model::DaylightingControl(model); |
| 3852 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | daylightingControl1->setPositionXCoordinate(x); |
| 3853 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | daylightingControl1->setPositionYCoordinate(y); |
| 3854 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | daylightingControl1->setPositionZCoordinate(z); |
| 3855 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | daylightingControl1->setIlluminanceSetpoint(setpoint); |
| 3856 | |||
| 3857 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (daylightingControlType) { |
| 3858 |
13/28✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 9 taken 16 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 16 times.
✓ Branch 15 taken 16 times.
✓ Branch 18 taken 16 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 16 times.
✓ Branch 22 taken 16 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 16 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 16 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 16 times.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✓ Branch 33 taken 16 times.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
|
80 | if (istringEqual(*daylightingControlType, "SteppedSwitching") || istringEqual(*daylightingControlType, "SteppedDimming")) { |
| 3859 | ✗ | if (!daylightingControl1->setLightingControlType("Stepped")) { | |
| 3860 | ✗ | LOG(Error, "Could not set daylighting control type to 'Stepped'"); | |
| 3861 | } | ||
| 3862 | ✗ | if (daylightingNumberOfControlSteps) { | |
| 3863 | ✗ | daylightingControl1->setNumberofSteppedControlSteps(*daylightingNumberOfControlSteps); | |
| 3864 | } | ||
| 3865 |
4/5✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
✗ Branch 11 not taken.
|
32 | } else if (istringEqual(*daylightingControlType, "Continuous")) { |
| 3866 |
4/5✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 16 times.
|
48 | if (!daylightingControl1->setLightingControlType("Continuous")) { |
| 3867 | ✗ | LOG(Error, "Could not set daylighting control type to 'Continuous'"); | |
| 3868 | } | ||
| 3869 | ✗ | } else if (istringEqual(*daylightingControlType, "ContinuousPlusOff")) { | |
| 3870 | ✗ | if (!daylightingControl1->setLightingControlType("Continuous/Off")) { | |
| 3871 | ✗ | LOG(Error, "Could not set daylighting control type to 'Continuous/Off'"); | |
| 3872 | } | ||
| 3873 | } else { | ||
| 3874 | ✗ | LOG(Error, "Unknown DayltgCtrlType '" << *daylightingControlType << "'"); | |
| 3875 | } | ||
| 3876 | } | ||
| 3877 | |||
| 3878 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (daylightingMinLighting) { |
| 3879 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | daylightingControl1->setMinimumLightOutputFractionforContinuousDimmingControl(*daylightingMinLighting); |
| 3880 | } | ||
| 3881 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (daylightingMinPower) { |
| 3882 |
3/3✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
|
16 | daylightingControl1->setMinimumInputPowerFractionforContinuousDimmingControl(*daylightingMinPower); |
| 3883 | } | ||
| 3884 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if (daylightingGlareAzimuth) { |
| 3885 | ✗ | daylightingControl1->setPhiRotationAroundZAxis(degToRad(*daylightingGlareAzimuth)); | |
| 3886 | } | ||
| 3887 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if (daylightingMaxGlare) { |
| 3888 | ✗ | daylightingControl1->setMaximumAllowableDiscomfortGlareIndex(*daylightingMaxGlare); | |
| 3889 | } | ||
| 3890 | |||
| 3891 | 16 | BoundingBox pointBox; | |
| 3892 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | pointBox.addPoint(Point3d(x, y, z)); |
| 3893 |
1/2✓ Branch 5 taken 16 times.
✗ Branch 6 not taken.
|
16 | for (const model::Space& space : spaces) { |
| 3894 |
1/1✓ Branch 1 taken 16 times.
|
16 | BoundingBox boundingBox = space.boundingBox(); |
| 3895 |
2/3✓ Branch 1 taken 16 times.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
|
16 | if (boundingBox.intersects(pointBox)) { |
| 3896 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | daylightingControl1->setSpace(space); |
| 3897 | 16 | break; | |
| 3898 | } | ||
| 3899 | } | ||
| 3900 | |||
| 3901 |
3/4✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 16 times.
|
16 | if (!daylightingControl1->space()) { |
| 3902 | ✗ | LOG(Error, "Primary daylighting control specified for Thermal Zone '" << name << "' could not be associated with a space in that zone"); | |
| 3903 | ✗ | daylightingControl1->remove(); | |
| 3904 | ✗ | daylightingControl1.reset(); | |
| 3905 | } else { | ||
| 3906 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | thermalZone.setPrimaryDaylightingControl(*daylightingControl1); |
| 3907 |
1/1✓ Branch 1 taken 16 times.
|
16 | thermalZone.setFractionofZoneControlledbyPrimaryDaylightingControl(fraction); |
| 3908 | } | ||
| 3909 | } | ||
| 3910 | |||
| 3911 | // second point | ||
| 3912 | 25 | boost::optional<model::DaylightingControl> daylightingControl2; | |
| 3913 |
2/10✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 25 times.
|
25 | if (daylighting2CoordElements.size() == 3 && daylighting2SetpointElement && daylighting2FractionElement) { |
| 3914 | ✗ | if (!daylightingControl1) { | |
| 3915 | ✗ | LOG(Error, "Secondary daylighting control specified for Thermal Zone '" << name << "' but there is no primary daylighting control"); | |
| 3916 | } else { | ||
| 3917 | ✗ | double x = footToMeter * daylighting2CoordElements[0].text().as_double(); | |
| 3918 | ✗ | double y = footToMeter * daylighting2CoordElements[1].text().as_double(); | |
| 3919 | ✗ | double z = footToMeter * daylighting2CoordElements[2].text().as_double(); | |
| 3920 | |||
| 3921 | // DLM: units in SDD are in lux | ||
| 3922 | //double setpoint = footCandleToLux*daylighting2SetpointElement.text().as_double(); | ||
| 3923 | ✗ | double setpoint = daylighting2SetpointElement.text().as_double(); | |
| 3924 | ✗ | double fraction = daylighting2FractionElement.text().as_double(); | |
| 3925 | |||
| 3926 | ✗ | daylightingControl2 = model::DaylightingControl(model); | |
| 3927 | ✗ | daylightingControl2->setPositionXCoordinate(x); | |
| 3928 | ✗ | daylightingControl2->setPositionYCoordinate(y); | |
| 3929 | ✗ | daylightingControl2->setPositionZCoordinate(z); | |
| 3930 | ✗ | daylightingControl2->setIlluminanceSetpoint(setpoint); | |
| 3931 | |||
| 3932 | ✗ | if (daylightingControlType) { | |
| 3933 | ✗ | if (istringEqual(*daylightingControlType, "SteppedSwitching") || istringEqual(*daylightingControlType, "SteppedDimming")) { | |
| 3934 | ✗ | if (!daylightingControl2->setLightingControlType("Stepped")) { | |
| 3935 | ✗ | LOG(Error, "Could not set daylighting control type to 'Stepped'"); | |
| 3936 | } | ||
| 3937 | ✗ | if (daylightingNumberOfControlSteps) { | |
| 3938 | ✗ | daylightingControl2->setNumberofSteppedControlSteps(*daylightingNumberOfControlSteps); | |
| 3939 | } | ||
| 3940 | ✗ | } else if (istringEqual(*daylightingControlType, "Continuous")) { | |
| 3941 | ✗ | if (!daylightingControl2->setLightingControlType("Continuous")) { | |
| 3942 | ✗ | LOG(Error, "Could not set daylighting control type to 'Continuous'"); | |
| 3943 | } | ||
| 3944 | ✗ | } else if (istringEqual(*daylightingControlType, "ContinuousPlusOff")) { | |
| 3945 | ✗ | if (!daylightingControl2->setLightingControlType("Continuous/Off")) { | |
| 3946 | ✗ | LOG(Error, "Could not set daylighting control type to 'Continuous/Off'"); | |
| 3947 | } | ||
| 3948 | } else { | ||
| 3949 | ✗ | LOG(Error, "Unknown DayltgCtrlType '" << *daylightingControlType << "'"); | |
| 3950 | } | ||
| 3951 | } | ||
| 3952 | |||
| 3953 | ✗ | if (daylightingMinLighting) { | |
| 3954 | ✗ | daylightingControl2->setMinimumLightOutputFractionforContinuousDimmingControl(*daylightingMinLighting); | |
| 3955 | } | ||
| 3956 | ✗ | if (daylightingMinPower) { | |
| 3957 | ✗ | daylightingControl2->setMinimumInputPowerFractionforContinuousDimmingControl(*daylightingMinPower); | |
| 3958 | } | ||
| 3959 | ✗ | if (daylightingGlareAzimuth) { | |
| 3960 | ✗ | daylightingControl2->setPhiRotationAroundZAxis(degToRad(*daylightingGlareAzimuth)); | |
| 3961 | } | ||
| 3962 | ✗ | if (daylightingMaxGlare) { | |
| 3963 | ✗ | daylightingControl2->setMaximumAllowableDiscomfortGlareIndex(*daylightingMaxGlare); | |
| 3964 | } | ||
| 3965 | |||
| 3966 | ✗ | thermalZone.setSecondaryDaylightingControl(*daylightingControl2); | |
| 3967 | |||
| 3968 | ✗ | BoundingBox pointBox; | |
| 3969 | ✗ | pointBox.addPoint(Point3d(x, y, z)); | |
| 3970 | ✗ | for (const model::Space& space : spaces) { | |
| 3971 | ✗ | BoundingBox boundingBox = space.boundingBox(); | |
| 3972 | ✗ | if (boundingBox.intersects(pointBox)) { | |
| 3973 | ✗ | daylightingControl2->setSpace(space); | |
| 3974 | ✗ | break; | |
| 3975 | } | ||
| 3976 | } | ||
| 3977 | |||
| 3978 | ✗ | if (!daylightingControl2->space()) { | |
| 3979 | ✗ | LOG(Error, "Secondary daylighting control specified for Thermal Zone '" << name << "' could not be associated with a space in that zone"); | |
| 3980 | ✗ | daylightingControl2->remove(); | |
| 3981 | ✗ | daylightingControl2.reset(); | |
| 3982 | } else { | ||
| 3983 | ✗ | thermalZone.setSecondaryDaylightingControl(*daylightingControl2); | |
| 3984 | ✗ | thermalZone.setFractionofZoneControlledbySecondaryDaylightingControl(fraction); | |
| 3985 | } | ||
| 3986 | } | ||
| 3987 | } | ||
| 3988 | |||
| 3989 | // Mult | ||
| 3990 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node multElement = thermalZoneElement.child("Mult"); |
| 3991 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<int> _mult = lexicalCastToInt(multElement); |
| 3992 |
1/2✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
|
25 | if (_mult) { |
| 3993 |
2/2✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
|
25 | thermalZone.setMultiplier(_mult.get()); |
| 3994 | } | ||
| 3995 | |||
| 3996 | // Optional AirLoopHVAC | ||
| 3997 | 25 | boost::optional<model::AirLoopHVAC> airLoopHVAC; | |
| 3998 | |||
| 3999 | // Map of SysRefElement to SysElement. SysElement will be a zone sys or null | ||
| 4000 | struct SysInfo | ||
| 4001 | { | ||
| 4002 | pugi::xml_node SysRefElement; | ||
| 4003 | pugi::xml_node ZnSysElement; | ||
| 4004 | pugi::xml_node AirSysElement; | ||
| 4005 | int Index; | ||
| 4006 | boost::optional<model::ModelObject> ModelObject; | ||
| 4007 | //int Priority; | ||
| 4008 | }; | ||
| 4009 | |||
| 4010 | 25 | std::vector<SysInfo> priAirCondInfo; | |
| 4011 | 25 | std::vector<SysInfo> simSysInfo; | |
| 4012 | |||
| 4013 | { | ||
| 4014 |
1/1✓ Branch 1 taken 25 times.
|
25 | std::vector<pugi::xml_node> elements = makeVectorOfChildren(thermalZoneElement, "PriAirCondgSysRef"); |
| 4015 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 2 taken 25 times.
|
46 | for (std::vector<pugi::xml_node>::size_type i = 0; i < elements.size(); i++) { |
| 4016 | 21 | const auto& element = elements[i]; | |
| 4017 |
1/1✓ Branch 1 taken 21 times.
|
21 | SysInfo sysInfo; |
| 4018 | 21 | sysInfo.SysRefElement = element; | |
| 4019 |
1/1✓ Branch 1 taken 21 times.
|
21 | sysInfo.ZnSysElement = findZnSysElement(element); |
| 4020 |
1/1✓ Branch 1 taken 21 times.
|
21 | sysInfo.AirSysElement = findAirSysElement(element); |
| 4021 | // Check if the node has an attribute 'index' that can be converted to an int | ||
| 4022 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | boost::optional<int> _index = lexicalCastToInt(element.attribute("index")); |
| 4023 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if (_index) { |
| 4024 |
1/1✓ Branch 1 taken 21 times.
|
21 | sysInfo.Index = _index.get(); |
| 4025 | } | ||
| 4026 |
1/1✓ Branch 1 taken 21 times.
|
21 | priAirCondInfo.push_back(sysInfo); |
| 4027 | 21 | } | |
| 4028 | 25 | } | |
| 4029 | |||
| 4030 | { | ||
| 4031 |
1/1✓ Branch 1 taken 25 times.
|
25 | std::vector<pugi::xml_node> elements = makeVectorOfChildren(thermalZoneElement, "SimSysRef"); |
| 4032 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
|
25 | for (std::vector<pugi::xml_node>::size_type i = 0; i < elements.size(); i++) { |
| 4033 | ✗ | const auto& element = elements[i]; | |
| 4034 | ✗ | SysInfo sysInfo; | |
| 4035 | ✗ | sysInfo.SysRefElement = element; | |
| 4036 | ✗ | sysInfo.ZnSysElement = findZnSysElement(element); | |
| 4037 | ✗ | sysInfo.AirSysElement = findAirSysElement(element); | |
| 4038 | // Check if the node has an attribute 'index' that can be converted to an int | ||
| 4039 | ✗ | boost::optional<int> _index = lexicalCastToInt(element.attribute("index")); | |
| 4040 | ✗ | if (_index) { | |
| 4041 | ✗ | sysInfo.Index = _index.get(); | |
| 4042 | } | ||
| 4043 | ✗ | simSysInfo.push_back(sysInfo); | |
| 4044 | ✗ | } | |
| 4045 | 25 | } | |
| 4046 | |||
| 4047 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node ventSysRefElement = thermalZoneElement.child("VentSysRef"); |
| 4048 | 25 | boost::optional<model::ModelObject> ventSysEquip; | |
| 4049 | |||
| 4050 | // ThermalZoneVentilationSystem | ||
| 4051 | // Find out if ventSys is already a simsys or a priaircondgsys (=they have the same inner TEXT) | ||
| 4052 | 25 | bool translateVentSys = true; | |
| 4053 |
2/2✓ Branch 5 taken 21 times.
✓ Branch 6 taken 4 times.
|
25 | for (const auto& info : priAirCondInfo) { |
| 4054 |
8/9✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✓ Branch 13 taken 21 times.
✓ Branch 16 taken 21 times.
✓ Branch 19 taken 21 times.
✓ Branch 23 taken 21 times.
✗ Branch 24 not taken.
|
42 | if (openstudio::istringEqual(info.SysRefElement.text().as_string(), ventSysRefElement.text().as_string())) { |
| 4055 | 21 | translateVentSys = false; | |
| 4056 | 21 | break; | |
| 4057 | } | ||
| 4058 | } | ||
| 4059 | |||
| 4060 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 21 times.
|
25 | if (translateVentSys) { |
| 4061 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
|
4 | for (const auto& info : simSysInfo) { |
| 4062 | ✗ | if (openstudio::istringEqual(info.SysRefElement.text().as_string(), ventSysRefElement.text().as_string())) { | |
| 4063 | ✗ | translateVentSys = false; | |
| 4064 | ✗ | break; | |
| 4065 | } | ||
| 4066 | } | ||
| 4067 | } | ||
| 4068 | |||
| 4069 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 21 times.
|
25 | if (translateVentSys) { |
| 4070 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
4 | airLoopHVAC = model.getConcreteModelObjectByName<model::AirLoopHVAC>(ventSysRefElement.text().as_string()); |
| 4071 | |||
| 4072 |
3/11✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
8 | if (airLoopHVAC && !thermalZone.airLoopHVAC()) { |
| 4073 | ✗ | pugi::xml_node trmlUnitElement = findTrmlUnitElementForZone(nameElement); | |
| 4074 | ✗ | if (trmlUnitElement) { | |
| 4075 | ✗ | if (boost::optional<model::ModelObject> trmlUnit = translateTrmlUnit(trmlUnitElement, model)) { | |
| 4076 | ✗ | ventSysEquip = trmlUnit; | |
| 4077 | ✗ | airLoopHVAC->addBranchForZone(thermalZone, trmlUnit->cast<model::StraightComponent>()); | |
| 4078 | ✗ | pugi::xml_node inducedAirZnRefElement = trmlUnitElement.child("InducedAirZnRef"); | |
| 4079 | ✗ | if (boost::optional<model::ThermalZone> tz = | |
| 4080 | ✗ | model.getConcreteModelObjectByName<model::ThermalZone>(inducedAirZnRefElement.text().as_string())) { | |
| 4081 | ✗ | if (tz->isPlenum()) { | |
| 4082 | ✗ | if (boost::optional<model::AirTerminalSingleDuctSeriesPIUReheat> piu = | |
| 4083 | ✗ | trmlUnit->optionalCast<model::AirTerminalSingleDuctSeriesPIUReheat>()) { | |
| 4084 | ✗ | piu->getImpl<model::detail::AirTerminalSingleDuctSeriesPIUReheat_Impl>()->setInducedAirPlenumZone(tz.get()); | |
| 4085 | ✗ | } else if (boost::optional<model::AirTerminalSingleDuctParallelPIUReheat> piu = | |
| 4086 | ✗ | trmlUnit->optionalCast<model::AirTerminalSingleDuctParallelPIUReheat>()) { | |
| 4087 | ✗ | piu->getImpl<model::detail::AirTerminalSingleDuctParallelPIUReheat_Impl>()->setInducedAirPlenumZone(tz.get()); | |
| 4088 | ✗ | } | |
| 4089 | } | ||
| 4090 | ✗ | } | |
| 4091 | ✗ | } | |
| 4092 | } | ||
| 4093 | } | ||
| 4094 | |||
| 4095 | // If the model has requested ventilation from the system, | ||
| 4096 | // make sure the system has an OA system even if it wasn't asked for. | ||
| 4097 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if (airLoopHVAC) { |
| 4098 | ✗ | boost::optional<model::AirLoopHVACOutdoorAirSystem> oaSystem = airLoopHVAC->airLoopHVACOutdoorAirSystem(); | |
| 4099 | ✗ | if (!oaSystem) { | |
| 4100 | ✗ | model::ControllerOutdoorAir oaController(model); | |
| 4101 | |||
| 4102 | ✗ | oaController.setName(airLoopHVAC->name().get() + " OA Controller"); | |
| 4103 | |||
| 4104 | ✗ | model::AirLoopHVACOutdoorAirSystem newOASystem(model, oaController); | |
| 4105 | |||
| 4106 | ✗ | newOASystem.setName(airLoopHVAC->name().get() + " OA System"); | |
| 4107 | |||
| 4108 | ✗ | model::Node supplyInletNode = airLoopHVAC->supplyInletNode(); | |
| 4109 | |||
| 4110 | ✗ | newOASystem.addToNode(supplyInletNode); | |
| 4111 | ✗ | } | |
| 4112 | ✗ | } | |
| 4113 | } | ||
| 4114 | |||
| 4115 | 21 | auto translateSystemForZone = [&](SysInfo& sysInfo) { | |
| 4116 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
|
21 | if (sysInfo.ZnSysElement) { |
| 4117 | ✗ | boost::optional<model::ModelObject> mo = translateZnSys(sysInfo.ZnSysElement, model); | |
| 4118 | ✗ | sysInfo.ModelObject = mo; | |
| 4119 | |||
| 4120 | ✗ | if (mo) { | |
| 4121 | ✗ | boost::optional<model::ZoneHVACComponent> zoneHVACComponent = mo->optionalCast<model::ZoneHVACComponent>(); | |
| 4122 | |||
| 4123 | ✗ | if (zoneHVACComponent) { | |
| 4124 | ✗ | zoneHVACComponent->addToThermalZone(thermalZone); | |
| 4125 | |||
| 4126 | // If not the ventilation system we lock down the oa system of the zone equipment | ||
| 4127 | ✗ | if (!openstudio::istringEqual(sysInfo.SysRefElement.text().as_string(), ventSysRefElement.text().as_string())) { | |
| 4128 | ✗ | if (boost::optional<model::ZoneHVACPackagedTerminalAirConditioner> ptac = | |
| 4129 | ✗ | zoneHVACComponent->optionalCast<model::ZoneHVACPackagedTerminalAirConditioner>()) { | |
| 4130 | ✗ | ptac->setOutdoorAirFlowRateDuringHeatingOperation(0.0); | |
| 4131 | ✗ | ptac->setOutdoorAirFlowRateDuringCoolingOperation(0.0); | |
| 4132 | ✗ | ptac->setOutdoorAirFlowRateWhenNoCoolingorHeatingisNeeded(0.0); | |
| 4133 | ✗ | } else if (boost::optional<model::ZoneHVACPackagedTerminalHeatPump> pthp = | |
| 4134 | ✗ | zoneHVACComponent->optionalCast<model::ZoneHVACPackagedTerminalHeatPump>()) { | |
| 4135 | ✗ | pthp->setOutdoorAirFlowRateDuringHeatingOperation(0.0); | |
| 4136 | ✗ | pthp->setOutdoorAirFlowRateDuringCoolingOperation(0.0); | |
| 4137 | ✗ | pthp->setOutdoorAirFlowRateWhenNoCoolingorHeatingisNeeded(0.0); | |
| 4138 | ✗ | } else if (boost::optional<model::ZoneHVACFourPipeFanCoil> fanCoil = | |
| 4139 | ✗ | zoneHVACComponent->optionalCast<model::ZoneHVACFourPipeFanCoil>()) { | |
| 4140 | ✗ | fanCoil->setMaximumOutdoorAirFlowRate(0.0); | |
| 4141 | ✗ | } | |
| 4142 | } | ||
| 4143 | } | ||
| 4144 | ✗ | } | |
| 4145 | ✗ | } else { | |
| 4146 |
4/4✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
|
42 | airLoopHVAC = model.getConcreteModelObjectByName<model::AirLoopHVAC>(sysInfo.SysRefElement.text().as_string()); |
| 4147 | |||
| 4148 |
5/11✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 21 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 21 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
42 | if (airLoopHVAC && !thermalZone.airLoopHVAC()) { |
| 4149 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node trmlUnitElement = findTrmlUnitElementForZone(nameElement); |
| 4150 |
2/3✓ Branch 1 taken 21 times.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
|
21 | if (trmlUnitElement) { |
| 4151 |
2/3✓ Branch 1 taken 21 times.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
|
42 | if (boost::optional<model::ModelObject> trmlUnit = translateTrmlUnit(trmlUnitElement, model)) { |
| 4152 |
1/1✓ Branch 1 taken 21 times.
|
21 | sysInfo.ModelObject = trmlUnit; |
| 4153 |
5/5✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✓ Branch 13 taken 21 times.
|
21 | airLoopHVAC->addBranchForZone(thermalZone, trmlUnit->cast<model::StraightComponent>()); |
| 4154 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node inducedAirZnRefElement = trmlUnitElement.child("InducedAirZnRef"); |
| 4155 | 21 | if (boost::optional<model::ThermalZone> tz = | |
| 4156 |
5/6✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 21 times.
|
63 | model.getConcreteModelObjectByName<model::ThermalZone>(inducedAirZnRefElement.text().as_string())) { |
| 4157 | ✗ | if (tz->isPlenum()) { | |
| 4158 | ✗ | if (boost::optional<model::AirTerminalSingleDuctSeriesPIUReheat> piu = | |
| 4159 | ✗ | trmlUnit->optionalCast<model::AirTerminalSingleDuctSeriesPIUReheat>()) { | |
| 4160 | ✗ | piu->getImpl<model::detail::AirTerminalSingleDuctSeriesPIUReheat_Impl>()->setInducedAirPlenumZone(tz.get()); | |
| 4161 | ✗ | } else if (boost::optional<model::AirTerminalSingleDuctParallelPIUReheat> piu = | |
| 4162 | ✗ | trmlUnit->optionalCast<model::AirTerminalSingleDuctParallelPIUReheat>()) { | |
| 4163 | ✗ | piu->getImpl<model::detail::AirTerminalSingleDuctParallelPIUReheat_Impl>()->setInducedAirPlenumZone(tz.get()); | |
| 4164 | ✗ | } | |
| 4165 | } | ||
| 4166 | 21 | } | |
| 4167 | 21 | } | |
| 4168 | } | ||
| 4169 | } | ||
| 4170 | } | ||
| 4171 | 21 | }; | |
| 4172 | |||
| 4173 |
2/2✓ Branch 5 taken 21 times.
✓ Branch 6 taken 25 times.
|
46 | for (auto& sysInfo : priAirCondInfo) { |
| 4174 |
1/1✓ Branch 1 taken 21 times.
|
21 | translateSystemForZone(sysInfo); |
| 4175 | } | ||
| 4176 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 25 times.
|
25 | for (auto& sysInfo : simSysInfo) { |
| 4177 | ✗ | translateSystemForZone(sysInfo); | |
| 4178 | } | ||
| 4179 | |||
| 4180 | // Set priority | ||
| 4181 | 21 | auto setPriority = [&thermalZone, &thermalZoneElement](const SysInfo& sysInfo, const std::string& priorityElement) { | |
| 4182 |
1/2✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
|
42 | if (sysInfo.ModelObject) { |
| 4183 | // Clg and Htg | ||
| 4184 |
4/6✓ Branch 2 taken 21 times.
✓ Branch 7 taken 21 times.
✗ Branch 10 not taken.
✓ Branch 13 taken 21 times.
✓ Branch 15 taken 21 times.
✗ Branch 16 not taken.
|
21 | for (const pugi::xml_node& element : thermalZoneElement.children(priorityElement.c_str())) { |
| 4185 | // Check if the node has an attribute 'index' that is an int *and* matches our sysInfo.index | ||
| 4186 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | boost::optional<int> _index = lexicalCastToInt(element.attribute("index")); |
| 4187 |
4/7✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 21 times.
✓ Branch 5 taken 21 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 21 times.
✗ Branch 8 not taken.
|
21 | if (_index && _index.get() == sysInfo.Index) { |
| 4188 | // Now we check if it has a priority in its text() | ||
| 4189 |
1/1✓ Branch 1 taken 21 times.
|
21 | boost::optional<int> _priority = lexicalCastToInt(element); |
| 4190 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if (_priority) { |
| 4191 |
3/3✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
|
21 | thermalZone.setCoolingPriority(sysInfo.ModelObject.get(), _priority.get()); |
| 4192 |
3/3✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
|
21 | thermalZone.setHeatingPriority(sysInfo.ModelObject.get(), _priority.get()); |
| 4193 | } | ||
| 4194 | 21 | break; | |
| 4195 | } | ||
| 4196 | } | ||
| 4197 | // Clg | ||
| 4198 |
4/7✓ Branch 1 taken 21 times.
✓ Branch 5 taken 21 times.
✗ Branch 11 not taken.
✗ Branch 14 not taken.
✓ Branch 17 taken 21 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 21 times.
|
21 | for (const pugi::xml_node& element : thermalZoneElement.children((priorityElement + "Clg").c_str())) { |
| 4199 | // Check if the node has an attribute 'index' that is an int *and* matches our sysInfo.index | ||
| 4200 | ✗ | boost::optional<int> _index = lexicalCastToInt(element.attribute("index")); | |
| 4201 | ✗ | if (_index && _index.get() == sysInfo.Index) { | |
| 4202 | // Now we check if it has a priority in its text() | ||
| 4203 | ✗ | boost::optional<int> _priority = lexicalCastToInt(element); | |
| 4204 | ✗ | if (_priority) { | |
| 4205 | ✗ | thermalZone.setCoolingPriority(sysInfo.ModelObject.get(), _priority.get()); | |
| 4206 | } | ||
| 4207 | ✗ | break; | |
| 4208 | } | ||
| 4209 | } | ||
| 4210 | // Htg | ||
| 4211 |
4/7✓ Branch 1 taken 21 times.
✓ Branch 5 taken 21 times.
✗ Branch 11 not taken.
✗ Branch 14 not taken.
✓ Branch 17 taken 21 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 21 times.
|
21 | for (const pugi::xml_node& element : thermalZoneElement.children((priorityElement + "Htg").c_str())) { |
| 4212 | // Check if the node has an attribute 'index' that is an int *and* matches our sysInfo.index | ||
| 4213 | ✗ | boost::optional<int> _index = lexicalCastToInt(element.attribute("index")); | |
| 4214 | ✗ | if (_index && _index.get() == sysInfo.Index) { | |
| 4215 | // Now we check if it has a priority in its text() | ||
| 4216 | ✗ | boost::optional<int> _priority = lexicalCastToInt(element); | |
| 4217 | ✗ | if (_priority) { | |
| 4218 | ✗ | thermalZone.setHeatingPriority(sysInfo.ModelObject.get(), _priority.get()); | |
| 4219 | } | ||
| 4220 | ✗ | break; | |
| 4221 | } | ||
| 4222 | } | ||
| 4223 | } | ||
| 4224 | 21 | }; | |
| 4225 | |||
| 4226 |
2/2✓ Branch 4 taken 21 times.
✓ Branch 5 taken 25 times.
|
46 | for (const SysInfo& sysInfo : priAirCondInfo) { |
| 4227 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
42 | setPriority(sysInfo, "PriAirCondgSysPriority"); |
| 4228 | } | ||
| 4229 |
1/2✗ Branch 4 not taken.
✓ Branch 5 taken 25 times.
|
25 | for (const SysInfo& sysInfo : simSysInfo) { |
| 4230 | ✗ | setPriority(sysInfo, "SimSysPriority"); | |
| 4231 | } | ||
| 4232 | |||
| 4233 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
|
25 | if (ventSysEquip) { |
| 4234 | ✗ | pugi::xml_node ventSysPriorityElement = thermalZoneElement.child("VentSysPriority"); | |
| 4235 | ✗ | boost::optional<int> _ventSysPriority = lexicalCastToInt(ventSysPriorityElement); | |
| 4236 | ✗ | if (_ventSysPriority) { | |
| 4237 | ✗ | int value = _ventSysPriority.get(); | |
| 4238 | ✗ | thermalZone.setCoolingPriority(ventSysEquip.get(), value); | |
| 4239 | ✗ | thermalZone.setHeatingPriority(ventSysEquip.get(), value); | |
| 4240 | } | ||
| 4241 | |||
| 4242 | ✗ | pugi::xml_node ventSysPriorityClgElement = thermalZoneElement.child("VentSysPriorityClg"); | |
| 4243 | ✗ | boost::optional<int> _ventSysPriorityClg = lexicalCastToInt(ventSysPriorityClgElement); | |
| 4244 | ✗ | if (_ventSysPriorityClg) { | |
| 4245 | ✗ | thermalZone.setCoolingPriority(ventSysEquip.get(), _ventSysPriorityClg.get()); | |
| 4246 | } | ||
| 4247 | |||
| 4248 | ✗ | pugi::xml_node ventSysPriorityHtgElement = thermalZoneElement.child("VentSysPriorityHtg"); | |
| 4249 | ✗ | boost::optional<int> _ventSysPriorityHtg = lexicalCastToInt(ventSysPriorityHtgElement); | |
| 4250 | ✗ | if (_ventSysPriorityHtg) { | |
| 4251 | ✗ | thermalZone.setHeatingPriority(ventSysEquip.get(), _ventSysPriorityHtg.get()); | |
| 4252 | } | ||
| 4253 | } | ||
| 4254 | |||
| 4255 | // Set zone for optimum start, if applicable | ||
| 4256 | { | ||
| 4257 |
3/3✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
✓ Branch 7 taken 25 times.
|
25 | auto optimumStart = m_optimumStartControlZones.find(thermalZone.name().get()); |
| 4258 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 25 times.
|
25 | if (optimumStart != m_optimumStartControlZones.end()) { |
| 4259 | ✗ | optimumStart->second.setControlZone(thermalZone); | |
| 4260 | } | ||
| 4261 | } | ||
| 4262 | |||
| 4263 | // Set zone for night cycle, if applicable | ||
| 4264 | { | ||
| 4265 |
3/3✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
✓ Branch 7 taken 25 times.
|
25 | auto nightCycle = m_nightCycleControlZones.find(thermalZone.name().get()); |
| 4266 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 25 times.
|
25 | if (nightCycle != m_nightCycleControlZones.end()) { |
| 4267 | ✗ | std::vector<model::ThermalZone> thermalZones = {thermalZone}; | |
| 4268 | ✗ | nightCycle->second.setControlThermalZones(thermalZones); | |
| 4269 | ✗ | } | |
| 4270 | } | ||
| 4271 | |||
| 4272 | // Set the master control zone for vrf system, if applicable | ||
| 4273 | { | ||
| 4274 |
3/3✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
✓ Branch 7 taken 25 times.
|
25 | auto vrfSystem = m_vrfSystemControlZones.find(thermalZone.name().get()); |
| 4275 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 25 times.
|
25 | if (vrfSystem != m_vrfSystemControlZones.end()) { |
| 4276 | ✗ | vrfSystem->second.setZoneforMasterThermostatLocation(thermalZone); | |
| 4277 | } | ||
| 4278 | } | ||
| 4279 | |||
| 4280 | // DCV? | ||
| 4281 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node ventCtrlMthdElement = thermalZoneElement.child("VentCtrlMthd"); |
| 4282 |
8/20✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
✓ Branch 7 taken 25 times.
✓ Branch 10 taken 25 times.
✓ Branch 13 taken 25 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 25 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 25 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 25 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
|
125 | if (istringEqual(ventCtrlMthdElement.text().as_string(), "OccupantSensors") |
| 4283 |
13/28✓ Branch 1 taken 25 times.
✓ Branch 3 taken 25 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 25 times.
✓ Branch 9 taken 25 times.
✓ Branch 12 taken 25 times.
✓ Branch 15 taken 25 times.
✓ Branch 18 taken 25 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 25 times.
✓ Branch 22 taken 25 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 25 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 25 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 25 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 25 times.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
|
175 | || istringEqual(ventCtrlMthdElement.text().as_string(), "CO2Sensors")) { |
| 4284 | ✗ | if (airLoopHVAC) { | |
| 4285 | ✗ | if (boost::optional<model::AirLoopHVACOutdoorAirSystem> oaSystem = airLoopHVAC->airLoopHVACOutdoorAirSystem()) { | |
| 4286 | ✗ | oaSystem->getControllerOutdoorAir().controllerMechanicalVentilation().setDemandControlledVentilation(true); | |
| 4287 | ✗ | } | |
| 4288 | } | ||
| 4289 | } | ||
| 4290 | |||
| 4291 | // ClgTstatSchRef | ||
| 4292 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node clgTstatSchRefElement = thermalZoneElement.child("ClgTstatSchRef"); |
| 4293 |
3/3✓ Branch 1 taken 25 times.
✓ Branch 3 taken 21 times.
✓ Branch 4 taken 4 times.
|
25 | if (clgTstatSchRefElement) { |
| 4294 |
4/4✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
|
21 | std::string scheduleName = escapeName(clgTstatSchRefElement.text().as_string()); |
| 4295 |
1/1✓ Branch 1 taken 21 times.
|
21 | boost::optional<model::Schedule> schedule = model.getModelObjectByName<model::Schedule>(scheduleName); |
| 4296 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if (schedule) { |
| 4297 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if (optionalThermostat) { |
| 4298 |
3/3✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
|
21 | optionalThermostat->setCoolingSchedule(*schedule); |
| 4299 | } else { | ||
| 4300 | ✗ | LOG(Error, "Cannot assign cooling schedule to unconditioned thermal zone '" << name << "'"); | |
| 4301 | } | ||
| 4302 | } else { | ||
| 4303 | ✗ | LOG(Error, "Schedule named " << scheduleName << " cannot be found."); | |
| 4304 | } | ||
| 4305 | 21 | } else { | |
| 4306 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if (optionalThermostat) { |
| 4307 | ✗ | model::ScheduleRuleset scheduleRuleset = model::ScheduleRuleset(model); | |
| 4308 | |||
| 4309 | ✗ | scheduleRuleset.setName(thermalZone.name().get() + " Default Cooling Schedule"); | |
| 4310 | |||
| 4311 | ✗ | model::ScheduleDay scheduleDay = scheduleRuleset.defaultDaySchedule(); | |
| 4312 | |||
| 4313 | ✗ | scheduleDay.addValue(Time(1.0), 90.0); | |
| 4314 | |||
| 4315 | ✗ | optionalThermostat->setCoolingSchedule(scheduleRuleset); | |
| 4316 | ✗ | } | |
| 4317 | } | ||
| 4318 | |||
| 4319 | // HtgTstatSchRef | ||
| 4320 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node htgTstatSchRefElement = thermalZoneElement.child("HtgTstatSchRef"); |
| 4321 |
3/3✓ Branch 1 taken 25 times.
✓ Branch 3 taken 21 times.
✓ Branch 4 taken 4 times.
|
25 | if (htgTstatSchRefElement) { |
| 4322 |
4/4✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
|
21 | std::string scheduleName = escapeName(htgTstatSchRefElement.text().as_string()); |
| 4323 |
1/1✓ Branch 1 taken 21 times.
|
21 | boost::optional<model::Schedule> schedule = model.getModelObjectByName<model::Schedule>(scheduleName); |
| 4324 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if (schedule) { |
| 4325 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if (optionalThermostat) { |
| 4326 |
3/3✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
|
21 | optionalThermostat->setHeatingSchedule(*schedule); |
| 4327 | } else { | ||
| 4328 | ✗ | LOG(Error, "Cannot assign heating schedule to unconditioned thermal zone '" << name << "'"); | |
| 4329 | } | ||
| 4330 | } else { | ||
| 4331 | ✗ | LOG(Error, "Schedule named " << scheduleName << " cannot be found."); | |
| 4332 | } | ||
| 4333 | 21 | } else { | |
| 4334 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if (optionalThermostat) { |
| 4335 | ✗ | model::ScheduleRuleset scheduleRuleset = model::ScheduleRuleset(model); | |
| 4336 | |||
| 4337 | ✗ | scheduleRuleset.setName(thermalZone.name().get() + " Default Heating Schedule"); | |
| 4338 | |||
| 4339 | ✗ | model::ScheduleDay scheduleDay = scheduleRuleset.defaultDaySchedule(); | |
| 4340 | |||
| 4341 | ✗ | scheduleDay.addValue(Time(1.0), -100.0); | |
| 4342 | |||
| 4343 | ✗ | optionalThermostat->setHeatingSchedule(scheduleRuleset); | |
| 4344 | ✗ | } | |
| 4345 | } | ||
| 4346 | |||
| 4347 |
1/1✓ Branch 1 taken 25 times.
|
25 | airLoopHVAC = thermalZone.airLoopHVAC(); |
| 4348 | |||
| 4349 | // Connect to plenum(s) if required | ||
| 4350 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 4 times.
|
25 | if (airLoopHVAC) { |
| 4351 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node rtnPlenumZnRefElement = thermalZoneElement.child("RetPlenumZnRef"); |
| 4352 | 21 | boost::optional<model::ThermalZone> returnPlenumZone; | |
| 4353 |
4/4✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
|
21 | returnPlenumZone = model.getConcreteModelObjectByName<model::ThermalZone>(rtnPlenumZnRefElement.text().as_string()); |
| 4354 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | if (returnPlenumZone) { |
| 4355 | ✗ | thermalZone.setReturnPlenum(returnPlenumZone.get()); | |
| 4356 | } | ||
| 4357 | |||
| 4358 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node supPlenumZnRefElement = thermalZoneElement.child("SupPlenumZnRef"); |
| 4359 | 21 | boost::optional<model::ThermalZone> supplyPlenumZone; | |
| 4360 |
4/4✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
|
21 | supplyPlenumZone = model.getConcreteModelObjectByName<model::ThermalZone>(supPlenumZnRefElement.text().as_string()); |
| 4361 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | if (supplyPlenumZone) { |
| 4362 | ✗ | thermalZone.setSupplyPlenum(supplyPlenumZone.get()); | |
| 4363 | } | ||
| 4364 | 21 | } | |
| 4365 | |||
| 4366 | // Connect setpoint manager single zone reheat if required | ||
| 4367 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 4 times.
|
25 | if (airLoopHVAC) { |
| 4368 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | model::Node supplyOutletNode = airLoopHVAC->supplyOutletNode(); |
| 4369 | 21 | boost::optional<model::SetpointManagerSingleZoneReheat> spm; | |
| 4370 | std::vector<model::SetpointManagerSingleZoneReheat> _setpointManagers = | ||
| 4371 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | subsetCastVector<model::SetpointManagerSingleZoneReheat>(supplyOutletNode.setpointManagers()); |
| 4372 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
|
21 | if (!_setpointManagers.empty()) { |
| 4373 | ✗ | spm = _setpointManagers.front(); | |
| 4374 | } | ||
| 4375 | |||
| 4376 | // Only set the control zone if there is a SetpointManagerSingleZoneReheat on the supply outlet node | ||
| 4377 |
5/5✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✓ Branch 13 taken 21 times.
|
21 | pugi::xml_node airSystemElement = findAirSysElement(airLoopHVAC->name().get(), getProjectElement(thermalZoneElement)); |
| 4378 |
2/7✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 21 times.
|
21 | if (spm && airSystemElement) { |
| 4379 | ✗ | pugi::xml_node ctrlZnRefElement = airSystemElement.child("CtrlZnRef"); | |
| 4380 | ✗ | if (istringEqual(ctrlZnRefElement.text().as_string(), thermalZone.name().get())) { | |
| 4381 | ✗ | spm->setControlZone(thermalZone); | |
| 4382 | } | ||
| 4383 | } | ||
| 4384 | 21 | } | |
| 4385 | |||
| 4386 | // OperableWinInterlock | ||
| 4387 |
1/1✓ Branch 1 taken 25 times.
|
25 | pugi::xml_node operableWinInterlockElement = thermalZoneElement.child("OperableWinInterlock"); |
| 4388 |
1/1✓ Branch 1 taken 25 times.
|
25 | boost::optional<int> _operableWinInterlock = lexicalCastToInt(operableWinInterlockElement); |
| 4389 |
2/7✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 25 times.
|
25 | if (_operableWinInterlock && (_operableWinInterlock.get() == 1)) { |
| 4390 | ✗ | model::ZoneVentilationDesignFlowRate zoneVent(model); | |
| 4391 | ✗ | zoneVent.setName(thermalZone.nameString() + " Operable Window Ventilation"); | |
| 4392 | ✗ | zoneVent.setFlowRateperZoneFloorArea(0.000762); | |
| 4393 | ✗ | zoneVent.setVentilationType("Intake"); | |
| 4394 | ✗ | zoneVent.setFanPressureRise(0.0); | |
| 4395 | ✗ | zoneVent.setFanTotalEfficiency(1.0); | |
| 4396 | ✗ | zoneVent.setConstantTermCoefficient(1.0); | |
| 4397 | ✗ | zoneVent.setTemperatureTermCoefficient(0.0); | |
| 4398 | ✗ | zoneVent.setVelocityTermCoefficient(0.0); | |
| 4399 | ✗ | zoneVent.setVelocitySquaredTermCoefficient(0.0); | |
| 4400 | ✗ | zoneVent.setMinimumOutdoorTemperature(10); | |
| 4401 | ✗ | zoneVent.setMaximumOutdoorTemperature(29.4); | |
| 4402 | ✗ | zoneVent.setMaximumWindSpeed(40); | |
| 4403 | ✗ | zoneVent.setMinimumIndoorTemperature(-100); | |
| 4404 | ✗ | zoneVent.setMaximumIndoorTemperature(100); | |
| 4405 | ✗ | zoneVent.setDeltaTemperature(-100); | |
| 4406 | |||
| 4407 | ✗ | pugi::xml_node operableWinOALimLoElement = thermalZoneElement.child("OperableWinOALimLo"); | |
| 4408 | ✗ | boost::optional<double> _operableWinOALimLo = lexicalCastToDouble(operableWinOALimLoElement); | |
| 4409 | ✗ | if (_operableWinOALimLo) { | |
| 4410 | ✗ | double operableWinOALimLo = unitToUnit(_operableWinOALimLo.get(), "F", "C").get(); | |
| 4411 | ✗ | zoneVent.setMinimumOutdoorTemperature(operableWinOALimLo); | |
| 4412 | } | ||
| 4413 | |||
| 4414 | ✗ | pugi::xml_node operableWinOALimHiElement = thermalZoneElement.child("OperableWinOALimHi"); | |
| 4415 | ✗ | boost::optional<double> _operableWinOALimHi = lexicalCastToDouble(operableWinOALimHiElement); | |
| 4416 | ✗ | if (_operableWinOALimHi) { | |
| 4417 | ✗ | double operableWinOALimHi = unitToUnit(_operableWinOALimHi.get(), "F", "C").get(); | |
| 4418 | ✗ | zoneVent.setMaximumOutdoorTemperature(operableWinOALimHi); | |
| 4419 | } | ||
| 4420 | |||
| 4421 | // priAirCondInfo zoneVent | ||
| 4422 | |||
| 4423 | ✗ | for (const auto& info : priAirCondInfo) { | |
| 4424 | ✗ | if (info.ZnSysElement) { | |
| 4425 | ✗ | auto availSchRefElement = info.ZnSysElement.child("AvailSchRef"); | |
| 4426 | ✗ | if (auto availSch = model.getModelObjectByName<model::Schedule>(availSchRefElement.text().as_string())) { | |
| 4427 | ✗ | zoneVent.setSchedule(availSch.get()); | |
| 4428 | ✗ | break; | |
| 4429 | ✗ | } | |
| 4430 | ✗ | } else if (info.AirSysElement) { | |
| 4431 | ✗ | auto availSchRefElement = info.AirSysElement.child("AvailSchRef"); | |
| 4432 | ✗ | auto availSch = model.getModelObjectByName<model::Schedule>(availSchRefElement.text().as_string()); | |
| 4433 | ✗ | if (auto availSch = model.getModelObjectByName<model::Schedule>(availSchRefElement.text().as_string())) { | |
| 4434 | ✗ | zoneVent.setSchedule(availSch.get()); | |
| 4435 | ✗ | break; | |
| 4436 | ✗ | } | |
| 4437 | ✗ | } | |
| 4438 | } | ||
| 4439 | |||
| 4440 | ✗ | zoneVent.addToThermalZone(thermalZone); | |
| 4441 | ✗ | } | |
| 4442 | |||
| 4443 | 25 | return result; | |
| 4444 | 25 | } | |
| 4445 | |||
| 4446 | 21 | boost::optional<model::ModelObject> ReverseTranslator::translateTrmlUnit(const pugi::xml_node& trmlUnitElement, openstudio::model::Model& model) { | |
| 4447 | 21 | boost::optional<openstudio::model::ModelObject> result; | |
| 4448 | |||
| 4449 |
5/6✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 21 times.
|
84 | if (!istringEqual(trmlUnitElement.name(), "TrmlUnit")) { |
| 4450 | ✗ | return result; | |
| 4451 | } | ||
| 4452 | |||
| 4453 | // Name | ||
| 4454 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node nameElement = trmlUnitElement.child("Name"); |
| 4455 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | const auto* name = nameElement.text().as_string(); |
| 4456 | |||
| 4457 | // AvailSchRef | ||
| 4458 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node availSchRefElement = trmlUnitElement.child("AvailSchRef"); |
| 4459 |
4/4✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
|
21 | boost::optional<model::Schedule> availSch = model.getModelObjectByName<model::Schedule>(availSchRefElement.text().as_string()); |
| 4460 | |||
| 4461 | // Type | ||
| 4462 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node typeElement = trmlUnitElement.child("TypeSim"); |
| 4463 | |||
| 4464 | // PriAirFlow | ||
| 4465 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node priAirFlowElement = trmlUnitElement.child("PriAirFlowMaxSim"); |
| 4466 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node priAirFlowMinElement = trmlUnitElement.child("PriAirFlowMinSim"); |
| 4467 | 21 | boost::optional<double> primaryAirFlow; | |
| 4468 | 21 | boost::optional<double> primaryAirFlowMin; | |
| 4469 | |||
| 4470 |
2/3✓ Branch 1 taken 21 times.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
|
21 | if (!autosize()) { |
| 4471 |
1/1✓ Branch 1 taken 21 times.
|
21 | boost::optional<double> _priAirFlow = lexicalCastToDouble(priAirFlowElement); |
| 4472 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if (_priAirFlow) { |
| 4473 |
6/6✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✓ Branch 13 taken 21 times.
✓ Branch 16 taken 21 times.
|
84 | primaryAirFlow = unitToUnit(_priAirFlow.get(), "cfm", "m^3/s").get(); |
| 4474 | } | ||
| 4475 | } | ||
| 4476 | |||
| 4477 |
1/1✓ Branch 1 taken 21 times.
|
21 | boost::optional<double> _priAirFlowMin = lexicalCastToDouble(priAirFlowMinElement); |
| 4478 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if (_priAirFlowMin) { |
| 4479 |
6/6✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✓ Branch 13 taken 21 times.
✓ Branch 16 taken 21 times.
|
84 | primaryAirFlowMin = unitToUnit(_priAirFlowMin.get(), "cfm", "m^3/s").get(); |
| 4480 | } | ||
| 4481 | |||
| 4482 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node airSysElement = trmlUnitElement.parent(); |
| 4483 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node airSystemTypeElement; |
| 4484 |
2/3✓ Branch 1 taken 21 times.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
|
21 | if (airSysElement) { |
| 4485 |
1/1✓ Branch 1 taken 21 times.
|
21 | airSystemTypeElement = airSysElement.child("TypeSim"); |
| 4486 | } | ||
| 4487 | |||
| 4488 |
6/7✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✓ Branch 13 taken 21 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 21 times.
|
63 | if (istringEqual("VAVNoReheatBox", typeElement.text().as_string())) { |
| 4489 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 4490 | |||
| 4491 | ✗ | model::AirTerminalSingleDuctVAVNoReheat terminal(model, schedule); | |
| 4492 | |||
| 4493 | ✗ | pugi::xml_node minAirFracSchRefElement = trmlUnitElement.child("MinAirFracSchRef"); | |
| 4494 | ✗ | if (boost::optional<model::Schedule> minAirFracSch = model.getModelObjectByName<model::Schedule>(minAirFracSchRefElement.text().as_string())) { | |
| 4495 | ✗ | terminal.setZoneMinimumAirFlowInputMethod("Scheduled"); | |
| 4496 | ✗ | terminal.setMinimumAirFlowFractionSchedule(minAirFracSch.get()); | |
| 4497 | ✗ | } else if (primaryAirFlowMin) { | |
| 4498 | ✗ | terminal.setZoneMinimumAirFlowInputMethod("FixedFlowRate"); | |
| 4499 | ✗ | terminal.setFixedMinimumAirFlowRate(primaryAirFlowMin.get()); | |
| 4500 | } else { | ||
| 4501 | ✗ | terminal.setZoneMinimumAirFlowInputMethod("Constant"); | |
| 4502 | ✗ | terminal.setConstantMinimumAirFlowFraction(0.5); | |
| 4503 | ✗ | } | |
| 4504 | |||
| 4505 | ✗ | if (availSch) { | |
| 4506 | ✗ | terminal.setAvailabilitySchedule(availSch.get()); | |
| 4507 | } | ||
| 4508 | |||
| 4509 | ✗ | if (primaryAirFlow) { | |
| 4510 | ✗ | terminal.setMaximumAirFlowRate(primaryAirFlow.get()); | |
| 4511 | } | ||
| 4512 | |||
| 4513 | ✗ | auto ctrlForOAElement = trmlUnitElement.child("CtrlForOA"); | |
| 4514 | ✗ | if (istringEqual("1", ctrlForOAElement.text().as_string())) { | |
| 4515 | ✗ | terminal.setControlForOutdoorAir(true); | |
| 4516 | } | ||
| 4517 | |||
| 4518 | ✗ | result = terminal; | |
| 4519 |
6/7✓ Branch 3 taken 21 times.
✓ Branch 6 taken 21 times.
✓ Branch 9 taken 21 times.
✓ Branch 12 taken 21 times.
✓ Branch 15 taken 21 times.
✓ Branch 19 taken 21 times.
✗ Branch 20 not taken.
|
63 | } else if (istringEqual("VAVReheatBox", typeElement.text().as_string())) { |
| 4520 |
1/1✓ Branch 1 taken 21 times.
|
21 | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); |
| 4521 | |||
| 4522 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node coilElement = trmlUnitElement.child("CoilHtg"); |
| 4523 | |||
| 4524 | 21 | boost::optional<model::HVACComponent> coil; | |
| 4525 | |||
| 4526 |
2/3✓ Branch 1 taken 21 times.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
|
21 | if (coilElement) { |
| 4527 |
2/3✓ Branch 1 taken 21 times.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
|
42 | if (auto mo = translateCoilHeating(coilElement, model)) { |
| 4528 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | coil = mo->optionalCast<model::HVACComponent>(); |
| 4529 | 21 | } | |
| 4530 | } | ||
| 4531 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
|
21 | if (!coil) { // If no coil is specified in the SDD, create an electric coil |
| 4532 | ✗ | coil = model::CoilHeatingElectric(model, schedule); | |
| 4533 | ✗ | LOG(Warn, name << " is assigned a default electric heating coil."); | |
| 4534 | } | ||
| 4535 | |||
| 4536 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 4 not taken.
|
21 | OS_ASSERT(coil); |
| 4537 | |||
| 4538 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | model::AirTerminalSingleDuctVAVReheat terminal(model, schedule, coil.get()); |
| 4539 | |||
| 4540 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node minAirFracSchRefElement = trmlUnitElement.child("MinAirFracSchRef"); |
| 4541 |
5/6✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 21 times.
|
42 | if (boost::optional<model::Schedule> minAirFracSch = model.getModelObjectByName<model::Schedule>(minAirFracSchRefElement.text().as_string())) { |
| 4542 | ✗ | terminal.setZoneMinimumAirFlowInputMethod("Scheduled"); | |
| 4543 | ✗ | terminal.setMinimumAirFlowFractionSchedule(minAirFracSch.get()); | |
| 4544 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | } else if (primaryAirFlowMin) { |
| 4545 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | terminal.setZoneMinimumAirFlowInputMethod("FixedFlowRate"); |
| 4546 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | terminal.setFixedMinimumAirFlowRate(primaryAirFlowMin.get()); |
| 4547 | } else { | ||
| 4548 | ✗ | terminal.setZoneMinimumAirFlowInputMethod("Constant"); | |
| 4549 | ✗ | terminal.setConstantMinimumAirFlowFraction(0.2); | |
| 4550 | 21 | } | |
| 4551 | |||
| 4552 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | if (availSch) { |
| 4553 | ✗ | terminal.setAvailabilitySchedule(availSch.get()); | |
| 4554 | } | ||
| 4555 | |||
| 4556 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if (primaryAirFlow) { |
| 4557 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | terminal.setMaximumAirFlowRate(primaryAirFlow.get()); |
| 4558 | } | ||
| 4559 | |||
| 4560 |
1/1✓ Branch 1 taken 21 times.
|
21 | terminal.resetMaximumFlowPerZoneFloorAreaDuringReheat(); |
| 4561 | |||
| 4562 | // ReheatCtrlMthd | ||
| 4563 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node reheatCtrlMthdElement = trmlUnitElement.child("ReheatCtrlMthd"); |
| 4564 |
15/33✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✓ Branch 13 taken 21 times.
✓ Branch 15 taken 21 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 21 times.
✓ Branch 21 taken 21 times.
✓ Branch 24 taken 21 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 21 times.
✗ Branch 27 not taken.
✓ Branch 29 taken 21 times.
✗ Branch 30 not taken.
✓ Branch 32 taken 21 times.
✗ Branch 33 not taken.
✓ Branch 34 taken 21 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 21 times.
✗ Branch 38 not taken.
✓ Branch 39 taken 21 times.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
|
126 | if (istringEqual(reheatCtrlMthdElement.text().as_string(), "DualMaximum") && coil->optionalCast<model::CoilHeatingWater>()) { |
| 4565 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
42 | terminal.setDamperHeatingAction("Reverse"); |
| 4566 | } else { | ||
| 4567 | ✗ | terminal.setDamperHeatingAction("Normal"); | |
| 4568 | } | ||
| 4569 | |||
| 4570 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node htgAirFlowMaxElement = trmlUnitElement.child("HtgAirFlowMaxSim"); |
| 4571 |
1/1✓ Branch 1 taken 21 times.
|
21 | boost::optional<double> _htgAirFlowMax = lexicalCastToDouble(htgAirFlowMaxElement); |
| 4572 |
3/6✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
|
42 | if (_htgAirFlowMax && primaryAirFlow) { |
| 4573 |
5/5✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✓ Branch 13 taken 21 times.
|
63 | double value = unitToUnit(_htgAirFlowMax.get(), "cfm", "m^3/s").get(); |
| 4574 |
1/1✓ Branch 1 taken 21 times.
|
21 | double fraction = value / primaryAirFlow.get(); |
| 4575 |
1/1✓ Branch 1 taken 21 times.
|
21 | terminal.setMaximumFlowFractionDuringReheat(fraction); |
| 4576 | } else { | ||
| 4577 | ✗ | bool found = false; | |
| 4578 | |||
| 4579 | ✗ | pugi::xml_node zoneServedElement = trmlUnitElement.child("ZnServedRef"); | |
| 4580 | |||
| 4581 | ✗ | std::vector<pugi::xml_node> thrmlZnElements = makeVectorOfChildren(trmlUnitElement.parent().parent().parent(), "ThrmlZn"); | |
| 4582 | |||
| 4583 | ✗ | for (std::vector<pugi::xml_node>::size_type j = 0; j < thrmlZnElements.size(); j++) { | |
| 4584 | ✗ | pugi::xml_node thrmlZnElement = thrmlZnElements[j]; | |
| 4585 | |||
| 4586 | ✗ | pugi::xml_node thrmlZnNameElement = thrmlZnElement.child("Name"); | |
| 4587 | |||
| 4588 | ✗ | if (istringEqual(thrmlZnNameElement.text().as_string(), zoneServedElement.text().as_string())) { | |
| 4589 | ✗ | pugi::xml_node htgDsgnMaxFlowFracElement = thrmlZnElement.child("HtgDsgnMaxFlowFrac"); | |
| 4590 | |||
| 4591 | ✗ | boost::optional<double> _htgDsgnMaxFlowFrac = lexicalCastToDouble(htgDsgnMaxFlowFracElement); | |
| 4592 | |||
| 4593 | ✗ | if (_htgDsgnMaxFlowFrac) { | |
| 4594 | ✗ | terminal.setMaximumFlowFractionDuringReheat(_htgDsgnMaxFlowFrac.get()); | |
| 4595 | |||
| 4596 | ✗ | found = true; | |
| 4597 | } | ||
| 4598 | |||
| 4599 | ✗ | break; | |
| 4600 | } | ||
| 4601 | } | ||
| 4602 | |||
| 4603 | ✗ | if (!found) { | |
| 4604 | ✗ | if (istringEqual(terminal.damperHeatingAction(), "Reverse")) { | |
| 4605 | ✗ | terminal.setMaximumFlowFractionDuringReheat(0.5); | |
| 4606 | } else { | ||
| 4607 | ✗ | terminal.setMaximumFlowFractionDuringReheat(0.2); | |
| 4608 | } | ||
| 4609 | } | ||
| 4610 | ✗ | } | |
| 4611 | |||
| 4612 |
1/1✓ Branch 1 taken 21 times.
|
21 | auto ctrlForOAElement = trmlUnitElement.child("CtrlForOA"); |
| 4613 |
6/7✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✓ Branch 13 taken 21 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 21 times.
|
63 | if (istringEqual("1", ctrlForOAElement.text().as_string())) { |
| 4614 | ✗ | terminal.setControlForOutdoorAir(true); | |
| 4615 | } | ||
| 4616 | |||
| 4617 |
1/1✓ Branch 1 taken 21 times.
|
21 | result = terminal; |
| 4618 |
0/7✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
|
21 | } else if (istringEqual("SeriesFanBox", typeElement.text().as_string())) { |
| 4619 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 4620 | |||
| 4621 | // CoilHtg | ||
| 4622 | ✗ | pugi::xml_node coilHtgElement = trmlUnitElement.child("CoilHtg"); | |
| 4623 | ✗ | boost::optional<model::ModelObject> coil; | |
| 4624 | ✗ | coil = translateCoilHeating(coilHtgElement, model); | |
| 4625 | ✗ | if (!coil) { | |
| 4626 | ✗ | coil = model::CoilHeatingElectric(model, schedule); | |
| 4627 | ✗ | LOG(Warn, name << " is assigned a default electric heating coil."); | |
| 4628 | } | ||
| 4629 | ✗ | auto hvacComponentCoil = coil->cast<model::HVACComponent>(); | |
| 4630 | |||
| 4631 | // Fan | ||
| 4632 | ✗ | pugi::xml_node fanElement = trmlUnitElement.child("Fan"); | |
| 4633 | ✗ | boost::optional<model::ModelObject> fan; | |
| 4634 | ✗ | fan = translateFan(fanElement, model); | |
| 4635 | ✗ | if (!fan) { | |
| 4636 | ✗ | fan = model::FanConstantVolume(model, schedule); | |
| 4637 | ✗ | LOG(Warn, name << " is assigned a default constant volume fan."); | |
| 4638 | } | ||
| 4639 | ✗ | auto hvacComponentFan = fan->cast<model::HVACComponent>(); | |
| 4640 | |||
| 4641 | // Terminal | ||
| 4642 | ✗ | model::AirTerminalSingleDuctSeriesPIUReheat terminal(model, hvacComponentFan, hvacComponentCoil); | |
| 4643 | |||
| 4644 | ✗ | if (availSch) { | |
| 4645 | ✗ | terminal.setAvailabilitySchedule(availSch.get()); | |
| 4646 | } | ||
| 4647 | |||
| 4648 | ✗ | if (primaryAirFlow) { | |
| 4649 | ✗ | terminal.setMaximumAirFlowRate(primaryAirFlow.get()); | |
| 4650 | } | ||
| 4651 | |||
| 4652 | // Maximum and Minimum Primary Air Flow Rate | ||
| 4653 | ✗ | if (boost::optional<model::FanConstantVolume> constantFan = hvacComponentFan.optionalCast<model::FanConstantVolume>()) { | |
| 4654 | ✗ | if (boost::optional<double> flow = constantFan->maximumFlowRate()) { | |
| 4655 | ✗ | terminal.setMaximumPrimaryAirFlowRate(flow.get()); | |
| 4656 | ✗ | if (primaryAirFlowMin) { | |
| 4657 | ✗ | terminal.setMinimumPrimaryAirFlowFraction(primaryAirFlowMin.get() / flow.get()); | |
| 4658 | } | ||
| 4659 | } | ||
| 4660 | ✗ | } else if (boost::optional<model::FanVariableVolume> variableFan = hvacComponentFan.optionalCast<model::FanVariableVolume>()) { | |
| 4661 | ✗ | if (boost::optional<double> flow = variableFan->maximumFlowRate()) { | |
| 4662 | ✗ | terminal.setMaximumPrimaryAirFlowRate(flow.get()); | |
| 4663 | ✗ | if (primaryAirFlowMin) { | |
| 4664 | ✗ | terminal.setMinimumPrimaryAirFlowFraction(primaryAirFlowMin.get() / flow.get()); | |
| 4665 | } | ||
| 4666 | } | ||
| 4667 | ✗ | } | |
| 4668 | |||
| 4669 | // Hot Water Related Properties | ||
| 4670 | ✗ | if (boost::optional<model::CoilHeatingWater> waterCoil = hvacComponentCoil.optionalCast<model::CoilHeatingWater>()) { | |
| 4671 | ✗ | terminal.setConvergenceTolerance(0.001); | |
| 4672 | ✗ | if (boost::optional<double> flow = waterCoil->maximumWaterFlowRate()) { | |
| 4673 | ✗ | terminal.setMaximumHotWaterorSteamFlowRate(flow.get()); | |
| 4674 | } | ||
| 4675 | ✗ | } | |
| 4676 | |||
| 4677 | ✗ | result = terminal; | |
| 4678 | ✗ | } else if (istringEqual("ParallelFanBox", typeElement.text().as_string())) { | |
| 4679 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 4680 | |||
| 4681 | // CoilHtg | ||
| 4682 | |||
| 4683 | ✗ | pugi::xml_node coilHtgElement = trmlUnitElement.child("CoilHtg"); | |
| 4684 | |||
| 4685 | ✗ | boost::optional<model::ModelObject> coil; | |
| 4686 | |||
| 4687 | ✗ | coil = translateCoilHeating(coilHtgElement, model); | |
| 4688 | |||
| 4689 | ✗ | if (!coil) { | |
| 4690 | ✗ | coil = model::CoilHeatingElectric(model, schedule); | |
| 4691 | ✗ | LOG(Warn, name << " is assigned a default electric heating coil."); | |
| 4692 | } | ||
| 4693 | |||
| 4694 | ✗ | auto hvacComponentCoil = coil->cast<model::HVACComponent>(); | |
| 4695 | |||
| 4696 | // Fan | ||
| 4697 | |||
| 4698 | ✗ | pugi::xml_node fanElement = trmlUnitElement.child("Fan"); | |
| 4699 | |||
| 4700 | ✗ | boost::optional<model::ModelObject> fan; | |
| 4701 | |||
| 4702 | ✗ | fan = translateFan(fanElement, model); | |
| 4703 | |||
| 4704 | ✗ | if (!fan) { | |
| 4705 | ✗ | fan = model::FanConstantVolume(model, schedule); | |
| 4706 | ✗ | LOG(Warn, name << " is assigned a default constant volume fan."); | |
| 4707 | } | ||
| 4708 | |||
| 4709 | ✗ | auto hvacComponentFan = fan->cast<model::HVACComponent>(); | |
| 4710 | |||
| 4711 | // Terminal | ||
| 4712 | |||
| 4713 | ✗ | model::AirTerminalSingleDuctParallelPIUReheat terminal(model, schedule, hvacComponentFan, hvacComponentCoil); | |
| 4714 | |||
| 4715 | ✗ | if (availSch) { | |
| 4716 | ✗ | terminal.setAvailabilitySchedule(availSch.get()); | |
| 4717 | } | ||
| 4718 | |||
| 4719 | ✗ | if (primaryAirFlow) { | |
| 4720 | ✗ | terminal.setMaximumPrimaryAirFlowRate(primaryAirFlow.get()); | |
| 4721 | } | ||
| 4722 | |||
| 4723 | ✗ | if (primaryAirFlow && primaryAirFlowMin) { | |
| 4724 | ✗ | terminal.setMinimumPrimaryAirFlowFraction(primaryAirFlowMin.get() / primaryAirFlow.get()); | |
| 4725 | } | ||
| 4726 | |||
| 4727 | // Maximum Secondary Air Flow Rate | ||
| 4728 | |||
| 4729 | ✗ | if (boost::optional<model::FanConstantVolume> constantFan = hvacComponentFan.optionalCast<model::FanConstantVolume>()) { | |
| 4730 | ✗ | if (boost::optional<double> flow = constantFan->maximumFlowRate()) { | |
| 4731 | ✗ | terminal.setMaximumSecondaryAirFlowRate(flow.get()); | |
| 4732 | } | ||
| 4733 | ✗ | } else if (boost::optional<model::FanVariableVolume> variableFan = hvacComponentFan.optionalCast<model::FanVariableVolume>()) { | |
| 4734 | ✗ | if (boost::optional<double> flow = variableFan->maximumFlowRate()) { | |
| 4735 | ✗ | terminal.setMaximumSecondaryAirFlowRate(flow.get()); | |
| 4736 | } | ||
| 4737 | ✗ | } | |
| 4738 | |||
| 4739 | // Hot Water Related Properties | ||
| 4740 | |||
| 4741 | ✗ | if (boost::optional<model::CoilHeatingWater> waterCoil = hvacComponentCoil.optionalCast<model::CoilHeatingWater>()) { | |
| 4742 | ✗ | terminal.setConvergenceTolerance(0.001); | |
| 4743 | |||
| 4744 | ✗ | if (boost::optional<double> flow = waterCoil->maximumWaterFlowRate()) { | |
| 4745 | ✗ | terminal.setMaximumHotWaterorSteamFlowRate(flow.get()); | |
| 4746 | } | ||
| 4747 | ✗ | } | |
| 4748 | |||
| 4749 | // ParallelBoxFanFlowFrac | ||
| 4750 | ✗ | pugi::xml_node parallelBoxFanFlowFracElement = trmlUnitElement.child("ParallelBoxFanFlowFrac"); | |
| 4751 | ✗ | boost::optional<double> _parallelBoxFanFlowFrac = lexicalCastToDouble(parallelBoxFanFlowFracElement); | |
| 4752 | ✗ | if (_parallelBoxFanFlowFrac) { | |
| 4753 | ✗ | terminal.setFanOnFlowFraction(_parallelBoxFanFlowFrac.get()); | |
| 4754 | } | ||
| 4755 | |||
| 4756 | ✗ | result = terminal; | |
| 4757 | ✗ | } else if (istringEqual("Uncontrolled", typeElement.text().as_string())) { | |
| 4758 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 4759 | |||
| 4760 | ✗ | model::AirTerminalSingleDuctConstantVolumeNoReheat terminal(model, schedule); | |
| 4761 | |||
| 4762 | // PriAirFlow | ||
| 4763 | ✗ | if (primaryAirFlow) { | |
| 4764 | ✗ | terminal.setMaximumAirFlowRate(primaryAirFlow.get()); | |
| 4765 | } | ||
| 4766 | |||
| 4767 | ✗ | result = terminal; | |
| 4768 | ✗ | } else { | |
| 4769 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 4770 | |||
| 4771 | ✗ | model::AirTerminalSingleDuctConstantVolumeNoReheat terminal(model, schedule); | |
| 4772 | |||
| 4773 | ✗ | result = terminal; | |
| 4774 | ✗ | } | |
| 4775 | |||
| 4776 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if (result) { |
| 4777 |
5/5✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✓ Branch 13 taken 21 times.
|
42 | result->setName(nameElement.text().as_string()); |
| 4778 | } | ||
| 4779 | |||
| 4780 | 21 | return result; | |
| 4781 | 21 | } | |
| 4782 | |||
| 4783 | 5 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateFluidSys(const pugi::xml_node& fluidSysElement, | |
| 4784 | openstudio::model::Model& model) { | ||
| 4785 | 5 | boost::optional<openstudio::model::ModelObject> result; | |
| 4786 | |||
| 4787 |
5/6✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 5 times.
|
20 | if (!istringEqual(fluidSysElement.name(), "FluidSys")) { |
| 4788 | ✗ | return result; | |
| 4789 | } | ||
| 4790 | |||
| 4791 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node nameElement = fluidSysElement.child("Name"); |
| 4792 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | std::string plantName = nameElement.text().as_string(); |
| 4793 | |||
| 4794 |
2/3✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
|
10 | if (boost::optional<model::PlantLoop> plant = model.getConcreteModelObjectByName<model::PlantLoop>(plantName)) { |
| 4795 | ✗ | return plant.get(); | |
| 4796 | 5 | } | |
| 4797 | |||
| 4798 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::PlantLoop plantLoop(model); |
| 4799 | |||
| 4800 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::Node supplyInletNode = plantLoop.supplyInletNode(); |
| 4801 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::Node supplyOutletNode = plantLoop.supplyOutletNode(); |
| 4802 | |||
| 4803 | 5 | bool bypass = false; | |
| 4804 | |||
| 4805 | // Name | ||
| 4806 | |||
| 4807 |
1/1✓ Branch 1 taken 5 times.
|
5 | plantLoop.setName(plantName); |
| 4808 | |||
| 4809 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::SizingPlant sizingPlant = plantLoop.sizingPlant(); |
| 4810 | |||
| 4811 | // Type | ||
| 4812 | |||
| 4813 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node typeElement = fluidSysElement.child("Type"); |
| 4814 | |||
| 4815 | // DsgnSupWtrTemp | ||
| 4816 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node dsgnSupWtrTempElement = fluidSysElement.child("DsgnSupWtrTemp"); |
| 4817 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _dsgnSupWtrTemp = lexicalCastToDouble(dsgnSupWtrTempElement); |
| 4818 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_dsgnSupWtrTemp) { |
| 4819 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
15 | double value = unitToUnit(_dsgnSupWtrTemp.get(), "F", "C").get(); |
| 4820 |
1/1✓ Branch 1 taken 5 times.
|
5 | sizingPlant.setDesignLoopExitTemperature(value); |
| 4821 | } | ||
| 4822 | |||
| 4823 | // DsgnSupWtrDelT | ||
| 4824 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node dsgnSupWtrDelTElement = fluidSysElement.child("DsgnSupWtrDelT"); |
| 4825 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _dsgnSupWtrDelT = lexicalCastToDouble(dsgnSupWtrDelTElement); |
| 4826 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_dsgnSupWtrDelT) { |
| 4827 |
1/1✓ Branch 1 taken 5 times.
|
5 | double value = _dsgnSupWtrDelT.get() / 1.8; |
| 4828 |
1/1✓ Branch 1 taken 5 times.
|
5 | sizingPlant.setLoopDesignTemperatureDifference(value); |
| 4829 | } | ||
| 4830 | |||
| 4831 |
7/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 17 taken 2 times.
✓ Branch 18 taken 3 times.
|
15 | if (istringEqual(typeElement.text().as_string(), "HotWater")) { |
| 4832 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | sizingPlant.setLoopType("Heating"); |
| 4833 |
7/7✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 17 taken 1 time.
✓ Branch 18 taken 2 times.
|
9 | } else if (istringEqual(typeElement.text().as_string(), "ChilledWater")) { |
| 4834 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | sizingPlant.setLoopType("Cooling"); |
| 4835 |
7/7✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 17 taken 1 time.
✓ Branch 18 taken 1 time.
|
6 | } else if (istringEqual(typeElement.text().as_string(), "CondenserWater")) { |
| 4836 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | sizingPlant.setLoopType("Condenser"); |
| 4837 | } | ||
| 4838 | |||
| 4839 | 11 | auto addBranchPump = [&](boost::optional<model::ModelObject> mo, pugi::xml_node baseElement) { | |
| 4840 |
1/1✓ Branch 1 taken 11 times.
|
11 | auto pumpElement = baseElement.child("Pump"); |
| 4841 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 6 times.
|
11 | if (pumpElement) { |
| 4842 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (mo) { |
| 4843 |
3/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
|
10 | if (auto inletNode = mo->optionalCast<model::Node>()) { |
| 4844 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
10 | if (auto mo2 = translatePump(pumpElement, model)) { |
| 4845 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 1 time.
✓ Branch 7 taken 4 times.
|
10 | if (boost::optional<model::PumpVariableSpeed> pump = mo2->optionalCast<model::PumpVariableSpeed>()) { |
| 4846 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | pump->addToNode(inletNode.get()); |
| 4847 |
3/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
|
8 | } else if (boost::optional<model::PumpConstantSpeed> pump = mo2->optionalCast<model::PumpConstantSpeed>()) { |
| 4848 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | pump->addToNode(inletNode.get()); |
| 4849 | 9 | } | |
| 4850 | 5 | } | |
| 4851 | 5 | } | |
| 4852 | } | ||
| 4853 | } | ||
| 4854 | 11 | }; | |
| 4855 | |||
| 4856 | // Boilers | ||
| 4857 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::vector<pugi::xml_node> boilerElements = makeVectorOfChildren(fluidSysElement, "Blr"); |
| 4858 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 2 taken 5 times.
|
9 | for (std::vector<pugi::xml_node>::size_type i = 0; i < boilerElements.size(); i++) { |
| 4859 | 4 | auto boilerElement = boilerElements[i]; | |
| 4860 | |||
| 4861 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (boost::optional<model::ModelObject> mo = translateBoiler(boilerElement, model)) { |
| 4862 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | auto boiler = mo->cast<model::BoilerHotWater>(); |
| 4863 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | plantLoop.addSupplyBranchForComponent(boiler); |
| 4864 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | addBranchPump(boiler.inletModelObject(), boilerElement); |
| 4865 | 8 | } | |
| 4866 | } | ||
| 4867 | |||
| 4868 | // ThrmlEngyStor | ||
| 4869 |
1/1✓ Branch 1 taken 5 times.
|
5 | auto thrmlEngyStorElement = fluidSysElement.child("ThrmlEngyStor"); |
| 4870 | 5 | boost::optional<model::ThermalStorageChilledWaterStratified> thermalStorage; | |
| 4871 | 5 | std::string thermalStorageDischargePriority; | |
| 4872 | 5 | boost::optional<model::ScheduleRuleset> tesSchedule; | |
| 4873 | // Note: this variable will be used un-initialized in case the "TankSetptTemp" child key is ill-formed (not present or, doesn't cast to double) | ||
| 4874 | // Setting to a default of 7.5 per E+ example 5ZoneVAV-ChilledWaterStorage-Stratified.idf | ||
| 4875 | 5 | double thermalStorageTankSetptTemp = 7.5; | |
| 4876 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 4 times.
|
10 | if (auto mo = translateThrmlEngyStor(thrmlEngyStorElement, model)) { |
| 4877 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | thermalStorage = mo->cast<model::ThermalStorageChilledWaterStratified>(); |
| 4878 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | plantLoop.addSupplyBranchForComponent(thermalStorage.get()); |
| 4879 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | addBranchPump(thermalStorage->supplyInletModelObject(), thrmlEngyStorElement); |
| 4880 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | plantLoop.addDemandBranchForComponent(thermalStorage.get()); |
| 4881 | |||
| 4882 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | thermalStorageDischargePriority = thrmlEngyStorElement.child("DischrgPriority").text().as_string(); |
| 4883 |
1/1✓ Branch 1 taken 1 time.
|
1 | pugi::xml_node tankSetptTempElement = thrmlEngyStorElement.child("TankSetptTemp"); |
| 4884 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> _tankSetptTemp = lexicalCastToDouble(tankSetptTempElement); |
| 4885 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_tankSetptTemp) { |
| 4886 |
5/5✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
|
4 | thermalStorageTankSetptTemp = unitToUnit(_tankSetptTemp.get(), "F", "C").get(); |
| 4887 | } else { | ||
| 4888 | ✗ | LOG(Warn, "Missing TankSetptTemp (or bad cast to double) for '" << thermalStorage->briefDescription() << ", defaulting to " | |
| 4889 | << thermalStorageTankSetptTemp << " C."); | ||
| 4890 | } | ||
| 4891 | |||
| 4892 | // charging scheme, which is a component setpoint scheme so we add SPMs | ||
| 4893 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | tesSchedule = model::ScheduleRuleset(model); |
| 4894 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | tesSchedule->setName(plantLoop.nameString() + "TES SPM Schedule"); |
| 4895 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | tesSchedule->defaultDaySchedule().addValue(Time(1.0), thermalStorageTankSetptTemp); |
| 4896 | |||
| 4897 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | thermalStorage->setSetpointTemperatureSchedule(tesSchedule.get()); |
| 4898 | |||
| 4899 | { | ||
| 4900 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | const auto* schRef = thrmlEngyStorElement.child("ChlrOnlySchRef").text().as_string(); |
| 4901 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
|
3 | if (auto sch = model.getModelObjectByName<model::Schedule>(schRef)) { |
| 4902 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | plantLoop.setPlantEquipmentOperationCoolingLoadSchedule(sch.get()); |
| 4903 | 1 | } | |
| 4904 | } | ||
| 4905 | |||
| 4906 | { | ||
| 4907 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | const auto* schRef = thrmlEngyStorElement.child("DischrgSchRef").text().as_string(); |
| 4908 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
|
3 | if (auto sch = model.getModelObjectByName<model::Schedule>(schRef)) { |
| 4909 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | plantLoop.setPrimaryPlantEquipmentOperationSchemeSchedule(sch.get()); |
| 4910 | 1 | } | |
| 4911 | } | ||
| 4912 | |||
| 4913 | { | ||
| 4914 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | const auto* schRef = thrmlEngyStorElement.child("ChrgSchRef").text().as_string(); |
| 4915 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
|
3 | if (auto sch = model.getModelObjectByName<model::Schedule>(schRef)) { |
| 4916 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | plantLoop.setComponentSetpointOperationSchemeSchedule(sch.get()); |
| 4917 | 1 | } | |
| 4918 | } | ||
| 4919 | 5 | } | |
| 4920 | |||
| 4921 | // Chillers | ||
| 4922 | |||
| 4923 | // Keep a map of chiller to a flag indicating if it should be used | ||
| 4924 | // in thermal energy storage discharge | ||
| 4925 | 5 | std::map<model::ModelObject, bool> enableOnThrmlEngyStorDischargeMap; | |
| 4926 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::vector<pugi::xml_node> chillerElements = makeVectorOfChildren(fluidSysElement, "Chlr"); |
| 4927 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 2 taken 5 times.
|
8 | for (std::vector<pugi::xml_node>::size_type i = 0; i < chillerElements.size(); i++) { |
| 4928 | 3 | auto chillerElement = chillerElements[i]; | |
| 4929 | |||
| 4930 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
6 | if (auto mo = translateChiller(chillerElement, model)) { |
| 4931 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | auto chiller = mo->cast<model::WaterToWaterComponent>(); |
| 4932 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | plantLoop.addSupplyBranchForComponent(chiller); |
| 4933 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | addBranchPump(chiller.supplyInletModelObject(), chillerElement); |
| 4934 | |||
| 4935 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto evapHasBypassElement = chillerElement.child("EvapHasBypass"); |
| 4936 |
3/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 3 times.
|
3 | if (evapHasBypassElement.text().as_int() == 1) { |
| 4937 | ✗ | bypass = true; | |
| 4938 | } | ||
| 4939 | |||
| 4940 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (thermalStorage) { |
| 4941 |
5/5✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 9 taken 1 time.
✓ Branch 10 taken 2 times.
|
3 | if (chillerElement.child("EnableOnThrmlEngyStorDischrg").text().as_int() == 1) { |
| 4942 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | enableOnThrmlEngyStorDischargeMap.insert(std::make_pair(chiller, true)); |
| 4943 | } else { | ||
| 4944 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | enableOnThrmlEngyStorDischargeMap.insert(std::make_pair(chiller, false)); |
| 4945 | } | ||
| 4946 | } | ||
| 4947 | 6 | } | |
| 4948 | } | ||
| 4949 | |||
| 4950 | // HtRej | ||
| 4951 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::vector<pugi::xml_node> htRejElements = makeVectorOfChildren(fluidSysElement, "HtRej"); |
| 4952 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 2 taken 5 times.
|
8 | for (std::vector<pugi::xml_node>::size_type i = 0; i < htRejElements.size(); i++) { |
| 4953 | 3 | auto htRejElement = htRejElements[i]; | |
| 4954 | |||
| 4955 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
6 | if (auto mo = translateHtRej(htRejElement, model)) { |
| 4956 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | auto tower = mo->cast<model::StraightComponent>(); |
| 4957 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | plantLoop.addSupplyBranchForComponent(tower); |
| 4958 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | addBranchPump(tower.inletModelObject(), htRejElement); |
| 4959 | 6 | } | |
| 4960 | } | ||
| 4961 | |||
| 4962 | // HX | ||
| 4963 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::vector<pugi::xml_node> hxElements = makeVectorOfChildren(fluidSysElement, "HX"); |
| 4964 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
|
5 | for (std::vector<pugi::xml_node>::size_type i = 0; i < hxElements.size(); i++) { |
| 4965 | ✗ | auto hxElement = hxElements[i]; | |
| 4966 | |||
| 4967 | ✗ | if (auto mo = translateHX(hxElement, model)) { | |
| 4968 | ✗ | auto hx = mo->cast<model::HeatExchangerFluidToFluid>(); | |
| 4969 | ✗ | const auto* economizerIntegration = hxElement.child("EconoIntegration").text().as_string(); | |
| 4970 | ✗ | if (istringEqual("Nonintegrated", economizerIntegration)) { | |
| 4971 | ✗ | plantLoop.addSupplyBranchForComponent(hx); | |
| 4972 | } else { | ||
| 4973 | ✗ | auto node = plantLoop.supplyInletNode(); | |
| 4974 | ✗ | hx.addToNode(node); | |
| 4975 | ✗ | } | |
| 4976 | ✗ | } | |
| 4977 | } | ||
| 4978 | |||
| 4979 | // Water Heaters | ||
| 4980 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::vector<pugi::xml_node> wtrHtrElements = makeVectorOfChildren(fluidSysElement, "WtrHtr"); |
| 4981 | |||
| 4982 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 5 times.
|
6 | for (std::vector<pugi::xml_node>::size_type i = 0; i < wtrHtrElements.size(); i++) { |
| 4983 | 1 | pugi::xml_node wtrHtrElement = wtrHtrElements[i]; | |
| 4984 | |||
| 4985 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<model::ModelObject> mo = translateWtrHtr(wtrHtrElement, model)) { |
| 4986 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | plantLoop.addSupplyBranchForComponent(mo->cast<model::HVACComponent>()); |
| 4987 | 1 | } | |
| 4988 | } | ||
| 4989 | |||
| 4990 | // Add a default bypass | ||
| 4991 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if (bypass) { |
| 4992 | ✗ | model::PipeAdiabatic pipe(model); | |
| 4993 | |||
| 4994 | ✗ | plantLoop.addSupplyBranchForComponent(pipe); | |
| 4995 | ✗ | } | |
| 4996 | |||
| 4997 | // Add a default hot water heater for servicehotwater systems | ||
| 4998 |
7/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 17 taken 1 time.
✓ Branch 18 taken 4 times.
|
15 | if (openstudio::istringEqual(typeElement.text().as_string(), "servicehotwater")) { |
| 4999 | 1 | boost::optional<model::WaterHeaterMixed> waterHeater; | |
| 5000 | |||
| 5001 | 1 | boost::optional<model::Schedule> setpointSchedule; | |
| 5002 | |||
| 5003 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | std::vector<model::ModelObject> waterHeaters = plantLoop.supplyComponents(model::WaterHeaterMixed::iddObjectType()); |
| 5004 | |||
| 5005 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (!waterHeaters.empty()) { |
| 5006 |
2/2✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
|
1 | waterHeater = waterHeaters.front().cast<model::WaterHeaterMixed>(); |
| 5007 | } | ||
| 5008 | |||
| 5009 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (waterHeater) { |
| 5010 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | setpointSchedule = waterHeater->setpointTemperatureSchedule(); |
| 5011 | } | ||
| 5012 | |||
| 5013 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (setpointSchedule) { |
| 5014 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | model::SetpointManagerScheduled spm(model, setpointSchedule.get()); |
| 5015 | |||
| 5016 |
1/1✓ Branch 1 taken 1 time.
|
1 | spm.addToNode(supplyOutletNode); |
| 5017 | 1 | } | |
| 5018 | |||
| 5019 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (!waterHeaters.empty()) { |
| 5020 |
1/1✓ Branch 1 taken 1 time.
|
1 | model::PumpVariableSpeed pumpVariableSpeed(model); |
| 5021 | |||
| 5022 |
1/1✓ Branch 1 taken 1 time.
|
1 | model::Node supplyInletNode = plantLoop.supplyInletNode(); |
| 5023 | |||
| 5024 |
1/1✓ Branch 1 taken 1 time.
|
1 | pumpVariableSpeed.addToNode(supplyInletNode); |
| 5025 | |||
| 5026 |
1/1✓ Branch 1 taken 1 time.
|
1 | pumpVariableSpeed.setRatedPumpHead(0.0); |
| 5027 | 1 | } | |
| 5028 | 1 | } | |
| 5029 | |||
| 5030 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::vector<pugi::xml_node> fluidSegElements = makeVectorOfChildren(fluidSysElement, "FluidSeg"); |
| 5031 | |||
| 5032 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 2 taken 5 times.
|
15 | for (std::vector<pugi::xml_node>::size_type i = 0; i < fluidSegElements.size(); i++) { |
| 5033 | 10 | pugi::xml_node fluidSegElement = fluidSegElements[i]; | |
| 5034 | |||
| 5035 |
1/1✓ Branch 1 taken 10 times.
|
10 | pugi::xml_node fluidSegTypeElement = fluidSegElement.child("Type"); |
| 5036 | |||
| 5037 | // Translate Secondary Supply | ||
| 5038 |
6/7✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
✓ Branch 13 taken 10 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 10 times.
|
30 | if (openstudio::istringEqual(fluidSegTypeElement.text().as_string(), "secondarysupply")) { |
| 5039 | ✗ | pugi::xml_node pumpElement = fluidSegElement.child("Pump"); | |
| 5040 | |||
| 5041 | ✗ | if ((pumpElement != nullptr) && !openstudio::istringEqual(typeElement.text().as_string(), "ServiceHotWater")) { | |
| 5042 | ✗ | boost::optional<model::ModelObject> mo = translatePump(pumpElement, model); | |
| 5043 | |||
| 5044 | ✗ | if (mo) { | |
| 5045 | ✗ | model::Node demandInletNode = plantLoop.demandInletNode(); | |
| 5046 | |||
| 5047 | ✗ | mo->cast<model::HVACComponent>().addToNode(demandInletNode); | |
| 5048 | |||
| 5049 | ✗ | plantLoop.setCommonPipeSimulation("CommonPipe"); | |
| 5050 | ✗ | } | |
| 5051 | ✗ | } | |
| 5052 | } | ||
| 5053 | |||
| 5054 | // If CommonPipeSim is defined then respect it, overriding other things unless it is ServiceHotWater | ||
| 5055 |
7/7✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
✓ Branch 13 taken 10 times.
✓ Branch 17 taken 8 times.
✓ Branch 18 taken 2 times.
|
30 | if (!openstudio::istringEqual(typeElement.text().as_string(), "ServiceHotWater")) { |
| 5056 |
1/1✓ Branch 1 taken 8 times.
|
8 | auto commonPipeSimElement = fluidSysElement.child("CommonPipeSim"); |
| 5057 |
2/3✓ Branch 1 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
|
8 | if (commonPipeSimElement) { |
| 5058 | ✗ | plantLoop.setCommonPipeSimulation(commonPipeSimElement.text().as_string()); | |
| 5059 | } | ||
| 5060 | } | ||
| 5061 | |||
| 5062 | // Translate Primary Supply | ||
| 5063 | |||
| 5064 |
9/20✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
✓ Branch 13 taken 10 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 10 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 10 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 9 times.
✓ Branch 21 taken 1 time.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
|
50 | if (openstudio::istringEqual(fluidSegTypeElement.text().as_string(), "primaryreturn") |
| 5065 |
19/28✓ Branch 1 taken 10 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 6 times.
✓ Branch 9 taken 6 times.
✓ Branch 12 taken 6 times.
✓ Branch 15 taken 6 times.
✓ Branch 18 taken 6 times.
✓ Branch 20 taken 5 times.
✓ Branch 21 taken 1 time.
✓ Branch 22 taken 6 times.
✓ Branch 23 taken 4 times.
✓ Branch 25 taken 6 times.
✓ Branch 26 taken 4 times.
✓ Branch 27 taken 6 times.
✓ Branch 28 taken 4 times.
✓ Branch 30 taken 6 times.
✓ Branch 31 taken 4 times.
✓ Branch 32 taken 10 times.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
|
54 | || openstudio::istringEqual(fluidSegTypeElement.text().as_string(), "primarysupply")) { |
| 5066 |
1/1✓ Branch 1 taken 9 times.
|
9 | pugi::xml_node pumpElement = fluidSegElement.child("Pump"); |
| 5067 | |||
| 5068 |
3/3✓ Branch 1 taken 9 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 7 times.
|
9 | if (pumpElement) { |
| 5069 |
1/1✓ Branch 1 taken 2 times.
|
2 | boost::optional<model::ModelObject> mo = translatePump(pumpElement, model); |
| 5070 | |||
| 5071 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (mo) { |
| 5072 |
1/1✓ Branch 1 taken 2 times.
|
2 | model::Node supplyInletNode = plantLoop.supplyInletNode(); |
| 5073 | |||
| 5074 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | mo->cast<model::HVACComponent>().addToNode(supplyInletNode); |
| 5075 | 2 | } | |
| 5076 | 2 | } | |
| 5077 | } | ||
| 5078 | } | ||
| 5079 | |||
| 5080 | // Translate PlantLoop::MaximumLoopFlowRate and MinimumLoopFlowRate | ||
| 5081 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
5 | if (!autosize()) { |
| 5082 | 5 | std::vector<model::ModelObject> constantPumps; | |
| 5083 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | constantPumps = plantLoop.supplyComponents(plantLoop.supplyInletNode(), plantLoop.supplySplitter(), model::PumpConstantSpeed::iddObjectType()); |
| 5084 | |||
| 5085 | 5 | std::vector<model::ModelObject> variablePumps; | |
| 5086 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | variablePumps = plantLoop.supplyComponents(plantLoop.supplyInletNode(), plantLoop.supplySplitter(), model::PumpVariableSpeed::iddObjectType()); |
| 5087 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 4 times.
|
5 | if (!constantPumps.empty()) { |
| 5088 |
1/1✓ Branch 2 taken 1 time.
|
1 | auto pump = constantPumps.front().cast<model::PumpConstantSpeed>(); |
| 5089 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<double> value = pump.ratedFlowRate()) { |
| 5090 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | plantLoop.setMaximumLoopFlowRate(value.get()); |
| 5091 | //plantLoop.setMinimumLoopFlowRate(value.get()); | ||
| 5092 | } | ||
| 5093 |
2/2✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2 times.
|
5 | } else if (!variablePumps.empty()) { |
| 5094 |
1/1✓ Branch 2 taken 2 times.
|
2 | auto pump = variablePumps.front().cast<model::PumpVariableSpeed>(); |
| 5095 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
|
4 | if (boost::optional<double> value = pump.ratedFlowRate()) { |
| 5096 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | plantLoop.setMaximumLoopFlowRate(value.get()); |
| 5097 | } | ||
| 5098 | //if( boost::optional<double> value = pump.minimumFlowRate() ) | ||
| 5099 | //{ | ||
| 5100 | // plantLoop.setMinimumLoopFlowRate(value.get()); | ||
| 5101 | //} | ||
| 5102 | 2 | } else { | |
| 5103 | 2 | std::vector<double> minimums; | |
| 5104 | |||
| 5105 | 2 | double flowRate = 0.0; | |
| 5106 | |||
| 5107 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | constantPumps = plantLoop.supplyComponents(plantLoop.supplySplitter(), plantLoop.supplyMixer(), model::PumpConstantSpeed::iddObjectType()); |
| 5108 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | if (!constantPumps.empty()) { |
| 5109 |
2/2✓ Branch 4 taken 4 times.
✓ Branch 5 taken 2 times.
|
6 | for (auto it = constantPumps.begin(); it != constantPumps.end(); ++it) { |
| 5110 |
3/4✓ Branch 2 taken 4 times.
✓ Branch 5 taken 4 times.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
|
8 | if (boost::optional<double> ratedFlowRate = it->cast<model::PumpConstantSpeed>().ratedFlowRate()) { |
| 5111 |
1/1✓ Branch 1 taken 4 times.
|
4 | flowRate = flowRate + ratedFlowRate.get(); |
| 5112 | |||
| 5113 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | minimums.push_back(ratedFlowRate.get()); |
| 5114 | } | ||
| 5115 | } | ||
| 5116 | } | ||
| 5117 | |||
| 5118 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | variablePumps = plantLoop.supplyComponents(plantLoop.supplySplitter(), plantLoop.supplyMixer(), model::PumpVariableSpeed::iddObjectType()); |
| 5119 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 1 time.
|
2 | if (!variablePumps.empty()) { |
| 5120 |
2/2✓ Branch 4 taken 1 time.
✓ Branch 5 taken 1 time.
|
2 | for (auto it = variablePumps.begin(); it != variablePumps.end(); ++it) { |
| 5121 |
3/4✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 9 taken 1 time.
✗ Branch 10 not taken.
|
2 | if (boost::optional<double> ratedFlowRate = it->cast<model::PumpVariableSpeed>().ratedFlowRate()) { |
| 5122 |
1/1✓ Branch 1 taken 1 time.
|
1 | flowRate = flowRate + ratedFlowRate.get(); |
| 5123 | } | ||
| 5124 |
4/5✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 12 taken 1 time.
✗ Branch 13 not taken.
|
2 | if (boost::optional<double> minimumFlowRate = it->cast<model::PumpVariableSpeed>().minimumFlowRate()) { |
| 5125 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | minimums.push_back(minimumFlowRate.get()); |
| 5126 | } | ||
| 5127 | } | ||
| 5128 | } | ||
| 5129 | |||
| 5130 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | if (!equal<double>(flowRate, 0.0)) { |
| 5131 |
1/1✓ Branch 1 taken 2 times.
|
2 | plantLoop.setMaximumLoopFlowRate(flowRate); |
| 5132 | } | ||
| 5133 | |||
| 5134 | //if( ! minimums.empty() ) | ||
| 5135 | //{ | ||
| 5136 | // plantLoop.setMinimumLoopFlowRate(minimum(createVector(minimums))); | ||
| 5137 | //} | ||
| 5138 | 2 | } | |
| 5139 | 5 | } | |
| 5140 | |||
| 5141 | // Plant Operation Schemes | ||
| 5142 | |||
| 5143 | 5 | std::vector<double> ldRngLims; | |
| 5144 | using EquipmentList = std::vector<std::string>; | ||
| 5145 | 5 | std::vector<EquipmentList> equipmentLists; | |
| 5146 | |||
| 5147 | // Lambda to sort two pugi::xml_node according to their 'index' attribute | ||
| 5148 | ✗ | auto sortByIndex = [&plantName](const pugi::xml_node& lhs, const ::pugi::xml_node& rhs) { | |
| 5149 | ✗ | boost::optional<unsigned> _lhs_index = lexicalCastToUnsigned(lhs.attribute("index")); | |
| 5150 | ✗ | boost::optional<unsigned> _rhs_index = lexicalCastToUnsigned(rhs.attribute("index")); | |
| 5151 | ✗ | if (_lhs_index && _rhs_index) { | |
| 5152 | ✗ | return _lhs_index.get() < _rhs_index.get(); | |
| 5153 | ✗ | } else if (_lhs_index) { | |
| 5154 | ✗ | LOG(Error, "Seems like some of the 'LdRngLim' for FluidSys '" << plantName << "' are missing the 'index' attribute."); | |
| 5155 | ✗ | return true; | |
| 5156 | } else { | ||
| 5157 | ✗ | LOG(Error, "Seems like some of the 'LdRngLim' for FluidSys '" << plantName << "' are missing the 'index' attribute."); | |
| 5158 | ✗ | return false; | |
| 5159 | } | ||
| 5160 | 5 | }; | |
| 5161 | |||
| 5162 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::vector<pugi::xml_node> ldRngLimElements = makeVectorOfChildren(fluidSysElement, "LdRngLim"); |
| 5163 | // Sort by their index attribute | ||
| 5164 |
1/1✓ Branch 3 taken 5 times.
|
5 | std::sort(ldRngLimElements.begin(), ldRngLimElements.end(), sortByIndex); |
| 5165 | |||
| 5166 | // Get the range limits | ||
| 5167 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 5 times.
|
5 | for (const pugi::xml_node& rngElement : ldRngLimElements) { |
| 5168 | ✗ | boost::optional<double> _value = lexicalCastToDouble(rngElement); | |
| 5169 | ✗ | if (_value) { | |
| 5170 | ✗ | double value = unitToUnit(_value.get(), "Btu/h", "W").get(); | |
| 5171 | ✗ | ldRngLims.push_back(value); | |
| 5172 | } | ||
| 5173 | } | ||
| 5174 | |||
| 5175 | // Try to get an equipment list for each load range | ||
| 5176 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
|
5 | for (std::vector<double>::size_type i = 0; i < ldRngLims.size(); ++i) { |
| 5177 | // Create a tag like 'EqpList1Name' | ||
| 5178 | ✗ | std::string nodeName = "EqpList" + openstudio::string_conversions::number(std::int32_t(i + 1)) + "Name"; | |
| 5179 | |||
| 5180 | // Get the correspond children | ||
| 5181 | ✗ | std::vector<pugi::xml_node> eqpListNameElements = makeVectorOfChildren(fluidSysElement, nodeName.c_str()); | |
| 5182 | |||
| 5183 | ✗ | if (eqpListNameElements.empty()) { | |
| 5184 | ✗ | LOG(Debug, "Couldn't find any '" << nodeName << "' for FluidSys '" << plantName << "'."); | |
| 5185 | } | ||
| 5186 | |||
| 5187 | // Create the plantEquipmentList, regardless of whether we found equipment to put on it | ||
| 5188 | // (assume if not there, means there's no equipment which is fine) | ||
| 5189 | ✗ | EquipmentList equipmentList; | |
| 5190 | |||
| 5191 | // Sort them by index too so we push them in the right order | ||
| 5192 | ✗ | std::sort(eqpListNameElements.begin(), eqpListNameElements.end(), sortByIndex); | |
| 5193 | |||
| 5194 | ✗ | for (const auto& eqpListNameElement : eqpListNameElements) { | |
| 5195 | ✗ | equipmentList.push_back(eqpListNameElement.text().as_string()); | |
| 5196 | } | ||
| 5197 | |||
| 5198 | // Push the equipment list for that range to the vector | ||
| 5199 | ✗ | equipmentLists.push_back(equipmentList); | |
| 5200 | ✗ | } | |
| 5201 | |||
| 5202 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
|
5 | if (!ldRngLims.empty()) { |
| 5203 | ✗ | auto allPlantComponents = plantLoop.supplyComponents(); | |
| 5204 | |||
| 5205 | ✗ | OS_ASSERT(ldRngLims.size() == equipmentLists.size()); | |
| 5206 | |||
| 5207 | ✗ | boost::optional<model::PlantEquipmentOperationRangeBasedScheme> scheme; | |
| 5208 | |||
| 5209 | ✗ | if (istringEqual(typeElement.text().as_string(), "ChilledWater")) { | |
| 5210 | ✗ | model::PlantEquipmentOperationCoolingLoad coolingScheme(model); | |
| 5211 | ✗ | coolingScheme.setName(plantLoop.nameString() + " cooling operation scheme"); | |
| 5212 | ✗ | scheme = coolingScheme; | |
| 5213 | ✗ | plantLoop.setPlantEquipmentOperationCoolingLoad(coolingScheme); | |
| 5214 | ✗ | } else if (istringEqual(typeElement.text().as_string(), "HotWater")) { | |
| 5215 | ✗ | model::PlantEquipmentOperationHeatingLoad heatingScheme(model); | |
| 5216 | ✗ | heatingScheme.setName(plantLoop.nameString() + " heating operation scheme"); | |
| 5217 | ✗ | scheme = heatingScheme; | |
| 5218 | ✗ | plantLoop.setPlantEquipmentOperationHeatingLoad(heatingScheme); | |
| 5219 | ✗ | } | |
| 5220 | |||
| 5221 | ✗ | if (scheme) { | |
| 5222 | ✗ | for (std::vector<double>::size_type i = 0; i < ldRngLims.size(); ++i) { | |
| 5223 | ✗ | std::vector<model::HVACComponent> equipment; | |
| 5224 | ✗ | auto ldRngLim = ldRngLims[i]; | |
| 5225 | ✗ | auto equipmentList = equipmentLists[i]; | |
| 5226 | |||
| 5227 | ✗ | for (auto& name : equipmentList) { | |
| 5228 | ✗ | for (const auto& comp : allPlantComponents) { | |
| 5229 | ✗ | if (istringEqual(name, comp.nameString())) { | |
| 5230 | ✗ | equipment.push_back(comp.cast<model::HVACComponent>()); | |
| 5231 | ✗ | break; | |
| 5232 | } | ||
| 5233 | } | ||
| 5234 | } | ||
| 5235 | |||
| 5236 | ✗ | if (i == (ldRngLims.size() - 1)) { | |
| 5237 | ✗ | scheme->addLoadRange(1E8, equipment); | |
| 5238 | } else { | ||
| 5239 | ✗ | scheme->addLoadRange(ldRngLim, equipment); | |
| 5240 | } | ||
| 5241 | ✗ | } | |
| 5242 | } | ||
| 5243 | ✗ | } | |
| 5244 | |||
| 5245 | // Thermal Energy Storage needs special operation schemes | ||
| 5246 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 4 times.
|
5 | if (thermalStorage) { |
| 5247 | // The end result should be three operations schemes | ||
| 5248 | // charging and standby, discharging, charging | ||
| 5249 | |||
| 5250 | // plantLoop.plantEquipmentOperationCoolingLoad would exist because of load range spec in the SDD file | ||
| 5251 | // Or in other words standbyScheme would be the SDD controlled scheme, translated before this point | ||
| 5252 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto standbyScheme = plantLoop.plantEquipmentOperationCoolingLoad(); |
| 5253 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (!standbyScheme) { |
| 5254 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | standbyScheme = model::PlantEquipmentOperationCoolingLoad(model); |
| 5255 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | standbyScheme->setName(plantLoop.nameString() + " TES Standby Scheme"); |
| 5256 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | plantLoop.setPlantEquipmentOperationCoolingLoad(standbyScheme.get()); |
| 5257 |
2/2✓ Branch 4 taken 3 times.
✓ Branch 5 taken 1 time.
|
4 | for (const auto& chillerItem : enableOnThrmlEngyStorDischargeMap) { |
| 5258 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | standbyScheme->addEquipment(chillerItem.first.cast<model::HVACComponent>()); |
| 5259 | } | ||
| 5260 | } | ||
| 5261 | |||
| 5262 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
|
1 | OS_ASSERT(standbyScheme); |
| 5263 | |||
| 5264 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | auto dischargingScheme = standbyScheme->clone(model).cast<model::PlantEquipmentOperationCoolingLoad>(); |
| 5265 |
1/1✓ Branch 1 taken 1 time.
|
1 | plantLoop.setPrimaryPlantEquipmentOperationScheme(dischargingScheme); |
| 5266 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | dischargingScheme.setName(plantLoop.nameString() + " TES Discharging Scheme"); |
| 5267 | // Need to make sure that each chiller is allowed for discharge | ||
| 5268 | // Remove it from the scheme if not enabled for discharge | ||
| 5269 | // (We will readd it after the storage) | ||
| 5270 |
2/2✓ Branch 5 taken 3 times.
✓ Branch 6 taken 1 time.
|
4 | for (const auto& chillerItem : enableOnThrmlEngyStorDischargeMap) { |
| 5271 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 time.
|
3 | if (!chillerItem.second) { |
| 5272 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | dischargingScheme.removeEquipment(chillerItem.first.cast<model::HVACComponent>()); |
| 5273 | } | ||
| 5274 | } | ||
| 5275 | |||
| 5276 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 time.
|
2 | if (istringEqual(thermalStorageDischargePriority, "Chiller")) { |
| 5277 | ✗ | dischargingScheme.addEquipment(thermalStorage.get()); | |
| 5278 | } else { | ||
| 5279 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto upperLimit = dischargingScheme.maximumUpperLimit(); |
| 5280 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto equipment = dischargingScheme.equipment(upperLimit); |
| 5281 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 6 taken 1 time.
|
1 | equipment.insert(equipment.begin(), thermalStorage.get()); |
| 5282 |
1/1✓ Branch 1 taken 1 time.
|
1 | dischargingScheme.replaceEquipment(upperLimit, equipment); |
| 5283 | 1 | } | |
| 5284 | |||
| 5285 | // Add / readd the disabled chillers after the storage | ||
| 5286 |
2/2✓ Branch 5 taken 3 times.
✓ Branch 6 taken 1 time.
|
4 | for (const auto& chillerItem : enableOnThrmlEngyStorDischargeMap) { |
| 5287 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 time.
|
3 | if (!chillerItem.second) { |
| 5288 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | dischargingScheme.addEquipment(chillerItem.first.cast<model::HVACComponent>()); |
| 5289 | } | ||
| 5290 | } | ||
| 5291 | |||
| 5292 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (tesSchedule) { |
| 5293 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | auto chillers = subsetCastVector<model::ChillerElectricEIR>(plantLoop.supplyComponents(model::ChillerElectricEIR::iddObjectType())); |
| 5294 |
2/2✓ Branch 5 taken 3 times.
✓ Branch 6 taken 1 time.
|
4 | for (auto& chiller : chillers) { |
| 5295 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | model::SetpointManagerScheduled spm(model, tesSchedule.get()); |
| 5296 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | auto node = chiller.supplyOutletModelObject()->cast<model::Node>(); |
| 5297 |
1/1✓ Branch 1 taken 3 times.
|
3 | spm.addToNode(node); |
| 5298 | 3 | } | |
| 5299 | 1 | } | |
| 5300 | 1 | } | |
| 5301 | |||
| 5302 | // TempCtrl | ||
| 5303 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node tempCtrlElement = fluidSysElement.child("TempCtrl"); |
| 5304 | |||
| 5305 | // Fixed | ||
| 5306 |
6/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 17 taken 5 times.
✗ Branch 18 not taken.
|
15 | if (istringEqual(tempCtrlElement.text().as_string(), "Fixed")) { |
| 5307 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node fixedSupTempElement = fluidSysElement.child("FixedSupTemp"); |
| 5308 | |||
| 5309 | 5 | double fixedSupTemp = 21.1; | |
| 5310 | |||
| 5311 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _fixedSupTemp = lexicalCastToDouble(fixedSupTempElement); |
| 5312 | |||
| 5313 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_fixedSupTemp) { |
| 5314 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
|
20 | fixedSupTemp = unitToUnit(_fixedSupTemp.get(), "F", "C").get(); |
| 5315 | } else { | ||
| 5316 | ✗ | pugi::xml_node dsgnSupWtrTempElement = fluidSysElement.child("DsgnSupWtrTemp"); | |
| 5317 | ✗ | boost::optional<double> _dsgnSupWtrTemp = lexicalCastToDouble(dsgnSupWtrTempElement); | |
| 5318 | ✗ | if (_dsgnSupWtrTemp) { | |
| 5319 | ✗ | fixedSupTemp = unitToUnit(_dsgnSupWtrTemp.get(), "F", "C").get(); | |
| 5320 | |||
| 5321 | ✗ | LOG(Warn, plantLoop.name().get() << " Using DsgnSupWtrTemp for fixed supply temperature"); | |
| 5322 | } else { | ||
| 5323 | ✗ | LOG(Error, plantLoop.name().get() << " Control type is fixed, but a valid temperature was not provided"); | |
| 5324 | } | ||
| 5325 | } | ||
| 5326 | |||
| 5327 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::ScheduleRuleset schedule(model); |
| 5328 | |||
| 5329 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | schedule.setName(plantLoop.name().get() + " Supply Temp Schedule"); |
| 5330 | |||
| 5331 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::ScheduleDay scheduleDay = schedule.defaultDaySchedule(); |
| 5332 | |||
| 5333 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | scheduleDay.addValue(Time(1.0), fixedSupTemp); |
| 5334 | |||
| 5335 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::SetpointManagerScheduled spm(model, schedule); |
| 5336 | |||
| 5337 |
1/1✓ Branch 1 taken 5 times.
|
5 | spm.addToNode(supplyOutletNode); |
| 5338 |
0/7✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
|
5 | } else if (istringEqual(tempCtrlElement.text().as_string(), "Scheduled")) { |
| 5339 | ✗ | pugi::xml_node tempSetPtSchRefElement = fluidSysElement.child("TempSetptSchRef"); | |
| 5340 | |||
| 5341 | ✗ | boost::optional<model::Schedule> schedule = model.getModelObjectByName<model::Schedule>(tempSetPtSchRefElement.text().as_string()); | |
| 5342 | |||
| 5343 | ✗ | if (!schedule) { | |
| 5344 | ✗ | LOG(Error, plantLoop.name().get() << " Control type is scheduled, but a valid schedule could not be found."); | |
| 5345 | |||
| 5346 | ✗ | model::ScheduleRuleset schedule(model); | |
| 5347 | |||
| 5348 | ✗ | schedule.setName(plantLoop.name().get() + " Supply Temp Schedule"); | |
| 5349 | |||
| 5350 | ✗ | model::ScheduleDay scheduleDay = schedule.defaultDaySchedule(); | |
| 5351 | |||
| 5352 | ✗ | scheduleDay.addValue(Time(1.0), 21.1); | |
| 5353 | ✗ | } | |
| 5354 | |||
| 5355 | ✗ | model::SetpointManagerScheduled spm(model, schedule.get()); | |
| 5356 | |||
| 5357 | ✗ | spm.addToNode(supplyOutletNode); | |
| 5358 | ✗ | } else if (istringEqual(tempCtrlElement.text().as_string(), "WetBulbReset")) { | |
| 5359 | ✗ | model::SetpointManagerFollowOutdoorAirTemperature spm(model); | |
| 5360 | |||
| 5361 | ✗ | spm.setReferenceTemperatureType("OutdoorAirWetBulb"); | |
| 5362 | |||
| 5363 | ✗ | spm.addToNode(supplyOutletNode); | |
| 5364 | |||
| 5365 | ✗ | boost::optional<double> rstSupHi; | |
| 5366 | ✗ | boost::optional<double> rstSupLow; | |
| 5367 | |||
| 5368 | // RstSupHi | ||
| 5369 | ✗ | pugi::xml_node rstSupHiElement = fluidSysElement.child("RstSupHi"); | |
| 5370 | ✗ | boost::optional<double> _rstSupHi = lexicalCastToDouble(rstSupHiElement); | |
| 5371 | ✗ | if (_rstSupHi) { | |
| 5372 | ✗ | rstSupHi = unitToUnit(_rstSupHi.get(), "F", "C").get(); | |
| 5373 | } | ||
| 5374 | |||
| 5375 | // RstSupLow | ||
| 5376 | ✗ | pugi::xml_node rstSupLoElement = fluidSysElement.child("RstSupLow"); | |
| 5377 | ✗ | boost::optional<double> _rstSupLo = lexicalCastToDouble(rstSupLoElement); | |
| 5378 | ✗ | if (_rstSupLo) { | |
| 5379 | ✗ | rstSupLow = unitToUnit(_rstSupLo.get(), "F", "C").get(); | |
| 5380 | } | ||
| 5381 | |||
| 5382 | ✗ | if (rstSupLow && rstSupHi) { | |
| 5383 | ✗ | spm.setMinimumSetpointTemperature(rstSupLow.get()); | |
| 5384 | |||
| 5385 | ✗ | spm.setMaximumSetpointTemperature(rstSupHi.get()); | |
| 5386 | } | ||
| 5387 | |||
| 5388 | // WetBulbApproach | ||
| 5389 | ✗ | pugi::xml_node wetBulbApproachElement = fluidSysElement.child("WetBulbApproach"); | |
| 5390 | ✗ | boost::optional<double> _wetBulbApproach = lexicalCastToDouble(wetBulbApproachElement); | |
| 5391 | ✗ | if (_wetBulbApproach) { | |
| 5392 | ✗ | spm.setOffsetTemperatureDifference(_wetBulbApproach.get() * 5.0 / 9.0); | |
| 5393 | } | ||
| 5394 | ✗ | } else if (istringEqual(tempCtrlElement.text().as_string(), "OutsideAirReset")) { | |
| 5395 | ✗ | model::SetpointManagerOutdoorAirReset spm(model); | |
| 5396 | |||
| 5397 | ✗ | spm.addToNode(supplyOutletNode); | |
| 5398 | |||
| 5399 | ✗ | boost::optional<double> rstSupHi; | |
| 5400 | ✗ | boost::optional<double> rstSupLow; | |
| 5401 | ✗ | boost::optional<double> rstOutdrHi; | |
| 5402 | ✗ | boost::optional<double> rstOutdrLow; | |
| 5403 | |||
| 5404 | // RstSupHi | ||
| 5405 | ✗ | pugi::xml_node rstSupHiElement = fluidSysElement.child("RstSupHi"); | |
| 5406 | ✗ | boost::optional<double> _rstSupHi = lexicalCastToDouble(rstSupHiElement); | |
| 5407 | ✗ | if (_rstSupHi) { | |
| 5408 | ✗ | rstSupHi = unitToUnit(_rstSupHi.get(), "F", "C").get(); | |
| 5409 | } | ||
| 5410 | |||
| 5411 | // RstSupLow | ||
| 5412 | ✗ | pugi::xml_node rstSupLoElement = fluidSysElement.child("RstSupLow"); | |
| 5413 | ✗ | boost::optional<double> _rstSupLo = lexicalCastToDouble(rstSupLoElement); | |
| 5414 | ✗ | if (_rstSupLo) { | |
| 5415 | ✗ | rstSupLow = unitToUnit(_rstSupLo.get(), "F", "C").get(); | |
| 5416 | } | ||
| 5417 | |||
| 5418 | // RstOutdrHi | ||
| 5419 | ✗ | pugi::xml_node rstOutDrHiElement = fluidSysElement.child("RstOutdrHi"); | |
| 5420 | ✗ | boost::optional<double> _rstOutDrHi = lexicalCastToDouble(rstOutDrHiElement); | |
| 5421 | ✗ | if (_rstOutDrHi) { | |
| 5422 | ✗ | rstOutdrHi = unitToUnit(_rstOutDrHi.get(), "F", "C").get(); | |
| 5423 | } | ||
| 5424 | |||
| 5425 | // RstOutdrLow | ||
| 5426 | ✗ | pugi::xml_node rstOutDrLoElement = fluidSysElement.child("RstOutdrLow"); | |
| 5427 | ✗ | boost::optional<double> _rstOutDrLo = lexicalCastToDouble(rstOutDrLoElement); | |
| 5428 | ✗ | if (_rstOutDrLo) { | |
| 5429 | ✗ | rstOutdrLow = unitToUnit(_rstOutDrLo.get(), "F", "C").get(); | |
| 5430 | } | ||
| 5431 | |||
| 5432 | ✗ | if (rstSupHi && rstSupLow && rstOutdrHi && rstOutdrLow) { | |
| 5433 | ✗ | if (rstOutdrHi > rstOutdrLow) { | |
| 5434 | ✗ | spm.setOutdoorHighTemperature(rstOutdrHi.get()); | |
| 5435 | ✗ | spm.setSetpointatOutdoorHighTemperature(rstSupHi.get()); | |
| 5436 | ✗ | spm.setOutdoorLowTemperature(rstOutdrLow.get()); | |
| 5437 | ✗ | spm.setSetpointatOutdoorLowTemperature(rstSupLow.get()); | |
| 5438 | } else { | ||
| 5439 | ✗ | spm.setOutdoorHighTemperature(rstOutdrLow.get()); | |
| 5440 | ✗ | spm.setSetpointatOutdoorHighTemperature(rstSupLow.get()); | |
| 5441 | ✗ | spm.setOutdoorLowTemperature(rstOutdrHi.get()); | |
| 5442 | ✗ | spm.setSetpointatOutdoorLowTemperature(rstSupHi.get()); | |
| 5443 | } | ||
| 5444 | } else { | ||
| 5445 | ✗ | LOG(Warn, plantName << " requests OA reset control, but does not define setpoints." << " Using OpenStudio defaults."); | |
| 5446 | } | ||
| 5447 | ✗ | } else if (istringEqual(tempCtrlElement.text().as_string(), "LoadReset")) { | |
| 5448 | ✗ | pugi::xml_node dsgnSupWtrTempElement = fluidSysElement.child("DsgnSupWtrTemp"); | |
| 5449 | ✗ | boost::optional<double> _dsgnSupWtrTemp = lexicalCastToDouble(dsgnSupWtrTempElement); | |
| 5450 | ✗ | if (_dsgnSupWtrTemp) { | |
| 5451 | ✗ | double value = unitToUnit(_dsgnSupWtrTemp.get(), "F", "C").get(); | |
| 5452 | |||
| 5453 | ✗ | model::ScheduleRuleset schedule(model); | |
| 5454 | |||
| 5455 | ✗ | schedule.setName(plantLoop.name().get() + " Supply Temp Schedule"); | |
| 5456 | |||
| 5457 | ✗ | model::ScheduleDay scheduleDay = schedule.defaultDaySchedule(); | |
| 5458 | |||
| 5459 | ✗ | scheduleDay.addValue(Time(1.0), value); | |
| 5460 | |||
| 5461 | ✗ | model::SetpointManagerScheduled spm(model, schedule); | |
| 5462 | |||
| 5463 | ✗ | spm.addToNode(supplyOutletNode); | |
| 5464 | |||
| 5465 | ✗ | LOG(Warn, | |
| 5466 | plantLoop.name().get() << " Using DsgnSupWtrTemp for LoadReset temperature control. This control scheme is not fully implemented."); | ||
| 5467 | ✗ | } else { | |
| 5468 | ✗ | LOG(Error, plantLoop.name().get() << " no setpoint for LoadReset temperature control."); | |
| 5469 | } | ||
| 5470 | ✗ | } else if (istringEqual(tempCtrlElement.text().as_string(), "FixedDualSetpoint")) { | |
| 5471 | // It would be better to use setpoint manager dual setpoint, but | ||
| 5472 | // until it is available we use component setpoint operation and but | ||
| 5473 | // scheduled SPMs on the heating and cooling components. | ||
| 5474 | |||
| 5475 | ✗ | pugi::xml_node fixedSupTempElement = fluidSysElement.child("FixedSupTemp"); | |
| 5476 | ✗ | double fixedSupTemp = 10.0; | |
| 5477 | ✗ | boost::optional<double> _fixedSupTemp = lexicalCastToDouble(fixedSupTempElement); | |
| 5478 | ✗ | if (_fixedSupTemp) { | |
| 5479 | ✗ | fixedSupTemp = unitToUnit(_fixedSupTemp.get(), "F", "C").get(); | |
| 5480 | } | ||
| 5481 | |||
| 5482 | ✗ | pugi::xml_node htgFixedSupTempElement = fluidSysElement.child("HtgFixedSupTemp"); | |
| 5483 | ✗ | double htgFixedSupTemp = 26.7; | |
| 5484 | ✗ | boost::optional<double> _htgFixedSupTemp = lexicalCastToDouble(htgFixedSupTempElement); | |
| 5485 | ✗ | if (_htgFixedSupTemp) { | |
| 5486 | ✗ | htgFixedSupTemp = unitToUnit(_htgFixedSupTemp.get(), "F", "C").get(); | |
| 5487 | } | ||
| 5488 | |||
| 5489 | ✗ | model::ScheduleRuleset schedule(model); | |
| 5490 | ✗ | schedule.setName(plantLoop.name().get() + " Supply Temp Schedule"); | |
| 5491 | ✗ | model::ScheduleDay scheduleDay = schedule.defaultDaySchedule(); | |
| 5492 | ✗ | scheduleDay.addValue(Time(1.0), fixedSupTemp); | |
| 5493 | |||
| 5494 | ✗ | model::ScheduleRuleset heatingSchedule(model); | |
| 5495 | ✗ | heatingSchedule.setName(plantLoop.name().get() + " Heating Supply Temp Schedule"); | |
| 5496 | ✗ | model::ScheduleDay heatingScheduleDay = heatingSchedule.defaultDaySchedule(); | |
| 5497 | ✗ | heatingScheduleDay.addValue(Time(1.0), htgFixedSupTemp); | |
| 5498 | |||
| 5499 | ✗ | model::SetpointManagerScheduled spm(model, schedule); | |
| 5500 | ✗ | spm.setName(plantLoop.name().get() + " Supply Outlet SPM"); | |
| 5501 | ✗ | spm.addToNode(supplyOutletNode); | |
| 5502 | |||
| 5503 | // "Heating" components | ||
| 5504 | std::vector<model::BoilerHotWater> boilers = | ||
| 5505 | ✗ | subsetCastVector<model::BoilerHotWater>(plantLoop.supplyComponents(model::BoilerHotWater::iddObjectType())); | |
| 5506 | ✗ | for (auto it = boilers.begin(); it != boilers.end(); ++it) { | |
| 5507 | ✗ | boost::optional<model::ModelObject> mo = it->outletModelObject(); | |
| 5508 | ✗ | OS_ASSERT(mo); | |
| 5509 | ✗ | boost::optional<model::Node> node = mo->optionalCast<model::Node>(); | |
| 5510 | ✗ | OS_ASSERT(node); | |
| 5511 | |||
| 5512 | ✗ | model::SetpointManagerScheduled spm2(model, heatingSchedule); | |
| 5513 | ✗ | spm2.setName(it->name().get() + " SPM"); | |
| 5514 | ✗ | spm2.addToNode(node.get()); | |
| 5515 | ✗ | } | |
| 5516 | |||
| 5517 | std::vector<model::WaterHeaterMixed> waterHeaters = | ||
| 5518 | ✗ | subsetCastVector<model::WaterHeaterMixed>(plantLoop.supplyComponents(model::WaterHeaterMixed::iddObjectType())); | |
| 5519 | ✗ | for (auto it = waterHeaters.begin(); it != waterHeaters.end(); ++it) { | |
| 5520 | ✗ | boost::optional<model::ModelObject> mo = it->supplyOutletModelObject(); | |
| 5521 | ✗ | OS_ASSERT(mo); | |
| 5522 | ✗ | boost::optional<model::Node> node = mo->optionalCast<model::Node>(); | |
| 5523 | ✗ | OS_ASSERT(node); | |
| 5524 | |||
| 5525 | ✗ | model::SetpointManagerScheduled spm2(model, heatingSchedule); | |
| 5526 | ✗ | spm2.setName(it->name().get() + " SPM"); | |
| 5527 | ✗ | spm2.addToNode(node.get()); | |
| 5528 | ✗ | } | |
| 5529 | |||
| 5530 | // "Cooling" components | ||
| 5531 | std::vector<model::ChillerElectricEIR> chillers = | ||
| 5532 | ✗ | subsetCastVector<model::ChillerElectricEIR>(plantLoop.supplyComponents(model::ChillerElectricEIR::iddObjectType())); | |
| 5533 | ✗ | for (auto it = chillers.begin(); it != chillers.end(); ++it) { | |
| 5534 | ✗ | boost::optional<model::ModelObject> mo = it->supplyOutletModelObject(); | |
| 5535 | ✗ | OS_ASSERT(mo); | |
| 5536 | ✗ | boost::optional<model::Node> node = mo->optionalCast<model::Node>(); | |
| 5537 | ✗ | OS_ASSERT(node); | |
| 5538 | |||
| 5539 | ✗ | model::SetpointManagerScheduled spm2(model, schedule); | |
| 5540 | ✗ | spm2.setName(it->name().get() + " SPM"); | |
| 5541 | ✗ | spm2.addToNode(node.get()); | |
| 5542 | ✗ | } | |
| 5543 | |||
| 5544 | std::vector<model::CoolingTowerVariableSpeed> variableTowers = | ||
| 5545 | ✗ | subsetCastVector<model::CoolingTowerVariableSpeed>(plantLoop.supplyComponents(model::CoolingTowerVariableSpeed::iddObjectType())); | |
| 5546 | ✗ | for (auto it = variableTowers.begin(); it != variableTowers.end(); ++it) { | |
| 5547 | ✗ | boost::optional<model::ModelObject> mo = it->outletModelObject(); | |
| 5548 | ✗ | OS_ASSERT(mo); | |
| 5549 | ✗ | boost::optional<model::Node> node = mo->optionalCast<model::Node>(); | |
| 5550 | ✗ | OS_ASSERT(node); | |
| 5551 | |||
| 5552 | ✗ | model::SetpointManagerScheduled spm2(model, schedule); | |
| 5553 | ✗ | spm2.setName(it->name().get() + " SPM"); | |
| 5554 | ✗ | spm2.addToNode(node.get()); | |
| 5555 | ✗ | } | |
| 5556 | |||
| 5557 | std::vector<model::CoolingTowerSingleSpeed> constantTowers = | ||
| 5558 | ✗ | subsetCastVector<model::CoolingTowerSingleSpeed>(plantLoop.supplyComponents(model::CoolingTowerSingleSpeed::iddObjectType())); | |
| 5559 | ✗ | for (auto it = constantTowers.begin(); it != constantTowers.end(); ++it) { | |
| 5560 | ✗ | boost::optional<model::ModelObject> mo = it->outletModelObject(); | |
| 5561 | ✗ | OS_ASSERT(mo); | |
| 5562 | ✗ | boost::optional<model::Node> node = mo->optionalCast<model::Node>(); | |
| 5563 | ✗ | OS_ASSERT(node); | |
| 5564 | |||
| 5565 | ✗ | model::SetpointManagerScheduled spm2(model, schedule); | |
| 5566 | ✗ | spm2.setName(it->name().get() + " SPM"); | |
| 5567 | ✗ | spm2.addToNode(node.get()); | |
| 5568 | ✗ | } | |
| 5569 | ✗ | } else { | |
| 5570 | ✗ | LOG(Error, plantLoop.name().get() << " does not have a setpoint."); | |
| 5571 | } | ||
| 5572 | |||
| 5573 |
1/1✓ Branch 1 taken 5 times.
|
5 | return plantLoop; |
| 5574 | 5 | } | |
| 5575 | |||
| 5576 | 7 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translatePump(const pugi::xml_node& pumpElement, | |
| 5577 | openstudio::model::Model& model) { | ||
| 5578 | 7 | boost::optional<openstudio::model::ModelObject> result; | |
| 5579 | |||
| 5580 |
5/6✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✓ Branch 10 taken 7 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 7 times.
|
28 | if (!istringEqual(pumpElement.name(), "Pump")) { |
| 5581 | ✗ | return result; | |
| 5582 | } | ||
| 5583 | |||
| 5584 | 7 | boost::optional<double> mtrEff; | |
| 5585 | 7 | boost::optional<double> totHd; | |
| 5586 | 7 | boost::optional<double> flowCap; | |
| 5587 | 7 | boost::optional<double> pwr; | |
| 5588 | |||
| 5589 |
3/3✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
|
7 | const auto* pumpName = pumpElement.child("Name").text().as_string(); |
| 5590 | |||
| 5591 |
1/1✓ Branch 1 taken 7 times.
|
7 | pugi::xml_node mtrEffElement = pumpElement.child("MtrEff"); |
| 5592 |
1/1✓ Branch 1 taken 7 times.
|
7 | boost::optional<double> _mtrEff = lexicalCastToDouble(mtrEffElement); |
| 5593 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if (_mtrEff) { |
| 5594 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | mtrEff = _mtrEff.get(); |
| 5595 | } | ||
| 5596 | |||
| 5597 |
1/1✓ Branch 1 taken 7 times.
|
7 | pugi::xml_node totHdElement = pumpElement.child("TotHd"); |
| 5598 |
1/1✓ Branch 1 taken 7 times.
|
7 | boost::optional<double> _totHd = lexicalCastToDouble(totHdElement); |
| 5599 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if (_totHd) { |
| 5600 | // ft water to Pa | ||
| 5601 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | totHd = _totHd.get() * 2989.067; |
| 5602 | } | ||
| 5603 | |||
| 5604 |
1/1✓ Branch 1 taken 7 times.
|
7 | pugi::xml_node flowCapElement = pumpElement.child("FlowCapSim"); |
| 5605 |
1/1✓ Branch 1 taken 7 times.
|
7 | boost::optional<double> _flowCap = lexicalCastToDouble(flowCapElement); |
| 5606 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if (_flowCap) { |
| 5607 |
6/6✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✓ Branch 10 taken 7 times.
✓ Branch 13 taken 7 times.
✓ Branch 16 taken 7 times.
|
28 | flowCap = unitToUnit(_flowCap.get(), "gal/min", "m^3/s").get(); |
| 5608 | } | ||
| 5609 | |||
| 5610 |
1/1✓ Branch 1 taken 7 times.
|
7 | pugi::xml_node pwrElement = pumpElement.child("PwrSim"); |
| 5611 |
1/1✓ Branch 1 taken 7 times.
|
7 | boost::optional<double> _pwr = lexicalCastToDouble(pwrElement); |
| 5612 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if (_pwr) { |
| 5613 | // kW to W | ||
| 5614 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | pwr = _pwr.get() * 1000.0; |
| 5615 | } | ||
| 5616 | |||
| 5617 |
1/1✓ Branch 1 taken 7 times.
|
7 | pugi::xml_node spdCtrlElement = pumpElement.child("SpdCtrl"); |
| 5618 |
7/7✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✓ Branch 10 taken 7 times.
✓ Branch 13 taken 7 times.
✓ Branch 17 taken 5 times.
✓ Branch 18 taken 2 times.
|
21 | if (openstudio::istringEqual(spdCtrlElement.text().as_string(), "constantspeed")) { |
| 5619 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::PumpConstantSpeed pump(model); |
| 5620 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
10 | pump.setName(pumpName); |
| 5621 | |||
| 5622 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (mtrEff) { |
| 5623 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | pump.setMotorEfficiency(mtrEff.get()); |
| 5624 | } | ||
| 5625 | |||
| 5626 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (totHd) { |
| 5627 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | pump.setRatedPumpHead(totHd.get()); |
| 5628 | } | ||
| 5629 | |||
| 5630 |
2/3✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
|
5 | if (autosize()) { |
| 5631 | ✗ | if (!totHd) { | |
| 5632 | ✗ | pump.setRatedPumpHead(149453.0); | |
| 5633 | ✗ | LOG(Warn, pump.name().get() << " TotHd set to OpenStudio default"); | |
| 5634 | } | ||
| 5635 | } else { | ||
| 5636 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (flowCap) { |
| 5637 |
2/3✓ Branch 2 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5 times.
|
5 | if (equal(flowCap.get(), 0.0)) { |
| 5638 | ✗ | LOG(Warn, pump.name().get() << " has 0 capacity specified."); | |
| 5639 | } | ||
| 5640 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | pump.setRatedFlowRate(flowCap.get()); |
| 5641 | } | ||
| 5642 | |||
| 5643 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (pwr) { |
| 5644 |
2/3✓ Branch 2 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5 times.
|
5 | if (equal(pwr.get(), 0.0)) { |
| 5645 | ✗ | LOG(Warn, pump.name().get() << " has 0 pwr specified."); | |
| 5646 | } | ||
| 5647 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | pump.setRatedPowerConsumption(pwr.get()); |
| 5648 | } | ||
| 5649 | |||
| 5650 |
4/8✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 5 times.
|
10 | if (flowCap && pwr && (!totHd)) { |
| 5651 | ✗ | pump.setRatedPumpHead(0.80 * pwr.get() / flowCap.get()); | |
| 5652 | ✗ | LOG(Warn, pump.name().get() << " TotHd set to OpenStudio default"); | |
| 5653 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
|
5 | } else if (!totHd) { |
| 5654 | ✗ | pump.setRatedPumpHead(149453.0); | |
| 5655 | ✗ | LOG(Warn, pump.name().get() << " TotHd set to OpenStudio default"); | |
| 5656 | } | ||
| 5657 | } | ||
| 5658 | |||
| 5659 |
1/1✓ Branch 1 taken 5 times.
|
5 | result = pump; |
| 5660 | 5 | } else { | |
| 5661 |
1/1✓ Branch 1 taken 2 times.
|
2 | model::PumpVariableSpeed pump(model); |
| 5662 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | pump.setName(pumpName); |
| 5663 | |||
| 5664 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (mtrEff) { |
| 5665 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | pump.setMotorEfficiency(mtrEff.get()); |
| 5666 | } | ||
| 5667 | |||
| 5668 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (totHd) { |
| 5669 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | pump.setRatedPumpHead(totHd.get()); |
| 5670 | } | ||
| 5671 | |||
| 5672 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
|
2 | if (autosize()) { |
| 5673 | ✗ | if (!totHd) { | |
| 5674 | ✗ | pump.setRatedPumpHead(149453.0); | |
| 5675 | ✗ | LOG(Warn, pump.name().get() << " TotHd set to OpenStudio default"); | |
| 5676 | } | ||
| 5677 | } else { | ||
| 5678 |
1/1✓ Branch 1 taken 2 times.
|
2 | pugi::xml_node flowMinElement = pumpElement.child("FlowMinSim"); |
| 5679 |
1/1✓ Branch 1 taken 2 times.
|
2 | boost::optional<double> _flowMin = lexicalCastToDouble(flowMinElement); |
| 5680 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (_flowMin) { |
| 5681 |
5/5✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
|
6 | auto flowMin = unitToUnit(_flowMin.get(), "gal/min", "m^3/s").get(); |
| 5682 |
1/1✓ Branch 1 taken 2 times.
|
2 | pump.setMinimumFlowRate(flowMin); |
| 5683 | } | ||
| 5684 | |||
| 5685 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (flowCap) { |
| 5686 |
2/3✓ Branch 2 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
|
2 | if (equal(flowCap.get(), 0.0)) { |
| 5687 | ✗ | LOG(Warn, pump.name().get() << " has 0 capacity specified."); | |
| 5688 | } | ||
| 5689 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | pump.setRatedFlowRate(flowCap.get()); |
| 5690 | } | ||
| 5691 | |||
| 5692 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (pwr) { |
| 5693 |
2/3✓ Branch 2 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
|
2 | if (equal(pwr.get(), 0.0)) { |
| 5694 | ✗ | LOG(Warn, pump.name().get() << " has 0 pwr specified."); | |
| 5695 | } | ||
| 5696 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | pump.setRatedPowerConsumption(pwr.get()); |
| 5697 | } | ||
| 5698 | |||
| 5699 |
4/8✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
|
4 | if (flowCap && pwr && (!totHd)) { |
| 5700 | ✗ | pump.setRatedPumpHead(0.80 * pwr.get() / flowCap.get()); | |
| 5701 | ✗ | LOG(Warn, pump.name().get() << " TotHd set to OpenStudio default"); | |
| 5702 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
|
2 | } else if (!totHd) { |
| 5703 | ✗ | pump.setRatedPumpHead(149453.0); | |
| 5704 | ✗ | LOG(Warn, pump.name().get() << " TotHd set to OpenStudio default"); | |
| 5705 | } | ||
| 5706 | } | ||
| 5707 | |||
| 5708 | // Pwr_fPLRCrvRef | ||
| 5709 | |||
| 5710 | 2 | boost::optional<model::CurveCubic> pwr_fPLRCrv; | |
| 5711 |
1/1✓ Branch 1 taken 2 times.
|
2 | pugi::xml_node pwr_fPLRCrvRefElement = pumpElement.child("Pwr_fPLRCrvRef"); |
| 5712 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | pwr_fPLRCrv = model.getConcreteModelObjectByName<model::CurveCubic>(pwr_fPLRCrvRefElement.text().as_string()); |
| 5713 | |||
| 5714 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (pwr_fPLRCrv) { |
| 5715 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | double c1 = pwr_fPLRCrv->coefficient1Constant(); |
| 5716 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | double c2 = pwr_fPLRCrv->coefficient2x(); |
| 5717 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | double c3 = pwr_fPLRCrv->coefficient3xPOW2(); |
| 5718 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | double c4 = pwr_fPLRCrv->coefficient4xPOW3(); |
| 5719 | |||
| 5720 |
1/1✓ Branch 1 taken 2 times.
|
2 | pump.setCoefficient1ofthePartLoadPerformanceCurve(c1); |
| 5721 |
1/1✓ Branch 1 taken 2 times.
|
2 | pump.setCoefficient2ofthePartLoadPerformanceCurve(c2); |
| 5722 |
1/1✓ Branch 1 taken 2 times.
|
2 | pump.setCoefficient3ofthePartLoadPerformanceCurve(c3); |
| 5723 |
1/1✓ Branch 1 taken 2 times.
|
2 | pump.setCoefficient4ofthePartLoadPerformanceCurve(c4); |
| 5724 | } | ||
| 5725 | |||
| 5726 | // TODO Figure out a way to set a more realistic minimum | ||
| 5727 |
8/8✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 17 taken 2 times.
✓ Branch 20 taken 2 times.
✓ Branch 23 taken 2 times.
|
2 | LOG(Warn, pump.name().get() << " ignores minimum flow specification from SDD, defaulting to 0."); |
| 5728 |
1/1✓ Branch 1 taken 2 times.
|
2 | pump.setMinimumFlowRate(0.0); |
| 5729 | |||
| 5730 |
1/1✓ Branch 1 taken 2 times.
|
2 | result = pump; |
| 5731 | 2 | } | |
| 5732 | |||
| 5733 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if (result) { |
| 5734 |
1/1✓ Branch 1 taken 7 times.
|
7 | pugi::xml_node nameElement = pumpElement.child("Name"); |
| 5735 | |||
| 5736 |
5/5✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✓ Branch 10 taken 7 times.
✓ Branch 13 taken 7 times.
|
14 | result->setName(nameElement.text().as_string()); |
| 5737 | } | ||
| 5738 | |||
| 5739 | 7 | return result; | |
| 5740 | ✗ | } | |
| 5741 | |||
| 5742 | 4 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateBoiler(const pugi::xml_node& boilerElement, | |
| 5743 | openstudio::model::Model& model) { | ||
| 5744 | 4 | boost::optional<openstudio::model::ModelObject> result; | |
| 5745 | |||
| 5746 |
5/6✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 4 times.
|
16 | if (!istringEqual(boilerElement.name(), "Blr")) { |
| 5747 | ✗ | return result; | |
| 5748 | } | ||
| 5749 | |||
| 5750 |
1/1✓ Branch 1 taken 4 times.
|
4 | model::BoilerHotWater boiler(model); |
| 5751 | |||
| 5752 | // Name | ||
| 5753 | |||
| 5754 |
1/1✓ Branch 1 taken 4 times.
|
4 | pugi::xml_node nameElement = boilerElement.child("Name"); |
| 5755 | |||
| 5756 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
4 | boiler.setName(nameElement.text().as_string()); |
| 5757 | |||
| 5758 | // ThrmlEff | ||
| 5759 | |||
| 5760 |
1/1✓ Branch 1 taken 4 times.
|
4 | pugi::xml_node thrmlEffElement = boilerElement.child("ThrmlEff"); |
| 5761 |
1/1✓ Branch 1 taken 4 times.
|
4 | boost::optional<double> _thrmlEff = lexicalCastToDouble(thrmlEffElement); |
| 5762 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (_thrmlEff) { |
| 5763 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | boiler.setNominalThermalEfficiency(_thrmlEff.get()); |
| 5764 | } | ||
| 5765 | |||
| 5766 | // HIR_fPLRCrvRef | ||
| 5767 | |||
| 5768 | 4 | boost::optional<model::Curve> hirfPLRCrv; | |
| 5769 |
1/1✓ Branch 1 taken 4 times.
|
4 | pugi::xml_node hirfPLRCrvRefElement = boilerElement.child("HIR_fPLRCrvRef"); |
| 5770 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
4 | hirfPLRCrv = model.getModelObjectByName<model::Curve>(hirfPLRCrvRefElement.text().as_string()); |
| 5771 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 time.
|
4 | if (hirfPLRCrv) { |
| 5772 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | boiler.setNormalizedBoilerEfficiencyCurve(hirfPLRCrv.get()); |
| 5773 | |||
| 5774 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 2 times.
|
6 | if (hirfPLRCrv->optionalCast<model::CurveBiquadratic>()) { |
| 5775 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | boiler.setEfficiencyCurveTemperatureEvaluationVariable("EnteringBoiler"); |
| 5776 | } else { | ||
| 5777 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | boiler.setEfficiencyCurveTemperatureEvaluationVariable("LeavingBoiler"); |
| 5778 | } | ||
| 5779 | } | ||
| 5780 | |||
| 5781 | // FuelSrc | ||
| 5782 | |||
| 5783 |
1/1✓ Branch 1 taken 4 times.
|
4 | pugi::xml_node fuelSrcElement = boilerElement.child("FuelSrc"); |
| 5784 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | std::string fuelSrc = fuelSrcElement.text().as_string(); |
| 5785 | |||
| 5786 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 3 times.
|
8 | if (openstudio::istringEqual(fuelSrc, "electric")) { |
| 5787 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | boiler.setFuelType("Electricity"); |
| 5788 |
3/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
|
6 | } else if (openstudio::istringEqual(fuelSrc, "gas")) { |
| 5789 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
6 | boiler.setFuelType("NaturalGas"); |
| 5790 | ✗ | } else if (openstudio::istringEqual(fuelSrc, "oil")) { | |
| 5791 | ✗ | boiler.setFuelType("FuelOilNo2"); | |
| 5792 | } | ||
| 5793 | |||
| 5794 | // ParasiticLd | ||
| 5795 | |||
| 5796 |
1/1✓ Branch 1 taken 4 times.
|
4 | pugi::xml_node parasiticLdElement = boilerElement.child("ParasiticLdSim"); |
| 5797 | |||
| 5798 |
1/1✓ Branch 1 taken 4 times.
|
4 | boost::optional<double> _parasiticLd = lexicalCastToDouble(parasiticLdElement); |
| 5799 | |||
| 5800 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
|
4 | if (_parasiticLd) { |
| 5801 |
6/6✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
|
8 | boiler.setOnCycleParasiticElectricLoad(unitToUnit(_parasiticLd.get(), "Btu/h", "W").get()); |
| 5802 | } | ||
| 5803 | |||
| 5804 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
4 | if (!autosize()) { |
| 5805 | // CapRtd | ||
| 5806 | 4 | boost::optional<double> capRtd; | |
| 5807 |
1/1✓ Branch 1 taken 4 times.
|
4 | pugi::xml_node capRtdElement = boilerElement.child("CapRtdSim"); |
| 5808 |
1/1✓ Branch 1 taken 4 times.
|
4 | boost::optional<double> _capRtd = lexicalCastToDouble(capRtdElement); |
| 5809 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (_capRtd) { |
| 5810 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
16 | capRtd = unitToUnit(_capRtd.get(), "Btu/h", "W"); |
| 5811 | } | ||
| 5812 | |||
| 5813 | // EntTempDsgn | ||
| 5814 | 4 | boost::optional<double> entTempDsgn; | |
| 5815 |
1/1✓ Branch 1 taken 4 times.
|
4 | pugi::xml_node entTempDsgnElement = boilerElement.child("EntTempDsgn"); |
| 5816 |
1/1✓ Branch 1 taken 4 times.
|
4 | boost::optional<double> _entTempDsgn = lexicalCastToDouble(entTempDsgnElement); |
| 5817 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (_entTempDsgn) { |
| 5818 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
16 | entTempDsgn = unitToUnit(_entTempDsgn.get(), "F", "C"); |
| 5819 | } | ||
| 5820 | |||
| 5821 | // LvgTempDsgn | ||
| 5822 | 4 | boost::optional<double> lvgTempDsgn; | |
| 5823 |
1/1✓ Branch 1 taken 4 times.
|
4 | pugi::xml_node lvgTempDsgnElement = boilerElement.child("LvgTempDsgn"); |
| 5824 |
1/1✓ Branch 1 taken 4 times.
|
4 | boost::optional<double> _lvgTempDsgn = lexicalCastToDouble(lvgTempDsgnElement); |
| 5825 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (_lvgTempDsgn) { |
| 5826 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
16 | lvgTempDsgn = unitToUnit(_lvgTempDsgn.get(), "F", "C"); |
| 5827 | } | ||
| 5828 | |||
| 5829 |
4/8✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
|
12 | if (capRtd && entTempDsgn && lvgTempDsgn) { |
| 5830 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | boiler.setNominalCapacity(capRtd.get()); |
| 5831 | |||
| 5832 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | double flow = capRtd.get() / (cpWater * densityWater * (lvgTempDsgn.get() - entTempDsgn.get())); |
| 5833 | |||
| 5834 |
1/1✓ Branch 1 taken 4 times.
|
4 | boiler.setDesignWaterFlowRate(flow); |
| 5835 | } | ||
| 5836 | } | ||
| 5837 | |||
| 5838 |
1/1✓ Branch 1 taken 4 times.
|
4 | return boiler; |
| 5839 | 4 | } | |
| 5840 | |||
| 5841 | 3 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateHtRej(const pugi::xml_node& htRejElement, | |
| 5842 | openstudio::model::Model& model) { | ||
| 5843 | 3 | boost::optional<openstudio::model::ModelObject> result; | |
| 5844 | |||
| 5845 |
5/6✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 3 times.
|
12 | if (!istringEqual(htRejElement.name(), "HtRej")) { |
| 5846 | ✗ | return result; | |
| 5847 | } | ||
| 5848 | |||
| 5849 | // ModCtrl | ||
| 5850 | |||
| 5851 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node modCtrlElement = htRejElement.child("ModCtrl"); |
| 5852 | |||
| 5853 |
6/7✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 17 taken 3 times.
✗ Branch 18 not taken.
|
9 | if (openstudio::istringEqual(modCtrlElement.text().as_string(), "VariableSpeedDrive")) { |
| 5854 |
1/1✓ Branch 1 taken 3 times.
|
3 | model::CoolingTowerVariableSpeed tower(model); |
| 5855 | |||
| 5856 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pugi::xml_node wetBulbApproachElement = htRejElement.parent().child("WetBulbApproach"); |
| 5857 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pugi::xml_node dsgnSupWtrTempElement = htRejElement.parent().child("DsgnSupWtrTemp"); |
| 5858 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pugi::xml_node dsgnSupWtrDelTElement = htRejElement.parent().child("DsgnSupWtrDelT"); |
| 5859 | |||
| 5860 | 3 | boost::optional<double> wetBulbApproach; | |
| 5861 | 3 | boost::optional<double> dsgnSupWtrTemp; | |
| 5862 | 3 | boost::optional<double> dsgnSupWtrDelT; | |
| 5863 | |||
| 5864 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _wetBulbApproach = lexicalCastToDouble(wetBulbApproachElement); |
| 5865 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (_wetBulbApproach) { |
| 5866 | ✗ | wetBulbApproach = _wetBulbApproach.get() * 5.0 / 9.0; | |
| 5867 | } | ||
| 5868 | |||
| 5869 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _dsgnSupWtrTemp = lexicalCastToDouble(dsgnSupWtrTempElement); |
| 5870 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (_dsgnSupWtrTemp) { |
| 5871 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
12 | dsgnSupWtrTemp = unitToUnit(_dsgnSupWtrTemp.get(), "F", "C"); |
| 5872 | } | ||
| 5873 | |||
| 5874 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _dsgnSupWtrDelT = lexicalCastToDouble(dsgnSupWtrDelTElement); |
| 5875 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (_dsgnSupWtrDelT) { |
| 5876 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | dsgnSupWtrDelT = _dsgnSupWtrDelT.get() * 5.0 / 9.0; |
| 5877 | } | ||
| 5878 | |||
| 5879 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (dsgnSupWtrDelT) { |
| 5880 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | tower.setDesignRangeTemperature(dsgnSupWtrDelT.get()); |
| 5881 | } | ||
| 5882 | |||
| 5883 |
1/1✓ Branch 1 taken 3 times.
|
3 | tower.setDesignInletAirWetBulbTemperature(20.01); |
| 5884 | |||
| 5885 |
3/6✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
|
6 | if (dsgnSupWtrTemp && wetBulbApproach) { |
| 5886 | ✗ | tower.setDesignInletAirWetBulbTemperature(dsgnSupWtrTemp.get() - wetBulbApproach.get()); | |
| 5887 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | } else if (dsgnSupWtrTemp) { |
| 5888 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | tower.setDesignInletAirWetBulbTemperature(dsgnSupWtrTemp.get() - 5.55556); |
| 5889 | } | ||
| 5890 | |||
| 5891 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (wetBulbApproach) { |
| 5892 | ✗ | tower.setDesignApproachTemperature(wetBulbApproach.get()); | |
| 5893 | } else { | ||
| 5894 |
1/1✓ Branch 1 taken 3 times.
|
3 | tower.setDesignApproachTemperature(5.55556); |
| 5895 | } | ||
| 5896 | |||
| 5897 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
3 | if (!autosize()) { |
| 5898 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node airFlowCapElement = htRejElement.child("AirFlowCapSim"); |
| 5899 | |||
| 5900 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _airFlowCap = lexicalCastToDouble(airFlowCapElement); |
| 5901 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (_airFlowCap) { |
| 5902 |
6/6✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 16 taken 3 times.
|
12 | tower.setDesignAirFlowRate(unitToUnit(_airFlowCap.get(), "cfm", "m^3/s").get()); |
| 5903 | } | ||
| 5904 | |||
| 5905 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node wtrFlowCapElement = htRejElement.child("WtrFlowCapSim"); |
| 5906 | |||
| 5907 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _wtrFlowCap = lexicalCastToDouble(wtrFlowCapElement); |
| 5908 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (_wtrFlowCap) { |
| 5909 |
6/6✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 16 taken 3 times.
|
12 | tower.setDesignWaterFlowRate(unitToUnit(_wtrFlowCap.get(), "gal/min", "m^3/s").get()); |
| 5910 | } | ||
| 5911 | |||
| 5912 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node totFanHPElement = htRejElement.child("TotFanHPSim"); |
| 5913 | |||
| 5914 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _totFanHP = lexicalCastToDouble(totFanHPElement); |
| 5915 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (_totFanHP) { |
| 5916 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | tower.setDesignFanPower(_totFanHP.get() * 745.7); |
| 5917 | } | ||
| 5918 | } | ||
| 5919 | |||
| 5920 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node minSpdRatElement = htRejElement.child("LowSpdAirFlowRat"); |
| 5921 | |||
| 5922 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _minSpdRat = lexicalCastToDouble(minSpdRatElement); |
| 5923 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (_minSpdRat) { |
| 5924 | ✗ | tower.setMinimumAirFlowRateRatio(_minSpdRat.get()); | |
| 5925 | } | ||
| 5926 | |||
| 5927 | 3 | boost::optional<model::CurveCubic> vsdFanPwrRatio_fQRatio; | |
| 5928 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node vsdFanPwrRatio_fQRatioElement = htRejElement.child("VSDFanPwrRatio_fQRatio"); |
| 5929 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | vsdFanPwrRatio_fQRatio = model.getConcreteModelObjectByName<model::CurveCubic>(vsdFanPwrRatio_fQRatioElement.text().as_string()); |
| 5930 | |||
| 5931 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (vsdFanPwrRatio_fQRatio) { |
| 5932 | ✗ | tower.setFanPowerRatioFunctionofAirFlowRateRatioCurve(vsdFanPwrRatio_fQRatio.get()); | |
| 5933 | } | ||
| 5934 | |||
| 5935 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node cellCntElement = htRejElement.child("CellCnt"); |
| 5936 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<int> _cellCnt = lexicalCastToInt(cellCntElement); |
| 5937 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (_cellCnt) { |
| 5938 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | tower.setNumberofCells(_cellCnt.get()); |
| 5939 | } | ||
| 5940 | |||
| 5941 |
1/1✓ Branch 1 taken 3 times.
|
3 | result = tower; |
| 5942 | 3 | } else { | |
| 5943 | ✗ | model::CoolingTowerSingleSpeed tower(model); | |
| 5944 | |||
| 5945 | ✗ | result = tower; | |
| 5946 | |||
| 5947 | ✗ | if (openstudio::istringEqual(modCtrlElement.text().as_string(), "Cycling")) { | |
| 5948 | ✗ | tower.setCapacityControl("FanCycling"); | |
| 5949 | ✗ | } else if (openstudio::istringEqual(modCtrlElement.text().as_string(), "Bypass")) { | |
| 5950 | ✗ | tower.setCapacityControl("FluidBypass"); | |
| 5951 | } | ||
| 5952 | |||
| 5953 | ✗ | pugi::xml_node cellCntElement = htRejElement.child("CellCnt"); | |
| 5954 | ✗ | boost::optional<int> _cellCnt = lexicalCastToInt(cellCntElement); | |
| 5955 | ✗ | if (_cellCnt) { | |
| 5956 | ✗ | tower.setNumberofCells(_cellCnt.get()); | |
| 5957 | } | ||
| 5958 | |||
| 5959 | ✗ | if (!autosize()) { | |
| 5960 | // PerformanceInputMethod | ||
| 5961 | ✗ | tower.setPerformanceInputMethod("NominalCapacity"); | |
| 5962 | |||
| 5963 | ✗ | tower.resetDesignWaterFlowRate(); | |
| 5964 | |||
| 5965 | ✗ | tower.resetUFactorTimesAreaValueatDesignAirFlowRate(); | |
| 5966 | |||
| 5967 | ✗ | tower.resetUFactorTimesAreaValueatFreeConvectionAirFlowRate(); | |
| 5968 | |||
| 5969 | // CapRtd | ||
| 5970 | ✗ | pugi::xml_node capRtdElement = htRejElement.child("CapRtdSim"); | |
| 5971 | ✗ | boost::optional<double> _capRtd = lexicalCastToDouble(capRtdElement); | |
| 5972 | |||
| 5973 | ✗ | if (_capRtd) { | |
| 5974 | // NominalCapacity | ||
| 5975 | ✗ | double cap = unitToUnit(_capRtd.get(), "Btu/h", "W").get(); | |
| 5976 | |||
| 5977 | ✗ | tower.setNominalCapacity(cap); | |
| 5978 | } | ||
| 5979 | |||
| 5980 | ✗ | pugi::xml_node airFlowCapElement = htRejElement.child("AirFlowCapSim"); | |
| 5981 | |||
| 5982 | ✗ | boost::optional<double> _airFlowCap = lexicalCastToDouble(airFlowCapElement); | |
| 5983 | ✗ | if (_airFlowCap) { | |
| 5984 | ✗ | tower.setDesignAirFlowRate(unitToUnit(_airFlowCap.get(), "cfm", "m^3/s").get()); | |
| 5985 | } | ||
| 5986 | |||
| 5987 | ✗ | pugi::xml_node wtrFlowCapElement = htRejElement.child("WtrFlowCapSim"); | |
| 5988 | |||
| 5989 | ✗ | boost::optional<double> _wtrFlowCap = lexicalCastToDouble(wtrFlowCapElement); | |
| 5990 | ✗ | if (_wtrFlowCap) { | |
| 5991 | ✗ | tower.setDesignWaterFlowRate(unitToUnit(_wtrFlowCap.get(), "gal", "m^3").get()); | |
| 5992 | } | ||
| 5993 | |||
| 5994 | ✗ | pugi::xml_node totFanHPElement = htRejElement.child("TotFanHPSim"); | |
| 5995 | |||
| 5996 | ✗ | boost::optional<double> _totFanHP = lexicalCastToDouble(totFanHPElement); | |
| 5997 | ✗ | if (_totFanHP) { | |
| 5998 | ✗ | tower.setFanPoweratDesignAirFlowRate(_totFanHP.get() * 745.7); | |
| 5999 | } | ||
| 6000 | } | ||
| 6001 | ✗ | } | |
| 6002 | |||
| 6003 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (result) { |
| 6004 | // Name | ||
| 6005 | |||
| 6006 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node nameElement = htRejElement.child("Name"); |
| 6007 | |||
| 6008 |
5/5✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
|
6 | result->setName(nameElement.text().as_string()); |
| 6009 | } | ||
| 6010 | |||
| 6011 | 3 | return result; | |
| 6012 | ✗ | } | |
| 6013 | |||
| 6014 | ✗ | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateHX(const pugi::xml_node& hxElement, openstudio::model::Model& model) { | |
| 6015 | ✗ | boost::optional<openstudio::model::ModelObject> result; | |
| 6016 | |||
| 6017 | ✗ | if (!istringEqual(hxElement.name(), "HX")) { | |
| 6018 | ✗ | return result; | |
| 6019 | } | ||
| 6020 | |||
| 6021 | ✗ | model::HeatExchangerFluidToFluid hx(model); | |
| 6022 | ✗ | result = hx; | |
| 6023 | |||
| 6024 | ✗ | std::string name = hxElement.child("Name").text().as_string(); | |
| 6025 | ✗ | hx.setName(name); | |
| 6026 | |||
| 6027 | ✗ | auto cWFluidSegInRefElement = hxElement.child("CWFluidSegInRef"); | |
| 6028 | ✗ | if (!cWFluidSegInRefElement) { | |
| 6029 | ✗ | LOG(Error, "HeatExchangerFluidToFluid '" << name << "' doesn't have a CWFluidSegInRef element! It will not be connected."); | |
| 6030 | } else { | ||
| 6031 | // The HX is on the demand side, so its inlet (CWFluidSegInRef) is the supply side | ||
| 6032 | ✗ | if (auto condenserSystem = loopForSupplySegment(cWFluidSegInRefElement, model)) { | |
| 6033 | ✗ | condenserSystem->addDemandBranchForComponent(hx); | |
| 6034 | ✗ | } | |
| 6035 | } | ||
| 6036 | |||
| 6037 | ✗ | if (!autosize()) { | |
| 6038 | ✗ | auto cHWFluidFlowRtDsgnElement = hxElement.child("CHWFluidFlowRtDsgn"); | |
| 6039 | ✗ | boost::optional<double> _cHWFluidFlowRtDsgn = lexicalCastToDouble(cHWFluidFlowRtDsgnElement); | |
| 6040 | ✗ | if (_cHWFluidFlowRtDsgn) { | |
| 6041 | ✗ | double value = unitToUnit(_cHWFluidFlowRtDsgn.get(), "gal/min", "m^3/s").get(); | |
| 6042 | ✗ | hx.setLoopDemandSideDesignFlowRate(value); | |
| 6043 | } | ||
| 6044 | |||
| 6045 | ✗ | auto cWFluidFlowRtDsgnElement = hxElement.child("CWFluidFlowRtDsgn"); | |
| 6046 | ✗ | boost::optional<double> _cWFluidFlowRtDsgn = lexicalCastToDouble(cWFluidFlowRtDsgnElement); | |
| 6047 | ✗ | if (_cWFluidFlowRtDsgn) { | |
| 6048 | ✗ | double value = unitToUnit(_cWFluidFlowRtDsgn.get(), "gal/min", "m^3/s").get(); | |
| 6049 | ✗ | hx.setLoopSupplySideDesignFlowRate(value); | |
| 6050 | } | ||
| 6051 | |||
| 6052 | ✗ | auto uAElement = hxElement.child("UASim"); | |
| 6053 | ✗ | boost::optional<double> _uA = lexicalCastToDouble(uAElement); | |
| 6054 | ✗ | if (_uA) { | |
| 6055 | // sdd units = Btu/(hr*ft^2*F), os units = W/(m^2*K) | ||
| 6056 | ✗ | Quantity uaIP(_uA.get(), BTUUnit(BTUExpnt(1, -2, -1, -1))); | |
| 6057 | ✗ | auto uaSI = QuantityConverter::instance().convert(uaIP, UnitSystem(UnitSystem::Wh)); | |
| 6058 | ✗ | OS_ASSERT(uaSI); | |
| 6059 | ✗ | OS_ASSERT(uaSI->units() == WhUnit(WhExpnt(1, 0, -2, -1))); | |
| 6060 | ✗ | hx.setHeatExchangerUFactorTimesAreaValue(uaSI->value()); | |
| 6061 | ✗ | } | |
| 6062 | } | ||
| 6063 | |||
| 6064 | ✗ | std::string type = hxElement.child("Type").text().as_string(); | |
| 6065 | ✗ | if (istringEqual("CrossFlowSupplyMixed", type)) { | |
| 6066 | ✗ | hx.setHeatExchangeModelType("CrossFlowSupplyMixedDemandUnMixed"); | |
| 6067 | ✗ | } else if (istringEqual("CrossFlowDemandMixed", type)) { | |
| 6068 | ✗ | hx.setHeatExchangeModelType("CrossFlowDemandMixedSupplyUnMixed"); | |
| 6069 | ✗ | } else if (!hx.setHeatExchangeModelType(type)) { | |
| 6070 | ✗ | LOG(Warn, name + " Type field references an unsupported option " + type + "."); | |
| 6071 | } | ||
| 6072 | |||
| 6073 | ✗ | hx.setMinimumTemperatureDifferencetoActivateHeatExchanger(1.1); | |
| 6074 | |||
| 6075 | ✗ | hx.setHeatTransferMeteringEndUseType("FreeCooling"); | |
| 6076 | |||
| 6077 | ✗ | hx.setComponentOverrideCoolingControlTemperatureMode("Loop"); | |
| 6078 | |||
| 6079 | ✗ | hx.setSizingFactor(1.0); | |
| 6080 | |||
| 6081 | ✗ | hx.setOperationMinimumTemperatureLimit(4.4); | |
| 6082 | |||
| 6083 | ✗ | hx.setOperationMinimumTemperatureLimit(21.1); | |
| 6084 | |||
| 6085 | ✗ | return result; | |
| 6086 | ✗ | } | |
| 6087 | 5 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateThrmlEngyStor(const pugi::xml_node& tesElement, | |
| 6088 | openstudio::model::Model& model) { | ||
| 6089 | 5 | boost::optional<openstudio::model::ModelObject> result; | |
| 6090 | |||
| 6091 |
6/6✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 14 taken 4 times.
✓ Branch 15 taken 1 time.
|
20 | if (!istringEqual(tesElement.name(), "ThrmlEngyStor")) { |
| 6092 | 4 | return result; | |
| 6093 | } | ||
| 6094 | |||
| 6095 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | std::string name = tesElement.child("Name").text().as_string(); |
| 6096 | |||
| 6097 |
1/1✓ Branch 1 taken 1 time.
|
1 | model::ThermalStorageChilledWaterStratified tes(model); |
| 6098 |
1/1✓ Branch 1 taken 1 time.
|
1 | result = tes; |
| 6099 | |||
| 6100 |
1/1✓ Branch 1 taken 1 time.
|
1 | tes.setName(name); |
| 6101 | |||
| 6102 |
1/1✓ Branch 1 taken 1 time.
|
1 | pugi::xml_node storCapElement = tesElement.child("StorCap"); |
| 6103 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> _storCap = lexicalCastToDouble(storCapElement); |
| 6104 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (_storCap) { |
| 6105 | ✗ | double value = unitToUnit(_storCap.get(), "gal", "m^3").get(); | |
| 6106 | ✗ | tes.setTankVolume(value); | |
| 6107 | } | ||
| 6108 | |||
| 6109 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | boost::optional<double> _tankHgt = lexicalCastToDouble(tesElement.child("TankHgt")); |
| 6110 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (_tankHgt) { |
| 6111 | ✗ | double value = unitToUnit(_tankHgt.get(), "ft", "m").get(); | |
| 6112 | ✗ | tes.setTankHeight(value); | |
| 6113 | ✗ | tes.setSourceSideOutletHeight(value); | |
| 6114 | } | ||
| 6115 | |||
| 6116 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | std::string tankShapeSim = tesElement.child("TankShapeSim").text().as_string(); |
| 6117 |
1/1✓ Branch 1 taken 1 time.
|
1 | tes.setTankShape(tankShapeSim); |
| 6118 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
|
2 | if (istringEqual("Other", tankShapeSim)) { |
| 6119 | // Used to be TankPerim I think, but now I'm sure it's TankPerimSim | ||
| 6120 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | boost::optional<double> _tankPerim = lexicalCastToDouble(tesElement.child("TankPerimSim")); |
| 6121 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_tankPerim) { |
| 6122 |
5/5✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
|
3 | double value = unitToUnit(_tankPerim.get(), "ft", "m").get(); |
| 6123 |
1/1✓ Branch 1 taken 1 time.
|
1 | tes.setTankPerimeter(value); |
| 6124 | } | ||
| 6125 | } else { | ||
| 6126 | ✗ | tes.resetTankPerimeter(); | |
| 6127 | } | ||
| 6128 | |||
| 6129 |
1/1✓ Branch 1 taken 1 time.
|
1 | tes.setDeadbandTemperatureDifference(0.5); |
| 6130 |
1/1✓ Branch 1 taken 1 time.
|
1 | tes.setTemperatureSensorHeight(0.0); |
| 6131 |
1/1✓ Branch 1 taken 1 time.
|
1 | tes.setMinimumTemperatureLimit(1.0); |
| 6132 | |||
| 6133 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | boost::optional<double> _capRtd = lexicalCastToDouble(tesElement.child("CapRtd")); |
| 6134 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (_capRtd) { |
| 6135 | ✗ | double value = unitToUnit(_capRtd.get(), "Btu/h", "W").get(); | |
| 6136 | ✗ | tes.setNominalCoolingCapacity(value); | |
| 6137 | } | ||
| 6138 | |||
| 6139 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | std::string storLctnSim = tesElement.child("StorLctnSim").text().as_string(); |
| 6140 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
|
2 | if (istringEqual("Zone", storLctnSim)) { |
| 6141 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | tes.setAmbientTemperatureIndicator("Zone"); |
| 6142 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | std::string storZnRef = tesElement.child("StorZnRef").text().as_string(); |
| 6143 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto tz = model.getConcreteModelObjectByName<model::ThermalZone>(storZnRef)) { |
| 6144 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | tes.setAmbientTemperatureThermalZone(tz.get()); |
| 6145 | 1 | } | |
| 6146 | 1 | } else { | |
| 6147 | ✗ | tes.setAmbientTemperatureIndicator("Outdoors"); | |
| 6148 | } | ||
| 6149 | |||
| 6150 |
1/1✓ Branch 1 taken 1 time.
|
1 | tes.resetAmbientTemperatureSchedule(); |
| 6151 | |||
| 6152 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | boost::optional<double> _tankUFac = lexicalCastToDouble(tesElement.child("TankUFac")); |
| 6153 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_tankUFac) { |
| 6154 | // sdd units = Btu/(hr*ft^2*F), os units = W/(m^2*K) | ||
| 6155 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
|
1 | Quantity uaIP(_tankUFac.get(), BTUUnit(BTUExpnt(1, -2, -1, -1))); |
| 6156 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | auto uaSI = QuantityConverter::instance().convert(uaIP, UnitSystem(UnitSystem::Wh)); |
| 6157 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
|
1 | OS_ASSERT(uaSI); |
| 6158 |
6/8✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
✓ Branch 14 taken 1 time.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 time.
✗ Branch 19 not taken.
|
1 | OS_ASSERT(uaSI->units() == WhUnit(WhExpnt(1, 0, -2, -1))); |
| 6159 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | tes.setUniformSkinLossCoefficientperUnitAreatoAmbientTemperature(uaSI->value()); |
| 6160 | 1 | } | |
| 6161 | |||
| 6162 |
1/1✓ Branch 1 taken 1 time.
|
1 | tes.setUseSideHeatTransferEffectiveness(1.0); |
| 6163 | |||
| 6164 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | std::string dischrgSchRef = tesElement.child("DischrgSchRef").text().as_string(); |
| 6165 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto schedule = model.getModelObjectByName<model::Schedule>(dischrgSchRef)) { |
| 6166 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | tes.setUseSideAvailabilitySchedule(schedule.get()); |
| 6167 | 1 | } | |
| 6168 | |||
| 6169 | // Note JM 2019-01-15: TODO: This is a redefinition (and exactly the same key as above), | ||
| 6170 | // not sure what was meant here | ||
| 6171 | // boost::optional<double> _tankHgt = lexicalCastToDouble(tesElement.child("TankHgt")); | ||
| 6172 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (_tankHgt) { |
| 6173 | ✗ | double value = unitToUnit(_tankHgt.get(), "ft", "m").get(); | |
| 6174 | ✗ | tes.setUseSideInletHeight(value); | |
| 6175 | } | ||
| 6176 | |||
| 6177 |
1/1✓ Branch 1 taken 1 time.
|
1 | tes.setUseSideOutletHeight(0.0); |
| 6178 | |||
| 6179 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | boost::optional<double> _wtrFlowCap = lexicalCastToDouble(tesElement.child("WtrFlowCap")); |
| 6180 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (_wtrFlowCap) { |
| 6181 | ✗ | double value = unitToUnit(_wtrFlowCap.get(), "gal/min", "m^3/s").get(); | |
| 6182 | ✗ | tes.setUseSideDesignFlowRate(value); | |
| 6183 | ✗ | tes.setSourceSideDesignFlowRate(value); | |
| 6184 | } | ||
| 6185 | |||
| 6186 |
1/1✓ Branch 1 taken 1 time.
|
1 | tes.setSourceSideHeatTransferEffectiveness(1.0); |
| 6187 | |||
| 6188 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | std::string chrgSchRef = tesElement.child("ChrgSchRef").text().as_string(); |
| 6189 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto schedule = model.getModelObjectByName<model::Schedule>(chrgSchRef)) { |
| 6190 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | tes.setSourceSideAvailabilitySchedule(schedule.get()); |
| 6191 | 1 | } | |
| 6192 | |||
| 6193 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | boost::optional<int> _numberOfNodes = lexicalCastToInt(tesElement.child("TankNodeCnt")); |
| 6194 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_numberOfNodes) { |
| 6195 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | tes.setNumberofNodes(_numberOfNodes.get()); |
| 6196 | } else { | ||
| 6197 | ✗ | tes.setNumberofNodes(5); | |
| 6198 | } | ||
| 6199 | |||
| 6200 |
1/1✓ Branch 1 taken 1 time.
|
1 | tes.setSourceSideInletHeight(0.0); |
| 6201 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | tes.setInletMode("Fixed"); |
| 6202 |
1/1✓ Branch 1 taken 1 time.
|
1 | tes.setAdditionalDestratificationConductivity(0.0); |
| 6203 | |||
| 6204 | 1 | return result; | |
| 6205 | 1 | } | |
| 6206 | |||
| 6207 | 3 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateChiller(const pugi::xml_node& chillerElement, | |
| 6208 | openstudio::model::Model& model) { | ||
| 6209 | 3 | boost::optional<openstudio::model::ModelObject> result; | |
| 6210 | |||
| 6211 |
5/6✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 3 times.
|
12 | if (!istringEqual(chillerElement.name(), "Chlr")) { |
| 6212 | ✗ | return result; | |
| 6213 | } | ||
| 6214 | |||
| 6215 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | std::string name = chillerElement.child("Name").text().as_string(); |
| 6216 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto typeElement = chillerElement.child("Type"); |
| 6217 | |||
| 6218 |
6/7✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 3 times.
|
9 | if (istringEqual("AbsorptionSingleEffect", typeElement.text().as_string())) { |
| 6219 | ✗ | model::ChillerAbsorptionIndirect chiller(model); | |
| 6220 | ✗ | chiller.setName(name); | |
| 6221 | ✗ | result = chiller; | |
| 6222 | |||
| 6223 | ✗ | auto cndsrInRefElement = chillerElement.child("CndsrFluidSegInRef"); | |
| 6224 | ✗ | if (!cndsrInRefElement) { | |
| 6225 | ✗ | LOG(Error, "ChillerAbsorptionIndirect '" << name << "' doesn't have a CndsrFluidSegInRef element! It will not be connected."); | |
| 6226 | } else { | ||
| 6227 | ✗ | auto condenserSystem = loopForSupplySegment(cndsrInRefElement, model); | |
| 6228 | ✗ | if (condenserSystem) { | |
| 6229 | ✗ | condenserSystem->addDemandBranchForComponent(chiller); | |
| 6230 | ✗ | double value = condenserSystem->sizingPlant().designLoopExitTemperature(); | |
| 6231 | ✗ | chiller.setDesignCondenserWaterFlowRate(value); | |
| 6232 | } | ||
| 6233 | ✗ | } | |
| 6234 | |||
| 6235 | ✗ | auto genFluidSegInRefElement = chillerElement.child("GenFluidSegInRef"); | |
| 6236 | ✗ | if (!genFluidSegInRefElement) { | |
| 6237 | ✗ | LOG(Error, "ChillerAbsorptionIndirect '" << name << "' doesn't have a GenFluidSegInRef element! It will not be connected."); | |
| 6238 | } else { | ||
| 6239 | ✗ | auto genSystem = loopForSupplySegment(genFluidSegInRefElement, model); | |
| 6240 | ✗ | if (genSystem) { | |
| 6241 | ✗ | genSystem->addDemandBranchForComponent(chiller, true); | |
| 6242 | } | ||
| 6243 | ✗ | } | |
| 6244 | |||
| 6245 | ✗ | if (!autosize()) { | |
| 6246 | ✗ | auto capRtdElement = chillerElement.child("CapRtdSim"); | |
| 6247 | ✗ | boost::optional<double> _capRtd = lexicalCastToDouble(capRtdElement); | |
| 6248 | ✗ | if (_capRtd) { | |
| 6249 | ✗ | double value = unitToUnit(_capRtd.get(), "Btu/h", "W").get(); | |
| 6250 | ✗ | chiller.setNominalCapacity(value); | |
| 6251 | } | ||
| 6252 | |||
| 6253 | ✗ | auto auxPwrElement = chillerElement.child("AuxPwrSim"); | |
| 6254 | ✗ | boost::optional<double> _auxPwr = lexicalCastToDouble(auxPwrElement); | |
| 6255 | ✗ | if (_auxPwr) { | |
| 6256 | ✗ | double value = unitToUnit(_auxPwr.get(), "Btu/h", "W").get(); | |
| 6257 | ✗ | chiller.setNominalPumpingPower(value); | |
| 6258 | } | ||
| 6259 | |||
| 6260 | ✗ | auto wtrFlowCapElement = chillerElement.child("WtrFlowCapSim"); | |
| 6261 | ✗ | boost::optional<double> _wtrFlowCap = lexicalCastToDouble(wtrFlowCapElement); | |
| 6262 | ✗ | if (_wtrFlowCap) { | |
| 6263 | ✗ | double value = unitToUnit(_wtrFlowCap.get(), "gal/min", "m^3/s").get(); | |
| 6264 | ✗ | chiller.setDesignChilledWaterFlowRate(value); | |
| 6265 | } | ||
| 6266 | |||
| 6267 | ✗ | auto genFluidFlowCapElement = chillerElement.child("GenFluidFlowCapSim"); | |
| 6268 | ✗ | boost::optional<double> _genFluidFlowCap = lexicalCastToDouble(genFluidFlowCapElement); | |
| 6269 | ✗ | if (_genFluidFlowCap) { | |
| 6270 | ✗ | double value = unitToUnit(_genFluidFlowCap.get(), "gal/min", "m^3/s").get(); | |
| 6271 | ✗ | chiller.setDesignGeneratorFluidFlowRate(value); | |
| 6272 | } | ||
| 6273 | |||
| 6274 | ✗ | auto cndsrFlowCapElement = chillerElement.child("CndsrFlowCap"); | |
| 6275 | ✗ | boost::optional<double> _cndsrFlowCap = lexicalCastToDouble(cndsrFlowCapElement); | |
| 6276 | ✗ | if (_cndsrFlowCap) { | |
| 6277 | ✗ | double value = unitToUnit(_cndsrFlowCap.get(), "gal/min", "m^3/s").get(); | |
| 6278 | ✗ | chiller.setDesignCondenserWaterFlowRate(value); | |
| 6279 | } | ||
| 6280 | } | ||
| 6281 | |||
| 6282 | ✗ | auto partLdRatMinElement = chillerElement.child("PLRMin"); | |
| 6283 | ✗ | boost::optional<double> _partLdRatMin = lexicalCastToDouble(partLdRatMinElement); | |
| 6284 | ✗ | if (_partLdRatMin) { | |
| 6285 | ✗ | chiller.setMinimumPartLoadRatio(_partLdRatMin.get()); | |
| 6286 | } | ||
| 6287 | |||
| 6288 | ✗ | chiller.setMaximumPartLoadRatio(1.1); | |
| 6289 | |||
| 6290 | ✗ | chiller.setOptimumPartLoadRatio(1.0); | |
| 6291 | |||
| 6292 | ✗ | chiller.setChillerFlowMode("NotModulated"); | |
| 6293 | |||
| 6294 | ✗ | if (chiller.tertiaryPlantLoop()) { | |
| 6295 | ✗ | chiller.setGeneratorHeatSourceType("HotWater"); | |
| 6296 | } else { | ||
| 6297 | ✗ | chiller.setGeneratorHeatSourceType("Steam"); | |
| 6298 | } | ||
| 6299 | |||
| 6300 | ✗ | chiller.setTemperatureLowerLimitGeneratorInlet(60.0); | |
| 6301 | |||
| 6302 | ✗ | chiller.setSizingFactor(1.0); | |
| 6303 | |||
| 6304 | { | ||
| 6305 | ✗ | auto curveElement = chillerElement.child("HIR_fPLRCrvRef"); | |
| 6306 | ✗ | if (auto curve = model.getModelObjectByName<model::Curve>(curveElement.text().as_string())) { | |
| 6307 | ✗ | auto oldCurve = chiller.generatorHeatInputFunctionofPartLoadRatioCurve(); | |
| 6308 | ✗ | if (chiller.setGeneratorHeatInputFunctionofPartLoadRatioCurve(curve.get())) { | |
| 6309 | ✗ | oldCurve.remove(); | |
| 6310 | } | ||
| 6311 | ✗ | } | |
| 6312 | } | ||
| 6313 | |||
| 6314 | { | ||
| 6315 | ✗ | auto curveElement = chillerElement.child("HIR_fCndTempCrvRef"); | |
| 6316 | ✗ | if (auto curve = model.getModelObjectByName<model::Curve>(curveElement.text().as_string())) { | |
| 6317 | ✗ | auto oldCurve = chiller.generatorHeatInputCorrectionFunctionofCondenserTemperatureCurve(); | |
| 6318 | ✗ | if (chiller.setGeneratorHeatInputCorrectionFunctionofCondenserTemperatureCurve(curve.get())) { | |
| 6319 | ✗ | oldCurve.remove(); | |
| 6320 | } | ||
| 6321 | ✗ | } | |
| 6322 | } | ||
| 6323 | |||
| 6324 | { | ||
| 6325 | ✗ | auto curveElement = chillerElement.child("HIR_fEvapTempCrvRef"); | |
| 6326 | ✗ | if (auto curve = model.getModelObjectByName<model::Curve>(curveElement.text().as_string())) { | |
| 6327 | ✗ | auto oldCurve = chiller.generatorHeatInputCorrectionFunctionofChilledWaterTemperatureCurve(); | |
| 6328 | ✗ | if (chiller.setGeneratorHeatInputCorrectionFunctionofChilledWaterTemperatureCurve(curve.get())) { | |
| 6329 | ✗ | oldCurve.remove(); | |
| 6330 | } | ||
| 6331 | ✗ | } | |
| 6332 | } | ||
| 6333 | |||
| 6334 | { | ||
| 6335 | ✗ | auto curveElement = chillerElement.child("Cap_fCndTempCrvRef"); | |
| 6336 | ✗ | if (auto curve = model.getModelObjectByName<model::Curve>(curveElement.text().as_string())) { | |
| 6337 | ✗ | auto oldCurve = chiller.capacityCorrectionFunctionofCondenserTemperatureCurve(); | |
| 6338 | ✗ | if (chiller.setCapacityCorrectionFunctionofCondenserTemperatureCurve(curve.get())) { | |
| 6339 | ✗ | oldCurve.remove(); | |
| 6340 | } | ||
| 6341 | ✗ | } | |
| 6342 | } | ||
| 6343 | |||
| 6344 | { | ||
| 6345 | ✗ | auto curveElement = chillerElement.child("Cap_fEvapTempCrvRef"); | |
| 6346 | ✗ | if (auto curve = model.getModelObjectByName<model::Curve>(curveElement.text().as_string())) { | |
| 6347 | ✗ | auto oldCurve = chiller.capacityCorrectionFunctionofChilledWaterTemperatureCurve(); | |
| 6348 | ✗ | if (chiller.setCapacityCorrectionFunctionofChilledWaterTemperatureCurve(curve.get())) { | |
| 6349 | ✗ | oldCurve.remove(); | |
| 6350 | } | ||
| 6351 | ✗ | } | |
| 6352 | } | ||
| 6353 | |||
| 6354 | { | ||
| 6355 | ✗ | auto curveElement = chillerElement.child("Cap_fGenTempCrvRef"); | |
| 6356 | ✗ | if (auto curve = model.getModelObjectByName<model::Curve>(curveElement.text().as_string())) { | |
| 6357 | ✗ | auto oldCurve = chiller.capacityCorrectionFunctionofGeneratorTemperatureCurve(); | |
| 6358 | ✗ | if (chiller.setCapacityCorrectionFunctionofGeneratorTemperatureCurve(curve.get())) { | |
| 6359 | ✗ | oldCurve.remove(); | |
| 6360 | } | ||
| 6361 | ✗ | } | |
| 6362 | } | ||
| 6363 | ✗ | } else { | |
| 6364 | // Cap_fTempCrvRef | ||
| 6365 | 3 | boost::optional<model::CurveBiquadratic> cap_fTempCrv; | |
| 6366 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node cap_fTempCrvElement = chillerElement.child("Cap_fTempCrvRef"); |
| 6367 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | cap_fTempCrv = model.getConcreteModelObjectByName<model::CurveBiquadratic>(cap_fTempCrvElement.text().as_string()); |
| 6368 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
3 | if (!cap_fTempCrv) { |
| 6369 | ✗ | LOG(Error, "Coil: " << name << " Broken Cap_fTempCrv"); | |
| 6370 | |||
| 6371 | ✗ | cap_fTempCrv = model::CurveBiquadratic(model); | |
| 6372 | ✗ | cap_fTempCrv->setCoefficient1Constant(1.0215158); | |
| 6373 | ✗ | cap_fTempCrv->setCoefficient2x(0.037035864); | |
| 6374 | ✗ | cap_fTempCrv->setCoefficient3xPOW2(0.0002332476); | |
| 6375 | ✗ | cap_fTempCrv->setCoefficient4y(-0.003894048); | |
| 6376 | ✗ | cap_fTempCrv->setCoefficient5yPOW2(-6.52536e-005); | |
| 6377 | ✗ | cap_fTempCrv->setCoefficient6xTIMESY(-0.0002680452); | |
| 6378 | ✗ | cap_fTempCrv->setMinimumValueofx(5.0); | |
| 6379 | ✗ | cap_fTempCrv->setMaximumValueofx(10.0); | |
| 6380 | ✗ | cap_fTempCrv->setMinimumValueofy(24.0); | |
| 6381 | ✗ | cap_fTempCrv->setMaximumValueofy(35.0); | |
| 6382 | } | ||
| 6383 | |||
| 6384 | // EIR_fTempCrvRef | ||
| 6385 | 3 | boost::optional<model::CurveBiquadratic> eir_fTempCrv; | |
| 6386 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node eir_fTempCrvElement = chillerElement.child("EIR_fTempCrvRef"); |
| 6387 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | eir_fTempCrv = model.getConcreteModelObjectByName<model::CurveBiquadratic>(eir_fTempCrvElement.text().as_string()); |
| 6388 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
3 | if (!eir_fTempCrv) { |
| 6389 | ✗ | LOG(Error, "Coil: " << name << "Broken EIR_fTempCrvRef"); | |
| 6390 | |||
| 6391 | ✗ | eir_fTempCrv = model::CurveBiquadratic(model); | |
| 6392 | ✗ | eir_fTempCrv->setCoefficient1Constant(0.70176857); | |
| 6393 | ✗ | eir_fTempCrv->setCoefficient2x(-0.00452016); | |
| 6394 | ✗ | eir_fTempCrv->setCoefficient3xPOW2(0.0005331096); | |
| 6395 | ✗ | eir_fTempCrv->setCoefficient4y(-0.005498208); | |
| 6396 | ✗ | eir_fTempCrv->setCoefficient5yPOW2(0.0005445792); | |
| 6397 | ✗ | eir_fTempCrv->setCoefficient6xTIMESY(-0.0007290324); | |
| 6398 | ✗ | eir_fTempCrv->setMinimumValueofx(5.0); | |
| 6399 | ✗ | eir_fTempCrv->setMaximumValueofx(10.0); | |
| 6400 | ✗ | eir_fTempCrv->setMinimumValueofy(24.0); | |
| 6401 | ✗ | eir_fTempCrv->setMaximumValueofy(35.0); | |
| 6402 | } | ||
| 6403 | |||
| 6404 | // EIR_fPLRCrvRef | ||
| 6405 | 3 | boost::optional<model::CurveQuadratic> eir_fPLRCrv; | |
| 6406 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node eir_fPLRCrvElement = chillerElement.child("EIR_fPLRCrvRef"); |
| 6407 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | eir_fPLRCrv = model.getConcreteModelObjectByName<model::CurveQuadratic>(eir_fPLRCrvElement.text().as_string()); |
| 6408 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
3 | if (!eir_fPLRCrv) { |
| 6409 | ✗ | LOG(Error, "Coil: " << name << "Broken EIR_fPLRCrvRef"); | |
| 6410 | |||
| 6411 | ✗ | eir_fPLRCrv = model::CurveQuadratic(model); | |
| 6412 | ✗ | eir_fPLRCrv->setCoefficient1Constant(0.06369119); | |
| 6413 | ✗ | eir_fPLRCrv->setCoefficient2x(0.58488832); | |
| 6414 | ✗ | eir_fPLRCrv->setCoefficient3xPOW2(0.35280274); | |
| 6415 | ✗ | eir_fPLRCrv->setMinimumValueofx(0.0); | |
| 6416 | ✗ | eir_fPLRCrv->setMaximumValueofx(1.0); | |
| 6417 | } | ||
| 6418 | |||
| 6419 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | model::ChillerElectricEIR chiller(model, cap_fTempCrv.get(), eir_fTempCrv.get(), eir_fPLRCrv.get()); |
| 6420 |
1/1✓ Branch 1 taken 3 times.
|
3 | result = chiller; |
| 6421 | |||
| 6422 | // Name | ||
| 6423 |
1/1✓ Branch 1 taken 3 times.
|
3 | chiller.setName(name); |
| 6424 | |||
| 6425 | // CndsrInRef | ||
| 6426 | // Will be aircooled if Condenser not specified | ||
| 6427 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node cndsrInRefElement = chillerElement.child("CndsrFluidSegInRef"); |
| 6428 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
3 | if (cndsrInRefElement) { |
| 6429 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<model::PlantLoop> condenserSystem = loopForSupplySegment(cndsrInRefElement, model); |
| 6430 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (condenserSystem) { |
| 6431 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | condenserSystem->addDemandBranchForComponent(chiller); |
| 6432 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | double value = condenserSystem->sizingPlant().designLoopExitTemperature(); |
| 6433 |
1/1✓ Branch 1 taken 3 times.
|
3 | chiller.setReferenceEnteringCondenserFluidTemperature(value); |
| 6434 | } | ||
| 6435 | 3 | } | |
| 6436 | |||
| 6437 | // COP | ||
| 6438 | 3 | boost::optional<double> cop; | |
| 6439 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node copElement = chillerElement.child("COP"); |
| 6440 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _cop = lexicalCastToDouble(copElement); |
| 6441 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (_cop) { |
| 6442 |
1/1✓ Branch 1 taken 3 times.
|
3 | double value = _cop.get(); |
| 6443 |
1/1✓ Branch 1 taken 3 times.
|
3 | chiller.setReferenceCOP(value); |
| 6444 |
1/1✓ Branch 1 taken 3 times.
|
3 | cop = value; |
| 6445 | } | ||
| 6446 | |||
| 6447 | // PartLdRatMin | ||
| 6448 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node partLdRatMinElement = chillerElement.child("PLRMin"); |
| 6449 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _partLdRatMin = lexicalCastToDouble(partLdRatMinElement); |
| 6450 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (_partLdRatMin) { |
| 6451 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | chiller.setMinimumPartLoadRatio(_partLdRatMin.get()); |
| 6452 | } | ||
| 6453 | |||
| 6454 | // UnldRatMin | ||
| 6455 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node unldRatMinElement = chillerElement.child("UnldRatMin"); |
| 6456 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _unldRatMin = lexicalCastToDouble(unldRatMinElement); |
| 6457 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (_unldRatMin) { |
| 6458 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | chiller.setMinimumUnloadingRatio(_unldRatMin.get()); |
| 6459 | } | ||
| 6460 | |||
| 6461 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
3 | if (!autosize()) { |
| 6462 | // CapRtd | ||
| 6463 | 3 | boost::optional<double> capRtd; | |
| 6464 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node capRtdElement = chillerElement.child("CapRtdSim"); |
| 6465 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _capRtd = lexicalCastToDouble(capRtdElement); |
| 6466 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (_capRtd) { |
| 6467 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
12 | capRtd = unitToUnit(_capRtd.get(), "Btu/h", "W"); |
| 6468 | } | ||
| 6469 | |||
| 6470 | // EntTempDsgn | ||
| 6471 | 3 | boost::optional<double> entTempDsgn; | |
| 6472 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node entTempDsgnElement = chillerElement.child("EntTempDsgn"); |
| 6473 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _entTempDsgn = lexicalCastToDouble(entTempDsgnElement); |
| 6474 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (_entTempDsgn) { |
| 6475 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
12 | entTempDsgn = unitToUnit(_entTempDsgn.get(), "F", "C"); |
| 6476 | } | ||
| 6477 | |||
| 6478 | // LvgTempDsgn | ||
| 6479 | 3 | boost::optional<double> lvgTempDsgn; | |
| 6480 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node lvgTempDsgnElement = chillerElement.child("LvgTempDsgn"); |
| 6481 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _lvgTempDsgn = lexicalCastToDouble(lvgTempDsgnElement); |
| 6482 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (_lvgTempDsgn) { |
| 6483 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
12 | lvgTempDsgn = unitToUnit(_lvgTempDsgn.get(), "F", "C"); |
| 6484 | } | ||
| 6485 | |||
| 6486 |
4/8✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
|
9 | if (capRtd && entTempDsgn && lvgTempDsgn) { |
| 6487 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | chiller.setReferenceCapacity(capRtd.get()); |
| 6488 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | double flow = capRtd.get() / (cpWater * densityWater * (entTempDsgn.get() - lvgTempDsgn.get())); |
| 6489 |
1/1✓ Branch 1 taken 3 times.
|
3 | chiller.setReferenceChilledWaterFlowRate(flow); |
| 6490 | } | ||
| 6491 | |||
| 6492 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto cndsrFlowCapElement = chillerElement.child("CndsrFlowCap"); |
| 6493 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _cndsrFlowCap = lexicalCastToDouble(cndsrFlowCapElement); |
| 6494 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (_cndsrFlowCap) { |
| 6495 | ✗ | double value = unitToUnit(_cndsrFlowCap.get(), "gal/min", "m^3/s").get(); | |
| 6496 | ✗ | chiller.setReferenceCondenserFluidFlowRate(value); | |
| 6497 | } | ||
| 6498 | } | ||
| 6499 | 3 | } | |
| 6500 | |||
| 6501 | 3 | return result; | |
| 6502 | 3 | } | |
| 6503 | |||
| 6504 | 1 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateWtrHtr(const pugi::xml_node& element, openstudio::model::Model& model) { | |
| 6505 | 1 | boost::optional<openstudio::model::ModelObject> result; | |
| 6506 | |||
| 6507 |
5/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 time.
|
4 | if (!istringEqual(element.name(), "WtrHtr")) { |
| 6508 | ✗ | return result; | |
| 6509 | } | ||
| 6510 | |||
| 6511 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | std::string typeSim = element.child("TypeSim").text().as_string(); |
| 6512 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 time.
|
2 | if (istringEqual(typeSim, "HeatPumpSplit")) { |
| 6513 | ✗ | model::WaterHeaterHeatPump heatPump(model); | |
| 6514 | ✗ | auto waterHeater = heatPump.tank().cast<model::WaterHeaterMixed>(); | |
| 6515 | ✗ | auto coil = heatPump.dXCoil().cast<model::CoilWaterHeatingAirToWaterHeatPump>(); | |
| 6516 | ✗ | auto fan = heatPump.fan().cast<model::FanOnOff>(); | |
| 6517 | |||
| 6518 | ✗ | std::string hpName = element.child("Name").text().as_string(); | |
| 6519 | ✗ | heatPump.setName(hpName); | |
| 6520 | ✗ | waterHeater.setName(hpName + " Storage Tank"); | |
| 6521 | ✗ | coil.setName(hpName + " Heating Coil"); | |
| 6522 | ✗ | fan.setName(hpName + " Fan"); | |
| 6523 | |||
| 6524 | ✗ | heatPump.setDeadBandTemperatureDifference(0.01); | |
| 6525 | ✗ | heatPump.autosizeCondenserWaterFlowRate(); | |
| 6526 | ✗ | heatPump.setFanPlacement("DrawThrough"); | |
| 6527 | ✗ | heatPump.setOnCycleParasiticElectricLoad(0.0); | |
| 6528 | ✗ | heatPump.setOffCycleParasiticElectricLoad(0.0); | |
| 6529 | |||
| 6530 | { | ||
| 6531 | ✗ | auto schedule = model.alwaysOnDiscreteSchedule(); | |
| 6532 | ✗ | heatPump.setAvailabilitySchedule(schedule); | |
| 6533 | ✗ | } | |
| 6534 | |||
| 6535 | ✗ | std::string cprsrZn = element.child("CprsrZn").text().as_string(); | |
| 6536 | ✗ | if (istringEqual(cprsrZn, "Zone")) { | |
| 6537 | ✗ | heatPump.setInletAirConfiguration("ZoneAirOnly"); | |
| 6538 | ✗ | heatPump.setCompressorLocation("Zone"); | |
| 6539 | ✗ | heatPump.setParasiticHeatRejectionLocation("Zone"); | |
| 6540 | } else { | ||
| 6541 | ✗ | heatPump.setInletAirConfiguration("OutdoorAirOnly"); | |
| 6542 | ✗ | heatPump.setCompressorLocation("Outdoors"); | |
| 6543 | ✗ | heatPump.setParasiticHeatRejectionLocation("Outdoors"); | |
| 6544 | } | ||
| 6545 | |||
| 6546 | // Might have to relocate after zones are available | ||
| 6547 | ✗ | std::string cprsrZnRef = element.child("CprsrZnRef").text().as_string(); | |
| 6548 | ✗ | if (auto zone = model.getConcreteModelObjectByName<model::ThermalZone>(cprsrZnRef)) { | |
| 6549 | ✗ | heatPump.addToThermalZone(zone.get()); | |
| 6550 | ✗ | } | |
| 6551 | |||
| 6552 | ✗ | boost::optional<double> _fanFlowCapSim = lexicalCastToDouble(element.child("FanFlowCapSim")); | |
| 6553 | ✗ | if (_fanFlowCapSim) { | |
| 6554 | ✗ | double value = unitToUnit(_fanFlowCapSim.get(), "cfm", "m^3/s").get(); | |
| 6555 | ✗ | heatPump.setEvaporatorAirFlowRate(value); | |
| 6556 | } else { | ||
| 6557 | ✗ | heatPump.autosizeEvaporatorAirFlowRate(); | |
| 6558 | } | ||
| 6559 | |||
| 6560 | ✗ | heatPump.setMinimumInletAirTemperatureforCompressorOperation(5.0); | |
| 6561 | ✗ | boost::optional<double> _minAirTemp = lexicalCastToDouble(element.child("MinAirTemp")); | |
| 6562 | ✗ | if (_minAirTemp) { | |
| 6563 | ✗ | double value = unitToUnit(_minAirTemp.get(), "F", "C").get(); | |
| 6564 | ✗ | heatPump.setMinimumInletAirTemperatureforCompressorOperation(value); | |
| 6565 | } | ||
| 6566 | |||
| 6567 | ✗ | waterHeater.setDeadbandTemperatureDifference(0.01); | |
| 6568 | ✗ | waterHeater.setHeaterControlType("Cycle"); | |
| 6569 | ✗ | waterHeater.setHeaterMaximumCapacity(0.0); | |
| 6570 | ✗ | waterHeater.setHeaterMinimumCapacity(0.0); | |
| 6571 | ✗ | waterHeater.setHeaterIgnitionMinimumFlowRate(0.0); | |
| 6572 | ✗ | waterHeater.setHeaterIgnitionDelay(0.0); | |
| 6573 | ✗ | waterHeater.setHeaterThermalEfficiency(0.8); | |
| 6574 | ✗ | waterHeater.setOnCycleLossFractiontoThermalZone(1.0); | |
| 6575 | ✗ | waterHeater.setUseSideEffectiveness(1.0); | |
| 6576 | ✗ | waterHeater.setSourceSideEffectiveness(1.0); | |
| 6577 | ✗ | waterHeater.setIndirectWaterHeatingRecoveryTime(1.5); | |
| 6578 | |||
| 6579 | ✗ | boost::optional<double> _storCapSim = lexicalCastToDouble(element.child("StorCapSim")); | |
| 6580 | ✗ | if (_storCapSim) { | |
| 6581 | ✗ | waterHeater.setTankVolume(unitToUnit(_storCapSim.get(), "gal", "m^3").get()); | |
| 6582 | } | ||
| 6583 | |||
| 6584 | ✗ | std::string storZn = element.child("StorZn").text().as_string(); | |
| 6585 | ✗ | if (istringEqual(storZn, "Zone")) { | |
| 6586 | ✗ | waterHeater.setAmbientTemperatureIndicator("ThermalZone"); | |
| 6587 | } else { | ||
| 6588 | ✗ | waterHeater.setAmbientTemperatureIndicator("Outdoors"); | |
| 6589 | } | ||
| 6590 | |||
| 6591 | ✗ | std::string storZnRef = element.child("StorZnRef").text().as_string(); | |
| 6592 | ✗ | if (auto zone = model.getConcreteModelObjectByName<model::ThermalZone>(storZnRef)) { | |
| 6593 | ✗ | waterHeater.setAmbientTemperatureThermalZone(zone.get()); | |
| 6594 | ✗ | } | |
| 6595 | |||
| 6596 | ✗ | auto fixedSupTempElement = element.parent().child("FixedSupTemp"); | |
| 6597 | ✗ | if (fixedSupTempElement) { | |
| 6598 | ✗ | boost::optional<double> _fixedSupTemp = lexicalCastToDouble(fixedSupTempElement); | |
| 6599 | ✗ | if (_fixedSupTemp) { | |
| 6600 | ✗ | double value = unitToUnit(_fixedSupTemp.get(), "F", "C").get(); | |
| 6601 | { | ||
| 6602 | ✗ | if (auto defaultSchedule = waterHeater.setpointTemperatureSchedule()) { | |
| 6603 | ✗ | defaultSchedule->remove(); | |
| 6604 | ✗ | } | |
| 6605 | ✗ | model::ScheduleRuleset schedule(model); | |
| 6606 | ✗ | schedule.setName(waterHeater.name().get() + " Setpoint Temp"); | |
| 6607 | ✗ | auto scheduleDay = schedule.defaultDaySchedule(); | |
| 6608 | ✗ | scheduleDay.addValue(Time(1.0), value); | |
| 6609 | ✗ | waterHeater.setSetpointTemperatureSchedule(schedule); | |
| 6610 | ✗ | } | |
| 6611 | { | ||
| 6612 | ✗ | heatPump.compressorSetpointTemperatureSchedule().remove(); | |
| 6613 | ✗ | model::ScheduleRuleset schedule(model); | |
| 6614 | ✗ | schedule.setName(heatPump.name().get() + " Compressor Setpoint Temp"); | |
| 6615 | ✗ | auto scheduleDay = schedule.defaultDaySchedule(); | |
| 6616 | ✗ | scheduleDay.addValue(Time(1.0), value + 5.0); | |
| 6617 | ✗ | heatPump.setCompressorSetpointTemperatureSchedule(schedule); | |
| 6618 | ✗ | } | |
| 6619 | } | ||
| 6620 | } | ||
| 6621 | |||
| 6622 | ✗ | std::string fuelSrc = element.child("FuelSrc").text().as_string(); | |
| 6623 | // TODO: probably need to check input here | ||
| 6624 | ✗ | waterHeater.setHeaterFuelType(fuelSrc); | |
| 6625 | |||
| 6626 | { | ||
| 6627 | ✗ | const auto* curveRef = element.child("HIR_fPLRCrvRef").text().as_string(); | |
| 6628 | ✗ | auto newcurve = model.getModelObjectByName<model::Curve>(curveRef); | |
| 6629 | ✗ | if (newcurve) { | |
| 6630 | ✗ | auto oldcurve = waterHeater.partLoadFactorCurve(); | |
| 6631 | ✗ | if (oldcurve && (oldcurve.get() != newcurve.get())) { | |
| 6632 | ✗ | oldcurve->remove(); | |
| 6633 | } | ||
| 6634 | ✗ | waterHeater.setPartLoadFactorCurve(newcurve->cast<model::CurveCubic>()); | |
| 6635 | ✗ | } | |
| 6636 | ✗ | } | |
| 6637 | |||
| 6638 | ✗ | boost::optional<double> _offCyclePrstcLossSim = lexicalCastToDouble(element.child("OffCyclePrstcLossSim")); | |
| 6639 | ✗ | if (_offCyclePrstcLossSim) { | |
| 6640 | ✗ | waterHeater.setOffCycleParasiticFuelConsumptionRate(_offCyclePrstcLossSim.get()); | |
| 6641 | } | ||
| 6642 | |||
| 6643 | // TODO: check input? | ||
| 6644 | ✗ | std::string offCycleFuelSrc = element.child("OffCycleFuelSrc").text().as_string(); | |
| 6645 | ✗ | waterHeater.setOffCycleParasiticFuelType(offCycleFuelSrc); | |
| 6646 | |||
| 6647 | ✗ | waterHeater.setOffCycleParasiticHeatFractiontoTank(0.8); | |
| 6648 | |||
| 6649 | ✗ | boost::optional<double> _onCyclePrstcLossSim = lexicalCastToDouble(element.child("OnCyclePrstcLossSim")); | |
| 6650 | ✗ | if (_onCyclePrstcLossSim) { | |
| 6651 | ✗ | waterHeater.setOnCycleParasiticFuelConsumptionRate(_onCyclePrstcLossSim.get()); | |
| 6652 | } | ||
| 6653 | |||
| 6654 | ✗ | std::string onCycleFuelSrc = element.child("OnCycleFuelSrc").text().as_string(); | |
| 6655 | ✗ | waterHeater.setOnCycleParasiticFuelType(onCycleFuelSrc); | |
| 6656 | |||
| 6657 | ✗ | waterHeater.setOnCycleParasiticHeatFractiontoTank(0.0); | |
| 6658 | |||
| 6659 | ✗ | boost::optional<double> _tankOffCycleLossCoefSim = lexicalCastToDouble(element.child("TankOffCycleLossCoefSim")); | |
| 6660 | ✗ | if (_tankOffCycleLossCoefSim) { | |
| 6661 | ✗ | waterHeater.setOffCycleLossCoefficienttoAmbientTemperature(_tankOffCycleLossCoefSim.get() * 0.5275); | |
| 6662 | } | ||
| 6663 | |||
| 6664 | ✗ | waterHeater.setOffCycleLossFractiontoThermalZone(1.0); | |
| 6665 | |||
| 6666 | // TODO: this used to be wrong | ||
| 6667 | ✗ | boost::optional<double> _tankOnCycleLossCoefSim = lexicalCastToDouble(element.child("TankOnCycleLossCoefSim")); | |
| 6668 | ✗ | if (_tankOnCycleLossCoefSim) { | |
| 6669 | ✗ | waterHeater.setOnCycleLossCoefficienttoAmbientTemperature(_tankOnCycleLossCoefSim.get() * 0.5275); | |
| 6670 | } | ||
| 6671 | |||
| 6672 | ✗ | boost::optional<double> _capRtdSim = lexicalCastToDouble(element.child("CapRtdSim")); | |
| 6673 | ✗ | if (_capRtdSim) { | |
| 6674 | ✗ | coil.setRatedHeatingCapacity(unitToUnit(_capRtdSim.get(), "Btu/h", "W").get()); | |
| 6675 | } | ||
| 6676 | |||
| 6677 | ✗ | boost::optional<double> _cOP = lexicalCastToDouble(element.child("COP")); | |
| 6678 | ✗ | if (_cOP) { | |
| 6679 | ✗ | coil.setRatedCOP(_cOP.get()); | |
| 6680 | } | ||
| 6681 | |||
| 6682 | ✗ | boost::optional<double> _cndsrPumpPwrSim = lexicalCastToDouble(element.child("CndsrPumpPwrSim")); | |
| 6683 | ✗ | if (_cndsrPumpPwrSim) { | |
| 6684 | ✗ | coil.setCondenserWaterPumpPower(_cndsrPumpPwrSim.get()); | |
| 6685 | } | ||
| 6686 | |||
| 6687 | ✗ | boost::optional<double> _crankcaseHtrCapSim = lexicalCastToDouble(element.child("CrankcaseHtrCapSim")); | |
| 6688 | ✗ | if (_crankcaseHtrCapSim) { | |
| 6689 | ✗ | coil.setCrankcaseHeaterCapacity(_crankcaseHtrCapSim.get()); | |
| 6690 | } | ||
| 6691 | |||
| 6692 | ✗ | coil.setMaximumAmbientTemperatureforCrankcaseHeaterOperation(10); | |
| 6693 | ✗ | boost::optional<double> _crankcaseHtrHiLimTemp = lexicalCastToDouble(element.child("CrankcaseHtrHiLimTemp")); | |
| 6694 | ✗ | if (_crankcaseHtrHiLimTemp) { | |
| 6695 | ✗ | coil.setMaximumAmbientTemperatureforCrankcaseHeaterOperation(unitToUnit(_crankcaseHtrHiLimTemp.get(), "F", "C").get()); | |
| 6696 | } | ||
| 6697 | |||
| 6698 | ✗ | boost::optional<double> _rtdSensHtRat = lexicalCastToDouble(element.child("RtdSensHtRat")); | |
| 6699 | ✗ | if (_rtdSensHtRat) { | |
| 6700 | ✗ | coil.setRatedSensibleHeatRatio(_rtdSensHtRat.get()); | |
| 6701 | } else { | ||
| 6702 | ✗ | coil.setRatedSensibleHeatRatio(0.85); | |
| 6703 | } | ||
| 6704 | ✗ | coil.setRatedEvaporatorInletAirDryBulbTemperature(19.7); | |
| 6705 | ✗ | coil.setRatedEvaporatorInletAirWetBulbTemperature(13.5); | |
| 6706 | ✗ | coil.setRatedCondenserInletWaterTemperature(57.5); | |
| 6707 | ✗ | coil.setEvaporatorFanPowerIncludedinRatedCOP(true); | |
| 6708 | ✗ | coil.setCondenserPumpPowerIncludedinRatedCOP(true); | |
| 6709 | ✗ | coil.setCondenserPumpHeatIncludedinRatedHeatingCapacityandRatedCOP(true); | |
| 6710 | ✗ | coil.setFractionofCondenserPumpHeattoWater(0.2); | |
| 6711 | ✗ | coil.setMaximumAmbientTemperatureforCrankcaseHeaterOperation(10.0); | |
| 6712 | ✗ | coil.setEvaporatorAirTemperatureTypeforCurveObjects("DryBulbTemperature"); | |
| 6713 | |||
| 6714 | ✗ | auto setCurve = [&](const std::string& elementName, | |
| 6715 | const std::function<bool(model::CoilWaterHeatingAirToWaterHeatPump&, const model::Curve&)>& osSetter, | ||
| 6716 | const std::function<model::Curve(model::CoilWaterHeatingAirToWaterHeatPump&)>& osGetter) { | ||
| 6717 | ✗ | const auto* value = element.child(elementName.c_str()).text().as_string(); | |
| 6718 | ✗ | auto newcurve = model.getModelObjectByName<model::Curve>(value); | |
| 6719 | ✗ | if (newcurve) { | |
| 6720 | ✗ | auto oldcurve = osGetter(coil); | |
| 6721 | ✗ | if (oldcurve != newcurve.get()) { | |
| 6722 | ✗ | oldcurve.remove(); | |
| 6723 | } | ||
| 6724 | ✗ | osSetter(coil, newcurve.get()); | |
| 6725 | ✗ | } | |
| 6726 | ✗ | }; | |
| 6727 | |||
| 6728 | ✗ | setCurve("Cap_fTempCrvRef", std::mem_fn(&model::CoilWaterHeatingAirToWaterHeatPump::setHeatingCapacityFunctionofTemperatureCurve), | |
| 6729 | ✗ | std::mem_fn(&model::CoilWaterHeatingAirToWaterHeatPump::heatingCapacityFunctionofTemperatureCurve)); | |
| 6730 | |||
| 6731 | ✗ | setCurve("COP_fTempCrvRef", std::mem_fn(&model::CoilWaterHeatingAirToWaterHeatPump::setHeatingCOPFunctionofTemperatureCurve), | |
| 6732 | ✗ | std::mem_fn(&model::CoilWaterHeatingAirToWaterHeatPump::heatingCOPFunctionofTemperatureCurve)); | |
| 6733 | |||
| 6734 | // Override default | ||
| 6735 | { | ||
| 6736 | ✗ | auto curve = coil.partLoadFractionCorrelationCurve().cast<model::CurveQuadratic>(); | |
| 6737 | ✗ | curve.setCoefficient1Constant(1.0); | |
| 6738 | ✗ | curve.setCoefficient2x(0.0); | |
| 6739 | ✗ | curve.setCoefficient3xPOW2(0.0); | |
| 6740 | ✗ | curve.setMinimumValueofx(0.0); | |
| 6741 | ✗ | curve.setMaximumValueofx(1.0); | |
| 6742 | ✗ | coil.setPartLoadFractionCorrelationCurve(curve); | |
| 6743 | ✗ | } | |
| 6744 | |||
| 6745 | ✗ | fan.setFanEfficiency(0.5); | |
| 6746 | ✗ | fan.setMotorEfficiency(0.85); | |
| 6747 | ✗ | fan.setMotorInAirstreamFraction(1.0); | |
| 6748 | ✗ | fan.setEndUseSubcategory(" "); | |
| 6749 | |||
| 6750 | ✗ | boost::optional<double> _fanTotStaticPressSim = lexicalCastToDouble(element.child("FanTotStaticPressSim")); | |
| 6751 | ✗ | if (_fanTotStaticPressSim) { | |
| 6752 | ✗ | fan.setPressureRise(_fanTotStaticPressSim.get() * 249.0889); | |
| 6753 | } | ||
| 6754 | |||
| 6755 | // TODO: this is a redefinition (exaclty the same "key" as above, except above sets the heatPump.setEvaporatorAirFlowRate) | ||
| 6756 | // boost::optional<double> _fanFlowCapSim = lexicalCastToDouble(element.child("FanFlowCapSim")); | ||
| 6757 | ✗ | if (_fanFlowCapSim) { | |
| 6758 | ✗ | double value = unitToUnit(_fanFlowCapSim.get(), "cfm", "m^3/s").get(); | |
| 6759 | ✗ | fan.setMaximumFlowRate(value); | |
| 6760 | ✗ | coil.setRatedEvaporatorAirFlowRate(value); | |
| 6761 | } else { | ||
| 6762 | ✗ | coil.autosizeRatedEvaporatorAirFlowRate(); | |
| 6763 | ✗ | fan.autosizeMaximumFlowRate(); | |
| 6764 | } | ||
| 6765 | |||
| 6766 | ✗ | return waterHeater; | |
| 6767 | ✗ | } else { | |
| 6768 |
1/1✓ Branch 1 taken 1 time.
|
1 | model::WaterHeaterMixed waterHeaterMixed(model); |
| 6769 | |||
| 6770 | // Name | ||
| 6771 | |||
| 6772 |
1/1✓ Branch 1 taken 1 time.
|
1 | pugi::xml_node nameElement = element.child("Name"); |
| 6773 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | std::string name = nameElement.text().as_string(); |
| 6774 |
1/1✓ Branch 1 taken 1 time.
|
1 | waterHeaterMixed.setName(name); |
| 6775 | |||
| 6776 | // ThrmlEff | ||
| 6777 | |||
| 6778 |
1/1✓ Branch 1 taken 1 time.
|
1 | pugi::xml_node thrmlEffElement = element.child("ThrmlEff"); |
| 6779 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> _thrmlEff = lexicalCastToDouble(thrmlEffElement); |
| 6780 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_thrmlEff) { |
| 6781 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | waterHeaterMixed.setHeaterThermalEfficiency(_thrmlEff.get()); |
| 6782 | } | ||
| 6783 | |||
| 6784 | // Ambient water temperature indicator | ||
| 6785 | |||
| 6786 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | waterHeaterMixed.setAmbientTemperatureIndicator("Schedule"); |
| 6787 | |||
| 6788 |
1/1✓ Branch 1 taken 1 time.
|
1 | model::ScheduleRuleset scheduleRuleset = model::ScheduleRuleset(model); |
| 6789 | |||
| 6790 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | scheduleRuleset.setName(name + " Ambient Temperature"); |
| 6791 | |||
| 6792 |
1/1✓ Branch 1 taken 1 time.
|
1 | model::ScheduleDay scheduleDay = scheduleRuleset.defaultDaySchedule(); |
| 6793 | |||
| 6794 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | scheduleDay.addValue(Time(1.0), 20.0); |
| 6795 | |||
| 6796 |
1/1✓ Branch 1 taken 1 time.
|
1 | waterHeaterMixed.setAmbientTemperatureSchedule(scheduleRuleset); |
| 6797 | |||
| 6798 | // StorCap | ||
| 6799 | |||
| 6800 |
1/1✓ Branch 1 taken 1 time.
|
1 | pugi::xml_node wtrHtrStorCapElement = element.child("StorCapSim"); |
| 6801 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> _wtrHtrStorCap = lexicalCastToDouble(wtrHtrStorCapElement); |
| 6802 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_wtrHtrStorCap) { |
| 6803 |
6/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
|
4 | waterHeaterMixed.setTankVolume(unitToUnit(_wtrHtrStorCap.get(), "gal", "m^3").get()); |
| 6804 | } | ||
| 6805 | |||
| 6806 | // CapRtd | ||
| 6807 | |||
| 6808 |
1/1✓ Branch 1 taken 1 time.
|
1 | pugi::xml_node wtrHtrMaxCapElement = element.child("CapRtdSim"); |
| 6809 | |||
| 6810 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> _wtrHtrMaxCap = lexicalCastToDouble(wtrHtrMaxCapElement); |
| 6811 | |||
| 6812 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_wtrHtrMaxCap) { |
| 6813 |
6/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
|
4 | waterHeaterMixed.setHeaterMaximumCapacity(unitToUnit(_wtrHtrMaxCap.get(), "Btu/h", "W").get()); |
| 6814 | } | ||
| 6815 | |||
| 6816 | // MinCap | ||
| 6817 | |||
| 6818 |
1/1✓ Branch 1 taken 1 time.
|
1 | pugi::xml_node minCapElement = element.child("MinCap"); |
| 6819 | |||
| 6820 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> _minCap = lexicalCastToDouble(minCapElement); |
| 6821 | |||
| 6822 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (_minCap) { |
| 6823 | ✗ | waterHeaterMixed.setHeaterMinimumCapacity(unitToUnit(_minCap.get(), "Btu/h", "W").get()); | |
| 6824 | } | ||
| 6825 | |||
| 6826 | // OffCyclePrstcLoss | ||
| 6827 | |||
| 6828 |
1/1✓ Branch 1 taken 1 time.
|
1 | pugi::xml_node offCyclePrstcLossElement = element.child("OffCyclePrstcLossSim"); |
| 6829 | |||
| 6830 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> _offCyclePrstcLoss = lexicalCastToDouble(offCyclePrstcLossElement); |
| 6831 | |||
| 6832 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_offCyclePrstcLoss) { |
| 6833 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | waterHeaterMixed.setOffCycleParasiticFuelConsumptionRate(_offCyclePrstcLoss.get()); |
| 6834 | } | ||
| 6835 | |||
| 6836 | // OnCyclePrstcLoss | ||
| 6837 | |||
| 6838 |
1/1✓ Branch 1 taken 1 time.
|
1 | pugi::xml_node onCyclePrstcLossElement = element.child("OnCyclePrstcLossSim"); |
| 6839 | |||
| 6840 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> _onCyclePrstcLoss = lexicalCastToDouble(onCyclePrstcLossElement); |
| 6841 | |||
| 6842 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_onCyclePrstcLoss) { |
| 6843 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | waterHeaterMixed.setOnCycleParasiticFuelConsumptionRate(_onCyclePrstcLoss.get()); |
| 6844 | } | ||
| 6845 | |||
| 6846 | // TankOffCycleLossCoef | ||
| 6847 | |||
| 6848 |
1/1✓ Branch 1 taken 1 time.
|
1 | pugi::xml_node tankOffCycleLossCoefElement = element.child("TankOffCycleLossCoefSim"); |
| 6849 | |||
| 6850 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> _tankOffCycleLossCoef = lexicalCastToDouble(tankOffCycleLossCoefElement); |
| 6851 | |||
| 6852 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_tankOffCycleLossCoef) { |
| 6853 | // Convert Btu/h-F to W/K | ||
| 6854 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | waterHeaterMixed.setOffCycleLossCoefficienttoAmbientTemperature(_tankOffCycleLossCoef.get() * 0.5275); |
| 6855 | } | ||
| 6856 | |||
| 6857 | // TankOnCycleLossCoef | ||
| 6858 | |||
| 6859 |
1/1✓ Branch 1 taken 1 time.
|
1 | pugi::xml_node tankOnCycleLossCoefElement = element.child("TankOnCycleLossCoefSim"); |
| 6860 | |||
| 6861 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> _tankOnCycleLossCoef = lexicalCastToDouble(tankOnCycleLossCoefElement); |
| 6862 | |||
| 6863 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_tankOnCycleLossCoef) { |
| 6864 | // Convert Btu/h-F to W/K | ||
| 6865 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | waterHeaterMixed.setOnCycleLossCoefficienttoAmbientTemperature(_tankOnCycleLossCoef.get() * 0.5275); |
| 6866 | } | ||
| 6867 | |||
| 6868 | // Setpoint schedule | ||
| 6869 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | auto fixedSupTempElement = element.parent().child("FixedSupTemp"); |
| 6870 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (fixedSupTempElement) { |
| 6871 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> _fixedSupTemp = lexicalCastToDouble(fixedSupTempElement); |
| 6872 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_fixedSupTemp) { |
| 6873 |
5/5✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
|
3 | double value = unitToUnit(_fixedSupTemp.get(), "F", "C").get(); |
| 6874 |
1/1✓ Branch 1 taken 1 time.
|
1 | model::ScheduleRuleset schedule(model); |
| 6875 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | schedule.setName(waterHeaterMixed.name().get() + " Setpoint Temp"); |
| 6876 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto scheduleDay = schedule.defaultDaySchedule(); |
| 6877 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | scheduleDay.addValue(Time(1.0), value); |
| 6878 |
1/1✓ Branch 1 taken 1 time.
|
1 | waterHeaterMixed.setSetpointTemperatureSchedule(schedule); |
| 6879 | 1 | } | |
| 6880 | } else { | ||
| 6881 | ✗ | model::Schedule setpointTempSchedule = serviceHotWaterSetpointSchedule(model); | |
| 6882 | ✗ | waterHeaterMixed.setSetpointTemperatureSchedule(setpointTempSchedule); | |
| 6883 | ✗ | } | |
| 6884 | |||
| 6885 | // HIR_fPLRCrvRef | ||
| 6886 | |||
| 6887 |
1/1✓ Branch 1 taken 1 time.
|
1 | pugi::xml_node hirfPLRCrvRefElement = element.child("HIR_fPLRCrvRef"); |
| 6888 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | boost::optional<model::CurveCubic> hirfPLRCrv = model.getConcreteModelObjectByName<model::CurveCubic>(hirfPLRCrvRefElement.text().as_string()); |
| 6889 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (hirfPLRCrv) { |
| 6890 | ✗ | waterHeaterMixed.setPartLoadFactorCurve(hirfPLRCrv.get()); | |
| 6891 | } | ||
| 6892 | |||
| 6893 | // FuelSrc | ||
| 6894 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto fuelSrcElement = element.child("FuelSrc"); |
| 6895 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | waterHeaterMixed.setHeaterFuelType(fuelSrcElement.text().as_string()); |
| 6896 | |||
| 6897 | // OffCycleFuelSrc | ||
| 6898 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto offCycleFuelSrcElement = element.child("OffCycleFuelSrc"); |
| 6899 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | waterHeaterMixed.setOffCycleParasiticFuelType(offCycleFuelSrcElement.text().as_string()); |
| 6900 | |||
| 6901 | // OnCycleFuelSrc | ||
| 6902 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto onCycleFuelSrcElement = element.child("OnCycleFuelSrc"); |
| 6903 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | waterHeaterMixed.setOnCycleParasiticFuelType(onCycleFuelSrcElement.text().as_string()); |
| 6904 | |||
| 6905 |
1/1✓ Branch 1 taken 1 time.
|
1 | return waterHeaterMixed; |
| 6906 | 1 | } | |
| 6907 | 1 | } | |
| 6908 | |||
| 6909 | ✗ | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateZnSys(const pugi::xml_node& element, openstudio::model::Model& model) { | |
| 6910 | ✗ | if (!istringEqual(element.name(), "ZnSys")) { | |
| 6911 | ✗ | return boost::none; | |
| 6912 | } | ||
| 6913 | |||
| 6914 | ✗ | boost::optional<model::ModelObject> result; | |
| 6915 | |||
| 6916 | // Name | ||
| 6917 | ✗ | std::string name = element.child("Name").text().as_string(); | |
| 6918 | |||
| 6919 | // Type | ||
| 6920 | ✗ | pugi::xml_node typeElement = element.child("TypeSim"); | |
| 6921 | ✗ | if (openstudio::istringEqual(typeElement.text().as_string(), "Exhaust")) { | |
| 6922 | ✗ | return boost::none; | |
| 6923 | } | ||
| 6924 | ✗ | std::string type = typeElement.text().as_string(); | |
| 6925 | |||
| 6926 | // Availability Schedule | ||
| 6927 | ✗ | pugi::xml_node scheduleElement = element.child("AvailSchRef"); | |
| 6928 | |||
| 6929 | ✗ | boost::optional<model::Schedule> schedule; | |
| 6930 | |||
| 6931 | ✗ | if (scheduleElement) { | |
| 6932 | ✗ | schedule = model.getModelObjectByName<model::Schedule>(scheduleElement.text().as_string()); | |
| 6933 | } | ||
| 6934 | |||
| 6935 | ✗ | if (!schedule) { | |
| 6936 | ✗ | schedule = model.alwaysOnDiscreteSchedule(); | |
| 6937 | } | ||
| 6938 | |||
| 6939 | // FlowCap | ||
| 6940 | |||
| 6941 | ✗ | pugi::xml_node fanElement = element.child("Fan"); | |
| 6942 | |||
| 6943 | ✗ | pugi::xml_node flowCapElement = fanElement.child("FlowCapSim"); | |
| 6944 | ✗ | pugi::xml_node flowMinElement = fanElement.child("FlowMinSim"); | |
| 6945 | |||
| 6946 | ✗ | boost::optional<double> flowCap; | |
| 6947 | ✗ | boost::optional<double> flowMin; | |
| 6948 | |||
| 6949 | ✗ | if (!autosize()) { | |
| 6950 | ✗ | boost::optional<double> _flowCap = lexicalCastToDouble(flowCapElement); | |
| 6951 | |||
| 6952 | ✗ | if (_flowCap) { | |
| 6953 | ✗ | flowCap = unitToUnit(_flowCap.get(), "cfm", "m^3/s").get(); | |
| 6954 | } | ||
| 6955 | |||
| 6956 | ✗ | boost::optional<double> _flowMin = lexicalCastToDouble(flowMinElement); | |
| 6957 | |||
| 6958 | ✗ | if (_flowMin) { | |
| 6959 | ✗ | flowMin = unitToUnit(_flowMin.get(), "cfm", "m^3/s").get(); | |
| 6960 | } | ||
| 6961 | } | ||
| 6962 | |||
| 6963 | // HtgDsgnSupAirTemp | ||
| 6964 | |||
| 6965 | ✗ | boost::optional<double> htgDsgnSupAirTemp; | |
| 6966 | |||
| 6967 | ✗ | if (!autosize()) { | |
| 6968 | ✗ | pugi::xml_node htgDsgnSupAirTempElement = element.child("HtgDsgnSupAirTemp"); | |
| 6969 | |||
| 6970 | ✗ | boost::optional<double> _htgDsgnSupAirTemp = lexicalCastToDouble(htgDsgnSupAirTempElement); | |
| 6971 | ✗ | if (_htgDsgnSupAirTemp) { | |
| 6972 | ✗ | htgDsgnSupAirTemp = unitToUnit(_htgDsgnSupAirTemp.get(), "F", "C").get(); | |
| 6973 | } | ||
| 6974 | } | ||
| 6975 | |||
| 6976 | ✗ | if (istringEqual(type, "PTAC") || istringEqual(type, "SZAC")) { | |
| 6977 | // Fan | ||
| 6978 | ✗ | boost::optional<model::HVACComponent> fan; | |
| 6979 | ✗ | if (auto mo = translateFan(fanElement, model)) { | |
| 6980 | ✗ | fan = mo->optionalCast<model::HVACComponent>(); | |
| 6981 | ✗ | } | |
| 6982 | ✗ | if (!fan) { | |
| 6983 | ✗ | LOG(Error, name << " references an undefined fan."); | |
| 6984 | } | ||
| 6985 | |||
| 6986 | // Heating Coil | ||
| 6987 | ✗ | pugi::xml_node heatingCoilElement = element.child("CoilHtg"); | |
| 6988 | ✗ | boost::optional<model::HVACComponent> heatingCoil; | |
| 6989 | ✗ | if (auto mo = translateCoilHeating(heatingCoilElement, model)) { | |
| 6990 | ✗ | heatingCoil = mo->optionalCast<model::HVACComponent>(); | |
| 6991 | ✗ | } | |
| 6992 | ✗ | if (!heatingCoil) { | |
| 6993 | ✗ | LOG(Error, name << " references an undefined heating coil."); | |
| 6994 | } | ||
| 6995 | |||
| 6996 | // Cooling Coil | ||
| 6997 | ✗ | pugi::xml_node coolingCoilElement = element.child("CoilClg"); | |
| 6998 | ✗ | boost::optional<model::HVACComponent> coolingCoil; | |
| 6999 | ✗ | if (auto mo = translateCoilCooling(coolingCoilElement, model)) { | |
| 7000 | ✗ | coolingCoil = mo->optionalCast<model::HVACComponent>(); | |
| 7001 | ✗ | } | |
| 7002 | ✗ | if (!coolingCoil) { | |
| 7003 | ✗ | LOG(Error, name << " references an undefined cooling coil."); | |
| 7004 | } | ||
| 7005 | |||
| 7006 | ✗ | if (!schedule) { | |
| 7007 | ✗ | LOG(Error, name << " references an undefined schedule."); | |
| 7008 | } | ||
| 7009 | |||
| 7010 | // PTAC | ||
| 7011 | ✗ | if (schedule && fan && heatingCoil && coolingCoil) { | |
| 7012 | ✗ | model::ZoneHVACPackagedTerminalAirConditioner ptac(model, schedule.get(), fan.get(), heatingCoil.get(), coolingCoil.get()); | |
| 7013 | |||
| 7014 | ✗ | if (flowCap) { | |
| 7015 | ✗ | ptac.setSupplyAirFlowRateDuringCoolingOperation(flowCap.get()); | |
| 7016 | ✗ | ptac.setSupplyAirFlowRateDuringHeatingOperation(flowCap.get()); | |
| 7017 | ✗ | ptac.setSupplyAirFlowRateWhenNoCoolingorHeatingisNeeded(flowCap.get()); | |
| 7018 | } | ||
| 7019 | |||
| 7020 | // Name | ||
| 7021 | ✗ | ptac.setName(name); | |
| 7022 | |||
| 7023 | // FanCtrl | ||
| 7024 | ✗ | pugi::xml_node fanCtrlElement = element.child("FanCtrl"); | |
| 7025 | ✗ | if (istringEqual(fanCtrlElement.text().as_string(), "Continuous")) { | |
| 7026 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 7027 | ✗ | ptac.setSupplyAirFanOperatingModeSchedule(schedule); | |
| 7028 | ✗ | } | |
| 7029 | |||
| 7030 | ✗ | result = ptac; | |
| 7031 | ✗ | } | |
| 7032 | ✗ | } else if (istringEqual(type, "WSHP")) { | |
| 7033 | ✗ | pugi::xml_node htPumpSuppTempElement; | |
| 7034 | ✗ | pugi::xml_node htPumpCprsrLockoutTempElement; | |
| 7035 | |||
| 7036 | // Fan | ||
| 7037 | ✗ | pugi::xml_node fanElement = element.child("Fan"); | |
| 7038 | ✗ | boost::optional<model::HVACComponent> fan; | |
| 7039 | ✗ | if (auto mo = translateFan(fanElement, model)) { | |
| 7040 | ✗ | fan = mo->optionalCast<model::HVACComponent>(); | |
| 7041 | ✗ | } | |
| 7042 | ✗ | if (!fan) { | |
| 7043 | ✗ | LOG(Error, name << " references an undefined fan."); | |
| 7044 | } | ||
| 7045 | |||
| 7046 | // Heating Coil | ||
| 7047 | ✗ | boost::optional<model::CoilHeatingWaterToAirHeatPumpEquationFit> heatingCoil; | |
| 7048 | ✗ | boost::optional<model::HVACComponent> suppHeatingCoil; | |
| 7049 | ✗ | std::vector<pugi::xml_node> heatingCoilElements = makeVectorOfChildren(element, "CoilHtg"); | |
| 7050 | ✗ | for (std::vector<pugi::xml_node>::size_type i = 0; i < heatingCoilElements.size(); i++) { | |
| 7051 | ✗ | pugi::xml_node heatingCoilElement = heatingCoilElements[i]; | |
| 7052 | ✗ | pugi::xml_node typeElement = heatingCoilElement.child("Type"); | |
| 7053 | ✗ | if (auto mo = translateCoilHeating(heatingCoilElement, model)) { | |
| 7054 | ✗ | if (istringEqual(typeElement.text().as_string(), "HeatPump")) { | |
| 7055 | ✗ | if (auto hvacComp = mo->optionalCast<model::HVACComponent>()) { | |
| 7056 | ✗ | if ((heatingCoil = hvacComp->optionalCast<model::CoilHeatingWaterToAirHeatPumpEquationFit>())) { | |
| 7057 | ✗ | htPumpSuppTempElement = heatingCoilElement.child("HtPumpSuppTemp"); | |
| 7058 | ✗ | htPumpCprsrLockoutTempElement = heatingCoilElement.child("HtPumpCprsrLockoutTemp"); | |
| 7059 | } | ||
| 7060 | ✗ | } | |
| 7061 | } else { | ||
| 7062 | ✗ | suppHeatingCoil = mo->optionalCast<model::HVACComponent>(); | |
| 7063 | } | ||
| 7064 | ✗ | } | |
| 7065 | |||
| 7066 | ✗ | if (i > 1) { | |
| 7067 | ✗ | LOG(Warn, name << " has unused heating coils defined."); | |
| 7068 | } | ||
| 7069 | } | ||
| 7070 | |||
| 7071 | ✗ | if (!heatingCoil) { | |
| 7072 | ✗ | LOG(Error, name << " has an undefined heating coil."); | |
| 7073 | } | ||
| 7074 | ✗ | if (!suppHeatingCoil) { | |
| 7075 | ✗ | LOG(Error, name << " has an undefined supplementary heating coil."); | |
| 7076 | } | ||
| 7077 | |||
| 7078 | // Cooling Coil | ||
| 7079 | ✗ | pugi::xml_node coolingCoilElement = element.child("CoilClg"); | |
| 7080 | ✗ | boost::optional<model::CoilCoolingWaterToAirHeatPumpEquationFit> coolingCoil; | |
| 7081 | ✗ | if (auto mo = translateCoilCooling(coolingCoilElement, model)) { | |
| 7082 | ✗ | if (auto hvacComp = mo->optionalCast<model::HVACComponent>()) { | |
| 7083 | ✗ | coolingCoil = hvacComp->optionalCast<model::CoilCoolingWaterToAirHeatPumpEquationFit>(); | |
| 7084 | ✗ | } | |
| 7085 | ✗ | } | |
| 7086 | ✗ | if (!coolingCoil) { | |
| 7087 | ✗ | LOG(Error, name << " has an undefined cooling coil."); | |
| 7088 | } | ||
| 7089 | |||
| 7090 | ✗ | boost::optional<model::ZoneHVACWaterToAirHeatPump> wshp; | |
| 7091 | |||
| 7092 | // Default Supplemental Heating Coil if one is not provided | ||
| 7093 | ✗ | if (!suppHeatingCoil) { | |
| 7094 | ✗ | model::Schedule alwaysOnDiscreteSchedule = model.alwaysOnDiscreteSchedule(); | |
| 7095 | ✗ | suppHeatingCoil = model::CoilHeatingElectric(model, alwaysOnDiscreteSchedule); | |
| 7096 | ✗ | LOG(Warn, name << " creating a default supplementary heating coil"); | |
| 7097 | ✗ | } | |
| 7098 | |||
| 7099 | ✗ | if (!schedule) { | |
| 7100 | ✗ | LOG(Error, name << " has an undefined schedule."); | |
| 7101 | } | ||
| 7102 | |||
| 7103 | ✗ | if (schedule && fan && heatingCoil && coolingCoil && suppHeatingCoil) { | |
| 7104 | ✗ | wshp = model::ZoneHVACWaterToAirHeatPump(model, schedule.get(), fan.get(), heatingCoil.get(), coolingCoil.get(), suppHeatingCoil.get()); | |
| 7105 | ✗ | result = wshp; | |
| 7106 | |||
| 7107 | // Name | ||
| 7108 | ✗ | wshp->setName(name); | |
| 7109 | |||
| 7110 | ✗ | if (flowCap) { | |
| 7111 | ✗ | wshp->setSupplyAirFlowRateDuringCoolingOperation(flowCap.get()); | |
| 7112 | ✗ | wshp->setSupplyAirFlowRateDuringHeatingOperation(flowCap.get()); | |
| 7113 | ✗ | wshp->setSupplyAirFlowRateWhenNoCoolingorHeatingisNeeded(flowCap.get()); | |
| 7114 | } | ||
| 7115 | |||
| 7116 | ✗ | coolingCoil->setMaximumCyclingRate(2.5); | |
| 7117 | ✗ | coolingCoil->setLatentCapacityTimeConstant(60.0); | |
| 7118 | ✗ | coolingCoil->setFanDelayTime(0.01); | |
| 7119 | |||
| 7120 | ✗ | pugi::xml_node htPumpFanDelayElement = element.child("HtPumpFanDelay"); | |
| 7121 | ✗ | boost::optional<double> _htPumpFanDelay = lexicalCastToDouble(htPumpFanDelayElement); | |
| 7122 | ✗ | if (_htPumpFanDelay) { | |
| 7123 | ✗ | coolingCoil->setFanDelayTime(_htPumpFanDelay.get()); | |
| 7124 | } else { | ||
| 7125 | ✗ | coolingCoil->setFanDelayTime(60.0); | |
| 7126 | } | ||
| 7127 | |||
| 7128 | ✗ | if (htgDsgnSupAirTemp) { | |
| 7129 | ✗ | wshp->setMaximumSupplyAirTemperaturefromSupplementalHeater(htgDsgnSupAirTemp.get()); | |
| 7130 | } | ||
| 7131 | |||
| 7132 | ✗ | boost::optional<double> _htPumpSuppTemp = lexicalCastToDouble(htPumpSuppTempElement); | |
| 7133 | ✗ | if (_htPumpSuppTemp) { | |
| 7134 | ✗ | double value = unitToUnit(_htPumpSuppTemp.get(), "F", "C").get(); | |
| 7135 | ✗ | wshp->setMaximumOutdoorDryBulbTemperatureforSupplementalHeaterOperation(value); | |
| 7136 | } | ||
| 7137 | |||
| 7138 | // FanCtrl | ||
| 7139 | ✗ | pugi::xml_node fanCtrlElement = element.child("FanCtrl"); | |
| 7140 | ✗ | if (istringEqual(fanCtrlElement.text().as_string(), "Continuous")) { | |
| 7141 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 7142 | ✗ | wshp->setSupplyAirFanOperatingModeSchedule(schedule); | |
| 7143 | ✗ | } | |
| 7144 | } | ||
| 7145 | ✗ | } else if (istringEqual(type, "PTHP") || istringEqual(type, "SZHP")) { | |
| 7146 | ✗ | pugi::xml_node htPumpSuppTempElement; | |
| 7147 | ✗ | pugi::xml_node htPumpCprsrLockoutTempElement; | |
| 7148 | |||
| 7149 | // Fan | ||
| 7150 | ✗ | pugi::xml_node fanElement = element.child("Fan"); | |
| 7151 | ✗ | boost::optional<model::HVACComponent> fan; | |
| 7152 | ✗ | if (auto mo = translateFan(fanElement, model)) { | |
| 7153 | ✗ | fan = mo->optionalCast<model::HVACComponent>(); | |
| 7154 | ✗ | } | |
| 7155 | ✗ | if (!fan) { | |
| 7156 | ✗ | LOG(Error, name << " has an undefined fan."); | |
| 7157 | } | ||
| 7158 | |||
| 7159 | // Heating Coil | ||
| 7160 | ✗ | boost::optional<model::HVACComponent> heatingCoil; | |
| 7161 | ✗ | boost::optional<model::HVACComponent> suppHeatingCoil; | |
| 7162 | ✗ | std::vector<pugi::xml_node> heatingCoilElements = makeVectorOfChildren(element, "CoilHtg"); | |
| 7163 | ✗ | for (std::vector<pugi::xml_node>::size_type i = 0; i < heatingCoilElements.size(); i++) { | |
| 7164 | ✗ | pugi::xml_node heatingCoilElement = heatingCoilElements[i]; | |
| 7165 | ✗ | pugi::xml_node typeElement = heatingCoilElement.child("Type"); | |
| 7166 | ✗ | if (auto mo = translateCoilHeating(heatingCoilElement, model)) { | |
| 7167 | ✗ | if (istringEqual(typeElement.text().as_string(), "HeatPump")) { | |
| 7168 | ✗ | if ((heatingCoil = mo->optionalCast<model::HVACComponent>())) { | |
| 7169 | ✗ | htPumpSuppTempElement = heatingCoilElement.child("HtPumpSuppTemp"); | |
| 7170 | ✗ | htPumpCprsrLockoutTempElement = heatingCoilElement.child("HtPumpCprsrLockoutTemp"); | |
| 7171 | } | ||
| 7172 | } else { | ||
| 7173 | ✗ | suppHeatingCoil = mo->optionalCast<model::HVACComponent>(); | |
| 7174 | } | ||
| 7175 | ✗ | } | |
| 7176 | |||
| 7177 | ✗ | if (i > 1) { | |
| 7178 | ✗ | LOG(Warn, name << " has unused heating coils defined."); | |
| 7179 | } | ||
| 7180 | } | ||
| 7181 | |||
| 7182 | ✗ | if (!heatingCoil) { | |
| 7183 | ✗ | LOG(Error, name << " has an undefined heating coil."); | |
| 7184 | } | ||
| 7185 | ✗ | if (!suppHeatingCoil) { | |
| 7186 | ✗ | LOG(Error, name << " has an undefined supplementary heating coil."); | |
| 7187 | } | ||
| 7188 | |||
| 7189 | // Cooling Coil | ||
| 7190 | ✗ | pugi::xml_node coolingCoilElement = element.child("CoilClg"); | |
| 7191 | ✗ | boost::optional<model::HVACComponent> coolingCoil; | |
| 7192 | ✗ | if (auto mo = translateCoilCooling(coolingCoilElement, model)) { | |
| 7193 | ✗ | coolingCoil = mo->optionalCast<model::HVACComponent>(); | |
| 7194 | ✗ | } | |
| 7195 | ✗ | if (!coolingCoil) { | |
| 7196 | ✗ | LOG(Error, name << " has an undefined cooling coil."); | |
| 7197 | } | ||
| 7198 | |||
| 7199 | // Default Supplemental Heating Coil if one is not provided | ||
| 7200 | ✗ | if (!suppHeatingCoil) { | |
| 7201 | ✗ | model::Schedule alwaysOnDiscreteSchedule = model.alwaysOnDiscreteSchedule(); | |
| 7202 | ✗ | suppHeatingCoil = model::CoilHeatingElectric(model, alwaysOnDiscreteSchedule); | |
| 7203 | ✗ | LOG(Warn, name << " creating a default supplementary heating coil"); | |
| 7204 | ✗ | } | |
| 7205 | |||
| 7206 | ✗ | if (!heatingCoil) { | |
| 7207 | ✗ | model::Schedule alwaysOnDiscreteSchedule = model.alwaysOnDiscreteSchedule(); | |
| 7208 | |||
| 7209 | ✗ | model::CurveCubic totalHeatingCapacityFunctionofTemperatureCurve(model); | |
| 7210 | ✗ | totalHeatingCapacityFunctionofTemperatureCurve.setCoefficient1Constant(0.758746); | |
| 7211 | ✗ | totalHeatingCapacityFunctionofTemperatureCurve.setCoefficient2x(0.027626); | |
| 7212 | ✗ | totalHeatingCapacityFunctionofTemperatureCurve.setCoefficient3xPOW2(0.000148716); | |
| 7213 | ✗ | totalHeatingCapacityFunctionofTemperatureCurve.setCoefficient4xPOW3(0.0000034992); | |
| 7214 | ✗ | totalHeatingCapacityFunctionofTemperatureCurve.setMinimumValueofx(-20.0); | |
| 7215 | ✗ | totalHeatingCapacityFunctionofTemperatureCurve.setMaximumValueofx(20.0); | |
| 7216 | |||
| 7217 | ✗ | model::CurveCubic totalHeatingCapacityFunctionofFlowFractionCurve(model); | |
| 7218 | ✗ | totalHeatingCapacityFunctionofFlowFractionCurve.setCoefficient1Constant(0.84); | |
| 7219 | ✗ | totalHeatingCapacityFunctionofFlowFractionCurve.setCoefficient2x(0.16); | |
| 7220 | ✗ | totalHeatingCapacityFunctionofFlowFractionCurve.setCoefficient3xPOW2(0.0); | |
| 7221 | ✗ | totalHeatingCapacityFunctionofFlowFractionCurve.setCoefficient4xPOW3(0.0); | |
| 7222 | ✗ | totalHeatingCapacityFunctionofFlowFractionCurve.setMinimumValueofx(0.5); | |
| 7223 | ✗ | totalHeatingCapacityFunctionofFlowFractionCurve.setMaximumValueofx(1.5); | |
| 7224 | |||
| 7225 | ✗ | model::CurveCubic energyInputRatioFunctionofTemperatureCurve(model); | |
| 7226 | ✗ | energyInputRatioFunctionofTemperatureCurve.setCoefficient1Constant(1.19248); | |
| 7227 | ✗ | energyInputRatioFunctionofTemperatureCurve.setCoefficient2x(-0.0300438); | |
| 7228 | ✗ | energyInputRatioFunctionofTemperatureCurve.setCoefficient3xPOW2(0.00103745); | |
| 7229 | ✗ | energyInputRatioFunctionofTemperatureCurve.setCoefficient4xPOW3(-0.000023328); | |
| 7230 | ✗ | energyInputRatioFunctionofTemperatureCurve.setMinimumValueofx(-20.0); | |
| 7231 | ✗ | energyInputRatioFunctionofTemperatureCurve.setMaximumValueofx(20.0); | |
| 7232 | |||
| 7233 | ✗ | model::CurveQuadratic energyInputRatioFunctionofFlowFractionCurve(model); | |
| 7234 | ✗ | energyInputRatioFunctionofFlowFractionCurve.setCoefficient1Constant(1.3824); | |
| 7235 | ✗ | energyInputRatioFunctionofFlowFractionCurve.setCoefficient2x(-0.4336); | |
| 7236 | ✗ | energyInputRatioFunctionofFlowFractionCurve.setCoefficient3xPOW2(0.0512); | |
| 7237 | ✗ | energyInputRatioFunctionofFlowFractionCurve.setMinimumValueofx(0.0); | |
| 7238 | ✗ | energyInputRatioFunctionofFlowFractionCurve.setMaximumValueofx(1.0); | |
| 7239 | |||
| 7240 | ✗ | model::CurveQuadratic partLoadFractionCorrelationCurve(model); | |
| 7241 | ✗ | partLoadFractionCorrelationCurve.setCoefficient1Constant(0.75); | |
| 7242 | ✗ | partLoadFractionCorrelationCurve.setCoefficient2x(0.25); | |
| 7243 | ✗ | partLoadFractionCorrelationCurve.setCoefficient3xPOW2(0.0); | |
| 7244 | ✗ | partLoadFractionCorrelationCurve.setMinimumValueofx(0.0); | |
| 7245 | ✗ | partLoadFractionCorrelationCurve.setMaximumValueofx(1.0); | |
| 7246 | |||
| 7247 | ✗ | suppHeatingCoil = model::CoilHeatingDXSingleSpeed(model, alwaysOnDiscreteSchedule, totalHeatingCapacityFunctionofTemperatureCurve, | |
| 7248 | totalHeatingCapacityFunctionofFlowFractionCurve, energyInputRatioFunctionofTemperatureCurve, | ||
| 7249 | ✗ | energyInputRatioFunctionofFlowFractionCurve, partLoadFractionCorrelationCurve); | |
| 7250 | |||
| 7251 | ✗ | LOG(Warn, name << " creating a default heating coil"); | |
| 7252 | ✗ | } | |
| 7253 | |||
| 7254 | ✗ | boost::optional<model::ZoneHVACPackagedTerminalHeatPump> pthp; | |
| 7255 | ✗ | boost::optional<model::ZoneHVACWaterToAirHeatPump> wshp; | |
| 7256 | |||
| 7257 | ✗ | if (schedule && fan && heatingCoil && coolingCoil && suppHeatingCoil) { | |
| 7258 | ✗ | pthp = model::ZoneHVACPackagedTerminalHeatPump(model, schedule.get(), fan.get(), heatingCoil.get(), coolingCoil.get(), suppHeatingCoil.get()); | |
| 7259 | ✗ | result = pthp; | |
| 7260 | |||
| 7261 | ✗ | if (flowCap) { | |
| 7262 | ✗ | pthp->setSupplyAirFlowRateDuringCoolingOperation(flowCap.get()); | |
| 7263 | ✗ | pthp->setSupplyAirFlowRateDuringHeatingOperation(flowCap.get()); | |
| 7264 | ✗ | pthp->setSupplyAirFlowRateWhenNoCoolingorHeatingisNeeded(flowCap.get()); | |
| 7265 | } | ||
| 7266 | |||
| 7267 | // Name | ||
| 7268 | ✗ | pthp->setName(name); | |
| 7269 | |||
| 7270 | // HtPumpSuppTemp | ||
| 7271 | ✗ | boost::optional<double> _htPumpSuppTemp = lexicalCastToDouble(htPumpSuppTempElement); | |
| 7272 | ✗ | if (_htPumpSuppTemp) { | |
| 7273 | ✗ | double value = unitToUnit(_htPumpSuppTemp.get(), "F", "C").get(); | |
| 7274 | ✗ | pthp->setMaximumOutdoorDryBulbTemperatureforSupplementalHeaterOperation(value); | |
| 7275 | } | ||
| 7276 | |||
| 7277 | // HtPumpCprsrLockoutTemp | ||
| 7278 | ✗ | boost::optional<double> _htPumpCprsrLockoutTemp = lexicalCastToDouble(htPumpCprsrLockoutTempElement); | |
| 7279 | ✗ | if (_htPumpCprsrLockoutTemp) { | |
| 7280 | ✗ | double value = unitToUnit(_htPumpCprsrLockoutTemp.get(), "F", "C").get(); | |
| 7281 | ✗ | pthp->setMinimumOutdoorDryBulbTemperatureforCompressorOperation(value); | |
| 7282 | } | ||
| 7283 | |||
| 7284 | // FanCtrl | ||
| 7285 | ✗ | pugi::xml_node fanCtrlElement = element.child("FanCtrl"); | |
| 7286 | ✗ | if (istringEqual(fanCtrlElement.text().as_string(), "Continuous")) { | |
| 7287 | ✗ | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); | |
| 7288 | ✗ | pthp->setSupplyAirFanOperatingModeSchedule(schedule); | |
| 7289 | ✗ | } | |
| 7290 | |||
| 7291 | // htgDsgnSupAirTemp | ||
| 7292 | ✗ | if (htgDsgnSupAirTemp) { | |
| 7293 | ✗ | pthp->setMaximumSupplyAirTemperaturefromSupplementalHeater(htgDsgnSupAirTemp.get()); | |
| 7294 | } | ||
| 7295 | } | ||
| 7296 | ✗ | } else if (istringEqual(type, "Baseboard")) { | |
| 7297 | // Heating Coil | ||
| 7298 | ✗ | pugi::xml_node heatingCoilElement = element.child("CoilHtg"); | |
| 7299 | |||
| 7300 | // Heating Coil Type | ||
| 7301 | ✗ | std::string htgCoilType = heatingCoilElement.child("Type").text().as_string(); | |
| 7302 | |||
| 7303 | ✗ | if (istringEqual(htgCoilType, "Resistance")) { | |
| 7304 | // ZoneHVAC Baseboard Convective Electric | ||
| 7305 | ✗ | model::ZoneHVACBaseboardConvectiveElectric baseboard(model); | |
| 7306 | ✗ | result = baseboard; | |
| 7307 | |||
| 7308 | // Nominal Capacity | ||
| 7309 | ✗ | boost::optional<double> nomHtgCap; | |
| 7310 | |||
| 7311 | ✗ | if (!autosize()) { | |
| 7312 | ✗ | boost::optional<double> _capTotGrossRtdSim = lexicalCastToDouble(heatingCoilElement.child("CapTotGrossRtdSim")); | |
| 7313 | |||
| 7314 | ✗ | if (_capTotGrossRtdSim) { | |
| 7315 | ✗ | nomHtgCap = unitToUnit(_capTotGrossRtdSim.get(), "Btu/hr", "W"); | |
| 7316 | } | ||
| 7317 | } | ||
| 7318 | |||
| 7319 | //set the nominal capacity of the baseboard unit | ||
| 7320 | ✗ | if (nomHtgCap) { | |
| 7321 | ✗ | baseboard.setNominalCapacity(nomHtgCap.get()); | |
| 7322 | } | ||
| 7323 | |||
| 7324 | // Name | ||
| 7325 | ✗ | baseboard.setName(name); | |
| 7326 | ✗ | } else if (istringEqual(htgCoilType, "HotWater")) { | |
| 7327 | // Coil Heating Water Baseboard (special coil type for baseboard only) | ||
| 7328 | ✗ | model::CoilHeatingWaterBaseboard coil(model); | |
| 7329 | |||
| 7330 | // Autosize the max flow rate and the u-factor times area value | ||
| 7331 | ✗ | coil.autosizeMaximumWaterFlowRate(); | |
| 7332 | ✗ | coil.autosizeUFactorTimesAreaValue(); | |
| 7333 | |||
| 7334 | // Maximum Water Flow Rate (units are gpm in the sdd file) | ||
| 7335 | ✗ | boost::optional<double> dsnHtgFlowRt; | |
| 7336 | |||
| 7337 | ✗ | if (!autosize()) { | |
| 7338 | ✗ | boost::optional<double> _fluidFlowRtDsgnSim = lexicalCastToDouble(heatingCoilElement.child("FluidFlowRtDsgnSim")); | |
| 7339 | |||
| 7340 | ✗ | if (_fluidFlowRtDsgnSim) { | |
| 7341 | ✗ | dsnHtgFlowRt = unitToUnit(_fluidFlowRtDsgnSim.get(), "gal/min", "m^3/s"); | |
| 7342 | } | ||
| 7343 | } | ||
| 7344 | |||
| 7345 | ✗ | if (dsnHtgFlowRt) { | |
| 7346 | ✗ | coil.setMaximumWaterFlowRate(*dsnHtgFlowRt); | |
| 7347 | } | ||
| 7348 | |||
| 7349 | //Hook Coil to PlantLoop | ||
| 7350 | ✗ | pugi::xml_node fluidSegInRefElement = heatingCoilElement.child("FluidSegInRef"); | |
| 7351 | ✗ | if (!fluidSegInRefElement) { | |
| 7352 | ✗ | LOG(Error, "CoilHeatingWaterBaseboard for ZnSys '" << name << "' doesn't have a FluidSegInRef element! It will not be connected."); | |
| 7353 | } else { | ||
| 7354 | ✗ | if (boost::optional<model::PlantLoop> plant = loopForSupplySegment(fluidSegInRefElement, model)) { | |
| 7355 | ✗ | plant->addDemandBranchForComponent(coil); | |
| 7356 | // Figure out if this is connected to a ServiceHotWater system | ||
| 7357 | // If it is then make sure any supply segment pumps go on the branch, | ||
| 7358 | // as opposed to the demand side inlet branch | ||
| 7359 | ✗ | auto supplySegmentElement = supplySegment(fluidSegInRefElement); | |
| 7360 | ✗ | auto fluidSysTypeElment = supplySegmentElement.parent().child("Type"); | |
| 7361 | ✗ | if (openstudio::istringEqual(fluidSysTypeElment.text().as_string(), "ServiceHotWater")) { | |
| 7362 | ✗ | auto pumpElement = supplySegmentElement.child("Pump"); | |
| 7363 | ✗ | if (pumpElement) { | |
| 7364 | ✗ | if (auto modelObject = translatePump(pumpElement, model)) { | |
| 7365 | ✗ | auto hvacComponent = modelObject->cast<model::HVACComponent>(); | |
| 7366 | ✗ | auto inletNode = coil.inletModelObject()->cast<model::Node>(); | |
| 7367 | ✗ | hvacComponent.addToNode(inletNode); | |
| 7368 | ✗ | } | |
| 7369 | } | ||
| 7370 | } | ||
| 7371 | ✗ | } | |
| 7372 | } | ||
| 7373 | |||
| 7374 | // ZoneHVAC Baseboard Convective Electric | ||
| 7375 | ✗ | model::ZoneHVACBaseboardConvectiveWater baseboard(model, schedule.get(), coil); | |
| 7376 | ✗ | result = baseboard; | |
| 7377 | |||
| 7378 | // Name | ||
| 7379 | ✗ | baseboard.setName(name); | |
| 7380 | ✗ | } | |
| 7381 | ✗ | } else if (istringEqual(type, "FPFC")) { | |
| 7382 | ✗ | boost::optional<openstudio::model::ModelObject> mo; | |
| 7383 | |||
| 7384 | // Fan | ||
| 7385 | ✗ | pugi::xml_node fanElement = element.child("Fan"); | |
| 7386 | ✗ | boost::optional<model::HVACComponent> fan; | |
| 7387 | ✗ | if (auto mo = translateFan(fanElement, model)) { | |
| 7388 | ✗ | fan = mo->optionalCast<model::HVACComponent>(); | |
| 7389 | ✗ | } | |
| 7390 | ✗ | if (!fan) { | |
| 7391 | ✗ | LOG(Error, name << " has an undefined fan."); | |
| 7392 | } | ||
| 7393 | |||
| 7394 | // Heating Coil | ||
| 7395 | ✗ | pugi::xml_node heatingCoilElement = element.child("CoilHtg"); | |
| 7396 | ✗ | boost::optional<model::HVACComponent> heatingCoil; | |
| 7397 | ✗ | if ((mo = translateCoilHeating(heatingCoilElement, model))) { | |
| 7398 | ✗ | heatingCoil = mo->optionalCast<model::HVACComponent>(); | |
| 7399 | } | ||
| 7400 | ✗ | if (!heatingCoil) { | |
| 7401 | ✗ | LOG(Error, name << " has an undefined heating coil."); | |
| 7402 | } | ||
| 7403 | |||
| 7404 | // get the heating coil's max flow rate (units are gpm in the sdd file) | ||
| 7405 | ✗ | pugi::xml_node dsnHtgFlowRtElement = heatingCoilElement.child("FluidFlowRtDsgnSim"); | |
| 7406 | |||
| 7407 | ✗ | boost::optional<double> dsnHtgFlowRt; | |
| 7408 | |||
| 7409 | ✗ | if (!autosize()) { | |
| 7410 | ✗ | boost::optional<double> _dsnHtgFlowRt = lexicalCastToDouble(dsnHtgFlowRtElement); | |
| 7411 | ✗ | if (_dsnHtgFlowRt) { | |
| 7412 | ✗ | dsnHtgFlowRt = unitToUnit(_dsnHtgFlowRt.get(), "gal/min", "m^3/s"); | |
| 7413 | } | ||
| 7414 | } | ||
| 7415 | |||
| 7416 | // Cooling Coil | ||
| 7417 | ✗ | pugi::xml_node coolingCoilElement = element.child("CoilClg"); | |
| 7418 | ✗ | boost::optional<model::HVACComponent> coolingCoil; | |
| 7419 | ✗ | if (auto mo = translateCoilCooling(coolingCoilElement, model)) { | |
| 7420 | ✗ | coolingCoil = mo->optionalCast<model::HVACComponent>(); | |
| 7421 | ✗ | } | |
| 7422 | ✗ | if (!coolingCoil) { | |
| 7423 | ✗ | LOG(Error, name << " has an undefined cooling coil."); | |
| 7424 | } | ||
| 7425 | |||
| 7426 | // get the cooling coil's max flow rate (units are gpm in the sdd file) | ||
| 7427 | ✗ | pugi::xml_node dsnClgFlowRtElement = coolingCoilElement.child("FluidFlowRtDsgnSim"); | |
| 7428 | ✗ | boost::optional<double> dsnClgFlowRt; | |
| 7429 | ✗ | if (!autosize()) { | |
| 7430 | ✗ | boost::optional<double> _dsnClgFlowRt = lexicalCastToDouble(dsnClgFlowRtElement); | |
| 7431 | ✗ | if (_dsnClgFlowRt) { | |
| 7432 | ✗ | dsnClgFlowRt = unitToUnit(_dsnClgFlowRt.get(), "gal/min", "m^3/s"); | |
| 7433 | } | ||
| 7434 | } | ||
| 7435 | |||
| 7436 | ✗ | if (!schedule) { | |
| 7437 | ✗ | LOG(Error, name << " has an undefined schedule."); | |
| 7438 | } | ||
| 7439 | |||
| 7440 | // FPFC (Four Pipe Fan Coil) | ||
| 7441 | ✗ | if (schedule && fan && coolingCoil && heatingCoil) { | |
| 7442 | ✗ | model::ZoneHVACFourPipeFanCoil fpfc(model, schedule.get(), fan.get(), coolingCoil.get(), heatingCoil.get()); | |
| 7443 | ✗ | result = fpfc; | |
| 7444 | |||
| 7445 | // pull the max air flow rate from the fan and set in the fpfc | ||
| 7446 | ✗ | if (flowCap) { | |
| 7447 | ✗ | fpfc.setMaximumSupplyAirFlowRate(flowCap.get()); | |
| 7448 | } | ||
| 7449 | |||
| 7450 | //set the max heating water flow rate | ||
| 7451 | ✗ | if (dsnHtgFlowRt) { | |
| 7452 | ✗ | fpfc.setMaximumHotWaterFlowRate(*dsnHtgFlowRt); | |
| 7453 | } | ||
| 7454 | |||
| 7455 | //set the max cooling water flow rate | ||
| 7456 | ✗ | if (dsnClgFlowRt) { | |
| 7457 | ✗ | fpfc.setMaximumColdWaterFlowRate(dsnClgFlowRt.get()); | |
| 7458 | } | ||
| 7459 | |||
| 7460 | // FanElementControlMethod | ||
| 7461 | |||
| 7462 | ✗ | pugi::xml_node fanElementControlMethodElement = fanElement.child("CtrlMthdSim"); | |
| 7463 | |||
| 7464 | // FanElementMinFlow | ||
| 7465 | // Already handled above | ||
| 7466 | //pugi::xml_node fanElementFlowMinElement = fanElement.child("FlowMinSim"); | ||
| 7467 | |||
| 7468 | // FanElementFlowCap | ||
| 7469 | // Already handled abovd | ||
| 7470 | // pugi::xml_node fanElementFlowCapElement = fanElement.child("FlowCapSim"); | ||
| 7471 | |||
| 7472 | ✗ | boost::optional<double> flowMinRatio; | |
| 7473 | |||
| 7474 | ✗ | if (flowMin && flowCap) { | |
| 7475 | ✗ | flowMinRatio = flowMin.get() / flowCap.get(); | |
| 7476 | } | ||
| 7477 | |||
| 7478 | // FanCtrl | ||
| 7479 | |||
| 7480 | ✗ | fpfc.setLowSpeedSupplyAirFlowRatio(1.0); | |
| 7481 | |||
| 7482 | ✗ | fpfc.setMediumSpeedSupplyAirFlowRatio(1.0); | |
| 7483 | |||
| 7484 | ✗ | pugi::xml_node fanCtrlElement = element.child("FanCtrl"); | |
| 7485 | |||
| 7486 | ✗ | if (openstudio::istringEqual(fanCtrlElement.text().as_string(), "Continuous")) { | |
| 7487 | ✗ | if (openstudio::istringEqual(fanElementControlMethodElement.text().as_string(), "ConstantVolume")) { | |
| 7488 | ✗ | fpfc.setCapacityControlMethod("ConstantFanVariableFlow"); | |
| 7489 | ✗ | } else if (openstudio::istringEqual(fanElementControlMethodElement.text().as_string(), "VariableSpeedDrive")) { | |
| 7490 | ✗ | fpfc.setCapacityControlMethod("VariableFanVariableFlow"); | |
| 7491 | |||
| 7492 | ✗ | if (flowMinRatio) { | |
| 7493 | ✗ | fpfc.setLowSpeedSupplyAirFlowRatio(flowMinRatio.get()); | |
| 7494 | |||
| 7495 | ✗ | fpfc.setMediumSpeedSupplyAirFlowRatio(flowMinRatio.get()); | |
| 7496 | } | ||
| 7497 | } | ||
| 7498 | ✗ | } else if (openstudio::istringEqual(fanCtrlElement.text().as_string(), "Cycling")) { | |
| 7499 | ✗ | if (openstudio::istringEqual(fanElementControlMethodElement.text().as_string(), "TwoSpeed")) { | |
| 7500 | ✗ | fpfc.setCapacityControlMethod("CyclingFan"); | |
| 7501 | |||
| 7502 | ✗ | if (flowMinRatio) { | |
| 7503 | ✗ | fpfc.setLowSpeedSupplyAirFlowRatio(flowMinRatio.get()); | |
| 7504 | |||
| 7505 | ✗ | fpfc.setMediumSpeedSupplyAirFlowRatio(flowMinRatio.get()); | |
| 7506 | } | ||
| 7507 | ✗ | } else if (openstudio::istringEqual(fanElementControlMethodElement.text().as_string(), "ConstantVolume")) { | |
| 7508 | ✗ | fpfc.setCapacityControlMethod("CyclingFan"); | |
| 7509 | } | ||
| 7510 | } | ||
| 7511 | // Name | ||
| 7512 | ✗ | fpfc.setName(name); | |
| 7513 | ✗ | } | |
| 7514 | ✗ | } else if (istringEqual(type, "VRF")) { | |
| 7515 | ✗ | boost::optional<model::HVACComponent> fan; | |
| 7516 | ✗ | if (auto mo = translateFan(fanElement, model)) { | |
| 7517 | ✗ | fan = mo->optionalCast<model::HVACComponent>(); | |
| 7518 | ✗ | } | |
| 7519 | ✗ | if (!fan) { | |
| 7520 | ✗ | LOG(Error, name << " references an undefined fan."); | |
| 7521 | } | ||
| 7522 | |||
| 7523 | ✗ | boost::optional<model::CoilCoolingDXVariableRefrigerantFlow> coolingCoil; | |
| 7524 | { | ||
| 7525 | ✗ | auto coolingCoilElement = element.child("CoilClg"); | |
| 7526 | ✗ | if (coolingCoilElement) { | |
| 7527 | ✗ | if (auto mo = translateCoilCoolingDXVariableRefrigerantFlow(coolingCoilElement, model)) { | |
| 7528 | ✗ | coolingCoil = mo->optionalCast<model::CoilCoolingDXVariableRefrigerantFlow>(); | |
| 7529 | ✗ | } | |
| 7530 | } | ||
| 7531 | } | ||
| 7532 | ✗ | if (!coolingCoil) { | |
| 7533 | ✗ | LOG(Error, name << " references an undefined cooling coil"); | |
| 7534 | } | ||
| 7535 | |||
| 7536 | ✗ | boost::optional<model::CoilHeatingDXVariableRefrigerantFlow> heatingCoil; | |
| 7537 | { | ||
| 7538 | ✗ | auto heatingCoilElement = element.child("CoilHtg"); | |
| 7539 | ✗ | if (heatingCoilElement) { | |
| 7540 | ✗ | if (auto mo = translateCoilHeatingDXVariableRefrigerantFlow(heatingCoilElement, model)) { | |
| 7541 | ✗ | heatingCoil = mo->optionalCast<model::CoilHeatingDXVariableRefrigerantFlow>(); | |
| 7542 | ✗ | } | |
| 7543 | } | ||
| 7544 | } | ||
| 7545 | ✗ | if (!heatingCoil) { | |
| 7546 | ✗ | LOG(Error, name << " references an undefined heating coil"); | |
| 7547 | } | ||
| 7548 | |||
| 7549 | ✗ | if (fan && coolingCoil && heatingCoil) { | |
| 7550 | ✗ | model::ZoneHVACTerminalUnitVariableRefrigerantFlow vrfTerminal(model, coolingCoil.get(), heatingCoil.get(), fan.get()); | |
| 7551 | ✗ | vrfTerminal.setName(name); | |
| 7552 | ✗ | if (schedule) { | |
| 7553 | ✗ | vrfTerminal.setTerminalUnitAvailabilityschedule(schedule.get()); | |
| 7554 | } | ||
| 7555 | |||
| 7556 | ✗ | result = vrfTerminal; | |
| 7557 | |||
| 7558 | { | ||
| 7559 | ✗ | const auto* value = element.child("VRFSysRef").text().as_string(); | |
| 7560 | ✗ | auto vrfSys = model.getConcreteModelObjectByName<model::AirConditionerVariableRefrigerantFlow>(value); | |
| 7561 | ✗ | if (vrfSys) { | |
| 7562 | ✗ | vrfSys->addTerminal(vrfTerminal); | |
| 7563 | } else { | ||
| 7564 | ✗ | LOG(Error, name << " references an undefined vrf system"); | |
| 7565 | } | ||
| 7566 | ✗ | } | |
| 7567 | |||
| 7568 | //FanPos | ||
| 7569 | { | ||
| 7570 | // fan placement is not implemented in OS | ||
| 7571 | // TODO: Fix this! | ||
| 7572 | // auto fanPosElement = element.child("FanPos"); | ||
| 7573 | } | ||
| 7574 | |||
| 7575 | // FanCtrl | ||
| 7576 | { | ||
| 7577 | ✗ | auto fanCtrlElement = element.child("FanCtrl"); | |
| 7578 | ✗ | if (istringEqual(fanCtrlElement.text().as_string(), "Continuous")) { | |
| 7579 | ✗ | auto schedule = model.alwaysOnDiscreteSchedule(); | |
| 7580 | ✗ | vrfTerminal.setSupplyAirFanOperatingModeSchedule(schedule); | |
| 7581 | ✗ | } else { | |
| 7582 | ✗ | auto schedule = model.alwaysOffDiscreteSchedule(); | |
| 7583 | ✗ | vrfTerminal.setSupplyAirFanOperatingModeSchedule(schedule); | |
| 7584 | ✗ | } | |
| 7585 | } | ||
| 7586 | |||
| 7587 | // ClgSupFanCapSim | ||
| 7588 | ✗ | if (!autosize()) { | |
| 7589 | ✗ | boost::optional<double> _clgSupFanCapSim = lexicalCastToDouble(element.child("ClgSupFanCapSim")); | |
| 7590 | ✗ | if (_clgSupFanCapSim) { | |
| 7591 | ✗ | double value = unitToUnit(_clgSupFanCapSim.get(), "cfm", "m^3/s").get(); | |
| 7592 | ✗ | vrfTerminal.setSupplyAirFlowRateDuringCoolingOperation(value); | |
| 7593 | } | ||
| 7594 | } | ||
| 7595 | |||
| 7596 | // HtgSupFanCapSim | ||
| 7597 | ✗ | if (!autosize()) { | |
| 7598 | ✗ | boost::optional<double> _htgSupFanCapSim = lexicalCastToDouble(element.child("HtgSupFanCapSim")); | |
| 7599 | ✗ | if (_htgSupFanCapSim) { | |
| 7600 | ✗ | double value = unitToUnit(_htgSupFanCapSim.get(), "cfm", "m^3/s").get(); | |
| 7601 | ✗ | vrfTerminal.setSupplyAirFlowRateDuringHeatingOperation(value); | |
| 7602 | } | ||
| 7603 | } | ||
| 7604 | |||
| 7605 | // NoClgSupFanCapSim | ||
| 7606 | ✗ | if (!autosize()) { | |
| 7607 | ✗ | boost::optional<double> _noClgSupFanCapSim = lexicalCastToDouble(element.child("NoClgSupFanCapSim")); | |
| 7608 | ✗ | if (_noClgSupFanCapSim) { | |
| 7609 | ✗ | double value = unitToUnit(_noClgSupFanCapSim.get(), "cfm", "m^3/s").get(); | |
| 7610 | ✗ | vrfTerminal.setSupplyAirFlowRateWhenNoCoolingisNeeded(value); | |
| 7611 | } | ||
| 7612 | } | ||
| 7613 | |||
| 7614 | // NoHtgSupFanCapSim | ||
| 7615 | ✗ | if (!autosize()) { | |
| 7616 | ✗ | boost::optional<double> _noHtgSupFanCapSim = lexicalCastToDouble(element.child("NoHtgSupFanCapSim")); | |
| 7617 | ✗ | if (_noHtgSupFanCapSim) { | |
| 7618 | ✗ | double value = unitToUnit(_noHtgSupFanCapSim.get(), "cfm", "m^3/s").get(); | |
| 7619 | ✗ | vrfTerminal.setSupplyAirFlowRateWhenNoHeatingisNeeded(value); | |
| 7620 | } | ||
| 7621 | } | ||
| 7622 | |||
| 7623 | // ClgOAFlowCapSim | ||
| 7624 | ✗ | if (!autosize()) { | |
| 7625 | ✗ | boost::optional<double> _clgOAFlowCapSim = lexicalCastToDouble(element.child("ClgOAFlowCapSim")); | |
| 7626 | ✗ | if (_clgOAFlowCapSim) { | |
| 7627 | ✗ | double value = unitToUnit(_clgOAFlowCapSim.get(), "cfm", "m^3/s").get(); | |
| 7628 | ✗ | vrfTerminal.setOutdoorAirFlowRateDuringCoolingOperation(value); | |
| 7629 | } | ||
| 7630 | } | ||
| 7631 | |||
| 7632 | // HtgOAFlowCapSim | ||
| 7633 | ✗ | if (!autosize()) { | |
| 7634 | ✗ | boost::optional<double> _htgOAFlowCapSim = lexicalCastToDouble(element.child("HtgOAFlowCapSim")); | |
| 7635 | ✗ | if (_htgOAFlowCapSim) { | |
| 7636 | ✗ | double value = unitToUnit(_htgOAFlowCapSim.get(), "cfm", "m^3/s").get(); | |
| 7637 | ✗ | vrfTerminal.setOutdoorAirFlowRateDuringHeatingOperation(value); | |
| 7638 | } | ||
| 7639 | } | ||
| 7640 | |||
| 7641 | // NoClgHtgOAFlowCapSim | ||
| 7642 | ✗ | if (!autosize()) { | |
| 7643 | ✗ | boost::optional<double> _noClgHtgOAFlowCapSim = lexicalCastToDouble(element.child("NoClgHtgOAFlowCapSim")); | |
| 7644 | ✗ | if (_noClgHtgOAFlowCapSim) { | |
| 7645 | ✗ | double value = unitToUnit(_noClgHtgOAFlowCapSim.get(), "cfm", "m^3/s").get(); | |
| 7646 | ✗ | vrfTerminal.setOutdoorAirFlowRateWhenNoCoolingorHeatingisNeeded(value); | |
| 7647 | } | ||
| 7648 | } | ||
| 7649 | |||
| 7650 | //<ClgDsgnSupAirTemp>55</ClgDsgnSupAirTemp> | ||
| 7651 | //<HtgDsgnSupAirTemp>95</HtgDsgnSupAirTemp> | ||
| 7652 | |||
| 7653 | // AuxPwrOnSim | ||
| 7654 | ✗ | if (!autosize()) { | |
| 7655 | ✗ | boost::optional<double> _auxPwrOnSim = lexicalCastToDouble(element.child("AuxPwrOnSim")); | |
| 7656 | ✗ | if (_auxPwrOnSim) { | |
| 7657 | ✗ | double value = unitToUnit(_auxPwrOnSim.get(), "Btu/h", "W").get(); | |
| 7658 | ✗ | vrfTerminal.setZoneTerminalUnitOnParasiticElectricEnergyUse(value); | |
| 7659 | } | ||
| 7660 | } | ||
| 7661 | |||
| 7662 | // AuxPwrOffSim | ||
| 7663 | ✗ | if (!autosize()) { | |
| 7664 | ✗ | boost::optional<double> _auxPwrOffSim = lexicalCastToDouble(element.child("AuxPwrOffSim")); | |
| 7665 | ✗ | if (_auxPwrOffSim) { | |
| 7666 | ✗ | double value = unitToUnit(_auxPwrOffSim.get(), "Btu/h", "W").get(); | |
| 7667 | ✗ | vrfTerminal.setZoneTerminalUnitOffParasiticElectricEnergyUse(value); | |
| 7668 | } | ||
| 7669 | } | ||
| 7670 | |||
| 7671 | // See ZoneSizing | ||
| 7672 | // ClgDsgnSupAirTemp | ||
| 7673 | // HtgDsgnSupAirTemp | ||
| 7674 | |||
| 7675 | ✗ | } else { | |
| 7676 | ✗ | LOG(Error, name << " could not be created."); | |
| 7677 | } | ||
| 7678 | ✗ | } | |
| 7679 | |||
| 7680 | ✗ | return result; | |
| 7681 | ✗ | } | |
| 7682 | |||
| 7683 | ✗ | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateCoilHeatingDXVariableRefrigerantFlow(const pugi::xml_node& element, | |
| 7684 | openstudio::model::Model& model) { | ||
| 7685 | ✗ | if (!istringEqual(element.name(), "CoilHtg")) { | |
| 7686 | ✗ | return boost::none; | |
| 7687 | } | ||
| 7688 | |||
| 7689 | ✗ | model::CoilHeatingDXVariableRefrigerantFlow coil(model); | |
| 7690 | |||
| 7691 | { | ||
| 7692 | ✗ | const auto* value = element.child("Name").text().as_string(); | |
| 7693 | ✗ | coil.setName(value); | |
| 7694 | } | ||
| 7695 | |||
| 7696 | ✗ | if (!autosize()) { | |
| 7697 | ✗ | boost::optional<double> _capTotGrossRtdSim = lexicalCastToDouble(element.child("CapTotGrossRtdSim")); | |
| 7698 | ✗ | if (_capTotGrossRtdSim) { | |
| 7699 | ✗ | double value = unitToUnit(_capTotGrossRtdSim.get(), "Btu/h", "W").get(); | |
| 7700 | ✗ | coil.setRatedTotalHeatingCapacity(value); | |
| 7701 | } | ||
| 7702 | } | ||
| 7703 | |||
| 7704 | ✗ | auto setCurve = [&](const std::string& elementName, | |
| 7705 | const std::function<bool(model::CoilHeatingDXVariableRefrigerantFlow&, const model::Curve&)>& osSetter, | ||
| 7706 | const std::function<model::Curve(model::CoilHeatingDXVariableRefrigerantFlow&)>& osGetter) { | ||
| 7707 | ✗ | const auto* value = element.child(elementName.c_str()).text().as_string(); | |
| 7708 | ✗ | auto newcurve = model.getModelObjectByName<model::Curve>(value); | |
| 7709 | ✗ | if (newcurve) { | |
| 7710 | ✗ | auto oldcurve = osGetter(coil); | |
| 7711 | ✗ | if (oldcurve != newcurve.get()) { | |
| 7712 | ✗ | oldcurve.remove(); | |
| 7713 | } | ||
| 7714 | ✗ | osSetter(coil, newcurve.get()); | |
| 7715 | ✗ | } | |
| 7716 | ✗ | }; | |
| 7717 | |||
| 7718 | ✗ | setCurve("HtPumpCap_fTempCrvRef", | |
| 7719 | ✗ | std::mem_fn(&model::CoilHeatingDXVariableRefrigerantFlow::setHeatingCapacityRatioModifierFunctionofTemperatureCurve), | |
| 7720 | ✗ | std::mem_fn(&model::CoilHeatingDXVariableRefrigerantFlow::heatingCapacityRatioModifierFunctionofTemperatureCurve)); | |
| 7721 | |||
| 7722 | ✗ | setCurve("HtPumpCap_fFlowCrvRef", | |
| 7723 | ✗ | std::mem_fn(&model::CoilHeatingDXVariableRefrigerantFlow::setHeatingCapacityModifierFunctionofFlowFractionCurve), | |
| 7724 | ✗ | std::mem_fn(&model::CoilHeatingDXVariableRefrigerantFlow::heatingCapacityModifierFunctionofFlowFractionCurve)); | |
| 7725 | |||
| 7726 | ✗ | if (!autosize()) { | |
| 7727 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element.parent().child("Fan").child("FlowCapSim")); | |
| 7728 | ✗ | if (_value) { | |
| 7729 | ✗ | double value = unitToUnit(_value.get(), "cfm", "m^3/s").get(); | |
| 7730 | ✗ | coil.setRatedAirFlowRate(value); | |
| 7731 | } | ||
| 7732 | } | ||
| 7733 | |||
| 7734 | ✗ | return coil; | |
| 7735 | ✗ | } | |
| 7736 | |||
| 7737 | ✗ | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateCoilCoolingDXVariableRefrigerantFlow(const pugi::xml_node& element, | |
| 7738 | openstudio::model::Model& model) { | ||
| 7739 | ✗ | if (!istringEqual(element.name(), "CoilClg")) { | |
| 7740 | ✗ | return boost::none; | |
| 7741 | } | ||
| 7742 | |||
| 7743 | ✗ | model::CoilCoolingDXVariableRefrigerantFlow coil(model); | |
| 7744 | |||
| 7745 | { | ||
| 7746 | ✗ | const auto* value = element.child("Name").text().as_string(); | |
| 7747 | ✗ | coil.setName(value); | |
| 7748 | } | ||
| 7749 | |||
| 7750 | ✗ | if (!autosize()) { | |
| 7751 | ✗ | boost::optional<double> _capTotGrossRtdSim = lexicalCastToDouble(element.child("CapTotGrossRtdSim")); | |
| 7752 | ✗ | if (_capTotGrossRtdSim) { | |
| 7753 | ✗ | double value = unitToUnit(_capTotGrossRtdSim.get(), "Btu/h", "W").get(); | |
| 7754 | ✗ | coil.setRatedTotalCoolingCapacity(value); | |
| 7755 | } | ||
| 7756 | } | ||
| 7757 | |||
| 7758 | ✗ | auto setCurve = [&](const std::string& elementName, | |
| 7759 | const std::function<bool(model::CoilCoolingDXVariableRefrigerantFlow&, const model::Curve&)>& osSetter, | ||
| 7760 | const std::function<model::Curve(model::CoilCoolingDXVariableRefrigerantFlow&)>& osGetter) { | ||
| 7761 | ✗ | const auto* value = element.child(elementName.c_str()).text().as_string(); | |
| 7762 | ✗ | auto newcurve = model.getModelObjectByName<model::Curve>(value); | |
| 7763 | ✗ | if (newcurve) { | |
| 7764 | ✗ | auto oldcurve = osGetter(coil); | |
| 7765 | ✗ | if (oldcurve != newcurve.get()) { | |
| 7766 | ✗ | oldcurve.remove(); | |
| 7767 | } | ||
| 7768 | ✗ | osSetter(coil, newcurve.get()); | |
| 7769 | ✗ | } | |
| 7770 | ✗ | }; | |
| 7771 | |||
| 7772 | ✗ | setCurve("Cap_fTempCrvRef", std::mem_fn(&model::CoilCoolingDXVariableRefrigerantFlow::setCoolingCapacityRatioModifierFunctionofTemperatureCurve), | |
| 7773 | ✗ | std::mem_fn(&model::CoilCoolingDXVariableRefrigerantFlow::coolingCapacityRatioModifierFunctionofTemperatureCurve)); | |
| 7774 | |||
| 7775 | ✗ | setCurve("Cap_fFlowCrvRef", std::mem_fn(&model::CoilCoolingDXVariableRefrigerantFlow::setCoolingCapacityModifierCurveFunctionofFlowFraction), | |
| 7776 | ✗ | std::mem_fn(&model::CoilCoolingDXVariableRefrigerantFlow::coolingCapacityModifierCurveFunctionofFlowFraction)); | |
| 7777 | |||
| 7778 | ✗ | if (!autosize()) { | |
| 7779 | ✗ | boost::optional<double> _value = lexicalCastToDouble(element.parent().child("Fan").child("FlowCapSim")); | |
| 7780 | |||
| 7781 | ✗ | if (_value) { | |
| 7782 | ✗ | double value = unitToUnit(_value.get(), "cfm", "m^3/s").get(); | |
| 7783 | ✗ | coil.setRatedAirFlowRate(value); | |
| 7784 | } | ||
| 7785 | } | ||
| 7786 | |||
| 7787 | ✗ | return coil; | |
| 7788 | ✗ | } | |
| 7789 | |||
| 7790 | 5 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateCrvDblQuad(const pugi::xml_node& element, | |
| 7791 | openstudio::model::Model& model) { | ||
| 7792 |
5/6✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 5 times.
|
20 | if (!istringEqual(element.name(), "CrvDblQuad")) { |
| 7793 | ✗ | return boost::none; | |
| 7794 | } | ||
| 7795 | |||
| 7796 |
1/1✓ Branch 1 taken 5 times.
|
5 | model::CurveBiquadratic curve(model); |
| 7797 | |||
| 7798 | // Name | ||
| 7799 | |||
| 7800 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node nameElement = element.child("Name"); |
| 7801 | |||
| 7802 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | curve.setName(nameElement.text().as_string()); |
| 7803 | |||
| 7804 | // Coef1 | ||
| 7805 | |||
| 7806 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node coef1Element = element.child("Coef1"); |
| 7807 | |||
| 7808 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | curve.setCoefficient1Constant(coef1Element.text().as_double()); |
| 7809 | |||
| 7810 | // Coef2 | ||
| 7811 | |||
| 7812 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node coef2Element = element.child("Coef2"); |
| 7813 | |||
| 7814 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | curve.setCoefficient2x(coef2Element.text().as_double()); |
| 7815 | |||
| 7816 | // Coef3 | ||
| 7817 | |||
| 7818 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node coef3Element = element.child("Coef3"); |
| 7819 | |||
| 7820 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | curve.setCoefficient3xPOW2(coef3Element.text().as_double()); |
| 7821 | |||
| 7822 | // Coef4 | ||
| 7823 | |||
| 7824 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node coef4Element = element.child("Coef4"); |
| 7825 | |||
| 7826 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | curve.setCoefficient4y(coef4Element.text().as_double()); |
| 7827 | |||
| 7828 | // Coef5 | ||
| 7829 | |||
| 7830 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node coef5Element = element.child("Coef5"); |
| 7831 | |||
| 7832 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | curve.setCoefficient5yPOW2(coef5Element.text().as_double()); |
| 7833 | |||
| 7834 | // Coef6 | ||
| 7835 | |||
| 7836 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node coef6Element = element.child("Coef6"); |
| 7837 | |||
| 7838 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | curve.setCoefficient6xTIMESY(coef6Element.text().as_double()); |
| 7839 | |||
| 7840 | // MinVar1 | ||
| 7841 | |||
| 7842 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node minVar1Element = element.child("MinVar1"); |
| 7843 | |||
| 7844 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _minVar1 = lexicalCastToDouble(minVar1Element); |
| 7845 | |||
| 7846 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_minVar1) { |
| 7847 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | curve.setMinimumValueofx(_minVar1.get()); |
| 7848 | } else { | ||
| 7849 | ✗ | curve.setMinimumValueofx(0.0); | |
| 7850 | |||
| 7851 | ✗ | LOG(Warn, "Curve: " << nameElement.text().as_string() << " Missing X Minimum Limit"); | |
| 7852 | } | ||
| 7853 | |||
| 7854 | // MaxVar1 | ||
| 7855 | |||
| 7856 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node maxVar1Element = element.child("MaxVar1"); |
| 7857 | |||
| 7858 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _maxVar1 = lexicalCastToDouble(maxVar1Element); |
| 7859 | |||
| 7860 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_maxVar1) { |
| 7861 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | curve.setMaximumValueofx(_maxVar1.get()); |
| 7862 | } else { | ||
| 7863 | ✗ | curve.setMaximumValueofx(100.0); | |
| 7864 | |||
| 7865 | ✗ | LOG(Warn, "Curve: " << nameElement.text().as_string() << " Missing X Maximum Limit"); | |
| 7866 | } | ||
| 7867 | |||
| 7868 | // MinVar2 | ||
| 7869 | |||
| 7870 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node minVar2Element = element.child("MinVar2"); |
| 7871 | |||
| 7872 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _minVar2 = lexicalCastToDouble(minVar2Element); |
| 7873 | |||
| 7874 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_minVar2) { |
| 7875 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | curve.setMinimumValueofy(_minVar2.get()); |
| 7876 | } else { | ||
| 7877 | ✗ | curve.setMinimumValueofy(0.0); | |
| 7878 | |||
| 7879 | ✗ | LOG(Warn, "Curve: " << nameElement.text().as_string() << " Missing Y Minimum Limit"); | |
| 7880 | } | ||
| 7881 | |||
| 7882 | // MaxVar2 | ||
| 7883 | |||
| 7884 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node maxVar2Element = element.child("MaxVar2"); |
| 7885 | |||
| 7886 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _maxVar2 = lexicalCastToDouble(maxVar2Element); |
| 7887 | |||
| 7888 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_maxVar2) { |
| 7889 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | curve.setMaximumValueofy(_maxVar2.get()); |
| 7890 | } else { | ||
| 7891 | ✗ | curve.setMaximumValueofy(100.0); | |
| 7892 | |||
| 7893 | ✗ | LOG(Warn, "Curve: " << nameElement.text().as_string() << " Missing Y Maximum Limit"); | |
| 7894 | } | ||
| 7895 | |||
| 7896 | // MaxOut | ||
| 7897 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node maxOutElement = element.child("MaxOut"); |
| 7898 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _maxOut = lexicalCastToDouble(maxOutElement); |
| 7899 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_maxOut) { |
| 7900 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | curve.setMaximumCurveOutput(_maxOut.get()); |
| 7901 | } | ||
| 7902 | |||
| 7903 | // MinOut | ||
| 7904 |
1/1✓ Branch 1 taken 5 times.
|
5 | pugi::xml_node minOutElement = element.child("MinOut"); |
| 7905 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<double> _minOut = lexicalCastToDouble(minOutElement); |
| 7906 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (_minOut) { |
| 7907 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | curve.setMinimumCurveOutput(_minOut.get()); |
| 7908 | } | ||
| 7909 | |||
| 7910 |
1/1✓ Branch 1 taken 5 times.
|
5 | return curve; |
| 7911 | 5 | } | |
| 7912 | |||
| 7913 | 3 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateCrvCubic(const pugi::xml_node& element, | |
| 7914 | openstudio::model::Model& model) { | ||
| 7915 |
5/6✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 3 times.
|
12 | if (!istringEqual(element.name(), "CrvCubic")) { |
| 7916 | ✗ | return boost::none; | |
| 7917 | } | ||
| 7918 | |||
| 7919 |
1/1✓ Branch 1 taken 3 times.
|
3 | model::CurveCubic curve(model); |
| 7920 | |||
| 7921 | // Name | ||
| 7922 | |||
| 7923 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node nameElement = element.child("Name"); |
| 7924 | |||
| 7925 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | curve.setName(nameElement.text().as_string()); |
| 7926 | |||
| 7927 | // Coef1 | ||
| 7928 | |||
| 7929 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node coef1Element = element.child("Coef1"); |
| 7930 | |||
| 7931 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | curve.setCoefficient1Constant(coef1Element.text().as_double()); |
| 7932 | |||
| 7933 | // Coef2 | ||
| 7934 | |||
| 7935 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node coef2Element = element.child("Coef2"); |
| 7936 | |||
| 7937 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | curve.setCoefficient2x(coef2Element.text().as_double()); |
| 7938 | |||
| 7939 | // Coef3 | ||
| 7940 | |||
| 7941 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node coef3Element = element.child("Coef3"); |
| 7942 | |||
| 7943 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | curve.setCoefficient3xPOW2(coef3Element.text().as_double()); |
| 7944 | |||
| 7945 | // Coef4 | ||
| 7946 | |||
| 7947 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node coef4Element = element.child("Coef4"); |
| 7948 | |||
| 7949 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | curve.setCoefficient4xPOW3(coef4Element.text().as_double()); |
| 7950 | |||
| 7951 | // MinVar1 | ||
| 7952 | |||
| 7953 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node minVar1Element = element.child("MinVar1"); |
| 7954 | |||
| 7955 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _minVar1 = lexicalCastToDouble(minVar1Element); |
| 7956 | |||
| 7957 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 time.
|
3 | if (_minVar1) { |
| 7958 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | curve.setMinimumValueofx(_minVar1.get()); |
| 7959 | } else { | ||
| 7960 |
1/1✓ Branch 1 taken 1 time.
|
1 | curve.setMinimumValueofx(0.0); |
| 7961 | |||
| 7962 |
9/9✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
|
1 | LOG(Warn, "Curve: " << nameElement.text().as_string() << " Missing X Minimum Limit"); |
| 7963 | } | ||
| 7964 | |||
| 7965 | // MaxVar1 | ||
| 7966 | |||
| 7967 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node maxVar1Element = element.child("MaxVar1"); |
| 7968 | |||
| 7969 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _maxVar1 = lexicalCastToDouble(maxVar1Element); |
| 7970 | |||
| 7971 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 time.
|
3 | if (_maxVar1) { |
| 7972 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | curve.setMaximumValueofx(_maxVar1.get()); |
| 7973 | } else { | ||
| 7974 |
1/1✓ Branch 1 taken 1 time.
|
1 | curve.setMaximumValueofx(100.0); |
| 7975 | |||
| 7976 |
9/9✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
|
1 | LOG(Warn, "Curve: " << nameElement.text().as_string() << " Missing X Maximum Limit"); |
| 7977 | } | ||
| 7978 | |||
| 7979 | // MaxOut | ||
| 7980 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node maxOutElement = element.child("MaxOut"); |
| 7981 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _maxOut = lexicalCastToDouble(maxOutElement); |
| 7982 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 time.
|
3 | if (_maxOut) { |
| 7983 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | curve.setMaximumCurveOutput(_maxOut.get()); |
| 7984 | } | ||
| 7985 | |||
| 7986 | // MinOut | ||
| 7987 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node minOutElement = element.child("MinOut"); |
| 7988 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _minOut = lexicalCastToDouble(minOutElement); |
| 7989 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 time.
|
3 | if (_minOut) { |
| 7990 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | curve.setMinimumCurveOutput(_minOut.get()); |
| 7991 | } | ||
| 7992 | |||
| 7993 |
1/1✓ Branch 1 taken 3 times.
|
3 | return curve; |
| 7994 | 3 | } | |
| 7995 | |||
| 7996 | ✗ | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateCrvLin(const pugi::xml_node& element, openstudio::model::Model& model) { | |
| 7997 | ✗ | if (!istringEqual(element.name(), "CrvLin")) { | |
| 7998 | ✗ | return boost::none; | |
| 7999 | } | ||
| 8000 | |||
| 8001 | ✗ | model::CurveLinear curve(model); | |
| 8002 | |||
| 8003 | // Name | ||
| 8004 | ✗ | pugi::xml_node nameElement = element.child("Name"); | |
| 8005 | ✗ | curve.setName(nameElement.text().as_string()); | |
| 8006 | |||
| 8007 | // Coef1 | ||
| 8008 | ✗ | pugi::xml_node coef1Element = element.child("Coef1"); | |
| 8009 | ✗ | curve.setCoefficient1Constant(coef1Element.text().as_double()); | |
| 8010 | |||
| 8011 | // Coef2 | ||
| 8012 | ✗ | pugi::xml_node coef2Element = element.child("Coef2"); | |
| 8013 | ✗ | curve.setCoefficient2x(coef2Element.text().as_double()); | |
| 8014 | |||
| 8015 | // MinVar1 | ||
| 8016 | ✗ | auto minVar1Element = element.child("MinVar1"); | |
| 8017 | ✗ | boost::optional<double> _minVar1 = lexicalCastToDouble(minVar1Element); | |
| 8018 | ✗ | if (_minVar1) { | |
| 8019 | ✗ | curve.setMinimumValueofx(_minVar1.get()); | |
| 8020 | } else { | ||
| 8021 | ✗ | curve.setMinimumValueofx(0.0); | |
| 8022 | ✗ | LOG(Warn, "Curve: " << nameElement.text().as_string() << " Missing X Minimum Limit"); | |
| 8023 | } | ||
| 8024 | |||
| 8025 | // MaxVar1 | ||
| 8026 | ✗ | auto maxVar1Element = element.child("MaxVar1"); | |
| 8027 | ✗ | boost::optional<double> _maxVar1 = lexicalCastToDouble(maxVar1Element); | |
| 8028 | ✗ | if (_maxVar1) { | |
| 8029 | ✗ | curve.setMaximumValueofx(_maxVar1.get()); | |
| 8030 | } else { | ||
| 8031 | ✗ | curve.setMaximumValueofx(100.0); | |
| 8032 | ✗ | LOG(Warn, "Curve: " << nameElement.text().as_string() << " Missing X Maximum Limit"); | |
| 8033 | } | ||
| 8034 | |||
| 8035 | // MaxOut | ||
| 8036 | ✗ | auto maxOutElement = element.child("MaxOut"); | |
| 8037 | ✗ | boost::optional<double> _maxOut = lexicalCastToDouble(maxOutElement); | |
| 8038 | ✗ | if (_maxOut) { | |
| 8039 | ✗ | curve.setMaximumCurveOutput(_maxOut.get()); | |
| 8040 | } | ||
| 8041 | |||
| 8042 | // MinOut | ||
| 8043 | ✗ | auto minOutElement = element.child("MinOut"); | |
| 8044 | ✗ | boost::optional<double> _minOut = lexicalCastToDouble(minOutElement); | |
| 8045 | ✗ | if (_minOut) { | |
| 8046 | ✗ | curve.setMinimumCurveOutput(_minOut.get()); | |
| 8047 | } | ||
| 8048 | |||
| 8049 | ✗ | return curve; | |
| 8050 | ✗ | } | |
| 8051 | |||
| 8052 | 3 | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateCrvQuad(const pugi::xml_node& element, | |
| 8053 | openstudio::model::Model& model) { | ||
| 8054 |
5/6✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 3 times.
|
12 | if (!istringEqual(element.name(), "CrvQuad")) { |
| 8055 | ✗ | return boost::none; | |
| 8056 | } | ||
| 8057 | |||
| 8058 |
1/1✓ Branch 1 taken 3 times.
|
3 | model::CurveQuadratic curve(model); |
| 8059 | |||
| 8060 | // Name | ||
| 8061 | |||
| 8062 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node nameElement = element.child("Name"); |
| 8063 | |||
| 8064 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | curve.setName(nameElement.text().as_string()); |
| 8065 | |||
| 8066 | // Coef1 | ||
| 8067 | |||
| 8068 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node coef1Element = element.child("Coef1"); |
| 8069 | |||
| 8070 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | curve.setCoefficient1Constant(coef1Element.text().as_double()); |
| 8071 | |||
| 8072 | // Coef2 | ||
| 8073 | |||
| 8074 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node coef2Element = element.child("Coef2"); |
| 8075 | |||
| 8076 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | curve.setCoefficient2x(coef2Element.text().as_double()); |
| 8077 | |||
| 8078 | // Coef3 | ||
| 8079 | |||
| 8080 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node coef3Element = element.child("Coef3"); |
| 8081 | |||
| 8082 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | curve.setCoefficient3xPOW2(coef3Element.text().as_double()); |
| 8083 | |||
| 8084 | // MinVar1 | ||
| 8085 | |||
| 8086 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node minVar1Element = element.child("MinVar1"); |
| 8087 | |||
| 8088 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _minVar1 = lexicalCastToDouble(minVar1Element); |
| 8089 | |||
| 8090 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 time.
|
3 | if (_minVar1) { |
| 8091 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | curve.setMinimumValueofx(_minVar1.get()); |
| 8092 | } else { | ||
| 8093 |
1/1✓ Branch 1 taken 1 time.
|
1 | curve.setMinimumValueofx(0.0); |
| 8094 | |||
| 8095 |
9/9✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
|
1 | LOG(Warn, "Curve: " << nameElement.text().as_string() << " Missing X Minimum Limit"); |
| 8096 | } | ||
| 8097 | |||
| 8098 | // MaxVar1 | ||
| 8099 | |||
| 8100 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node maxVar1Element = element.child("MaxVar1"); |
| 8101 | |||
| 8102 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _maxVar1 = lexicalCastToDouble(maxVar1Element); |
| 8103 | |||
| 8104 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (_maxVar1) { |
| 8105 | ✗ | curve.setMaximumValueofx(_maxVar1.get()); | |
| 8106 | } else { | ||
| 8107 |
1/1✓ Branch 1 taken 3 times.
|
3 | curve.setMaximumValueofx(100.0); |
| 8108 | |||
| 8109 |
9/9✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 16 taken 3 times.
✓ Branch 19 taken 3 times.
✓ Branch 22 taken 3 times.
✓ Branch 25 taken 3 times.
|
3 | LOG(Warn, "Curve: " << nameElement.text().as_string() << " Missing X Maximum Limit"); |
| 8110 | } | ||
| 8111 | |||
| 8112 | // MaxOut | ||
| 8113 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node maxOutElement = element.child("MaxOut"); |
| 8114 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _maxOut = lexicalCastToDouble(maxOutElement); |
| 8115 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (_maxOut) { |
| 8116 | ✗ | curve.setMaximumCurveOutput(_maxOut.get()); | |
| 8117 | } | ||
| 8118 | |||
| 8119 | // MinOut | ||
| 8120 |
1/1✓ Branch 1 taken 3 times.
|
3 | pugi::xml_node minOutElement = element.child("MinOut"); |
| 8121 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> _minOut = lexicalCastToDouble(minOutElement); |
| 8122 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (_minOut) { |
| 8123 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | curve.setMinimumCurveOutput(_minOut.get()); |
| 8124 | } | ||
| 8125 | |||
| 8126 |
1/1✓ Branch 1 taken 3 times.
|
3 | return curve; |
| 8127 | 3 | } | |
| 8128 | |||
| 8129 | ✗ | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateCrvMapDblVar(const pugi::xml_node& element, | |
| 8130 | openstudio::model::Model& model) { | ||
| 8131 | ✗ | if (!istringEqual(element.name(), "CrvMapDblVar")) { | |
| 8132 | ✗ | return boost::none; | |
| 8133 | } | ||
| 8134 | |||
| 8135 | ✗ | model::TableLookup table(model); | |
| 8136 | |||
| 8137 | ✗ | auto nameElement = element.child("Name"); | |
| 8138 | ✗ | table.setName(nameElement.text().as_string()); | |
| 8139 | |||
| 8140 | ✗ | std::vector<pugi::xml_node> arrayVar1Elements; | |
| 8141 | ✗ | std::vector<pugi::xml_node> arrayVar2Elements; | |
| 8142 | ✗ | std::vector<pugi::xml_node> arrayOutElements; | |
| 8143 | |||
| 8144 | ✗ | for (const pugi::xml_node& child : element.children()) { | |
| 8145 | ✗ | if (istringEqual(child.name(), "ArrayVar1")) { | |
| 8146 | ✗ | arrayVar1Elements.push_back(child); | |
| 8147 | ✗ | } else if (istringEqual(child.name(), "ArrayVar2")) { | |
| 8148 | ✗ | arrayVar2Elements.push_back(child); | |
| 8149 | ✗ | } else if (istringEqual(child.name(), "ArrayOut")) { | |
| 8150 | ✗ | arrayOutElements.push_back(child); | |
| 8151 | } | ||
| 8152 | } | ||
| 8153 | |||
| 8154 | ✗ | if (arrayVar1Elements.size() != arrayOutElements.size()) { | |
| 8155 | ✗ | return table; | |
| 8156 | } | ||
| 8157 | |||
| 8158 | ✗ | if (arrayVar2Elements.size() != arrayOutElements.size()) { | |
| 8159 | ✗ | return table; | |
| 8160 | } | ||
| 8161 | |||
| 8162 | ✗ | model::TableIndependentVariable var1(model); | |
| 8163 | ✗ | model::TableIndependentVariable var2(model); | |
| 8164 | ✗ | table.addIndependentVariable(var1); | |
| 8165 | ✗ | table.addIndependentVariable(var2); | |
| 8166 | |||
| 8167 | ✗ | for (std::vector<pugi::xml_node>::size_type i = 0; i < arrayVar1Elements.size(); i++) { | |
| 8168 | |||
| 8169 | ✗ | boost::optional<double> _arrayVar1 = lexicalCastToDouble(arrayVar1Elements[i]); | |
| 8170 | ✗ | boost::optional<double> _arrayVar2 = lexicalCastToDouble(arrayVar2Elements[i]); | |
| 8171 | ✗ | boost::optional<double> _arrayOut = lexicalCastToDouble(arrayOutElements[i]); | |
| 8172 | |||
| 8173 | ✗ | if (_arrayVar1 && _arrayVar2 && _arrayOut) { | |
| 8174 | ✗ | var1.addValue(_arrayVar1.get()); | |
| 8175 | ✗ | var2.addValue(_arrayVar2.get()); | |
| 8176 | ✗ | table.addOutputValue(_arrayOut.get()); | |
| 8177 | } | ||
| 8178 | } | ||
| 8179 | |||
| 8180 | ✗ | std::string text; | |
| 8181 | |||
| 8182 | ✗ | boost::optional<double> _minOut = lexicalCastToDouble(element.child("MinOut")); | |
| 8183 | ✗ | if (_minOut) { | |
| 8184 | ✗ | table.setMinimumOutput(_minOut.get()); | |
| 8185 | } | ||
| 8186 | |||
| 8187 | ✗ | boost::optional<double> _maxOut = lexicalCastToDouble(element.child("MaxOut")); | |
| 8188 | ✗ | if (_maxOut) { | |
| 8189 | ✗ | table.setMaximumOutput(_maxOut.get()); | |
| 8190 | } | ||
| 8191 | |||
| 8192 | ✗ | text = element.child("UnitTypeVar1").text().as_string(); | |
| 8193 | ✗ | var1.setUnitType(text); | |
| 8194 | |||
| 8195 | ✗ | text = element.child("UnitTypeVar2").text().as_string(); | |
| 8196 | ✗ | var2.setUnitType(text); | |
| 8197 | |||
| 8198 | ✗ | text = element.child("UnitTypeOut").text().as_string(); | |
| 8199 | ✗ | table.setOutputUnitType(text); | |
| 8200 | |||
| 8201 | ✗ | boost::optional<double> _minVar1 = lexicalCastToDouble(element.child("MinVar1")); | |
| 8202 | ✗ | if (_minVar1) { | |
| 8203 | ✗ | var1.setMinimumValue(_minVar1.get()); | |
| 8204 | } | ||
| 8205 | |||
| 8206 | ✗ | boost::optional<double> _maxVar1 = lexicalCastToDouble(element.child("MaxVar1")); | |
| 8207 | ✗ | if (_maxVar1) { | |
| 8208 | ✗ | var1.setMaximumValue(_maxVar1.get()); | |
| 8209 | } | ||
| 8210 | |||
| 8211 | ✗ | boost::optional<double> _minVar2 = lexicalCastToDouble(element.child("MinVar2")); | |
| 8212 | ✗ | if (_minVar2) { | |
| 8213 | ✗ | var2.setMinimumValue(_minVar2.get()); | |
| 8214 | } | ||
| 8215 | |||
| 8216 | ✗ | boost::optional<double> _maxVar2 = lexicalCastToDouble(element.child("MaxVar2")); | |
| 8217 | ✗ | if (_maxVar2) { | |
| 8218 | ✗ | var2.setMaximumValue(_maxVar2.get()); | |
| 8219 | } | ||
| 8220 | |||
| 8221 | ✗ | text = element.child("InterpMthd").text().as_string(); | |
| 8222 | ✗ | std::string newInterpMethod = "Cubic"; | |
| 8223 | ✗ | std::string newExtrapMethod = "Constant"; | |
| 8224 | ✗ | if (openstudio::istringEqual(text, "LagrangeInterpolationLinearExtrapolation")) { | |
| 8225 | ✗ | newInterpMethod = "Cubic"; | |
| 8226 | ✗ | newExtrapMethod = "Linear"; | |
| 8227 | ✗ | } else if (istringEqual(text, "LinearInterpolationOfTable")) { | |
| 8228 | ✗ | newInterpMethod = "Linear"; | |
| 8229 | ✗ | newExtrapMethod = "Constant"; | |
| 8230 | } | ||
| 8231 | |||
| 8232 | ✗ | var1.setInterpolationMethod(newInterpMethod); | |
| 8233 | ✗ | var1.setExtrapolationMethod(newExtrapMethod); | |
| 8234 | ✗ | var2.setInterpolationMethod(newInterpMethod); | |
| 8235 | ✗ | var2.setExtrapolationMethod(newExtrapMethod); | |
| 8236 | |||
| 8237 | ✗ | boost::optional<double> _normalizationPt = lexicalCastToDouble(element.child("NormalizationPt")); | |
| 8238 | ✗ | if (_normalizationPt) { | |
| 8239 | ✗ | table.setNormalizationMethod("DivisorOnly"); | |
| 8240 | ✗ | table.setNormalizationDivisor(_normalizationPt.get()); | |
| 8241 | } | ||
| 8242 | |||
| 8243 | // Now ignored | ||
| 8244 | //text = element.child("Type").text().as_string(); | ||
| 8245 | // table.setCurveType(text); | ||
| 8246 | |||
| 8247 | ✗ | return table; | |
| 8248 | ✗ | } | |
| 8249 | |||
| 8250 | ✗ | boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateCrvMapSglVar(const pugi::xml_node& element, | |
| 8251 | openstudio::model::Model& model) { | ||
| 8252 | ✗ | if (!istringEqual(element.name(), "CrvMapSglVar")) { | |
| 8253 | ✗ | return boost::none; | |
| 8254 | } | ||
| 8255 | |||
| 8256 | ✗ | model::TableLookup table(model); | |
| 8257 | ✗ | model::TableIndependentVariable var1(model); | |
| 8258 | ✗ | table.addIndependentVariable(var1); | |
| 8259 | |||
| 8260 | ✗ | auto nameElement = element.child("Name"); | |
| 8261 | ✗ | table.setName(nameElement.text().as_string()); | |
| 8262 | |||
| 8263 | ✗ | std::vector<pugi::xml_node> arrayVar1Elements; | |
| 8264 | ✗ | std::vector<pugi::xml_node> arrayOutElements; | |
| 8265 | |||
| 8266 | ✗ | for (const pugi::xml_node& child : element.children()) { | |
| 8267 | ✗ | if (istringEqual(child.name(), "ArrayVar1")) { | |
| 8268 | ✗ | arrayVar1Elements.push_back(child); | |
| 8269 | ✗ | } else if (istringEqual(child.name(), "ArrayOut")) { | |
| 8270 | ✗ | arrayOutElements.push_back(child); | |
| 8271 | } | ||
| 8272 | } | ||
| 8273 | |||
| 8274 | ✗ | if (arrayVar1Elements.size() != arrayOutElements.size()) { | |
| 8275 | ✗ | return table; | |
| 8276 | } | ||
| 8277 | |||
| 8278 | ✗ | for (std::vector<pugi::xml_node>::size_type i = 0; i < arrayVar1Elements.size(); i++) { | |
| 8279 | ✗ | boost::optional<double> _arrayVar1 = lexicalCastToDouble(arrayVar1Elements[i]); | |
| 8280 | ✗ | boost::optional<double> _arrayOut = lexicalCastToDouble(arrayOutElements[i]); | |
| 8281 | |||
| 8282 | ✗ | if (_arrayVar1 && _arrayOut) { | |
| 8283 | ✗ | var1.addValue(_arrayVar1.get()); | |
| 8284 | ✗ | table.addOutputValue(_arrayOut.get()); | |
| 8285 | } | ||
| 8286 | } | ||
| 8287 | |||
| 8288 | ✗ | boost::optional<double> _minOut = lexicalCastToDouble(element.child("MinOut")); | |
| 8289 | ✗ | if (_minOut) { | |
| 8290 | ✗ | table.setMinimumOutput(_minOut.get()); | |
| 8291 | } | ||
| 8292 | |||
| 8293 | ✗ | boost::optional<double> _maxOut = lexicalCastToDouble(element.child("MaxOut")); | |
| 8294 | ✗ | if (_maxOut) { | |
| 8295 | ✗ | table.setMaximumOutput(_maxOut.get()); | |
| 8296 | } | ||
| 8297 | |||
| 8298 | ✗ | var1.setUnitType(element.child("UnitTypeVar1").text().as_string()); | |
| 8299 | |||
| 8300 | ✗ | table.setOutputUnitType(element.child("UnitTypeOut").text().as_string()); | |
| 8301 | |||
| 8302 | ✗ | boost::optional<double> _minVar1 = lexicalCastToDouble(element.child("MinVar1")); | |
| 8303 | ✗ | if (_minVar1) { | |
| 8304 | ✗ | var1.setMinimumValue(_minVar1.get()); | |
| 8305 | } | ||
| 8306 | |||
| 8307 | ✗ | boost::optional<double> _maxVar1 = lexicalCastToDouble(element.child("MaxVar1")); | |
| 8308 | ✗ | if (_maxVar1) { | |
| 8309 | ✗ | var1.setMaximumValue(_maxVar1.get()); | |
| 8310 | } | ||
| 8311 | |||
| 8312 | ✗ | const auto* text = element.child("InterpMthd").text().as_string(); | |
| 8313 | ✗ | std::string newInterpMethod = "Cubic"; | |
| 8314 | ✗ | std::string newExtrapMethod = "Constant"; | |
| 8315 | ✗ | if (openstudio::istringEqual(text, "LagrangeInterpolationLinearExtrapolation")) { | |
| 8316 | ✗ | newInterpMethod = "Cubic"; | |
| 8317 | ✗ | newExtrapMethod = "Linear"; | |
| 8318 | ✗ | } else if (istringEqual(text, "LinearInterpolationOfTable")) { | |
| 8319 | ✗ | newInterpMethod = "Linear"; | |
| 8320 | ✗ | newExtrapMethod = "Constant"; | |
| 8321 | } | ||
| 8322 | |||
| 8323 | ✗ | var1.setInterpolationMethod(newInterpMethod); | |
| 8324 | ✗ | var1.setExtrapolationMethod(newExtrapMethod); | |
| 8325 | |||
| 8326 | ✗ | boost::optional<double> _normalizationPt = lexicalCastToDouble(element.child("NormalizationPt")); | |
| 8327 | ✗ | if (_normalizationPt) { | |
| 8328 | ✗ | table.setNormalizationMethod("DivisorOnly"); | |
| 8329 | ✗ | table.setNormalizationDivisor(_normalizationPt.get()); | |
| 8330 | } | ||
| 8331 | |||
| 8332 | // Now ignored | ||
| 8333 | //text = element.child("Type").text().as_string(); | ||
| 8334 | // table.setCurveType(text); | ||
| 8335 | |||
| 8336 | ✗ | return table; | |
| 8337 | ✗ | } | |
| 8338 | |||
| 8339 | 21 | pugi::xml_node ReverseTranslator::findZnSysElement(const pugi::xml_node& znSysRefElement) { | |
| 8340 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node projectElement = getProjectElement(znSysRefElement); |
| 8341 | // TODO: perhaps we should rely on the makeVectorOfChildrenRecursive instead (uses Xpath instead of having to harcoded the path) | ||
| 8342 | // Not sure about speed penalties | ||
| 8343 | // makeVectorOfChildrenRecursive("ZnSys") would work, regardless of which level 'ZnSys' is at | ||
| 8344 | // Proj > Bldg > [ZnSys] | ||
| 8345 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | std::vector<pugi::xml_node> znSysElements = makeVectorOfChildren(projectElement.child("Bldg"), "ZnSys"); |
| 8346 |
3/3✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
|
21 | std::string znSysName = znSysRefElement.text().as_string(); |
| 8347 | |||
| 8348 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
|
21 | if (znSysName.empty()) { |
| 8349 | ✗ | LOG(Error, "findZnSysElement called with an empty znSysName"); | |
| 8350 | ✗ | OS_ASSERT(false); | |
| 8351 | } | ||
| 8352 | |||
| 8353 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
|
21 | for (std::vector<pugi::xml_node>::size_type i = 0; i < znSysElements.size(); i++) { |
| 8354 | ✗ | pugi::xml_node znSysElement = znSysElements[i]; | |
| 8355 | ✗ | std::string znSysElementName = znSysElement.child("Name").text().as_string(); | |
| 8356 | |||
| 8357 | ✗ | if (openstudio::istringEqual(znSysElementName, znSysName)) { | |
| 8358 | ✗ | return znSysElement; | |
| 8359 | } | ||
| 8360 | ✗ | } | |
| 8361 | |||
| 8362 |
7/7✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✓ Branch 13 taken 21 times.
✓ Branch 16 taken 21 times.
✓ Branch 19 taken 21 times.
|
21 | LOG(Debug, "Couldn't locate the ZnSys element with name '" << znSysName << "'."); |
| 8363 |
1/1✓ Branch 1 taken 21 times.
|
21 | return {}; |
| 8364 | 21 | } | |
| 8365 | |||
| 8366 | 21 | pugi::xml_node ReverseTranslator::findTrmlUnitElementForZone(const pugi::xml_node& znNameElement) { | |
| 8367 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node projectElement = getProjectElement(znNameElement); |
| 8368 | // Proj > Bldg > [AirSys] | ||
| 8369 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | std::vector<pugi::xml_node> airSystemElements = makeVectorOfChildren(projectElement.child("Bldg"), "AirSys"); |
| 8370 |
3/3✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
|
21 | std::string zoneName = znNameElement.text().as_string(); |
| 8371 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
|
21 | if (zoneName.empty()) { |
| 8372 | ✗ | LOG(Error, "findTrmlUnitElementForZone called with an empty zoneName"); | |
| 8373 | ✗ | OS_ASSERT(false); | |
| 8374 | } | ||
| 8375 | |||
| 8376 |
1/2✓ Branch 1 taken 71 times.
✗ Branch 2 not taken.
|
71 | for (std::vector<pugi::xml_node>::size_type i = 0; i < airSystemElements.size(); i++) { |
| 8377 | 71 | pugi::xml_node airSystemElement = airSystemElements[i]; | |
| 8378 |
1/1✓ Branch 1 taken 71 times.
|
71 | std::vector<pugi::xml_node> terminalElements = makeVectorOfChildren(airSystemElement, "TrmlUnit"); |
| 8379 |
2/2✓ Branch 1 taken 231 times.
✓ Branch 2 taken 50 times.
|
281 | for (std::vector<pugi::xml_node>::size_type j = 0; j < terminalElements.size(); j++) { |
| 8380 | 231 | pugi::xml_node terminalElement = terminalElements[j]; | |
| 8381 |
4/4✓ Branch 1 taken 231 times.
✓ Branch 4 taken 231 times.
✓ Branch 7 taken 231 times.
✓ Branch 10 taken 231 times.
|
231 | std::string zoneServedElementName = terminalElement.child("ZnServedRef").text().as_string(); |
| 8382 | |||
| 8383 |
3/3✓ Branch 1 taken 231 times.
✓ Branch 3 taken 21 times.
✓ Branch 4 taken 210 times.
|
231 | if (openstudio::istringEqual(zoneName, zoneServedElementName)) { |
| 8384 | 21 | return terminalElement; | |
| 8385 | } | ||
| 8386 | 231 | } | |
| 8387 | 71 | } | |
| 8388 | |||
| 8389 | ✗ | LOG(Debug, "Couldn't locate the TrmlUnit element for zoneName '" << zoneName << "'."); | |
| 8390 | |||
| 8391 | ✗ | return {}; | |
| 8392 | 21 | } | |
| 8393 | |||
| 8394 | 21 | pugi::xml_node ReverseTranslator::findAirSysElement(const pugi::xml_node& airSyRefElement) { | |
| 8395 | |||
| 8396 |
1/1✓ Branch 1 taken 21 times.
|
21 | pugi::xml_node projectElement = getProjectElement(airSyRefElement); |
| 8397 |
3/3✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
|
21 | std::string airSysName = airSyRefElement.text().as_string(); |
| 8398 |
1/1✓ Branch 1 taken 21 times.
|
42 | return findAirSysElement(airSysName, projectElement); |
| 8399 | 21 | } | |
| 8400 | |||
| 8401 | 42 | pugi::xml_node ReverseTranslator::findAirSysElement(const std::string& airSysName, const pugi::xml_node& projectElement) { | |
| 8402 |
5/8✓ Branch 1 taken 42 times.
✓ Branch 3 taken 42 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 42 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 42 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 42 times.
|
42 | if (!projectElement || (strcmp(projectElement.name(), "Proj") != 0)) { |
| 8403 | ✗ | LOG(Error, "findAirSysElement has to be called with the projectElement"); | |
| 8404 | ✗ | OS_ASSERT(false); | |
| 8405 | } | ||
| 8406 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 42 times.
|
42 | if (airSysName.empty()) { |
| 8407 | ✗ | LOG(Error, "findAirSysElement called with an empty airSysName"); | |
| 8408 | ✗ | OS_ASSERT(false); | |
| 8409 | } | ||
| 8410 | |||
| 8411 | // Proj > Bldg > [AirSys] | ||
| 8412 |
2/2✓ Branch 1 taken 42 times.
✓ Branch 4 taken 42 times.
|
42 | std::vector<pugi::xml_node> airSystemElements = makeVectorOfChildren(projectElement.child("Bldg"), "AirSys"); |
| 8413 | |||
| 8414 |
1/2✓ Branch 1 taken 142 times.
✗ Branch 2 not taken.
|
142 | for (std::vector<pugi::xml_node>::size_type i = 0; i < airSystemElements.size(); i++) { |
| 8415 | 142 | pugi::xml_node airSystemElement = airSystemElements[i]; | |
| 8416 |
4/4✓ Branch 1 taken 142 times.
✓ Branch 4 taken 142 times.
✓ Branch 7 taken 142 times.
✓ Branch 10 taken 142 times.
|
142 | std::string airSystemElementName = airSystemElement.child("Name").text().as_string(); |
| 8417 | |||
| 8418 |
3/3✓ Branch 1 taken 142 times.
✓ Branch 3 taken 42 times.
✓ Branch 4 taken 100 times.
|
142 | if (openstudio::istringEqual(airSysName, airSystemElementName)) { |
| 8419 | 42 | return airSystemElement; | |
| 8420 | } | ||
| 8421 | 142 | } | |
| 8422 | |||
| 8423 | ✗ | LOG(Debug, "Couldn't locate the AirSys element for airSysName '" << airSysName << "'."); | |
| 8424 | |||
| 8425 | ✗ | return {}; | |
| 8426 | 42 | } | |
| 8427 | |||
| 8428 | 1 | boost::optional<pugi::xml_node> ForwardTranslator::translateAirLoopHVAC(const model::AirLoopHVAC& airLoop, pugi::xml_node& root) { | |
| 8429 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto result = root.append_child("AirSys"); |
| 8430 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | m_translatedObjects[airLoop.handle()] = result; |
| 8431 | |||
| 8432 | // Gather info about the system makeup | ||
| 8433 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | auto variableFans = airLoop.supplyComponents(model::FanVariableVolume::iddObjectType()); |
| 8434 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | auto coilHeatingDXSingleSpeeds = airLoop.supplyComponents(model::CoilHeatingDXSingleSpeed::iddObjectType()); |
| 8435 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | auto coilCoolingDXSingleSpeeds = airLoop.supplyComponents(model::CoilCoolingDXSingleSpeed::iddObjectType()); |
| 8436 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | auto coilCoolingDXTwoSpeeds = airLoop.supplyComponents(model::CoilCoolingDXTwoSpeed::iddObjectType()); |
| 8437 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | auto coilCoolingDXMultiSpeeds = airLoop.supplyComponents(model::CoilCoolingDXMultiSpeed::iddObjectType()); |
| 8438 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | auto coilCoolingWaters = airLoop.supplyComponents(model::CoilCoolingWater::iddObjectType()); |
| 8439 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto zones = airLoop.thermalZones(); |
| 8440 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto supplyOutletNode = airLoop.supplyOutletNode(); |
| 8441 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto spms = supplyOutletNode.setpointManagers(); |
| 8442 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto singleZoneReheats = subsetCastVector<model::SetpointManagerSingleZoneReheat>(spms); |
| 8443 | |||
| 8444 | // Name | ||
| 8445 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | auto name = airLoop.name().get(); |
| 8446 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto nameElement = result.append_child("Name"); |
| 8447 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
|
1 | nameElement.text() = escapeName(name).c_str(); |
| 8448 | |||
| 8449 | // Type | ||
| 8450 | // 1: "PVAV" | ||
| 8451 | // 2: "VAV" | ||
| 8452 | // 3: "SZAC" | ||
| 8453 | // 4: "SZHP" | ||
| 8454 | // 5: "SZVAVAC" | ||
| 8455 | // 6: "SZVAVHP" | ||
| 8456 | // 7: "HV" | ||
| 8457 | // 8: "Exhaust" - TODO figure out how to identify this one | ||
| 8458 | |||
| 8459 |
1/1✓ Branch 1 taken 1 time.
|
2 | const std::string PVAV = "PVAV"; |
| 8460 |
1/1✓ Branch 1 taken 1 time.
|
2 | const std::string VAV = "VAV"; |
| 8461 |
1/1✓ Branch 1 taken 1 time.
|
2 | const std::string SZAC = "SZAC"; |
| 8462 |
1/1✓ Branch 1 taken 1 time.
|
2 | const std::string SZHP = "SZHP"; |
| 8463 |
1/1✓ Branch 1 taken 1 time.
|
2 | const std::string SZVAVAC = "SZVAVAC"; |
| 8464 |
1/1✓ Branch 1 taken 1 time.
|
2 | const std::string SZVAVHP = "SZVAVHP"; |
| 8465 |
1/1✓ Branch 1 taken 1 time.
|
2 | const std::string HV = "HV"; |
| 8466 |
1/1✓ Branch 1 taken 1 time.
|
1 | const std::string EXHAUST = "EXHAUST"; |
| 8467 | |||
| 8468 | 1 | std::string type; | |
| 8469 | |||
| 8470 |
3/10✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 time.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 time.
|
1 | if (coilCoolingDXTwoSpeeds.empty() && coilCoolingDXSingleSpeeds.empty() && coilCoolingDXMultiSpeeds.empty() && coilCoolingWaters.empty()) { |
| 8471 | ✗ | type = HV; | |
| 8472 | } else { | ||
| 8473 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (!variableFans.empty()) { // Variable speed fan |
| 8474 | ✗ | if (!singleZoneReheats.empty()) { // Single zone reheat SPM | |
| 8475 | ✗ | if (!coilHeatingDXSingleSpeeds.empty()) { // DX Heating (Heat pump) | |
| 8476 | ✗ | type = SZVAVHP; | |
| 8477 | } else { // Not DX Heating (No heat pump) | ||
| 8478 | ✗ | type = SZVAVAC; | |
| 8479 | } | ||
| 8480 | } else { // Anything besides single zone reheat | ||
| 8481 | ✗ | if (!coilCoolingWaters.empty()) { // Chilled water coil | |
| 8482 | ✗ | type = VAV; | |
| 8483 | } else { // No chilled water coil | ||
| 8484 | ✗ | type = PVAV; | |
| 8485 | } | ||
| 8486 | } | ||
| 8487 | } else { // Not variable speed fan | ||
| 8488 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (!singleZoneReheats.empty()) { // Single zone reheat SPM |
| 8489 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
|
1 | if (!coilHeatingDXSingleSpeeds.empty()) { // DX Heating (Heat pump) |
| 8490 | ✗ | type = SZHP; | |
| 8491 | } else { // Not DX Heating (No heat pump) | ||
| 8492 |
1/1✓ Branch 1 taken 1 time.
|
1 | type = SZAC; |
| 8493 | } | ||
| 8494 | } else { | ||
| 8495 | ✗ | LOG(Warn, | |
| 8496 | airLoop.briefDescription() << " does not directly map to an air system type. Assuming VAV even though there is no variable speed fan.") | ||
| 8497 | ✗ | type = VAV; | |
| 8498 | } | ||
| 8499 | } | ||
| 8500 | } | ||
| 8501 | |||
| 8502 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
|
1 | OS_ASSERT(!type.empty()); |
| 8503 | |||
| 8504 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto typeElement = result.append_child("TypeSim"); |
| 8505 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
|
1 | typeElement.text() = escapeName(type).c_str(); |
| 8506 | |||
| 8507 | // TODO | ||
| 8508 | // SubType | ||
| 8509 | // 1: "SinglePackage" | ||
| 8510 | // 2: "SplitSystem" | ||
| 8511 | // 3: "CRAC" | ||
| 8512 | // 4: "CRAH" | ||
| 8513 | |||
| 8514 | // NightCycleFanCtrl | ||
| 8515 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto nightCycleFanCtrlElement = result.append_child("NightCycleFanCtrl"); |
| 8516 | |||
| 8517 | // OpenStudio string to represent night cycle control method | ||
| 8518 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto osNightCycleFanCtrl = airLoop.nightCycleControlType(); |
| 8519 | // Convert to SDD string | ||
| 8520 | 1 | std::string nightCycleFanCtrl; | |
| 8521 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 time.
|
2 | if (istringEqual(osNightCycleFanCtrl, "CycleOnAny")) { |
| 8522 | ✗ | nightCycleFanCtrl = "CycleOnCallAnyZone"; | |
| 8523 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 time.
|
2 | } else if (istringEqual(osNightCycleFanCtrl, "CycleOnAnyZoneFansOnly")) { |
| 8524 | ✗ | nightCycleFanCtrl = "CycleZoneFansOnly"; | |
| 8525 | } else { | ||
| 8526 |
1/1✓ Branch 1 taken 1 time.
|
1 | nightCycleFanCtrl = "StaysOff"; |
| 8527 | } | ||
| 8528 | |||
| 8529 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
|
1 | nightCycleFanCtrlElement.text() = escapeName(nightCycleFanCtrl).c_str(); |
| 8530 | |||
| 8531 | // Cnt | ||
| 8532 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto cntElement = result.append_child("Cnt"); |
| 8533 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | cntElement.text() = "1"; |
| 8534 | |||
| 8535 | // FanPos | ||
| 8536 | 1 | std::string fanPos; | |
| 8537 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto inletComp = supplyOutletNode.inletModelObject(); |
| 8538 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
|
1 | OS_ASSERT(inletComp); |
| 8539 |
6/18✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 time.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 time.
✓ Branch 21 taken 1 time.
✗ Branch 22 not taken.
✓ Branch 24 taken 1 time.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
|
2 | if (inletComp->optionalCast<model::FanConstantVolume>() || inletComp->optionalCast<model::FanVariableVolume>()) { |
| 8540 |
1/1✓ Branch 1 taken 1 time.
|
1 | fanPos = "DrawThrough"; |
| 8541 | } else { | ||
| 8542 | ✗ | fanPos = "BlowThrough"; | |
| 8543 | } | ||
| 8544 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto fanPosElement = result.append_child("FanPos"); |
| 8545 |
2/2✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
|
1 | fanPosElement.text() = fanPos.c_str(); |
| 8546 | |||
| 8547 | // ClgCtrl | ||
| 8548 |
1/2✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
|
1 | for (const auto& spm : spms) { |
| 8549 |
4/5✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 11 taken 1 time.
✗ Branch 12 not taken.
|
2 | if (istringEqual(spm.controlVariable(), "Temperature")) { |
| 8550 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
2 | if (auto tempSPM = spm.optionalCast<model::SetpointManagerFollowOutdoorAirTemperature>()) { |
| 8551 | // SetpointManagerFollowOutdoorAirTemperature is not supported by CBECC so it is converted to oa reset. | ||
| 8552 | ✗ | LOG(Warn, tempSPM->briefDescription() << " is translated to ClgCtrl type OutsideAirReset in CBECC."); | |
| 8553 | ✗ | auto clgCtrlElement = result.append_child("ClgCtrl"); | |
| 8554 | ✗ | clgCtrlElement.text() = "OutsideAirReset"; | |
| 8555 | |||
| 8556 | ✗ | auto clRstSupHiElement = result.append_child("ClRstSupHi"); | |
| 8557 | ✗ | clRstSupHiElement.text() = "100"; | |
| 8558 | |||
| 8559 | ✗ | auto clRstSupLowElement = result.append_child("ClRstSupLow"); | |
| 8560 | ✗ | clRstSupLowElement.text() = "0"; | |
| 8561 | |||
| 8562 | ✗ | auto clRstOutdrHiElement = result.append_child("ClRstOutdrHi"); | |
| 8563 | ✗ | clRstOutdrHiElement.text() = "100"; | |
| 8564 | |||
| 8565 | ✗ | auto clRstOutdrLowElement = result.append_child("ClRstOutdrLow"); | |
| 8566 | ✗ | clRstOutdrLowElement.text() = "0"; | |
| 8567 | |||
| 8568 | ✗ | m_translatedObjects[tempSPM->handle()] = clgCtrlElement; | |
| 8569 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
2 | } else if (auto tempSPM = spm.optionalCast<model::SetpointManagerOutdoorAirReset>()) { |
| 8570 | ✗ | auto clgCtrlElement = result.append_child("ClgCtrl"); | |
| 8571 | ✗ | clgCtrlElement.text() = "OutsideAirReset"; | |
| 8572 | |||
| 8573 | ✗ | auto clRstSupHiElement = result.append_child("ClRstSupHi"); | |
| 8574 | ✗ | auto clRstSupHi = convert(tempSPM->setpointatOutdoorHighTemperature(), "C", "F").get(); | |
| 8575 | ✗ | clRstSupHiElement.text() = openstudio::string_conversions::number(clRstSupHi).c_str(); | |
| 8576 | |||
| 8577 | ✗ | auto clRstSupLowElement = result.append_child("ClRstSupLow"); | |
| 8578 | ✗ | auto clRstSupLow = convert(tempSPM->setpointatOutdoorLowTemperature(), "C", "F").get(); | |
| 8579 | ✗ | clRstSupLowElement.text() = openstudio::string_conversions::number(clRstSupLow).c_str(); | |
| 8580 | |||
| 8581 | ✗ | auto clRstOutdrHiElement = result.append_child("ClRstOutdrHi"); | |
| 8582 | ✗ | auto clRstOutdrHi = convert(tempSPM->outdoorHighTemperature(), "C", "F").get(); | |
| 8583 | ✗ | clRstOutdrHiElement.text() = openstudio::string_conversions::number(clRstOutdrHi).c_str(); | |
| 8584 | |||
| 8585 | ✗ | auto clRstOutdrLowElement = result.append_child("ClRstOutdrLow"); | |
| 8586 | ✗ | auto clRstOutdrLow = convert(tempSPM->outdoorHighTemperature(), "C", "F").get(); | |
| 8587 | ✗ | clRstOutdrLowElement.text() = openstudio::string_conversions::number(clRstOutdrLow).c_str(); | |
| 8588 | |||
| 8589 | ✗ | m_translatedObjects[tempSPM->handle()] = clgCtrlElement; | |
| 8590 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
2 | } else if (auto tempSPM = spm.optionalCast<model::SetpointManagerScheduled>()) { |
| 8591 | ✗ | auto clgCtrlElement = result.append_child("ClgCtrl"); | |
| 8592 | ✗ | clgCtrlElement.text() = "Scheduled"; | |
| 8593 | |||
| 8594 | ✗ | auto clgSetPtSchRefElement = result.append_child("ClgSetptSchRef"); | |
| 8595 | ✗ | const auto& schedule = tempSPM->schedule(); | |
| 8596 | ✗ | clgSetPtSchRefElement.text() = escapeName(schedule.name().get()).c_str(); | |
| 8597 | |||
| 8598 | ✗ | m_translatedObjects[tempSPM->handle()] = clgCtrlElement; | |
| 8599 |
2/3✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 time.
|
2 | } else if (auto tempSPM = spm.optionalCast<model::SetpointManagerScheduledDualSetpoint>()) { |
| 8600 | ✗ | LOG(Error, tempSPM->briefDescription() << " is not supported by CBECC."); | |
| 8601 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if (auto tempSPM = spm.optionalCast<model::SetpointManagerSingleZoneReheat>()) { |
| 8602 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto clgCtrlElement = result.append_child("ClgCtrl"); |
| 8603 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | clgCtrlElement.text() = "NoSATControl"; |
| 8604 | |||
| 8605 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | m_translatedObjects[tempSPM->handle()] = clgCtrlElement; |
| 8606 | ✗ | } else if (auto tempSPM = spm.optionalCast<model::SetpointManagerWarmestTemperatureFlow>()) { | |
| 8607 | ✗ | auto clgCtrlElement = result.append_child("ClgCtrl"); | |
| 8608 | ✗ | if (istringEqual(tempSPM->strategy(), "FlowFirst")) { | |
| 8609 | ✗ | clgCtrlElement.text() = "WarmestResetFlowFirst"; | |
| 8610 | } else { | ||
| 8611 | ✗ | clgCtrlElement.text() = "WarmestResetTemperatureFirst"; | |
| 8612 | } | ||
| 8613 | |||
| 8614 | ✗ | auto clRstSupHiElement = result.append_child("ClRstSupHi"); | |
| 8615 | ✗ | auto clRstSupHi = convert(tempSPM->maximumSetpointTemperature(), "C", "F").get(); | |
| 8616 | ✗ | clRstSupHiElement.text() = openstudio::string_conversions::number(clRstSupHi).c_str(); | |
| 8617 | |||
| 8618 | ✗ | auto clRstSupLowElement = result.append_child("ClRstSupLow"); | |
| 8619 | ✗ | auto clRstSupLow = convert(tempSPM->maximumSetpointTemperature(), "C", "F").get(); | |
| 8620 | ✗ | clRstSupLowElement.text() = openstudio::string_conversions::number(clRstSupLow).c_str(); | |
| 8621 | |||
| 8622 | ✗ | auto dsgnAirFlowMinElement = result.append_child("DsgnAirFlowMin"); | |
| 8623 | ✗ | auto dsgnAirFlowMin = tempSPM->minimumTurndownRatio(); | |
| 8624 | ✗ | dsgnAirFlowMinElement.text() = openstudio::string_conversions::number(dsgnAirFlowMin).c_str(); | |
| 8625 | |||
| 8626 | ✗ | m_translatedObjects[tempSPM->handle()] = clgCtrlElement; | |
| 8627 | ✗ | } else if (auto tempSPM = spm.optionalCast<model::SetpointManagerWarmest>()) { | |
| 8628 | ✗ | auto clgCtrlElement = result.append_child("ClgCtrl"); | |
| 8629 | ✗ | clgCtrlElement.text() = "WarmestReset"; | |
| 8630 | |||
| 8631 | ✗ | auto clRstSupHiElement = result.append_child("ClRstSupHi"); | |
| 8632 | ✗ | auto clRstSupHi = convert(tempSPM->maximumSetpointTemperature(), "C", "F").get(); | |
| 8633 | ✗ | clRstSupHiElement.text() = openstudio::string_conversions::number(clRstSupHi).c_str(); | |
| 8634 | |||
| 8635 | ✗ | auto clRstSupLowElement = result.append_child("ClRstSupLow"); | |
| 8636 | ✗ | auto clRstSupLow = convert(tempSPM->maximumSetpointTemperature(), "C", "F").get(); | |
| 8637 | ✗ | clRstSupLowElement.text() = openstudio::string_conversions::number(clRstSupLow).c_str(); | |
| 8638 | |||
| 8639 | ✗ | m_translatedObjects[tempSPM->handle()] = clgCtrlElement; | |
| 8640 | } else { | ||
| 8641 | ✗ | LOG(Error, spm.briefDescription() << " does not currently map into SDD format.") | |
| 8642 | // TODO Handle other SPMs | ||
| 8643 | 5 | } | |
| 8644 | |||
| 8645 | 1 | break; | |
| 8646 | } | ||
| 8647 | } | ||
| 8648 | |||
| 8649 | // Translate supply components | ||
| 8650 | |||
| 8651 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto airSegElement = result.append_child("AirSeg"); |
| 8652 | |||
| 8653 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto airSegNameElement = airSegElement.append_child("Name"); |
| 8654 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
|
1 | airSegNameElement.text() = (name + " Supply AirSeg").c_str(); |
| 8655 | |||
| 8656 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto airSegTypeElement = airSegElement.append_child("Type"); |
| 8657 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | airSegTypeElement.text() = "Supply"; |
| 8658 | |||
| 8659 |
5/5✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 15 taken 9 times.
✓ Branch 16 taken 1 time.
|
12 | for (auto& comp : airLoop.supplyComponents()) { |
| 8660 |
3/3✓ Branch 1 taken 9 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 8 times.
|
18 | if (auto fan = comp.optionalCast<model::FanConstantVolume>()) { |
| 8661 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | translateFanConstantVolume(fan.get(), airSegElement); |
| 8662 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 7 times.
|
16 | } else if (auto coil = comp.optionalCast<model::CoilCoolingDXSingleSpeed>()) { |
| 8663 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | translateCoilCoolingDXSingleSpeed(coil.get(), airSegElement); |
| 8664 |
3/3✓ Branch 1 taken 7 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 6 times.
|
14 | } else if (auto coil = comp.optionalCast<model::CoilHeatingGas>()) { |
| 8665 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | translateCoilHeatingGas(coil.get(), airSegElement); |
| 8666 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 5 times.
|
12 | } else if (auto oasys = comp.optionalCast<model::AirLoopHVACOutdoorAirSystem>()) { |
| 8667 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | translateAirLoopHVACOutdoorAirSystem(oasys.get(), result); |
| 8668 | } else { | ||
| 8669 | // TODO Handle other supply component types | ||
| 8670 |
7/7✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 14 taken 5 times.
✓ Branch 17 taken 5 times.
✓ Branch 20 taken 5 times.
|
5 | LOG(Warn, comp.briefDescription() << " does not currently map into SDD format.") |
| 8671 | 30 | } | |
| 8672 | 1 | } | |
| 8673 | |||
| 8674 |
1/1✓ Branch 1 taken 1 time.
|
2 | return result; |
| 8675 | 1 | } | |
| 8676 | |||
| 8677 | 1 | boost::optional<pugi::xml_node> ForwardTranslator::translateAirLoopHVACOutdoorAirSystem(const openstudio::model::AirLoopHVACOutdoorAirSystem& oasys, | |
| 8678 | pugi::xml_node& airSegElement) { | ||
| 8679 | // TODO: nothing is happening here really | ||
| 8680 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto result = airSegElement.append_child("OACtrl"); |
| 8681 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | m_translatedObjects[oasys.handle()] = result; |
| 8682 |
1/1✓ Branch 1 taken 1 time.
|
2 | return result; |
| 8683 | } | ||
| 8684 | |||
| 8685 | 1 | boost::optional<pugi::xml_node> ForwardTranslator::translateCoilHeatingGas(const openstudio::model::CoilHeatingGas& coil, | |
| 8686 | pugi::xml_node& airSegElement) { | ||
| 8687 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto result = airSegElement.append_child("CoilHtg"); |
| 8688 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | m_translatedObjects[coil.handle()] = result; |
| 8689 | |||
| 8690 | // Type | ||
| 8691 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto typeElement = result.append_child("Type"); |
| 8692 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | typeElement.text() = "Furnace"; |
| 8693 | |||
| 8694 | // FuelSrc | ||
| 8695 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto fuelSrcElement = result.append_child("FuelSrc"); |
| 8696 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | fuelSrcElement.text() = "NaturalGas"; |
| 8697 | |||
| 8698 | // CapTotGrossRtd | ||
| 8699 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (coil.isNominalCapacityAutosized()) { |
| 8700 | 1 | m_autoHardSize = true; | |
| 8701 | ✗ | } else if (auto value = coil.nominalCapacity()) { | |
| 8702 | ✗ | auto capTotGrossRtdElement = result.append_child("CapTotGrossRtd"); | |
| 8703 | ✗ | capTotGrossRtdElement.text() = openstudio::string_conversions::number(convert(value.get(), "W", "Btu/h").get()).c_str(); | |
| 8704 | } | ||
| 8705 | |||
| 8706 | // FurnThrmlEff | ||
| 8707 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto furnThrmlEffElement = result.append_child("FurnThrmlEff"); |
| 8708 |
8/8✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 20 taken 1 time.
✓ Branch 23 taken 1 time.
|
3 | furnThrmlEffElement.text() = openstudio::string_conversions::number(convert(coil.gasBurnerEfficiency(), "W", "Btu/h").get()).c_str(); |
| 8709 | |||
| 8710 |
1/1✓ Branch 1 taken 1 time.
|
2 | return result; |
| 8711 | } | ||
| 8712 | |||
| 8713 | 1 | boost::optional<pugi::xml_node> ForwardTranslator::translateCoilCoolingDXSingleSpeed(const openstudio::model::CoilCoolingDXSingleSpeed& coil, | |
| 8714 | pugi::xml_node& airSegElement) { | ||
| 8715 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto result = airSegElement.append_child("CoilClg"); |
| 8716 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | m_translatedObjects[coil.handle()] = result; |
| 8717 | |||
| 8718 | // Type | ||
| 8719 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto typeElement = result.append_child("Type"); |
| 8720 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | typeElement.text() = "DirectExpansion"; |
| 8721 | |||
| 8722 | // NumClgStages | ||
| 8723 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto numClgStagesElement = result.append_child("NumClgStages"); |
| 8724 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | numClgStagesElement.text() = "1"; |
| 8725 | |||
| 8726 | // CapTotGrossRtd | ||
| 8727 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (coil.isRatedTotalCoolingCapacityAutosized()) { |
| 8728 | 1 | m_autoHardSize = true; | |
| 8729 | ✗ | } else if (auto value = coil.ratedTotalCoolingCapacity()) { | |
| 8730 | ✗ | auto capTotGrossRtdElement = result.append_child("CapTotGrossRtd"); | |
| 8731 | ✗ | capTotGrossRtdElement.text() = openstudio::string_conversions::number(convert(value.get(), "W", "Btu/h").get()).c_str(); | |
| 8732 | } | ||
| 8733 | |||
| 8734 | // DXEER | ||
| 8735 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (auto cop = coil.ratedCOP()) { |
| 8736 | 1 | auto r = 0.12; | |
| 8737 | 1 | auto eer = (cop * (1 - r) - r) * 3.413; | |
| 8738 | |||
| 8739 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto dxEERElement = result.append_child("DXEER"); |
| 8740 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
|
1 | dxEERElement.text() = openstudio::string_conversions::number(eer).c_str(); |
| 8741 | } else { | ||
| 8742 | ✗ | m_autoEfficiency = true; | |
| 8743 | } | ||
| 8744 | |||
| 8745 | // CndsrType | ||
| 8746 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto cndsrTypeElement = result.append_child("CndsrType"); |
| 8747 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | cndsrTypeElement.text() = "Air"; |
| 8748 | |||
| 8749 |
1/1✓ Branch 1 taken 1 time.
|
2 | return result; |
| 8750 | } | ||
| 8751 | |||
| 8752 | 1 | boost::optional<pugi::xml_node> ForwardTranslator::translateFanConstantVolume(const openstudio::model::FanConstantVolume& fan, | |
| 8753 | pugi::xml_node& airSegElement) { | ||
| 8754 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto result = airSegElement.append_child("Fan"); |
| 8755 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | m_translatedObjects[fan.handle()] = result; |
| 8756 | |||
| 8757 | // CtrlMthd | ||
| 8758 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto ctrlMthdElement = result.append_child("CtrlMthdSim"); |
| 8759 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | ctrlMthdElement.text() = "ConstantVolume"; |
| 8760 | |||
| 8761 | // Class - Centrifugal | Axial | ||
| 8762 | // TODO Define a way to deterimine or specify | ||
| 8763 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto classElement = result.append_child("Class"); |
| 8764 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | classElement.text() = "Axial"; |
| 8765 | |||
| 8766 | // ModelingMthd | ||
| 8767 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto modelingMthdElement = result.append_child("ModelingMthd"); |
| 8768 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelingMthdElement.text() = "StaticPressure"; |
| 8769 | |||
| 8770 | // FlowCap | ||
| 8771 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (fan.isMaximumFlowRateAutosized()) { |
| 8772 | 1 | m_autoHardSize = true; | |
| 8773 | ✗ | } else if (auto value = fan.maximumFlowRate()) { | |
| 8774 | ✗ | auto flowCapElement = result.append_child("FlowCap"); | |
| 8775 | // Note JM 2019-01-16: I use string_conversions::number here to mimic QString::number's number of decimals | ||
| 8776 | ✗ | flowCapElement.text() = openstudio::string_conversions::number(convert(value.get(), "m^3/s", "cfm").get()).c_str(); | |
| 8777 | } | ||
| 8778 | |||
| 8779 | // FlowEff | ||
| 8780 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto flowEffElement = result.append_child("FlowEff"); |
| 8781 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
|
1 | flowEffElement.text() = openstudio::string_conversions::number(fan.fanEfficiency()).c_str(); |
| 8782 | |||
| 8783 | // TotStaticPress | ||
| 8784 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto totStaticPressElement = result.append_child("TotStaticPress"); |
| 8785 | // Convert in PA to WC | ||
| 8786 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
|
1 | totStaticPressElement.text() = openstudio::string_conversions::number(fan.pressureRise() / 249.0889).c_str(); |
| 8787 | |||
| 8788 | // MtrEff | ||
| 8789 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto mtrEffElement = result.append_child("MtrEff"); |
| 8790 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
|
1 | mtrEffElement.text() = openstudio::string_conversions::number(fan.motorEfficiency()).c_str(); |
| 8791 | |||
| 8792 | // MtrPos | ||
| 8793 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto mtrPosElement = result.append_child("MtrfPos"); |
| 8794 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (fan.motorInAirstreamFraction() >= 0.5) { |
| 8795 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | mtrPosElement.text() = "InAirStream"; |
| 8796 | } else { | ||
| 8797 | ✗ | mtrPosElement.text() = "NotInAirStream"; | |
| 8798 | } | ||
| 8799 | |||
| 8800 |
1/1✓ Branch 1 taken 1 time.
|
2 | return result; |
| 8801 | } | ||
| 8802 | |||
| 8803 | } // namespace sdd | ||
| 8804 | } // namespace openstudio | ||
| 8805 |