GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 97.2% 103 / 0 / 106
Functions: 100.0% 1 / 0 / 1
Branches: 86.3% 176 / 0 / 204

src/energyplus/ForwardTranslator/ForwardTranslateCoilCoolingDXMultiSpeed.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/CoilCoolingDXMultiSpeed.hpp"
9 #include "../../model/CoilCoolingDXMultiSpeedStageData.hpp"
10 #include "../../model/Node.hpp"
11 #include "../../model/Schedule.hpp"
12 #include "../../model/Curve.hpp"
13 #include <utilities/idd/Coil_Cooling_DX_MultiSpeed_FieldEnums.hxx>
14 #include "../../utilities/idd/IddEnums.hpp"
15 #include <utilities/idd/IddEnums.hxx>
16 #include <utilities/idd/IddFactory.hxx>
17 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
18
19 using namespace openstudio::model;
20
21 namespace openstudio {
22
23 namespace energyplus {
24
25 14 boost::optional<IdfObject> ForwardTranslator::translateCoilCoolingDXMultiSpeed(CoilCoolingDXMultiSpeed& modelObject) {
26 14 boost::optional<std::string> s;
27 14 boost::optional<double> value;
28
29 // Name
30
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Coil_Cooling_DX_MultiSpeed, modelObject);
31
32 // AvailabilityScheduleName
33
3/3
✓ Branch 1 taken 14 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 13 times.
28 if (auto schedule = modelObject.availabilitySchedule()) {
34
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto _schedule = translateAndMapModelObject(schedule.get())) {
35
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_Cooling_DX_MultiSpeedFields::AvailabilityScheduleName, _schedule->name().get());
36 1 }
37 14 }
38
39 // AirInletNodeName
40
2/3
✓ Branch 1 taken 14 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
28 if (auto node = modelObject.inletModelObject()) {
41 ✗ idfObject.setString(Coil_Cooling_DX_MultiSpeedFields::AirInletNodeName, node->name().get());
42 14 }
43
44 // AirOutletNodeName
45
2/3
✓ Branch 1 taken 14 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
28 if (auto node = modelObject.outletModelObject()) {
46 ✗ idfObject.setString(Coil_Cooling_DX_MultiSpeedFields::AirOutletNodeName, node->name().get());
47 14 }
48
49 // CondenserAirInletNodeName: stays blank so we get condition from weather file
50
51 // CondenserType
52
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 idfObject.setString(Coil_Cooling_DX_MultiSpeedFields::CondenserType, modelObject.condenserType());
53
54 // SupplyWaterStorageTankName
55
56 // CondensateCollectionWaterStorageTankName
57
58 // ApplyPartLoadFractiontoSpeedsGreaterthan1
59
60
2/3
✓ Branch 1 taken 14 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
14 if (modelObject.applyPartLoadFractiontoSpeedsGreaterthan1()) {
61 ✗ idfObject.setString(Coil_Cooling_DX_MultiSpeedFields::ApplyPartLoadFractiontoSpeedsGreaterthan1, "Yes");
62 } else {
63
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
28 idfObject.setString(Coil_Cooling_DX_MultiSpeedFields::ApplyPartLoadFractiontoSpeedsGreaterthan1, "No");
64 }
65
66 // ApplyLatentDegradationtoSpeedsGreaterthan1
67
3/3
✓ Branch 1 taken 14 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 13 times.
14 if (modelObject.applyLatentDegradationtoSpeedsGreaterthan1()) {
68
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 idfObject.setString(Coil_Cooling_DX_MultiSpeedFields::ApplyLatentDegradationtoSpeedsGreaterthan1, "Yes");
69 } else {
70
2/2
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
26 idfObject.setString(Coil_Cooling_DX_MultiSpeedFields::ApplyLatentDegradationtoSpeedsGreaterthan1, "No");
71 }
72
73 // Minimum Outdoor Dry-Bulb Temperature for Compressor Operation
74
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 idfObject.setDouble(Coil_Cooling_DX_MultiSpeedFields::MinimumOutdoorDryBulbTemperatureforCompressorOperation,
75 modelObject.minimumOutdoorDryBulbTemperatureforCompressorOperation());
76
77 // CrankcaseHeaterCapacity
78
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 idfObject.setDouble(Coil_Cooling_DX_MultiSpeedFields::CrankcaseHeaterCapacity, modelObject.crankcaseHeaterCapacity());
79
80 // CrankcaseHeaterCapacityFunctionofTemperatureCurveName
81
3/3
✓ Branch 1 taken 14 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 13 times.
28 if (auto crankCurve_ = modelObject.crankcaseHeaterCapacityFunctionofTemperatureCurve()) {
82
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_)) {
83
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(Coil_Cooling_DX_MultiSpeedFields::CrankcaseHeaterCapacityFunctionofTemperatureCurveName, curve_->nameString());
84 1 }
85 14 }
86
87 // MaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation
88
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 idfObject.setDouble(Coil_Cooling_DX_MultiSpeedFields::MaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation,
89 modelObject.maximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation());
90
91 // BasinHeaterCapacity
92
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 idfObject.setDouble(Coil_Cooling_DX_MultiSpeedFields::BasinHeaterCapacity, modelObject.basinHeaterCapacity());
93
94 // BasinHeaterSetpointTemperature
95
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 idfObject.setDouble(Coil_Cooling_DX_MultiSpeedFields::BasinHeaterSetpointTemperature, modelObject.basinHeaterSetpointTemperature());
96
97 // BasinHeaterOperatingScheduleName
98
3/3
✓ Branch 1 taken 14 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 13 times.
28 if (auto schedule = modelObject.basinHeaterOperatingSchedule()) {
99
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto _schedule = translateAndMapModelObject(schedule.get())) {
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(Coil_Cooling_DX_MultiSpeedFields::BasinHeaterOperatingScheduleName, _schedule->name().get());
101 1 }
102 14 }
103
104 // FuelType
105
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 idfObject.setString(Coil_Cooling_DX_MultiSpeedFields::FuelType, modelObject.fuelType());
106
107
1/1
✓ Branch 1 taken 14 times.
14 const auto stages = modelObject.stages();
108
109 // NumberofSpeeds
110
2/2
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 6 times.
14 if (!stages.empty()) {
111
1/1
✓ Branch 2 taken 8 times.
8 idfObject.setInt(Coil_Cooling_DX_MultiSpeedFields::NumberofSpeeds, stages.size());
112 }
113
114
2/2
✓ Branch 5 taken 18 times.
✓ Branch 6 taken 14 times.
32 for (const auto& stage : stages) {
115
1/1
✓ Branch 1 taken 18 times.
18 auto eg = idfObject.pushExtensibleGroup();
116
117 // SpeedGrossRatedTotalCoolingCapacity
118
3/3
✓ Branch 1 taken 18 times.
✓ Branch 3 taken 17 times.
✓ Branch 4 taken 1 time.
18 if (stage.isGrossRatedTotalCoolingCapacityAutosized()) {
119
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
34 eg.setString(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedGrossRatedTotalCoolingCapacity, "AutoSize");
120
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 } else if ((value = stage.grossRatedTotalCoolingCapacity())) {
121
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 eg.setDouble(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedGrossRatedTotalCoolingCapacity, value.get());
122 }
123
124 // SpeedGrossRatedSensibleHeatRatio
125
3/3
✓ Branch 1 taken 18 times.
✓ Branch 3 taken 17 times.
✓ Branch 4 taken 1 time.
18 if (stage.isGrossRatedSensibleHeatRatioAutosized()) {
126
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
34 eg.setString(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedGrossRatedSensibleHeatRatio, "AutoSize");
127
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 } else if ((value = stage.grossRatedSensibleHeatRatio())) {
128
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 eg.setDouble(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedGrossRatedSensibleHeatRatio, value.get());
129 }
130
131 // SpeedGrossRatedCoolingCOP
132
2/2
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
18 eg.setDouble(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedGrossRatedCoolingCOP, stage.grossRatedCoolingCOP());
133
134 // SpeedRatedAirFlowRate
135
3/3
✓ Branch 1 taken 18 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 8 times.
18 if (stage.isRatedAirFlowRateAutosized()) {
136
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
20 eg.setString(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedRatedAirFlowRate, "AutoSize");
137
2/3
✓ Branch 1 taken 8 times.
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
16 } else if ((value = stage.ratedAirFlowRate())) {
138
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 eg.setDouble(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedRatedAirFlowRate, value.get());
139 }
140
141 // RatedEvaporatorFanPowerPerVolumeFlowRate2017
142
2/2
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
18 eg.setDouble(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedRatedEvaporatorFanPowerPerVolumeFlowRate2017,
143 stage.ratedEvaporatorFanPowerPerVolumeFlowRate2017());
144
145 // RatedEvaporatorFanPowerPerVolumeFlowRate2023
146
2/2
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
18 eg.setDouble(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedRatedEvaporatorFanPowerPerVolumeFlowRate2023,
147 stage.ratedEvaporatorFanPowerPerVolumeFlowRate2023());
148
149 // SpeedTotalCoolingCapacityFunctionofTemperatureCurveName
150 {
151
1/1
✓ Branch 1 taken 18 times.
18 auto curve = stage.totalCoolingCapacityFunctionofTemperatureCurve();
152
2/3
✓ Branch 1 taken 18 times.
✓ Branch 3 taken 18 times.
✗ Branch 4 not taken.
36 if (auto _curve = translateAndMapModelObject(curve)) {
153
4/4
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
✓ Branch 7 taken 18 times.
✓ Branch 10 taken 18 times.
18 eg.setString(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedTotalCoolingCapacityFunctionofTemperatureCurveName, _curve->name().get());
154 18 }
155 18 }
156
157 // SpeedTotalCoolingCapacityFunctionofFlowFractionCurveName
158 {
159
1/1
✓ Branch 1 taken 18 times.
18 auto curve = stage.totalCoolingCapacityFunctionofFlowFractionCurve();
160
2/3
✓ Branch 1 taken 18 times.
✓ Branch 3 taken 18 times.
✗ Branch 4 not taken.
36 if (auto _curve = translateAndMapModelObject(curve)) {
161
4/4
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
✓ Branch 7 taken 18 times.
✓ Branch 10 taken 18 times.
18 eg.setString(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedTotalCoolingCapacityFunctionofFlowFractionCurveName, _curve->name().get());
162 18 }
163 18 }
164
165 // SpeedEnergyInputRatioFunctionofTemperatureCurveName
166 {
167
1/1
✓ Branch 1 taken 18 times.
18 auto curve = stage.energyInputRatioFunctionofTemperatureCurve();
168
2/3
✓ Branch 1 taken 18 times.
✓ Branch 3 taken 18 times.
✗ Branch 4 not taken.
36 if (auto _curve = translateAndMapModelObject(curve)) {
169
4/4
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
✓ Branch 7 taken 18 times.
✓ Branch 10 taken 18 times.
18 eg.setString(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedEnergyInputRatioFunctionofTemperatureCurveName, _curve->name().get());
170 18 }
171 18 }
172
173 // SpeedEnergyInputRatioFunctionofFlowFractionCurveName
174 {
175
1/1
✓ Branch 1 taken 18 times.
18 auto curve = stage.energyInputRatioFunctionofFlowFractionCurve();
176
2/3
✓ Branch 1 taken 18 times.
✓ Branch 3 taken 18 times.
✗ Branch 4 not taken.
36 if (auto _curve = translateAndMapModelObject(curve)) {
177
4/4
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
✓ Branch 7 taken 18 times.
✓ Branch 10 taken 18 times.
18 eg.setString(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedEnergyInputRatioFunctionofFlowFractionCurveName, _curve->name().get());
178 18 }
179 18 }
180
181 // SpeedPartLoadFractionCorrelationCurveName
182 {
183
1/1
✓ Branch 1 taken 18 times.
18 auto curve = stage.partLoadFractionCorrelationCurve();
184
2/3
✓ Branch 1 taken 18 times.
✓ Branch 3 taken 18 times.
✗ Branch 4 not taken.
36 if (auto _curve = translateAndMapModelObject(curve)) {
185
4/4
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
✓ Branch 7 taken 18 times.
✓ Branch 10 taken 18 times.
18 eg.setString(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedPartLoadFractionCorrelationCurveName, _curve->name().get());
186 18 }
187 18 }
188
189 // SpeedNominalTimeforCondensateRemovaltoBegin
190
3/4
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
✓ Branch 7 taken 18 times.
✗ Branch 8 not taken.
36 if ((value = stage.nominalTimeforCondensateRemovaltoBegin())) {
191
2/2
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
18 eg.setDouble(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedNominalTimeforCondensateRemovaltoBegin, value.get());
192 }
193
194 // SpeedRatioofInitialMoistureEvaporationRateandSteadyStateLatentCapacity
195
2/2
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
18 eg.setDouble(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedRatioofInitialMoistureEvaporationRateandSteadyStateLatentCapacity,
196 stage.ratioofInitialMoistureEvaporationRateandSteadyStateLatentCapacity());
197
198 // SpeedMaximumCyclingRate
199
2/2
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
18 eg.setDouble(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedMaximumCyclingRate, stage.maximumCyclingRate());
200
201 // SpeedLatentCapacityTimeConstant
202
2/2
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
18 eg.setDouble(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedLatentCapacityTimeConstant, stage.latentCapacityTimeConstant());
203
204 // SpeedRatedWasteHeatFractionofPowerInput
205
2/2
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
18 eg.setDouble(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedRatedWasteHeatFractionofPowerInput, stage.ratedWasteHeatFractionofPowerInput());
206
207 // SpeedWasteHeatFunctionofTemperatureCurveName
208 {
209
1/1
✓ Branch 1 taken 18 times.
18 auto curve = stage.wasteHeatFunctionofTemperatureCurve();
210
2/3
✓ Branch 1 taken 18 times.
✓ Branch 3 taken 18 times.
✗ Branch 4 not taken.
36 if (auto _curve = translateAndMapModelObject(curve)) {
211
4/4
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
✓ Branch 7 taken 18 times.
✓ Branch 10 taken 18 times.
18 eg.setString(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedWasteHeatFunctionofTemperatureCurveName, _curve->name().get());
212 18 }
213 18 }
214
215 // SpeedEvaporativeCondenserEffectiveness
216
2/2
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
18 eg.setDouble(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedEvaporativeCondenserEffectiveness, stage.evaporativeCondenserEffectiveness());
217
218 // SpeedEvaporativeCondenserAirFlowRate
219
3/3
✓ Branch 1 taken 18 times.
✓ Branch 3 taken 17 times.
✓ Branch 4 taken 1 time.
18 if (stage.isEvaporativeCondenserAirFlowRateAutosized()) {
220
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
34 eg.setString(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedEvaporativeCondenserAirFlowRate, "AutoSize");
221
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 } else if ((value = stage.evaporativeCondenserAirFlowRate())) {
222
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 eg.setDouble(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedEvaporativeCondenserAirFlowRate, value.get());
223 }
224
225 // SpeedRatedEvaporativeCondenserPumpPowerConsumption
226
3/3
✓ Branch 1 taken 18 times.
✓ Branch 3 taken 17 times.
✓ Branch 4 taken 1 time.
18 if (stage.isRatedEvaporativeCondenserPumpPowerConsumptionAutosized()) {
227
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
34 eg.setString(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedRatedEvaporativeCondenserPumpPowerConsumption, "AutoSize");
228
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 } else if ((value = stage.ratedEvaporativeCondenserPumpPowerConsumption())) {
229
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 eg.setDouble(Coil_Cooling_DX_MultiSpeedExtensibleFields::SpeedRatedEvaporativeCondenserPumpPowerConsumption, value.get());
230 }
231 18 }
232
233
1/1
✓ Branch 1 taken 14 times.
28 return idfObject;
234 14 }
235
236 } // namespace energyplus
237
238 } // namespace openstudio
239