GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 35.8% 110 / 0 / 307
Functions: 39.2% 29 / 0 / 74
Branches: 21.1% 76 / 0 / 360

src/model/ZoneHVACEnergyRecoveryVentilator.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 "ZoneHVACEnergyRecoveryVentilator.hpp"
7 #include "ZoneHVACEnergyRecoveryVentilator_Impl.hpp"
8
9 #include "Schedule.hpp"
10 #include "Schedule_Impl.hpp"
11 #include "HVACComponent.hpp"
12 #include "HVACComponent_Impl.hpp"
13 #include "Model.hpp"
14 #include "HeatExchangerAirToAirSensibleAndLatent.hpp"
15 #include "HeatExchangerAirToAirSensibleAndLatent_Impl.hpp"
16 #include "FanOnOff.hpp"
17 // #include "FanSystemModel.hpp"
18 #include "ZoneHVACEnergyRecoveryVentilatorController.hpp"
19 #include "ZoneHVACEnergyRecoveryVentilatorController_Impl.hpp"
20 #include "ScheduleTypeLimits.hpp"
21 #include "ScheduleTypeRegistry.hpp"
22
23 #include <utilities/idd/IddFactory.hxx>
24 #include <utilities/idd/OS_ZoneHVAC_EnergyRecoveryVentilator_FieldEnums.hxx>
25
26 #include "../utilities/core/Assert.hpp"
27 #include "../utilities/data/DataEnums.hpp"
28
29 namespace openstudio {
30 namespace model {
31
32 namespace detail {
33
34 4 ZoneHVACEnergyRecoveryVentilator_Impl::ZoneHVACEnergyRecoveryVentilator_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
35 4 : ZoneHVACComponent_Impl(idfObject, model, keepHandle) {
36
4/6
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 13 not taken.
4 OS_ASSERT(idfObject.iddObject().type() == ZoneHVACEnergyRecoveryVentilator::iddObjectType());
37 4 }
38
39 ✗ ZoneHVACEnergyRecoveryVentilator_Impl::ZoneHVACEnergyRecoveryVentilator_Impl(const openstudio::detail::WorkspaceObject_Impl& other,
40 ✗ Model_Impl* model, bool keepHandle)
41 ✗ : ZoneHVACComponent_Impl(other, model, keepHandle) {
42 ✗ OS_ASSERT(other.iddObject().type() == ZoneHVACEnergyRecoveryVentilator::iddObjectType());
43 ✗ }
44
45 ✗ ZoneHVACEnergyRecoveryVentilator_Impl::ZoneHVACEnergyRecoveryVentilator_Impl(const ZoneHVACEnergyRecoveryVentilator_Impl& other,
46 ✗ Model_Impl* model, bool keepHandle)
47 ✗ : ZoneHVACComponent_Impl(other, model, keepHandle) {}
48
49 ✗ const std::vector<std::string>& ZoneHVACEnergyRecoveryVentilator_Impl::outputVariableNames() const {
50 static const std::vector<std::string> result{
51 "Zone Ventilator Electricity Rate", "Zone Ventilator Electricity Energy", "Zone Ventilator Total Cooling Rate",
52 "Zone Ventilator Total Cooling Energy", "Zone Ventilator Total Heating Rate", "Zone Ventilator Total Heating Energy",
53 "Zone Ventilator Sensible Cooling Rate", "Zone Ventilator Sensible Cooling Energy", "Zone Ventilator Sensible Heating Rate",
54 "Zone Ventilator Sensible Heating Energy", "Zone Ventilator Latent Cooling Rate", "Zone Ventilator Latent Cooling Energy",
55 ✗ "Zone Ventilator Latent Heating Rate", "Zone Ventilator Latent Heating Energy", "Zone Ventilator Supply Fan Availability Status"};
56 ✗ return result;
57 ✗ }
58
59 ✗ IddObjectType ZoneHVACEnergyRecoveryVentilator_Impl::iddObjectType() const {
60 ✗ return ZoneHVACEnergyRecoveryVentilator::iddObjectType();
61 }
62
63 ✗ std::vector<ScheduleTypeKey> ZoneHVACEnergyRecoveryVentilator_Impl::getScheduleTypeKeys(const Schedule& schedule) const {
64 ✗ std::vector<ScheduleTypeKey> result;
65 ✗ UnsignedVector fieldIndices = getSourceIndices(schedule.handle());
66 ✗ UnsignedVector::const_iterator b(fieldIndices.begin());
67 ✗ UnsignedVector::const_iterator e(fieldIndices.end());
68 ✗ if (std::find(b, e, OS_ZoneHVAC_EnergyRecoveryVentilatorFields::AvailabilityScheduleName) != e) {
69 ✗ result.push_back(ScheduleTypeKey("ZoneHVACEnergyRecoveryVentilator", "Availability"));
70 }
71 ✗ return result;
72 ✗ }
73
74 ✗ ModelObject ZoneHVACEnergyRecoveryVentilator_Impl::clone(Model model) const {
75 ✗ auto cloneObject = ZoneHVACComponent_Impl::clone(model).cast<ZoneHVACEnergyRecoveryVentilator>();
76
77 ✗ auto const supplyFanClone = supplyAirFan().clone(model).cast<HVACComponent>();
78 ✗ cloneObject.setSupplyAirFan(supplyFanClone);
79
80 ✗ auto const exhaustFanClone = exhaustAirFan().clone(model).cast<HVACComponent>();
81 ✗ cloneObject.setExhaustAirFan(exhaustFanClone);
82
83 ✗ auto const heatExchangerClone = heatExchanger().clone(model).cast<HVACComponent>();
84 ✗ cloneObject.setHeatExchanger(heatExchangerClone);
85
86 ✗ if (auto const controllerObj = controller()) {
87 ✗ auto const controllerClone = controllerObj->clone(model).cast<ZoneHVACEnergyRecoveryVentilatorController>();
88 ✗ cloneObject.setController(controllerClone);
89 ✗ }
90
91 ✗ return std::move(cloneObject);
92 ✗ }
93
94 1 std::vector<ModelObject> ZoneHVACEnergyRecoveryVentilator_Impl::children() const {
95 1 std::vector<ModelObject> result;
96
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto const intermediate = optionalSupplyAirFan()) {
97
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 result.push_back(intermediate.get());
98 1 }
99
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto const intermediate = optionalExhaustAirFan()) {
100
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 result.push_back(intermediate.get());
101 1 }
102
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto const intermediate = optionalHeatExchanger()) {
103
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 result.push_back(intermediate.get());
104 1 }
105
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
2 if (auto const intermediate = controller()) {
106 ✗ result.push_back(intermediate.get());
107 1 }
108 1 return result;
109 ✗ }
110
111 12 unsigned ZoneHVACEnergyRecoveryVentilator_Impl::inletPort() const {
112 12 return OS_ZoneHVAC_EnergyRecoveryVentilatorFields::AirInletNodeName;
113 }
114
115 6 unsigned ZoneHVACEnergyRecoveryVentilator_Impl::outletPort() const {
116 6 return OS_ZoneHVAC_EnergyRecoveryVentilatorFields::AirOutletNodeName;
117 }
118
119 ✗ Schedule ZoneHVACEnergyRecoveryVentilator_Impl::availabilitySchedule() const {
120 ✗ boost::optional<Schedule> value = optionalAvailabilitySchedule();
121 ✗ if (!value) {
122 ✗ LOG_AND_THROW(briefDescription() << " does not have an Availability Schedule attached.");
123 }
124 ✗ return value.get();
125 ✗ }
126
127 ✗ HVACComponent ZoneHVACEnergyRecoveryVentilator_Impl::heatExchanger() const {
128 ✗ boost::optional<HVACComponent> value = optionalHeatExchanger();
129 ✗ if (!value) {
130 ✗ LOG_AND_THROW(briefDescription() << " does not have an Heat Exchanger attached.");
131 }
132 ✗ return value.get();
133 ✗ }
134
135 ✗ boost::optional<double> ZoneHVACEnergyRecoveryVentilator_Impl::supplyAirFlowRate() const {
136 ✗ return getDouble(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::SupplyAirFlowRate, true);
137 }
138
139 ✗ bool ZoneHVACEnergyRecoveryVentilator_Impl::isSupplyAirFlowRateAutosized() const {
140 ✗ bool result = false;
141 ✗ boost::optional<std::string> value = getString(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::SupplyAirFlowRate, true);
142 ✗ if (value) {
143 ✗ result = openstudio::istringEqual(value.get(), "autosize");
144 }
145 ✗ return result;
146 ✗ }
147
148 ✗ boost::optional<double> ZoneHVACEnergyRecoveryVentilator_Impl::exhaustAirFlowRate() const {
149 ✗ return getDouble(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::ExhaustAirFlowRate, true);
150 }
151
152 ✗ bool ZoneHVACEnergyRecoveryVentilator_Impl::isExhaustAirFlowRateAutosized() const {
153 ✗ bool result = false;
154 ✗ boost::optional<std::string> value = getString(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::ExhaustAirFlowRate, true);
155 ✗ if (value) {
156 ✗ result = openstudio::istringEqual(value.get(), "autosize");
157 }
158 ✗ return result;
159 ✗ }
160
161 1 HVACComponent ZoneHVACEnergyRecoveryVentilator_Impl::supplyAirFan() const {
162
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<HVACComponent> value = optionalSupplyAirFan();
163
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
1 if (!value) {
164 ✗ LOG_AND_THROW(briefDescription() << " does not have an Supply Air Fan attached.");
165 }
166
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 return value.get();
167 1 }
168
169 ✗ HVACComponent ZoneHVACEnergyRecoveryVentilator_Impl::exhaustAirFan() const {
170 ✗ boost::optional<HVACComponent> value = optionalExhaustAirFan();
171 ✗ if (!value) {
172 ✗ LOG_AND_THROW(briefDescription() << " does not have an Exhaust Air Fan attached.");
173 }
174 ✗ return value.get();
175 ✗ }
176
177 1 boost::optional<ZoneHVACEnergyRecoveryVentilatorController> ZoneHVACEnergyRecoveryVentilator_Impl::controller() const {
178
1/1
✓ Branch 1 taken 1 time.
2 return getObject<ModelObject>().getModelObjectTarget<ZoneHVACEnergyRecoveryVentilatorController>(
179
1/1
✓ Branch 1 taken 1 time.
2 OS_ZoneHVAC_EnergyRecoveryVentilatorFields::ControllerName);
180 }
181
182 ✗ double ZoneHVACEnergyRecoveryVentilator_Impl::ventilationRateperUnitFloorArea() const {
183 ✗ boost::optional<double> value = getDouble(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::VentilationRateperUnitFloorArea, true);
184 ✗ OS_ASSERT(value);
185 ✗ return value.get();
186 }
187
188 ✗ double ZoneHVACEnergyRecoveryVentilator_Impl::ventilationRateperOccupant() const {
189 ✗ boost::optional<double> value = getDouble(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::VentilationRateperOccupant, true);
190 ✗ OS_ASSERT(value);
191 ✗ return value.get();
192 }
193
194 // boost::optional<ModelObject> ZoneHVACEnergyRecoveryVentilator_Impl::availabilityManagerList() const {
195 // return getObject<ModelObject>().getModelObjectTarget<ModelObject>(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::AvailabilityManagerListName);
196 // }
197
198 4 bool ZoneHVACEnergyRecoveryVentilator_Impl::setAvailabilitySchedule(Schedule& schedule) {
199
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
16 bool result = setSchedule(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::AvailabilityScheduleName, "ZoneHVACEnergyRecoveryVentilator",
200 "Availability", schedule);
201 4 return result;
202 }
203
204 4 bool ZoneHVACEnergyRecoveryVentilator_Impl::setHeatExchanger(const HVACComponent& hxAirToAirSensibleAndLatent) {
205
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 bool result = setPointer(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::HeatExchangerName, hxAirToAirSensibleAndLatent.handle());
206 4 return result;
207 }
208
209 ✗ bool ZoneHVACEnergyRecoveryVentilator_Impl::setSupplyAirFlowRate(boost::optional<double> supplyAirFlowRate) {
210 ✗ bool result(false);
211 ✗ if (supplyAirFlowRate) {
212 ✗ result = setDouble(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::SupplyAirFlowRate, supplyAirFlowRate.get());
213 }
214 ✗ return result;
215 }
216
217 4 void ZoneHVACEnergyRecoveryVentilator_Impl::autosizeSupplyAirFlowRate() {
218
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
8 bool result = setString(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::SupplyAirFlowRate, "autosize");
219
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 OS_ASSERT(result);
220 4 }
221
222 ✗ bool ZoneHVACEnergyRecoveryVentilator_Impl::setExhaustAirFlowRate(boost::optional<double> exhaustAirFlowRate) {
223 ✗ bool result(false);
224 ✗ if (exhaustAirFlowRate) {
225 ✗ result = setDouble(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::ExhaustAirFlowRate, exhaustAirFlowRate.get());
226 }
227 ✗ return result;
228 }
229
230 4 void ZoneHVACEnergyRecoveryVentilator_Impl::autosizeExhaustAirFlowRate() {
231
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
8 bool result = setString(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::ExhaustAirFlowRate, "autosize");
232
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 OS_ASSERT(result);
233 4 }
234
235 5 bool ZoneHVACEnergyRecoveryVentilator_Impl::setSupplyAirFan(const HVACComponent& supplyAirFan) {
236
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 bool result = setPointer(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::SupplyAirFanName, supplyAirFan.handle());
237 5 return result;
238 }
239
240 4 bool ZoneHVACEnergyRecoveryVentilator_Impl::setExhaustAirFan(const HVACComponent& exhaustAirFan) {
241
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 bool result = setPointer(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::ExhaustAirFanName, exhaustAirFan.handle());
242 4 return result;
243 }
244
245 ✗ bool ZoneHVACEnergyRecoveryVentilator_Impl::setController(
246 const boost::optional<ZoneHVACEnergyRecoveryVentilatorController>& zoneHVACEnergyRecoveryVentilatorController) {
247 ✗ bool result(false);
248 ✗ if (zoneHVACEnergyRecoveryVentilatorController) {
249 ✗ result = setPointer(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::ControllerName, zoneHVACEnergyRecoveryVentilatorController.get().handle());
250 } else {
251 ✗ resetController();
252 ✗ result = true;
253 }
254 ✗ return result;
255 }
256
257 ✗ void ZoneHVACEnergyRecoveryVentilator_Impl::resetController() {
258 ✗ bool result = setString(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::ControllerName, "");
259 ✗ OS_ASSERT(result);
260 ✗ }
261
262 4 bool ZoneHVACEnergyRecoveryVentilator_Impl::setVentilationRateperUnitFloorArea(double ventilationRateperUnitFloorArea) {
263 4 bool result = setDouble(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::VentilationRateperUnitFloorArea, ventilationRateperUnitFloorArea);
264 4 return result;
265 }
266
267 4 bool ZoneHVACEnergyRecoveryVentilator_Impl::setVentilationRateperOccupant(double ventilationRateperOccupant) {
268 4 bool result = setDouble(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::VentilationRateperOccupant, ventilationRateperOccupant);
269 4 return result;
270 }
271
272 // bool ZoneHVACEnergyRecoveryVentilator_Impl::setAvailabilityManagerList(const boost::optional<ModelObject>& systemAvailabilityManagerLists) {
273 // bool result(false);
274 // if (systemAvailabilityManagerLists) {
275 // result = setPointer(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::AvailabilityManagerListName, systemAvailabilityManagerLists.get().handle());
276 // }
277 // else {
278 // resetAvailabilityManagerList();
279 // result = true;
280 // }
281 // return result;
282 // }
283
284 // void ZoneHVACEnergyRecoveryVentilator_Impl::resetAvailabilityManagerList() {
285 // bool result = setString(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::AvailabilityManagerListName, "");
286 // OS_ASSERT(result);
287 // }
288
289 ✗ boost::optional<Schedule> ZoneHVACEnergyRecoveryVentilator_Impl::optionalAvailabilitySchedule() const {
290 ✗ return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::AvailabilityScheduleName);
291 }
292
293 1 boost::optional<HVACComponent> ZoneHVACEnergyRecoveryVentilator_Impl::optionalHeatExchanger() const {
294
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return getObject<ModelObject>().getModelObjectTarget<HVACComponent>(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::HeatExchangerName);
295 }
296
297 2 boost::optional<HVACComponent> ZoneHVACEnergyRecoveryVentilator_Impl::optionalSupplyAirFan() const {
298
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 return getObject<ModelObject>().getModelObjectTarget<HVACComponent>(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::SupplyAirFanName);
299 }
300
301 1 boost::optional<HVACComponent> ZoneHVACEnergyRecoveryVentilator_Impl::optionalExhaustAirFan() const {
302
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return getObject<ModelObject>().getModelObjectTarget<HVACComponent>(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::ExhaustAirFanName);
303 }
304
305 ✗ boost::optional<double> ZoneHVACEnergyRecoveryVentilator_Impl::autosizedSupplyAirFlowRate() const {
306 ✗ boost::optional<double> result;
307 ✗ result = getAutosizedValue("Design Size Supply Air Flow Rate", "m3/s");
308 // E+ 9.0.0 wrongly returns as User-Specified
309 ✗ if (!result) {
310 ✗ result = getAutosizedValue("User-Specified Supply Air Flow Rate", "m3/s");
311 }
312 ✗ return result;
313 }
314
315 ✗ boost::optional<double> ZoneHVACEnergyRecoveryVentilator_Impl::autosizedExhaustAirFlowRate() const {
316 ✗ boost::optional<double> result;
317 ✗ result = getAutosizedValue("Design Size Exhaust Air Flow Rate", "m3/s");
318 // E+ 9.0.0 wrongly returns as User-Specified
319 ✗ if (!result) {
320 ✗ result = getAutosizedValue("User-Specified Exhaust Air Flow Rate", "m3/s");
321 }
322 ✗ return result;
323 }
324
325 ✗ void ZoneHVACEnergyRecoveryVentilator_Impl::autosize() {
326 ✗ autosizeSupplyAirFlowRate();
327 ✗ autosizeExhaustAirFlowRate();
328 ✗ }
329
330 ✗ void ZoneHVACEnergyRecoveryVentilator_Impl::applySizingValues() {
331 ✗ boost::optional<double> val;
332 ✗ val = autosizedSupplyAirFlowRate();
333 ✗ if (val) {
334 ✗ setSupplyAirFlowRate(val.get());
335 }
336
337 ✗ val = autosizedExhaustAirFlowRate();
338 ✗ if (val) {
339 ✗ setExhaustAirFlowRate(val.get());
340 }
341 ✗ }
342
343 ✗ ComponentType ZoneHVACEnergyRecoveryVentilator_Impl::componentType() const {
344 ✗ return ComponentType::None;
345 }
346
347 ✗ std::vector<FuelType> ZoneHVACEnergyRecoveryVentilator_Impl::coolingFuelTypes() const {
348 ✗ return {};
349 }
350
351 ✗ std::vector<FuelType> ZoneHVACEnergyRecoveryVentilator_Impl::heatingFuelTypes() const {
352 ✗ return {};
353 }
354
355 ✗ std::vector<AppGFuelType> ZoneHVACEnergyRecoveryVentilator_Impl::appGHeatingFuelTypes() const {
356 ✗ return {};
357 }
358
359 } // namespace detail
360
361 4 ZoneHVACEnergyRecoveryVentilator::ZoneHVACEnergyRecoveryVentilator(const Model& model)
362 4 : ZoneHVACComponent(ZoneHVACEnergyRecoveryVentilator::iddObjectType(), model) {
363
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 5 not taken.
4 OS_ASSERT(getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>());
364
365
1/1
✓ Branch 1 taken 4 times.
4 auto heatExchanger = HeatExchangerAirToAirSensibleAndLatent(model);
366 // The Supply Air Outlet Temperature Control must be "No" in the heat exchanger, otherwise
367 // we need to add a Setpoint Manager on the Supply Air Outlet Node of the heat exchanger.
368
1/1
✓ Branch 1 taken 4 times.
4 heatExchanger.setSupplyAirOutletTemperatureControl(false);
369
1/1
✓ Branch 1 taken 4 times.
4 auto supplyAirFan = FanOnOff(model);
370
1/1
✓ Branch 1 taken 4 times.
4 auto exhaustAirFan = FanOnOff(model);
371
372 4 bool ok = true;
373
1/1
✓ Branch 1 taken 4 times.
4 auto alwaysOn = model.alwaysOnDiscreteSchedule();
374
1/1
✓ Branch 1 taken 4 times.
4 ok = setAvailabilitySchedule(alwaysOn);
375
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
4 OS_ASSERT(ok);
376
1/1
✓ Branch 1 taken 4 times.
4 ok = setHeatExchanger(heatExchanger);
377
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
4 OS_ASSERT(ok);
378
1/1
✓ Branch 1 taken 4 times.
4 autosizeSupplyAirFlowRate();
379
1/1
✓ Branch 1 taken 4 times.
4 autosizeExhaustAirFlowRate();
380
1/1
✓ Branch 1 taken 4 times.
4 ok = setSupplyAirFan(supplyAirFan);
381
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
4 OS_ASSERT(ok);
382
1/1
✓ Branch 1 taken 4 times.
4 ok = setExhaustAirFan(exhaustAirFan);
383
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
4 OS_ASSERT(ok);
384
1/1
✓ Branch 1 taken 4 times.
4 ok = setVentilationRateperUnitFloorArea(0.000508);
385
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
4 OS_ASSERT(ok);
386
1/1
✓ Branch 1 taken 4 times.
4 ok = setVentilationRateperOccupant(0.00236);
387
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
4 OS_ASSERT(ok);
388 4 }
389
390 ✗ ZoneHVACEnergyRecoveryVentilator::ZoneHVACEnergyRecoveryVentilator(const Model& model, const HVACComponent& heatExchanger,
391 ✗ const HVACComponent& supplyAirFan, const HVACComponent& exhaustAirFan)
392 ✗ : ZoneHVACComponent(ZoneHVACEnergyRecoveryVentilator::iddObjectType(), model) {
393 ✗ OS_ASSERT(getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>());
394
395 ✗ bool ok = true;
396 ✗ auto alwaysOn = model.alwaysOnDiscreteSchedule();
397 ✗ ok = setAvailabilitySchedule(alwaysOn);
398 ✗ OS_ASSERT(ok);
399 ✗ if (auto _heatExchanger = heatExchanger.optionalCast<HeatExchangerAirToAirSensibleAndLatent>()) {
400 // The Supply Air Outlet Temperature Control must be "No" in the heat exchanger, otherwise
401 // we need to add a Setpoint Manager on the Supply Air Outlet Node of the heat exchanger.
402 ✗ _heatExchanger->setSupplyAirOutletTemperatureControl(false);
403 ✗ }
404 ✗ ok = setHeatExchanger(heatExchanger);
405 ✗ OS_ASSERT(ok);
406 ✗ autosizeSupplyAirFlowRate();
407 ✗ autosizeExhaustAirFlowRate();
408 ✗ ok = setSupplyAirFan(supplyAirFan);
409 ✗ OS_ASSERT(ok);
410 ✗ ok = setExhaustAirFan(exhaustAirFan);
411 ✗ OS_ASSERT(ok);
412 ✗ ok = setVentilationRateperUnitFloorArea(0.000508);
413 ✗ OS_ASSERT(ok);
414 ✗ ok = setVentilationRateperOccupant(0.00236);
415 ✗ OS_ASSERT(ok);
416 ✗ }
417
418 7736 IddObjectType ZoneHVACEnergyRecoveryVentilator::iddObjectType() {
419
1/1
✓ Branch 1 taken 7736 times.
7736 return {IddObjectType::OS_ZoneHVAC_EnergyRecoveryVentilator};
420 }
421
422 ✗ Schedule ZoneHVACEnergyRecoveryVentilator::availabilitySchedule() const {
423 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->availabilitySchedule();
424 }
425
426 ✗ HVACComponent ZoneHVACEnergyRecoveryVentilator::heatExchanger() const {
427 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->heatExchanger();
428 }
429
430 ✗ boost::optional<double> ZoneHVACEnergyRecoveryVentilator::supplyAirFlowRate() const {
431 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->supplyAirFlowRate();
432 }
433
434 ✗ bool ZoneHVACEnergyRecoveryVentilator::isSupplyAirFlowRateAutosized() const {
435 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->isSupplyAirFlowRateAutosized();
436 }
437
438 ✗ boost::optional<double> ZoneHVACEnergyRecoveryVentilator::exhaustAirFlowRate() const {
439 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->exhaustAirFlowRate();
440 }
441
442 ✗ bool ZoneHVACEnergyRecoveryVentilator::isExhaustAirFlowRateAutosized() const {
443 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->isExhaustAirFlowRateAutosized();
444 }
445
446 1 HVACComponent ZoneHVACEnergyRecoveryVentilator::supplyAirFan() const {
447
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->supplyAirFan();
448 }
449
450 ✗ HVACComponent ZoneHVACEnergyRecoveryVentilator::exhaustAirFan() const {
451 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->exhaustAirFan();
452 }
453
454 ✗ boost::optional<ZoneHVACEnergyRecoveryVentilatorController> ZoneHVACEnergyRecoveryVentilator::controller() const {
455 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->controller();
456 }
457
458 ✗ double ZoneHVACEnergyRecoveryVentilator::ventilationRateperUnitFloorArea() const {
459 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->ventilationRateperUnitFloorArea();
460 }
461
462 ✗ double ZoneHVACEnergyRecoveryVentilator::ventilationRateperOccupant() const {
463 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->ventilationRateperOccupant();
464 }
465
466 // boost::optional<ModelObject> ZoneHVACEnergyRecoveryVentilator::availabilityManagerList() const {
467 // return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->availabilityManagerList();
468 // }
469
470 4 bool ZoneHVACEnergyRecoveryVentilator::setAvailabilitySchedule(Schedule& schedule) {
471
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->setAvailabilitySchedule(schedule);
472 }
473
474 4 bool ZoneHVACEnergyRecoveryVentilator::setHeatExchanger(const HVACComponent& hxAirToAirSensibleAndLatent) {
475
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->setHeatExchanger(hxAirToAirSensibleAndLatent);
476 }
477
478 ✗ bool ZoneHVACEnergyRecoveryVentilator::setSupplyAirFlowRate(double supplyAirFlowRate) {
479 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->setSupplyAirFlowRate(supplyAirFlowRate);
480 }
481
482 4 void ZoneHVACEnergyRecoveryVentilator::autosizeSupplyAirFlowRate() {
483
1/1
✓ Branch 3 taken 4 times.
4 getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->autosizeSupplyAirFlowRate();
484 4 }
485
486 ✗ bool ZoneHVACEnergyRecoveryVentilator::setExhaustAirFlowRate(double exhaustAirFlowRate) {
487 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->setExhaustAirFlowRate(exhaustAirFlowRate);
488 }
489
490 4 void ZoneHVACEnergyRecoveryVentilator::autosizeExhaustAirFlowRate() {
491
1/1
✓ Branch 3 taken 4 times.
4 getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->autosizeExhaustAirFlowRate();
492 4 }
493
494 5 bool ZoneHVACEnergyRecoveryVentilator::setSupplyAirFan(const HVACComponent& fansOnOff) {
495
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->setSupplyAirFan(fansOnOff);
496 }
497
498 4 bool ZoneHVACEnergyRecoveryVentilator::setExhaustAirFan(const HVACComponent& fansOnOff) {
499
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->setExhaustAirFan(fansOnOff);
500 }
501
502 ✗ bool ZoneHVACEnergyRecoveryVentilator::setController(const ZoneHVACEnergyRecoveryVentilatorController& zoneHVACEnergyRecoveryVentilatorController) {
503 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->setController(zoneHVACEnergyRecoveryVentilatorController);
504 }
505
506 ✗ void ZoneHVACEnergyRecoveryVentilator::resetController() {
507 ✗ getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->resetController();
508 ✗ }
509
510 4 bool ZoneHVACEnergyRecoveryVentilator::setVentilationRateperUnitFloorArea(double ventilationRateperUnitFloorArea) {
511
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->setVentilationRateperUnitFloorArea(ventilationRateperUnitFloorArea);
512 }
513
514 4 bool ZoneHVACEnergyRecoveryVentilator::setVentilationRateperOccupant(double ventilationRateperOccupant) {
515
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->setVentilationRateperOccupant(ventilationRateperOccupant);
516 }
517
518 // bool ZoneHVACEnergyRecoveryVentilator::setAvailabilityManagerList(const ModelObject& systemAvailabilityManagerLists) {
519 // return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->setAvailabilityManagerList(systemAvailabilityManagerLists);
520 // }
521
522 // void ZoneHVACEnergyRecoveryVentilator::resetAvailabilityManagerList() {
523 // getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->resetAvailabilityManagerList();
524 // }
525
526 /// @cond
527 1 ZoneHVACEnergyRecoveryVentilator::ZoneHVACEnergyRecoveryVentilator(std::shared_ptr<detail::ZoneHVACEnergyRecoveryVentilator_Impl> impl)
528
1/1
✓ Branch 3 taken 1 time.
1 : ZoneHVACComponent(std::move(impl)) {}
529 /// @endcond
530
531 ✗ boost::optional<double> ZoneHVACEnergyRecoveryVentilator::autosizedSupplyAirFlowRate() const {
532 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->autosizedSupplyAirFlowRate();
533 }
534
535 ✗ boost::optional<double> ZoneHVACEnergyRecoveryVentilator::autosizedExhaustAirFlowRate() const {
536 ✗ return getImpl<detail::ZoneHVACEnergyRecoveryVentilator_Impl>()->autosizedExhaustAirFlowRate();
537 }
538
539 } // namespace model
540 } // namespace openstudio
541