GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 86.4% 95 / 0 / 110
Functions: 50.0% 1 / 0 / 2
Branches: 76.3% 164 / 0 / 215

src/energyplus/ForwardTranslator/ForwardTranslateCoilHeatingDXVariableSpeed.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/CoilHeatingDXVariableSpeed.hpp"
9 #include "../../model/CoilHeatingDXVariableSpeedSpeedData.hpp"
10 #include "../../model/Node.hpp"
11 #include "../../model/Schedule.hpp"
12 #include "../../model/Curve.hpp"
13 #include <utilities/idd/CoilSystem_Heating_DX_FieldEnums.hxx>
14 #include <utilities/idd/Coil_Heating_DX_VariableSpeed_FieldEnums.hxx>
15 #include "../../utilities/idd/IddEnums.hpp"
16 #include <utilities/idd/IddEnums.hxx>
17 #include <utilities/idd/IddFactory.hxx>
18 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
19
20 using namespace openstudio::model;
21
22 namespace openstudio {
23
24 namespace energyplus {
25
26 8 boost::optional<IdfObject> ForwardTranslator::translateCoilHeatingDXVariableSpeedWithoutUnitary(CoilHeatingDXVariableSpeed& modelObject) {
27 8 boost::optional<std::string> s;
28 8 boost::optional<double> value;
29
30 // Name
31
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Coil_Heating_DX_VariableSpeed, modelObject);
32
33 // AvailabilityScheduleName
34 {
35
1/1
✓ Branch 1 taken 8 times.
8 auto schedule = modelObject.availabilitySchedule();
36
2/3
✓ Branch 1 taken 8 times.
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
16 if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule)) {
37
4/4
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✓ Branch 10 taken 8 times.
8 idfObject.setString(Coil_Heating_DX_VariableSpeedFields::AvailabilityScheduleName, _schedule->name().get());
38 8 }
39 8 }
40
41 // IndoorAirInletNodeName
42
2/3
✓ Branch 1 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
16 if (auto node = modelObject.inletModelObject()) {
43 ✗ idfObject.setString(Coil_Heating_DX_VariableSpeedFields::IndoorAirInletNodeName, node->name().get());
44 8 }
45
46 // IndoorAirOutletNodeName
47
2/3
✓ Branch 1 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
16 if (auto node = modelObject.outletModelObject()) {
48 ✗ idfObject.setString(Coil_Heating_DX_VariableSpeedFields::IndoorAirOutletNodeName, node->name().get());
49 8 }
50
51 // NominalSpeedLevel
52
2/3
✓ Branch 1 taken 8 times.
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
8 if (auto speedLevel = modelObject.nominalSpeedLevel()) {
53
1/1
✓ Branch 1 taken 8 times.
8 idfObject.setInt(Coil_Heating_DX_VariableSpeedFields::NominalSpeedLevel, speedLevel);
54 }
55
56 // RatedHeatingCapacityAtSelectedNominalSpeedLevel
57
3/3
✓ Branch 1 taken 8 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 1 time.
8 if (modelObject.isRatedHeatingCapacityAtSelectedNominalSpeedLevelAutosized()) {
58
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
14 idfObject.setString(Coil_Heating_DX_VariableSpeedFields::RatedHeatingCapacityAtSelectedNominalSpeedLevel, "AutoSize");
59
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 } else if ((value = modelObject.ratedHeatingCapacityAtSelectedNominalSpeedLevel())) {
60
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Coil_Heating_DX_VariableSpeedFields::RatedHeatingCapacityAtSelectedNominalSpeedLevel, value.get());
61 }
62
63 // RatedAirFlowRateAtSelectedNominalSpeedLevel
64
3/3
✓ Branch 1 taken 8 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 1 time.
8 if (modelObject.isRatedAirFlowRateAtSelectedNominalSpeedLevelAutosized()) {
65
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
14 idfObject.setString(Coil_Heating_DX_VariableSpeedFields::RatedAirFlowRateAtSelectedNominalSpeedLevel, "AutoSize");
66
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 } else if ((value = modelObject.ratedAirFlowRateAtSelectedNominalSpeedLevel())) {
67
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Coil_Heating_DX_VariableSpeedFields::RatedAirFlowRateAtSelectedNominalSpeedLevel, value.get());
68 }
69
70 // EnergyPartLoadFractionCurveName
71 {
72
1/1
✓ Branch 1 taken 8 times.
8 auto curve = modelObject.energyPartLoadFractionCurve();
73
2/3
✓ Branch 1 taken 8 times.
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
16 if (auto _curve = translateAndMapModelObject(curve)) {
74
4/4
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✓ Branch 10 taken 8 times.
8 idfObject.setString(Coil_Heating_DX_VariableSpeedFields::EnergyPartLoadFractionCurveName, _curve->name().get());
75 8 }
76 8 }
77
78 // DefrostEnergyInputRatioFunctionofTemperatureCurveName
79
3/3
✓ Branch 1 taken 8 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 7 times.
16 if (auto curve = modelObject.defrostEnergyInputRatioFunctionofTemperatureCurve()) {
80
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())) {
81
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_VariableSpeedFields::DefrostEnergyInputRatioFunctionofTemperatureCurveName, _curve->name().get());
82 1 }
83 8 }
84
85 // MinimumOutdoorDryBulbTemperatureforCompressorOperation
86
3/4
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
16 if ((value = modelObject.minimumOutdoorDryBulbTemperatureforCompressorOperation())) {
87
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 idfObject.setDouble(Coil_Heating_DX_VariableSpeedFields::MinimumOutdoorDryBulbTemperatureforCompressorOperation, value.get());
88 }
89
90 // OutdoorDryBulbTemperaturetoTurnOnCompressor
91
3/3
✓ Branch 1 taken 8 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 7 times.
16 if ((value = modelObject.outdoorDryBulbTemperaturetoTurnOnCompressor())) {
92
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Coil_Heating_DX_VariableSpeedFields::OutdoorDryBulbTemperaturetoTurnOnCompressor, value.get());
93 }
94
95 // MaximumOutdoorDryBulbTemperatureforDefrostOperation
96
3/4
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
16 if ((value = modelObject.maximumOutdoorDryBulbTemperatureforDefrostOperation())) {
97
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 idfObject.setDouble(Coil_Heating_DX_VariableSpeedFields::MaximumOutdoorDryBulbTemperatureforDefrostOperation, value.get());
98 }
99
100 // CrankcaseHeaterCapacity
101
3/4
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
16 if ((value = modelObject.crankcaseHeaterCapacity())) {
102
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 idfObject.setDouble(Coil_Heating_DX_VariableSpeedFields::CrankcaseHeaterCapacity, value.get());
103 }
104
105 // CrankcaseHeaterCapacityFunctionofTemperatureCurveName
106
3/3
✓ Branch 1 taken 8 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 7 times.
16 if (auto crankCurve_ = modelObject.crankcaseHeaterCapacityFunctionofTemperatureCurve()) {
107
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_)) {
108
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(Coil_Heating_DX_VariableSpeedFields::CrankcaseHeaterCapacityFunctionofTemperatureCurveName, curve_->nameString());
109 1 }
110 8 }
111
112 // MaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation
113
3/4
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
16 if ((value = modelObject.maximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation())) {
114
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 idfObject.setDouble(Coil_Heating_DX_VariableSpeedFields::MaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation, value.get());
115 }
116
117 // DefrostStrategy
118
3/4
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 8 taken 8 times.
✗ Branch 9 not taken.
16 if ((s = modelObject.defrostStrategy())) {
119
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 idfObject.setString(Coil_Heating_DX_VariableSpeedFields::DefrostStrategy, s.get());
120 }
121
122 // DefrostControl
123
3/4
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 8 taken 8 times.
✗ Branch 9 not taken.
16 if ((s = modelObject.defrostControl())) {
124
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 idfObject.setString(Coil_Heating_DX_VariableSpeedFields::DefrostControl, s.get());
125 }
126
127 // DefrostTimePeriodFraction
128
3/4
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
16 if ((value = modelObject.defrostTimePeriodFraction())) {
129
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 idfObject.setDouble(Coil_Heating_DX_VariableSpeedFields::DefrostTimePeriodFraction, value.get());
130 }
131
132 // ResistiveDefrostHeaterCapacity
133
3/3
✓ Branch 1 taken 8 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 1 time.
8 if (modelObject.isResistiveDefrostHeaterCapacityAutosized()) {
134
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
14 idfObject.setString(Coil_Heating_DX_VariableSpeedFields::ResistiveDefrostHeaterCapacity, "AutoSize");
135
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 } else if ((value = modelObject.resistiveDefrostHeaterCapacity())) {
136
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Coil_Heating_DX_VariableSpeedFields::ResistiveDefrostHeaterCapacity, value.get());
137 }
138
139
1/1
✓ Branch 1 taken 8 times.
8 auto const speeds = modelObject.speeds();
140
141 // NumberofSpeeds
142
2/2
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 7 times.
8 if (auto num = speeds.size()) {
143
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setInt(Coil_Heating_DX_VariableSpeedFields::NumberofSpeeds, num);
144 }
145
146
2/2
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 8 times.
10 for (auto const& speed : speeds) {
147
1/1
✓ Branch 1 taken 2 times.
2 auto eg = idfObject.pushExtensibleGroup();
148
149 // SpeedReferenceUnitGrossRatedHeatingCapacity
150
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
4 if ((value = speed.referenceUnitGrossRatedHeatingCapacity())) {
151
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 eg.setDouble(Coil_Heating_DX_VariableSpeedExtensibleFields::SpeedReferenceUnitGrossRatedHeatingCapacity, value.get());
152 }
153
154 // SpeedReferenceUnitGrossRatedHeatingCOP
155
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
4 if ((value = speed.referenceUnitGrossRatedHeatingCOP())) {
156
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 eg.setDouble(Coil_Heating_DX_VariableSpeedExtensibleFields::SpeedReferenceUnitGrossRatedHeatingCOP, value.get());
157 }
158
159 // SpeedReferenceUnitRatedAirFlowRate
160
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
4 if ((value = speed.referenceUnitRatedAirFlowRate())) {
161
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 eg.setDouble(Coil_Heating_DX_VariableSpeedExtensibleFields::SpeedReferenceUnitRatedAirFlowRate, value.get());
162 }
163
164
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 eg.setDouble(Coil_Heating_DX_VariableSpeedExtensibleFields::SpeedRatedSupplyAirFanPowerPerVolumeFlowRate2017,
165 speed.ratedSupplyFanPowerPerVolumeFlowRate2017());
166
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 eg.setDouble(Coil_Heating_DX_VariableSpeedExtensibleFields::SpeedRatedSupplyAirFanPowerPerVolumeFlowRate2023,
167 speed.ratedSupplyFanPowerPerVolumeFlowRate2023());
168
169 // SpeedHeatingCapacityFunctionofTemperatureCurveName
170 {
171
1/1
✓ Branch 1 taken 2 times.
2 auto curve = speed.heatingCapacityFunctionofTemperatureCurve();
172
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (auto _curve = translateAndMapModelObject(curve)) {
173
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 eg.setString(Coil_Heating_DX_VariableSpeedExtensibleFields::SpeedHeatingCapacityFunctionofTemperatureCurveName, _curve->name().get());
174 2 }
175 2 }
176
177 // SpeedTotalHeatingCapacityFunctionofAirFlowFractionCurveName
178 {
179
1/1
✓ Branch 1 taken 2 times.
2 auto curve = speed.totalHeatingCapacityFunctionofAirFlowFractionCurve();
180
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (auto _curve = translateAndMapModelObject(curve)) {
181 2 eg.setString(Coil_Heating_DX_VariableSpeedExtensibleFields::SpeedTotalHeatingCapacityFunctionofAirFlowFractionCurveName,
182
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 _curve->name().get());
183 2 }
184 2 }
185
186 // SpeedEnergyInputRatioFunctionofTemperatureCurveName
187 {
188
1/1
✓ Branch 1 taken 2 times.
2 auto curve = speed.energyInputRatioFunctionofTemperatureCurve();
189
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (auto _curve = translateAndMapModelObject(curve)) {
190
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 eg.setString(Coil_Heating_DX_VariableSpeedExtensibleFields::SpeedEnergyInputRatioFunctionofTemperatureCurveName, _curve->name().get());
191 2 }
192 2 }
193
194 // SpeedEnergyInputRatioFunctionofAirFlowFractionCurveName
195 {
196
1/1
✓ Branch 1 taken 2 times.
2 auto curve = speed.energyInputRatioFunctionofAirFlowFractionCurve();
197
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (auto _curve = translateAndMapModelObject(curve)) {
198
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 eg.setString(Coil_Heating_DX_VariableSpeedExtensibleFields::SpeedEnergyInputRatioFunctionofAirFlowFractionCurveName, _curve->name().get());
199 2 }
200 2 }
201 2 }
202
203
1/1
✓ Branch 1 taken 8 times.
16 return idfObject;
204 8 }
205
206 ✗ boost::optional<IdfObject> ForwardTranslator::translateCoilHeatingDXVariableSpeed(CoilHeatingDXVariableSpeed& modelObject) {
207 ✗ IdfObject coilSystemHeatingDXIdf(IddObjectType::CoilSystem_Heating_DX);
208
209 ✗ m_idfObjects.push_back(coilSystemHeatingDXIdf);
210
211 ✗ boost::optional<IdfObject> idfObject = translateCoilHeatingDXVariableSpeedWithoutUnitary(modelObject);
212
213 ✗ if (!idfObject) {
214 ✗ return boost::none;
215 }
216
217 ✗ if (auto s = modelObject.name()) {
218 ✗ coilSystemHeatingDXIdf.setString(CoilSystem_Heating_DXFields::HeatingCoilObjectType, idfObject->iddObject().name());
219 ✗ coilSystemHeatingDXIdf.setString(CoilSystem_Heating_DXFields::HeatingCoilName, s.get());
220 ✗ coilSystemHeatingDXIdf.setName(s.get() + " CoilSystem");
221 ✗ }
222
223 ✗ return coilSystemHeatingDXIdf;
224 ✗ }
225
226 } // namespace energyplus
227
228 } // namespace openstudio
229