GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 90.9% 130 / 0 / 143
Functions: 100.0% 1 / 0 / 1
Branches: 64.9% 222 / 0 / 342

src/energyplus/ForwardTranslator/ForwardTranslateAirTerminalSingleDuctConstantVolumeFourPipeBeam.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
8 #include "../../model/Model.hpp"
9 #include "../../model/AirTerminalSingleDuctConstantVolumeFourPipeBeam.hpp"
10 #include "../../model/AirTerminalSingleDuctConstantVolumeFourPipeBeam_Impl.hpp"
11 #include "../../model/CoilCoolingFourPipeBeam.hpp"
12 #include "../../model/CoilCoolingFourPipeBeam_Impl.hpp"
13 #include "../../model/CoilHeatingFourPipeBeam.hpp"
14 #include "../../model/CoilHeatingFourPipeBeam_Impl.hpp"
15
16 #include "../../model/HVACComponent.hpp"
17 #include "../../model/HVACComponent_Impl.hpp"
18 #include "../../model/StraightComponent.hpp"
19 #include "../../model/StraightComponent_Impl.hpp"
20 #include "../../model/AirLoopHVACZoneSplitter.hpp"
21 #include "../../model/AirLoopHVACZoneSplitter_Impl.hpp"
22 #include "../../model/AirLoopHVACZoneMixer.hpp"
23 #include "../../model/AirLoopHVACZoneMixer_Impl.hpp"
24 #include "../../model/Schedule.hpp"
25 #include "../../model/Schedule_Impl.hpp"
26 #include "../../model/Node.hpp"
27 #include "../../model/Node_Impl.hpp"
28 #include "../../model/PlantLoop.hpp"
29 #include "../../model/Curve.hpp"
30
31 #include <utilities/idd/AirTerminal_SingleDuct_ConstantVolume_FourPipeBeam_FieldEnums.hxx>
32 #include <utilities/idd/ZoneHVAC_AirDistributionUnit_FieldEnums.hxx>
33
34 #include "../../utilities/idd/IddEnums.hpp"
35 #include <utilities/idd/IddEnums.hxx>
36 #include <utilities/idd/IddFactory.hxx>
37
38 using namespace openstudio::model;
39
40 namespace openstudio {
41
42 namespace energyplus {
43
44 boost::optional<IdfObject>
45 3 ForwardTranslator::translateAirTerminalSingleDuctConstantVolumeFourPipeBeam(AirTerminalSingleDuctConstantVolumeFourPipeBeam& modelObject) {
46
47 // Sanity check: this object must be connected to an AirLoopHVAC, and it must have at least one cooling coil or one heating coil that is connected
48 // to a PlantLoop
49
4/7
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
9 if (!(modelObject.airLoopHVAC().is_initialized()
50
9/16
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 1 time.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✓ Branch 13 taken 1 time.
✓ Branch 15 taken 3 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 3 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
6 && (modelObject.chilledWaterPlantLoop().is_initialized() || modelObject.hotWaterPlantLoop().is_initialized()))) {
51
7/7
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 14 taken 2 times.
✓ Branch 17 taken 2 times.
✓ Branch 20 taken 2 times.
2 LOG(Warn, modelObject.briefDescription() << " is not connected to at least one AirLoopHVAC AND one PlantLoop, it will NOT be translated");
52 2 return boost::none;
53 }
54
55 // Name
56
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject idfObject(openstudio::IddObjectType::AirTerminal_SingleDuct_ConstantVolume_FourPipeBeam);
57
1/1
✓ Branch 1 taken 1 time.
1 m_idfObjects.push_back(idfObject);
58
59 // A1 , \field Name
60
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 std::string baseName = modelObject.name().get();
61
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setName(baseName);
62
63 //register the air distribution unit in the map rather than the chilled beam air terminal itself.
64 //this is necessary because the air distribution unit encapsulating the chilled beam air terminal
65 //goes on both the brachlist and the zone HVAC equipment list
66 //since the branches are translated first, when the chilled beam's coil is encountered in the branchlist, the air distribution unit
67 //that encapsulates the chilled beam is returned and put onto the branch list.
68 //When the chilled beam air terminal is encountered again on the zone HVAC equipment list,
69 //the map must return the air distribution unit to ensure that the air distribution unit is on the translated
70 //equipment list.
71
72
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject _airDistributionUnit(IddObjectType::ZoneHVAC_AirDistributionUnit);
73
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 _airDistributionUnit.setName("ADU " + baseName); //ADU: Air Distribution Unit
74
1/1
✓ Branch 1 taken 1 time.
1 m_idfObjects.push_back(_airDistributionUnit);
75
76 1 boost::optional<std::string> s;
77 1 boost::optional<double> optD;
78 1 boost::optional<ModelObject> temp;
79
80 // A2 , \field Primary Air Availability Schedule Name
81 {
82
1/1
✓ Branch 1 taken 1 time.
1 Schedule schedule = modelObject.primaryAirAvailabilitySchedule();
83
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule)) {
84
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::PrimaryAirAvailabilityScheduleName, _schedule->name().get());
85 1 }
86 1 }
87
88 // A3 , \field Cooling Availability Schedule Name
89 {
90
1/1
✓ Branch 1 taken 1 time.
1 Schedule schedule = modelObject.coolingAvailabilitySchedule();
91
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule)) {
92
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::CoolingAvailabilityScheduleName, _schedule->name().get());
93 1 }
94 1 }
95
96 // A4 , \field Heating Availability Schedule Name
97 {
98
1/1
✓ Branch 1 taken 1 time.
1 Schedule schedule = modelObject.heatingAvailabilitySchedule();
99
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule)) {
100
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::HeatingAvailabilityScheduleName, _schedule->name().get());
101 1 }
102 1 }
103
104 // A5 , \field Primary Air Inlet Node Name
105
1/1
✓ Branch 1 taken 1 time.
1 temp = modelObject.inletModelObject();
106
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (temp) {
107
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if ((s = temp->name())) {
108
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::PrimaryAirInletNodeName, s.get());
109 }
110 }
111
112 // A6 , \field Primary Air Outlet Node Name
113
1/1
✓ Branch 1 taken 1 time.
1 temp = modelObject.outletModelObject();
114
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (temp) {
115
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if ((s = temp->name())) {
116
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::PrimaryAirOutletNodeName, s.get());
117 }
118 }
119
120 /* Double autosizable fields */
121
122 // N1 , \field Design Primary Air Volume Flow Rate
123
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
1 if (modelObject.isDesignPrimaryAirVolumeFlowRateAutosized()) {
124
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::DesignPrimaryAirVolumeFlowRate, "Autosize");
125 ✗ } else if ((optD = modelObject.designPrimaryAirVolumeFlowRate())) {
126 ✗ idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::DesignPrimaryAirVolumeFlowRate, optD.get());
127 }
128
129 // N2 , \field Design Chilled Water Volume Flow Rate
130
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
1 if (modelObject.isDesignChilledWaterVolumeFlowRateAutosized()) {
131
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::DesignChilledWaterVolumeFlowRate, "Autosize");
132 ✗ } else if ((optD = modelObject.designChilledWaterVolumeFlowRate())) {
133 ✗ idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::DesignChilledWaterVolumeFlowRate, optD.get());
134 }
135
136 // N3 , \field Design Hot Water Volume Flow Rate
137
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
1 if (modelObject.isDesignHotWaterVolumeFlowRateAutosized()) {
138 ✗ idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::DesignHotWaterVolumeFlowRate, "Autosize");
139
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 } else if ((optD = modelObject.designHotWaterVolumeFlowRate())) {
140
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::DesignHotWaterVolumeFlowRate, optD.get());
141 }
142
143 // N4 , \field Zone Total Beam Length
144
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
1 if (modelObject.isZoneTotalBeamLengthAutosized()) {
145
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::ZoneTotalBeamLength, "Autosize");
146 ✗ } else if ((optD = modelObject.zoneTotalBeamLength())) {
147 ✗ idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::ZoneTotalBeamLength, optD.get());
148 }
149
150 /* Double, with defaults */
151
152 // N5 , \field Rated Primary Air Flow Rate per Beam Length
153 {
154
1/1
✓ Branch 1 taken 1 time.
1 double value = modelObject.ratedPrimaryAirFlowRateperBeamLength();
155
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::RatedPrimaryAirFlowRateperBeamLength, value);
156 }
157
158 // Cooling Side: everything is carried on the subclass CoilCoolingFourPipeBeam
159
160
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<HVACComponent> _comp = modelObject.coolingCoil()) {
161
162
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<CoilCoolingFourPipeBeam> _cc = _comp->optionalCast<CoilCoolingFourPipeBeam>();
163
164
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
1 if (!_cc.is_initialized()) {
165 ✗ LOG(Error, "Cooling coil is not a CoilCoolingFourPipeBeam for " << modelObject.briefDescription() << ". Coil will not be translated");
166 } else {
167
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 CoilCoolingFourPipeBeam cc = _cc.get();
168
169 // It it isn't connected to a plantLoop, it's useless...
170 // If it is connected to a plantloop, all three curves are required fields
171
172 /* Curves: all three are required if the FourPipeBeam is connected to a chilled water plant loop, which is the case if we have reached this
173 * point, so I will log and not translate is they aren't defined
174 * Note that since I assign curves in the Ctor and there isn't a reset function for the curves, we shouldn't really have a reason to have a
175 * problem unless something went wrong at some point (or someone used setString("") on the field or something) */
176
177 // A11, \field Beam Cooling Capacity Temperature Difference Modification Factor Curve Name
178
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<Curve> capModFuncOfTempDiff = cc.beamCoolingCapacityTemperatureDifferenceModificationFactorCurve();
179
180 // A12, \field Beam Cooling Capacity Air Flow Modification Factor Curve Name
181
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<Curve> capModFuncOfSAFlow = cc.beamCoolingCapacityAirFlowModificationFactorCurve();
182
183 // A13, \field Beam Cooling Capacity Chilled Water Flow Modification Factor Curve Name
184
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<Curve> capModFuncOfWaterFlow = cc.beamCoolingCapacityChilledWaterFlowModificationFactorCurve();
185 // Check that it is connected to a plantLoop
186
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 time.
1 if (!_cc->plantLoop().is_initialized()) {
187 ✗ LOG(Warn, "The Cooling side of " << modelObject.briefDescription() << " isn't connected to a plantLoop, it will not be translated");
188
189 // It MUST have the three curves defined in this case
190
4/8
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 time.
1 } else if (!capModFuncOfTempDiff.is_initialized() || !capModFuncOfSAFlow.is_initialized() || !capModFuncOfWaterFlow.is_initialized()) {
191 ✗ LOG(Warn, "If you connect the cooling side of " << modelObject.briefDescription()
192 << " to a plantLoop, you MUST supply all three curves in the subobject "
193 << cc.briefDescription());
194
195 } else {
196 // A7 , \field Chilled Water Inlet Node Name
197
1/1
✓ Branch 1 taken 1 time.
1 temp = cc.inletModelObject();
198
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (temp) {
199
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if ((s = temp->name())) {
200
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::ChilledWaterInletNodeName, s.get());
201 }
202 }
203 // A8 , \field Chilled Water Outlet Node Name
204
1/1
✓ Branch 1 taken 1 time.
1 temp = cc.outletModelObject();
205
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (temp) {
206
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if ((s = temp->name())) {
207
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::ChilledWaterOutletNodeName, s.get());
208 }
209 }
210
211 /* Double with defaults (not optionals) */
212
213 // N6 , \field Beam Rated Cooling Capacity per Beam Length
214 {
215
1/1
✓ Branch 1 taken 1 time.
1 double value = cc.beamRatedCoolingCapacityperBeamLength();
216
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::BeamRatedCoolingCapacityperBeamLength, value);
217 }
218
219 // N7 , \field Beam Rated Cooling Room Air Chilled Water Temperature Difference
220 {
221
1/1
✓ Branch 1 taken 1 time.
1 double value = cc.beamRatedCoolingRoomAirChilledWaterTemperatureDifference();
222
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::BeamRatedCoolingRoomAirChilledWaterTemperatureDifference,
223 value);
224 }
225
226 // N8 , \field Beam Rated Chilled Water Volume Flow Rate per Beam Length
227 {
228
1/1
✓ Branch 1 taken 1 time.
1 double value = cc.beamRatedChilledWaterVolumeFlowRateperBeamLength();
229
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::BeamRatedChilledWaterVolumeFlowRateperBeamLength, value);
230 }
231
232 /* Curves: At this point, I have alreaady checked above that all three curves are defined */
233
234 // A11, \field Beam Cooling Capacity Temperature Difference Modification Factor Curve Name
235
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto _curve = translateAndMapModelObject(capModFuncOfTempDiff.get())) {
236 1 idfObject.setString(
237 AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::BeamCoolingCapacityTemperatureDifferenceModificationFactorCurveName,
238
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 _curve->name().get());
239 1 }
240
241 // A12, \field Beam Cooling Capacity Air Flow Modification Factor Curve Name
242
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto _curve = translateAndMapModelObject(capModFuncOfSAFlow.get())) {
243 1 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::BeamCoolingCapacityAirFlowModificationFactorCurveName,
244
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 _curve->name().get());
245 1 }
246
247 // A13, \field Beam Cooling Capacity Chilled Water Flow Modification Factor Curve Name
248
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto _curve = translateAndMapModelObject(capModFuncOfWaterFlow.get())) {
249 1 idfObject.setString(
250 AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::BeamCoolingCapacityChilledWaterFlowModificationFactorCurveName,
251
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 _curve->name().get());
252 1 }
253 }
254 1 }
255 2 }
256
257 /**
258 * HEATING SIDE: everything is carried on the subclass CoilHeatingFourPipeBeam
259 */
260
261
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<HVACComponent> _comp = modelObject.heatingCoil()) {
262
263
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<CoilHeatingFourPipeBeam> _hc = _comp->optionalCast<CoilHeatingFourPipeBeam>();
264
265
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
1 if (!_hc.is_initialized()) {
266 ✗ LOG(Error, "Heating coil is not a CoilHeatingFourPipeBeam for " << modelObject.briefDescription() << ". Coil will not be translated");
267 } else {
268
269
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 CoilHeatingFourPipeBeam hc = _hc.get();
270
271 // It it isn't connected to a plantLoop, it's useless...
272 // If it is connected to a plantloop, all three curves are required fields
273
274 /* Curves: all three are required if the FourPipeBeam is connected to a hot water plant loop, which is the case if we have reached this
275 * point, so I will log and not translate is they aren't defined */
276
277 // A11, \field Beam Heating Capacity Temperature Difference Modification Factor Curve Name
278
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<Curve> capModFuncOfTempDiff = hc.beamHeatingCapacityTemperatureDifferenceModificationFactorCurve();
279
280 // A12, \field Beam Heating Capacity Air Flow Modification Factor Curve Name
281
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<Curve> capModFuncOfSAFlow = hc.beamHeatingCapacityAirFlowModificationFactorCurve();
282
283 // A13, \field Beam Heating Capacity Hot Water Flow Modification Factor Curve Name
284
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<Curve> capModFuncOfWaterFlow = hc.beamHeatingCapacityHotWaterFlowModificationFactorCurve();
285 // Check that it is connected to a plantLoop
286
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 time.
1 if (!_hc->plantLoop().is_initialized()) {
287 ✗ LOG(Warn, "The Heating side of " << modelObject.briefDescription() << " isn't connected to a plantLoop, it will not be translated");
288
289 // It MUST have the three curves defined in this case
290
4/8
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 time.
1 } else if (!capModFuncOfTempDiff.is_initialized() || !capModFuncOfSAFlow.is_initialized() || !capModFuncOfWaterFlow.is_initialized()) {
291 ✗ LOG(Warn, "If you connect the heating side of " << modelObject.briefDescription()
292 << " to a plantLoop, you MUST supply all three curves in the subobject "
293 << hc.briefDescription());
294
295 } else {
296 // A9 , \field Hot Water Inlet Node Name
297
1/1
✓ Branch 1 taken 1 time.
1 temp = hc.inletModelObject();
298
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (temp) {
299
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if ((s = temp->name())) {
300
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::HotWaterInletNodeName, s.get());
301 }
302 }
303 // A10 , \field Hot Water Outlet Node Name
304
1/1
✓ Branch 1 taken 1 time.
1 temp = hc.outletModelObject();
305
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (temp) {
306
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if ((s = temp->name())) {
307
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::HotWaterOutletNodeName, s.get());
308 }
309 }
310
311 /* Double with defaults (not optionals) */
312
313 // N9 , \field Beam Rated Heating Capacity per Beam Length
314 {
315
1/1
✓ Branch 1 taken 1 time.
1 double value = hc.beamRatedHeatingCapacityperBeamLength();
316
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::BeamRatedHeatingCapacityperBeamLength, value);
317 }
318
319 // N10, \field Beam Rated Heating Room Air Hot Water Temperature Difference
320 {
321
1/1
✓ Branch 1 taken 1 time.
1 double value = hc.beamRatedHeatingRoomAirHotWaterTemperatureDifference();
322
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::BeamRatedHeatingRoomAirHotWaterTemperatureDifference,
323 value);
324 }
325
326 // N11, \field Beam Rated Hot Water Volume Flow Rate per Beam Length
327 {
328
1/1
✓ Branch 1 taken 1 time.
1 double value = hc.beamRatedHotWaterVolumeFlowRateperBeamLength();
329
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::BeamRatedHotWaterVolumeFlowRateperBeamLength, value);
330 }
331
332 /* Curves: At this point, I have already checked above that all three curves are defined */
333
334 // A14, \field Beam Heating Capacity Temperature Difference Modification Factor Curve Name
335
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto _curve = translateAndMapModelObject(capModFuncOfTempDiff.get())) {
336 1 idfObject.setString(
337 AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::BeamHeatingCapacityTemperatureDifferenceModificationFactorCurveName,
338
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 _curve->name().get());
339 1 }
340
341 // A15, \field Beam Heating Capacity Air Flow Modification Factor Curve Name
342
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto _curve = translateAndMapModelObject(capModFuncOfSAFlow.get())) {
343 1 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::BeamHeatingCapacityAirFlowModificationFactorCurveName,
344
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 _curve->name().get());
345 1 }
346
347 // A16, \field Beam Heating Capacity Hot Water Flow Modification Factor Curve Name
348
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto _curve = translateAndMapModelObject(capModFuncOfWaterFlow.get())) {
349 1 idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::BeamHeatingCapacityHotWaterFlowModificationFactorCurveName,
350
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 _curve->name().get());
351 1 }
352 }
353 1 }
354 2 }
355
356 // Populate fields for AirDistributionUnit
357
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<ModelObject> outletNode = modelObject.outletModelObject()) {
358
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirDistributionUnitOutletNodeName, outletNode->name().get());
359 1 }
360
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirTerminalObjectType, idfObject.iddObject().name());
361
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirTerminalName, idfObject.name().get());
362
363
1/1
✓ Branch 1 taken 1 time.
1 return _airDistributionUnit;
364 1 }
365
366 } // namespace energyplus
367
368 } // namespace openstudio
369