GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 96.8% 91 / 0 / 94
Functions: 100.0% 1 / 0 / 1
Branches: 84.5% 147 / 0 / 174

src/energyplus/ForwardTranslator/ForwardTranslateCoilHeatingDXMultiSpeed.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/CoilHeatingDXMultiSpeed.hpp"
9 #include "../../model/CoilHeatingDXMultiSpeedStageData.hpp"
10 #include "../../model/Node.hpp"
11 #include "../../model/Schedule.hpp"
12 #include "../../model/Curve.hpp"
13 #include <utilities/idd/Coil_Heating_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 9 boost::optional<IdfObject> ForwardTranslator::translateCoilHeatingDXMultiSpeed(CoilHeatingDXMultiSpeed& modelObject) {
26 9 boost::optional<std::string> s;
27 9 boost::optional<double> value;
28
29 // Name
30
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Coil_Heating_DX_MultiSpeed, modelObject);
31
32 // AvailabilityScheduleName
33
2/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
18 if (auto schedule = modelObject.availabilitySchedule()) {
34
3/4
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 6 taken 9 times.
✗ Branch 7 not taken.
18 if (auto _schedule = translateAndMapModelObject(schedule.get())) {
35
4/4
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
✓ Branch 10 taken 9 times.
9 idfObject.setString(Coil_Heating_DX_MultiSpeedFields::AvailabilityScheduleName, _schedule->name().get());
36 9 }
37 9 }
38
39 // AirInletNodeName
40
2/3
✓ Branch 1 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
18 if (auto node = modelObject.inletModelObject()) {
41 ✗ idfObject.setString(Coil_Heating_DX_MultiSpeedFields::AirInletNodeName, node->name().get());
42 9 }
43
44 // AirOutletNodeName
45
2/3
✓ Branch 1 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
18 if (auto node = modelObject.outletModelObject()) {
46 ✗ idfObject.setString(Coil_Heating_DX_MultiSpeedFields::AirOutletNodeName, node->name().get());
47 9 }
48
49 // MinimumOutdoorDryBulbTemperatureforCompressorOperation
50
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setDouble(Coil_Heating_DX_MultiSpeedFields::MinimumOutdoorDryBulbTemperatureforCompressorOperation,
51 modelObject.minimumOutdoorDryBulbTemperatureforCompressorOperation());
52
53 // OutdoorDryBulbTemperaturetoTurnOnCompressor
54
3/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 8 times.
18 if ((value = modelObject.outdoorDryBulbTemperaturetoTurnOnCompressor())) {
55
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Coil_Heating_DX_MultiSpeedFields::OutdoorDryBulbTemperaturetoTurnOnCompressor, value.get());
56 }
57
58 // CrankcaseHeaterCapacity
59
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setDouble(Coil_Heating_DX_MultiSpeedFields::CrankcaseHeaterCapacity, modelObject.crankcaseHeaterCapacity());
60
61 // CrankcaseHeaterCapacityFunctionofTemperatureCurveName
62
3/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 8 times.
18 if (auto crankCurve_ = modelObject.crankcaseHeaterCapacityFunctionofTemperatureCurve()) {
63
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_)) {
64
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(Coil_Heating_DX_MultiSpeedFields::CrankcaseHeaterCapacityFunctionofTemperatureCurveName, curve_->nameString());
65 1 }
66 9 }
67
68 // MaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation
69
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setDouble(Coil_Heating_DX_MultiSpeedFields::MaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation,
70 modelObject.maximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation());
71
72 // DefrostEnergyInputRatioFunctionofTemperatureCurveName
73
3/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 8 times.
18 if (auto curve = modelObject.defrostEnergyInputRatioFunctionofTemperatureCurve()) {
74
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(curve.get())) {
75
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_MultiSpeedFields::DefrostEnergyInputRatioFunctionofTemperatureCurveName, _curve->name().get());
76 1 }
77 9 }
78
79 // MaximumOutdoorDryBulbTemperatureforDefrostOperation
80
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setDouble(Coil_Heating_DX_MultiSpeedFields::MaximumOutdoorDryBulbTemperatureforDefrostOperation,
81 modelObject.maximumOutdoorDryBulbTemperatureforDefrostOperation());
82
83 // DefrostStrategy
84
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setString(Coil_Heating_DX_MultiSpeedFields::DefrostStrategy, modelObject.defrostStrategy());
85
86 // DefrostControl
87
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setString(Coil_Heating_DX_MultiSpeedFields::DefrostControl, modelObject.defrostControl());
88
89 // DefrostTimePeriodFraction
90
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setDouble(Coil_Heating_DX_MultiSpeedFields::DefrostTimePeriodFraction, modelObject.defrostTimePeriodFraction());
91
92 // ResistiveDefrostHeaterCapacity
93
3/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 1 time.
9 if (modelObject.isResistiveDefrostHeaterCapacityAutosized()) {
94
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
16 idfObject.setString(Coil_Heating_DX_MultiSpeedFields::ResistiveDefrostHeaterCapacity, "AutoSize");
95
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 } else if ((value = modelObject.resistiveDefrostHeaterCapacity())) {
96
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Coil_Heating_DX_MultiSpeedFields::ResistiveDefrostHeaterCapacity, value.get());
97 }
98
99 // ApplyPartLoadFractiontoSpeedsGreaterthan1
100
2/3
✓ Branch 1 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
9 if (modelObject.applyPartLoadFractiontoSpeedsGreaterthan1()) {
101 ✗ idfObject.setString(Coil_Heating_DX_MultiSpeedFields::ApplyPartLoadFractiontoSpeedsGreaterthan1, "Yes");
102 } else {
103
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
18 idfObject.setString(Coil_Heating_DX_MultiSpeedFields::ApplyPartLoadFractiontoSpeedsGreaterthan1, "No");
104 }
105
106 // FuelType
107
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setString(Coil_Heating_DX_MultiSpeedFields::FuelType, modelObject.fuelType());
108
109 // RegionnumberforCalculatingHSPF
110
2/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
9 if (auto num = modelObject.regionnumberforCalculatingHSPF()) {
111
1/1
✓ Branch 1 taken 9 times.
9 idfObject.setInt(Coil_Heating_DX_MultiSpeedFields::RegionnumberforCalculatingHSPF, num);
112 }
113
114
1/1
✓ Branch 1 taken 9 times.
9 const auto stages = modelObject.stages();
115
116 // NumberofSpeeds
117
2/2
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 1 time.
9 if (!stages.empty()) {
118
1/1
✓ Branch 2 taken 8 times.
8 idfObject.setInt(Coil_Heating_DX_MultiSpeedFields::NumberofSpeeds, stages.size());
119 }
120
121
2/2
✓ Branch 5 taken 17 times.
✓ Branch 6 taken 9 times.
26 for (const auto& stage : stages) {
122
1/1
✓ Branch 1 taken 17 times.
17 auto eg = idfObject.pushExtensibleGroup();
123
124 // GrossRatedHeatingCapacity
125
3/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 1 time.
17 if (stage.isGrossRatedHeatingCapacityAutosized()) {
126
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
32 eg.setString(Coil_Heating_DX_MultiSpeedExtensibleFields::SpeedGrossRatedHeatingCapacity, "AutoSize");
127
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 } else if ((value = stage.grossRatedHeatingCapacity())) {
128
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 eg.setDouble(Coil_Heating_DX_MultiSpeedExtensibleFields::SpeedGrossRatedHeatingCapacity, value.get());
129 }
130
131 // GrossRatedHeatingCOP
132
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 eg.setDouble(Coil_Heating_DX_MultiSpeedExtensibleFields::SpeedGrossRatedHeatingCOP, stage.grossRatedHeatingCOP());
133
134 // RatedAirFlowRate
135
3/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 7 times.
17 if (stage.isRatedAirFlowRateAutosized()) {
136
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
20 eg.setString(Coil_Heating_DX_MultiSpeedExtensibleFields::SpeedRatedAirFlowRate, "AutoSize");
137
2/3
✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
14 } else if ((value = stage.ratedAirFlowRate())) {
138
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 eg.setDouble(Coil_Heating_DX_MultiSpeedExtensibleFields::SpeedRatedAirFlowRate, value.get());
139 }
140
141 // RatedSupplyAirFanPowerPerVolumeFlowRate2017
142
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 eg.setDouble(Coil_Heating_DX_MultiSpeedExtensibleFields::SpeedRatedSupplyAirFanPowerPerVolumeFlowRate2017,
143 stage.ratedSupplyAirFanPowerPerVolumeFlowRate2017());
144
145 // RatedSupplyAirFanPowerPerVolumeFlowRate2023
146
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 eg.setDouble(Coil_Heating_DX_MultiSpeedExtensibleFields::SpeedRatedSupplyAirFanPowerPerVolumeFlowRate2023,
147 stage.ratedSupplyAirFanPowerPerVolumeFlowRate2023());
148
149 // HeatingCapacityFunctionofTemperatureCurveName
150 {
151
1/1
✓ Branch 1 taken 17 times.
17 auto curve = stage.heatingCapacityFunctionofTemperatureCurve();
152
2/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 17 times.
✗ Branch 4 not taken.
34 if (auto _curve = translateAndMapModelObject(curve)) {
153
4/4
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
✓ Branch 10 taken 17 times.
17 eg.setString(Coil_Heating_DX_MultiSpeedExtensibleFields::SpeedHeatingCapacityFunctionofTemperatureCurveName, _curve->name().get());
154 17 }
155 17 }
156
157 // HeatingCapacityFunctionofFlowFractionCurveName
158 {
159
1/1
✓ Branch 1 taken 17 times.
17 auto curve = stage.heatingCapacityFunctionofFlowFractionCurve();
160
2/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 17 times.
✗ Branch 4 not taken.
34 if (auto _curve = translateAndMapModelObject(curve)) {
161
4/4
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
✓ Branch 10 taken 17 times.
17 eg.setString(Coil_Heating_DX_MultiSpeedExtensibleFields::SpeedHeatingCapacityFunctionofFlowFractionCurveName, _curve->name().get());
162 17 }
163 17 }
164
165 // SpeedEnergyInputRatioFunctionofTemperatureCurveName
166 {
167
1/1
✓ Branch 1 taken 17 times.
17 auto curve = stage.energyInputRatioFunctionofTemperatureCurve();
168
2/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 17 times.
✗ Branch 4 not taken.
34 if (auto _curve = translateAndMapModelObject(curve)) {
169
4/4
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
✓ Branch 10 taken 17 times.
17 eg.setString(Coil_Heating_DX_MultiSpeedExtensibleFields::SpeedEnergyInputRatioFunctionofTemperatureCurveName, _curve->name().get());
170 17 }
171 17 }
172
173 // SpeedEnergyInputRatioFunctionofFlowFractionCurveName
174 {
175
1/1
✓ Branch 1 taken 17 times.
17 auto curve = stage.energyInputRatioFunctionofFlowFractionCurve();
176
2/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 17 times.
✗ Branch 4 not taken.
34 if (auto _curve = translateAndMapModelObject(curve)) {
177
4/4
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
✓ Branch 10 taken 17 times.
17 eg.setString(Coil_Heating_DX_MultiSpeedExtensibleFields::SpeedEnergyInputRatioFunctionofFlowFractionCurveName, _curve->name().get());
178 17 }
179 17 }
180
181 // SpeedPartLoadFractionCorrelationCurveName
182 {
183
1/1
✓ Branch 1 taken 17 times.
17 auto curve = stage.partLoadFractionCorrelationCurve();
184
2/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 17 times.
✗ Branch 4 not taken.
34 if (auto _curve = translateAndMapModelObject(curve)) {
185
4/4
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
✓ Branch 10 taken 17 times.
17 eg.setString(Coil_Heating_DX_MultiSpeedExtensibleFields::SpeedPartLoadFractionCorrelationCurveName, _curve->name().get());
186 17 }
187 17 }
188
189 // SpeedRatedWasteHeatFractionofPowerInput
190
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 eg.setDouble(Coil_Heating_DX_MultiSpeedExtensibleFields::SpeedRatedWasteHeatFractionofPowerInput, stage.ratedWasteHeatFractionofPowerInput());
191
192 // SpeedWasteHeatFunctionofTemperatureCurveName
193 {
194
1/1
✓ Branch 1 taken 17 times.
17 auto curve = stage.wasteHeatFunctionofTemperatureCurve();
195
2/3
✓ Branch 1 taken 17 times.
✓ Branch 3 taken 17 times.
✗ Branch 4 not taken.
34 if (auto _curve = translateAndMapModelObject(curve)) {
196
4/4
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
✓ Branch 10 taken 17 times.
17 eg.setString(Coil_Heating_DX_MultiSpeedExtensibleFields::SpeedWasteHeatFunctionofTemperatureCurveName, _curve->name().get());
197 17 }
198 17 }
199 17 }
200
201
1/1
✓ Branch 1 taken 9 times.
18 return idfObject;
202 9 }
203
204 } // namespace energyplus
205
206 } // namespace openstudio
207