GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 67.6% 1273 / 0 / 1882
Functions: 68.9% 246 / 0 / 357
Branches: 56.7% 1423 / 0 / 2511

src/model/ThermalZone.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 "ThermalZone.hpp"
7 #include "ThermalZone_Impl.hpp"
8 #include "AirLoopHVACSupplyPlenum.hpp"
9 #include "AirLoopHVACSupplyPlenum_Impl.hpp"
10 #include "AirTerminalSingleDuctParallelPIUReheat.hpp"
11 #include "AirTerminalSingleDuctParallelPIUReheat_Impl.hpp"
12 #include "AirTerminalSingleDuctSeriesPIUReheat.hpp"
13 #include "AirTerminalSingleDuctSeriesPIUReheat_Impl.hpp"
14 #include "AirTerminalSingleDuctConstantVolumeFourPipeInduction.hpp"
15 #include "AirTerminalSingleDuctConstantVolumeFourPipeInduction_Impl.hpp"
16 #include "AirLoopHVACReturnPlenum.hpp"
17 #include "AirLoopHVACReturnPlenum_Impl.hpp"
18 #include "ZoneHVACEquipmentList.hpp"
19 #include "ZoneHVACEquipmentList_Impl.hpp"
20 #include "Model.hpp"
21 #include "Model_Impl.hpp"
22 #include "Building.hpp"
23 #include "Building_Impl.hpp"
24 #include "SizingZone.hpp"
25 #include "SizingZone_Impl.hpp"
26 #include "BuildingStory.hpp"
27 #include "BuildingStory_Impl.hpp"
28 #include "SpaceType.hpp"
29 #include "SpaceType_Impl.hpp"
30 #include "DefaultConstructionSet.hpp"
31 #include "DefaultConstructionSet_Impl.hpp"
32 #include "DefaultScheduleSet.hpp"
33 #include "DefaultScheduleSet_Impl.hpp"
34 #include "Space.hpp"
35 #include "Space_Impl.hpp"
36 #include "SpaceLoad.hpp"
37 #include "SpaceLoad_Impl.hpp"
38 #include "Surface.hpp"
39 #include "Surface_Impl.hpp"
40 #include "InteriorPartitionSurfaceGroup.hpp"
41 #include "InteriorPartitionSurfaceGroup_Impl.hpp"
42 #include "InteriorPartitionSurface.hpp"
43 #include "InteriorPartitionSurface_Impl.hpp"
44 #include "ConstructionBase.hpp"
45 #include "ConstructionBase_Impl.hpp"
46 #include "DaylightingControl.hpp"
47 #include "DaylightingControl_Impl.hpp"
48 #include "IlluminanceMap.hpp"
49 #include "IlluminanceMap_Impl.hpp"
50 #include "RenderingColor.hpp"
51 #include "RenderingColor_Impl.hpp"
52 #include "Node.hpp"
53 #include "Node_Impl.hpp"
54 #include "PortList.hpp"
55 #include "PortList_Impl.hpp"
56 #include "AirLoopHVAC.hpp"
57 #include "AirLoopHVAC_Impl.hpp"
58 #include "Thermostat.hpp"
59 #include "Thermostat_Impl.hpp"
60 #include "ThermostatSetpointDualSetpoint.hpp"
61 #include "ThermostatSetpointDualSetpoint_Impl.hpp"
62 #include "ZoneControlContaminantController.hpp"
63 #include "ZoneControlContaminantController_Impl.hpp"
64 #include "ZoneControlHumidistat.hpp"
65 #include "ZoneControlHumidistat_Impl.hpp"
66 #include "DesignSpecificationOutdoorAir.hpp"
67 #include "DesignSpecificationOutdoorAir_Impl.hpp"
68 #include "Schedule.hpp"
69 #include "Schedule_Impl.hpp"
70 #include "ScheduleConstant.hpp"
71 #include "ScheduleConstant_Impl.hpp"
72 #include "AirLoopHVACZoneSplitter.hpp"
73 #include "AirLoopHVACZoneSplitter_Impl.hpp"
74 #include "AirLoopHVACZoneMixer.hpp"
75 #include "AirLoopHVACZoneMixer_Impl.hpp"
76 #include "LifeCycleCost.hpp"
77 #include "LifeCycleCost_Impl.hpp"
78 #include "SetpointManagerSingleZoneReheat.hpp"
79 #include "SetpointManagerSingleZoneReheat_Impl.hpp"
80 #include "SetpointManagerSingleZoneCooling.hpp"
81 #include "SetpointManagerSingleZoneCooling_Impl.hpp"
82 #include "SetpointManagerSingleZoneHeating.hpp"
83 #include "SetpointManagerSingleZoneHeating_Impl.hpp"
84 #include "ZoneMixing.hpp"
85 #include "ZoneMixing_Impl.hpp"
86 #include "AirflowNetworkZone.hpp"
87 #include "AirflowNetworkZone_Impl.hpp"
88 #include "ZonePropertyUserViewFactorsBySurfaceName.hpp"
89 #include "ZonePropertyUserViewFactorsBySurfaceName_Impl.hpp"
90 #include "ZoneMRTCalculation.hpp"
91 #include "ZoneMRTCalculation_Impl.hpp"
92 #include "ScheduleTypeLimits.hpp"
93 #include "ScheduleTypeRegistry.hpp"
94
95 #include "../utilities/core/Assert.hpp"
96 #include "../utilities/core/ContainersMove.hpp"
97 #include "../utilities/data/DataEnums.hpp"
98 #include "../utilities/geometry/Transformation.hpp"
99 #include "../utilities/geometry/Geometry.hpp"
100 #include "../utilities/geometry/Point3d.hpp"
101 #include "../utilities/geometry/Vector3d.hpp"
102 #include "../utilities/math/FloatCompare.hpp"
103 #include "../utilities/sql/SqlFile.hpp"
104
105 #include <utilities/idd/IddFactory.hxx>
106 #include <utilities/idd/OS_ThermalZone_FieldEnums.hxx>
107 #include <utilities/idd/IddEnums.hxx>
108
109 #include <fmt/format.h>
110
111 #include <algorithm>
112
113 namespace openstudio {
114 namespace model {
115
116 namespace detail {
117
118 3719 ThermalZone_Impl::ThermalZone_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
119 3719 : HVACComponent_Impl(idfObject, model, keepHandle) {
120
4/6
✓ Branch 1 taken 3719 times.
✓ Branch 4 taken 3719 times.
✓ Branch 7 taken 3719 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 3719 times.
✗ Branch 13 not taken.
3719 OS_ASSERT(idfObject.iddObject().type() == ThermalZone::iddObjectType());
121 3719 }
122
123 1357 ThermalZone_Impl::ThermalZone_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
124 1357 : HVACComponent_Impl(other, model, keepHandle) {
125
4/6
✓ Branch 1 taken 1357 times.
✓ Branch 4 taken 1357 times.
✓ Branch 7 taken 1357 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1357 times.
✗ Branch 13 not taken.
1357 OS_ASSERT(other.iddObject().type() == ThermalZone::iddObjectType());
126 1357 }
127
128 631 ThermalZone_Impl::ThermalZone_Impl(const ThermalZone_Impl& other, Model_Impl* model, bool keepHandle)
129 631 : HVACComponent_Impl(other, model, keepHandle) {}
130
131 16 boost::optional<ParentObject> ThermalZone_Impl::parent() const {
132
3/3
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
16 return boost::optional<ParentObject>(this->model().building());
133 }
134
135 566 std::vector<ModelObject> ThermalZone_Impl::children() const {
136 566 std::vector<ModelObject> result;
137
138 // Sizing Zone object
139
2/2
✓ Branch 1 taken 566 times.
✓ Branch 4 taken 566 times.
566 result.emplace_back(this->sizingZone());
140
141 // DLM: temporarily add supplyZoneMixing as children so we can see them in IG
142 // remove once we have gridview for these
143
2/2
✓ Branch 1 taken 566 times.
✓ Branch 4 taken 566 times.
566 openstudio::detail::concat_helper(result, this->supplyZoneMixing());
144
145
1/1
✓ Branch 1 taken 566 times.
566 boost::optional<AirflowNetworkZone> afnz = airflowNetworkZone();
146
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 566 times.
566 if (afnz) {
147 ✗ result.emplace_back(afnz.get());
148 }
149
150
3/4
✓ Branch 1 taken 566 times.
✓ Branch 4 taken 566 times.
✓ Branch 8 taken 566 times.
✗ Branch 9 not taken.
1132 if (boost::optional<ZoneHVACEquipmentList> z_eq = this->zoneHVACEquipmentList()) {
151
2/2
✓ Branch 1 taken 566 times.
✓ Branch 4 taken 566 times.
566 result.emplace_back(z_eq.get());
152 566 }
153
154 1132 return result;
155 566 }
156
157 ✗ bool ThermalZone_Impl::setParent(ParentObject& newParent) {
158 ✗ bool result = false;
159 ✗ if (newParent.optionalCast<Building>()) {
160 ✗ result = (this->model() == newParent.model());
161 }
162 ✗ return result;
163 }
164
165 ✗ std::vector<IddObjectType> ThermalZone_Impl::allowableChildTypes() const {
166 // DLM: this does not seem to agree with implementation of children()
167 return {
168 IddObjectType::OS_ThermostatSetpoint_DualSetpoint,
169 IddObjectType::OS_ZoneControl_Thermostat_StagedDualSetpoint,
170 IddObjectType::OS_ZoneHVAC_EquipmentList,
171 ✗ };
172 }
173
174 179 const std::vector<std::string>& ThermalZone_Impl::outputVariableNames() const {
175 static const std::vector<std::string> result{
176
177 /*
178 * Zone Thermal Output
179 */
180
181 // Outdoor
182 "Zone Outdoor Air Drybulb Temperature", "Zone Outdoor Air Wetbulb Temperature", "Zone Outdoor Air Wind Speed",
183
184 // Internal
185 "Zone Total Internal Radiant Heating Energy", "Zone Total Internal Radiant Heating Rate",
186 "Zone Total Internal Visible Radiation Heating Energy", "Zone Total Internal Visible Radiation Heating Rate",
187 "Zone Total Internal Convective Heating Energy", "Zone Total Internal Convective Heating Rate", "Zone Total Internal Latent Gain Energy",
188 "Zone Total Internal Latent Gain Rate", "Zone Total Internal Total Heating Energy", "Zone Total Internal Total Heating Rate",
189
190 // Temperatures and RH
191 "Zone Mean Air Temperature", // Zone level
192 "Zone Air Temperature", // HVAC level
193 "Zone Mean Air Dewpoint Temperature", "Zone Mean Radiant Temperature", "Zone Standard Mean Radiant Temperature", "Zone Operative Temperature",
194 "Zone Air Humidity Ratio", "Zone Air Relative Humidity",
195
196 // Heat Balance
197 "Zone Air Heat Balance Internal Convective Heat Gain Rate", "Zone Air Heat Balance Surface Convection Rate",
198 "Zone Air Heat Balance Interzone Air Transfer Rate", "Zone Air Heat Balance Outdoor Air Transfer Rate",
199 "Zone Air Heat Balance System Air Transfer Rate", "Zone Air Heat Balance System Convective Heat Gain Rate",
200 "Zone Air Heat Balance Air Energy Storage Rate", "Zone Air Heat Balance Deviation Rate",
201
202 // Air System
203 "Zone Air System Sensible Heating Energy", "Zone Air System Sensible Cooling Energy", "Zone Air System Sensible Heating Rate",
204 "Zone Air System Sensible Cooling Rate",
205
206 /*
207 * Zone Outputs from LOADS: Equipment, People, Lights
208 */
209
210 // TODO:: All of this section should be dynamic (if no ElectricEquipment, don't propose the output...)
211
212 // Electric Equipment
213 "Zone Electric Equipment Electricity Rate", "Zone Electric Equipment Electricity Energy", "Zone Electric Equipment Radiant Heating Energy",
214 "Zone Electric Equipment Radiant Heating Rate", "Zone Electric Equipment Convective Heating Energy",
215 "Zone Electric Equipment Convective Heating Rate", "Zone Electric Equipment Latent Gain Energy", "Zone Electric Equipment Latent Gain Rate",
216 "Zone Electric Equipment Lost Heat Energy", "Zone Electric Equipment Lost Heat Rate", "Zone Electric Equipment Total Heating Energy",
217 "Zone Electric Equipment Total Heating Rate",
218
219 // Gas Equipment
220 "Zone Gas Equipment NaturalGas Rate", "Zone Gas Equipment NaturalGas Energy", "Zone Gas Equipment Radiant Heating Energy",
221 "Zone Gas Equipment Radiant Heating Rate", "Zone Gas Equipment Convective Heating Energy", "Zone Gas Equipment Convective Heating Rate",
222 "Zone Gas Equipment Latent Gain Energy", "Zone Gas Equipment Latent Gain Rate", "Zone Gas Equipment Lost Heat Energy",
223 "Zone Gas Equipment Lost Heat Rate", "Zone Gas Equipment Total Heating Energy", "Zone Gas Equipment Total Heating Rate",
224
225 // HotWater Equipment
226 "Zone Hot Water Equipment District Heating Rate", "Zone Hot Water Equipment District Heating Energy",
227 "Zone Hot Water Equipment Radiant Heating Energy", "Zone Hot Water Equipment Radiant Heating Rate",
228 "Zone Hot Water Equipment Convective Heating Energy", "Zone Hot Water Equipment Convective Heating Rate",
229 "Zone Hot Water Equipment Latent Gain Energy", "Zone Hot Water Equipment Latent Gain Rate", "Zone Hot Water Equipment Lost Heat Energy",
230 "Zone Hot Water Equipment Lost Heat Rate", "Zone Hot Water Equipment Total Heating Energy", "Zone Hot Water Equipment Total Heating Rate",
231
232 // IT Equipment
233 "Zone ITE Adjusted Return Air Temperature ", "Zone ITE CPU Electricity Rate ", "Zone ITE Fan Electricity Rate ",
234 "Zone ITE UPS Electricity Rate ", "Zone ITE CPU Electricity Rate at Design Inlet Conditions ",
235 "Zone ITE Fan Electricity Rate at Design Inlet Conditions ", "Zone ITE UPS Heat Gain to Zone Rate ", "Zone ITE Total Heat Gain to Zone Rate ",
236 "Zone ITE CPU Electricity Energy ", "Zone ITE Fan Electricity Energy ", "Zone ITE UPS Electricity Energy ",
237 "Zone ITE CPU Electricity Energy at Design Inlet Conditions ", "Zone ITE Fan Electricity Energy at Design Inlet Conditions ",
238 "Zone ITE UPS Heat Gain to Zone Energy ", "Zone ITE Total Heat Gain to Zone Energy ", "Zone ITE Standard Density Air Volume Flow Rate ",
239 "Zone ITE Air Mass Flow Rate ", "Zone ITE Average Supply Heat Index ", "Zone ITE Any Air Inlet Operating Range Exceeded Time ",
240 "Zone ITE Any Air Inlet Dry-Bulb Temperature Above Operating Range Time ",
241 "Zone ITE Any Air Inlet Dry-Bulb Temperature Below Operating Range Time ",
242 "Zone ITE Any Air Inlet Dewpoint Temperature Above Operating Range Time ",
243 "Zone ITE Any Air Inlet Dewpoint Temperature Below Operating Range Time ",
244 "Zone ITE Any Air Inlet Relative Humidity Above Operating Range Time ",
245 "Zone ITE Any Air Inlet Relative Humidity Below Operating Range Time ",
246
247 // Lights
248 // TODO: if zone.spaces.select{|s| s.lights.size > 0}.size > 0
249 "Zone Lights Electricity Rate", "Zone Lights Radiant Heating Energy", "Zone Lights Radiant Heating Rate",
250 "Zone Lights Visible Radiation Heating Energy", "Zone Lights Visible Radiation Heating Rate", "Zone Lights Convective Heating Energy",
251 "Zone Lights Convective Heating Rate", "Zone Lights Return Air Heating Energy", "Zone Lights Return Air Heating Rate",
252 "Zone Lights Total Heating Energy", "Zone Lights Total Heating Rate", "Zone Lights Electricity Energy",
253
254 // OtherEquipment
255 "Zone Other Equipment Radiant Heating Energy", "Zone Other Equipment Radiant Heating Rate", "Zone Other Equipment Convective Heating Energy",
256 "Zone Other Equipment Convective Heating Rate", "Zone Other Equipment Latent Gain Energy", "Zone Other Equipment Latent Gain Rate",
257 "Zone Other Equipment Lost Heat Energy", "Zone Other Equipment Lost Heat Rate", "Zone Other Equipment Total Heating Energy",
258 "Zone Other Equipment Total Heating Rate",
259
260 // People
261 "Zone People Occupant Count", "Zone People Radiant Heating Energy", "Zone People Radiant Heating Rate",
262 "Zone People Convective Heating Energy", "Zone People Convective Heating Rate", "Zone People Sensible Heating Energy",
263 "Zone People Sensible Heating Rate", "Zone People Latent Gain Energy", "Zone People Latent Gain Rate", "Zone People Total Heating Energy",
264 "Zone People Total Heating Rate",
265
266 // TODO: check if has thermal comfort enabled
267 // Ruby pseudo code...
268 //zone.spaces.each do |s|
269 //next if s.people.size == 0
270 //s.people.each do |p|
271 //pd = p.peopleDefinition
272 //next if pd.numThermalComfortModelTypes == 0
273 //for i in (0..pd.numThermalComfortModelTypes-1)
274 //t = pd.getThermalComfortModelType(i)
275 //if t in ["Fanger", "Pierce", "KSU", "AdaptiveASH55", "AdaptiveCEN15251"]
276 //puts t
277 //end
278 //end
279 //end
280 //end
281 // JM: Not sure which model outputs these, maybe all
282 "Zone Thermal Comfort Mean Radiant Temperature", "Zone Thermal Comfort Operative Temperature",
283 "Zone Thermal Comfort Clothing Surface Temperature",
284 // if Fanger
285 "Zone Thermal Comfort Fanger Model PMV", "Zone Thermal Comfort Fanger Model PPD",
286 // if Pierce
287 "Zone Thermal Comfort Pierce Model Effective Temperature PMV", "Zone Thermal Comfort Pierce Model Standard Effective Temperature PMV",
288 "Zone Thermal Comfort Pierce Model Discomfort Index", "Zone Thermal Comfort Pierce Model Thermal Sensation Index",
289 // if KSU
290 "Zone Thermal Comfort KSU Model Thermal Sensation Index",
291 // if AdaptiveASH55
292 "Zone Thermal Comfort ASHRAE 55 Adaptive Model 80% Acceptability Status",
293 "Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status",
294 "Zone Thermal Comfort ASHRAE 55 Adaptive Model Running Average Outdoor Air Temperature",
295 "Zone Thermal Comfort ASHRAE 55 Adaptive Model Temperature",
296 // if AdaptiveCEN15251
297 "Zone Thermal Comfort CEN 15251 Adaptive Model Category I Status", "Zone Thermal Comfort CEN 15251 Adaptive Model Category II Status",
298 "Zone Thermal Comfort CEN 15251 Adaptive Model Category III Status",
299 "Zone Thermal Comfort CEN 15251 Adaptive Model Running Average Outdoor Air Temperature",
300 "Zone Thermal Comfort CEN 15251 Adaptive Model Temperature",
301
302 // Steam Equipment
303 "Zone Steam Equipment District Heating Rate", "Zone Steam Equipment District Heating Energy", "Zone Steam Equipment Radiant Heating Energy",
304 "Zone Steam Equipment Radiant Heating Rate", "Zone Steam Equipment Convective Heating Energy", "Zone Steam Equipment Convective Heating Rate",
305 "Zone Steam Equipment Latent Gain Energy", "Zone Steam Equipment Latent Gain Rate", "Zone Steam Equipment Lost Heat Energy",
306 "Zone Steam Equipment Lost Heat Rate", "Zone Steam Equipment Total Heating Energy", "Zone Steam Equipment Total Heating Rate",
307
308 /*
309 * Zone Outputs from Daylighting Controls
310 */
311
312 "Daylighting Lighting Power Multiplier",
313
314 // DLM: this is a static list so no dynamic
315 //if (primaryDaylightingControl()){
316 "Daylighting Reference Point 1 Illuminance", "Daylighting Reference Point 1 Glare Index",
317 "Daylighting Reference Point 1 Glare Index Setpoint Exceeded Time",
318 "Daylighting Reference Point 1 Daylight Illuminance Setpoint Exceeded Time",
319 //}
320
321 //if (secondaryDaylightingControl()){
322 "Daylighting Reference Point 2 Illuminance", "Daylighting Reference Point 2 Glare Index",
323 "Daylighting Reference Point 2 Glare Index Setpoint Exceeded Time",
324 "Daylighting Reference Point 2 Daylight Illuminance Setpoint Exceeded Time",
325 //}
326
327 /*
328 * Zone Outputs from Surfaces
329 */
330
331 // Opaque
332 // Output variables applicable to opaque heat transfer surfaces (FLOOR, WALL, ROOF, DOOR).
333 // if Output:Diagnostics is used
334 //"Zone Opaque Surface Inside Face Conduction",
335 //"Zone Opaque Surface Inside Faces Total Conduction Heat Gain Rate",
336 //"Zone Opaque Surface Inside Faces Total Conduction Heat Loss Rate",
337 //"Zone Opaque Surface Inside Faces Total Conduction Heat Gain Energy",
338 //"Zone Opaque Surface Inside Faces Total Conduction Heat Loss Energy",
339 //"Zone Opaque Surface Outside Face Conduction",
340 //"Zone Opaque Surface Outside Face Conduction Gain",
341 //"Zone Opaque Surface Outside Face Conduction Loss",
342
343 // Window
344 "Zone Windows Total Transmitted Solar Radiation Rate", "Zone Windows Total Transmitted Solar Radiation Energy",
345
346 "Zone Windows Total Heat Gain Rate", "Zone Windows Total Heat Gain Energy", "Zone Windows Total Heat Loss Rate",
347 "Zone Windows Total Heat Loss Energy",
348
349 "Zone Exterior Windows Total Transmitted Beam Solar Radiation Rate", "Zone Exterior Windows Total Transmitted Beam Solar Radiation Energy",
350 "Zone Exterior Windows Total Transmitted Diffuse Solar Radiation Rate",
351 "Zone Exterior Windows Total Transmitted Diffuse Solar Radiation Energy",
352
353 "Zone Interior Windows Total Transmitted Beam Solar Radiation Rate", "Zone Interior Windows Total Transmitted Beam Solar Radiation Energy",
354 "Zone Interior Windows Total Transmitted Diffuse Solar Radiation Rate",
355 "Zone Interior Windows Total Transmitted Diffuse Solar Radiation Energy",
356
357 /*
358 * Zone Outputs from other
359 */
360
361 // Infiltration
362 // If infiltration is used
363 "Zone Infiltration Sensible Heat Loss Energy", "Zone Infiltration Sensible Heat Gain Energy", "Zone Infiltration Latent Heat Loss Energy",
364 "Zone Infiltration Latent Heat Gain Energy", "Zone Infiltration Total Heat Loss Energy", "Zone Infiltration Total Heat Gain Energy",
365 "Zone Infiltration Current Density Volume Flow Rate", "Zone Infiltration Standard Density Volume Flow Rate",
366 "Zone Infiltration Current Density Volume", "Zone Infiltration Standard Density Volume", "Zone Infiltration Mass",
367 "Zone Infiltration Mass Flow Rate", "Zone Infiltration Current Density Air Change Rate", "Zone Infiltration Outdoor Density Volume Flow Rate",
368 "Zone Infiltration Standard Density Air Change Rate", "Zone Infiltration Outdoor Density Air Change Rate",
369
370 // ZoneVentilation:DesignFlowRate
371 "Zone Ventilation Sensible Heat Loss Energy", "Zone Ventilation Sensible Heat Gain Energy", "Zone Ventilation Latent Heat Loss Energy",
372 "Zone Ventilation Latent Heat Gain Energy", "Zone Ventilation Total Heat Loss Energy", "Zone Ventilation Total Heat Gain Energy",
373 "Zone Ventilation Current Density Volume Flow Rate", "Zone Ventilation Standard Density Volume Flow Rate",
374 "Zone Ventilation Current Density Volume", "Zone Ventilation Standard Density Volume", "Zone Ventilation Mass",
375 "Zone Ventilation Mass Flow Rate", "Zone Ventilation Current Density Air Change Rate", "Zone Ventilation Fan Electricity Energy",
376 "Zone Ventilation Air Inlet Temperature", "Zone Ventilation Outdoor Density Volume Flow Rate",
377 "Zone Ventilation Standard Density Air Change Rate", "Zone Ventilation Outdoor Density Air Change Rate",
378
379 "Zone Predicted Sensible Load to Setpoint Heat Transfer Rate", "Zone Predicted Sensible Load to Heating Setpoint Heat Transfer Rate",
380 "Zone Predicted Sensible Load to Cooling Setpoint Heat Transfer Rate", "Zone Predicted Moisture Load Moisture Transfer Rate",
381 "Zone Predicted Moisture Load to Humidifying Setpoint Moisture Transfer Rate",
382 "Zone Predicted Moisture Load to Dehumidifying Setpoint Moisture Transfer Rate",
383
384 "Zone Thermostat Control Type", "Zone Thermostat Heating Setpoint Temperature", "Zone Thermostat Cooling Setpoint Temperature",
385
386 "Zone Mechanical Ventilation No Load Heat Removal Energy", "Zone Mechanical Ventilation Cooling Load Increase Energy",
387 "Zone Mechanical Ventilation Cooling Load Increase Energy Due to Overheating Energy",
388 "Zone Mechanical Ventilation Cooling Load Decrease Energy", "Zone Mechanical Ventilation No Load Heat Addition Energy",
389 "Zone Mechanical Ventilation No Load Heat Removal Energy", "Zone Mechanical Ventilation Cooling Load Increase Energy",
390 "Zone Mechanical Ventilation Cooling Load Increase Energy Due to Overheating Energy",
391 "Zone Mechanical Ventilation Cooling Load Decrease Energy", "Zone Mechanical Ventilation No Load Heat Addition Energy",
392 "Zone Mechanical Ventilation Heating Load Increase Energy",
393 "Zone Mechanical Ventilation Heating Load Increase Energy Due to Overcooling Energy",
394 "Zone Mechanical Ventilation Heating Load Decrease Energy", "Zone Mechanical Ventilation Mass Flow Rate", "Zone Mechanical Ventilation Mass",
395 "Zone Mechanical Ventilation Standard Density Volume Flow Rate", "Zone Mechanical Ventilation Standard Density Volume",
396 "Zone Mechanical Ventilation Current Density Volume Flow Rate", "Zone Mechanical Ventilation Current Density Volume",
397 "Zone Mechanical Ventilation Air Changes per Hour",
398
399 // ZoneContaminantAirBalance
400 // The following output variables are available when Carbon Dioxide Concentration = Yes.
401 "Zone Air CO2 Internal Gain Volume Flow Rate", "Zone Air CO2 Concentration",
402 // The following output variable is available when Generic Contaminant Concentration = Yes.
403 "Zone Generic Air Contaminant Generation Volume Flow Rate", "Zone Air Generic Air Contaminant Concentration",
404
405 // Refrigeration:AirChiller
406 // TODO: implement test to see if AirChiller.
407 "Refrigeration Zone Air Chiller Sensible Cooling Rate", "Refrigeration Zone Air Chiller Sensible Cooling Energy",
408 "Refrigeration Zone Air Chiller Heating Rate", "Refrigeration Zone Air Chiller Heating Energy",
409 "Refrigeration Zone Air Chiller Latent Cooling Rate", "Refrigeration Zone Air Chiller Latent Cooling Energy",
410 "Refrigeration Zone Air Chiller Total Cooling Rate", "Refrigeration Zone Air Chiller Total Cooling Energy",
411 "Refrigeration Zone Air Chiller Water Removed Mass Flow Rate",
412
413 // RefrigerationWalkin
414 // TODO: test
415 "Refrigeration Walk In Zone Sensible Cooling Rate", "Refrigeration Walk In Zone Sensible Cooling Energy",
416 "Refrigeration Walk In Zone Sensible Heating Rate", "Refrigeration Walk In Zone Sensible Heating Energy",
417 "Refrigeration Walk In Zone Latent Rate", "Refrigeration Walk In Zone Latent Energy"
418
419
6/11
✓ Branch 0 taken 165 times.
✓ Branch 1 taken 14 times.
✓ Branch 3 taken 165 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 165 times.
✓ Branch 10 taken 43395 times.
✓ Branch 11 taken 165 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
43904 };
420 179 return result;
421 495 }
422
423 6627 IddObjectType ThermalZone_Impl::iddObjectType() const {
424 6627 return ThermalZone::iddObjectType();
425 }
426
427 6045 std::vector<HVACComponent> ThermalZone_Impl::edges(const boost::optional<HVACComponent>& /*prev*/) {
428
3/3
✓ Branch 1 taken 6045 times.
✓ Branch 4 taken 6045 times.
✓ Branch 7 taken 6045 times.
6045 return subsetCastVector<HVACComponent>(returnPortList().modelObjects());
429 }
430
431 ✗ std::vector<ScheduleTypeKey> ThermalZone_Impl::getScheduleTypeKeys(const Schedule& schedule) const {
432 ✗ std::vector<ScheduleTypeKey> result;
433 ✗ UnsignedVector fieldIndices = getSourceIndices(schedule.handle());
434 ✗ UnsignedVector::const_iterator b(fieldIndices.begin());
435 ✗ UnsignedVector::const_iterator e(fieldIndices.end());
436 ✗ if (std::find(b, e, OS_ThermalZoneFields::DaylightingControlsAvailabilityScheduleName) != e) {
437 ✗ result.emplace_back("ThermalZone", "Daylighting Controls Availability");
438 }
439 ✗ return result;
440 ✗ }
441
442 3536 int ThermalZone_Impl::multiplier() const {
443
1/1
✓ Branch 1 taken 3536 times.
3536 boost::optional<int> value = getInt(OS_ThermalZoneFields::Multiplier, true);
444
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 3536 times.
✗ Branch 4 not taken.
3536 OS_ASSERT(value);
445
1/1
✓ Branch 1 taken 3536 times.
7072 return value.get();
446 }
447
448 42 bool ThermalZone_Impl::isMultiplierDefaulted() const {
449 42 return isEmpty(OS_ThermalZoneFields::Multiplier);
450 }
451
452 431 boost::optional<double> ThermalZone_Impl::ceilingHeight() const {
453 431 return getDouble(OS_ThermalZoneFields::CeilingHeight, true);
454 }
455
456 42 bool ThermalZone_Impl::isCeilingHeightDefaulted() const {
457 42 return isEmpty(OS_ThermalZoneFields::CeilingHeight);
458 }
459
460 ✗ bool ThermalZone_Impl::isCeilingHeightAutocalculated() const {
461 ✗ bool result = false;
462 ✗ boost::optional<std::string> value = getString(OS_ThermalZoneFields::CeilingHeight, true);
463 ✗ if (value) {
464 ✗ result = openstudio::istringEqual(value.get(), "autocalculate");
465 }
466 ✗ return result;
467 ✗ }
468
469 440 boost::optional<double> ThermalZone_Impl::volume() const {
470 440 return getDouble(OS_ThermalZoneFields::Volume, true);
471 }
472
473 42 bool ThermalZone_Impl::isVolumeDefaulted() const {
474 42 return isEmpty(OS_ThermalZoneFields::Volume);
475 }
476
477 ✗ bool ThermalZone_Impl::isVolumeAutocalculated() const {
478 ✗ bool result = false;
479 ✗ boost::optional<std::string> value = getString(OS_ThermalZoneFields::Volume, true);
480 ✗ if (value) {
481 ✗ result = openstudio::istringEqual(value.get(), "autocalculate");
482 }
483 ✗ return result;
484 ✗ }
485
486 850 boost::optional<std::string> ThermalZone_Impl::zoneInsideConvectionAlgorithm() const {
487 850 return getString(OS_ThermalZoneFields::ZoneInsideConvectionAlgorithm, true);
488 }
489
490 850 boost::optional<std::string> ThermalZone_Impl::zoneOutsideConvectionAlgorithm() const {
491 850 return getString(OS_ThermalZoneFields::ZoneOutsideConvectionAlgorithm, true);
492 }
493
494 ✗ std::string ThermalZone_Impl::zoneConditioningEquipmentListName() const {
495 ✗ boost::optional<std::string> value = getString(OS_ThermalZoneFields::ZoneConditioningEquipmentListName, true);
496 ✗ OS_ASSERT(value);
497 ✗ return value.get();
498 ✗ }
499
500 66 double ThermalZone_Impl::fractionofZoneControlledbyPrimaryDaylightingControl() const {
501
1/1
✓ Branch 1 taken 66 times.
66 boost::optional<double> value = getDouble(OS_ThermalZoneFields::FractionofZoneControlledbyPrimaryDaylightingControl, true);
502
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 66 times.
✗ Branch 4 not taken.
66 OS_ASSERT(value);
503
1/1
✓ Branch 1 taken 66 times.
132 return value.get();
504 }
505
506 ✗ bool ThermalZone_Impl::isFractionofZoneControlledbyPrimaryDaylightingControlDefaulted() const {
507 ✗ return isEmpty(OS_ThermalZoneFields::FractionofZoneControlledbyPrimaryDaylightingControl);
508 }
509
510 216 double ThermalZone_Impl::fractionofZoneControlledbySecondaryDaylightingControl() const {
511
1/1
✓ Branch 1 taken 216 times.
216 boost::optional<double> value = getDouble(OS_ThermalZoneFields::FractionofZoneControlledbySecondaryDaylightingControl, true);
512
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 216 times.
✗ Branch 4 not taken.
216 OS_ASSERT(value);
513
1/1
✓ Branch 1 taken 216 times.
432 return value.get();
514 }
515
516 ✗ bool ThermalZone_Impl::isFractionofZoneControlledbySecondaryDaylightingControlDefaulted() const {
517 ✗ return isEmpty(OS_ThermalZoneFields::FractionofZoneControlledbySecondaryDaylightingControl);
518 }
519
520 1295 bool ThermalZone_Impl::setMultiplier(int multiplier) {
521 1295 bool result = setInt(OS_ThermalZoneFields::Multiplier, multiplier);
522 1295 return result;
523 }
524
525 ✗ void ThermalZone_Impl::resetMultiplier() {
526 ✗ bool result = setString(OS_ThermalZoneFields::Multiplier, "");
527 ✗ OS_ASSERT(result);
528 ✗ }
529
530 ✗ bool ThermalZone_Impl::setCeilingHeight(boost::optional<double> ceilingHeight) {
531 ✗ bool result = false;
532 ✗ if (ceilingHeight) {
533 ✗ result = setDouble(OS_ThermalZoneFields::CeilingHeight, ceilingHeight.get());
534 } else {
535 ✗ result = setString(OS_ThermalZoneFields::CeilingHeight, "");
536 }
537 ✗ OS_ASSERT(result);
538 ✗ return result;
539 }
540
541 12 bool ThermalZone_Impl::setCeilingHeight(double ceilingHeight) {
542 12 bool result = setDouble(OS_ThermalZoneFields::CeilingHeight, ceilingHeight);
543
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
12 OS_ASSERT(result);
544 12 return result;
545 }
546
547 ✗ void ThermalZone_Impl::resetCeilingHeight() {
548 ✗ bool result = setString(OS_ThermalZoneFields::CeilingHeight, "");
549 ✗ OS_ASSERT(result);
550 ✗ }
551
552 ✗ void ThermalZone_Impl::autocalculateCeilingHeight() {
553 ✗ bool result = setString(OS_ThermalZoneFields::CeilingHeight, "autocalculate");
554 ✗ OS_ASSERT(result);
555 ✗ }
556
557 ✗ bool ThermalZone_Impl::setVolume(boost::optional<double> volume) {
558 ✗ bool result = false;
559 ✗ if (volume) {
560 ✗ result = setDouble(OS_ThermalZoneFields::Volume, volume.get());
561 } else {
562 ✗ result = setString(OS_ThermalZoneFields::Volume, "");
563 }
564 ✗ OS_ASSERT(result);
565 ✗ return result;
566 }
567
568 12 bool ThermalZone_Impl::setVolume(double volume) {
569 12 bool result = setDouble(OS_ThermalZoneFields::Volume, volume);
570
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
12 OS_ASSERT(result);
571 12 return result;
572 }
573
574 ✗ void ThermalZone_Impl::resetVolume() {
575 ✗ bool result = setString(OS_ThermalZoneFields::Volume, "");
576 ✗ OS_ASSERT(result);
577 ✗ }
578
579 ✗ void ThermalZone_Impl::autocalculateVolume() {
580 ✗ bool result = setString(OS_ThermalZoneFields::Volume, "autocalculate");
581 ✗ OS_ASSERT(result);
582 ✗ }
583
584 ✗ bool ThermalZone_Impl::setZoneInsideConvectionAlgorithm(boost::optional<std::string> zoneInsideConvectionAlgorithm) {
585 ✗ bool result = false;
586 ✗ if (zoneInsideConvectionAlgorithm) {
587 ✗ result = setString(OS_ThermalZoneFields::ZoneInsideConvectionAlgorithm, zoneInsideConvectionAlgorithm.get());
588 } else {
589 ✗ result = setString(OS_ThermalZoneFields::ZoneInsideConvectionAlgorithm, "");
590 }
591 ✗ return result;
592 }
593
594 50 bool ThermalZone_Impl::setZoneInsideConvectionAlgorithm(const std::string& zoneInsideConvectionAlgorithm) {
595 50 bool result = setString(OS_ThermalZoneFields::ZoneInsideConvectionAlgorithm, zoneInsideConvectionAlgorithm);
596 50 return result;
597 }
598
599 ✗ void ThermalZone_Impl::resetZoneInsideConvectionAlgorithm() {
600 ✗ bool result = setString(OS_ThermalZoneFields::ZoneInsideConvectionAlgorithm, "");
601 ✗ OS_ASSERT(result);
602 ✗ }
603
604 ✗ bool ThermalZone_Impl::setZoneOutsideConvectionAlgorithm(boost::optional<std::string> zoneOutsideConvectionAlgorithm) {
605 ✗ bool result = false;
606 ✗ if (zoneOutsideConvectionAlgorithm) {
607 ✗ result = setString(OS_ThermalZoneFields::ZoneOutsideConvectionAlgorithm, zoneOutsideConvectionAlgorithm.get());
608 } else {
609 ✗ result = setString(OS_ThermalZoneFields::ZoneOutsideConvectionAlgorithm, "");
610 }
611 ✗ return result;
612 }
613
614 50 bool ThermalZone_Impl::setZoneOutsideConvectionAlgorithm(const std::string& zoneOutsideConvectionAlgorithm) {
615 50 bool result = setString(OS_ThermalZoneFields::ZoneOutsideConvectionAlgorithm, zoneOutsideConvectionAlgorithm);
616 50 return result;
617 }
618
619 ✗ void ThermalZone_Impl::resetZoneOutsideConvectionAlgorithm() {
620 ✗ bool result = setString(OS_ThermalZoneFields::ZoneOutsideConvectionAlgorithm, "");
621 ✗ OS_ASSERT(result);
622 ✗ }
623
624 ✗ bool ThermalZone_Impl::setZoneConditioningEquipmentListName(const std::string& zoneConditioningEquipmentListName) {
625 ✗ bool result = setString(OS_ThermalZoneFields::ZoneConditioningEquipmentListName, zoneConditioningEquipmentListName);
626 ✗ OS_ASSERT(result);
627 ✗ return result;
628 }
629
630 203 bool ThermalZone_Impl::setFractionofZoneControlledbyPrimaryDaylightingControl(double fractionofZoneControlledbyPrimaryDaylightingControl) {
631
632 203 double secondaryFrac = fractionofZoneControlledbySecondaryDaylightingControl();
633
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 202 times.
203 if ((fractionofZoneControlledbyPrimaryDaylightingControl + secondaryFrac) > 1.0) {
634
9/9
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
1 LOG(Error, "Fraction of Zone Controlled by Secondary Daylight Control is " << secondaryFrac << " and you supplied a Primary Fraction of "
635 << fractionofZoneControlledbyPrimaryDaylightingControl
636 << " which would result in a sum greater than 1.0");
637 1 return false;
638 }
639 bool result =
640 202 setDouble(OS_ThermalZoneFields::FractionofZoneControlledbyPrimaryDaylightingControl, fractionofZoneControlledbyPrimaryDaylightingControl);
641 202 return result;
642 }
643
644 ✗ void ThermalZone_Impl::resetFractionofZoneControlledbyPrimaryDaylightingControl() {
645 ✗ bool result = setString(OS_ThermalZoneFields::FractionofZoneControlledbyPrimaryDaylightingControl, "");
646 ✗ OS_ASSERT(result);
647 ✗ }
648
649 3 bool ThermalZone_Impl::setFractionofZoneControlledbySecondaryDaylightingControl(double fractionofZoneControlledbySecondaryDaylightingControl) {
650 3 double primaryFrac = fractionofZoneControlledbyPrimaryDaylightingControl();
651
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
3 if ((fractionofZoneControlledbySecondaryDaylightingControl + primaryFrac) > 1.0) {
652
9/9
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
1 LOG(Error, "Fraction of Zone Controlled by Primary Daylight Control is " << primaryFrac << " and you supplied a Secondary Fraction of "
653 << fractionofZoneControlledbySecondaryDaylightingControl
654 << " which would result in a sum greater than 1.0");
655 1 return false;
656 }
657 bool result =
658 2 setDouble(OS_ThermalZoneFields::FractionofZoneControlledbySecondaryDaylightingControl, fractionofZoneControlledbySecondaryDaylightingControl);
659 2 return result;
660 }
661
662 ✗ void ThermalZone_Impl::resetFractionofZoneControlledbySecondaryDaylightingControl() {
663 ✗ bool result = setString(OS_ThermalZoneFields::FractionofZoneControlledbySecondaryDaylightingControl, "");
664 ✗ OS_ASSERT(result);
665 ✗ }
666
667 6646 PortList ThermalZone_Impl::returnPortList() const {
668
2/2
✓ Branch 1 taken 6646 times.
✓ Branch 4 taken 6646 times.
6646 boost::optional<PortList> pl = getObject<ModelObject>().getModelObjectTarget<PortList>(OS_ThermalZoneFields::ZoneReturnAirPortList);
669
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 6646 times.
✗ Branch 4 not taken.
6646 OS_ASSERT(pl);
670
2/2
✓ Branch 1 taken 6646 times.
✓ Branch 4 taken 6646 times.
13292 return pl.get();
671 6646 }
672
673 22 unsigned ThermalZone_Impl::returnAirPort() const {
674
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 return returnPortList().port(0);
675 }
676
677 2597 unsigned ThermalZone_Impl::zoneAirPort() const {
678 2597 return OS_ThermalZoneFields::ZoneAirNodeName;
679 }
680
681 22 OptionalModelObject ThermalZone_Impl::returnAirModelObject() const {
682
3/3
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
22 return returnPortList().connectedObject(this->returnAirPort());
683 }
684
685 2 std::vector<ModelObject> ThermalZone_Impl::returnAirModelObjects() const {
686
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 return returnPortList().modelObjects();
687 }
688
689 222 Node ThermalZone_Impl::zoneAirNode() const {
690
4/4
✓ Branch 1 taken 222 times.
✓ Branch 4 taken 222 times.
✓ Branch 7 taken 222 times.
✓ Branch 10 taken 222 times.
222 return this->connectedObject(this->zoneAirPort())->cast<Node>();
691 }
692
693 5027 boost::optional<DaylightingControl> ThermalZone_Impl::primaryDaylightingControl() const {
694
2/2
✓ Branch 1 taken 5027 times.
✓ Branch 4 taken 5027 times.
5027 return getObject<ModelObject>().getModelObjectTarget<DaylightingControl>(OS_ThermalZoneFields::PrimaryDaylightingControlName);
695 }
696
697 220 bool ThermalZone_Impl::setPrimaryDaylightingControl(const DaylightingControl& daylightingControl) {
698
4/4
✓ Branch 1 taken 220 times.
✓ Branch 4 taken 220 times.
✓ Branch 7 taken 220 times.
✓ Branch 10 taken 220 times.
220 return setDaylightingControlsAndIlluminanceMaps(daylightingControl, this->secondaryDaylightingControl(), this->illuminanceMap());
699 }
700
701 2919 void ThermalZone_Impl::resetPrimaryDaylightingControl() {
702
2/2
✓ Branch 1 taken 2919 times.
✓ Branch 4 taken 2919 times.
5838 bool test = setString(OS_ThermalZoneFields::PrimaryDaylightingControlName, "");
703
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2919 times.
2919 OS_ASSERT(test);
704 2919 resetSecondaryDaylightingControl();
705 2919 }
706
707 3454 boost::optional<DaylightingControl> ThermalZone_Impl::secondaryDaylightingControl() const {
708
2/2
✓ Branch 1 taken 3454 times.
✓ Branch 4 taken 3454 times.
3454 return getObject<ModelObject>().getModelObjectTarget<DaylightingControl>(OS_ThermalZoneFields::SecondaryDaylightingControlName);
709 }
710
711 16 bool ThermalZone_Impl::setSecondaryDaylightingControl(const DaylightingControl& daylightingControl) {
712
4/4
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
16 return setDaylightingControlsAndIlluminanceMaps(this->primaryDaylightingControl(), daylightingControl, this->illuminanceMap());
713 }
714
715 5838 void ThermalZone_Impl::resetSecondaryDaylightingControl() {
716
2/2
✓ Branch 1 taken 5838 times.
✓ Branch 4 taken 5838 times.
11676 bool test = setString(OS_ThermalZoneFields::SecondaryDaylightingControlName, "");
717
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5838 times.
5838 OS_ASSERT(test);
718 5838 }
719
720 3174 boost::optional<IlluminanceMap> ThermalZone_Impl::illuminanceMap() const {
721
2/2
✓ Branch 1 taken 3174 times.
✓ Branch 4 taken 3174 times.
3174 return getObject<ModelObject>().getModelObjectTarget<IlluminanceMap>(OS_ThermalZoneFields::IlluminanceMapName);
722 }
723
724 169 bool ThermalZone_Impl::setIlluminanceMap(const IlluminanceMap& illuminanceMap) {
725
4/4
✓ Branch 1 taken 169 times.
✓ Branch 4 taken 169 times.
✓ Branch 7 taken 169 times.
✓ Branch 10 taken 169 times.
169 return setDaylightingControlsAndIlluminanceMaps(this->primaryDaylightingControl(), this->secondaryDaylightingControl(), illuminanceMap);
726 }
727
728 2919 void ThermalZone_Impl::resetIlluminanceMap() {
729
2/2
✓ Branch 1 taken 2919 times.
✓ Branch 4 taken 2919 times.
5838 bool test = setString(OS_ThermalZoneFields::IlluminanceMapName, "");
730
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2919 times.
2919 OS_ASSERT(test);
731 2919 }
732
733 2918 bool ThermalZone_Impl::setDaylightingControlsAndIlluminanceMaps(const boost::optional<DaylightingControl>& primaryDaylightingControl,
734 const boost::optional<DaylightingControl>& secondaryDaylightingControl,
735 const boost::optional<IlluminanceMap>& illuminanceMap) {
736 2918 resetPrimaryDaylightingControl();
737 2918 resetSecondaryDaylightingControl();
738 2918 resetIlluminanceMap();
739
740 2918 bool result = true;
741
2/2
✓ Branch 0 taken 424 times.
✓ Branch 1 taken 2494 times.
2918 if (primaryDaylightingControl) {
742
3/3
✓ Branch 1 taken 424 times.
✓ Branch 4 taken 424 times.
✓ Branch 7 taken 424 times.
424 result = setPointer(OS_ThermalZoneFields::PrimaryDaylightingControlName, primaryDaylightingControl->handle());
743 }
744
745
2/2
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 2899 times.
2918 if (secondaryDaylightingControl) {
746
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 19 times.
19 if (isEmpty(OS_ThermalZoneFields::PrimaryDaylightingControlName)) {
747 ✗ result = false;
748 } else {
749
5/7
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 19 times.
✓ Branch 6 taken 19 times.
✓ Branch 9 taken 19 times.
✓ Branch 11 taken 19 times.
✗ Branch 12 not taken.
19 result = result && setPointer(OS_ThermalZoneFields::SecondaryDaylightingControlName, secondaryDaylightingControl->handle());
750 }
751 }
752
753
2/2
✓ Branch 0 taken 180 times.
✓ Branch 1 taken 2738 times.
2918 if (illuminanceMap) {
754
2/2
✓ Branch 1 taken 180 times.
✓ Branch 4 taken 180 times.
180 boost::optional<Space> space = illuminanceMap->space();
755
16/24
✓ Branch 1 taken 180 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 180 times.
✓ Branch 7 taken 180 times.
✓ Branch 10 taken 180 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 180 times.
✓ Branch 16 taken 180 times.
✓ Branch 19 taken 180 times.
✓ Branch 22 taken 180 times.
✓ Branch 25 taken 180 times.
✓ Branch 28 taken 180 times.
✓ Branch 30 taken 175 times.
✓ Branch 31 taken 5 times.
✓ Branch 32 taken 180 times.
✗ Branch 33 not taken.
✓ Branch 35 taken 180 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 175 times.
✓ Branch 39 taken 5 times.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
540 if (space && (space->thermalZone()) && (space->thermalZone()->handle() == this->handle())) {
756
5/7
✓ Branch 0 taken 175 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 175 times.
✓ Branch 6 taken 175 times.
✓ Branch 9 taken 175 times.
✓ Branch 11 taken 175 times.
✗ Branch 12 not taken.
175 result = result && setPointer(OS_ThermalZoneFields::IlluminanceMapName, illuminanceMap->handle());
757 }
758 180 }
759
760 2918 return result;
761 }
762
763 2513 void ThermalZone_Impl::checkDaylightingControlsAndIlluminanceMaps() {
764
4/4
✓ Branch 1 taken 2513 times.
✓ Branch 4 taken 2513 times.
✓ Branch 7 taken 2513 times.
✓ Branch 10 taken 2513 times.
2513 setDaylightingControlsAndIlluminanceMaps(this->primaryDaylightingControl(), this->secondaryDaylightingControl(), this->illuminanceMap());
765 2513 }
766
767 65 boost::optional<Schedule> ThermalZone_Impl::daylightingControlsAvailabilitySchedule() const {
768
2/2
✓ Branch 1 taken 65 times.
✓ Branch 4 taken 65 times.
65 return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_ThermalZoneFields::DaylightingControlsAvailabilityScheduleName);
769 }
770
771 3 bool ThermalZone_Impl::setDaylightingControlsAvailabilitySchedule(Schedule& schedule) {
772 bool result =
773
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
12 setSchedule(OS_ThermalZoneFields::DaylightingControlsAvailabilityScheduleName, "ThermalZone", "Daylighting Controls Availability", schedule);
774 3 return result;
775 }
776
777 1 void ThermalZone_Impl::resetDaylightingControlsAvailabilitySchedule() {
778
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_ThermalZoneFields::DaylightingControlsAvailabilityScheduleName, "");
779
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
780 1 }
781
782 4888 boost::optional<RenderingColor> ThermalZone_Impl::renderingColor() const {
783
2/2
✓ Branch 1 taken 4888 times.
✓ Branch 4 taken 4888 times.
4888 return getObject<ModelObject>().getModelObjectTarget<RenderingColor>(OS_ThermalZoneFields::GroupRenderingName);
784 }
785
786 1125 bool ThermalZone_Impl::setRenderingColor(const RenderingColor& renderingColor) {
787
2/2
✓ Branch 1 taken 1125 times.
✓ Branch 4 taken 1125 times.
1125 return setPointer(OS_ThermalZoneFields::GroupRenderingName, renderingColor.handle());
788 }
789
790 ✗ void ThermalZone_Impl::resetRenderingColor() {
791 ✗ bool test = setString(OS_ThermalZoneFields::GroupRenderingName, "");
792 ✗ OS_ASSERT(test);
793 ✗ }
794
795 1627 std::vector<Space> ThermalZone_Impl::spaces() const {
796
3/3
✓ Branch 1 taken 1627 times.
✓ Branch 4 taken 1627 times.
✓ Branch 7 taken 1627 times.
1627 return getObject<ModelObject>().getModelObjectSources<Space>(Space::iddObjectType());
797 }
798
799 210 std::vector<Space> ThermalZone_Impl::spacesWithDesignSpecificationOutdoorAir() const {
800 210 auto spaces = this->spaces();
801
3/3
✓ Branch 1 taken 442 times.
✓ Branch 10 taken 210 times.
✓ Branch 14 taken 210 times.
652 spaces.erase(std::remove_if(spaces.begin(), spaces.end(), [](const auto& s) { return !s.designSpecificationOutdoorAir(); }), spaces.end());
802 210 return spaces;
803 ✗ }
804
805 6 double ThermalZone_Impl::floorArea() const {
806 6 double result(0.0);
807
3/3
✓ Branch 1 taken 6 times.
✓ Branch 7 taken 21 times.
✓ Branch 8 taken 6 times.
27 for (const Space& space : spaces()) {
808
1/1
✓ Branch 1 taken 21 times.
21 result += space.floorArea();
809 6 }
810 6 return result;
811 }
812
813 ✗ double ThermalZone_Impl::exteriorSurfaceArea() const {
814 ✗ double result(0.0);
815 ✗ for (const Space& space : spaces()) {
816 ✗ result += space.exteriorArea();
817 ✗ }
818 ✗ return result;
819 }
820
821 ✗ double ThermalZone_Impl::exteriorWallArea() const {
822 ✗ double result(0.0);
823 ✗ for (const Space& space : spaces()) {
824 ✗ result += space.exteriorWallArea();
825 ✗ }
826 ✗ return result;
827 }
828
829 ✗ double ThermalZone_Impl::airVolume() const {
830 ✗ double result(0.0);
831 ✗ for (const Space& space : spaces()) {
832 ✗ result += space.volume();
833 ✗ }
834 ✗ return result;
835 }
836
837 6 double ThermalZone_Impl::numberOfPeople() const {
838 6 double result(0.0);
839
3/3
✓ Branch 1 taken 6 times.
✓ Branch 7 taken 21 times.
✓ Branch 8 taken 6 times.
27 for (const Space& space : spaces()) {
840
1/1
✓ Branch 1 taken 21 times.
21 result += space.numberOfPeople();
841 6 }
842 6 return result;
843 }
844
845 ✗ double ThermalZone_Impl::peoplePerFloorArea() const {
846 ✗ double area = floorArea();
847 ✗ double np = numberOfPeople();
848 ✗ if (equal(area, 0.0)) {
849 ✗ if (equal(np, 0.0)) {
850 ✗ return 0.0;
851 }
852 ✗ if (spaces().size() == 1u) {
853 ✗ return spaces()[0].peoplePerFloorArea();
854 }
855 ✗ LOG_AND_THROW("Calculation would require division by 0.");
856 }
857 ✗ return np / area;
858 }
859
860 ✗ double ThermalZone_Impl::floorAreaPerPerson() const {
861 ✗ double area = floorArea();
862 ✗ double np = numberOfPeople();
863 ✗ if (equal(np, 0.0)) {
864 ✗ if (spaces().size() == 1u) {
865 ✗ return spaces()[0].floorAreaPerPerson();
866 }
867 ✗ LOG_AND_THROW("Calculation would require division by 0.");
868 }
869 ✗ return area / np;
870 }
871
872 3 double ThermalZone_Impl::lightingPower() const {
873 3 double result(0.0);
874
3/3
✓ Branch 1 taken 3 times.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 3 times.
15 for (const Space& space : spaces()) {
875
1/1
✓ Branch 1 taken 12 times.
12 result += space.lightingPower();
876 3 }
877 3 return result;
878 }
879
880 1 double ThermalZone_Impl::lightingPowerPerFloorArea() const {
881 1 double area = floorArea();
882 1 double lp = lightingPower();
883
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
1 if (equal(area, 0.0)) {
884 ✗ if (equal(lp, 0.0)) {
885 ✗ return 0.0;
886 ✗ } else if (spaces().size() == 1u) {
887 ✗ return spaces()[0].lightingPowerPerFloorArea();
888 }
889 ✗ LOG_AND_THROW("Calculation would require division by 0.");
890 }
891 1 return lp / area;
892 }
893
894 1 double ThermalZone_Impl::lightingPowerPerPerson() const {
895 1 double np = numberOfPeople();
896 1 double lp = lightingPower();
897
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
1 if (equal(np, 0.0)) {
898 ✗ if (equal(lp, 0.0)) {
899 ✗ return 0.0;
900 }
901 ✗ if (spaces().size() == 1u) {
902 ✗ return spaces()[0].lightingPowerPerPerson();
903 }
904 ✗ LOG_AND_THROW("Calculation would require division by 0.");
905 }
906 1 return lp / np;
907 }
908
909 3 double ThermalZone_Impl::electricEquipmentPower() const {
910 3 double result(0.0);
911
3/3
✓ Branch 1 taken 3 times.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 3 times.
15 for (const Space& space : spaces()) {
912
1/1
✓ Branch 1 taken 12 times.
12 result += space.electricEquipmentPower();
913 3 }
914 3 return result;
915 }
916
917 1 double ThermalZone_Impl::electricEquipmentPowerPerFloorArea() const {
918 1 double area = floorArea();
919 1 double ep = electricEquipmentPower();
920
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
1 if (equal(area, 0.0)) {
921 ✗ if (equal(ep, 0.0)) {
922 ✗ return 0.0;
923 }
924 ✗ if (spaces().size() == 1u) {
925 ✗ return spaces()[0].electricEquipmentPowerPerFloorArea();
926 }
927 ✗ LOG_AND_THROW("Calculation would require division by 0.");
928 }
929 1 return ep / area;
930 }
931
932 1 double ThermalZone_Impl::electricEquipmentPowerPerPerson() const {
933 1 double np = numberOfPeople();
934 1 double ep = electricEquipmentPower();
935
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
1 if (equal(np, 0.0)) {
936 ✗ if (equal(ep, 0.0)) {
937 ✗ return 0.0;
938 }
939 ✗ if (spaces().size() == 1u) {
940 ✗ return spaces()[0].electricEquipmentPowerPerPerson();
941 }
942 ✗ LOG_AND_THROW("Calculation would require division by 0.");
943 }
944 1 return ep / np;
945 }
946
947 3 double ThermalZone_Impl::gasEquipmentPower() const {
948 3 double result(0.0);
949
3/3
✓ Branch 1 taken 3 times.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 3 times.
15 for (const Space& space : spaces()) {
950
1/1
✓ Branch 1 taken 12 times.
12 result += space.gasEquipmentPower();
951 3 }
952 3 return result;
953 }
954
955 1 double ThermalZone_Impl::gasEquipmentPowerPerFloorArea() const {
956 1 double area = floorArea();
957 1 double ep = gasEquipmentPower();
958
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
1 if (equal(area, 0.0)) {
959 ✗ if (equal(ep, 0.0)) {
960 ✗ return 0.0;
961 }
962 ✗ if (spaces().size() == 1u) {
963 ✗ return spaces()[0].gasEquipmentPowerPerFloorArea();
964 }
965 ✗ LOG_AND_THROW("Calculation would require division by 0.");
966 }
967 1 return ep / area;
968 }
969
970 1 double ThermalZone_Impl::gasEquipmentPowerPerPerson() const {
971 1 double np = numberOfPeople();
972 1 double ep = gasEquipmentPower();
973
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
1 if (equal(np, 0.0)) {
974 ✗ if (equal(ep, 0.0)) {
975 ✗ return 0.0;
976 }
977 ✗ if (spaces().size() == 1u) {
978 ✗ return spaces()[0].gasEquipmentPowerPerPerson();
979 }
980 ✗ LOG_AND_THROW("Calculation would require division by 0.");
981 }
982 1 return ep / np;
983 }
984
985 3 double ThermalZone_Impl::hotWaterEquipmentPower() const {
986 3 double result(0.0);
987
3/3
✓ Branch 1 taken 3 times.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 3 times.
15 for (const Space& space : spaces()) {
988
1/1
✓ Branch 1 taken 12 times.
12 result += space.hotWaterEquipmentPower();
989 3 }
990 3 return result;
991 }
992
993 1 double ThermalZone_Impl::hotWaterEquipmentPowerPerFloorArea() const {
994 1 double area = floorArea();
995 1 double ep = hotWaterEquipmentPower();
996
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
1 if (equal(area, 0.0)) {
997 ✗ if (equal(ep, 0.0)) {
998 ✗ return 0.0;
999 }
1000 ✗ if (spaces().size() == 1u) {
1001 ✗ return spaces()[0].hotWaterEquipmentPowerPerFloorArea();
1002 }
1003 ✗ LOG_AND_THROW("Calculation would require division by 0.");
1004 }
1005 1 return ep / area;
1006 }
1007
1008 1 double ThermalZone_Impl::hotWaterEquipmentPowerPerPerson() const {
1009 1 double np = numberOfPeople();
1010 1 double ep = hotWaterEquipmentPower();
1011
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
1 if (equal(np, 0.0)) {
1012 ✗ if (equal(ep, 0.0)) {
1013 ✗ return 0.0;
1014 }
1015 ✗ if (spaces().size() == 1u) {
1016 ✗ return spaces()[0].hotWaterEquipmentPowerPerPerson();
1017 }
1018 ✗ LOG_AND_THROW("Calculation would require division by 0.");
1019 }
1020 1 return ep / np;
1021 }
1022
1023 ✗ double ThermalZone_Impl::infiltrationDesignFlowRate() const {
1024 ✗ double result(0.0);
1025 ✗ for (const Space& space : spaces()) {
1026 ✗ result += space.infiltrationDesignFlowRate();
1027 ✗ }
1028 ✗ return result;
1029 }
1030
1031 ✗ double ThermalZone_Impl::infiltrationDesignFlowPerSpaceFloorArea() const {
1032 ✗ double area = floorArea();
1033 ✗ double idfr = infiltrationDesignFlowRate();
1034 ✗ if (equal(area, 0.0)) {
1035 ✗ if (equal(idfr, 0.0)) {
1036 ✗ return 0.0;
1037 }
1038 ✗ if (spaces().size() == 1u) {
1039 ✗ return spaces()[0].infiltrationDesignFlowPerSpaceFloorArea();
1040 }
1041 ✗ LOG_AND_THROW("Calculation would require division by 0.");
1042 }
1043 ✗ return idfr / area;
1044 }
1045
1046 ✗ double ThermalZone_Impl::infiltrationDesignFlowPerExteriorSurfaceArea() const {
1047 ✗ double area = exteriorSurfaceArea();
1048 ✗ double idfr = infiltrationDesignFlowRate();
1049 ✗ if (equal(area, 0.0)) {
1050 ✗ if (equal(idfr, 0.0)) {
1051 ✗ return 0.0;
1052 }
1053 ✗ if (spaces().size() == 1u) {
1054 ✗ return spaces()[0].infiltrationDesignFlowPerExteriorSurfaceArea();
1055 }
1056 ✗ LOG_AND_THROW("Calculation would require division by 0.");
1057 }
1058 ✗ return idfr / area;
1059 }
1060
1061 ✗ double ThermalZone_Impl::infiltrationDesignFlowPerExteriorWallArea() const {
1062 ✗ double area = exteriorWallArea();
1063 ✗ double idfr = infiltrationDesignFlowRate();
1064 ✗ if (equal(area, 0.0)) {
1065 ✗ if (equal(idfr, 0.0)) {
1066 ✗ return 0.0;
1067 }
1068 ✗ if (spaces().size() == 1u) {
1069 ✗ return spaces()[0].infiltrationDesignFlowPerExteriorWallArea();
1070 }
1071 ✗ LOG_AND_THROW("Calculation would require division by 0.");
1072 }
1073 ✗ return idfr / area;
1074 }
1075
1076 ✗ double ThermalZone_Impl::infiltrationDesignAirChangesPerHour() const {
1077 ✗ double volume = airVolume();
1078 ✗ double idfr = infiltrationDesignFlowRate();
1079 ✗ if (equal(volume, 0.0)) {
1080 ✗ if (equal(idfr, 0.0)) {
1081 ✗ return 0.0;
1082 }
1083 ✗ if (spaces().size() == 1u) {
1084 ✗ return spaces()[0].infiltrationDesignAirChangesPerHour();
1085 }
1086 ✗ LOG_AND_THROW("Calculation would require division by 0.");
1087 }
1088 ✗ return (idfr / volume) * 3600.0;
1089 }
1090
1091 3 boost::optional<std::string> ThermalZone_Impl::isConditioned() const {
1092 3 boost::optional<std::string> result;
1093
1094
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 OptionalSqlFile mySqlFile = model().sqlFile();
1095
1096 // TODO: this should not require sql file
1097
1098
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 if (mySqlFile) {
1099 // now use sql query to check if conditioned
1100 ✗ std::string zoneName = boost::to_upper_copy(name(true).get());
1101
1102 ✗ std::string query = R"(SELECT Value from TabularDataWithStrings
1103 WHERE ReportName = 'InputVerificationandResultsSummary'
1104 AND ReportForString = 'Entire Facility'
1105 AND TableName = 'Zone Summary'
1106 AND ColumnName = 'Conditioned (Y/N)'
1107 AND RowName = ?;)";
1108
1109 ✗ result = mySqlFile->execAndReturnFirstString(query, zoneName); // zoneName is a bind argument, will get escaped properly
1110 ✗ if (!result) {
1111 ✗ LOG(Error, "Query for " << briefDescription() << " isConditioned failed.");
1112 }
1113 ✗ }
1114
1115 6 return result;
1116 3 }
1117
1118 29 bool ThermalZone_Impl::isRemovable() const {
1119 29 return true;
1120 }
1121
1122 1 boost::optional<ThermostatSetpointDualSetpoint> ThermalZone_Impl::thermostatSetpointDualSetpoint() const {
1123
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return getObject<ModelObject>().getModelObjectTarget<ThermostatSetpointDualSetpoint>(OS_ThermalZoneFields::ThermostatName);
1124 }
1125
1126 256 bool ThermalZone_Impl::setThermostatSetpointDualSetpoint(const ThermostatSetpointDualSetpoint& thermostat) {
1127 256 return setThermostat(thermostat);
1128 }
1129
1130 ✗ void ThermalZone_Impl::resetThermostatSetpointDualSetpoint() {
1131 // This will reset other thermostat types, but I think that is ok
1132 ✗ resetThermostat();
1133 ✗ }
1134
1135 1532 boost::optional<Thermostat> ThermalZone_Impl::thermostat() const {
1136
2/2
✓ Branch 1 taken 1532 times.
✓ Branch 4 taken 1532 times.
1532 return getObject<ModelObject>().getModelObjectTarget<Thermostat>(OS_ThermalZoneFields::ThermostatName);
1137 }
1138
1139 271 bool ThermalZone_Impl::setThermostat(const Thermostat& thermostat) {
1140
1/1
✓ Branch 1 taken 271 times.
271 auto t_model = model();
1141
1142
3/4
✓ Branch 1 taken 271 times.
✓ Branch 4 taken 271 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 271 times.
271 if (t_model != thermostat.model()) {
1143 ✗ return false;
1144 }
1145
1146
3/3
✓ Branch 1 taken 271 times.
✓ Branch 3 taken 12 times.
✓ Branch 4 taken 259 times.
542 if (auto currentZone = thermostat.thermalZone()) {
1147
6/6
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✓ Branch 10 taken 12 times.
✓ Branch 12 taken 1 time.
✓ Branch 13 taken 11 times.
12 if (currentZone->handle() == handle()) {
1148 // or should it be false?
1149 // I think this is similar to what you would see in
1150 // Lights::setSpace() under similar conditions
1151 1 return true;
1152 } else {
1153
3/3
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
11 auto thermostatClone = thermostat.clone(t_model).cast<Thermostat>();
1154
1/1
✓ Branch 1 taken 11 times.
11 resetThermostat();
1155
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 return setPointer(OS_ThermalZoneFields::ThermostatName, thermostatClone.handle());
1156 11 }
1157 } else {
1158
1/1
✓ Branch 1 taken 259 times.
259 resetThermostat();
1159
2/2
✓ Branch 1 taken 259 times.
✓ Branch 4 taken 259 times.
259 return setPointer(OS_ThermalZoneFields::ThermostatName, thermostat.handle());
1160 271 }
1161 271 }
1162
1163 270 void ThermalZone_Impl::resetThermostat() {
1164
3/3
✓ Branch 1 taken 270 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 269 times.
540 if (boost::optional<Thermostat> thermostat = this->thermostat()) {
1165
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 thermostat->remove();
1166 270 }
1167
1168
2/2
✓ Branch 1 taken 270 times.
✓ Branch 4 taken 270 times.
540 setString(OS_ThermalZoneFields::ThermostatName, "");
1169 270 }
1170
1171 186 boost::optional<ZoneControlHumidistat> ThermalZone_Impl::zoneControlHumidistat() const {
1172
2/2
✓ Branch 1 taken 186 times.
✓ Branch 4 taken 186 times.
186 return getObject<ModelObject>().getModelObjectTarget<ZoneControlHumidistat>(OS_ThermalZoneFields::HumidistatName);
1173 }
1174
1175 8 bool ThermalZone_Impl::setZoneControlHumidistat(const ZoneControlHumidistat& humidistat) {
1176
1/1
✓ Branch 1 taken 8 times.
8 auto t_model = model();
1177
1178
3/4
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 8 times.
8 if (t_model != humidistat.model()) {
1179 ✗ return false;
1180 }
1181
1182
3/3
✓ Branch 1 taken 8 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 6 times.
16 if (auto currentZone = humidistat.controlledZone()) {
1183
6/6
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 12 taken 1 time.
✓ Branch 13 taken 1 time.
2 if (currentZone->handle() == handle()) {
1184 1 return true;
1185 } else {
1186
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 auto humidistatClone = humidistat.clone(t_model).cast<ZoneControlHumidistat>();
1187
1/1
✓ Branch 1 taken 1 time.
1 resetZoneControlHumidistat();
1188
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return setPointer(OS_ThermalZoneFields::HumidistatName, humidistatClone.handle());
1189 1 }
1190 } else {
1191
1/1
✓ Branch 1 taken 6 times.
6 resetZoneControlHumidistat();
1192
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 return setPointer(OS_ThermalZoneFields::HumidistatName, humidistat.handle());
1193 8 }
1194 8 }
1195
1196 7 void ThermalZone_Impl::resetZoneControlHumidistat() {
1197
3/3
✓ Branch 1 taken 7 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 6 times.
14 if (boost::optional<ZoneControlHumidistat> humidistat = this->zoneControlHumidistat()) {
1198
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 humidistat->remove();
1199 7 }
1200
1201
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
14 setString(OS_ThermalZoneFields::HumidistatName, "");
1202 7 }
1203
1204 /// Combines all spaces referencing this zone into a single space referencing this zone.
1205 /// If this zone has no spaces referencing it, then an uninitialized optional space is returned.
1206 /// If this zone has one space referencing it, then that space is returned.
1207 /// If this zone is referenced by more than one space, then geometry from all spaces is added to a single zone.
1208 /// The space origin is at the minimum x, y, z coordinate of all space origins, direction of relative north is preserved if same for all spaces.
1209 /// If all spaces reference the same building story then that is preserved, otherwise it is cleared.
1210 /// If all spaces reference the same space type then that is preserved, otherwise space loads from the space type are applied to the new space directly.
1211 /// Direct child space loads are converted to absolute levels.
1212 /// Constructions and schedules are hard applied to all child surfaces and loads.
1213 /// Surfaces referencing other surfaces within the space are converted to interior partitions.
1214 80 boost::optional<Space> ThermalZone_Impl::combineSpaces() {
1215
1/1
✓ Branch 1 taken 80 times.
80 std::vector<Space> spaces = this->spaces();
1216
1217
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 80 times.
80 if (spaces.empty()) {
1218 ✗ return boost::none;
1219
2/2
✓ Branch 1 taken 36 times.
✓ Branch 2 taken 44 times.
80 } else if (spaces.size() == 1) {
1220
1/1
✓ Branch 2 taken 36 times.
36 return spaces[0];
1221 }
1222
1223 // sort by space name
1224
1/1
✓ Branch 3 taken 44 times.
44 std::sort(spaces.begin(), spaces.end(), WorkspaceObjectNameLess());
1225
1226 // if these variables are set, then they are not defaulted and are common to all spaces
1227
1/1
✓ Branch 2 taken 44 times.
44 boost::optional<BuildingStory> buildingStory = spaces[0].buildingStory();
1228
1/1
✓ Branch 2 taken 44 times.
44 boost::optional<SpaceType> spaceType = spaces[0].spaceType();
1229 44 boost::optional<double> directionofRelativeNorth;
1230
2/3
✓ Branch 2 taken 44 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 44 times.
44 if (!spaces[0].isDirectionofRelativeNorthDefaulted()) {
1231 ✗ directionofRelativeNorth = spaces[0].directionofRelativeNorth();
1232 }
1233
1/1
✓ Branch 2 taken 44 times.
44 double xOrigin = spaces[0].xOrigin();
1234
1/1
✓ Branch 2 taken 44 times.
44 double yOrigin = spaces[0].yOrigin();
1235
1/1
✓ Branch 2 taken 44 times.
44 double zOrigin = spaces[0].zOrigin();
1236 44 double sumFloorArea = 0.0;
1237 44 double sumNumberOfPeople = 0.0;
1238 44 double sumVolume = 0.0;
1239 44 double totalFloorArea = 0.0; // only area included in total floor area
1240 44 bool needToSetFloorArea = false;
1241 44 bool anyNotPartofTotalFloorArea = false;
1242
1/1
✓ Branch 2 taken 44 times.
44 bool partofTotalFloorArea = spaces[0].partofTotalFloorArea();
1243
1244 // variables for merging outdoor area
1245
1/1
✓ Branch 2 taken 44 times.
44 boost::optional<DesignSpecificationOutdoorAir> designSpecificationOutdoorAir = spaces[0].designSpecificationOutdoorAir();
1246
1/1
✓ Branch 2 taken 44 times.
44 bool allDesignSpecificationOutdoorAirDefaulted = spaces[0].isDesignSpecificationOutdoorAirDefaulted();
1247 44 bool anyDesignSpecificationOutdoorAirSchedules = false;
1248 44 bool anyMaxOutdoorAirMethod = false;
1249 44 bool anySumOutdoorAirMethod = false;
1250 44 double sumOutdoorAirForPeople = 0.0;
1251 44 double sumOutdoorAirForFloorArea = 0.0;
1252 44 double sumOutdoorAirRate = 0.0;
1253 44 double sumOutdoorAirForVolume = 0.0;
1254
1255 // find common variables for the new space
1256
2/2
✓ Branch 5 taken 105 times.
✓ Branch 6 taken 44 times.
149 for (const Space& space : spaces) {
1257
1258 // Quick check to see what kind of ventilation methods are used
1259
3/3
✓ Branch 1 taken 105 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 97 times.
210 if (boost::optional<DesignSpecificationOutdoorAir> designSpecificationOutdoorAir = space.designSpecificationOutdoorAir()) {
1260
6/6
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✓ Branch 10 taken 8 times.
✓ Branch 14 taken 2 times.
✓ Branch 15 taken 6 times.
24 if (istringEqual("Maximum", designSpecificationOutdoorAir->outdoorAirMethod())) {
1261 2 anyMaxOutdoorAirMethod = true;
1262
5/6
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 14 taken 6 times.
✗ Branch 15 not taken.
18 } else if (istringEqual("Sum", designSpecificationOutdoorAir->outdoorAirMethod())) {
1263 6 anySumOutdoorAirMethod = true;
1264 }
1265 105 }
1266
1267 // if all spaces are on the same building story use that, otherwise clear it
1268
3/3
✓ Branch 1 taken 105 times.
✓ Branch 4 taken 12 times.
✓ Branch 5 taken 93 times.
210 if (space.buildingStory()) {
1269
10/16
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✓ Branch 10 taken 12 times.
✓ Branch 13 taken 12 times.
✓ Branch 16 taken 12 times.
✓ Branch 19 taken 12 times.
✓ Branch 21 taken 12 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 12 times.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 12 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
24 if (buildingStory && (buildingStory->handle() == space.buildingStory()->handle())) {
1270 // no-op
1271 } else {
1272 ✗ buildingStory.reset();
1273 }
1274 } else {
1275 93 buildingStory.reset();
1276 }
1277
1278 // if all spaces have the same space type use that, otherwise clear it
1279
3/3
✓ Branch 1 taken 105 times.
✓ Branch 4 taken 78 times.
✓ Branch 5 taken 27 times.
210 if (space.spaceType()) {
1280
14/16
✓ Branch 1 taken 73 times.
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 73 times.
✓ Branch 7 taken 73 times.
✓ Branch 10 taken 73 times.
✓ Branch 13 taken 73 times.
✓ Branch 16 taken 73 times.
✓ Branch 19 taken 73 times.
✓ Branch 21 taken 56 times.
✓ Branch 22 taken 17 times.
✓ Branch 23 taken 73 times.
✓ Branch 24 taken 5 times.
✓ Branch 26 taken 22 times.
✓ Branch 27 taken 56 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
156 if (spaceType && (spaceType->handle() == space.spaceType()->handle())) {
1281 // no-op
1282 } else {
1283 22 spaceType.reset();
1284 }
1285 } else {
1286 27 spaceType.reset();
1287 }
1288
1289 // if all spaces have same directionOfRelativeNorth use that, otherwise clear it
1290
2/3
✓ Branch 1 taken 105 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 105 times.
105 if (!space.isDirectionofRelativeNorthDefaulted()) {
1291 ✗ if (directionofRelativeNorth && (*directionofRelativeNorth == space.directionofRelativeNorth())) {
1292 // no-op
1293 } else {
1294 ✗ directionofRelativeNorth.reset();
1295 }
1296 }
1297
1298 // pick the lower left corner if specified
1299
1/1
✓ Branch 1 taken 105 times.
105 xOrigin = std::min(xOrigin, space.xOrigin());
1300
1/1
✓ Branch 1 taken 105 times.
105 yOrigin = std::min(yOrigin, space.yOrigin());
1301
1/1
✓ Branch 1 taken 105 times.
105 zOrigin = std::min(zOrigin, space.zOrigin());
1302
1303
1/1
✓ Branch 1 taken 105 times.
105 double floorArea = space.floorArea();
1304 105 sumFloorArea += floorArea;
1305
1306
1/1
✓ Branch 1 taken 105 times.
105 double numberOfPeople = space.numberOfPeople(); // Note: this takes Space-level and SpaceType-level people into account
1307 105 sumNumberOfPeople += numberOfPeople;
1308
1309
1/1
✓ Branch 1 taken 105 times.
105 double volume = space.volume();
1310 105 sumVolume += volume;
1311
1312 // check if we have to explicitly set floor area and hard size loads
1313
3/3
✓ Branch 1 taken 105 times.
✓ Branch 8 taken 519 times.
✓ Branch 9 taken 105 times.
624 for (const Surface& surface : space.surfaces()) {
1314
5/5
✓ Branch 1 taken 519 times.
✓ Branch 4 taken 519 times.
✓ Branch 7 taken 519 times.
✓ Branch 11 taken 103 times.
✓ Branch 12 taken 416 times.
1038 if (istringEqual(surface.surfaceType(), "Floor")) {
1315
1316 // air wall floors do not count in floor area
1317
2/3
✓ Branch 1 taken 103 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 103 times.
103 if (surface.isAirWall()) {
1318 ✗ needToSetFloorArea = true;
1319 ✗ break;
1320 }
1321
1322
1/1
✓ Branch 1 taken 103 times.
103 auto adjacentSurface = surface.adjacentSurface();
1323
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 103 times.
103 if (adjacentSurface) {
1324 ✗ auto adjacentSpace = adjacentSurface->space();
1325 ✗ if (adjacentSpace) {
1326 ✗ auto adjacentThermalZone = adjacentSpace->thermalZone();
1327 ✗ if (adjacentThermalZone) {
1328 ✗ if (adjacentThermalZone->handle() == this->handle()) {
1329 // this surface is completely inside the zone, need to set floor area since this surface will be removed
1330 ✗ needToSetFloorArea = true;
1331 ✗ break;
1332 }
1333 }
1334 ✗ }
1335 ✗ }
1336 103 }
1337 105 }
1338
1339 // space floor area is counted if any space is part of floor area
1340
2/3
✓ Branch 1 taken 105 times.
✓ Branch 3 taken 105 times.
✗ Branch 4 not taken.
105 if (space.partofTotalFloorArea()) {
1341 105 partofTotalFloorArea = true;
1342 105 totalFloorArea += floorArea;
1343
1344
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 105 times.
105 if (anyNotPartofTotalFloorArea) {
1345 ✗ needToSetFloorArea = true;
1346 }
1347
1348 } else {
1349 ✗ anyNotPartofTotalFloorArea = true;
1350
1351 ✗ if (partofTotalFloorArea) {
1352 ✗ needToSetFloorArea = true;
1353 }
1354 }
1355
1356 // if all spaces have the same outdoor air specification use that, otherwise clear it
1357
1/1
✓ Branch 1 taken 105 times.
105 boost::optional<DesignSpecificationOutdoorAir> thisDesignSpecificationOutdoorAir = space.designSpecificationOutdoorAir();
1358
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 97 times.
105 if (thisDesignSpecificationOutdoorAir) {
1359
1360
11/11
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 6 times.
✓ Branch 6 taken 6 times.
✓ Branch 9 taken 6 times.
✓ Branch 12 taken 6 times.
✓ Branch 15 taken 6 times.
✓ Branch 17 taken 4 times.
✓ Branch 18 taken 2 times.
✓ Branch 19 taken 4 times.
✓ Branch 20 taken 4 times.
8 if (designSpecificationOutdoorAir && (designSpecificationOutdoorAir->handle() == thisDesignSpecificationOutdoorAir->handle())) {
1361 // no-op
1362 } else {
1363 4 designSpecificationOutdoorAir.reset();
1364 }
1365
1366
3/3
✓ Branch 1 taken 8 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 2 times.
8 if (!space.isDesignSpecificationOutdoorAirDefaulted()) {
1367 6 allDesignSpecificationOutdoorAirDefaulted = false;
1368 }
1369
1370
3/4
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 8 times.
16 if (thisDesignSpecificationOutdoorAir->outdoorAirFlowRateFractionSchedule()) {
1371 ✗ anyDesignSpecificationOutdoorAirSchedules = true;
1372 }
1373
1374 // compute outdoor air rates (m3/s) in case we need them
1375
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 double outdoorAirForPeople = numberOfPeople * thisDesignSpecificationOutdoorAir->outdoorAirFlowperPerson();
1376
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 double outdoorAirForFloorArea = floorArea * thisDesignSpecificationOutdoorAir->outdoorAirFlowperFloorArea();
1377
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 double outdoorAirRate = thisDesignSpecificationOutdoorAir->outdoorAirFlowRate();
1378 // ACH * volume = m3/h, divide by 3600 s/hr to get m3/s
1379
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 double outdoorAirForVolume = volume * thisDesignSpecificationOutdoorAir->outdoorAirFlowAirChangesperHour() / 3600.0;
1380
1381 // First check if this space uses the Maximum method and other spaces do not
1382
12/22
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✓ Branch 10 taken 8 times.
✓ Branch 12 taken 2 times.
✓ Branch 13 taken 6 times.
✓ Branch 14 taken 2 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 8 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 8 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 8 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 2 times.
✓ Branch 25 taken 6 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
24 if (istringEqual("Maximum", thisDesignSpecificationOutdoorAir->outdoorAirMethod()) && anySumOutdoorAirMethod) {
1383 2 sumOutdoorAirRate += std::max(outdoorAirForPeople, std::max(outdoorAirForFloorArea, std::max(outdoorAirRate, outdoorAirForVolume)));
1384 } else {
1385 6 sumOutdoorAirForPeople += outdoorAirForPeople;
1386 6 sumOutdoorAirForFloorArea += outdoorAirForFloorArea;
1387 6 sumOutdoorAirRate += outdoorAirRate;
1388 6 sumOutdoorAirForVolume += outdoorAirForVolume;
1389 }
1390
1391 } else {
1392 97 designSpecificationOutdoorAir.reset();
1393 97 allDesignSpecificationOutdoorAirDefaulted = false;
1394 }
1395 105 }
1396
1397 // if all spaces share a common space type, ensure that there are no absolute loads
1398
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 30 times.
44 if (spaceType) {
1399
4/4
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 11 taken 19 times.
✓ Branch 12 taken 9 times.
28 for (const auto& child : spaceType->children()) {
1400
2/3
✓ Branch 1 taken 19 times.
✓ Branch 3 taken 19 times.
✗ Branch 4 not taken.
38 if (auto load_ = child.optionalCast<SpaceLoad>()) {
1401
4/4
✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 14 times.
19 if (load_->isAbsolute()) {
1402
9/9
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 16 taken 5 times.
✓ Branch 20 taken 5 times.
✓ Branch 23 taken 5 times.
✓ Branch 26 taken 5 times.
5 LOG(Warn, "SpaceType '" << spaceType->nameString() << "' contains absolute loads, cannot be shared by combined spaces.")
1403 5 spaceType.reset();
1404 5 break;
1405 }
1406 19 }
1407 14 }
1408 }
1409
1410 // set E+ floor area here if needed, this is only used for reporting total building area
1411 // loads are hard sized according to OpenStudio space floor area
1412
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
44 if (needToSetFloorArea) {
1413
1414 // do not allow per area loads in the space type since we are overriding floor area
1415 ✗ spaceType.reset();
1416
1417 // don't override if user provided zone floor area
1418 ✗ if (isEmpty(OS_ThermalZoneFields::FloorArea)) {
1419 ✗ LOG(Info, "ThermalZone '" << this->name().get() << "' has spaces with mis-matched 'Part of Total Floor Area' flags. "
1420 << "Setting set the flag to 'Yes', but hard-coding the total floor area to only take into account the spaces "
1421 << "that are part of total Floor Area");
1422 ✗ this->setDouble(OS_ThermalZoneFields::FloorArea, totalFloorArea);
1423 } else {
1424 ✗ LOG(Info, "ThermalZone " << this->name().get() << " has a user-specified Floor Area, using this number");
1425 }
1426 }
1427
1428 // make the new space
1429
1/1
✓ Branch 1 taken 44 times.
44 Model model = this->model();
1430
1/1
✓ Branch 1 taken 44 times.
44 Space newSpace(model);
1431
1/1
✓ Branch 1 taken 44 times.
44 auto thermalZone = this->getObject<ThermalZone>();
1432
1/1
✓ Branch 1 taken 44 times.
44 newSpace.setThermalZone(thermalZone);
1433
1/1
✓ Branch 1 taken 44 times.
44 newSpace.setXOrigin(xOrigin);
1434
1/1
✓ Branch 1 taken 44 times.
44 newSpace.setYOrigin(yOrigin);
1435
1/1
✓ Branch 1 taken 44 times.
44 newSpace.setZOrigin(zOrigin);
1436
1/1
✓ Branch 1 taken 44 times.
44 newSpace.setPartofTotalFloorArea(partofTotalFloorArea);
1437
1438
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
44 if (directionofRelativeNorth) {
1439 ✗ newSpace.setDirectionofRelativeNorth(*directionofRelativeNorth);
1440 }
1441
1442
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 41 times.
44 if (buildingStory) {
1443
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 newSpace.setBuildingStory(*buildingStory);
1444 }
1445
1446
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 35 times.
44 if (spaceType) {
1447
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 newSpace.setSpaceType(*spaceType);
1448 } else {
1449 // create a new space type
1450
1/1
✓ Branch 1 taken 35 times.
35 SpaceType newSpaceType(model);
1451
1452 // set space type to prevent picking up building level space type
1453
1/1
✓ Branch 1 taken 35 times.
35 newSpace.setSpaceType(newSpaceType);
1454 35 }
1455
1456 // new space transformation
1457
1/1
✓ Branch 1 taken 44 times.
44 Transformation newTransformation = newSpace.transformation();
1458
1459 // set common variables for the new space
1460
2/2
✓ Branch 5 taken 105 times.
✓ Branch 6 taken 44 times.
149 for (Space& space : spaces) {
1461
1462 // shift the geometry
1463
1/1
✓ Branch 1 taken 105 times.
105 space.changeTransformation(newTransformation);
1464
1465 // apply the space type
1466
2/2
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 24 times.
105 if (!spaceType) {
1467
1/1
✓ Branch 1 taken 81 times.
81 space.hardApplySpaceType(true);
1468 }
1469
1/1
✓ Branch 1 taken 105 times.
105 space.hardApplyConstructions();
1470
1471 // get the children
1472
1/1
✓ Branch 1 taken 105 times.
105 std::vector<ModelObject> children = space.children();
1473
1474 // first hard size any space loads, do this before removing surfaces as
1475 // hard sizing may require space geometry
1476
2/2
✓ Branch 5 taken 625 times.
✓ Branch 6 taken 105 times.
730 for (ModelObject& child : children) {
1477
3/3
✓ Branch 1 taken 625 times.
✓ Branch 3 taken 80 times.
✓ Branch 4 taken 545 times.
1250 if (auto sp_ = child.optionalCast<SpaceLoad>()) {
1478
2/2
✓ Branch 1 taken 80 times.
✓ Branch 4 taken 80 times.
80 sp_->hardSize();
1479
2/2
✓ Branch 1 taken 80 times.
✓ Branch 4 taken 80 times.
80 sp_->hardApplySchedules();
1480 625 }
1481 }
1482
1483
3/3
✓ Branch 1 taken 105 times.
✓ Branch 8 taken 9 times.
✓ Branch 9 taken 105 times.
114 for (ZoneMixing& zm : space.supplyZoneMixing()) {
1484
1/1
✓ Branch 1 taken 9 times.
9 zm.hardSize();
1485
1/1
✓ Branch 1 taken 9 times.
9 zm.setParent(newSpace);
1486 105 }
1487
1488
3/3
✓ Branch 1 taken 105 times.
✓ Branch 8 taken 9 times.
✓ Branch 9 taken 105 times.
114 for (ZoneMixing& zm : space.exhaustZoneMixing()) {
1489 // We only need to hardSize when it's the RECEIVING zone
1490
1/1
✓ Branch 1 taken 9 times.
9 zm.setSourceSpace(newSpace);
1491 105 }
1492
1493 // now move costs over to the new space
1494
3/3
✓ Branch 1 taken 105 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 105 times.
107 for (const LifeCycleCost& cost : space.lifeCycleCosts()) {
1495 // new costs are in absolute units as space area is changing in the merge
1496
1/1
✓ Branch 1 taken 2 times.
2 LifeCycleCost newCost(newSpace);
1497
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 newCost.setName(cost.name().get());
1498
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 newCost.setCategory(cost.category());
1499
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 newCost.setCost(cost.totalCost());
1500
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 newCost.setCostUnits("CostPerEach");
1501
2/3
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
2 if (!cost.isYearsFromStartDefaulted()) {
1502 ✗ newCost.setYearsFromStart(cost.yearsFromStart());
1503 }
1504
2/3
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
2 if (!cost.isMonthsFromStartDefaulted()) {
1505 ✗ newCost.setMonthsFromStart(cost.monthsFromStart());
1506 }
1507
2/3
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
2 if (!cost.isRepeatPeriodYearsDefaulted()) {
1508 ✗ newCost.setRepeatPeriodYears(cost.repeatPeriodYears());
1509 }
1510
2/3
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
2 if (!cost.isRepeatPeriodMonthsDefaulted()) {
1511 ✗ newCost.setRepeatPeriodMonths(cost.repeatPeriodMonths());
1512 }
1513 107 }
1514
1515
2/2
✓ Branch 5 taken 625 times.
✓ Branch 6 taken 105 times.
730 for (ModelObject& child : children) {
1516 // now move everything over to the new space
1517
1/1
✓ Branch 1 taken 625 times.
625 child.setParent(newSpace);
1518 }
1519
1520 // remove the old space
1521
1/1
✓ Branch 1 taken 105 times.
105 space.remove();
1522 105 }
1523
1524 // merge surfaces
1525 44 boost::optional<InteriorPartitionSurfaceGroup> interiorPartitionSurfaceGroup;
1526 44 std::set<Surface> mergedSurfaces;
1527
1528 // sort by surface name
1529
1/1
✓ Branch 1 taken 44 times.
44 std::vector<Surface> surfaces = newSpace.surfaces();
1530
1/1
✓ Branch 3 taken 44 times.
44 std::sort(surfaces.begin(), surfaces.end(), WorkspaceObjectNameLess());
1531
1532
2/2
✓ Branch 5 taken 519 times.
✓ Branch 6 taken 44 times.
563 for (const Surface& surface : surfaces) {
1533
1534
1/1
✓ Branch 1 taken 519 times.
519 auto it = mergedSurfaces.find(surface);
1535
2/2
✓ Branch 2 taken 25 times.
✓ Branch 3 taken 494 times.
519 if (it != mergedSurfaces.end()) {
1536 37 continue;
1537 }
1538
1539
3/3
✓ Branch 1 taken 494 times.
✓ Branch 3 taken 25 times.
✓ Branch 4 taken 469 times.
988 if (boost::optional<Surface> adjacentSurface = surface.adjacentSurface()) {
1540
2/2
✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
25 boost::optional<Space> adjacentSpace = adjacentSurface->space();
1541
7/10
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 25 times.
✓ Branch 6 taken 25 times.
✓ Branch 9 taken 25 times.
✓ Branch 12 taken 25 times.
✓ Branch 14 taken 25 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 25 times.
✗ Branch 17 not taken.
25 if (adjacentSpace && (newSpace.handle() == adjacentSpace->handle())) {
1542
1543 // handling both the surface and the adjacentSurface
1544
1/1
✓ Branch 1 taken 25 times.
25 mergedSurfaces.insert(surface);
1545
2/2
✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
25 mergedSurfaces.insert(*adjacentSurface);
1546
1547 // don't make interior partitions for interior air walls
1548
1/1
✓ Branch 1 taken 25 times.
25 bool isAirWall = surface.isAirWall();
1549
2/2
✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
25 bool isAdjacentAirWall = adjacentSurface->isAirWall();
1550
1551
3/4
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
25 if (isAirWall && isAdjacentAirWall) {
1552 12 continue;
1553
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
13 } else if (isAirWall) {
1554 ✗ LOG(Warn, "Interior surface '" << surface.nameString() << "' is an air wall but adjacent surface '" << adjacentSurface->nameString()
1555 << "' is not, ignoring internal mass.")
1556 ✗ continue;
1557
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
13 } else if (isAdjacentAirWall) {
1558 ✗ LOG(Warn, "Interior surface '" << adjacentSurface->nameString() << "' is an air wall but adjacent surface '" << surface.nameString()
1559 << "' is not, ignoring internal mass.")
1560 ✗ continue;
1561 ✗ }
1562
1563
2/2
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 7 times.
13 if (!interiorPartitionSurfaceGroup) {
1564
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 interiorPartitionSurfaceGroup = InteriorPartitionSurfaceGroup(model);
1565
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 interiorPartitionSurfaceGroup->setSpace(newSpace);
1566 }
1567
1568 // DLM: is there a better way to pick which vertices to keep based on outward normal?
1569
2/2
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
13 InteriorPartitionSurface interiorPartitionSurface(surface.vertices(), model);
1570
9/9
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 13 times.
✓ Branch 10 taken 13 times.
✓ Branch 13 taken 13 times.
✓ Branch 16 taken 13 times.
✓ Branch 19 taken 13 times.
✓ Branch 22 taken 13 times.
✓ Branch 25 taken 13 times.
13 interiorPartitionSurface.setName("Merged " + surface.name().get() + " - " + adjacentSurface->name().get());
1571
2/2
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
13 interiorPartitionSurface.setInteriorPartitionSurfaceGroup(*interiorPartitionSurfaceGroup);
1572
1573
3/3
✓ Branch 1 taken 13 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 12 times.
26 if (boost::optional<ConstructionBase> construction = surface.construction()) {
1574
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 interiorPartitionSurface.setConstruction(*construction);
1575 13 }
1576 13 }
1577 519 }
1578 }
1579
1580 // std::set has const keys... so I have to make a copy here (can't take by ref)
1581
2/2
✓ Branch 1 taken 50 times.
✓ Branch 5 taken 44 times.
94 std::for_each(std::begin(mergedSurfaces), std::end(mergedSurfaces), [](auto s) { s.remove(); });
1582
1583 // if there is a common designSpecificationOutdoorAir
1584
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 43 times.
44 if (designSpecificationOutdoorAir) {
1585
1586 // allow new space to inherit from space type
1587 1 bool useSpaceTypeOutdoorAir = false;
1588
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (allDesignSpecificationOutdoorAirDefaulted) {
1589 ✗ if (spaceType) {
1590 ✗ if (spaceType->designSpecificationOutdoorAir()) {
1591 ✗ if (designSpecificationOutdoorAir->handle() == spaceType->designSpecificationOutdoorAir()->handle()) {
1592 ✗ useSpaceTypeOutdoorAir = true;
1593 }
1594 }
1595 }
1596 }
1597
1598 // set common designSpecificationOutdoorAir for the new space
1599
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (!useSpaceTypeOutdoorAir) {
1600
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 newSpace.setDesignSpecificationOutdoorAir(*designSpecificationOutdoorAir);
1601 }
1602
1603 } else {
1604
1605 43 double outdoorAirForPeople = 0.0;
1606
3/4
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 41 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
43 if (sumOutdoorAirForPeople > 0 && sumNumberOfPeople > 0) {
1607 2 outdoorAirForPeople = sumOutdoorAirForPeople / sumNumberOfPeople;
1608 }
1609
1610 43 double outdoorAirForFloorArea = 0.0;
1611
3/4
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 41 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
43 if (sumOutdoorAirForFloorArea > 0 && sumFloorArea > 0) {
1612 2 outdoorAirForFloorArea = sumOutdoorAirForFloorArea / sumFloorArea;
1613 }
1614
1615 43 double outdoorAirForVolume = 0.0;
1616
3/4
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 42 times.
✓ Branch 2 taken 1 time.
✗ Branch 3 not taken.
43 if (sumOutdoorAirForVolume > 0 && sumVolume > 0) {
1617 1 outdoorAirForVolume = 3600.0 * sumOutdoorAirForVolume / sumVolume; // convert back to ACH
1618 }
1619
1620 // make a new designSpecificationOutdoorAir
1621
2/2
✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
43 designSpecificationOutdoorAir = DesignSpecificationOutdoorAir(model);
1622
4/4
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 41 times.
✓ Branch 2 taken 1 time.
✓ Branch 3 taken 1 time.
43 if (anySumOutdoorAirMethod && anyMaxOutdoorAirMethod) {
1623
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
3 designSpecificationOutdoorAir->setOutdoorAirMethod("Sum");
1624
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 42 times.
42 } else if (anyMaxOutdoorAirMethod) {
1625 ✗ designSpecificationOutdoorAir->setOutdoorAirMethod("Maximum");
1626 } else {
1627
3/3
✓ Branch 1 taken 42 times.
✓ Branch 4 taken 42 times.
✓ Branch 7 taken 42 times.
126 designSpecificationOutdoorAir->setOutdoorAirMethod("Sum");
1628 }
1629
2/2
✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
43 designSpecificationOutdoorAir->setOutdoorAirFlowperPerson(outdoorAirForPeople);
1630
2/2
✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
43 designSpecificationOutdoorAir->setOutdoorAirFlowperFloorArea(outdoorAirForFloorArea);
1631
2/2
✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
43 designSpecificationOutdoorAir->setOutdoorAirFlowRate(sumOutdoorAirRate);
1632
2/2
✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
43 designSpecificationOutdoorAir->setOutdoorAirFlowAirChangesperHour(outdoorAirForVolume);
1633
1634
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
43 if (anyDesignSpecificationOutdoorAirSchedules) {
1635 ✗ LOG(Warn, "DesignSpecificationOutdoorAir objects merged for ThermalZone '"
1636 << this->nameString() << "', could not preserve outdoor air flow rate fraction schedules");
1637 }
1638
1639
2/2
✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
43 newSpace.setDesignSpecificationOutdoorAir(*designSpecificationOutdoorAir);
1640 }
1641
1642
1/1
✓ Branch 1 taken 44 times.
44 return newSpace;
1643 80 }
1644
1645 29 std::vector<IdfObject> ThermalZone_Impl::remove() {
1646
1/1
✓ Branch 1 taken 29 times.
29 auto m = model();
1647
1648
1/1
✓ Branch 1 taken 29 times.
29 auto thermalZone = getObject<ThermalZone>();
1649
3/3
✓ Branch 1 taken 29 times.
✓ Branch 8 taken 4 times.
✓ Branch 9 taken 29 times.
33 for (auto& airloop : airLoopHVACs()) {
1650
1/1
✓ Branch 1 taken 4 times.
4 airloop.removeBranchForZone(thermalZone);
1651 29 }
1652
1653
1/1
✓ Branch 1 taken 29 times.
29 auto comps = this->equipment();
1654
1/2
✗ Branch 4 not taken.
✓ Branch 5 taken 29 times.
29 for (auto& comp : comps) {
1655 ✗ comp.remove();
1656 }
1657
1658 //detach it from the zone air node
1659
1/1
✓ Branch 1 taken 29 times.
29 auto airNode = zoneAirNode();
1660
1/1
✓ Branch 1 taken 29 times.
29 airNode.disconnect();
1661
1/1
✓ Branch 1 taken 29 times.
29 airNode.remove();
1662
1663 // remove port lists
1664
2/2
✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
29 returnPortList().remove();
1665
2/2
✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
29 inletPortList().remove();
1666
2/2
✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
29 exhaustPortList().remove();
1667
1668 // remove ZoneHVACEquipmentList: handled already by the fact that it's a child of this ParentObject
1669 // zoneHVACEquipmentList().remove();
1670
1671 // remove ZoneMixing objects
1672
3/3
✓ Branch 1 taken 29 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 29 times.
31 for (auto& mixing : this->zoneMixing()) {
1673
1/1
✓ Branch 1 taken 2 times.
2 mixing.remove();
1674 29 }
1675
1676 // remove ZoneMRTCalculation objects before the required Thermal Zone pointer is cleared
1677
4/4
✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 29 times.
30 for (auto& zoneMRTCalculation : thermalZone.getModelObjectSources<ZoneMRTCalculation>(ZoneMRTCalculation::iddObjectType())) {
1678
1/1
✓ Branch 1 taken 1 time.
1 zoneMRTCalculation.remove();
1679 29 }
1680
1681
1/1
✓ Branch 1 taken 29 times.
58 return HVACComponent_Impl::remove();
1682 29 }
1683
1684 ✗ void ThermalZone_Impl::disconnect() {
1685 ✗ auto mo = this->getObject<ModelObject>();
1686 ✗ Model _model = this->model();
1687
1688 ✗ auto pl = inletPortList();
1689 ✗ auto plPorts = pl.airLoopHVACPorts();
1690 ✗ for (const auto& port : plPorts) {
1691 ✗ _model.disconnect(pl, port);
1692 }
1693
1694 ✗ pl = returnPortList();
1695 ✗ plPorts = pl.airLoopHVACPorts();
1696 ✗ for (const auto& port : plPorts) {
1697 ✗ _model.disconnect(pl, port);
1698 }
1699 ✗ }
1700
1701 1039 bool ThermalZone_Impl::useIdealAirLoads() const {
1702
1/1
✓ Branch 1 taken 1039 times.
1039 boost::optional<std::string> value = getString(OS_ThermalZoneFields::UseIdealAirLoads);
1703
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1039 times.
✗ Branch 4 not taken.
1039 OS_ASSERT(value);
1704
3/3
✓ Branch 1 taken 1039 times.
✓ Branch 4 taken 1039 times.
✓ Branch 7 taken 1039 times.
2078 return openstudio::istringEqual(value.get(), "Yes");
1705 1039 }
1706
1707 3206 bool ThermalZone_Impl::setUseIdealAirLoads(bool useIdealAirLoads) {
1708 3206 bool result = true;
1709
1710
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 3200 times.
3206 if (useIdealAirLoads) {
1711
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
12 result &= setString(OS_ThermalZoneFields::UseIdealAirLoads, "Yes");
1712
1713
1/1
✓ Branch 1 taken 6 times.
6 std::vector<ModelObject> comps = this->equipment();
1714
1715
1/2
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
6 for (auto& comp : comps) {
1716 ✗ comp.remove();
1717 }
1718
1719
2/3
✓ Branch 1 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
12 if (boost::optional<AirLoopHVAC> airLoop = this->airLoopHVAC()) {
1720 ✗ auto thisObject = this->getObject<ThermalZone>();
1721
1722 ✗ result &= airLoop->removeBranchForZone(thisObject);
1723 6 }
1724
1725 6 } else {
1726
2/2
✓ Branch 1 taken 3200 times.
✓ Branch 4 taken 3200 times.
9600 result &= setString(OS_ThermalZoneFields::UseIdealAirLoads, "No");
1727 }
1728 3206 return result;
1729 }
1730
1731 ✗ boost::optional<ModelObject> ThermalZone_Impl::thermostatSetpointDualSetpointAsModelObject() const {
1732 ✗ OptionalModelObject result;
1733 ✗ OptionalThermostatSetpointDualSetpoint intermediate = thermostatSetpointDualSetpoint();
1734 ✗ if (intermediate) {
1735 ✗ result = *intermediate;
1736 }
1737 ✗ return result;
1738 ✗ }
1739
1740 ✗ boost::optional<ModelObject> ThermalZone_Impl::zoneControlHumidistatAsModelObject() const {
1741 ✗ OptionalModelObject result;
1742 ✗ OptionalZoneControlHumidistat intermediate = zoneControlHumidistat();
1743 ✗ if (intermediate) {
1744 ✗ result = *intermediate;
1745 }
1746 ✗ return result;
1747 ✗ }
1748
1749 ✗ boost::optional<ModelObject> ThermalZone_Impl::primaryDaylightingControlAsModelObject() const {
1750 ✗ OptionalModelObject result;
1751 ✗ OptionalDaylightingControl intermediate = primaryDaylightingControl();
1752 ✗ if (intermediate) {
1753 ✗ result = *intermediate;
1754 }
1755 ✗ return result;
1756 ✗ }
1757
1758 ✗ boost::optional<ModelObject> ThermalZone_Impl::secondaryDaylightingControlAsModelObject() const {
1759 ✗ OptionalModelObject result;
1760 ✗ OptionalDaylightingControl intermediate = secondaryDaylightingControl();
1761 ✗ if (intermediate) {
1762 ✗ result = *intermediate;
1763 }
1764 ✗ return result;
1765 ✗ }
1766
1767 ✗ boost::optional<ModelObject> ThermalZone_Impl::illuminanceMapAsModelObject() const {
1768 ✗ OptionalModelObject result;
1769 ✗ OptionalIlluminanceMap intermediate = illuminanceMap();
1770 ✗ if (intermediate) {
1771 ✗ result = *intermediate;
1772 }
1773 ✗ return result;
1774 ✗ }
1775
1776 ✗ boost::optional<ModelObject> ThermalZone_Impl::renderingColorAsModelObject() const {
1777 ✗ OptionalModelObject result;
1778 ✗ OptionalRenderingColor intermediate = renderingColor();
1779 ✗ if (intermediate) {
1780 ✗ result = *intermediate;
1781 }
1782 ✗ return result;
1783 ✗ }
1784
1785 ✗ std::vector<ModelObject> ThermalZone_Impl::equipmentAsModelObjects() {
1786 ✗ ModelObjectVector result = castVector<ModelObject>(equipment());
1787 ✗ return result;
1788 }
1789
1790 ✗ std::vector<ModelObject> ThermalZone_Impl::spacesAsModelObjects() const {
1791 ✗ ModelObjectVector result = castVector<ModelObject>(spaces());
1792 ✗ return result;
1793 }
1794
1795 ✗ bool ThermalZone_Impl::setThermostatSetpointDualSetpointAsModelObject(const boost::optional<ModelObject>& modelObject) {
1796 ✗ if (modelObject) {
1797 ✗ OptionalThermostatSetpointDualSetpoint intermediate = modelObject->optionalCast<ThermostatSetpointDualSetpoint>();
1798 ✗ if (intermediate) {
1799 ✗ return setThermostatSetpointDualSetpoint(*intermediate);
1800 } else {
1801 ✗ return false;
1802 }
1803 ✗ } else {
1804 ✗ resetThermostatSetpointDualSetpoint();
1805 }
1806 ✗ return true;
1807 }
1808
1809 ✗ bool ThermalZone_Impl::setZoneControlHumidistatAsModelObject(const boost::optional<ModelObject>& modelObject) {
1810 ✗ if (modelObject) {
1811 ✗ OptionalZoneControlHumidistat intermediate = modelObject->optionalCast<ZoneControlHumidistat>();
1812 ✗ if (intermediate) {
1813 ✗ return setZoneControlHumidistat(*intermediate);
1814 } else {
1815 ✗ return false;
1816 }
1817 ✗ } else {
1818 ✗ resetZoneControlHumidistat();
1819 }
1820 ✗ return true;
1821 }
1822
1823 ✗ bool ThermalZone_Impl::setPrimaryDaylightingControlAsModelObject(const boost::optional<ModelObject>& modelObject) {
1824 ✗ if (modelObject) {
1825 ✗ OptionalDaylightingControl intermediate = modelObject->optionalCast<DaylightingControl>();
1826 ✗ if (intermediate) {
1827 ✗ return setPrimaryDaylightingControl(*intermediate);
1828 } else {
1829 ✗ return false;
1830 }
1831 ✗ } else {
1832 ✗ resetPrimaryDaylightingControl();
1833 }
1834 ✗ return true;
1835 }
1836
1837 ✗ bool ThermalZone_Impl::setSecondaryDaylightingControlAsModelObject(const boost::optional<ModelObject>& modelObject) {
1838 ✗ if (modelObject) {
1839 ✗ OptionalDaylightingControl intermediate = modelObject->optionalCast<DaylightingControl>();
1840 ✗ if (intermediate) {
1841 ✗ return setSecondaryDaylightingControl(*intermediate);
1842 } else {
1843 ✗ return false;
1844 }
1845 ✗ } else {
1846 ✗ resetSecondaryDaylightingControl();
1847 }
1848 ✗ return true;
1849 }
1850
1851 ✗ bool ThermalZone_Impl::setIlluminanceMapAsModelObject(const boost::optional<ModelObject>& modelObject) {
1852 ✗ if (modelObject) {
1853 ✗ OptionalIlluminanceMap intermediate = modelObject->optionalCast<IlluminanceMap>();
1854 ✗ if (intermediate) {
1855 ✗ return setIlluminanceMap(*intermediate);
1856 } else {
1857 ✗ return false;
1858 }
1859 ✗ } else {
1860 ✗ resetIlluminanceMap();
1861 }
1862 ✗ return true;
1863 }
1864
1865 ✗ bool ThermalZone_Impl::setRenderingColorAsModelObject(const boost::optional<ModelObject>& modelObject) {
1866 ✗ if (modelObject) {
1867 ✗ OptionalRenderingColor intermediate = modelObject->optionalCast<RenderingColor>();
1868 ✗ if (intermediate) {
1869 ✗ return setRenderingColor(*intermediate);
1870 } else {
1871 ✗ return false;
1872 }
1873 ✗ } else {
1874 ✗ resetRenderingColor();
1875 }
1876 ✗ return true;
1877 }
1878
1879 784 SizingZone ThermalZone_Impl::sizingZone() const {
1880
1881
3/3
✓ Branch 1 taken 784 times.
✓ Branch 4 taken 784 times.
✓ Branch 7 taken 784 times.
784 std::vector<SizingZone> sizingObjects = getObject<ModelObject>().getModelObjectSources<SizingZone>(SizingZone::iddObjectType());
1882
1883
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 784 times.
784 if (sizingObjects.empty()) {
1884 ✗ LOG_AND_THROW("ThermalZone missing Sizing:Zone object");
1885 } else {
1886
1/1
✓ Branch 2 taken 784 times.
1568 return sizingObjects[0];
1887 }
1888 784 }
1889
1890 372 bool ThermalZone_Impl::addToNodeImpl(Node& node) {
1891
1/1
✓ Branch 1 taken 372 times.
372 Model _model = model();
1892
1893
1/1
✓ Branch 1 taken 372 times.
372 auto thisObject = getObject<ThermalZone>();
1894
1895
3/4
✓ Branch 1 taken 372 times.
✓ Branch 4 taken 372 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 372 times.
372 if (node.model() != _model) {
1896 ✗ return false;
1897 }
1898
1899
2/3
✓ Branch 1 taken 372 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 372 times.
372 if (isPlenum()) {
1900 ✗ return false;
1901 }
1902
1903
1/1
✓ Branch 1 taken 372 times.
372 auto airLoop = node.airLoopHVAC();
1904
1905
1/2
✓ Branch 0 taken 372 times.
✗ Branch 1 not taken.
372 if (airLoop) {
1906
1/1
✓ Branch 1 taken 372 times.
372 auto loops = airLoopHVACs();
1907
2/2
✓ Branch 5 taken 9 times.
✓ Branch 6 taken 371 times.
380 for (const auto& loop : loops) {
1908
6/6
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
✓ Branch 10 taken 9 times.
✓ Branch 12 taken 1 time.
✓ Branch 13 taken 8 times.
9 if (loop.handle() == airLoop->handle()) {
1909 1 return false;
1910 }
1911 }
1912
1913
1/1
✓ Branch 1 taken 371 times.
371 auto inletObj = node.inletModelObject();
1914
1/1
✓ Branch 1 taken 371 times.
371 auto outletObj = node.outletModelObject();
1915
1916
3/6
✓ Branch 0 taken 371 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 371 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 371 times.
✗ Branch 5 not taken.
742 if (inletObj && outletObj) {
1917 // Rules for allowing connection:
1918 // * It must be the last node on the demand branch, meaning the outlet must be the Mixer
1919 // * There must not be any ThermalZone on the branch already
1920 // * (If ok, then the inletObj is usually an AirTerminal)
1921 // * In the most common case where not ok, inletObj is a PortList that connects to the ThermalZone
1922 // * inletObj can also be OS:AirLoopHVAC:ReturnPlenum
1923 // * => can't really check if inletObj is a Class, instead we check that the demand branch (between splitter and node) doesn't have a
1924 // ThermalZone already
1925
7/12
✓ Branch 1 taken 371 times.
✓ Branch 4 taken 371 times.
✓ Branch 7 taken 371 times.
✓ Branch 10 taken 371 times.
✓ Branch 13 taken 371 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 368 times.
✓ Branch 17 taken 3 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
742 if ((airLoop->demandComponents(airLoop->demandSplitter(), node, IddObjectType::OS_ThermalZone).empty())
1926
9/13
✓ Branch 1 taken 371 times.
✓ Branch 4 taken 368 times.
✓ Branch 5 taken 3 times.
✓ Branch 7 taken 368 times.
✓ Branch 10 taken 368 times.
✓ Branch 13 taken 368 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 368 times.
✓ Branch 16 taken 3 times.
✓ Branch 18 taken 371 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1110 && (outletObj->optionalCast<Mixer>())) {
1927
1/1
✓ Branch 1 taken 368 times.
368 Node newNode(_model);
1928
1/1
✓ Branch 1 taken 368 times.
368 auto thisobj = getObject<ThermalZone>();
1929
1/1
✓ Branch 1 taken 368 times.
368 auto _inletPortList = inletPortList();
1930
1/1
✓ Branch 1 taken 368 times.
368 auto _returnPortList = returnPortList();
1931
1932
3/3
✓ Branch 1 taken 368 times.
✓ Branch 4 taken 368 times.
✓ Branch 7 taken 368 times.
368 unsigned oldMixerPort = node.connectedObjectPort(node.outletPort()).get();
1933
1934
5/5
✓ Branch 1 taken 368 times.
✓ Branch 4 taken 368 times.
✓ Branch 7 taken 368 times.
✓ Branch 10 taken 368 times.
✓ Branch 13 taken 368 times.
368 _model.connect(node, node.outletPort(), _inletPortList, _inletPortList.nextPort());
1935
1936
5/5
✓ Branch 1 taken 368 times.
✓ Branch 4 taken 368 times.
✓ Branch 7 taken 368 times.
✓ Branch 10 taken 368 times.
✓ Branch 13 taken 368 times.
368 _model.connect(_returnPortList, _returnPortList.nextPort(), newNode, newNode.inletPort());
1937
1938
5/5
✓ Branch 1 taken 368 times.
✓ Branch 4 taken 368 times.
✓ Branch 7 taken 368 times.
✓ Branch 10 taken 368 times.
✓ Branch 13 taken 368 times.
368 _model.connect(newNode, newNode.outletPort(), outletObj.get(), oldMixerPort);
1939
1940 // Add the terminal to equipment list
1941
12/18
✓ Branch 1 taken 368 times.
✓ Branch 4 taken 368 times.
✓ Branch 7 taken 15 times.
✓ Branch 8 taken 353 times.
✓ Branch 10 taken 15 times.
✓ Branch 13 taken 15 times.
✓ Branch 16 taken 15 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 15 times.
✓ Branch 19 taken 353 times.
✓ Branch 21 taken 368 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 15 times.
✓ Branch 25 taken 353 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
368 if ((!inletObj->optionalCast<Splitter>()) && (!inletObj->optionalCast<Node>())) {
1942
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 addEquipment(inletObj.get());
1943
1944 15 if (boost::optional<AirTerminalSingleDuctParallelPIUReheat> terminal =
1945
4/4
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
✓ Branch 6 taken 1 time.
✓ Branch 7 taken 14 times.
30 inletObj->optionalCast<AirTerminalSingleDuctParallelPIUReheat>()) {
1946
1/1
✓ Branch 1 taken 1 time.
1 Node secondaryInletNode(_model);
1947
1948
1/1
✓ Branch 1 taken 1 time.
1 PortList t_exhaustPortList = exhaustPortList();
1949
1950
5/5
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
1 _model.connect(t_exhaustPortList, t_exhaustPortList.nextPort(), secondaryInletNode, secondaryInletNode.inletPort());
1951
1952
7/7
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
1 _model.connect(secondaryInletNode, secondaryInletNode.outletPort(), terminal.get(), terminal->secondaryAirInletPort());
1953 1 } else if (boost::optional<AirTerminalSingleDuctSeriesPIUReheat> terminal =
1954
4/4
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 6 taken 1 time.
✓ Branch 7 taken 13 times.
28 inletObj->optionalCast<AirTerminalSingleDuctSeriesPIUReheat>()) {
1955
1/1
✓ Branch 1 taken 1 time.
1 Node secondaryInletNode(_model);
1956
1957
1/1
✓ Branch 1 taken 1 time.
1 PortList t_exhaustPortList = exhaustPortList();
1958
1959
5/5
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
1 _model.connect(t_exhaustPortList, t_exhaustPortList.nextPort(), secondaryInletNode, secondaryInletNode.inletPort());
1960
1961
7/7
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
1 _model.connect(secondaryInletNode, secondaryInletNode.outletPort(), terminal.get(), terminal->secondaryAirInletPort());
1962 1 } else if (boost::optional<AirTerminalSingleDuctConstantVolumeFourPipeInduction> terminal =
1963
4/4
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 6 taken 1 time.
✓ Branch 7 taken 12 times.
26 inletObj->optionalCast<AirTerminalSingleDuctConstantVolumeFourPipeInduction>()) {
1964
1/1
✓ Branch 1 taken 1 time.
1 Node inducedAirInletNode(_model);
1965
1966
1/1
✓ Branch 1 taken 1 time.
1 PortList t_exhaustPortList = exhaustPortList();
1967
1968
5/5
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
1 _model.connect(t_exhaustPortList, t_exhaustPortList.nextPort(), inducedAirInletNode, inducedAirInletNode.inletPort());
1969
1970
7/7
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
1 _model.connect(inducedAirInletNode, inducedAirInletNode.outletPort(), terminal.get(), terminal->inducedAirInletPort());
1971 43 }
1972 }
1973
1974
1/1
✓ Branch 1 taken 368 times.
368 setUseIdealAirLoads(false);
1975
1976 // If there is a single zone reheat spm, see if the control zone is set.
1977 // If not set, then set it to this zone.
1978
1979
3/3
✓ Branch 1 taken 368 times.
✓ Branch 4 taken 368 times.
✓ Branch 7 taken 368 times.
368 std::vector<ModelObject> supplyNodes = airLoop->supplyComponents(Node::iddObjectType());
1980
1981
2/2
✓ Branch 5 taken 877 times.
✓ Branch 6 taken 368 times.
1245 for (const auto& supplyNode : supplyNodes) {
1982 {
1983 std::vector<SetpointManagerSingleZoneReheat> setpointManagers =
1984
3/3
✓ Branch 1 taken 877 times.
✓ Branch 4 taken 877 times.
✓ Branch 7 taken 877 times.
877 subsetCastVector<SetpointManagerSingleZoneReheat>(supplyNode.cast<Node>().setpointManagers());
1985
2/2
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 859 times.
877 if (!setpointManagers.empty()) {
1986
1/1
✓ Branch 2 taken 18 times.
18 SetpointManagerSingleZoneReheat spm = setpointManagers.front();
1987
3/3
✓ Branch 1 taken 18 times.
✓ Branch 5 taken 6 times.
✓ Branch 6 taken 12 times.
18 if (!spm.controlZone()) {
1988
1/1
✓ Branch 1 taken 6 times.
6 spm.setControlZone(thisobj);
1989 }
1990 18 }
1991 877 }
1992
1993 {
1994 std::vector<SetpointManagerSingleZoneCooling> setpointManagers =
1995
3/3
✓ Branch 1 taken 877 times.
✓ Branch 4 taken 877 times.
✓ Branch 7 taken 877 times.
877 subsetCastVector<SetpointManagerSingleZoneCooling>(supplyNode.cast<Node>().setpointManagers());
1996
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 877 times.
877 if (!setpointManagers.empty()) {
1997 ✗ SetpointManagerSingleZoneCooling spm = setpointManagers.front();
1998 ✗ if (!spm.controlZone()) {
1999 ✗ spm.setControlZone(thisobj);
2000 }
2001 ✗ }
2002 877 }
2003
2004 {
2005 std::vector<SetpointManagerSingleZoneHeating> setpointManagers =
2006
3/3
✓ Branch 1 taken 877 times.
✓ Branch 4 taken 877 times.
✓ Branch 7 taken 877 times.
877 subsetCastVector<SetpointManagerSingleZoneHeating>(supplyNode.cast<Node>().setpointManagers());
2007
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 877 times.
877 if (!setpointManagers.empty()) {
2008 ✗ SetpointManagerSingleZoneHeating spm = setpointManagers.front();
2009 ✗ if (!spm.controlZone()) {
2010 ✗ spm.setControlZone(thisobj);
2011 }
2012 ✗ }
2013 877 }
2014 }
2015
2016 368 return true;
2017 368 }
2018 }
2019 1108 }
2020
2021 3 return false;
2022 372 }
2023
2024 358 bool ThermalZone_Impl::addToNode(Node& node) {
2025
1/1
✓ Branch 1 taken 358 times.
358 auto loops = airLoopHVACs();
2026
1/1
✓ Branch 1 taken 358 times.
358 auto result = addToNodeImpl(node);
2027
1/1
✓ Branch 1 taken 358 times.
358 auto zone = getObject<model::ThermalZone>();
2028
2029
1/2
✓ Branch 0 taken 358 times.
✗ Branch 1 not taken.
358 if (result) {
2030
2/2
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 358 times.
359 for (auto& loop : loops) {
2031
1/1
✓ Branch 1 taken 1 time.
1 loop.removeBranchForZone(zone);
2032 }
2033 }
2034
2035 358 return result;
2036 358 }
2037
2038 14 bool ThermalZone_Impl::multiAddToNode(Node& node) {
2039 14 return addToNodeImpl(node);
2040 }
2041
2042 21213 PortList ThermalZone_Impl::inletPortList() const {
2043
2/2
✓ Branch 1 taken 21213 times.
✓ Branch 4 taken 21213 times.
21213 boost::optional<PortList> pl = getObject<ModelObject>().getModelObjectTarget<PortList>(OS_ThermalZoneFields::ZoneAirInletPortList);
2044
2045
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 21213 times.
✗ Branch 4 not taken.
21213 OS_ASSERT(pl);
2046
2047
2/2
✓ Branch 1 taken 21213 times.
✓ Branch 4 taken 21213 times.
42426 return pl.get();
2048 21213 }
2049
2050 301 PortList ThermalZone_Impl::exhaustPortList() const {
2051
2/2
✓ Branch 1 taken 301 times.
✓ Branch 4 taken 301 times.
301 boost::optional<PortList> pl = getObject<ModelObject>().getModelObjectTarget<PortList>(OS_ThermalZoneFields::ZoneAirExhaustPortList);
2052
2053
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 301 times.
✗ Branch 4 not taken.
301 OS_ASSERT(pl);
2054
2055
2/2
✓ Branch 1 taken 301 times.
✓ Branch 4 taken 301 times.
602 return pl.get();
2056 301 }
2057
2058 2409 ZoneHVACEquipmentList ThermalZone_Impl::zoneHVACEquipmentList() const {
2059 2409 boost::optional<ZoneHVACEquipmentList> result;
2060
2061 std::vector<ZoneHVACEquipmentList> list =
2062
3/3
✓ Branch 1 taken 2409 times.
✓ Branch 4 taken 2409 times.
✓ Branch 7 taken 2409 times.
2409 getObject<ModelObject>().getModelObjectSources<ZoneHVACEquipmentList>(ZoneHVACEquipmentList::iddObjectType());
2063
2064 //std::vector<ZoneHVACEquipmentList> list = model().getConcreteModelObjects<ZoneHVACEquipmentList>();
2065
2066
2/2
✓ Branch 5 taken 2409 times.
✓ Branch 6 taken 2409 times.
4818 for (const auto& elem : list) {
2067
5/6
✓ Branch 1 taken 2409 times.
✓ Branch 4 taken 2409 times.
✓ Branch 7 taken 2409 times.
✓ Branch 10 taken 2409 times.
✓ Branch 13 taken 2409 times.
✗ Branch 14 not taken.
2409 if (elem.thermalZone().handle() == handle()) {
2068
1/1
✓ Branch 1 taken 2409 times.
2409 result = elem;
2069 }
2070 }
2071
2072
1/2
✓ Branch 0 taken 2409 times.
✗ Branch 1 not taken.
2409 if (result) {
2073
2/2
✓ Branch 1 taken 2409 times.
✓ Branch 4 taken 2409 times.
4818 return result.get();
2074 } else {
2075 ✗ LOG_AND_THROW("ThermalZone missing ZoneHVAC:EquipmentList object");
2076 }
2077 2409 }
2078
2079 447 bool ThermalZone_Impl::addEquipment(const ModelObject& equipment) {
2080
2/2
✓ Branch 1 taken 447 times.
✓ Branch 4 taken 447 times.
447 return zoneHVACEquipmentList().addEquipment(equipment);
2081 }
2082
2083 65 bool ThermalZone_Impl::removeEquipment(const ModelObject& equipment) {
2084
2/2
✓ Branch 1 taken 65 times.
✓ Branch 4 taken 65 times.
65 return zoneHVACEquipmentList().removeEquipment(equipment);
2085 }
2086
2087 34 bool ThermalZone_Impl::setCoolingPriority(const ModelObject& equipment, unsigned priority) {
2088
2/2
✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
34 return zoneHVACEquipmentList().setCoolingPriority(equipment, priority);
2089 }
2090
2091 36 bool ThermalZone_Impl::setHeatingPriority(const ModelObject& equipment, unsigned priority) {
2092
2/2
✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
36 return zoneHVACEquipmentList().setHeatingPriority(equipment, priority);
2093 }
2094
2095 1079 std::vector<ModelObject> ThermalZone_Impl::equipment() const {
2096
2/2
✓ Branch 1 taken 1079 times.
✓ Branch 4 taken 1079 times.
1079 return zoneHVACEquipmentList().equipment();
2097 }
2098
2099 4 std::string ThermalZone_Impl::loadDistributionScheme() const {
2100
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 return zoneHVACEquipmentList().loadDistributionScheme();
2101 }
2102
2103 9 bool ThermalZone_Impl::setLoadDistributionScheme(const std::string& scheme) {
2104
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 return zoneHVACEquipmentList().setLoadDistributionScheme(scheme);
2105 }
2106
2107 3 std::vector<ModelObject> ThermalZone_Impl::equipmentInHeatingOrder() const {
2108
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 return zoneHVACEquipmentList().equipmentInHeatingOrder();
2109 }
2110
2111 3 std::vector<ModelObject> ThermalZone_Impl::equipmentInCoolingOrder() const {
2112
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 return zoneHVACEquipmentList().equipmentInCoolingOrder();
2113 }
2114
2115 10 boost::optional<double> ThermalZone_Impl::sequentialCoolingFraction(const ModelObject& equipment) const {
2116
2117 10 boost::optional<double> result;
2118
2119
3/3
✓ Branch 1 taken 10 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 4 times.
20 if (boost::optional<Schedule> _schedule = sequentialCoolingFractionSchedule(equipment)) {
2120
3/4
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
12 if (boost::optional<ScheduleConstant> _schConstant = _schedule->optionalCast<ScheduleConstant>()) {
2121
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
6 result = boost::optional<double>(_schConstant->value());
2122 } else {
2123 ✗ LOG(Warn, "This deprecated method cannot return a double when the "
2124 "'Zone Equipment Sequential Cooling Fraction Schedule' isn't a Schedule:Constant, "
2125 "here the schedule is a '"
2126 << _schedule->iddObject().name() << ". Occurred for " << briefDescription());
2127 6 }
2128 10 }
2129
2130 10 return result;
2131 }
2132
2133 14 boost::optional<Schedule> ThermalZone_Impl::sequentialCoolingFractionSchedule(const ModelObject& equipment) const {
2134
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 return zoneHVACEquipmentList().sequentialCoolingFractionSchedule(equipment);
2135 }
2136
2137 9 boost::optional<double> ThermalZone_Impl::sequentialHeatingFraction(const ModelObject& equipment) const {
2138 9 boost::optional<double> result;
2139
2140
3/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 4 times.
18 if (boost::optional<Schedule> _schedule = sequentialHeatingFractionSchedule(equipment)) {
2141
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (boost::optional<ScheduleConstant> _schConstant = _schedule->optionalCast<ScheduleConstant>()) {
2142
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 result = boost::optional<double>(_schConstant->value());
2143 } else {
2144 ✗ LOG(Warn, "This deprecated method cannot return a double when the "
2145 "'Zone Equipment Sequential Heating Fraction Schedule' isn't a Schedule:Constant, "
2146 "here the schedule is a '"
2147 << _schedule->iddObject().name() << ". Occurred for " << briefDescription());
2148 5 }
2149 9 }
2150
2151 9 return result;
2152 }
2153
2154 12 boost::optional<Schedule> ThermalZone_Impl::sequentialHeatingFractionSchedule(const ModelObject& equipment) const {
2155
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 return zoneHVACEquipmentList().sequentialHeatingFractionSchedule(equipment);
2156 }
2157
2158 5 bool ThermalZone_Impl::setSequentialCoolingFraction(const ModelObject& equipment, double fraction) {
2159
1/1
✓ Branch 1 taken 5 times.
5 Model model = this->model();
2160
1/1
✓ Branch 1 taken 5 times.
5 ScheduleConstant schedule(model);
2161
1/1
✓ Branch 1 taken 5 times.
5 schedule.setValue(fraction);
2162
2163
1/1
✓ Branch 1 taken 5 times.
10 return setSequentialCoolingFractionSchedule(equipment, schedule);
2164 5 }
2165
2166 6 bool ThermalZone_Impl::setSequentialCoolingFractionSchedule(const ModelObject& equipment, Schedule& schedule) {
2167
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 return zoneHVACEquipmentList().setSequentialCoolingFractionSchedule(equipment, schedule);
2168 }
2169
2170 3 bool ThermalZone_Impl::setSequentialHeatingFraction(const ModelObject& equipment, double fraction) {
2171
1/1
✓ Branch 1 taken 3 times.
3 Model model = this->model();
2172
1/1
✓ Branch 1 taken 3 times.
3 ScheduleConstant schedule(model);
2173
1/1
✓ Branch 1 taken 3 times.
3 schedule.setValue(fraction);
2174
2175
1/1
✓ Branch 1 taken 3 times.
6 return setSequentialHeatingFractionSchedule(equipment, schedule);
2176 3 }
2177
2178 4 bool ThermalZone_Impl::setSequentialHeatingFractionSchedule(const ModelObject& equipment, Schedule& schedule) {
2179
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 return zoneHVACEquipmentList().setSequentialHeatingFractionSchedule(equipment, schedule);
2180 }
2181
2182 16 ModelObject ThermalZone_Impl::clone(Model model) const {
2183
3/3
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
16 auto tz = HVACComponent_Impl::clone(model).cast<ThermalZone>();
2184 // We need this because "connect" is first going to try to disconnect from anything
2185 // currently attached. At this point tz is left pointing (through a connection) to the old zone air node,
2186 // (because of ModelObject::clone behavior) so connecting to the new node will remove the connection joining
2187 // the original zone and the original node.
2188
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
32 tz.setString(OS_ThermalZoneFields::ZoneAirNodeName, "");
2189
2190
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
32 tz.setString(OS_ThermalZoneFields::ThermostatName, "");
2191
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 tz.setString(OS_ThermalZoneFields::HumidistatName, "");
2192
2193
1/1
✓ Branch 1 taken 16 times.
16 Node node(model);
2194
5/5
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
✓ Branch 13 taken 16 times.
16 model.connect(tz, tz.zoneAirPort(), node, node.inletPort());
2195
2196
1/1
✓ Branch 1 taken 16 times.
16 PortList inletPortList(tz);
2197
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 tz.setPointer(OS_ThermalZoneFields::ZoneAirInletPortList, inletPortList.handle());
2198
2199
1/1
✓ Branch 1 taken 16 times.
16 PortList exhaustPortList(tz);
2200
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 tz.setPointer(OS_ThermalZoneFields::ZoneAirExhaustPortList, exhaustPortList.handle());
2201
2202
1/1
✓ Branch 1 taken 16 times.
16 PortList outletPortList(tz);
2203
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 tz.setPointer(OS_ThermalZoneFields::ZoneReturnAirPortList, outletPortList.handle());
2204
2205
4/4
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
16 auto sizingZoneClone = sizingZone().clone(model).cast<SizingZone>();
2206
1/1
✓ Branch 3 taken 16 times.
16 sizingZoneClone.getImpl<detail::SizingZone_Impl>()->setThermalZone(tz);
2207
2208
1/1
✓ Branch 1 taken 16 times.
16 ZoneHVACEquipmentList equipmentList(tz);
2209
2210
3/3
✓ Branch 1 taken 16 times.
✓ Branch 3 taken 9 times.
✓ Branch 4 taken 7 times.
32 if (auto t_thermostat = thermostat()) {
2211
4/4
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
✓ Branch 10 taken 9 times.
9 auto thermostatClone = t_thermostat->clone(model).cast<Thermostat>();
2212
1/1
✓ Branch 1 taken 9 times.
9 tz.setThermostat(thermostatClone);
2213 25 }
2214
2215
3/3
✓ Branch 1 taken 16 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 14 times.
32 if (auto t_humidistat = zoneControlHumidistat()) {
2216
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 auto humidistatClone = t_humidistat->clone(model).cast<ZoneControlHumidistat>();
2217
1/1
✓ Branch 1 taken 2 times.
2 tz.setZoneControlHumidistat(humidistatClone);
2218 18 }
2219
2220
3/3
✓ Branch 1 taken 16 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 15 times.
32 if (auto t_controller = zoneControlContaminantController()) {
2221
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 auto controllerClone = t_controller->clone(model).cast<ZoneControlContaminantController>();
2222
1/1
✓ Branch 1 taken 1 time.
1 tz.setZoneControlContaminantController(controllerClone);
2223 17 }
2224
2225 // DLM: do not clone zone mixing objects
2226
2227
3/3
✓ Branch 1 taken 16 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 15 times.
32 if (auto t_afnzone = airflowNetworkZone()) {
2228
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 auto afnzoneClone = t_afnzone->clone(model).cast<AirflowNetworkZone>();
2229
1/1
✓ Branch 1 taken 1 time.
1 afnzoneClone.setThermalZone(tz);
2230 17 }
2231
2232 32 return std::move(tz);
2233 16 }
2234
2235 20945 boost::optional<AirLoopHVACSupplyPlenum> ThermalZone_Impl::airLoopHVACSupplyPlenum() const {
2236 20945 boost::optional<AirLoopHVACSupplyPlenum> result;
2237
2238
2/2
✓ Branch 1 taken 20945 times.
✓ Branch 4 taken 20945 times.
20945 std::vector<AirLoopHVACSupplyPlenum> plenums = model().getConcreteModelObjects<AirLoopHVACSupplyPlenum>();
2239
2240
2/2
✓ Branch 5 taken 75 times.
✓ Branch 6 taken 20920 times.
20995 for (const auto& plenum : plenums) {
2241
3/3
✓ Branch 1 taken 75 times.
✓ Branch 3 taken 66 times.
✓ Branch 4 taken 9 times.
150 if (boost::optional<ThermalZone> tz = plenum.thermalZone()) {
2242
6/6
✓ Branch 1 taken 66 times.
✓ Branch 4 taken 66 times.
✓ Branch 7 taken 66 times.
✓ Branch 10 taken 66 times.
✓ Branch 12 taken 25 times.
✓ Branch 13 taken 41 times.
66 if (tz->handle() == handle()) {
2243
1/1
✓ Branch 1 taken 25 times.
25 return plenum;
2244 }
2245 75 }
2246 }
2247
2248 20920 return result;
2249 20945 }
2250
2251 20958 boost::optional<AirLoopHVACReturnPlenum> ThermalZone_Impl::airLoopHVACReturnPlenum() const {
2252 20958 boost::optional<AirLoopHVACReturnPlenum> result;
2253
2254
2/2
✓ Branch 1 taken 20958 times.
✓ Branch 4 taken 20958 times.
20958 std::vector<AirLoopHVACReturnPlenum> plenums = model().getConcreteModelObjects<AirLoopHVACReturnPlenum>();
2255
2256
2/2
✓ Branch 5 taken 73 times.
✓ Branch 6 taken 20939 times.
21012 for (const auto& plenum : plenums) {
2257
3/3
✓ Branch 1 taken 73 times.
✓ Branch 3 taken 64 times.
✓ Branch 4 taken 9 times.
146 if (boost::optional<ThermalZone> tz = plenum.thermalZone()) {
2258
6/6
✓ Branch 1 taken 64 times.
✓ Branch 4 taken 64 times.
✓ Branch 7 taken 64 times.
✓ Branch 10 taken 64 times.
✓ Branch 12 taken 19 times.
✓ Branch 13 taken 45 times.
64 if (tz->handle() == handle()) {
2259
1/1
✓ Branch 1 taken 19 times.
19 return plenum;
2260 }
2261 73 }
2262 }
2263
2264 20939 return result;
2265 20958 }
2266
2267 20923 bool ThermalZone_Impl::isPlenum() const {
2268 20923 bool result = false;
2269
11/16
✓ Branch 1 taken 20923 times.
✓ Branch 4 taken 20912 times.
✓ Branch 5 taken 11 times.
✓ Branch 7 taken 20912 times.
✓ Branch 10 taken 17 times.
✓ Branch 11 taken 20895 times.
✓ Branch 12 taken 20912 times.
✓ Branch 13 taken 11 times.
✓ Branch 15 taken 20923 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 28 times.
✓ Branch 19 taken 20895 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
62758 if (airLoopHVACReturnPlenum() || airLoopHVACSupplyPlenum()) {
2270 28 result = true;
2271 }
2272 20923 return result;
2273 }
2274
2275 38 bool ThermalZone_Impl::canBePlenum() const {
2276 38 bool result = true;
2277
2278
7/16
✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 38 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 38 times.
✓ Branch 12 taken 38 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 38 times.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 38 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
76 if (airLoopHVAC() || (!equipment().empty())) {
2279 ✗ result = false;
2280 }
2281
2282 38 return result;
2283 }
2284
2285 15 bool ThermalZone_Impl::setSupplyPlenum(const ThermalZone& plenumZone, unsigned branchIndex) {
2286 15 bool result = true;
2287
2288
2/3
✓ Branch 1 taken 15 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15 times.
15 if (!plenumZone.canBePlenum()) {
2289 ✗ result = false;
2290 }
2291
2292
1/1
✓ Branch 1 taken 15 times.
15 boost::optional<AirLoopHVAC> t_airLoopHVAC = airLoopHVAC();
2293
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
15 if (!t_airLoopHVAC) {
2294 ✗ result = false;
2295 }
2296
2297 15 boost::optional<AirLoopHVACSupplyPlenum> plenum;
2298
2299
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
15 if (result) {
2300
1/1
✓ Branch 3 taken 15 times.
15 plenum = plenumZone.getImpl<ThermalZone_Impl>()->airLoopHVACSupplyPlenum();
2301 15 boost::optional<AirLoopHVAC> plenumAirLoop;
2302
2303
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 7 times.
15 if (plenum) {
2304
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 plenumAirLoop = plenum->airLoopHVAC();
2305 }
2306
2307
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 7 times.
15 if (plenumAirLoop) {
2308
4/5
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 8 times.
8 if (plenumAirLoop.get() != t_airLoopHVAC.get()) {
2309 ✗ result = false;
2310 }
2311 }
2312 15 }
2313
2314
1/1
✓ Branch 1 taken 15 times.
15 Model t_model = model();
2315
2316
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
15 if (result) {
2317
2/2
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 8 times.
15 if (!plenum) {
2318
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 plenum = AirLoopHVACSupplyPlenum(t_model);
2319
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 plenum->setThermalZone(plenumZone);
2320 }
2321 }
2322
2323 15 boost::optional<AirLoopHVACZoneSplitter> zoneSplitter;
2324
2325
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
15 if (result) {
2326
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 auto zoneSplitters = t_airLoopHVAC->zoneSplitters();
2327
1/2
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
15 if (branchIndex < zoneSplitters.size()) {
2328
1/1
✓ Branch 2 taken 15 times.
15 zoneSplitter = zoneSplitters[branchIndex];
2329 }
2330 15 }
2331
2332
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
15 if (!zoneSplitter) {
2333 ✗ result = false;
2334 }
2335
2336
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
15 if (result) {
2337
1/1
✓ Branch 1 taken 15 times.
15 removeSupplyPlenum();
2338
2339
6/6
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
✓ Branch 7 taken 15 times.
✓ Branch 10 taken 15 times.
✓ Branch 13 taken 15 times.
✓ Branch 17 taken 15 times.
15 model::ModelObject mo = t_airLoopHVAC->demandComponents(zoneSplitter.get(), getObject<ThermalZone>(), Node::iddObjectType()).front();
2340
1/1
✓ Branch 1 taken 15 times.
15 Node node = mo.cast<Node>();
2341
2342
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 4 not taken.
15 OS_ASSERT(plenum);
2343
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 result = plenum->addToNode(node);
2344 15 }
2345
2346 15 return result;
2347 15 }
2348
2349 15 bool ThermalZone_Impl::setSupplyPlenum(const ThermalZone& plenumZone) {
2350 15 return setSupplyPlenum(plenumZone, 0u);
2351 }
2352
2353 53 void ThermalZone_Impl::removeSupplyPlenum(const AirLoopHVAC& airloop, unsigned branchIndex) {
2354
1/1
✓ Branch 1 taken 53 times.
53 Model m = model();
2355
2356
1/1
✓ Branch 1 taken 53 times.
53 auto zoneSplitters = airloop.zoneSplitters();
2357
1/2
✓ Branch 1 taken 53 times.
✗ Branch 2 not taken.
53 if (branchIndex < zoneSplitters.size()) {
2358
1/1
✓ Branch 2 taken 53 times.
53 auto zoneSplitter = zoneSplitters[branchIndex];
2359
2360
4/4
✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
✓ Branch 7 taken 53 times.
✓ Branch 10 taken 53 times.
106 auto modelObjects = airloop.demandComponents(zoneSplitter, getObject<ThermalZone>());
2361
1/1
✓ Branch 1 taken 53 times.
53 auto plenums = subsetCastVector<AirLoopHVACSupplyPlenum>(modelObjects);
2362 53 boost::optional<AirLoopHVACSupplyPlenum> plenum;
2363
2364
2/2
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 48 times.
53 if (!plenums.empty()) {
2365
1/1
✓ Branch 2 taken 5 times.
5 auto plenum = plenums.front();
2366
2367
3/3
✓ Branch 1 taken 5 times.
✓ Branch 5 taken 3 times.
✓ Branch 6 taken 2 times.
5 if (plenum.outletModelObjects().size() == 1u) {
2368
1/1
✓ Branch 1 taken 3 times.
3 plenum.remove();
2369 } else {
2370
1/1
✓ Branch 3 taken 2 times.
2 auto it = std::find(modelObjects.begin(), modelObjects.end(), plenum);
2371
1/1
✓ Branch 3 taken 2 times.
2 ModelObject plenumOutletModelObject = *(it + 1);
2372
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 unsigned branchIndex = plenum.branchIndexForOutletModelObject(plenumOutletModelObject);
2373
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 unsigned port = plenum.connectedObjectPort(plenum.outletPort(branchIndex)).get();
2374
1/1
✓ Branch 1 taken 2 times.
2 plenum.removePortForBranch(branchIndex);
2375
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 m.connect(zoneSplitter, zoneSplitter.nextOutletPort(), plenumOutletModelObject, port);
2376 2 }
2377 5 }
2378 53 }
2379 53 }
2380
2381 19 void ThermalZone_Impl::removeSupplyPlenum(unsigned branchIndex) {
2382
1/1
✓ Branch 1 taken 19 times.
19 auto airloop = airLoopHVAC();
2383
1/2
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
19 if (airloop) {
2384
2/2
✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
19 removeSupplyPlenum(airloop.get(), branchIndex);
2385 }
2386 19 }
2387
2388 17 void ThermalZone_Impl::removeSupplyPlenum() {
2389 17 removeSupplyPlenum(0u);
2390 17 }
2391
2392 ✗ void ThermalZone_Impl::removeSupplyPlenum(const AirLoopHVAC& airloop) {
2393 ✗ removeSupplyPlenum(airloop, 0u);
2394 ✗ }
2395
2396 16 bool ThermalZone_Impl::setReturnPlenum(const ThermalZone& plenumZone, AirLoopHVAC& airLoop) {
2397 16 bool result = true;
2398
2399
2/3
✓ Branch 1 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
16 if (!plenumZone.canBePlenum()) {
2400 ✗ result = false;
2401 }
2402
2403 16 boost::optional<AirLoopHVACReturnPlenum> plenum;
2404
2405
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 if (result) {
2406
1/1
✓ Branch 3 taken 16 times.
16 plenum = plenumZone.getImpl<ThermalZone_Impl>()->airLoopHVACReturnPlenum();
2407 16 boost::optional<AirLoopHVAC> plenumAirLoop;
2408
2409
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
16 if (plenum) {
2410
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 plenumAirLoop = plenum->airLoopHVAC();
2411 }
2412
2413
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
16 if (plenumAirLoop) {
2414
3/4
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 8 times.
8 if (plenumAirLoop.get() != airLoop) {
2415 ✗ result = false;
2416 }
2417 }
2418 16 }
2419
2420
1/1
✓ Branch 1 taken 16 times.
16 Model t_model = model();
2421
2422
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 if (result) {
2423
2/2
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 8 times.
16 if (!plenum) {
2424
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 plenum = AirLoopHVACReturnPlenum(t_model);
2425
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 plenum->setThermalZone(plenumZone);
2426 }
2427 }
2428
2429
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 if (result) {
2430
1/1
✓ Branch 1 taken 16 times.
16 removeReturnPlenum(airLoop);
2431
2432
5/5
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
✓ Branch 7 taken 16 times.
✓ Branch 10 taken 16 times.
✓ Branch 14 taken 16 times.
16 auto node = airLoop.demandComponents(getObject<ThermalZone>(), airLoop.zoneMixer(), Node::iddObjectType()).front().cast<Node>();
2433
2434
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✗ Branch 4 not taken.
16 OS_ASSERT(plenum);
2435
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 result = plenum->addToNode(node);
2436 16 }
2437
2438 16 return result;
2439 16 }
2440
2441 16 bool ThermalZone_Impl::setReturnPlenum(const ThermalZone& plenumZone) {
2442
1/1
✓ Branch 1 taken 16 times.
16 auto loop = airLoopHVAC();
2443
2444
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 if (loop) {
2445
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
16 return setReturnPlenum(plenumZone, loop.get());
2446 } else {
2447 ✗ return false;
2448 }
2449 16 }
2450
2451 47 void ThermalZone_Impl::removeReturnPlenum(AirLoopHVAC& airLoop) {
2452
1/1
✓ Branch 1 taken 47 times.
47 Model t_model = model();
2453
2454
1/1
✓ Branch 1 taken 47 times.
47 auto zoneMixer = airLoop.zoneMixer();
2455
4/4
✓ Branch 1 taken 47 times.
✓ Branch 4 taken 47 times.
✓ Branch 7 taken 47 times.
✓ Branch 10 taken 47 times.
94 auto modelObjects = airLoop.demandComponents(getObject<ThermalZone>(), zoneMixer);
2456
1/1
✓ Branch 1 taken 47 times.
47 auto plenums = subsetCastVector<AirLoopHVACReturnPlenum>(modelObjects);
2457 47 boost::optional<AirLoopHVACReturnPlenum> plenum;
2458
2459
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 43 times.
47 if (!plenums.empty()) {
2460
1/1
✓ Branch 2 taken 4 times.
4 plenum = plenums.front();
2461 }
2462
2463
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 43 times.
47 if (plenum) {
2464
4/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 2 times.
4 if (plenum->inletModelObjects().size() == 1u) {
2465
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 plenum->remove();
2466 } else {
2467
2/2
✓ Branch 1 taken 2 times.
✓ Branch 6 taken 2 times.
2 auto it = std::find(modelObjects.begin(), modelObjects.end(), plenum.get());
2468
1/1
✓ Branch 3 taken 2 times.
2 ModelObject plenumInletModelObject = *(it - 1);
2469
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 unsigned branchIndex = plenum->branchIndexForInletModelObject(plenumInletModelObject);
2470
5/5
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
2 unsigned port = plenum->connectedObjectPort(plenum->inletPort(branchIndex)).get();
2471
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 plenum->removePortForBranch(branchIndex);
2472
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 t_model.connect(plenumInletModelObject, port, zoneMixer, zoneMixer.nextInletPort());
2473 2 }
2474 }
2475 47 }
2476
2477 ✗ void ThermalZone_Impl::removeReturnPlenum() {
2478 ✗ auto loop = airLoopHVAC();
2479 ✗ if (loop) {
2480 ✗ removeReturnPlenum(loop.get());
2481 }
2482 ✗ }
2483
2484 1032 std::vector<ZoneMixing> ThermalZone_Impl::zoneMixing() const {
2485
2/2
✓ Branch 1 taken 1032 times.
✓ Branch 4 taken 1032 times.
1032 return getObject<ModelObject>().getModelObjectSources<ZoneMixing>();
2486 }
2487
2488 995 std::vector<ZoneMixing> ThermalZone_Impl::supplyZoneMixing() const {
2489
1/1
✓ Branch 1 taken 995 times.
995 std::vector<ZoneMixing> result = this->zoneMixing();
2490
2491
1/1
✓ Branch 1 taken 995 times.
995 Handle handle = this->handle();
2492 auto new_end =
2493
4/4
✓ Branch 3 taken 995 times.
✓ Branch 6 taken 11 times.
✓ Branch 9 taken 11 times.
✓ Branch 12 taken 11 times.
1006 std::remove_if(result.begin(), result.end(), [&](const ZoneMixing& mixing) { return (mixing.zoneOrSpace().handle() != handle); });
2494
2495
1/1
✓ Branch 4 taken 995 times.
995 result.erase(new_end, result.end());
2496 1990 return result;
2497 ✗ }
2498
2499 4 std::vector<ZoneMixing> ThermalZone_Impl::exhaustZoneMixing() const {
2500
1/1
✓ Branch 1 taken 4 times.
4 std::vector<ZoneMixing> result = this->zoneMixing();
2501
2502
1/1
✓ Branch 1 taken 4 times.
4 Handle handle = this->handle();
2503
1/1
✓ Branch 3 taken 4 times.
4 auto new_end = std::remove_if(result.begin(), result.end(), [&](const ZoneMixing& mixing) {
2504
12/17
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 1 time.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 18 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 20 taken 2 times.
✓ Branch 21 taken 1 time.
✓ Branch 23 taken 3 times.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
3 return (!mixing.sourceZoneOrSpace() || (mixing.sourceZoneOrSpace()->handle() != handle));
2505 });
2506
2507
1/1
✓ Branch 4 taken 4 times.
4 result.erase(new_end, result.end());
2508 8 return result;
2509 ✗ }
2510
2511 20368 std::vector<AirLoopHVAC> ThermalZone_Impl::airLoopHVACs() const {
2512 20368 std::vector<AirLoopHVAC> result;
2513
2514
1/1
✓ Branch 1 taken 20368 times.
20368 auto pl = inletPortList();
2515
2/2
✓ Branch 1 taken 20368 times.
✓ Branch 4 taken 20368 times.
20368 auto nodes = subsetCastVector<model::HVACComponent>(pl.airLoopHVACModelObjects());
2516
2/2
✓ Branch 5 taken 437 times.
✓ Branch 6 taken 20368 times.
20805 for (auto& node : nodes) {
2517
1/1
✓ Branch 1 taken 437 times.
437 auto loop = node.airLoopHVAC();
2518
1/2
✓ Branch 0 taken 437 times.
✗ Branch 1 not taken.
437 if (loop) {
2519
2/2
✓ Branch 1 taken 437 times.
✓ Branch 4 taken 437 times.
437 result.push_back(loop.get());
2520 }
2521 437 }
2522
2523 40736 return result;
2524 20368 }
2525
2526 29 boost::optional<HVACComponent> ThermalZone_Impl::airLoopHVACTerminal() const {
2527
4/4
✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
✓ Branch 8 taken 26 times.
✓ Branch 9 taken 3 times.
58 if (auto mo = inletPortList().airLoopHVACModelObject()) {
2528
3/4
✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 6 taken 26 times.
✗ Branch 7 not taken.
52 if (auto node = mo->optionalCast<Node>()) {
2529
3/4
✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 6 taken 26 times.
✗ Branch 7 not taken.
52 if (auto nodeInlet = node->inletModelObject()) {
2530
4/4
✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 8 taken 25 times.
✓ Branch 9 taken 1 time.
26 if (!nodeInlet->optionalCast<Splitter>()) {
2531
2/2
✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
25 return nodeInlet->optionalCast<HVACComponent>();
2532 }
2533 26 }
2534 26 }
2535 29 }
2536
2537 4 return boost::none;
2538 }
2539
2540 2 std::vector<HVACComponent> ThermalZone_Impl::airLoopHVACTerminals() const {
2541 2 std::vector<HVACComponent> result;
2542
2543
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 auto mos = inletPortList().airLoopHVACModelObjects();
2544
2/2
✓ Branch 5 taken 5 times.
✓ Branch 6 taken 2 times.
7 for (const auto& mo : mos) {
2545
2/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
10 if (auto node = mo.optionalCast<Node>()) {
2546
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (auto nodeInlet = node->inletModelObject()) {
2547
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 3 times.
5 if (!nodeInlet->optionalCast<Splitter>()) {
2548
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 auto hvaccomp = nodeInlet->optionalCast<HVACComponent>();
2549
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (hvaccomp) {
2550
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 result.push_back(hvaccomp.get());
2551 }
2552 2 }
2553 5 }
2554 5 }
2555 }
2556
2557 4 return result;
2558 2 }
2559
2560 168 boost::optional<ZoneControlContaminantController> ThermalZone_Impl::zoneControlContaminantController() const {
2561
1/1
✓ Branch 1 taken 168 times.
168 auto h = handle();
2562
2563
2/2
✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
168 auto controllers = model().getConcreteModelObjects<ZoneControlContaminantController>();
2564
2/2
✓ Branch 5 taken 17 times.
✓ Branch 6 taken 158 times.
175 for (const auto& controller : controllers) {
2565
3/3
✓ Branch 3 taken 17 times.
✓ Branch 7 taken 13 times.
✓ Branch 8 taken 4 times.
34 if (auto zone = controller.getImpl<detail::ZoneControlContaminantController_Impl>()->controlledZone()) {
2566
5/5
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 13 times.
✓ Branch 9 taken 10 times.
✓ Branch 10 taken 3 times.
13 if (zone->handle() == h) {
2567
1/1
✓ Branch 1 taken 10 times.
10 return controller;
2568 }
2569 17 }
2570 }
2571
2572 158 return boost::none;
2573 168 }
2574
2575 6 bool ThermalZone_Impl::setZoneControlContaminantController(const ZoneControlContaminantController& contaminantController) {
2576
1/1
✓ Branch 1 taken 6 times.
6 auto t_model = model();
2577
2578
3/4
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6 times.
6 if (t_model != contaminantController.model()) {
2579 ✗ return false;
2580 }
2581
2582
3/3
✓ Branch 1 taken 6 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 4 times.
12 if (auto currentZone = contaminantController.controlledZone()) {
2583
6/6
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 12 taken 1 time.
✓ Branch 13 taken 1 time.
2 if (currentZone->handle() == handle()) {
2584 1 return true;
2585 } else {
2586
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 auto controllerClone = contaminantController.clone(t_model).cast<ZoneControlContaminantController>();
2587
1/1
✓ Branch 1 taken 1 time.
1 auto tz = getObject<ThermalZone>();
2588
1/1
✓ Branch 3 taken 1 time.
1 return controllerClone.getImpl<detail::ZoneControlContaminantController_Impl>()->setControlledZone(tz);
2589 1 }
2590 } else {
2591
1/1
✓ Branch 1 taken 4 times.
4 resetZoneControlContaminantController();
2592
1/1
✓ Branch 1 taken 4 times.
4 auto tz = getObject<ThermalZone>();
2593
1/1
✓ Branch 3 taken 4 times.
4 return contaminantController.getImpl<detail::ZoneControlContaminantController_Impl>()->setControlledZone(tz);
2594 10 }
2595 6 }
2596
2597 4 void ThermalZone_Impl::resetZoneControlContaminantController() {
2598
3/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 3 times.
8 if (auto controller = zoneControlContaminantController()) {
2599
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 controller->remove();
2600 4 }
2601 4 }
2602
2603 ✗ std::vector<EMSActuatorNames> ThermalZone_Impl::emsActuatorNames() const {
2604 std::vector<EMSActuatorNames> actuators{{"Zone Temperature Control", "Heating Setpoint"},
2605 {"Zone Temperature Control", "Cooling Setpoint"},
2606 {"Zone Humidity Control", "Relative Humidity Humidifying Setpoint"},
2607 {"Zone Humidity Control", "Relative Humidity Dehumidifying Setpoint"},
2608 {"Zone Comfort Control", "Heating Setpoint"},
2609 {"Zone Comfort Control", "Cooling Setpoint"},
2610 {"Zone", "Outdoor Air Drybulb Temperature"},
2611 {"Zone", "Outdoor Air Wetbulb Temperature"},
2612 {"Zone", "Outdoor Air Wind Speed"},
2613 ✗ {"Zone", "Outdoor Air Wind Direction"}};
2614 ✗ return actuators;
2615 ✗ }
2616
2617 ✗ std::vector<std::string> ThermalZone_Impl::emsInternalVariableNames() const {
2618 ✗ std::vector<std::string> types{"Zone Floor Area", "Zone Air Volume", "Zone Multiplier", "Zone List Multiplier"};
2619 ✗ return types;
2620 ✗ }
2621
2622 2 AirflowNetworkZone ThermalZone_Impl::getAirflowNetworkZone() {
2623
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<AirflowNetworkZone> opt = airflowNetworkZone();
2624
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (opt) {
2625 ✗ return opt.get();
2626 }
2627
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 return AirflowNetworkZone(model(), handle());
2628 2 }
2629
2630 589 boost::optional<AirflowNetworkZone> ThermalZone_Impl::airflowNetworkZone() const {
2631 std::vector<AirflowNetworkZone> myAFNZones =
2632
3/3
✓ Branch 1 taken 589 times.
✓ Branch 4 taken 589 times.
✓ Branch 7 taken 589 times.
589 getObject<ModelObject>().getModelObjectSources<AirflowNetworkZone>(AirflowNetworkZone::iddObjectType());
2633 589 auto count = myAFNZones.size();
2634
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 585 times.
589 if (count == 1) {
2635
1/1
✓ Branch 2 taken 4 times.
4 return myAFNZones[0];
2636
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 585 times.
585 } else if (count > 1) {
2637 ✗ LOG(Warn, briefDescription() << " has more than one AirflowNetwork Zone attached, returning first.");
2638 ✗ return myAFNZones[0];
2639 }
2640 585 return boost::none;
2641 589 }
2642
2643 11 ZonePropertyUserViewFactorsBySurfaceName ThermalZone_Impl::getZonePropertyUserViewFactorsBySurfaceName() const {
2644
1/1
✓ Branch 1 taken 11 times.
11 auto thisThermalZone = getObject<ThermalZone>();
2645 std::vector<ZonePropertyUserViewFactorsBySurfaceName> zoneProps =
2646
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 thisThermalZone.getModelObjectSources<ZonePropertyUserViewFactorsBySurfaceName>(ZonePropertyUserViewFactorsBySurfaceName::iddObjectType());
2647
2/2
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 8 times.
11 if (!zoneProps.empty()) {
2648
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
3 if (zoneProps.size() > 1u) {
2649 // This shouldn't happen, ZonePropertyUserViewFactorsBySurfaceName's ctor should throw if a zone already has one
2650 ✗ OS_ASSERT(false);
2651 ✗ LOG(Error, briefDescription() << " is referenced by more than one ZonePropertyUserViewFactorsBySurfaceName, returning the first");
2652 }
2653
1/1
✓ Branch 2 taken 3 times.
3 return zoneProps[0];
2654 }
2655
2656
1/1
✓ Branch 1 taken 8 times.
8 ZonePropertyUserViewFactorsBySurfaceName zoneProp(thisThermalZone);
2657 8 return zoneProp;
2658 11 }
2659
2660 11 ZoneMRTCalculation ThermalZone_Impl::getZoneMRTCalculation() const {
2661
1/1
✓ Branch 1 taken 11 times.
11 auto thisThermalZone = getObject<ThermalZone>();
2662 std::vector<ZoneMRTCalculation> zoneMRTCalculations =
2663
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 thisThermalZone.getModelObjectSources<ZoneMRTCalculation>(ZoneMRTCalculation::iddObjectType());
2664
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 9 times.
11 if (!zoneMRTCalculations.empty()) {
2665
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
2 if (zoneMRTCalculations.size() > 1u) {
2666 ✗ OS_ASSERT(false);
2667 ✗ LOG(Error, briefDescription() << " is referenced by more than one ZoneMRTCalculation, returning the first");
2668 }
2669
1/1
✓ Branch 2 taken 2 times.
2 return zoneMRTCalculations[0];
2670 }
2671
2672
1/1
✓ Branch 1 taken 9 times.
9 ZoneMRTCalculation zoneMRTCalculation(thisThermalZone);
2673 9 return zoneMRTCalculation;
2674 11 }
2675
2676 ✗ boost::optional<double> ThermalZone_Impl::getAutosizedValueFromZoneSizes(const std::string& columnName, const std::string& loadType) const {
2677 // Check that the model has a sql file
2678 ✗ if (!model().sqlFile()) {
2679 ✗ LOG(Warn,
2680 "This model has no sql file, cannot retrieve the ZoneSizes autosized value '" << columnName << "' with loadType '" << loadType << "'.");
2681 ✗ return boost::none;
2682 }
2683
2684 ✗ if ((loadType != "Cooling") && (loadType != "Heating")) {
2685 ✗ LOG(Warn, "Cannot retrieve the ZoneSizes autosized value '" << columnName << ", Invalid loadType, must be one of ['Cooling', 'Heating']");
2686 ✗ return boost::none;
2687 }
2688
2689 // Get the object name and transform to the way it is recorded
2690 // in the sql file
2691 ✗ std::string sqlName = name().get();
2692 ✗ boost::to_upper(sqlName);
2693
2694 const std::string directQuery = fmt::format(
2695 R"sql(
2696 SELECT {} FROM ZoneSizes
2697 WHERE ZoneName = ?
2698 AND LoadType = ?;
2699 )sql",
2700 ✗ columnName);
2701 ✗ boost::optional<double> val = model().sqlFile().get().execAndReturnFirstDouble(directQuery,
2702 // bindArgs
2703 sqlName, loadType);
2704 ✗ if (!val) {
2705 ✗ LOG(Debug, fmt::format(R"sql(The direct query failed:
2706 SELECT {} FROM ZoneSizes
2707 WHERE ZoneName = '{}'
2708 AND LoadType = '{}';)sql",
2709 columnName, sqlName, loadType));
2710 }
2711
2712 ✗ return val;
2713 ✗ }
2714
2715 // SQL Queries
2716 ✗ boost::optional<double> ThermalZone_Impl::autosizedMinimumOutdoorAirFlowRate() const {
2717 // The same value is passed for both cooling and heating, so no need to check both
2718 ✗ return getAutosizedValueFromZoneSizes("CalcOutsideAirFlow", "Cooling");
2719 }
2720
2721 ✗ boost::optional<double> ThermalZone_Impl::autosizedCoolingDesignAirFlowRate() const {
2722 ✗ return getAutosizedValueFromZoneSizes("UserDesFlow", "Cooling");
2723 }
2724
2725 ✗ boost::optional<double> ThermalZone_Impl::autosizedHeatingDesignAirFlowRate() const {
2726 ✗ return getAutosizedValueFromZoneSizes("UserDesFlow", "Heating");
2727 }
2728
2729 ✗ boost::optional<double> ThermalZone_Impl::autosizedCoolingDesignLoad() const {
2730 ✗ return getAutosizedValueFromZoneSizes("UserDesLoad", "Cooling");
2731 }
2732
2733 ✗ boost::optional<double> ThermalZone_Impl::autosizedHeatingDesignLoad() const {
2734 ✗ return getAutosizedValueFromZoneSizes("UserDesLoad", "Heating");
2735 }
2736
2737 ✗ boost::optional<double> ThermalZone_Impl::autosizedDesignAirFlowRate() const {
2738 ✗ auto coolingFlow_ = autosizedCoolingDesignAirFlowRate();
2739 ✗ auto heatingFlow_ = autosizedHeatingDesignAirFlowRate();
2740 ✗ if (coolingFlow_ && heatingFlow_) {
2741 ✗ return std::max(coolingFlow_.get(), heatingFlow_.get());
2742 }
2743 ✗ return boost::none;
2744 }
2745
2746 5 ComponentType ThermalZone_Impl::componentType() const {
2747 5 bool has_cooling = false;
2748 5 bool has_heating = false;
2749
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 12 taken 5 times.
✓ Branch 13 taken 5 times.
10 for (const auto& comp : subsetCastVector<HVACComponent>(equipment())) {
2750
1/1
✓ Branch 1 taken 5 times.
5 auto compType = comp.componentType();
2751
2/3
✓ Branch 1 taken 5 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
5 if (compType == ComponentType::Cooling) {
2752 ✗ has_cooling = true;
2753
2/3
✓ Branch 1 taken 5 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
5 } else if (compType == ComponentType::Heating) {
2754 ✗ has_heating = true;
2755
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 2 times.
5 } else if (compType == ComponentType::Both) {
2756 3 has_cooling = true;
2757 3 has_heating = true;
2758 }
2759 5 }
2760
2761
3/4
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
5 if (has_cooling && has_heating) {
2762
1/1
✓ Branch 1 taken 2 times.
2 return ComponentType::Both;
2763
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 } else if (has_cooling) {
2764 ✗ return ComponentType::Cooling;
2765
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 } else if (has_heating) {
2766 ✗ return ComponentType::Heating;
2767 }
2768
1/1
✓ Branch 1 taken 3 times.
3 return ComponentType::None;
2769 }
2770
2771 5 std::vector<FuelType> ThermalZone_Impl::coolingFuelTypes() const {
2772 5 std::set<FuelType> result;
2773
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 12 taken 5 times.
✓ Branch 13 taken 5 times.
10 for (const auto& comp : subsetCastVector<HVACComponent>(equipment())) {
2774
3/3
✓ Branch 1 taken 5 times.
✓ Branch 8 taken 4 times.
✓ Branch 9 taken 5 times.
9 for (auto& ft : comp.coolingFuelTypes()) {
2775
1/1
✓ Branch 1 taken 4 times.
4 result.insert(ft);
2776 5 }
2777 5 }
2778
1/1
✓ Branch 3 taken 5 times.
15 return {result.begin(), result.end()};
2779 5 }
2780
2781 5 std::vector<FuelType> ThermalZone_Impl::heatingFuelTypes() const {
2782 5 std::set<FuelType> result;
2783
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 12 taken 5 times.
✓ Branch 13 taken 5 times.
10 for (const auto& comp : subsetCastVector<HVACComponent>(equipment())) {
2784
3/3
✓ Branch 1 taken 5 times.
✓ Branch 8 taken 6 times.
✓ Branch 9 taken 5 times.
11 for (auto& ft : comp.heatingFuelTypes()) {
2785
1/1
✓ Branch 1 taken 6 times.
6 result.insert(ft);
2786 5 }
2787 5 }
2788
1/1
✓ Branch 3 taken 5 times.
15 return {result.begin(), result.end()};
2789 5 }
2790
2791 5 std::vector<AppGFuelType> ThermalZone_Impl::appGHeatingFuelTypes() const {
2792 5 std::set<AppGFuelType> result;
2793
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 12 taken 5 times.
✓ Branch 13 taken 5 times.
10 for (const auto& comp : subsetCastVector<HVACComponent>(equipment())) {
2794
3/3
✓ Branch 1 taken 5 times.
✓ Branch 8 taken 6 times.
✓ Branch 9 taken 5 times.
11 for (auto& ft : comp.appGHeatingFuelTypes()) {
2795
1/1
✓ Branch 1 taken 6 times.
6 result.insert(ft);
2796 5 }
2797 5 }
2798
1/1
✓ Branch 3 taken 5 times.
15 return {result.begin(), result.end()};
2799 5 }
2800
2801 } // namespace detail
2802
2803 2359 ThermalZone::ThermalZone(const Model& model) : HVACComponent(ThermalZone::iddObjectType(), model) {
2804
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 2359 times.
✗ Branch 5 not taken.
2359 OS_ASSERT(getImpl<detail::ThermalZone_Impl>());
2805
2806
1/1
✓ Branch 1 taken 2359 times.
2359 Node node(model);
2807
5/5
✓ Branch 1 taken 2359 times.
✓ Branch 4 taken 2359 times.
✓ Branch 7 taken 2359 times.
✓ Branch 10 taken 2359 times.
✓ Branch 13 taken 2359 times.
2359 model.connect(*this, this->zoneAirPort(), node, node.inletPort());
2808
2809
1/1
✓ Branch 1 taken 2359 times.
2359 PortList inletPortList(*this);
2810
2/2
✓ Branch 1 taken 2359 times.
✓ Branch 4 taken 2359 times.
2359 setPointer(OS_ThermalZoneFields::ZoneAirInletPortList, inletPortList.handle());
2811
2812
1/1
✓ Branch 1 taken 2359 times.
2359 PortList exhaustPortList(*this);
2813
2/2
✓ Branch 1 taken 2359 times.
✓ Branch 4 taken 2359 times.
2359 setPointer(OS_ThermalZoneFields::ZoneAirExhaustPortList, exhaustPortList.handle());
2814
2815
1/1
✓ Branch 1 taken 2359 times.
2359 PortList returnPortList(*this);
2816
2/2
✓ Branch 1 taken 2359 times.
✓ Branch 4 taken 2359 times.
2359 setPointer(OS_ThermalZoneFields::ZoneReturnAirPortList, returnPortList.handle());
2817
2818
1/1
✓ Branch 1 taken 2359 times.
2359 SizingZone sizingZone(model, *this);
2819
2820
1/1
✓ Branch 1 taken 2359 times.
2359 ZoneHVACEquipmentList equipmentList(*this);
2821
2822
1/1
✓ Branch 1 taken 2359 times.
2359 setUseIdealAirLoads(false);
2823 2359 }
2824
2825 27043 IddObjectType ThermalZone::iddObjectType() {
2826
1/1
✓ Branch 1 taken 27043 times.
27043 IddObjectType result(IddObjectType::OS_ThermalZone);
2827 27043 return result;
2828 }
2829
2830 ✗ std::vector<std::string> ThermalZone::validZoneInsideConvectionAlgorithmValues() {
2831 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ThermalZoneFields::ZoneInsideConvectionAlgorithm);
2832 }
2833
2834 ✗ std::vector<std::string> ThermalZone::validZoneOutsideConvectionAlgorithmValues() {
2835 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ThermalZoneFields::ZoneOutsideConvectionAlgorithm);
2836 }
2837
2838 3536 int ThermalZone::multiplier() const {
2839
1/1
✓ Branch 3 taken 3536 times.
3536 return getImpl<detail::ThermalZone_Impl>()->multiplier();
2840 }
2841
2842 42 bool ThermalZone::isMultiplierDefaulted() const {
2843
1/1
✓ Branch 3 taken 42 times.
42 return getImpl<detail::ThermalZone_Impl>()->isMultiplierDefaulted();
2844 }
2845
2846 431 boost::optional<double> ThermalZone::ceilingHeight() const {
2847
1/1
✓ Branch 3 taken 431 times.
431 return getImpl<detail::ThermalZone_Impl>()->ceilingHeight();
2848 }
2849
2850 42 bool ThermalZone::isCeilingHeightDefaulted() const {
2851
1/1
✓ Branch 3 taken 42 times.
42 return getImpl<detail::ThermalZone_Impl>()->isCeilingHeightDefaulted();
2852 }
2853
2854 ✗ bool ThermalZone::isCeilingHeightAutocalculated() const {
2855 ✗ return getImpl<detail::ThermalZone_Impl>()->isCeilingHeightAutocalculated();
2856 }
2857
2858 440 boost::optional<double> ThermalZone::volume() const {
2859
1/1
✓ Branch 3 taken 440 times.
440 return getImpl<detail::ThermalZone_Impl>()->volume();
2860 }
2861
2862 42 bool ThermalZone::isVolumeDefaulted() const {
2863
1/1
✓ Branch 3 taken 42 times.
42 return getImpl<detail::ThermalZone_Impl>()->isVolumeDefaulted();
2864 }
2865
2866 ✗ bool ThermalZone::isVolumeAutocalculated() const {
2867 ✗ return getImpl<detail::ThermalZone_Impl>()->isVolumeAutocalculated();
2868 }
2869
2870 850 boost::optional<std::string> ThermalZone::zoneInsideConvectionAlgorithm() const {
2871
1/1
✓ Branch 3 taken 850 times.
850 return getImpl<detail::ThermalZone_Impl>()->zoneInsideConvectionAlgorithm();
2872 }
2873
2874 850 boost::optional<std::string> ThermalZone::zoneOutsideConvectionAlgorithm() const {
2875
1/1
✓ Branch 3 taken 850 times.
850 return getImpl<detail::ThermalZone_Impl>()->zoneOutsideConvectionAlgorithm();
2876 }
2877
2878 ✗ std::string ThermalZone::zoneConditioningEquipmentListName() const {
2879 ✗ return getImpl<detail::ThermalZone_Impl>()->zoneConditioningEquipmentListName();
2880 }
2881
2882 63 double ThermalZone::fractionofZoneControlledbyPrimaryDaylightingControl() const {
2883
1/1
✓ Branch 3 taken 63 times.
63 return getImpl<detail::ThermalZone_Impl>()->fractionofZoneControlledbyPrimaryDaylightingControl();
2884 }
2885
2886 ✗ bool ThermalZone::isFractionofZoneControlledbyPrimaryDaylightingControlDefaulted() const {
2887 ✗ return getImpl<detail::ThermalZone_Impl>()->isFractionofZoneControlledbyPrimaryDaylightingControlDefaulted();
2888 }
2889
2890 13 double ThermalZone::fractionofZoneControlledbySecondaryDaylightingControl() const {
2891
1/1
✓ Branch 3 taken 13 times.
13 return getImpl<detail::ThermalZone_Impl>()->fractionofZoneControlledbySecondaryDaylightingControl();
2892 }
2893
2894 ✗ bool ThermalZone::isFractionofZoneControlledbySecondaryDaylightingControlDefaulted() const {
2895 ✗ return getImpl<detail::ThermalZone_Impl>()->isFractionofZoneControlledbySecondaryDaylightingControlDefaulted();
2896 }
2897
2898 1295 bool ThermalZone::setMultiplier(int multiplier) {
2899
1/1
✓ Branch 3 taken 1295 times.
1295 return getImpl<detail::ThermalZone_Impl>()->setMultiplier(multiplier);
2900 }
2901
2902 ✗ void ThermalZone::resetMultiplier() {
2903 ✗ getImpl<detail::ThermalZone_Impl>()->resetMultiplier();
2904 ✗ }
2905
2906 ✗ bool ThermalZone::setCeilingHeight(boost::optional<double> ceilingHeight) {
2907 ✗ return getImpl<detail::ThermalZone_Impl>()->setCeilingHeight(ceilingHeight);
2908 }
2909
2910 12 bool ThermalZone::setCeilingHeight(double ceilingHeight) {
2911
1/1
✓ Branch 3 taken 12 times.
12 return getImpl<detail::ThermalZone_Impl>()->setCeilingHeight(ceilingHeight);
2912 }
2913
2914 ✗ void ThermalZone::resetCeilingHeight() {
2915 ✗ getImpl<detail::ThermalZone_Impl>()->resetCeilingHeight();
2916 ✗ }
2917
2918 ✗ void ThermalZone::autocalculateCeilingHeight() {
2919 ✗ getImpl<detail::ThermalZone_Impl>()->autocalculateCeilingHeight();
2920 ✗ }
2921
2922 ✗ bool ThermalZone::setVolume(boost::optional<double> volume) {
2923 ✗ return getImpl<detail::ThermalZone_Impl>()->setVolume(volume);
2924 }
2925
2926 12 bool ThermalZone::setVolume(double volume) {
2927
1/1
✓ Branch 3 taken 12 times.
12 return getImpl<detail::ThermalZone_Impl>()->setVolume(volume);
2928 }
2929
2930 ✗ void ThermalZone::resetVolume() {
2931 ✗ getImpl<detail::ThermalZone_Impl>()->resetVolume();
2932 ✗ }
2933
2934 ✗ void ThermalZone::autocalculateVolume() {
2935 ✗ getImpl<detail::ThermalZone_Impl>()->autocalculateVolume();
2936 ✗ }
2937
2938 ✗ bool ThermalZone::setZoneInsideConvectionAlgorithm(boost::optional<std::string> zoneInsideConvectionAlgorithm) {
2939 ✗ return getImpl<detail::ThermalZone_Impl>()->setZoneInsideConvectionAlgorithm(zoneInsideConvectionAlgorithm);
2940 }
2941
2942 50 bool ThermalZone::setZoneInsideConvectionAlgorithm(const std::string& zoneInsideConvectionAlgorithm) {
2943
1/1
✓ Branch 3 taken 50 times.
50 return getImpl<detail::ThermalZone_Impl>()->setZoneInsideConvectionAlgorithm(zoneInsideConvectionAlgorithm);
2944 }
2945
2946 ✗ void ThermalZone::resetZoneInsideConvectionAlgorithm() {
2947 ✗ getImpl<detail::ThermalZone_Impl>()->resetZoneInsideConvectionAlgorithm();
2948 ✗ }
2949
2950 ✗ bool ThermalZone::setZoneOutsideConvectionAlgorithm(boost::optional<std::string> zoneOutsideConvectionAlgorithm) {
2951 ✗ return getImpl<detail::ThermalZone_Impl>()->setZoneOutsideConvectionAlgorithm(zoneOutsideConvectionAlgorithm);
2952 }
2953
2954 50 bool ThermalZone::setZoneOutsideConvectionAlgorithm(const std::string& zoneOutsideConvectionAlgorithm) {
2955
1/1
✓ Branch 3 taken 50 times.
50 return getImpl<detail::ThermalZone_Impl>()->setZoneOutsideConvectionAlgorithm(zoneOutsideConvectionAlgorithm);
2956 }
2957
2958 ✗ void ThermalZone::resetZoneOutsideConvectionAlgorithm() {
2959 ✗ getImpl<detail::ThermalZone_Impl>()->resetZoneOutsideConvectionAlgorithm();
2960 ✗ }
2961
2962 ✗ bool ThermalZone::setZoneConditioningEquipmentListName(const std::string& zoneConditioningEquipmentListName) {
2963 ✗ return getImpl<detail::ThermalZone_Impl>()->setZoneConditioningEquipmentListName(zoneConditioningEquipmentListName);
2964 }
2965
2966 203 bool ThermalZone::setFractionofZoneControlledbyPrimaryDaylightingControl(double fractionofZoneControlledbyPrimaryDaylightingControl) {
2967
1/1
✓ Branch 3 taken 203 times.
406 return getImpl<detail::ThermalZone_Impl>()->setFractionofZoneControlledbyPrimaryDaylightingControl(
2968 406 fractionofZoneControlledbyPrimaryDaylightingControl);
2969 }
2970
2971 ✗ void ThermalZone::resetFractionofZoneControlledbyPrimaryDaylightingControl() {
2972 ✗ getImpl<detail::ThermalZone_Impl>()->resetFractionofZoneControlledbyPrimaryDaylightingControl();
2973 ✗ }
2974
2975 3 bool ThermalZone::setFractionofZoneControlledbySecondaryDaylightingControl(double fractionofZoneControlledbySecondaryDaylightingControl) {
2976
1/1
✓ Branch 3 taken 3 times.
6 return getImpl<detail::ThermalZone_Impl>()->setFractionofZoneControlledbySecondaryDaylightingControl(
2977 6 fractionofZoneControlledbySecondaryDaylightingControl);
2978 }
2979
2980 ✗ void ThermalZone::resetFractionofZoneControlledbySecondaryDaylightingControl() {
2981 ✗ getImpl<detail::ThermalZone_Impl>()->resetFractionofZoneControlledbySecondaryDaylightingControl();
2982 ✗ }
2983
2984 ✗ unsigned ThermalZone::returnAirPort() const {
2985 ✗ return getImpl<detail::ThermalZone_Impl>()->returnAirPort();
2986 }
2987
2988 2375 unsigned ThermalZone::zoneAirPort() const {
2989
1/1
✓ Branch 3 taken 2375 times.
2375 return getImpl<detail::ThermalZone_Impl>()->zoneAirPort();
2990 }
2991
2992 22 OptionalModelObject ThermalZone::returnAirModelObject() const {
2993
1/1
✓ Branch 3 taken 22 times.
22 return getImpl<detail::ThermalZone_Impl>()->returnAirModelObject();
2994 }
2995
2996 2 std::vector<ModelObject> ThermalZone::returnAirModelObjects() const {
2997
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::ThermalZone_Impl>()->returnAirModelObjects();
2998 }
2999
3000 193 Node ThermalZone::zoneAirNode() const {
3001
1/1
✓ Branch 3 taken 193 times.
193 return getImpl<detail::ThermalZone_Impl>()->zoneAirNode();
3002 }
3003
3004 2329 boost::optional<DaylightingControl> ThermalZone::primaryDaylightingControl() const {
3005
1/1
✓ Branch 3 taken 2329 times.
2329 return getImpl<detail::ThermalZone_Impl>()->primaryDaylightingControl();
3006 }
3007
3008 220 bool ThermalZone::setPrimaryDaylightingControl(const DaylightingControl& daylightingControl) {
3009
1/1
✓ Branch 3 taken 220 times.
220 return getImpl<detail::ThermalZone_Impl>()->setPrimaryDaylightingControl(daylightingControl);
3010 }
3011
3012 1 void ThermalZone::resetPrimaryDaylightingControl() {
3013
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::ThermalZone_Impl>()->resetPrimaryDaylightingControl();
3014 1 }
3015
3016 552 boost::optional<DaylightingControl> ThermalZone::secondaryDaylightingControl() const {
3017
1/1
✓ Branch 3 taken 552 times.
552 return getImpl<detail::ThermalZone_Impl>()->secondaryDaylightingControl();
3018 }
3019
3020 16 bool ThermalZone::setSecondaryDaylightingControl(const DaylightingControl& daylightingControl) {
3021
1/1
✓ Branch 3 taken 16 times.
16 return getImpl<detail::ThermalZone_Impl>()->setSecondaryDaylightingControl(daylightingControl);
3022 }
3023
3024 1 void ThermalZone::resetSecondaryDaylightingControl() {
3025
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::ThermalZone_Impl>()->resetSecondaryDaylightingControl();
3026 1 }
3027
3028 425 boost::optional<IlluminanceMap> ThermalZone::illuminanceMap() const {
3029
1/1
✓ Branch 3 taken 425 times.
425 return getImpl<detail::ThermalZone_Impl>()->illuminanceMap();
3030 }
3031
3032 169 bool ThermalZone::setIlluminanceMap(const IlluminanceMap& illuminanceMap) {
3033
1/1
✓ Branch 3 taken 169 times.
169 return getImpl<detail::ThermalZone_Impl>()->setIlluminanceMap(illuminanceMap);
3034 }
3035
3036 1 void ThermalZone::resetIlluminanceMap() {
3037
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::ThermalZone_Impl>()->resetIlluminanceMap();
3038 1 }
3039
3040 2513 void ThermalZone::checkDaylightingControlsAndIlluminanceMaps() {
3041
1/1
✓ Branch 3 taken 2513 times.
2513 getImpl<detail::ThermalZone_Impl>()->checkDaylightingControlsAndIlluminanceMaps();
3042 2513 }
3043
3044 65 boost::optional<Schedule> ThermalZone::daylightingControlsAvailabilitySchedule() const {
3045
1/1
✓ Branch 3 taken 65 times.
65 return getImpl<detail::ThermalZone_Impl>()->daylightingControlsAvailabilitySchedule();
3046 }
3047
3048 3 bool ThermalZone::setDaylightingControlsAvailabilitySchedule(Schedule& schedule) {
3049
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ThermalZone_Impl>()->setDaylightingControlsAvailabilitySchedule(schedule);
3050 }
3051
3052 1 void ThermalZone::resetDaylightingControlsAvailabilitySchedule() {
3053
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::ThermalZone_Impl>()->resetDaylightingControlsAvailabilitySchedule();
3054 1 }
3055
3056 4888 boost::optional<RenderingColor> ThermalZone::renderingColor() const {
3057
1/1
✓ Branch 3 taken 4888 times.
4888 return getImpl<detail::ThermalZone_Impl>()->renderingColor();
3058 }
3059
3060 1125 bool ThermalZone::setRenderingColor(const RenderingColor& renderingColor) {
3061
1/1
✓ Branch 3 taken 1125 times.
1125 return getImpl<detail::ThermalZone_Impl>()->setRenderingColor(renderingColor);
3062 }
3063
3064 ✗ void ThermalZone::resetRenderingColor() {
3065 ✗ getImpl<detail::ThermalZone_Impl>()->resetRenderingColor();
3066 ✗ }
3067
3068 1313 std::vector<Space> ThermalZone::spaces() const {
3069
1/1
✓ Branch 3 taken 1313 times.
1313 return getImpl<detail::ThermalZone_Impl>()->spaces();
3070 }
3071
3072 210 std::vector<Space> ThermalZone::spacesWithDesignSpecificationOutdoorAir() const {
3073
1/1
✓ Branch 3 taken 210 times.
210 return getImpl<detail::ThermalZone_Impl>()->spacesWithDesignSpecificationOutdoorAir();
3074 }
3075
3076 2 double ThermalZone::floorArea() const {
3077
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::ThermalZone_Impl>()->floorArea();
3078 }
3079
3080 ✗ double ThermalZone::exteriorSurfaceArea() const {
3081 ✗ return getImpl<detail::ThermalZone_Impl>()->exteriorSurfaceArea();
3082 }
3083
3084 ✗ double ThermalZone::exteriorWallArea() const {
3085 ✗ return getImpl<detail::ThermalZone_Impl>()->exteriorWallArea();
3086 }
3087
3088 ✗ double ThermalZone::airVolume() const {
3089 ✗ return getImpl<detail::ThermalZone_Impl>()->airVolume();
3090 }
3091
3092 2 double ThermalZone::numberOfPeople() const {
3093
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::ThermalZone_Impl>()->numberOfPeople();
3094 }
3095
3096 ✗ double ThermalZone::peoplePerFloorArea() const {
3097 ✗ return getImpl<detail::ThermalZone_Impl>()->peoplePerFloorArea();
3098 }
3099
3100 ✗ double ThermalZone::floorAreaPerPerson() const {
3101 ✗ return getImpl<detail::ThermalZone_Impl>()->floorAreaPerPerson();
3102 }
3103
3104 1 double ThermalZone::lightingPower() const {
3105
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->lightingPower();
3106 }
3107
3108 1 double ThermalZone::lightingPowerPerFloorArea() const {
3109
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->lightingPowerPerFloorArea();
3110 }
3111
3112 1 double ThermalZone::lightingPowerPerPerson() const {
3113
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->lightingPowerPerPerson();
3114 }
3115
3116 1 double ThermalZone::electricEquipmentPower() const {
3117
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->electricEquipmentPower();
3118 }
3119
3120 1 double ThermalZone::electricEquipmentPowerPerFloorArea() const {
3121
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->electricEquipmentPowerPerFloorArea();
3122 }
3123
3124 1 double ThermalZone::electricEquipmentPowerPerPerson() const {
3125
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->electricEquipmentPowerPerPerson();
3126 }
3127
3128 1 double ThermalZone::gasEquipmentPower() const {
3129
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->gasEquipmentPower();
3130 }
3131
3132 1 double ThermalZone::gasEquipmentPowerPerFloorArea() const {
3133
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->gasEquipmentPowerPerFloorArea();
3134 }
3135
3136 1 double ThermalZone::gasEquipmentPowerPerPerson() const {
3137
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->gasEquipmentPowerPerPerson();
3138 }
3139
3140 1 double ThermalZone::hotWaterEquipmentPower() const {
3141
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->hotWaterEquipmentPower();
3142 }
3143
3144 1 double ThermalZone::hotWaterEquipmentPowerPerFloorArea() const {
3145
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->hotWaterEquipmentPowerPerFloorArea();
3146 }
3147
3148 1 double ThermalZone::hotWaterEquipmentPowerPerPerson() const {
3149
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->hotWaterEquipmentPowerPerPerson();
3150 }
3151
3152 ✗ double ThermalZone::infiltrationDesignFlowRate() const {
3153 ✗ return getImpl<detail::ThermalZone_Impl>()->infiltrationDesignFlowRate();
3154 }
3155
3156 ✗ double ThermalZone::infiltrationDesignFlowPerSpaceFloorArea() const {
3157 ✗ return getImpl<detail::ThermalZone_Impl>()->infiltrationDesignFlowPerSpaceFloorArea();
3158 }
3159
3160 ✗ double ThermalZone::infiltrationDesignFlowPerExteriorSurfaceArea() const {
3161 ✗ return getImpl<detail::ThermalZone_Impl>()->infiltrationDesignFlowPerExteriorSurfaceArea();
3162 }
3163
3164 ✗ double ThermalZone::infiltrationDesignFlowPerExteriorWallArea() const {
3165 ✗ return getImpl<detail::ThermalZone_Impl>()->infiltrationDesignFlowPerExteriorWallArea();
3166 }
3167
3168 ✗ double ThermalZone::infiltrationDesignAirChangesPerHour() const {
3169 ✗ return getImpl<detail::ThermalZone_Impl>()->infiltrationDesignAirChangesPerHour();
3170 }
3171
3172 3 boost::optional<std::string> ThermalZone::isConditioned() const {
3173
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ThermalZone_Impl>()->isConditioned();
3174 }
3175
3176 1 boost::optional<ThermostatSetpointDualSetpoint> ThermalZone::thermostatSetpointDualSetpoint() const {
3177
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->thermostatSetpointDualSetpoint();
3178 }
3179
3180 256 bool ThermalZone::setThermostatSetpointDualSetpoint(const ThermostatSetpointDualSetpoint& thermostat) {
3181
1/1
✓ Branch 3 taken 256 times.
256 return getImpl<detail::ThermalZone_Impl>()->setThermostatSetpointDualSetpoint(thermostat);
3182 }
3183
3184 ✗ void ThermalZone::resetThermostatSetpointDualSetpoint() {
3185 ✗ getImpl<detail::ThermalZone_Impl>()->resetThermostatSetpointDualSetpoint();
3186 ✗ }
3187
3188 1246 boost::optional<Thermostat> ThermalZone::thermostat() const {
3189
1/1
✓ Branch 3 taken 1246 times.
1246 return getImpl<detail::ThermalZone_Impl>()->thermostat();
3190 }
3191
3192 15 bool ThermalZone::setThermostat(const Thermostat& thermostat) {
3193
1/1
✓ Branch 3 taken 15 times.
15 return getImpl<detail::ThermalZone_Impl>()->setThermostat(thermostat);
3194 }
3195
3196 ✗ void ThermalZone::resetThermostat() {
3197 ✗ getImpl<detail::ThermalZone_Impl>()->resetThermostat();
3198 ✗ }
3199
3200 163 boost::optional<ZoneControlHumidistat> ThermalZone::zoneControlHumidistat() const {
3201
1/1
✓ Branch 3 taken 163 times.
163 return getImpl<detail::ThermalZone_Impl>()->zoneControlHumidistat();
3202 }
3203
3204 8 bool ThermalZone::setZoneControlHumidistat(const ZoneControlHumidistat& humidistat) {
3205
1/1
✓ Branch 3 taken 8 times.
8 return getImpl<detail::ThermalZone_Impl>()->setZoneControlHumidistat(humidistat);
3206 }
3207
3208 ✗ void ThermalZone::resetZoneControlHumidistat() {
3209 ✗ getImpl<detail::ThermalZone_Impl>()->resetZoneControlHumidistat();
3210 ✗ }
3211
3212 ✗ void ThermalZone::disconnect() {
3213 ✗ getImpl<detail::ThermalZone_Impl>()->disconnect();
3214 ✗ }
3215
3216 80 boost::optional<Space> ThermalZone::combineSpaces() {
3217
1/1
✓ Branch 3 taken 80 times.
80 return getImpl<detail::ThermalZone_Impl>()->combineSpaces();
3218 }
3219
3220 ✗ bool ThermalZone::isRemovable() const {
3221 ✗ return getImpl<detail::ThermalZone_Impl>()->isRemovable();
3222 }
3223
3224 1039 bool ThermalZone::useIdealAirLoads() const {
3225
1/1
✓ Branch 3 taken 1039 times.
1039 return getImpl<detail::ThermalZone_Impl>()->useIdealAirLoads();
3226 }
3227
3228 2838 bool ThermalZone::setUseIdealAirLoads(bool useIdealAirLoads) {
3229
1/1
✓ Branch 3 taken 2838 times.
2838 return getImpl<detail::ThermalZone_Impl>()->setUseIdealAirLoads(useIdealAirLoads);
3230 }
3231
3232 202 SizingZone ThermalZone::sizingZone() const {
3233
1/1
✓ Branch 3 taken 202 times.
202 return getImpl<detail::ThermalZone_Impl>()->sizingZone();
3234 }
3235
3236 358 bool ThermalZone::addToNode(Node& node) {
3237
1/1
✓ Branch 3 taken 358 times.
358 return getImpl<detail::ThermalZone_Impl>()->addToNode(node);
3238 }
3239
3240 14 bool ThermalZone::multiAddToNode(Node& node) {
3241
1/1
✓ Branch 3 taken 14 times.
14 return getImpl<detail::ThermalZone_Impl>()->multiAddToNode(node);
3242 }
3243
3244 158 PortList ThermalZone::returnPortList() const {
3245
1/1
✓ Branch 3 taken 158 times.
158 return getImpl<detail::ThermalZone_Impl>()->returnPortList();
3246 }
3247
3248 417 PortList ThermalZone::inletPortList() const {
3249
1/1
✓ Branch 3 taken 417 times.
417 return getImpl<detail::ThermalZone_Impl>()->inletPortList();
3250 }
3251
3252 265 PortList ThermalZone::exhaustPortList() const {
3253
1/1
✓ Branch 3 taken 265 times.
265 return getImpl<detail::ThermalZone_Impl>()->exhaustPortList();
3254 }
3255
3256 432 bool ThermalZone::addEquipment(const ModelObject& equipment) {
3257
1/1
✓ Branch 3 taken 432 times.
432 return getImpl<detail::ThermalZone_Impl>()->addEquipment(equipment);
3258 }
3259
3260 34 bool ThermalZone::setCoolingPriority(const ModelObject& equipment, unsigned priority) {
3261
1/1
✓ Branch 3 taken 34 times.
34 return getImpl<detail::ThermalZone_Impl>()->setCoolingPriority(equipment, priority);
3262 }
3263
3264 36 bool ThermalZone::setHeatingPriority(const ModelObject& equipment, unsigned priority) {
3265
1/1
✓ Branch 3 taken 36 times.
36 return getImpl<detail::ThermalZone_Impl>()->setHeatingPriority(equipment, priority);
3266 }
3267
3268 10 boost::optional<double> ThermalZone::sequentialCoolingFraction(const ModelObject& equipment) const {
3269
1/1
✓ Branch 3 taken 10 times.
10 return getImpl<detail::ThermalZone_Impl>()->sequentialCoolingFraction(equipment);
3270 }
3271
3272 4 boost::optional<Schedule> ThermalZone::sequentialCoolingFractionSchedule(const ModelObject& equipment) const {
3273
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::ThermalZone_Impl>()->sequentialCoolingFractionSchedule(equipment);
3274 }
3275
3276 5 bool ThermalZone::setSequentialCoolingFraction(const ModelObject& equipment, double fraction) {
3277
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::ThermalZone_Impl>()->setSequentialCoolingFraction(equipment, fraction);
3278 }
3279
3280 1 bool ThermalZone::setSequentialCoolingFractionSchedule(const ModelObject& equipment, Schedule& schedule) {
3281
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->setSequentialCoolingFractionSchedule(equipment, schedule);
3282 }
3283
3284 9 boost::optional<double> ThermalZone::sequentialHeatingFraction(const ModelObject& equipment) const {
3285
1/1
✓ Branch 3 taken 9 times.
9 return getImpl<detail::ThermalZone_Impl>()->sequentialHeatingFraction(equipment);
3286 }
3287
3288 3 boost::optional<Schedule> ThermalZone::sequentialHeatingFractionSchedule(const ModelObject& equipment) const {
3289
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ThermalZone_Impl>()->sequentialHeatingFractionSchedule(equipment);
3290 }
3291
3292 3 bool ThermalZone::setSequentialHeatingFraction(const ModelObject& equipment, double fraction) {
3293
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ThermalZone_Impl>()->setSequentialHeatingFraction(equipment, fraction);
3294 }
3295
3296 1 bool ThermalZone::setSequentialHeatingFractionSchedule(const ModelObject& equipment, Schedule& schedule) {
3297
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ThermalZone_Impl>()->setSequentialHeatingFractionSchedule(equipment, schedule);
3298 }
3299
3300 986 std::vector<ModelObject> ThermalZone::equipment() const {
3301
1/1
✓ Branch 3 taken 986 times.
986 return getImpl<detail::ThermalZone_Impl>()->equipment();
3302 }
3303
3304 4 std::string ThermalZone::loadDistributionScheme() const {
3305
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::ThermalZone_Impl>()->loadDistributionScheme();
3306 }
3307
3308 9 bool ThermalZone::setLoadDistributionScheme(const std::string& scheme) {
3309
1/1
✓ Branch 3 taken 9 times.
9 return getImpl<detail::ThermalZone_Impl>()->setLoadDistributionScheme(scheme);
3310 }
3311
3312 3 std::vector<ModelObject> ThermalZone::equipmentInHeatingOrder() const {
3313
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ThermalZone_Impl>()->equipmentInHeatingOrder();
3314 }
3315
3316 3 std::vector<ModelObject> ThermalZone::equipmentInCoolingOrder() const {
3317
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ThermalZone_Impl>()->equipmentInCoolingOrder();
3318 }
3319
3320 65 bool ThermalZone::removeEquipment(const ModelObject& equipment) {
3321
1/1
✓ Branch 3 taken 65 times.
65 return getImpl<detail::ThermalZone_Impl>()->removeEquipment(equipment);
3322 }
3323
3324 20551 bool ThermalZone::isPlenum() const {
3325
1/1
✓ Branch 3 taken 20551 times.
20551 return getImpl<detail::ThermalZone_Impl>()->isPlenum();
3326 }
3327
3328 38 bool ThermalZone::canBePlenum() const {
3329
1/1
✓ Branch 3 taken 38 times.
38 return getImpl<detail::ThermalZone_Impl>()->canBePlenum();
3330 }
3331
3332 15 bool ThermalZone::setSupplyPlenum(const ThermalZone& plenumZone) {
3333
1/1
✓ Branch 3 taken 15 times.
15 return getImpl<detail::ThermalZone_Impl>()->setSupplyPlenum(plenumZone);
3334 }
3335
3336 ✗ bool ThermalZone::setSupplyPlenum(const ThermalZone& plenumZone, unsigned branchIndex) {
3337 ✗ return getImpl<detail::ThermalZone_Impl>()->setSupplyPlenum(plenumZone, branchIndex);
3338 }
3339
3340 2 void ThermalZone::removeSupplyPlenum() {
3341
1/1
✓ Branch 3 taken 2 times.
2 getImpl<detail::ThermalZone_Impl>()->removeSupplyPlenum();
3342 2 }
3343
3344 ✗ void ThermalZone::removeSupplyPlenum(const AirLoopHVAC& airloop) {
3345 ✗ getImpl<detail::ThermalZone_Impl>()->removeSupplyPlenum(airloop);
3346 ✗ }
3347
3348 34 void ThermalZone::removeSupplyPlenum(const AirLoopHVAC& airloop, unsigned branchIndex) {
3349
1/1
✓ Branch 3 taken 34 times.
34 getImpl<detail::ThermalZone_Impl>()->removeSupplyPlenum(airloop, branchIndex);
3350 34 }
3351
3352 2 void ThermalZone::removeSupplyPlenum(unsigned branchIndex) {
3353
1/1
✓ Branch 3 taken 2 times.
2 getImpl<detail::ThermalZone_Impl>()->removeSupplyPlenum(branchIndex);
3354 2 }
3355
3356 16 bool ThermalZone::setReturnPlenum(const ThermalZone& plenumZone) {
3357
1/1
✓ Branch 3 taken 16 times.
16 return getImpl<detail::ThermalZone_Impl>()->setReturnPlenum(plenumZone);
3358 }
3359
3360 ✗ bool ThermalZone::setReturnPlenum(const ThermalZone& plenumZone, AirLoopHVAC& airLoop) {
3361 ✗ return getImpl<detail::ThermalZone_Impl>()->setReturnPlenum(plenumZone, airLoop);
3362 }
3363
3364 ✗ void ThermalZone::removeReturnPlenum() {
3365 ✗ getImpl<detail::ThermalZone_Impl>()->removeReturnPlenum();
3366 ✗ }
3367
3368 31 void ThermalZone::removeReturnPlenum(AirLoopHVAC& airLoop) {
3369
1/1
✓ Branch 3 taken 31 times.
31 getImpl<detail::ThermalZone_Impl>()->removeReturnPlenum(airLoop);
3370 31 }
3371
3372 4 std::vector<ZoneMixing> ThermalZone::zoneMixing() const {
3373
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::ThermalZone_Impl>()->zoneMixing();
3374 }
3375
3376 429 std::vector<ZoneMixing> ThermalZone::supplyZoneMixing() const {
3377
1/1
✓ Branch 3 taken 429 times.
429 return getImpl<detail::ThermalZone_Impl>()->supplyZoneMixing();
3378 }
3379
3380 4 std::vector<ZoneMixing> ThermalZone::exhaustZoneMixing() const {
3381
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::ThermalZone_Impl>()->exhaustZoneMixing();
3382 }
3383
3384 29 boost::optional<HVACComponent> ThermalZone::airLoopHVACTerminal() const {
3385
1/1
✓ Branch 3 taken 29 times.
29 return getImpl<detail::ThermalZone_Impl>()->airLoopHVACTerminal();
3386 }
3387
3388 2 std::vector<HVACComponent> ThermalZone::airLoopHVACTerminals() const {
3389
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::ThermalZone_Impl>()->airLoopHVACTerminals();
3390 }
3391
3392 148 boost::optional<ZoneControlContaminantController> ThermalZone::zoneControlContaminantController() const {
3393
1/1
✓ Branch 3 taken 148 times.
148 return getImpl<detail::ThermalZone_Impl>()->zoneControlContaminantController();
3394 }
3395
3396 6 bool ThermalZone::setZoneControlContaminantController(const ZoneControlContaminantController& contaminantController) {
3397
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::ThermalZone_Impl>()->setZoneControlContaminantController(contaminantController);
3398 }
3399
3400 ✗ void ThermalZone::resetZoneControlContaminantController() {
3401 ✗ getImpl<detail::ThermalZone_Impl>()->resetZoneControlContaminantController();
3402 ✗ }
3403
3404 2 AirflowNetworkZone ThermalZone::getAirflowNetworkZone() {
3405
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::ThermalZone_Impl>()->getAirflowNetworkZone();
3406 }
3407
3408 5 boost::optional<AirflowNetworkZone> ThermalZone::airflowNetworkZone() const {
3409
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::ThermalZone_Impl>()->airflowNetworkZone();
3410 }
3411
3412 19609 std::vector<AirLoopHVAC> ThermalZone::airLoopHVACs() const {
3413
1/1
✓ Branch 3 taken 19609 times.
19609 return getImpl<detail::ThermalZone_Impl>()->airLoopHVACs();
3414 }
3415
3416 11 ZonePropertyUserViewFactorsBySurfaceName ThermalZone::getZonePropertyUserViewFactorsBySurfaceName() const {
3417
1/1
✓ Branch 3 taken 11 times.
11 return getImpl<detail::ThermalZone_Impl>()->getZonePropertyUserViewFactorsBySurfaceName();
3418 }
3419
3420 11 ZoneMRTCalculation ThermalZone::getZoneMRTCalculation() const {
3421
1/1
✓ Branch 3 taken 11 times.
11 return getImpl<detail::ThermalZone_Impl>()->getZoneMRTCalculation();
3422 }
3423
3424 /// @cond
3425
1/1
✓ Branch 3 taken 67602 times.
67602 ThermalZone::ThermalZone(std::shared_ptr<detail::ThermalZone_Impl> impl) : HVACComponent(std::move(impl)) {}
3426 /// @endcond
3427
3428 /** This class implements a transition zone, for DaylightingDeviceTubular */
3429 15 TransitionZone::TransitionZone(const ThermalZone& zone, double length) : m_zone(zone), m_length(length) {
3430
3431
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
15 if (m_length < 0) {
3432 ✗ LOG_AND_THROW("Unable to create transition zone, length of " << m_length << " less than 0");
3433 }
3434 15 }
3435
3436 10 ThermalZone TransitionZone::thermalZone() const {
3437 10 return m_zone;
3438 }
3439
3440 12 double TransitionZone::length() const {
3441 12 return m_length;
3442 }
3443
3444 ✗ std::ostream& operator<<(std::ostream& out, const openstudio::model::TransitionZone& transitionZone) {
3445 ✗ out << "thermal zone name=" << transitionZone.thermalZone().name().get() << ", length=" << transitionZone.length();
3446 ✗ return out;
3447 }
3448
3449 // SQL Queries
3450 ✗ boost::optional<double> ThermalZone::getAutosizedValueFromZoneSizes(const std::string& columnName, const std::string& loadType) const {
3451 ✗ return getImpl<detail::ThermalZone_Impl>()->getAutosizedValueFromZoneSizes(columnName, loadType);
3452 }
3453
3454 ✗ boost::optional<double> ThermalZone::autosizedMinimumOutdoorAirFlowRate() const {
3455 ✗ return getImpl<detail::ThermalZone_Impl>()->autosizedMinimumOutdoorAirFlowRate();
3456 }
3457
3458 ✗ boost::optional<double> ThermalZone::autosizedCoolingDesignAirFlowRate() const {
3459 ✗ return getImpl<detail::ThermalZone_Impl>()->autosizedCoolingDesignAirFlowRate();
3460 }
3461
3462 ✗ boost::optional<double> ThermalZone::autosizedHeatingDesignAirFlowRate() const {
3463 ✗ return getImpl<detail::ThermalZone_Impl>()->autosizedHeatingDesignAirFlowRate();
3464 }
3465
3466 ✗ boost::optional<double> ThermalZone::autosizedCoolingDesignLoad() const {
3467 ✗ return getImpl<detail::ThermalZone_Impl>()->autosizedCoolingDesignLoad();
3468 }
3469
3470 ✗ boost::optional<double> ThermalZone::autosizedDesignAirFlowRate() const {
3471 ✗ return getImpl<detail::ThermalZone_Impl>()->autosizedDesignAirFlowRate();
3472 }
3473
3474 ✗ boost::optional<double> ThermalZone::autosizedHeatingDesignLoad() const {
3475 ✗ return getImpl<detail::ThermalZone_Impl>()->autosizedHeatingDesignLoad();
3476 }
3477
3478 } // namespace model
3479 } // namespace openstudio
3480