GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 152
Functions: 0.0% 0 / 0 / 1
Branches: 0.0% 0 / 0 / 376

src/energyplus/ReverseTranslator/ReverseTranslateSizingSystem.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 "../ReverseTranslator.hpp"
7 #include "../../model/SizingSystem.hpp"
8 #include "../../model/SizingSystem_Impl.hpp"
9 #include "../../model/AirLoopHVAC.hpp"
10 #include "../../model/AirLoopHVAC_Impl.hpp"
11 #include <utilities/idd/Sizing_System_FieldEnums.hxx>
12
13 using namespace openstudio::model;
14
15 namespace openstudio {
16
17 namespace energyplus {
18
19 ✗ OptionalModelObject ReverseTranslator::translateSizingSystem(const WorkspaceObject& workspaceObject) {
20 ✗ boost::optional<WorkspaceObject> _airLoopHVAC = workspaceObject.getTarget(Sizing_SystemFields::AirLoopName);
21
22 ✗ boost::optional<AirLoopHVAC> airLoopHVAC;
23
24 ✗ if (_airLoopHVAC) {
25 ✗ boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(_airLoopHVAC.get());
26
27 ✗ if (mo) {
28 ✗ airLoopHVAC = mo->optionalCast<AirLoopHVAC>();
29 }
30 ✗ }
31
32 ✗ if (!airLoopHVAC) {
33 ✗ LOG(Error, "Error importing object: " << workspaceObject.briefDescription() << " Can't find associated AirLoopHVAC.");
34
35 ✗ return boost::none;
36 }
37
38 ✗ openstudio::model::SizingSystem sizingSystem = airLoopHVAC->sizingSystem();
39
40 ✗ boost::optional<std::string> s;
41 ✗ boost::optional<double> value;
42
43 // TypeofLoadtoSizeOn
44 ✗ s = workspaceObject.getString(Sizing_SystemFields::TypeofLoadtoSizeOn);
45 ✗ if (s) {
46 ✗ sizingSystem.setTypeofLoadtoSizeOn(s.get());
47 }
48
49 // DesignOutdoorAirFlowRate
50 ✗ s = workspaceObject.getString(Sizing_SystemFields::DesignOutdoorAirFlowRate);
51 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::DesignOutdoorAirFlowRate);
52 ✗ if (value) {
53 ✗ sizingSystem.setDesignOutdoorAirFlowRate(value.get());
54 ✗ } else if (s && istringEqual(s.get(), "Autosize")) {
55 ✗ sizingSystem.autosizeDesignOutdoorAirFlowRate();
56 }
57
58 // CentralHeatingMaximumSystemAirFlowRatio
59 ✗ s = workspaceObject.getString(Sizing_SystemFields::CentralHeatingMaximumSystemAirFlowRatio);
60 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::CentralHeatingMaximumSystemAirFlowRatio);
61 ✗ if (value) {
62 ✗ sizingSystem.setCentralHeatingMaximumSystemAirFlowRatio(value.get());
63 ✗ } else if (s && istringEqual(s.get(), "Autosize")) {
64 ✗ sizingSystem.autosizeCentralHeatingMaximumSystemAirFlowRatio();
65 }
66
67 // PreheatDesignTemperature
68 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::PreheatDesignTemperature);
69 ✗ if (value) {
70 ✗ sizingSystem.setPreheatDesignTemperature(value.get());
71 }
72
73 // PreheatDesignHumidityRatio
74 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::PreheatDesignHumidityRatio);
75 ✗ if (value) {
76 ✗ sizingSystem.setPreheatDesignHumidityRatio(value.get());
77 }
78
79 // PrecoolDesignTemperature
80 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::PrecoolDesignTemperature);
81 ✗ if (value) {
82 ✗ sizingSystem.setPrecoolDesignTemperature(value.get());
83 }
84
85 // PrecoolDesignHumidityRatio
86 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::PrecoolDesignHumidityRatio);
87 ✗ if (value) {
88 ✗ sizingSystem.setPrecoolDesignHumidityRatio(value.get());
89 }
90
91 // CentralCoolingDesignSupplyAirTemperature
92 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::CentralCoolingDesignSupplyAirTemperature);
93 ✗ if (value) {
94 ✗ sizingSystem.setCentralCoolingDesignSupplyAirTemperature(value.get());
95 }
96
97 // CentralHeatingDesignSupplyAirTemperature
98 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::CentralHeatingDesignSupplyAirTemperature);
99 ✗ if (value) {
100 ✗ sizingSystem.setCentralHeatingDesignSupplyAirTemperature(value.get());
101 }
102
103 // TypeofZoneSumtoUse
104 ✗ s = workspaceObject.getString(Sizing_SystemFields::TypeofZoneSumtoUse);
105 ✗ if (s) {
106 ✗ sizingSystem.setSizingOption(s.get());
107 }
108
109 // AllOutdoorAirinCooling
110 ✗ s = workspaceObject.getString(Sizing_SystemFields::AllOutdoorAirinCooling);
111 ✗ if (s && istringEqual(s.get(), "Yes")) {
112 ✗ sizingSystem.setAllOutdoorAirinCooling(true);
113 ✗ } else if (s && istringEqual(s.get(), "No")) {
114 ✗ sizingSystem.setAllOutdoorAirinCooling(false);
115 }
116
117 // AllOutdoorAirinHeating
118 ✗ s = workspaceObject.getString(Sizing_SystemFields::AllOutdoorAirinHeating);
119 ✗ if (s && istringEqual(s.get(), "Yes")) {
120 ✗ sizingSystem.setAllOutdoorAirinHeating(true);
121 ✗ } else if (s && istringEqual(s.get(), "No")) {
122 ✗ sizingSystem.setAllOutdoorAirinHeating(false);
123 }
124
125 // CentralCoolingDesignSupplyAirHumidityRatio
126 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::CentralCoolingDesignSupplyAirHumidityRatio);
127 ✗ if (value) {
128 ✗ sizingSystem.setCentralCoolingDesignSupplyAirHumidityRatio(value.get());
129 }
130
131 // CentralHeatingDesignSupplyAirHumidityRatio
132 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::CentralHeatingDesignSupplyAirHumidityRatio);
133 ✗ if (value) {
134 ✗ sizingSystem.setCentralHeatingDesignSupplyAirHumidityRatio(value.get());
135 }
136
137 // CoolingSupplyAirFlowRateMethod
138 ✗ s = workspaceObject.getString(Sizing_SystemFields::CoolingSupplyAirFlowRateMethod);
139 ✗ if (s) {
140 ✗ sizingSystem.setCoolingDesignAirFlowMethod(s.get());
141 }
142
143 // CoolingSupplyAirFlowRate
144 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::CoolingSupplyAirFlowRate);
145 ✗ if (value) {
146 ✗ sizingSystem.setCoolingDesignAirFlowRate(value.get());
147 }
148
149 // HeatingSupplyAirFlowRateMethod
150 ✗ s = workspaceObject.getString(Sizing_SystemFields::HeatingSupplyAirFlowRateMethod);
151 ✗ if (s) {
152 ✗ sizingSystem.setHeatingDesignAirFlowMethod(s.get());
153 }
154
155 // HeatingSupplyAirFlowRate
156 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::HeatingSupplyAirFlowRate);
157 ✗ if (value) {
158 ✗ sizingSystem.setHeatingDesignAirFlowRate(value.get());
159 }
160
161 // SystemOutdoorAirMethod
162 ✗ s = workspaceObject.getString(Sizing_SystemFields::SystemOutdoorAirMethod);
163 ✗ if (s) {
164 ✗ sizingSystem.setSystemOutdoorAirMethod(s.get());
165 }
166
167 // ZoneMaximumOutdoorAirFraction
168 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::ZoneMaximumOutdoorAirFraction);
169 ✗ if (value) {
170 ✗ sizingSystem.setZoneMaximumOutdoorAirFraction(value.get());
171 }
172
173 // CoolingSupplyAirFlowRatePerFloorArea
174 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::CoolingSupplyAirFlowRatePerFloorArea);
175 ✗ if (value) {
176 ✗ sizingSystem.setCoolingSupplyAirFlowRatePerFloorArea(value.get());
177 }
178
179 // CoolingFractionofAutosizedCoolingSupplyAirFlowRate
180 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::CoolingFractionofAutosizedCoolingSupplyAirFlowRate);
181 ✗ if (value) {
182 ✗ sizingSystem.setCoolingFractionofAutosizedCoolingSupplyAirFlowRate(value.get());
183 }
184
185 // CoolingSupplyAirFlowRatePerUnitCoolingCapacity
186 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::CoolingSupplyAirFlowRatePerUnitCoolingCapacity);
187 ✗ if (value) {
188 ✗ sizingSystem.setCoolingSupplyAirFlowRatePerUnitCoolingCapacity(value.get());
189 }
190
191 // HeatingSupplyAirFlowRatePerFloorArea
192 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::HeatingSupplyAirFlowRatePerFloorArea);
193 ✗ if (value) {
194 ✗ sizingSystem.setHeatingSupplyAirFlowRatePerFloorArea(value.get());
195 }
196
197 // HeatingFractionofAutosizedHeatingSupplyAirFlowRate
198 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::HeatingFractionofAutosizedHeatingSupplyAirFlowRate);
199 ✗ if (value) {
200 ✗ sizingSystem.setHeatingFractionofAutosizedHeatingSupplyAirFlowRate(value.get());
201 }
202
203 // HeatingFractionofAutosizedCoolingSupplyAirFlowRate
204 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::HeatingFractionofAutosizedCoolingSupplyAirFlowRate);
205 ✗ if (value) {
206 ✗ sizingSystem.setHeatingFractionofAutosizedCoolingSupplyAirFlowRate(value.get());
207 }
208
209 // HeatingSupplyAirFlowRatePerUnitHeatingCapacity
210 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::HeatingSupplyAirFlowRatePerUnitHeatingCapacity);
211 ✗ if (value) {
212 ✗ sizingSystem.setHeatingSupplyAirFlowRatePerUnitHeatingCapacity(value.get());
213 }
214
215 // CoolingDesignCapacityMethod
216 ✗ s = workspaceObject.getString(Sizing_SystemFields::CoolingDesignCapacityMethod);
217 ✗ if (s) {
218 ✗ sizingSystem.setCoolingDesignCapacityMethod(s.get());
219 }
220
221 // CoolingDesignCapacity
222 ✗ s = workspaceObject.getString(Sizing_SystemFields::CoolingDesignCapacity);
223 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::CoolingDesignCapacity);
224 ✗ if (value) {
225 ✗ sizingSystem.setCoolingDesignCapacity(value.get());
226 ✗ } else if (s && istringEqual(s.get(), "Autosize")) {
227 ✗ sizingSystem.autosizeCoolingDesignCapacity();
228 }
229
230 // CoolingDesignCapacityPerFloorArea
231 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::CoolingDesignCapacityPerFloorArea);
232 ✗ if (value) {
233 ✗ sizingSystem.setCoolingDesignCapacityPerFloorArea(value.get());
234 }
235
236 // FractionofAutosizedCoolingDesignCapacity
237 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::FractionofAutosizedCoolingDesignCapacity);
238 ✗ if (value) {
239 ✗ sizingSystem.setFractionofAutosizedCoolingDesignCapacity(value.get());
240 }
241
242 // HeatingDesignCapacityMethod
243 ✗ s = workspaceObject.getString(Sizing_SystemFields::HeatingDesignCapacityMethod);
244 ✗ if (s) {
245 ✗ sizingSystem.setHeatingDesignCapacityMethod(s.get());
246 }
247
248 // HeatingDesignCapacity
249 ✗ s = workspaceObject.getString(Sizing_SystemFields::HeatingDesignCapacity);
250 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::HeatingDesignCapacity);
251 ✗ if (value) {
252 ✗ sizingSystem.setHeatingDesignCapacity(value.get());
253 ✗ } else if (s && istringEqual(s.get(), "Autosize")) {
254 ✗ sizingSystem.autosizeHeatingDesignCapacity();
255 }
256
257 // HeatingDesignCapacityPerFloorArea
258 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::HeatingDesignCapacityPerFloorArea);
259 ✗ if (value) {
260 ✗ sizingSystem.setHeatingDesignCapacityPerFloorArea(value.get());
261 }
262
263 // FractionofAutosizedHeatingDesignCapacity
264 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::FractionofAutosizedHeatingDesignCapacity);
265 ✗ if (value) {
266 ✗ sizingSystem.setFractionofAutosizedHeatingDesignCapacity(value.get());
267 }
268
269 // CentralCoolingCapacityControlMethod
270 ✗ s = workspaceObject.getString(Sizing_SystemFields::CentralCoolingCapacityControlMethod);
271 ✗ if (s) {
272 ✗ sizingSystem.setCentralCoolingCapacityControlMethod(s.get());
273 }
274
275 // OccupantDiversity
276 ✗ s = workspaceObject.getString(Sizing_SystemFields::OccupantDiversity);
277 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::OccupantDiversity);
278 ✗ if (value) {
279 ✗ sizingSystem.setOccupantDiversity(value.get());
280 ✗ } else if (s && istringEqual(s.get(), "Autosize")) {
281 ✗ sizingSystem.autosizeOccupantDiversity();
282 }
283
284 // HeatingCoilSizingMethod
285 ✗ s = workspaceObject.getString(Sizing_SystemFields::HeatingCoilSizingMethod);
286 ✗ if (s) {
287 ✗ sizingSystem.setHeatingCoilSizingMethod(s.get());
288 }
289
290 // MaximumHeatingCapacityToCoolingCapacitySizingRatio
291 ✗ value = workspaceObject.getDouble(Sizing_SystemFields::MaximumHeatingCapacityToCoolingCapacitySizingRatio);
292 ✗ if (value) {
293 ✗ sizingSystem.setMaximumHeatingCapacityToCoolingCapacitySizingRatio(value.get());
294 }
295
296 ✗ return sizingSystem;
297 ✗ }
298
299 } // namespace energyplus
300
301 } // namespace openstudio
302