GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 99.1% 109 / 0 / 110
Functions: 100.0% 2 / 0 / 2
Branches: 90.1% 173 / 0 / 192

src/energyplus/ForwardTranslator/ForwardTranslateCoilCoolingDXTwoStageWithHumidityControlMode.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/Node.hpp"
11 #include "../../model/Node_Impl.hpp"
12 #include "../../model/CoilCoolingDXTwoStageWithHumidityControlMode.hpp"
13 #include "../../model/CoilCoolingDXTwoStageWithHumidityControlMode_Impl.hpp"
14 #include "../../model/CoilPerformanceDXCooling.hpp"
15 #include "../../model/CoilPerformanceDXCooling_Impl.hpp"
16 #include "../../model/Curve.hpp"
17 #include "../../model/Curve_Impl.hpp"
18 #include "../../utilities/core/Logger.hpp"
19 #include "../../utilities/core/Assert.hpp"
20 #include <utilities/idd/CoilSystem_Cooling_DX_FieldEnums.hxx>
21 #include <utilities/idd/Coil_Cooling_DX_TwoStageWithHumidityControlMode_FieldEnums.hxx>
22 #include "../../utilities/idd/IddEnums.hpp"
23 #include <utilities/idd/IddEnums.hxx>
24 #include <utilities/idd/IddFactory.hxx>
25
26 using namespace openstudio::model;
27
28 using namespace std;
29
30 namespace openstudio {
31
32 namespace energyplus {
33
34 4 boost::optional<IdfObject> ForwardTranslator::translateCoilCoolingDXTwoStageWithHumidityControlModeWithoutUnitary(
35 model::CoilCoolingDXTwoStageWithHumidityControlMode& modelObject) {
36 //create the IdfObject that will be the coil
37
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 IdfObject idfObject(IddObjectType::Coil_Cooling_DX_TwoStageWithHumidityControlMode);
38
39 //Name
40
1/1
✓ Branch 1 taken 4 times.
4 m_idfObjects.push_back(idfObject);
41
2/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
8 if (auto value = modelObject.name()) {
42
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 idfObject.setName(value.get());
43 4 }
44
45 // AirInletNodeName
46
3/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 3 times.
8 if (auto mo = modelObject.inletModelObject()) {
47
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto node = mo->optionalCast<model::Node>()) {
48
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_TwoStageWithHumidityControlModeFields::AirInletNodeName, node->name().get());
49 1 }
50 4 }
51
52 // AirOutletNodeName
53
3/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 3 times.
8 if (auto mo = modelObject.outletModelObject()) {
54
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto node = mo->optionalCast<model::Node>()) {
55
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_TwoStageWithHumidityControlModeFields::AirOutletNodeName, node->name().get());
56 1 }
57 4 }
58
59 // AvailabilityScheduleName
60
3/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 3 times.
8 if (auto schedule = modelObject.availabilitySchedule()) {
61
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto idf = translateAndMapModelObject(schedule.get())) {
62
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_TwoStageWithHumidityControlModeFields::AvailabilityScheduleName, idf->name().get());
63 1 }
64 4 }
65
66 // CrankcaseHeaterCapacity
67 {
68
1/1
✓ Branch 1 taken 4 times.
4 auto value = modelObject.crankcaseHeaterCapacity();
69
1/1
✓ Branch 1 taken 4 times.
4 idfObject.setDouble(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::CrankcaseHeaterCapacity, value);
70 }
71
72 // CrankcaseHeaterCapacityFunctionofTemperatureCurveName
73
3/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 3 times.
8 if (auto crankCurve_ = modelObject.crankcaseHeaterCapacityFunctionofTemperatureCurve()) {
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(*crankCurve_)) {
75
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setString(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::CrankcaseHeaterCapacityFunctionofTemperatureCurveName,
76
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 curve_->nameString());
77 1 }
78 4 }
79
80 // MaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation
81 {
82
1/1
✓ Branch 1 taken 4 times.
4 auto value = modelObject.maximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation();
83
1/1
✓ Branch 1 taken 4 times.
4 idfObject.setDouble(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::MaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation, value);
84 }
85
86 // NumberofCapacityStages
87 {
88
1/1
✓ Branch 1 taken 4 times.
4 auto value = modelObject.numberofCapacityStages();
89
1/1
✓ Branch 1 taken 4 times.
4 idfObject.setInt(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::NumberofCapacityStages, value);
90 }
91
92 // NumberofEnhancedDehumidificationModes
93 {
94
1/1
✓ Branch 1 taken 4 times.
4 auto value = modelObject.numberofEnhancedDehumidificationModes();
95
1/1
✓ Branch 1 taken 4 times.
4 idfObject.setInt(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::NumberofEnhancedDehumidificationModes, value);
96 }
97
98 // NormalModeStage1CoilPerformanceName
99
2/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
8 if (auto curve = modelObject.normalModeStage1CoilPerformance()) {
100
3/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
8 if (auto idf = translateAndMapModelObject(curve.get())) {
101
1/1
✓ Branch 1 taken 4 times.
4 idfObject.setString(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::NormalModeStage1CoilPerformanceObjectType,
102
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
8 idf->iddObject().name());
103
4/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
4 idfObject.setString(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::NormalModeStage1CoilPerformanceName, idf->name().get());
104 4 }
105 4 }
106
107 // NormalModeStage1_PLUS_2CoilPerformanceName
108
2/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
8 if (auto curve = modelObject.normalModeStage1Plus2CoilPerformance()) {
109
3/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
8 if (auto idf = translateAndMapModelObject(curve.get())) {
110
1/1
✓ Branch 1 taken 4 times.
4 idfObject.setString(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::NormalModeStage1_PLUS_2CoilPerformanceObjectType,
111
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
8 idf->iddObject().name());
112
4/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
4 idfObject.setString(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::NormalModeStage1_PLUS_2CoilPerformanceName, idf->name().get());
113 4 }
114 4 }
115
116 // DehumidificationMode1Stage1CoilPerformanceName
117
2/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
8 if (auto curve = modelObject.dehumidificationMode1Stage1CoilPerformance()) {
118
3/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
8 if (auto idf = translateAndMapModelObject(curve.get())) {
119
1/1
✓ Branch 1 taken 4 times.
4 idfObject.setString(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::DehumidificationMode1Stage1CoilPerformanceObjectType,
120
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
8 idf->iddObject().name());
121
4/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
4 idfObject.setString(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::DehumidificationMode1Stage1CoilPerformanceName, idf->name().get());
122 4 }
123 4 }
124
125 // DehumidificationMode1Stage1_PLUS_2CoilPerformanceName
126
2/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
8 if (auto curve = modelObject.dehumidificationMode1Stage1Plus2CoilPerformance()) {
127
3/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
8 if (auto idf = translateAndMapModelObject(curve.get())) {
128
1/1
✓ Branch 1 taken 4 times.
4 idfObject.setString(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::DehumidificationMode1Stage1_PLUS_2CoilPerformanceObjectType,
129
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
8 idf->iddObject().name());
130 4 idfObject.setString(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::DehumidificationMode1Stage1_PLUS_2CoilPerformanceName,
131
4/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
4 idf->name().get());
132 4 }
133 4 }
134
135 // Minimum Outdoor Dry-Bulb Temperature for Compressor Operation
136 {
137
1/1
✓ Branch 1 taken 4 times.
4 auto value = modelObject.minimumOutdoorDryBulbTemperatureforCompressorOperation();
138
1/1
✓ Branch 1 taken 4 times.
4 idfObject.setDouble(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::MinimumOutdoorDryBulbTemperatureforCompressorOperation, value);
139 }
140
141 // BasinHeaterCapacity
142 {
143
1/1
✓ Branch 1 taken 4 times.
4 auto value = modelObject.basinHeaterCapacity();
144
1/1
✓ Branch 1 taken 4 times.
4 idfObject.setDouble(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::BasinHeaterCapacity, value);
145 }
146
147 // BasinHeaterSetpointTemperature
148 {
149
1/1
✓ Branch 1 taken 4 times.
4 auto value = modelObject.basinHeaterSetpointTemperature();
150
1/1
✓ Branch 1 taken 4 times.
4 idfObject.setDouble(Coil_Cooling_DX_TwoStageWithHumidityControlModeFields::BasinHeaterSetpointTemperature, value);
151 }
152
153 // BasinHeaterOperatingScheduleName
154
3/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 3 times.
8 if (auto schedule = modelObject.basinHeaterOperatingSchedule()) {
155
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto idf = translateAndMapModelObject(schedule.get())) {
156
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_TwoStageWithHumidityControlModeFields::BasinHeaterOperatingScheduleName, idf->name().get());
157 1 }
158 4 }
159
160
1/1
✓ Branch 1 taken 4 times.
8 return idfObject;
161 4 }
162
163 boost::optional<IdfObject>
164 2 ForwardTranslator::translateCoilCoolingDXTwoStageWithHumidityControlMode(model::CoilCoolingDXTwoStageWithHumidityControlMode& modelObject) {
165
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 IdfObject coilSystemCoolingDXIdf(IddObjectType::CoilSystem_Cooling_DX);
166
167
1/1
✓ Branch 1 taken 2 times.
2 m_idfObjects.push_back(coilSystemCoolingDXIdf);
168
169
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<IdfObject> oIdfObject = translateCoilCoolingDXTwoStageWithHumidityControlModeWithoutUnitary(modelObject);
170
171
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
2 if (!oIdfObject) {
172 ✗ return boost::none;
173 }
174
175
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 IdfObject idfObject = oIdfObject.get();
176
177 2 OptionalString s;
178
179
1/1
✓ Branch 1 taken 2 times.
2 s = modelObject.name();
180
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (s) {
181
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 coilSystemCoolingDXIdf.setString(CoilSystem_Cooling_DXFields::CoolingCoilObjectType, idfObject.iddObject().name());
182
183
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 coilSystemCoolingDXIdf.setString(CoilSystem_Cooling_DXFields::CoolingCoilName, *s);
184
185
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 coilSystemCoolingDXIdf.setName(*s + " CoilSystem");
186 }
187
188
3/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
4 if (auto sched = modelObject.availabilitySchedule()) {
189
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (auto _sched = translateAndMapModelObject(sched.get())) {
190
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 coilSystemCoolingDXIdf.setString(CoilSystem_Cooling_DXFields::AvailabilityScheduleName, _sched->name().get());
191 1 }
192 2 }
193
194
1/1
✓ Branch 1 taken 2 times.
2 OptionalModelObject omo = modelObject.inletModelObject();
195
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
2 if (omo) {
196
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 translateAndMapModelObject(*omo);
197
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 s = omo->name();
198
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (s) {
199
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 coilSystemCoolingDXIdf.setString(CoilSystem_Cooling_DXFields::DXCoolingCoilSystemInletNodeName, *s);
200 }
201 }
202
203
1/1
✓ Branch 1 taken 2 times.
2 omo = modelObject.outletModelObject();
204
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
2 if (omo) {
205
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 translateAndMapModelObject(*omo);
206
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 s = omo->name();
207
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (s) {
208
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 coilSystemCoolingDXIdf.setString(CoilSystem_Cooling_DXFields::DXCoolingCoilSystemOutletNodeName, *s);
209
210
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 coilSystemCoolingDXIdf.setString(CoilSystem_Cooling_DXFields::DXCoolingCoilSystemSensorNodeName, *s);
211 }
212 }
213
214
1/1
✓ Branch 1 taken 2 times.
2 return coilSystemCoolingDXIdf;
215 2 }
216
217 } // namespace energyplus
218
219 } // namespace openstudio
220