GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 86.8% 178 / 0 / 205
Functions: 100.0% 6 / 0 / 6
Branches: 76.7% 381 / 0 / 497

src/energyplus/ForwardTranslator/ForwardTranslateZoneHVACTerminalUnitVariableRefrigerantFlow.cpp
Line Branch Exec Source
1 /***********************************************************************************************************************
2 * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC.
3 * See also https://openstudio.net/license
4 ***********************************************************************************************************************/
5
6 #include "../ForwardTranslator.hpp"
7 #include "../../model/Model.hpp"
8 #include "../../model/Schedule.hpp"
9 #include "../../model/Schedule_Impl.hpp"
10 #include "../../model/FanOnOff.hpp"
11 #include "../../model/FanOnOff_Impl.hpp"
12 #include "../../model/AirLoopHVAC.hpp"
13 #include "../../model/AirLoopHVAC_Impl.hpp"
14 #include "../../model/FanConstantVolume.hpp"
15 #include "../../model/FanConstantVolume_Impl.hpp"
16 #include "../../model/Node.hpp"
17 #include "../../model/Node_Impl.hpp"
18 #include "../../model/ThermalZone.hpp"
19 #include "../../model/ThermalZone_Impl.hpp"
20 #include "../../model/ZoneHVACTerminalUnitVariableRefrigerantFlow.hpp"
21 #include "../../model/ZoneHVACTerminalUnitVariableRefrigerantFlow_Impl.hpp"
22 #include "../../model/Curve.hpp"
23 #include "../../model/Curve_Impl.hpp"
24 #include "../../model/CurveBiquadratic.hpp"
25 #include "../../model/CurveBiquadratic_Impl.hpp"
26 #include "../../model/CurveCubic.hpp"
27 #include "../../model/CurveCubic_Impl.hpp"
28 #include "../../model/CoilCoolingDXVariableRefrigerantFlow.hpp"
29 #include "../../model/CoilCoolingDXVariableRefrigerantFlow_Impl.hpp"
30 #include "../../model/CoilHeatingDXVariableRefrigerantFlow.hpp"
31 #include "../../model/CoilHeatingDXVariableRefrigerantFlow_Impl.hpp"
32 #include "../../utilities/core/Logger.hpp"
33 #include "../../utilities/core/Assert.hpp"
34 #include "../../utilities/math/FloatCompare.hpp"
35 #include <utilities/idd/ZoneHVAC_TerminalUnit_VariableRefrigerantFlow_FieldEnums.hxx>
36 #include <utilities/idd/Fan_OnOff_FieldEnums.hxx>
37 #include <utilities/idd/Fan_SystemModel_FieldEnums.hxx>
38 #include <utilities/idd/Fan_ConstantVolume_FieldEnums.hxx>
39 #include <utilities/idd/OutdoorAir_Mixer_FieldEnums.hxx>
40 #include <utilities/idd/Coil_Cooling_DX_VariableRefrigerantFlow_FieldEnums.hxx>
41 #include <utilities/idd/Coil_Heating_DX_VariableRefrigerantFlow_FieldEnums.hxx>
42 #include <utilities/idd/Coil_Cooling_DX_VariableRefrigerantFlow_FluidTemperatureControl_FieldEnums.hxx>
43 #include <utilities/idd/Coil_Heating_DX_VariableRefrigerantFlow_FluidTemperatureControl_FieldEnums.hxx>
44 #include <utilities/idd/Coil_Heating_Fuel_FieldEnums.hxx>
45 #include <utilities/idd/Coil_Heating_Electric_FieldEnums.hxx>
46 #include <utilities/idd/Coil_Heating_Water_FieldEnums.hxx>
47 #include "../../utilities/idd/IddEnums.hpp"
48 #include <utilities/idd/IddEnums.hxx>
49
50 using namespace openstudio::model;
51
52 using namespace std;
53
54 namespace openstudio {
55
56 namespace energyplus {
57
58 boost::optional<IdfObject>
59 28 ForwardTranslator::translateZoneHVACTerminalUnitVariableRefrigerantFlow(ZoneHVACTerminalUnitVariableRefrigerantFlow& modelObject) {
60 28 boost::optional<std::string> s;
61 28 boost::optional<double> value;
62
63
2/2
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
28 IdfObject idfObject(IddObjectType::ZoneHVAC_TerminalUnit_VariableRefrigerantFlow);
64
65
1/1
✓ Branch 1 taken 28 times.
28 m_idfObjects.push_back(idfObject);
66
67 // Name
68
69
1/1
✓ Branch 1 taken 28 times.
28 s = modelObject.name();
70
1/2
✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
28 if (s) {
71
2/2
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
28 idfObject.setName(*s);
72 }
73
74
1/1
✓ Branch 1 taken 28 times.
28 auto t_airLoopHVAC = modelObject.airLoopHVAC();
75
76 // TerminalUnitAvailabilityschedule
77
78
3/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 8 taken 28 times.
✗ Branch 9 not taken.
56 if (boost::optional<model::Schedule> schedule = modelObject.terminalUnitAvailabilityschedule()) {
79
3/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 6 taken 28 times.
✗ Branch 7 not taken.
56 if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule.get())) {
80
4/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 7 taken 28 times.
✓ Branch 10 taken 28 times.
28 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::TerminalUnitAvailabilitySchedule, _schedule->name().get());
81 28 }
82 28 }
83
84 // SupplyAirFlowRateDuringCoolingOperation
85
86
2/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 28 times.
✗ Branch 4 not taken.
28 if (modelObject.isSupplyAirFlowRateDuringCoolingOperationAutosized()) {
87
2/2
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
56 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::CoolingSupplyAirFlowRate, "Autosize");
88 ✗ } else if ((value = modelObject.supplyAirFlowRateDuringCoolingOperation())) {
89 ✗ idfObject.setDouble(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::CoolingSupplyAirFlowRate, value.get());
90 }
91
92 // SupplyAirFlowRateWhenNoCoolingisNeeded
93
94
2/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 28 times.
✗ Branch 4 not taken.
28 if (modelObject.isSupplyAirFlowRateWhenNoCoolingisNeededAutosized()) {
95
2/2
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
56 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::NoCoolingSupplyAirFlowRate, "Autosize");
96 ✗ } else if ((value = modelObject.supplyAirFlowRateWhenNoCoolingisNeeded())) {
97 ✗ idfObject.setDouble(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::NoCoolingSupplyAirFlowRate, value.get());
98 }
99
100 // SupplyAirFlowRateDuringHeatingOperation
101
102
2/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 28 times.
✗ Branch 4 not taken.
28 if (modelObject.isSupplyAirFlowRateDuringHeatingOperationAutosized()) {
103
2/2
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
56 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::HeatingSupplyAirFlowRate, "Autosize");
104 ✗ } else if ((value = modelObject.supplyAirFlowRateDuringHeatingOperation())) {
105 ✗ idfObject.setDouble(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::HeatingSupplyAirFlowRate, value.get());
106 }
107
108 // SupplyAirFlowRateWhenNoHeatingisNeeded
109
110
2/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 28 times.
✗ Branch 4 not taken.
28 if (modelObject.isSupplyAirFlowRateWhenNoHeatingisNeededAutosized()) {
111
2/2
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
56 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::NoHeatingSupplyAirFlowRate, "Autosize");
112 ✗ } else if ((value = modelObject.supplyAirFlowRateWhenNoHeatingisNeeded())) {
113 ✗ idfObject.setDouble(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::NoHeatingSupplyAirFlowRate, value.get());
114 }
115
116 // OutdoorAirFlowRateDuringCoolingOperation
117
118
2/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 28 times.
✗ Branch 4 not taken.
28 if (modelObject.isOutdoorAirFlowRateDuringCoolingOperationAutosized()) {
119
2/2
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
56 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::CoolingOutdoorAirFlowRate, "Autosize");
120 ✗ } else if ((value = modelObject.outdoorAirFlowRateDuringCoolingOperation())) {
121 ✗ idfObject.setDouble(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::CoolingOutdoorAirFlowRate, value.get());
122 }
123
124 // OutdoorAirFlowRateDuringHeatingOperation
125
126
2/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 28 times.
✗ Branch 4 not taken.
28 if (modelObject.isOutdoorAirFlowRateDuringHeatingOperationAutosized()) {
127
2/2
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
56 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::HeatingOutdoorAirFlowRate, "Autosize");
128 ✗ } else if ((value = modelObject.outdoorAirFlowRateDuringHeatingOperation())) {
129 ✗ idfObject.setDouble(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::HeatingOutdoorAirFlowRate, value.get());
130 }
131
132 // OutdoorAirFlowRateWhenNoCoolingorHeatingisNeeded
133
134
2/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 28 times.
✗ Branch 4 not taken.
28 if (modelObject.isOutdoorAirFlowRateWhenNoCoolingorHeatingisNeededAutosized()) {
135
2/2
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
56 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::NoLoadOutdoorAirFlowRate, "Autosize");
136 ✗ } else if ((value = modelObject.outdoorAirFlowRateWhenNoCoolingorHeatingisNeeded())) {
137 ✗ idfObject.setDouble(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::NoLoadOutdoorAirFlowRate, value.get());
138 }
139
140 // SupplyAirFanOperatingModeScheduleName
141
142
3/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 8 taken 28 times.
✗ Branch 9 not taken.
56 if (boost::optional<model::Schedule> schedule = modelObject.supplyAirFanOperatingModeSchedule()) {
143
3/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 6 taken 28 times.
✗ Branch 7 not taken.
56 if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule.get())) {
144
4/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 7 taken 28 times.
✓ Branch 10 taken 28 times.
28 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::SupplyAirFanOperatingModeScheduleName, _schedule->name().get());
145 28 }
146 28 }
147
148 // SupplyAirFanplacement
149 28 bool t_blowThrough = false;
150
1/1
✓ Branch 1 taken 28 times.
28 auto fanPlacement = modelObject.supplyAirFanPlacement();
151
1/1
✓ Branch 1 taken 28 times.
28 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::SupplyAirFanPlacement, fanPlacement);
152
4/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 27 times.
56 if (istringEqual(fanPlacement, "BlowThrough")) {
153 1 t_blowThrough = true;
154 }
155
156 // Node Names
157 // Currently we default the Fan to DrawThrough, which means the components are ordered as such:
158 // InletNode ----- (Mixer) ---- CoolingCoil ----- HeatingCoil ----- Fan ---- (Supplemental Heating Coil) -------- OutletNode
159 // BlowThrough
160 // InletNode ----- (Mixer) ---- Fan ---- CoolingCoil ----- HeatingCoil ----- (Supplemental Heating Coil) -------- OutletNode
161
162 28 std::string inletNodeName;
163 28 std::string outletNodeName;
164
165
3/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 14 times.
✓ Branch 4 taken 14 times.
56 if (boost::optional<model::Node> node = modelObject.inletNode()) {
166
4/4
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✓ Branch 10 taken 14 times.
14 inletNodeName = node->name().get();
167 28 }
168
169
3/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 14 times.
✓ Branch 4 taken 14 times.
56 if (boost::optional<model::Node> node = modelObject.outletNode()) {
170
4/4
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✓ Branch 10 taken 14 times.
14 outletNodeName = node->name().get();
171 28 }
172
173 // TerminalUnitAirInletNodeName
174
175
1/1
✓ Branch 1 taken 28 times.
28 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::TerminalUnitAirInletNodeName, inletNodeName);
176
177 // TerminalUnitAirOutletNodeName
178
179
1/1
✓ Branch 1 taken 28 times.
28 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::TerminalUnitAirOutletNodeName, outletNodeName);
180
181 28 auto translateMixer = [&]() {
182
10/16
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 21 times.
✓ Branch 5 taken 7 times.
✓ Branch 7 taken 21 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 21 times.
✓ Branch 12 taken 21 times.
✓ Branch 13 taken 7 times.
✓ Branch 15 taken 28 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 7 times.
✓ Branch 19 taken 21 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
77 if (modelObject.airLoopHVAC() || modelObject.airLoopHVACOutdoorAirSystem()) {
183 7 return false;
184 }
185
186 21 bool zeroOA = false;
187
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
42 if ((value = modelObject.outdoorAirFlowRateDuringCoolingOperation())) {
188 ✗ zeroOA = equal(value.get(), 0.0);
189 }
190
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
42 if ((value = modelObject.outdoorAirFlowRateDuringHeatingOperation())) {
191 ✗ zeroOA = (zeroOA && equal(value.get(), 0.0));
192 }
193
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
42 if ((value = modelObject.outdoorAirFlowRateWhenNoCoolingorHeatingisNeeded())) {
194 ✗ zeroOA = (zeroOA && equal(value.get(), 0.0));
195 }
196
197
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
21 if (zeroOA) {
198 ✗ return false;
199 }
200
201 21 return true;
202 28 };
203
204 // OutdoorAirMixer
205
3/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 21 times.
✓ Branch 4 taken 7 times.
28 if (translateMixer()) {
206
2/2
✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
21 IdfObject _outdoorAirMixer(IddObjectType::OutdoorAir_Mixer);
207
4/4
✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
21 _outdoorAirMixer.setName(modelObject.name().get() + " OA Mixer");
208
1/1
✓ Branch 1 taken 21 times.
21 m_idfObjects.push_back(_outdoorAirMixer);
209
210
3/3
✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
21 std::string mixerOutletNodeName = modelObject.name().get() + " Mixer Outlet Node";
211
3/3
✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
21 std::string oaNodeName = modelObject.name().get() + " Outdoor Air Node";
212
213
1/1
✓ Branch 1 taken 21 times.
21 _outdoorAirMixer.setString(OutdoorAir_MixerFields::MixedAirNodeName, mixerOutletNodeName);
214
215
1/1
✓ Branch 1 taken 21 times.
21 _outdoorAirMixer.setString(OutdoorAir_MixerFields::ReturnAirStreamNodeName, inletNodeName);
216
217
2/2
✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
21 IdfObject _oaNodeList(openstudio::IddObjectType::OutdoorAir_NodeList);
218
1/1
✓ Branch 1 taken 21 times.
21 _oaNodeList.setString(0, oaNodeName);
219
1/1
✓ Branch 1 taken 21 times.
21 m_idfObjects.push_back(_oaNodeList);
220
221
4/4
✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
21 _outdoorAirMixer.setString(OutdoorAir_MixerFields::ReliefAirStreamNodeName, modelObject.name().get() + " Relief Node Name");
222
223
1/1
✓ Branch 1 taken 21 times.
21 _outdoorAirMixer.setString(OutdoorAir_MixerFields::OutdoorAirStreamNodeName, oaNodeName);
224
225 // OutsideAirMixerObjectType
226
227
3/3
✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
21 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::OutsideAirMixerObjectType, _outdoorAirMixer.iddObject().name());
228
229 // OutsideAirMixerObjectName
230
231
3/3
✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
21 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::OutsideAirMixerObjectName, _outdoorAirMixer.name().get());
232
233 // For the remaining components, the first node is the mixerOutletNodeName
234
1/1
✓ Branch 1 taken 21 times.
21 inletNodeName = mixerOutletNodeName;
235 21 }
236
237 struct Component
238 {
239 83 Component(const IdfObject& obj, const std::string& t_outletNodeName, unsigned t_inletIndex, unsigned t_outletIndex)
240
1/1
✓ Branch 2 taken 83 times.
83 : idfObject(obj), outletNodeName(t_outletNodeName), inletIndex(t_inletIndex), outletIndex(t_outletIndex) {}
241 IdfObject idfObject;
242 std::string outletNodeName;
243 unsigned inletIndex;
244 unsigned outletIndex;
245 };
246
247 28 size_t fanIndex = -1;
248
249 // We'll store the Components in the vector, so we can write their inlet/outlet nodes in the right order
250 28 std::vector<Component> compsInOrder;
251
252 23 auto getFanInletOutletIndexes = [&modelObject](const IdfObject& idf_fan) {
253
5/5
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
✓ Branch 7 taken 23 times.
✓ Branch 11 taken 19 times.
✓ Branch 12 taken 4 times.
23 if (idf_fan.iddObject().type() == IddObjectType::Fan_OnOff) {
254 19 return std::pair<unsigned, unsigned>{Fan_OnOffFields::AirInletNodeName, Fan_OnOffFields::AirOutletNodeName};
255
4/5
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4 times.
4 } else if (idf_fan.iddObject().type() == IddObjectType::Fan_ConstantVolume) {
256 ✗ return std::pair<unsigned, unsigned>{Fan_ConstantVolumeFields::AirInletNodeName, Fan_ConstantVolumeFields::AirOutletNodeName};
257
4/5
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
4 } else if (idf_fan.iddObject().type() == IddObjectType::Fan_SystemModel) {
258 4 return std::pair<unsigned, unsigned>{Fan_SystemModelFields::AirInletNodeName, Fan_SystemModelFields::AirOutletNodeName};
259 } else {
260 ✗ LOG(Error, "VRF named " << modelObject.name().get() << " uses an unsupported fan type.");
261 ✗ OS_ASSERT(false);
262 ✗ return std::pair<unsigned, unsigned>{0, 0};
263 }
264 28 };
265
266 28 auto translateFan = [&](ModelObject& fan) {
267 // Only translate fan if it's not on an AirLoopHVACOutdoorAirSystem,n or on a AirLoopHVAC main branch that already has a fan
268
3/3
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 24 times.
56 if (modelObject.airLoopHVACOutdoorAirSystem()) {
269
9/9
✓ 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 16 taken 4 times.
✓ Branch 20 taken 4 times.
✓ Branch 23 taken 4 times.
✓ Branch 26 taken 4 times.
4 LOG(Info, "Will not translate fan for VRF named '" << modelObject.name().get() << "' since it is on an AirLoopHVACOutdoorAirSystem.");
270 4 return;
271 }
272
25/36
✓ Branch 1 taken 24 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 21 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 16 taken 2 times.
✓ Branch 17 taken 1 time.
✓ Branch 19 taken 2 times.
✓ Branch 22 taken 2 times.
✓ Branch 25 taken 2 times.
✓ Branch 28 taken 2 times.
✓ Branch 31 taken 1 time.
✓ Branch 32 taken 1 time.
✓ Branch 33 taken 2 times.
✓ Branch 34 taken 22 times.
✓ Branch 36 taken 2 times.
✓ Branch 37 taken 22 times.
✓ Branch 39 taken 3 times.
✓ Branch 40 taken 21 times.
✓ Branch 42 taken 3 times.
✓ Branch 43 taken 21 times.
✓ Branch 45 taken 24 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 1 time.
✓ Branch 49 taken 23 times.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
53 if (modelObject.airLoopHVAC() && modelObject.airLoopHVAC()->supplyFan() && modelObject.airLoopHVAC()->supplyComponent(modelObject.handle())) {
273
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 20 taken 1 time.
✓ Branch 23 taken 1 time.
✓ Branch 26 taken 1 time.
1 LOG(Info, "Will not translate fan for VRF named '" << modelObject.name().get()
274 << "' since it is on an AirLoopHVAC main branch that already has a supply Fan assigned.");
275 1 return;
276 }
277
278
2/3
✓ Branch 1 taken 23 times.
✓ Branch 3 taken 23 times.
✗ Branch 4 not taken.
46 if (boost::optional<IdfObject> idf_fan_ = translateAndMapModelObject(fan)) {
279
4/4
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
✓ Branch 7 taken 23 times.
✓ Branch 10 taken 23 times.
23 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::SupplyAirFanObjectType, idf_fan_->iddObject().name());
280
4/4
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
✓ Branch 7 taken 23 times.
✓ Branch 10 taken 23 times.
23 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::SupplyAirFanObjectName, idf_fan_->name().get());
281
2/2
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
23 auto [inletIndex, outletIndex] = getFanInletOutletIndexes(idf_fan_.get());
282 23 fanIndex = compsInOrder.size(); // Store index
283
6/6
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
✓ Branch 7 taken 23 times.
✓ Branch 10 taken 23 times.
✓ Branch 13 taken 23 times.
✓ Branch 16 taken 23 times.
23 compsInOrder.emplace_back(Component(idf_fan_.get(), modelObject.name().get() + " Fan Outlet Node", inletIndex, outletIndex));
284 23 }
285 28 };
286
287
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 27 times.
28 if (t_blowThrough) {
288 // For now this is always instantiated...
289
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if (boost::optional<HVACComponent> fan_ = modelObject.supplyAirFan()) {
290
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 translateFan(fan_.get());
291 1 }
292 }
293
294
2/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 28 times.
✗ Branch 4 not taken.
56 if (auto coolingCoil = modelObject.coolingCoil()) {
295
296
3/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 6 taken 28 times.
✗ Branch 7 not taken.
56 if (boost::optional<IdfObject> _coolingCoil = translateAndMapModelObject(coolingCoil.get())) {
297
298
4/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 7 taken 28 times.
✓ Branch 10 taken 28 times.
28 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::CoolingCoilObjectType, _coolingCoil->iddObject().name());
299
4/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 7 taken 28 times.
✓ Branch 10 taken 28 times.
28 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::CoolingCoilObjectName, _coolingCoil->name().get());
300
301
6/6
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 7 taken 28 times.
✓ Branch 10 taken 28 times.
✓ Branch 14 taken 24 times.
✓ Branch 15 taken 4 times.
28 if (_coolingCoil->iddObject().type() == IddObjectType::Coil_Cooling_DX_VariableRefrigerantFlow) {
302
6/6
✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
✓ Branch 7 taken 24 times.
✓ Branch 10 taken 24 times.
✓ Branch 13 taken 24 times.
✓ Branch 16 taken 24 times.
24 compsInOrder.emplace_back(Component(_coolingCoil.get(), modelObject.name().get() + " Cooling Coil Outlet Node",
303 Coil_Cooling_DX_VariableRefrigerantFlowFields::CoilAirInletNode,
304 Coil_Cooling_DX_VariableRefrigerantFlowFields::CoilAirOutletNode));
305
5/6
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 14 taken 4 times.
✗ Branch 15 not taken.
4 } else if (_coolingCoil->iddObject().type() == IddObjectType::Coil_Cooling_DX_VariableRefrigerantFlow_FluidTemperatureControl) {
306
6/6
✓ 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 16 taken 4 times.
4 compsInOrder.emplace_back(Component(_coolingCoil.get(), modelObject.name().get() + " Cooling Coil Outlet Node",
307 Coil_Cooling_DX_VariableRefrigerantFlow_FluidTemperatureControlFields::CoilAirInletNode,
308 Coil_Cooling_DX_VariableRefrigerantFlow_FluidTemperatureControlFields::CoilAirOutletNode));
309 }
310 28 }
311 28 }
312
313
2/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 28 times.
✗ Branch 4 not taken.
56 if (auto heatingCoil = modelObject.heatingCoil()) {
314
3/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 6 taken 28 times.
✗ Branch 7 not taken.
56 if (boost::optional<IdfObject> _heatingCoil = translateAndMapModelObject(heatingCoil.get())) {
315
316
4/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 7 taken 28 times.
✓ Branch 10 taken 28 times.
28 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::HeatingCoilObjectType, _heatingCoil->iddObject().name());
317
4/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 7 taken 28 times.
✓ Branch 10 taken 28 times.
28 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::HeatingCoilObjectName, _heatingCoil->name().get());
318
319
6/6
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 7 taken 28 times.
✓ Branch 10 taken 28 times.
✓ Branch 14 taken 24 times.
✓ Branch 15 taken 4 times.
28 if (_heatingCoil->iddObject().type() == IddObjectType::Coil_Heating_DX_VariableRefrigerantFlow) {
320
6/6
✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
✓ Branch 7 taken 24 times.
✓ Branch 10 taken 24 times.
✓ Branch 13 taken 24 times.
✓ Branch 16 taken 24 times.
24 compsInOrder.emplace_back(Component(_heatingCoil.get(), modelObject.name().get() + " Heating Coil Outlet Node",
321 Coil_Heating_DX_VariableRefrigerantFlowFields::CoilAirInletNode,
322 Coil_Heating_DX_VariableRefrigerantFlowFields::CoilAirOutletNode));
323
5/6
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 14 taken 4 times.
✗ Branch 15 not taken.
4 } else if (_heatingCoil->iddObject().type() == IddObjectType::Coil_Heating_DX_VariableRefrigerantFlow_FluidTemperatureControl) {
324
6/6
✓ 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 16 taken 4 times.
4 compsInOrder.emplace_back(Component(_heatingCoil.get(), modelObject.name().get() + " Heating Coil Outlet Node",
325 Coil_Heating_DX_VariableRefrigerantFlow_FluidTemperatureControlFields::CoilAirInletNode,
326 Coil_Heating_DX_VariableRefrigerantFlow_FluidTemperatureControlFields::CoilAirOutletNode));
327 }
328 28 }
329 28 }
330
331
2/2
✓ Branch 0 taken 27 times.
✓ Branch 1 taken 1 time.
28 if (!t_blowThrough) {
332 // For now this is always instantiated...
333
3/4
✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
✓ Branch 8 taken 27 times.
✗ Branch 9 not taken.
54 if (boost::optional<HVACComponent> fan_ = modelObject.supplyAirFan()) {
334
2/2
✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
27 translateFan(fan_.get());
335 27 }
336 }
337
338
3/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 24 times.
56 if (auto _mo_supplementalHeatingCoil = modelObject.supplementalHeatingCoil()) {
339
340
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<IdfObject> _supplementalHeatingCoil = translateAndMapModelObject(_mo_supplementalHeatingCoil.get())) {
341
342
1/1
✓ Branch 1 taken 4 times.
4 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::SupplementalHeatingCoilObjectType,
343
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
8 _supplementalHeatingCoil->iddObject().name());
344
4/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
4 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::SupplementalHeatingCoilName, _supplementalHeatingCoil->name().get());
345
346 4 auto getCoilInletOutletIndexes = [&modelObject](const IdfObject& idf_coil) {
347
5/5
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 3 times.
4 if (idf_coil.iddObject().type() == IddObjectType::Coil_Heating_Fuel) {
348 1 return std::pair<unsigned, unsigned>{Coil_Heating_FuelFields::AirInletNodeName, Coil_Heating_FuelFields::AirOutletNodeName};
349
5/5
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 2 times.
3 } else if (idf_coil.iddObject().type() == IddObjectType::Coil_Heating_Electric) {
350 1 return std::pair<unsigned, unsigned>{Coil_Heating_ElectricFields::AirInletNodeName, Coil_Heating_ElectricFields::AirOutletNodeName};
351
4/5
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 11 taken 2 times.
✗ Branch 12 not taken.
2 } else if (idf_coil.iddObject().type() == IddObjectType::Coil_Heating_Water) {
352 2 return std::pair<unsigned, unsigned>{Coil_Heating_WaterFields::AirInletNodeName, Coil_Heating_WaterFields::AirOutletNodeName};
353 ✗ } else if (idf_coil.iddObject().type() == IddObjectType::Coil_Heating_Steam) {
354 // Not yet supported in OS
355 ✗ OS_ASSERT(false);
356 } else {
357 ✗ LOG(Error, "Unsupported supplemental heating Coil type for " << modelObject.briefDescription());
358 ✗ OS_ASSERT(false);
359 }
360 ✗ return std::pair<unsigned, unsigned>{0, 0};
361 4 };
362
363
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 auto [inletIndex, outletIndex] = getCoilInletOutletIndexes(_supplementalHeatingCoil.get());
364
365
1/1
✓ Branch 1 taken 4 times.
4 compsInOrder.emplace_back(
366
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.
8 Component(_supplementalHeatingCoil.get(), modelObject.name().get() + " Supplemental Heating Coil Outlet Node", inletIndex, outletIndex));
367 4 }
368 28 }
369
370 // Now we write the nodes in the order we determine
371 // Last Node is the VRT TU outlet Node
372
1/1
✓ Branch 2 taken 28 times.
28 compsInOrder.back().outletNodeName = outletNodeName;
373
374 28 size_t curIndex = 0;
375
2/2
✓ Branch 4 taken 83 times.
✓ Branch 5 taken 28 times.
111 for (auto& comp : compsInOrder) {
376
1/1
✓ Branch 1 taken 83 times.
83 comp.idfObject.setString(comp.inletIndex, inletNodeName);
377
1/1
✓ Branch 1 taken 83 times.
83 comp.idfObject.setString(comp.outletIndex, comp.outletNodeName);
378
379
2/2
✓ Branch 0 taken 23 times.
✓ Branch 1 taken 60 times.
83 if (curIndex == fanIndex) {
380 // Adjust the Fan Inlet/OutletNode to pick up the fan inside this unit.
381
1/1
✓ Branch 1 taken 23 times.
23 fixSPMsForUnitarySystem(modelObject, inletNodeName, comp.outletNodeName);
382 }
383
384
1/1
✓ Branch 1 taken 83 times.
83 inletNodeName = comp.outletNodeName;
385 83 ++curIndex;
386 }
387
388 // ZoneTerminalUnitOnParasiticElectricEnergyUse
389
390
3/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 7 taken 28 times.
✗ Branch 8 not taken.
56 if ((value = modelObject.zoneTerminalUnitOnParasiticElectricEnergyUse())) {
391
2/2
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
28 idfObject.setDouble(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::ZoneTerminalUnitOnParasiticElectricEnergyUse, value.get());
392 }
393
394 // ZoneTerminalUnitOffParasiticElectricEnergyUse
395
396
3/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 7 taken 28 times.
✗ Branch 8 not taken.
56 if ((value = modelObject.zoneTerminalUnitOffParasiticElectricEnergyUse())) {
397
2/2
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
28 idfObject.setDouble(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::ZoneTerminalUnitOffParasiticElectricEnergyUse, value.get());
398 }
399
400 // RatedTotalHeatingCapacitySizingRatio
401
402
3/4
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 7 taken 28 times.
✗ Branch 8 not taken.
56 if ((value = modelObject.ratedTotalHeatingCapacitySizingRatio())) {
403
2/2
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
28 idfObject.setDouble(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::RatedHeatingCapacitySizingRatio, value.get());
404 }
405
406 // \field Availability Manager List Name
407 // \field Design Specification ZoneHVAC Sizing Object Name
408
409 // Maximum Supply Air Temperature from Supplemental Heater (autosized)
410
3/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 27 times.
✓ Branch 4 taken 1 time.
28 if (modelObject.isMaximumSupplyAirTemperaturefromSupplementalHeaterAutosized()) {
411
2/2
✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
54 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::MaximumSupplyAirTemperaturefromSupplementalHeater, "Autosize");
412
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 } else if ((value = modelObject.maximumSupplyAirTemperaturefromSupplementalHeater())) {
413
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::MaximumSupplyAirTemperaturefromSupplementalHeater, value.get());
414 }
415
416 // \field Maximum Outdoor Dry-Bulb Temperature for Supplemental Heater Operation (default 21C)
417
2/2
✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
28 idfObject.setDouble(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::MaximumOutdoorDryBulbTemperatureforSupplementalHeaterOperation,
418 modelObject.maximumOutdoorDryBulbTemperatureforSupplementalHeaterOperation());
419
420 // ControllingZoneorThermostatLocation
421
3/3
✓ Branch 1 taken 28 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 26 times.
56 if (boost::optional<ThermalZone> tz = modelObject.controllingZoneorThermostatLocation()) {
422
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::ControllingZoneorThermostatLocation, tz->name().get());
423
3/3
✓ Branch 1 taken 26 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 21 times.
52 } else if (auto airLoop = modelObject.airLoopHVAC()) {
424
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 auto zones = airLoop->thermalZones();
425
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 if (zones.size() == 1u) {
426
2/3
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
10 if (auto zone = translateAndMapModelObject(zones.front())) {
427
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
5 idfObject.setString(ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::ControllingZoneorThermostatLocation, zone->name().get());
428 5 }
429 }
430 59 }
431
432
1/1
✓ Branch 1 taken 28 times.
56 return idfObject;
433 28 }
434
435 } // namespace energyplus
436
437 } // namespace openstudio
438