GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 99.0% 100 / 0 / 101
Functions: 100.0% 2 / 0 / 2
Branches: 87.0% 167 / 0 / 192

src/energyplus/ForwardTranslator/ForwardTranslateCoilHeatingDXSingleSpeed.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/CoilHeatingDXSingleSpeed.hpp"
11 #include "../../model/CoilHeatingDXSingleSpeed_Impl.hpp"
12 #include "../../model/Node.hpp"
13 #include "../../model/Node_Impl.hpp"
14 #include "../../model/CurveBiquadratic.hpp"
15 #include "../../model/CurveBiquadratic_Impl.hpp"
16 #include "../../model/CurveQuadratic.hpp"
17 #include "../../model/CurveQuadratic_Impl.hpp"
18 #include <utilities/idd/Coil_Heating_DX_SingleSpeed_FieldEnums.hxx>
19 #include <utilities/idd/CoilSystem_Heating_DX_FieldEnums.hxx>
20 #include "../../utilities/idd/IddEnums.hpp"
21 #include <utilities/idd/IddEnums.hxx>
22 #include <utilities/idd/IddFactory.hxx>
23
24 #include "../../utilities/core/Assert.hpp"
25
26 using namespace openstudio::model;
27
28 namespace openstudio {
29
30 namespace energyplus {
31
32 22 boost::optional<IdfObject> ForwardTranslator::translateCoilHeatingDXSingleSpeedWithoutUnitary(CoilHeatingDXSingleSpeed& modelObject) {
33 22 boost::optional<std::string> s;
34 22 boost::optional<double> value;
35
36
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 IdfObject idfObject(IddObjectType::Coil_Heating_DX_SingleSpeed);
37
38
1/1
✓ Branch 1 taken 22 times.
22 m_idfObjects.push_back(idfObject);
39
40 // Name
41
42
1/1
✓ Branch 1 taken 22 times.
22 s = modelObject.name();
43
1/2
✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
22 if (s) {
44
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 idfObject.setName(*s);
45 }
46
47 // AvailabilityScheduleName
48
49
3/4
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 8 taken 22 times.
✗ Branch 9 not taken.
44 if (boost::optional<Schedule> schedule = modelObject.availabilitySchedule()) {
50
3/4
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 6 taken 22 times.
✗ Branch 7 not taken.
44 if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule.get())) {
51
4/4
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
✓ Branch 10 taken 22 times.
22 idfObject.setString(Coil_Heating_DX_SingleSpeedFields::AvailabilityScheduleName, _schedule->name().get());
52 22 }
53 22 }
54
55 // AirInletNodeName
56
57 22 boost::optional<std::string> airInletNodeName;
58
59
3/3
✓ Branch 1 taken 22 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 21 times.
44 if (boost::optional<ModelObject> mo = modelObject.inletModelObject()) {
60
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (boost::optional<Node> node = mo->optionalCast<Node>()) {
61
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if ((s = node->name())) {
62
1/1
✓ Branch 1 taken 1 time.
1 airInletNodeName = s;
63
64
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(Coil_Heating_DX_SingleSpeedFields::AirInletNodeName, s.get());
65 }
66 1 }
67 22 }
68
69 // AirOutletNodeName
70
71 22 boost::optional<std::string> airOutletNodeName;
72
73
3/3
✓ Branch 1 taken 22 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 21 times.
44 if (boost::optional<ModelObject> mo = modelObject.outletModelObject()) {
74
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (boost::optional<Node> node = mo->optionalCast<Node>()) {
75
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if ((s = node->name())) {
76
1/1
✓ Branch 1 taken 1 time.
1 airOutletNodeName = s;
77
78
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(Coil_Heating_DX_SingleSpeedFields::AirOutletNodeName, s.get());
79 }
80 1 }
81 22 }
82
83 // RatedTotalHeatingCapacity
84
85
3/3
✓ Branch 1 taken 22 times.
✓ Branch 3 taken 21 times.
✓ Branch 4 taken 1 time.
22 if (modelObject.isRatedTotalHeatingCapacityAutosized()) {
86
2/2
✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
42 idfObject.setString(Coil_Heating_DX_SingleSpeedFields::GrossRatedHeatingCapacity, "Autosize");
87
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 } else if ((value = modelObject.ratedTotalHeatingCapacity())) {
88
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Coil_Heating_DX_SingleSpeedFields::GrossRatedHeatingCapacity, value.get());
89 }
90
91 // RatedCOP
92
93
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 idfObject.setDouble(Coil_Heating_DX_SingleSpeedFields::GrossRatedHeatingCOP, modelObject.ratedCOP());
94
95 // RatedAirFlowRate
96
97
3/3
✓ Branch 1 taken 22 times.
✓ Branch 3 taken 21 times.
✓ Branch 4 taken 1 time.
22 if (modelObject.isRatedAirFlowRateAutosized()) {
98
2/2
✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
42 idfObject.setString(Coil_Heating_DX_SingleSpeedFields::RatedAirFlowRate, "Autosize");
99
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 } else if ((value = modelObject.ratedAirFlowRate())) {
100
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Coil_Heating_DX_SingleSpeedFields::RatedAirFlowRate, value.get());
101 }
102
103 // Rated Supply Fan Power Per Volume Flow Rate 2017
104
105
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 idfObject.setDouble(Coil_Heating_DX_SingleSpeedFields::RatedSupplyFanPowerPerVolumeFlowRate2017,
106 modelObject.ratedSupplyFanPowerPerVolumeFlowRate2017());
107
108 // Rated Supply Fan Power Per Volume Flow Rate 2023
109
110
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 idfObject.setDouble(Coil_Heating_DX_SingleSpeedFields::RatedSupplyFanPowerPerVolumeFlowRate2023,
111 modelObject.ratedSupplyFanPowerPerVolumeFlowRate2023());
112
113 // TotalHeatingCapacityFunctionofTemperatureCurveName
114
115
1/1
✓ Branch 1 taken 22 times.
22 ModelObject curve = modelObject.totalHeatingCapacityFunctionofTemperatureCurve();
116
117
2/3
✓ Branch 1 taken 22 times.
✓ Branch 3 taken 22 times.
✗ Branch 4 not taken.
44 if (boost::optional<IdfObject> _curve = translateAndMapModelObject(curve)) {
118
4/4
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
✓ Branch 10 taken 22 times.
22 idfObject.setString(Coil_Heating_DX_SingleSpeedFields::HeatingCapacityFunctionofTemperatureCurveName, _curve->name().get());
119 22 }
120
121 // TotalHeatingCapacityFunctionofFlowFractionCurveName
122
123
1/1
✓ Branch 1 taken 22 times.
22 curve = modelObject.totalHeatingCapacityFunctionofFlowFractionCurve();
124
125
2/3
✓ Branch 1 taken 22 times.
✓ Branch 3 taken 22 times.
✗ Branch 4 not taken.
44 if (boost::optional<IdfObject> _curve = translateAndMapModelObject(curve)) {
126
4/4
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
✓ Branch 10 taken 22 times.
22 idfObject.setString(Coil_Heating_DX_SingleSpeedFields::HeatingCapacityFunctionofFlowFractionCurveName, _curve->name().get());
127 22 }
128
129 // EnergyInputRatioFunctionofTemperatureCurveName
130
131
1/1
✓ Branch 1 taken 22 times.
22 curve = modelObject.energyInputRatioFunctionofTemperatureCurve();
132
133
2/3
✓ Branch 1 taken 22 times.
✓ Branch 3 taken 22 times.
✗ Branch 4 not taken.
44 if (boost::optional<IdfObject> _curve = translateAndMapModelObject(curve)) {
134
4/4
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
✓ Branch 10 taken 22 times.
22 idfObject.setString(Coil_Heating_DX_SingleSpeedFields::EnergyInputRatioFunctionofTemperatureCurveName, _curve->name().get());
135 22 }
136
137 // EnergyInputRatioFunctionofFlowFractionCurveName
138
139
1/1
✓ Branch 1 taken 22 times.
22 curve = modelObject.energyInputRatioFunctionofFlowFractionCurve();
140
141
2/3
✓ Branch 1 taken 22 times.
✓ Branch 3 taken 22 times.
✗ Branch 4 not taken.
44 if (boost::optional<IdfObject> _curve = translateAndMapModelObject(curve)) {
142
4/4
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
✓ Branch 10 taken 22 times.
22 idfObject.setString(Coil_Heating_DX_SingleSpeedFields::EnergyInputRatioFunctionofFlowFractionCurveName, _curve->name().get());
143 22 }
144
145 // PartLoadFractionCorrelationCurveName
146
147
1/1
✓ Branch 1 taken 22 times.
22 curve = modelObject.partLoadFractionCorrelationCurve();
148
149
2/3
✓ Branch 1 taken 22 times.
✓ Branch 3 taken 22 times.
✗ Branch 4 not taken.
44 if (boost::optional<IdfObject> _curve = translateAndMapModelObject(curve)) {
150
4/4
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
✓ Branch 10 taken 22 times.
22 idfObject.setString(Coil_Heating_DX_SingleSpeedFields::PartLoadFractionCorrelationCurveName, _curve->name().get());
151 22 }
152
153 // DefrostEnergyInputRatioFunctionofTemperatureCurveName
154
155
3/3
✓ Branch 1 taken 22 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 21 times.
44 if (boost::optional<Curve> curve = modelObject.defrostEnergyInputRatioFunctionofTemperatureCurve()) {
156
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (boost::optional<IdfObject> _curve = translateAndMapModelObject(curve.get())) {
157
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(Coil_Heating_DX_SingleSpeedFields::DefrostEnergyInputRatioFunctionofTemperatureCurveName, _curve->name().get());
158 1 }
159 22 }
160
161 // MinimumOutdoorDryBulbTemperatureforCompressorOperation
162
163
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 idfObject.setDouble(Coil_Heating_DX_SingleSpeedFields::MinimumOutdoorDryBulbTemperatureforCompressorOperation,
164 modelObject.minimumOutdoorDryBulbTemperatureforCompressorOperation());
165
166 // MaximumOutdoorDryBulbTemperatureforDefrostOperation
167
168
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 idfObject.setDouble(Coil_Heating_DX_SingleSpeedFields::MaximumOutdoorDryBulbTemperatureforDefrostOperation,
169 modelObject.maximumOutdoorDryBulbTemperatureforDefrostOperation());
170
171 // CrankcaseHeaterCapacity
172
173
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 idfObject.setDouble(Coil_Heating_DX_SingleSpeedFields::CrankcaseHeaterCapacity, modelObject.crankcaseHeaterCapacity());
174
175 // CrankcaseHeaterCapacityFunctionofTemperatureCurveName
176
3/3
✓ Branch 1 taken 22 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 21 times.
44 if (auto crankCurve_ = modelObject.crankcaseHeaterCapacityFunctionofTemperatureCurve()) {
177
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(*crankCurve_)) {
178
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(Coil_Heating_DX_SingleSpeedFields::CrankcaseHeaterCapacityFunctionofTemperatureCurveName, curve_->nameString());
179 1 }
180 22 }
181
182 // MaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation
183
184
3/4
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
✗ Branch 8 not taken.
44 if ((value = modelObject.maximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation())) {
185
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 idfObject.setDouble(Coil_Heating_DX_SingleSpeedFields::MaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation, value.get());
186 }
187
188 // DefrostStrategy
189
190
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 idfObject.setString(Coil_Heating_DX_SingleSpeedFields::DefrostStrategy, modelObject.defrostStrategy());
191
192 // DefrostControl
193
194
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 idfObject.setString(Coil_Heating_DX_SingleSpeedFields::DefrostControl, modelObject.defrostControl());
195
196 // DefrostTimePeriodFraction
197
198
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 idfObject.setDouble(Coil_Heating_DX_SingleSpeedFields::DefrostTimePeriodFraction, modelObject.defrostTimePeriodFraction());
199
200 // ResistiveDefrostHeaterCapacity
201
202
2/3
✓ Branch 1 taken 22 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 22 times.
22 if (modelObject.isResistiveDefrostHeaterCapacityAutosized()) {
203 ✗ idfObject.setString(Coil_Heating_DX_SingleSpeedFields::ResistiveDefrostHeaterCapacity, "Autosize");
204
2/3
✓ Branch 1 taken 22 times.
✓ Branch 3 taken 22 times.
✗ Branch 4 not taken.
44 } else if ((value = modelObject.resistiveDefrostHeaterCapacity())) {
205
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 idfObject.setDouble(Coil_Heating_DX_SingleSpeedFields::ResistiveDefrostHeaterCapacity, value.get());
206 }
207
208
1/1
✓ Branch 1 taken 22 times.
44 return idfObject;
209 22 }
210
211 1 boost::optional<IdfObject> ForwardTranslator::translateCoilHeatingDXSingleSpeed(CoilHeatingDXSingleSpeed& modelObject) {
212
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject _coilSystemHeatingDX(IddObjectType::CoilSystem_Heating_DX);
213
214
1/1
✓ Branch 1 taken 1 time.
1 m_idfObjects.push_back(_coilSystemHeatingDX);
215
216
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<IdfObject> _coilHeatingDXSingleSpeed = translateCoilHeatingDXSingleSpeedWithoutUnitary(modelObject);
217
218
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(_coilHeatingDXSingleSpeed);
219
220 1 OptionalString s;
221
222
1/1
✓ Branch 1 taken 1 time.
1 s = modelObject.name();
223
224 // Type and Name
225
226
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (s) {
227
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 _coilSystemHeatingDX.setString(CoilSystem_Heating_DXFields::HeatingCoilObjectType, _coilHeatingDXSingleSpeed->iddObject().name());
228
229
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 _coilSystemHeatingDX.setString(CoilSystem_Heating_DXFields::HeatingCoilName, *s);
230
231
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 _coilSystemHeatingDX.setName(*s + " CoilSystem");
232 }
233
234 // Availability Schedule
235
236
1/1
✓ Branch 1 taken 1 time.
1 Schedule schedule = modelObject.availabilitySchedule();
237
238
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule);
239
240
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (_schedule) {
241
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 _coilSystemHeatingDX.setString(CoilSystem_Heating_DXFields::AvailabilityScheduleName, _schedule->name().get());
242 }
243
244
1/1
✓ Branch 1 taken 1 time.
2 return _coilSystemHeatingDX;
245 1 }
246
247 } // namespace energyplus
248
249 } // namespace openstudio
250