GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 77.1% 481 / 0 / 624
Functions: 79.2% 118 / 0 / 149
Branches: 62.0% 450 / 0 / 726

src/model/FanSystemModel.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 "FanSystemModel.hpp"
7 #include "FanSystemModel_Impl.hpp"
8
9 #include "Model.hpp"
10 #include "AirLoopHVAC.hpp"
11 #include "AirLoopHVAC_Impl.hpp"
12 #include "Node.hpp"
13 #include "Node_Impl.hpp"
14 #include "Schedule.hpp"
15 #include "Schedule_Impl.hpp"
16 #include "ThermalZone.hpp"
17 #include "ThermalZone_Impl.hpp"
18 #include "Curve.hpp"
19 #include "Curve_Impl.hpp"
20
21 // containing HVAC Component
22 #include "AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.hpp"
23 #include "AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass_Impl.hpp"
24 //#include "AirLoopHVACUnitaryHeatPumpAirToAir.hpp"
25 //#include "AirLoopHVACUnitaryHeatPumpAirToAir_Impl.hpp"
26 //#include "AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.hpp"
27 //#include "AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed_Impl.hpp"
28 #include "AirLoopHVACUnitarySystem.hpp"
29 #include "AirLoopHVACUnitarySystem_Impl.hpp"
30 #include "AirTerminalSingleDuctParallelPIUReheat.hpp"
31 #include "AirTerminalSingleDuctParallelPIUReheat_Impl.hpp"
32 #include "AirTerminalSingleDuctSeriesPIUReheat.hpp"
33 #include "AirTerminalSingleDuctSeriesPIUReheat_Impl.hpp"
34
35 // containing ZoneHVAC Component
36 #include "ZoneHVACEnergyRecoveryVentilator.hpp"
37 #include "ZoneHVACEnergyRecoveryVentilator_Impl.hpp"
38 #include "ZoneHVACFourPipeFanCoil.hpp"
39 #include "ZoneHVACFourPipeFanCoil_Impl.hpp"
40 #include "ZoneHVACPackagedTerminalAirConditioner.hpp"
41 #include "ZoneHVACPackagedTerminalAirConditioner_Impl.hpp"
42 #include "ZoneHVACPackagedTerminalHeatPump.hpp"
43 #include "ZoneHVACPackagedTerminalHeatPump_Impl.hpp"
44 #include "ZoneHVACTerminalUnitVariableRefrigerantFlow.hpp"
45 #include "ZoneHVACTerminalUnitVariableRefrigerantFlow_Impl.hpp"
46 #include "ZoneHVACUnitHeater.hpp"
47 #include "ZoneHVACUnitHeater_Impl.hpp"
48 #include "ZoneHVACUnitVentilator.hpp"
49 #include "ZoneHVACUnitVentilator_Impl.hpp"
50 #include "ZoneHVACEvaporativeCoolerUnit.hpp"
51 #include "ZoneHVACEvaporativeCoolerUnit_Impl.hpp"
52 #include "ZoneHVACWaterToAirHeatPump.hpp"
53 #include "ZoneHVACWaterToAirHeatPump_Impl.hpp"
54 // These are supposed to be ZoneHVACComponents
55 #include "WaterHeaterHeatPump.hpp"
56 #include "WaterHeaterHeatPump_Impl.hpp"
57 #include "WaterHeaterHeatPumpWrappedCondenser.hpp"
58 #include "WaterHeaterHeatPumpWrappedCondenser_Impl.hpp"
59
60 #include "AirflowNetworkFan.hpp"
61 #include "AirflowNetworkFan_Impl.hpp"
62
63 #include "SetpointManagerMixedAir.hpp"
64
65 #include "ScheduleTypeLimits.hpp"
66 #include "ScheduleTypeRegistry.hpp"
67
68 #include "../utilities/idf/IdfExtensibleGroup.hpp"
69 #include "../utilities/idf/WorkspaceExtensibleGroup.hpp"
70 #include <utilities/idd/IddFactory.hxx>
71 #include <utilities/idd/IddEnums.hxx>
72 #include <utilities/idd/OS_Fan_SystemModel_FieldEnums.hxx>
73 #include "../utilities/core/Assert.hpp"
74 #include "../utilities/data/DataEnums.hpp"
75
76 #include <algorithm>
77
78 namespace openstudio {
79 namespace model {
80
81 17 FanSystemModelSpeed::FanSystemModelSpeed(double t_flowFraction) : m_flowFraction(t_flowFraction), m_electricPowerFraction(boost::none) {
82
83
2/4
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 17 times.
17 if ((m_flowFraction < 0) || (m_flowFraction > 1)) {
84 ✗ LOG_AND_THROW("Unable to create FanSystemModelSpeed, Flow Fraction (" << m_flowFraction << ") is outside the range [0, 1]");
85 }
86 17 }
87
88 51 FanSystemModelSpeed::FanSystemModelSpeed(double t_flowFraction, double t_electricPowerFraction)
89 51 : m_flowFraction(t_flowFraction), m_electricPowerFraction(t_electricPowerFraction) {
90
91
4/4
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 47 times.
51 if ((m_flowFraction < 0) || (m_flowFraction > 1)) {
92
17/17
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 4 times.
✓ Branch 16 taken 4 times.
✓ Branch 19 taken 4 times.
✓ Branch 25 taken 4 times.
✓ Branch 28 taken 4 times.
✓ Branch 31 taken 4 times.
✓ Branch 34 taken 4 times.
✓ Branch 37 taken 4 times.
✓ Branch 40 taken 4 times.
✓ Branch 43 taken 4 times.
✓ Branch 46 taken 4 times.
✓ Branch 50 taken 4 times.
✓ Branch 53 taken 4 times.
4 LOG_AND_THROW("Unable to create FanSystemModelSpeed, Flow Fraction (" << m_flowFraction << ") is outside the range [0, 1]");
93 }
94
4/4
✓ Branch 0 taken 46 times.
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 1 time.
✓ Branch 3 taken 45 times.
47 if ((t_electricPowerFraction < 0) || (t_electricPowerFraction > 1)) {
95
17/17
✓ 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.
✓ Branch 16 taken 2 times.
✓ Branch 19 taken 2 times.
✓ Branch 25 taken 2 times.
✓ Branch 28 taken 2 times.
✓ Branch 31 taken 2 times.
✓ Branch 34 taken 2 times.
✓ Branch 37 taken 2 times.
✓ Branch 40 taken 2 times.
✓ Branch 43 taken 2 times.
✓ Branch 46 taken 2 times.
✓ Branch 50 taken 2 times.
✓ Branch 53 taken 2 times.
2 LOG_AND_THROW("Unable to create FanSystemModelSpeed, Electric Power Fraction (" << t_electricPowerFraction << ") is outside the range [0, 1]");
96 }
97 45 }
98
99 66 double FanSystemModelSpeed::flowFraction() const {
100 66 return m_flowFraction;
101 }
102
103 77 boost::optional<double> FanSystemModelSpeed::electricPowerFraction() const {
104 77 return m_electricPowerFraction;
105 }
106
107 ✗ bool FanSystemModelSpeed::operator<(const FanSystemModelSpeed& other) const {
108 ✗ return (m_flowFraction < other.m_flowFraction);
109 }
110
111 ✗ std::ostream& operator<<(std::ostream& out, const openstudio::model::FanSystemModelSpeed& speed) {
112 ✗ if (auto efp_ = speed.electricPowerFraction()) {
113 ✗ out << "[" << speed.flowFraction() << ", " << efp_.get() << "]";
114 } else {
115 ✗ out << "[" << speed.flowFraction() << ", None]";
116 }
117 ✗ return out;
118 }
119
120 namespace detail {
121
122 87 FanSystemModel_Impl::FanSystemModel_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
123 87 : StraightComponent_Impl(idfObject, model, keepHandle) {
124
4/6
✓ Branch 1 taken 87 times.
✓ Branch 4 taken 87 times.
✓ Branch 7 taken 87 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 87 times.
✗ Branch 13 not taken.
87 OS_ASSERT(idfObject.iddObject().type() == FanSystemModel::iddObjectType());
125 87 }
126
127 3 FanSystemModel_Impl::FanSystemModel_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
128 3 : StraightComponent_Impl(other, model, keepHandle) {
129
4/6
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 3 times.
✗ Branch 13 not taken.
3 OS_ASSERT(other.iddObject().type() == FanSystemModel::iddObjectType());
130 3 }
131
132 30 FanSystemModel_Impl::FanSystemModel_Impl(const FanSystemModel_Impl& other, Model_Impl* model, bool keepHandle)
133 30 : StraightComponent_Impl(other, model, keepHandle) {}
134
135 ✗ const std::vector<std::string>& FanSystemModel_Impl::outputVariableNames() const {
136
137 static const std::vector<std::string> results{"Fan Electricity Rate", "Fan Rise in Air Temperature", "Fan Electricity Energy",
138 ✗ "Fan Air Mass Flow Rate"};
139 ✗ return results;
140 ✗ }
141
142 75 IddObjectType FanSystemModel_Impl::iddObjectType() const {
143 75 return FanSystemModel::iddObjectType();
144 }
145
146 ✗ std::vector<ScheduleTypeKey> FanSystemModel_Impl::getScheduleTypeKeys(const Schedule& schedule) const {
147 ✗ std::vector<ScheduleTypeKey> result;
148 ✗ UnsignedVector fieldIndices = getSourceIndices(schedule.handle());
149 ✗ UnsignedVector::const_iterator b(fieldIndices.begin());
150 ✗ UnsignedVector::const_iterator e(fieldIndices.end());
151 ✗ if (std::find(b, e, OS_Fan_SystemModelFields::AvailabilityScheduleName) != e) {
152 ✗ result.push_back(ScheduleTypeKey("FanSystemModel", "Availability"));
153 }
154 ✗ return result;
155 ✗ }
156
157 26 std::vector<ModelObject> FanSystemModel_Impl::children() const {
158 26 std::vector<ModelObject> result;
159
3/3
✓ Branch 1 taken 26 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 25 times.
52 if (boost::optional<Curve> intermediate = electricPowerFunctionofFlowFractionCurve()) {
160
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 result.push_back(*intermediate);
161 26 }
162 26 return result;
163 ✗ }
164
165 22 Schedule FanSystemModel_Impl::availabilitySchedule() const {
166
1/1
✓ Branch 1 taken 22 times.
22 boost::optional<Schedule> value = optionalAvailabilitySchedule();
167
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
22 if (!value) {
168 ✗ LOG_AND_THROW(briefDescription() << " does not have an Availability Schedule attached.");
169 }
170
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
44 return value.get();
171 22 }
172
173 22 boost::optional<Schedule> FanSystemModel_Impl::optionalAvailabilitySchedule() const {
174
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_Fan_SystemModelFields::AvailabilityScheduleName);
175 }
176
177 23 boost::optional<double> FanSystemModel_Impl::designMaximumAirFlowRate() const {
178 23 return getDouble(OS_Fan_SystemModelFields::DesignMaximumAirFlowRate, true);
179 }
180
181 4 bool FanSystemModel_Impl::isDesignMaximumAirFlowRateAutosized() const {
182 4 bool result = false;
183
1/1
✓ Branch 1 taken 4 times.
4 boost::optional<std::string> value = getString(OS_Fan_SystemModelFields::DesignMaximumAirFlowRate, true);
184
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 if (value) {
185
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
8 result = openstudio::istringEqual(value.get(), "autosize");
186 }
187 4 return result;
188 4 }
189
190 ✗ boost::optional<double> FanSystemModel_Impl::autosizedDesignMaximumAirFlowRate() {
191 ✗ return getAutosizedValue("Design Size Design Maximum Air Flow Rate", "m3/s");
192 }
193
194 23 std::string FanSystemModel_Impl::speedControlMethod() const {
195
1/1
✓ Branch 1 taken 23 times.
23 boost::optional<std::string> value = getString(OS_Fan_SystemModelFields::SpeedControlMethod, true);
196
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 23 times.
✗ Branch 4 not taken.
23 OS_ASSERT(value);
197
2/2
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
46 return value.get();
198 23 }
199
200 21 double FanSystemModel_Impl::electricPowerMinimumFlowRateFraction() const {
201
1/1
✓ Branch 1 taken 21 times.
21 boost::optional<double> value = getDouble(OS_Fan_SystemModelFields::ElectricPowerMinimumFlowRateFraction, true);
202
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 4 not taken.
21 OS_ASSERT(value);
203
1/1
✓ Branch 1 taken 21 times.
42 return value.get();
204 }
205
206 23 double FanSystemModel_Impl::designPressureRise() const {
207
1/1
✓ Branch 1 taken 23 times.
23 boost::optional<double> value = getDouble(OS_Fan_SystemModelFields::DesignPressureRise, true);
208
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 23 times.
✗ Branch 4 not taken.
23 OS_ASSERT(value);
209
1/1
✓ Branch 1 taken 23 times.
46 return value.get();
210 }
211
212 21 double FanSystemModel_Impl::motorEfficiency() const {
213
1/1
✓ Branch 1 taken 21 times.
21 boost::optional<double> value = getDouble(OS_Fan_SystemModelFields::MotorEfficiency, true);
214
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 4 not taken.
21 OS_ASSERT(value);
215
1/1
✓ Branch 1 taken 21 times.
42 return value.get();
216 }
217
218 21 double FanSystemModel_Impl::motorInAirStreamFraction() const {
219
1/1
✓ Branch 1 taken 21 times.
21 boost::optional<double> value = getDouble(OS_Fan_SystemModelFields::MotorInAirStreamFraction, true);
220
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 4 not taken.
21 OS_ASSERT(value);
221
1/1
✓ Branch 1 taken 21 times.
42 return value.get();
222 }
223
224 21 boost::optional<double> FanSystemModel_Impl::designElectricPowerConsumption() const {
225 21 return getDouble(OS_Fan_SystemModelFields::DesignElectricPowerConsumption, true);
226 }
227
228 4 bool FanSystemModel_Impl::isDesignElectricPowerConsumptionAutosized() const {
229 4 bool result = false;
230
1/1
✓ Branch 1 taken 4 times.
4 boost::optional<std::string> value = getString(OS_Fan_SystemModelFields::DesignElectricPowerConsumption, true);
231
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 if (value) {
232
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
8 result = openstudio::istringEqual(value.get(), "autosize");
233 }
234 4 return result;
235 4 }
236
237 ✗ boost::optional<double> FanSystemModel_Impl::autosizedDesignElectricPowerConsumption() {
238 ✗ return getAutosizedValue("Design Electric Power Consumption", "W");
239 }
240
241 22 std::string FanSystemModel_Impl::designPowerSizingMethod() const {
242
1/1
✓ Branch 1 taken 22 times.
22 boost::optional<std::string> value = getString(OS_Fan_SystemModelFields::DesignPowerSizingMethod, true);
243
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
✗ Branch 4 not taken.
22 OS_ASSERT(value);
244
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
44 return value.get();
245 22 }
246
247 21 double FanSystemModel_Impl::electricPowerPerUnitFlowRate() const {
248
1/1
✓ Branch 1 taken 21 times.
21 boost::optional<double> value = getDouble(OS_Fan_SystemModelFields::ElectricPowerPerUnitFlowRate, true);
249
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 4 not taken.
21 OS_ASSERT(value);
250
1/1
✓ Branch 1 taken 21 times.
42 return value.get();
251 }
252
253 21 double FanSystemModel_Impl::electricPowerPerUnitFlowRatePerUnitPressure() const {
254
1/1
✓ Branch 1 taken 21 times.
21 boost::optional<double> value = getDouble(OS_Fan_SystemModelFields::ElectricPowerPerUnitFlowRatePerUnitPressure, true);
255
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 4 not taken.
21 OS_ASSERT(value);
256
1/1
✓ Branch 1 taken 21 times.
42 return value.get();
257 }
258
259 24 double FanSystemModel_Impl::fanTotalEfficiency() const {
260
1/1
✓ Branch 1 taken 24 times.
24 boost::optional<double> value = getDouble(OS_Fan_SystemModelFields::FanTotalEfficiency, true);
261
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 4 not taken.
24 OS_ASSERT(value);
262
1/1
✓ Branch 1 taken 24 times.
48 return value.get();
263 }
264
265 71 boost::optional<Curve> FanSystemModel_Impl::electricPowerFunctionofFlowFractionCurve() const {
266
2/2
✓ Branch 1 taken 71 times.
✓ Branch 4 taken 71 times.
71 return getObject<ModelObject>().getModelObjectTarget<Curve>(OS_Fan_SystemModelFields::ElectricPowerFunctionofFlowFractionCurveName);
267 }
268
269 22 boost::optional<double> FanSystemModel_Impl::nightVentilationModePressureRise() const {
270 22 return getDouble(OS_Fan_SystemModelFields::NightVentilationModePressureRise, true);
271 }
272
273 22 boost::optional<double> FanSystemModel_Impl::nightVentilationModeFlowFraction() const {
274 22 return getDouble(OS_Fan_SystemModelFields::NightVentilationModeFlowFraction, true);
275 }
276
277 22 boost::optional<ThermalZone> FanSystemModel_Impl::motorLossZone() const {
278
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 return getObject<ModelObject>().getModelObjectTarget<ThermalZone>(OS_Fan_SystemModelFields::MotorLossZoneName);
279 }
280
281 22 double FanSystemModel_Impl::motorLossRadiativeFraction() const {
282
1/1
✓ Branch 1 taken 22 times.
22 boost::optional<double> value = getDouble(OS_Fan_SystemModelFields::MotorLossRadiativeFraction, true);
283
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
✗ Branch 4 not taken.
22 OS_ASSERT(value);
284
1/1
✓ Branch 1 taken 22 times.
44 return value.get();
285 }
286
287 20 std::string FanSystemModel_Impl::endUseSubcategory() const {
288
1/1
✓ Branch 1 taken 20 times.
20 boost::optional<std::string> value = getString(OS_Fan_SystemModelFields::EndUseSubcategory, true);
289
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
✗ Branch 4 not taken.
20 OS_ASSERT(value);
290
2/2
✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
40 return value.get();
291 20 }
292
293 102 bool FanSystemModel_Impl::setAvailabilitySchedule(Schedule& schedule) {
294
3/3
✓ Branch 1 taken 102 times.
✓ Branch 4 taken 102 times.
✓ Branch 7 taken 102 times.
408 bool result = setSchedule(OS_Fan_SystemModelFields::AvailabilityScheduleName, "FanSystemModel", "Availability", schedule);
295 102 return result;
296 }
297
298 67 unsigned FanSystemModel_Impl::inletPort() const {
299 67 return OS_Fan_SystemModelFields::AirInletNodeName;
300 }
301
302 114 unsigned FanSystemModel_Impl::outletPort() const {
303 114 return OS_Fan_SystemModelFields::AirOutletNodeName;
304 }
305
306 9 bool FanSystemModel_Impl::addToNode(Node& node) {
307
1/1
✓ Branch 1 taken 9 times.
9 auto oaSystem = node.airLoopHVACOutdoorAirSystem();
308
1/1
✓ Branch 1 taken 9 times.
9 auto airLoop = node.airLoopHVAC();
309
310
19/24
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 3 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 13 taken 1 time.
✓ Branch 14 taken 5 times.
✓ Branch 15 taken 1 time.
✓ Branch 16 taken 3 times.
✓ Branch 18 taken 1 time.
✓ Branch 21 taken 1 time.
✓ Branch 24 taken 1 time.
✓ Branch 27 taken 1 time.
✗ Branch 28 not taken.
✓ Branch 29 taken 1 time.
✓ Branch 30 taken 8 times.
✓ Branch 32 taken 6 times.
✓ Branch 33 taken 3 times.
✓ Branch 35 taken 6 times.
✓ Branch 36 taken 3 times.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
29 if ((airLoop && airLoop->supplyComponent(node.handle())) || (oaSystem && oaSystem->component(node.handle()))) {
311
2/3
✓ Branch 1 taken 6 times.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
6 if (StraightComponent_Impl::addToNode(node)) {
312
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 time.
6 if (airLoop) {
313
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 SetpointManagerMixedAir::updateFanInletOutletNodes(airLoop.get());
314 }
315 6 return true;
316 }
317 }
318
319 3 return false;
320 9 }
321
322 5 boost::optional<HVACComponent> FanSystemModel_Impl::containingHVACComponent() const {
323
1/1
✓ Branch 1 taken 5 times.
5 auto t_handle = handle();
324
325 // AirLoopHVACUnitarySystem
326
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 std::vector<AirLoopHVACUnitarySystem> airLoopHVACUnitarySystems = this->model().getConcreteModelObjects<AirLoopHVACUnitarySystem>();
327
328
2/2
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 4 times.
5 for (const auto& airLoopHVACUnitarySystem : airLoopHVACUnitarySystems) {
329
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<HVACComponent> fan = airLoopHVACUnitarySystem.supplyFan()) {
330
4/5
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 9 taken 1 time.
✗ Branch 10 not taken.
1 if (fan->handle() == t_handle) {
331
1/1
✓ Branch 1 taken 1 time.
1 return airLoopHVACUnitarySystem;
332 }
333 1 }
334 }
335
336 // AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass
337 std::vector<AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass> bypassSystems =
338
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 this->model().getConcreteModelObjects<AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass>();
339
340
2/2
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 3 times.
4 for (const auto& bypassSystem : bypassSystems) {
341
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if (boost::optional<HVACComponent> fan = bypassSystem.supplyAirFan()) {
342
4/5
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 9 taken 1 time.
✗ Branch 10 not taken.
1 if (fan->handle() == t_handle) {
343
1/1
✓ Branch 1 taken 1 time.
1 return bypassSystem;
344 }
345 1 }
346 }
347
348 // TODO: Energy+.idd currently won't let that actually happen right now (cf https://github.com/NREL/EnergyPlus/issues/7697)
349 // But it can't hurt to have that code in already
350 // AirLoopHVACUnitaryHeatPumpAirToAir
351 //std::vector<AirLoopHVACUnitaryHeatPumpAirToAir> airLoopHVACUnitaryHeatPumpAirToAirs = this->model().getConcreteModelObjects<AirLoopHVACUnitaryHeatPumpAirToAir>();
352
353 //for( const auto & airLoopHVACUnitaryHeatPumpAirToAir : airLoopHVACUnitaryHeatPumpAirToAirs )
354 //{
355 //if( boost::optional<HVACComponent> fan = airLoopHVACUnitaryHeatPumpAirToAir.supplyAirFan() )
356 //{
357 //if( fan->handle() == this->handle() )
358 //{
359 //return airLoopHVACUnitaryHeatPumpAirToAir;
360 //}
361 //}
362 //}
363
364 // TODO: Energy+.idd currently won't let that actually happen
365 // AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed
366 //std::vector<AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed> airLoopHVACUnitaryHeatPumpAirToAirMultiSpeeds = this->model().getConcreteModelObjects<AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed>();
367
368 //for( const auto & airLoopHVACUnitaryHeatPumpAirToAirMultiSpeed : airLoopHVACUnitaryHeatPumpAirToAirMultiSpeeds )
369 //{
370 //if( boost::optional<HVACComponent> fan = airLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.supplyAirFan() )
371 //{
372 //if( fan->handle() == this->handle() )
373 //{
374 //return airLoopHVACUnitaryHeatPumpAirToAirMultiSpeed;
375 //}
376 //}
377 //}
378
379 // AirTerminalSingleDuctParallelPIUReheat
380 3 std::vector<AirTerminalSingleDuctParallelPIUReheat> airTerminalSingleDuctParallelPIUReheatObjects;
381
382
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 airTerminalSingleDuctParallelPIUReheatObjects = this->model().getConcreteModelObjects<AirTerminalSingleDuctParallelPIUReheat>();
383
384
2/2
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 2 times.
3 for (const auto& airTerminalSingleDuctParallelPIUReheatObject : airTerminalSingleDuctParallelPIUReheatObjects) {
385
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if (boost::optional<HVACComponent> fan = airTerminalSingleDuctParallelPIUReheatObject.fan()) {
386
5/6
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 12 taken 1 time.
✗ Branch 13 not taken.
1 if (fan->handle() == this->handle()) {
387
1/1
✓ Branch 1 taken 1 time.
1 return airTerminalSingleDuctParallelPIUReheatObject;
388 }
389 1 }
390 }
391
392 // AirTerminalSingleDuctSeriesPIUReheat
393 2 std::vector<AirTerminalSingleDuctSeriesPIUReheat> airTerminalSingleDuctSeriesPIUReheatObjects;
394
395
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 airTerminalSingleDuctSeriesPIUReheatObjects = this->model().getConcreteModelObjects<AirTerminalSingleDuctSeriesPIUReheat>();
396
397
2/2
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 1 time.
2 for (const auto& airTerminalSingleDuctSeriesPIUReheatObject : airTerminalSingleDuctSeriesPIUReheatObjects) {
398
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
2 if (boost::optional<HVACComponent> fan = airTerminalSingleDuctSeriesPIUReheatObject.fan()) {
399
5/6
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 12 taken 1 time.
✗ Branch 13 not taken.
1 if (fan->handle() == this->handle()) {
400
1/1
✓ Branch 1 taken 1 time.
1 return airTerminalSingleDuctSeriesPIUReheatObject;
401 }
402 1 }
403 }
404
405 // WaterHeaterHeatPump: That's a ZoneHVAC technically...
406 //{
407 //auto hpwhs = model().getConcreteModelObjects<WaterHeaterHeatPump>();
408 //for( const auto & hpwh : hpwhs ) {
409 //if( hpwh.fan().handle() == t_handle ) {
410 //return hpwh;
411 //}
412 //}
413 //}
414
415 1 return boost::none;
416 5 }
417
418 14 boost::optional<ZoneHVACComponent> FanSystemModel_Impl::containingZoneHVACComponent() const {
419
420
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 std::vector<ZoneHVACComponent> zoneHVACComponent = this->model().getModelObjects<ZoneHVACComponent>();
421
2/2
✓ Branch 5 taken 14 times.
✓ Branch 6 taken 1 time.
15 for (const auto& elem : zoneHVACComponent) {
422
15/15
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 14 taken 1 time.
✓ Branch 15 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 18 taken 1 time.
✓ Branch 19 taken 3 times.
✓ Branch 20 taken 1 time.
✓ Branch 21 taken 1 time.
14 switch (elem.iddObject().type().value()) {
423
424 // Technically these two **are** ZoneHVACComponents
425 1 case openstudio::IddObjectType::OS_WaterHeater_HeatPump: {
426
1/1
✓ Branch 1 taken 1 time.
1 auto component = elem.cast<WaterHeaterHeatPump>();
427
5/6
✓ 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 14 not taken.
1 if (component.fan().handle() == this->handle()) {
428
1/1
✓ Branch 1 taken 1 time.
1 return elem;
429 }
430 ✗ break;
431 1 }
432 1 case openstudio::IddObjectType::OS_WaterHeater_HeatPump_WrappedCondenser: {
433
1/1
✓ Branch 1 taken 1 time.
1 auto component = elem.cast<WaterHeaterHeatPumpWrappedCondenser>();
434
5/6
✓ 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 14 not taken.
1 if (component.fan().handle() == this->handle()) {
435
1/1
✓ Branch 1 taken 1 time.
1 return elem;
436 }
437 ✗ break;
438 1 }
439
440 1 case openstudio::IddObjectType::OS_ZoneHVAC_EnergyRecoveryVentilator: {
441
1/1
✓ Branch 1 taken 1 time.
1 auto component = elem.cast<ZoneHVACEnergyRecoveryVentilator>();
442
5/6
✓ 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 14 not taken.
1 if (component.supplyAirFan().handle() == this->handle()) {
443
1/1
✓ Branch 1 taken 1 time.
1 return elem;
444 }
445 ✗ break;
446 1 }
447 1 case openstudio::IddObjectType::OS_ZoneHVAC_FourPipeFanCoil: {
448
1/1
✓ Branch 1 taken 1 time.
1 auto component = elem.cast<ZoneHVACFourPipeFanCoil>();
449
5/6
✓ 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 14 not taken.
1 if (component.supplyAirFan().handle() == this->handle()) {
450
1/1
✓ Branch 1 taken 1 time.
1 return elem;
451 }
452 ✗ break;
453 1 }
454 1 case openstudio::IddObjectType::OS_ZoneHVAC_PackagedTerminalAirConditioner: {
455
1/1
✓ Branch 1 taken 1 time.
1 auto component = elem.cast<ZoneHVACPackagedTerminalAirConditioner>();
456
5/6
✓ 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 14 not taken.
1 if (component.supplyAirFan().handle() == this->handle()) {
457
1/1
✓ Branch 1 taken 1 time.
1 return elem;
458 }
459 ✗ break;
460 1 }
461 1 case openstudio::IddObjectType::OS_ZoneHVAC_PackagedTerminalHeatPump: {
462
1/1
✓ Branch 1 taken 1 time.
1 auto component = elem.cast<ZoneHVACPackagedTerminalHeatPump>();
463
5/6
✓ 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 14 not taken.
1 if (component.supplyAirFan().handle() == this->handle()) {
464
1/1
✓ Branch 1 taken 1 time.
1 return elem;
465 }
466 ✗ break;
467 1 }
468 1 case openstudio::IddObjectType::OS_ZoneHVAC_TerminalUnit_VariableRefrigerantFlow: {
469
1/1
✓ Branch 1 taken 1 time.
1 auto component = elem.cast<ZoneHVACTerminalUnitVariableRefrigerantFlow>();
470
5/6
✓ 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 14 not taken.
1 if (component.supplyAirFan().handle() == this->handle()) {
471
1/1
✓ Branch 1 taken 1 time.
1 return elem;
472 }
473 ✗ break;
474 1 }
475 1 case openstudio::IddObjectType::OS_ZoneHVAC_UnitHeater: {
476
1/1
✓ Branch 1 taken 1 time.
1 auto component = elem.cast<ZoneHVACUnitHeater>();
477
5/6
✓ 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 14 not taken.
1 if (component.supplyAirFan().handle() == this->handle()) {
478
1/1
✓ Branch 1 taken 1 time.
1 return elem;
479 }
480 ✗ break;
481 1 }
482 1 case openstudio::IddObjectType::OS_ZoneHVAC_UnitVentilator: {
483
1/1
✓ Branch 1 taken 1 time.
1 auto component = elem.cast<ZoneHVACUnitVentilator>();
484
5/6
✓ 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 14 not taken.
1 if (component.supplyAirFan().handle() == this->handle()) {
485
1/1
✓ Branch 1 taken 1 time.
1 return elem;
486 }
487 ✗ break;
488 1 }
489 3 case openstudio::IddObjectType::OS_ZoneHVAC_EvaporativeCoolerUnit: {
490
1/1
✓ Branch 1 taken 3 times.
3 auto component = elem.cast<ZoneHVACEvaporativeCoolerUnit>();
491
5/6
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✗ Branch 14 not taken.
3 if (component.supplyAirFan().handle() == this->handle()) {
492
1/1
✓ Branch 1 taken 3 times.
3 return elem;
493 }
494 ✗ break;
495 3 }
496 1 case openstudio::IddObjectType::OS_ZoneHVAC_WaterToAirHeatPump: {
497
1/1
✓ Branch 1 taken 1 time.
1 auto component = elem.cast<ZoneHVACWaterToAirHeatPump>();
498
5/6
✓ 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 14 not taken.
1 if (component.supplyAirFan().handle() == this->handle()) {
499
1/1
✓ Branch 1 taken 1 time.
1 return elem;
500 }
501 ✗ break;
502 1 }
503 1 default: {
504 1 break;
505 }
506 }
507 }
508 1 return boost::none;
509 14 }
510
511 4 bool FanSystemModel_Impl::setDesignMaximumAirFlowRate(double designMaximumAirFlowRate) {
512 4 bool result = setDouble(OS_Fan_SystemModelFields::DesignMaximumAirFlowRate, designMaximumAirFlowRate);
513 4 return result;
514 }
515
516 99 void FanSystemModel_Impl::autosizeDesignMaximumAirFlowRate() {
517
2/2
✓ Branch 1 taken 99 times.
✓ Branch 4 taken 99 times.
198 bool result = setString(OS_Fan_SystemModelFields::DesignMaximumAirFlowRate, "autosize");
518
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 99 times.
99 OS_ASSERT(result);
519 99 }
520
521 102 bool FanSystemModel_Impl::setSpeedControlMethod(const std::string& speedControlMethod) {
522 102 bool result = setString(OS_Fan_SystemModelFields::SpeedControlMethod, speedControlMethod);
523 102 return result;
524 }
525
526 100 bool FanSystemModel_Impl::setElectricPowerMinimumFlowRateFraction(double electricPowerMinimumFlowRateFraction) {
527 100 bool result = setDouble(OS_Fan_SystemModelFields::ElectricPowerMinimumFlowRateFraction, electricPowerMinimumFlowRateFraction);
528 100 return result;
529 }
530
531 102 bool FanSystemModel_Impl::setDesignPressureRise(double designPressureRise) {
532 102 bool result = setDouble(OS_Fan_SystemModelFields::DesignPressureRise, designPressureRise);
533 102 return result;
534 }
535
536 100 bool FanSystemModel_Impl::setMotorEfficiency(double motorEfficiency) {
537 100 bool result = setDouble(OS_Fan_SystemModelFields::MotorEfficiency, motorEfficiency);
538 100 return result;
539 }
540
541 100 bool FanSystemModel_Impl::setMotorInAirStreamFraction(double motorInAirStreamFraction) {
542 100 bool result = setDouble(OS_Fan_SystemModelFields::MotorInAirStreamFraction, motorInAirStreamFraction);
543 100 return result;
544 }
545
546 2 bool FanSystemModel_Impl::setDesignElectricPowerConsumption(double designElectricPowerConsumption) {
547 2 bool result = setDouble(OS_Fan_SystemModelFields::DesignElectricPowerConsumption, designElectricPowerConsumption);
548 // OS_ASSERT(result); // shouldn't accept < 0
549 2 return result;
550 }
551
552 99 void FanSystemModel_Impl::autosizeDesignElectricPowerConsumption() {
553
2/2
✓ Branch 1 taken 99 times.
✓ Branch 4 taken 99 times.
198 bool result = setString(OS_Fan_SystemModelFields::DesignElectricPowerConsumption, "autosize");
554
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 99 times.
99 OS_ASSERT(result);
555 99 }
556
557 103 bool FanSystemModel_Impl::setDesignPowerSizingMethod(const std::string& designPowerSizingMethod) {
558 103 bool result = setString(OS_Fan_SystemModelFields::DesignPowerSizingMethod, designPowerSizingMethod);
559 103 return result;
560 }
561
562 86 bool FanSystemModel_Impl::setElectricPowerPerUnitFlowRate(double electricPowerPerUnitFlowRate) {
563 86 bool result = setDouble(OS_Fan_SystemModelFields::ElectricPowerPerUnitFlowRate, electricPowerPerUnitFlowRate);
564 // OS_ASSERT(result); // shouldn't accept < 0
565 86 return result;
566 }
567
568 86 bool FanSystemModel_Impl::setElectricPowerPerUnitFlowRatePerUnitPressure(double electricPowerPerUnitFlowRatePerUnitPressure) {
569 86 bool result = setDouble(OS_Fan_SystemModelFields::ElectricPowerPerUnitFlowRatePerUnitPressure, electricPowerPerUnitFlowRatePerUnitPressure);
570 // OS_ASSERT(result); // shouldn't accept < 0
571 86 return result;
572 }
573
574 102 bool FanSystemModel_Impl::setFanTotalEfficiency(double fanTotalEfficiency) {
575 102 bool result = setDouble(OS_Fan_SystemModelFields::FanTotalEfficiency, fanTotalEfficiency);
576 102 return result;
577 }
578
579 13 bool FanSystemModel_Impl::setElectricPowerFunctionofFlowFractionCurve(const Curve& curve) {
580
2/2
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
13 bool result = setPointer(OS_Fan_SystemModelFields::ElectricPowerFunctionofFlowFractionCurveName, curve.handle());
581 13 return result;
582 }
583
584 1 void FanSystemModel_Impl::resetElectricPowerFunctionofFlowFractionCurve() {
585
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Fan_SystemModelFields::ElectricPowerFunctionofFlowFractionCurveName, "");
586
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
587 1 }
588
589 2 bool FanSystemModel_Impl::setNightVentilationModePressureRise(double nightVentilationModePressureRise) {
590 2 bool result = setDouble(OS_Fan_SystemModelFields::NightVentilationModePressureRise, nightVentilationModePressureRise);
591 // OS_ASSERT(result); // shouldn't accept < 0
592 2 return result;
593 }
594
595 ✗ void FanSystemModel_Impl::resetNightVentilationModePressureRise() {
596 ✗ bool result = setString(OS_Fan_SystemModelFields::NightVentilationModePressureRise, "");
597 ✗ OS_ASSERT(result);
598 ✗ }
599
600 2 bool FanSystemModel_Impl::setNightVentilationModeFlowFraction(double nightVentilationModeFlowFraction) {
601 2 bool result = setDouble(OS_Fan_SystemModelFields::NightVentilationModeFlowFraction, nightVentilationModeFlowFraction);
602 2 return result;
603 }
604
605 ✗ void FanSystemModel_Impl::resetNightVentilationModeFlowFraction() {
606 ✗ bool result = setString(OS_Fan_SystemModelFields::NightVentilationModeFlowFraction, "");
607 ✗ OS_ASSERT(result);
608 ✗ }
609
610 2 bool FanSystemModel_Impl::setMotorLossZone(const ThermalZone& thermalZone) {
611
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 bool result = setPointer(OS_Fan_SystemModelFields::MotorLossZoneName, thermalZone.handle());
612 2 return result;
613 }
614
615 ✗ void FanSystemModel_Impl::resetMotorLossZone() {
616 ✗ bool result = setString(OS_Fan_SystemModelFields::MotorLossZoneName, "");
617 ✗ OS_ASSERT(result);
618 ✗ }
619
620 87 bool FanSystemModel_Impl::setMotorLossRadiativeFraction(double motorLossRadiativeFraction) {
621 87 bool result = setDouble(OS_Fan_SystemModelFields::MotorLossRadiativeFraction, motorLossRadiativeFraction);
622 87 return result;
623 }
624
625 100 bool FanSystemModel_Impl::setEndUseSubcategory(const std::string& endUseSubcategory) {
626 100 bool result = setString(OS_Fan_SystemModelFields::EndUseSubcategory, endUseSubcategory);
627
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
100 OS_ASSERT(result);
628 100 return result;
629 }
630
631 //bool FanSystemModel_Impl::setNumberofSpeeds(int numberofSpeeds) {
632 //bool result = setInt(OS_Fan_SystemModelFields::NumberofSpeeds, numberofSpeeds);
633 //// OS_ASSERT(result); // shouldn't accept < 0
634 //return result;
635 //}
636
637 38 unsigned FanSystemModel_Impl::numberofSpeeds() const {
638 // number of different speed levels available when Speed Control Method is set to Discrete
639 // note Speed need to be arranged in increasing order in remaining field sets.
640 // If set to 1, or omitted, and Speed Control Method is Discrete then constant fan speed is the design maximum.
641
1/1
✓ Branch 1 taken 38 times.
38 return std::max<unsigned>(1, numExtensibleGroups());
642 }
643
644 ✗ boost::optional<unsigned> FanSystemModel_Impl::speedIndex(const FanSystemModelSpeed& t_speed) const {
645 ✗ boost::optional<unsigned> result;
646
647 // We do it with extensibleGroups() (rather than speeds()) and getString to avoid overhead
648 // of manipulating actual model objects and speed up the routine
649 ✗ auto egs = castVector<WorkspaceExtensibleGroup>(extensibleGroups());
650 ✗ auto flowFraction = toString(t_speed.flowFraction());
651 ✗ auto it = std::find_if(egs.begin(), egs.end(), [&](const WorkspaceExtensibleGroup& eg) {
652 ✗ return (eg.getField(OS_Fan_SystemModelExtensibleFields::SpeedFlowFraction).get() == flowFraction);
653 });
654
655 // If found, we compute the index by using std::distance between the start of vector and the iterator returned by std::find_if
656 ✗ if (it != egs.end()) {
657 ✗ result = std::distance(egs.begin(), it);
658 }
659
660 ✗ return result;
661 ✗ }
662
663 35 std::vector<FanSystemModelSpeed> FanSystemModel_Impl::speeds() const {
664
665 35 std::vector<FanSystemModelSpeed> result;
666
667
3/3
✓ Branch 1 taken 35 times.
✓ Branch 8 taken 32 times.
✓ Branch 9 taken 35 times.
67 for (const auto& group : extensibleGroups()) {
668
1/1
✓ Branch 1 taken 32 times.
32 boost::optional<double> _flowFraction = group.getDouble(OS_Fan_SystemModelExtensibleFields::SpeedFlowFraction);
669
1/1
✓ Branch 1 taken 32 times.
32 boost::optional<double> _electricPowerFraction = group.getDouble(OS_Fan_SystemModelExtensibleFields::SpeedElectricPowerFraction);
670
1/2
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
32 if (_flowFraction.has_value()) {
671
2/2
✓ Branch 1 taken 19 times.
✓ Branch 2 taken 13 times.
32 if (_electricPowerFraction.has_value()) {
672
4/4
✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
✓ Branch 7 taken 19 times.
✓ Branch 10 taken 19 times.
19 result.push_back(FanSystemModelSpeed(_flowFraction.get(), _electricPowerFraction.get()));
673 } else {
674
3/3
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 13 times.
13 result.push_back(FanSystemModelSpeed(_flowFraction.get()));
675 }
676 } else {
677 // Shouldn't happen
678 ✗ OS_ASSERT(false);
679 }
680 35 }
681
682 35 return result;
683 ✗ }
684
685 ✗ boost::optional<FanSystemModelSpeed> FanSystemModel_Impl::getSpeed(unsigned speedIndex) const {
686
687 ✗ boost::optional<FanSystemModelSpeed> result;
688
689 ✗ unsigned n = numberofSpeeds();
690 ✗ if (speedIndex >= n) {
691 ✗ LOG(Error, "Asked to get FanSystemModelSpeed with index " << speedIndex << ", but " << briefDescription() << " has just " << n << " Speeds.");
692 ✗ return result;
693 }
694
695 ✗ IdfExtensibleGroup group = getExtensibleGroup(speedIndex);
696 ✗ boost::optional<double> _flowFraction = group.getDouble(OS_Fan_SystemModelExtensibleFields::SpeedFlowFraction);
697 ✗ boost::optional<double> _electricPowerFraction = group.getDouble(OS_Fan_SystemModelExtensibleFields::SpeedElectricPowerFraction);
698 ✗ if (_flowFraction.has_value()) {
699 ✗ if (_electricPowerFraction.has_value()) {
700 ✗ result = FanSystemModelSpeed(_flowFraction.get(), _electricPowerFraction.get());
701 } else {
702 ✗ result = FanSystemModelSpeed(_flowFraction.get());
703 }
704 } else {
705 // Shouldn't happen
706 ✗ OS_ASSERT(false);
707 }
708
709 ✗ return result;
710 ✗ }
711
712 39 bool FanSystemModel_Impl::addSpeedPrivate(double flowFraction, boost::optional<double> electricPowerFraction) {
713 bool result;
714 // Push an extensible group
715
3/3
✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
✓ Branch 7 taken 39 times.
39 auto eg = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>();
716
1/1
✓ Branch 1 taken 39 times.
39 bool temp = eg.setDouble(OS_Fan_SystemModelExtensibleFields::SpeedFlowFraction, flowFraction);
717 39 bool ok = electricPowerFraction.is_initialized()
718
4/4
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 30 times.
✓ Branch 6 taken 30 times.
39 ? eg.setDouble(OS_Fan_SystemModelExtensibleFields::SpeedElectricPowerFraction, electricPowerFraction.get())
719 39 : true;
720
2/4
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
✗ Branch 3 not taken.
39 if (temp && ok) {
721 39 result = true;
722 } else {
723 // Something went wrong, which shouldn't happen really.
724 ✗ getObject<ModelObject>().eraseExtensibleGroup(eg.groupIndex());
725 ✗ result = false;
726 }
727 39 return result;
728 39 }
729
730 6 bool FanSystemModel_Impl::addSpeed(const FanSystemModelSpeed& speed) {
731 // Speeds need to be sorted...
732
1/1
✓ Branch 1 taken 6 times.
6 std::vector<FanSystemModelSpeed> s = speeds();
733
1/1
✓ Branch 1 taken 6 times.
6 s.push_back(speed);
734
1/1
✓ Branch 1 taken 6 times.
12 return setSpeeds(s);
735 6 }
736
737 2 bool FanSystemModel_Impl::addSpeed(double flowFraction) {
738
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 return addSpeed(FanSystemModelSpeed(flowFraction));
739 }
740
741 // Overloads, it creates a FanSystemModelSpeed wrapper, then call `addSpeed(const FanSystemModelSpeed&)`
742 2 bool FanSystemModel_Impl::addSpeed(double flowFraction, double electricPowerFraction) {
743 // Make a speed (which will check for validity), and then call the above function
744
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 return addSpeed(FanSystemModelSpeed(flowFraction, electricPowerFraction));
745 }
746
747 2 bool FanSystemModel_Impl::removeSpeed(unsigned speedIndex) {
748 bool result;
749
750 2 unsigned n = numberofSpeeds();
751
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (speedIndex < n) {
752
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 getObject<ModelObject>().eraseExtensibleGroup(speedIndex);
753 2 result = true;
754 } else {
755 ✗ result = false;
756 }
757 2 return result;
758 }
759
760 2 void FanSystemModel_Impl::removeAllSpeeds() {
761
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 getObject<ModelObject>().clearExtensibleGroups();
762 2 }
763
764 // Directly set the speeds from a vector, will delete any existing speeds, will sort the speeds by flow fraction too as required
765 15 bool FanSystemModel_Impl::setSpeeds(const std::vector<FanSystemModelSpeed>& speeds) {
766
767 // Ok, now we clear
768
1/1
✓ Branch 1 taken 15 times.
15 this->clearExtensibleGroups();
769
770 15 std::vector<std::pair<double, boost::optional<double>>> speedVecPair;
771
2/2
✓ Branch 4 taken 39 times.
✓ Branch 5 taken 15 times.
54 for (const FanSystemModelSpeed& sp : speeds) {
772
3/3
✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
✓ Branch 8 taken 39 times.
39 speedVecPair.push_back(std::make_pair(sp.flowFraction(), sp.electricPowerFraction()));
773 }
774
1/1
✓ Branch 3 taken 15 times.
15 std::sort(speedVecPair.begin(), speedVecPair.end());
775 15 bool result = true;
776
2/2
✓ Branch 4 taken 39 times.
✓ Branch 5 taken 15 times.
54 for (const auto& speed : speedVecPair) {
777
1/1
✓ Branch 1 taken 39 times.
39 result &= addSpeedPrivate(speed.first, speed.second);
778 }
779
780
3/3
✓ Branch 1 taken 15 times.
✓ Branch 5 taken 14 times.
✓ Branch 6 taken 1 time.
15 if (!electricPowerFunctionofFlowFractionCurve()) {
781
782 // We do it with extensibleGroups() (rather than speeds()) and isEmpty to avoid overhead
783 // of manipulating actual model objects and speed up the routine
784
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 auto egs = castVector<WorkspaceExtensibleGroup>(extensibleGroups());
785 31 auto hasBlankEPF = [](const WorkspaceExtensibleGroup& eg) {
786 31 return eg.isEmpty(OS_Fan_SystemModelExtensibleFields::SpeedElectricPowerFraction);
787 };
788
3/3
✓ Branch 3 taken 14 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 10 times.
14 if (std::any_of(egs.begin(), egs.end(), hasBlankEPF)) {
789
9/9
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 13 taken 4 times.
✓ Branch 16 taken 4 times.
✓ Branch 20 taken 4 times.
✓ Branch 23 taken 4 times.
✓ Branch 26 taken 4 times.
4 LOG(Warn, "For" << briefDescription() << ", you have speeds with blank ElectricPowerFraction "
790 << "but you did not assign an Electric Power Function of Flow Fraction Curve.");
791 }
792 14 }
793
794 15 return result;
795 15 }
796
797 ✗ void FanSystemModel_Impl::autosize() {
798 ✗ autosizedDesignMaximumAirFlowRate();
799 ✗ autosizedDesignElectricPowerConsumption();
800 ✗ }
801
802 ✗ void FanSystemModel_Impl::applySizingValues() {
803 ✗ boost::optional<double> val;
804 ✗ val = autosizedDesignMaximumAirFlowRate();
805 ✗ if (val) {
806 ✗ setDesignMaximumAirFlowRate(val.get());
807 }
808
809 ✗ val = autosizedDesignElectricPowerConsumption();
810 ✗ if (val) {
811 ✗ setDesignElectricPowerConsumption(val.get());
812 }
813 ✗ }
814
815 ✗ AirflowNetworkFan FanSystemModel_Impl::getAirflowNetworkFan() {
816 ✗ auto opt = airflowNetworkFan();
817 ✗ if (opt) {
818 ✗ return opt.get();
819 }
820 ✗ return AirflowNetworkFan(model(), handle());
821 ✗ }
822
823 ✗ boost::optional<AirflowNetworkFan> FanSystemModel_Impl::airflowNetworkFan() const {
824 std::vector<AirflowNetworkFan> myAFNitems =
825 ✗ getObject<ModelObject>().getModelObjectSources<AirflowNetworkFan>(AirflowNetworkFan::iddObjectType());
826 ✗ auto count = myAFNitems.size();
827 ✗ if (count == 1) {
828 ✗ return myAFNitems[0];
829 ✗ } else if (count > 1) {
830 ✗ LOG(Warn, briefDescription() << " has more than one AirflowNetworkFan attached, returning first.");
831 ✗ return myAFNitems[0];
832 }
833 ✗ return boost::none;
834 ✗ }
835
836 ✗ ComponentType FanSystemModel_Impl::componentType() const {
837 ✗ return ComponentType::None;
838 }
839
840 ✗ std::vector<FuelType> FanSystemModel_Impl::coolingFuelTypes() const {
841 ✗ return {};
842 }
843
844 ✗ std::vector<FuelType> FanSystemModel_Impl::heatingFuelTypes() const {
845 ✗ return {};
846 }
847
848 ✗ std::vector<AppGFuelType> FanSystemModel_Impl::appGHeatingFuelTypes() const {
849 ✗ return {};
850 }
851
852 } // namespace detail
853
854 84 FanSystemModel::FanSystemModel(const Model& model) : StraightComponent(FanSystemModel::iddObjectType(), model) {
855
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 84 times.
✗ Branch 5 not taken.
84 OS_ASSERT(getImpl<detail::FanSystemModel_Impl>());
856
857 84 bool ok = true;
858
859
1/1
✓ Branch 1 taken 84 times.
84 auto availabilitySchedule = model.alwaysOnDiscreteSchedule();
860
1/1
✓ Branch 1 taken 84 times.
84 ok = setAvailabilitySchedule(availabilitySchedule);
861
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✗ Branch 3 not taken.
84 OS_ASSERT(ok);
862
863
1/1
✓ Branch 1 taken 84 times.
84 autosizeDesignMaximumAirFlowRate();
864
865
1/1
✓ Branch 1 taken 84 times.
84 ok = setDesignPressureRise(500.0); // Completely abritrary
866
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✗ Branch 3 not taken.
84 OS_ASSERT(ok);
867
2/2
✓ Branch 1 taken 84 times.
✓ Branch 4 taken 84 times.
84 ok = setSpeedControlMethod("Discrete");
868
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✗ Branch 3 not taken.
84 OS_ASSERT(ok);
869
1/1
✓ Branch 1 taken 84 times.
84 ok = setElectricPowerMinimumFlowRateFraction(0.2);
870
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✗ Branch 3 not taken.
84 OS_ASSERT(ok);
871
1/1
✓ Branch 1 taken 84 times.
84 ok = setMotorEfficiency(0.9);
872
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✗ Branch 3 not taken.
84 OS_ASSERT(ok);
873
1/1
✓ Branch 1 taken 84 times.
84 ok = setMotorInAirStreamFraction(1.0);
874
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✗ Branch 3 not taken.
84 OS_ASSERT(ok);
875
876
1/1
✓ Branch 1 taken 84 times.
84 autosizeDesignElectricPowerConsumption();
877
878
1/1
✓ Branch 1 taken 84 times.
84 ok = setElectricPowerPerUnitFlowRate(840.0); // TODO
879
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✗ Branch 3 not taken.
84 OS_ASSERT(ok);
880
1/1
✓ Branch 1 taken 84 times.
84 ok = setElectricPowerPerUnitFlowRatePerUnitPressure(1.66667);
881
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✗ Branch 3 not taken.
84 OS_ASSERT(ok);
882
2/2
✓ Branch 1 taken 84 times.
✓ Branch 4 taken 84 times.
84 ok = setDesignPowerSizingMethod("PowerPerFlowPerPressure");
883
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✗ Branch 3 not taken.
84 OS_ASSERT(ok);
884
1/1
✓ Branch 1 taken 84 times.
84 ok = setFanTotalEfficiency(0.7);
885
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✗ Branch 3 not taken.
84 OS_ASSERT(ok);
886
1/1
✓ Branch 1 taken 84 times.
84 ok = setMotorLossRadiativeFraction(0.0);
887
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✗ Branch 3 not taken.
84 OS_ASSERT(ok);
888
2/2
✓ Branch 1 taken 84 times.
✓ Branch 4 taken 84 times.
84 ok = setEndUseSubcategory("General");
889
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✗ Branch 3 not taken.
84 OS_ASSERT(ok);
890 84 }
891
892 7991 IddObjectType FanSystemModel::iddObjectType() {
893
1/1
✓ Branch 1 taken 7991 times.
7991 return {IddObjectType::OS_Fan_SystemModel};
894 }
895
896 ✗ std::vector<std::string> FanSystemModel::speedControlMethodValues() {
897 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Fan_SystemModelFields::SpeedControlMethod);
898 }
899
900 ✗ std::vector<std::string> FanSystemModel::designPowerSizingMethodValues() {
901 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Fan_SystemModelFields::DesignPowerSizingMethod);
902 }
903
904 22 Schedule FanSystemModel::availabilitySchedule() const {
905
1/1
✓ Branch 3 taken 22 times.
22 return getImpl<detail::FanSystemModel_Impl>()->availabilitySchedule();
906 }
907
908 23 boost::optional<double> FanSystemModel::designMaximumAirFlowRate() const {
909
1/1
✓ Branch 3 taken 23 times.
23 return getImpl<detail::FanSystemModel_Impl>()->designMaximumAirFlowRate();
910 }
911
912 4 bool FanSystemModel::isDesignMaximumAirFlowRateAutosized() const {
913
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::FanSystemModel_Impl>()->isDesignMaximumAirFlowRateAutosized();
914 }
915
916 ✗ boost::optional<double> FanSystemModel::autosizedDesignMaximumAirFlowRate() {
917 ✗ return getImpl<detail::FanSystemModel_Impl>()->autosizedDesignMaximumAirFlowRate();
918 }
919
920 23 std::string FanSystemModel::speedControlMethod() const {
921
1/1
✓ Branch 3 taken 23 times.
23 return getImpl<detail::FanSystemModel_Impl>()->speedControlMethod();
922 }
923
924 21 double FanSystemModel::electricPowerMinimumFlowRateFraction() const {
925
1/1
✓ Branch 3 taken 21 times.
21 return getImpl<detail::FanSystemModel_Impl>()->electricPowerMinimumFlowRateFraction();
926 }
927
928 23 double FanSystemModel::designPressureRise() const {
929
1/1
✓ Branch 3 taken 23 times.
23 return getImpl<detail::FanSystemModel_Impl>()->designPressureRise();
930 }
931
932 21 double FanSystemModel::motorEfficiency() const {
933
1/1
✓ Branch 3 taken 21 times.
21 return getImpl<detail::FanSystemModel_Impl>()->motorEfficiency();
934 }
935
936 21 double FanSystemModel::motorInAirStreamFraction() const {
937
1/1
✓ Branch 3 taken 21 times.
21 return getImpl<detail::FanSystemModel_Impl>()->motorInAirStreamFraction();
938 }
939
940 21 boost::optional<double> FanSystemModel::designElectricPowerConsumption() const {
941
1/1
✓ Branch 3 taken 21 times.
21 return getImpl<detail::FanSystemModel_Impl>()->designElectricPowerConsumption();
942 }
943
944 4 bool FanSystemModel::isDesignElectricPowerConsumptionAutosized() const {
945
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::FanSystemModel_Impl>()->isDesignElectricPowerConsumptionAutosized();
946 }
947
948 ✗ boost::optional<double> FanSystemModel::autosizedDesignElectricPowerConsumption() {
949 ✗ return getImpl<detail::FanSystemModel_Impl>()->autosizedDesignElectricPowerConsumption();
950 }
951
952 22 std::string FanSystemModel::designPowerSizingMethod() const {
953
1/1
✓ Branch 3 taken 22 times.
22 return getImpl<detail::FanSystemModel_Impl>()->designPowerSizingMethod();
954 }
955
956 21 double FanSystemModel::electricPowerPerUnitFlowRate() const {
957
1/1
✓ Branch 3 taken 21 times.
21 return getImpl<detail::FanSystemModel_Impl>()->electricPowerPerUnitFlowRate();
958 }
959
960 21 double FanSystemModel::electricPowerPerUnitFlowRatePerUnitPressure() const {
961
1/1
✓ Branch 3 taken 21 times.
21 return getImpl<detail::FanSystemModel_Impl>()->electricPowerPerUnitFlowRatePerUnitPressure();
962 }
963
964 24 double FanSystemModel::fanTotalEfficiency() const {
965
1/1
✓ Branch 3 taken 24 times.
24 return getImpl<detail::FanSystemModel_Impl>()->fanTotalEfficiency();
966 }
967
968 30 boost::optional<Curve> FanSystemModel::electricPowerFunctionofFlowFractionCurve() const {
969
1/1
✓ Branch 3 taken 30 times.
30 return getImpl<detail::FanSystemModel_Impl>()->electricPowerFunctionofFlowFractionCurve();
970 }
971
972 22 boost::optional<double> FanSystemModel::nightVentilationModePressureRise() const {
973
1/1
✓ Branch 3 taken 22 times.
22 return getImpl<detail::FanSystemModel_Impl>()->nightVentilationModePressureRise();
974 }
975
976 22 boost::optional<double> FanSystemModel::nightVentilationModeFlowFraction() const {
977
1/1
✓ Branch 3 taken 22 times.
22 return getImpl<detail::FanSystemModel_Impl>()->nightVentilationModeFlowFraction();
978 }
979
980 22 boost::optional<ThermalZone> FanSystemModel::motorLossZone() const {
981
1/1
✓ Branch 3 taken 22 times.
22 return getImpl<detail::FanSystemModel_Impl>()->motorLossZone();
982 }
983
984 22 double FanSystemModel::motorLossRadiativeFraction() const {
985
1/1
✓ Branch 3 taken 22 times.
22 return getImpl<detail::FanSystemModel_Impl>()->motorLossRadiativeFraction();
986 }
987
988 20 std::string FanSystemModel::endUseSubcategory() const {
989
1/1
✓ Branch 3 taken 20 times.
20 return getImpl<detail::FanSystemModel_Impl>()->endUseSubcategory();
990 }
991
992 102 bool FanSystemModel::setAvailabilitySchedule(Schedule& schedule) {
993
1/1
✓ Branch 3 taken 102 times.
102 return getImpl<detail::FanSystemModel_Impl>()->setAvailabilitySchedule(schedule);
994 }
995
996 4 bool FanSystemModel::setDesignMaximumAirFlowRate(double designMaximumAirFlowRate) {
997
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::FanSystemModel_Impl>()->setDesignMaximumAirFlowRate(designMaximumAirFlowRate);
998 }
999
1000 99 void FanSystemModel::autosizeDesignMaximumAirFlowRate() {
1001
1/1
✓ Branch 3 taken 99 times.
99 getImpl<detail::FanSystemModel_Impl>()->autosizeDesignMaximumAirFlowRate();
1002 99 }
1003
1004 102 bool FanSystemModel::setSpeedControlMethod(const std::string& speedControlMethod) {
1005
1/1
✓ Branch 3 taken 102 times.
102 return getImpl<detail::FanSystemModel_Impl>()->setSpeedControlMethod(speedControlMethod);
1006 }
1007
1008 100 bool FanSystemModel::setElectricPowerMinimumFlowRateFraction(double electricPowerMinimumFlowRateFraction) {
1009
1/1
✓ Branch 3 taken 100 times.
100 return getImpl<detail::FanSystemModel_Impl>()->setElectricPowerMinimumFlowRateFraction(electricPowerMinimumFlowRateFraction);
1010 }
1011
1012 102 bool FanSystemModel::setDesignPressureRise(double designPressureRise) {
1013
1/1
✓ Branch 3 taken 102 times.
102 return getImpl<detail::FanSystemModel_Impl>()->setDesignPressureRise(designPressureRise);
1014 }
1015
1016 100 bool FanSystemModel::setMotorEfficiency(double motorEfficiency) {
1017
1/1
✓ Branch 3 taken 100 times.
100 return getImpl<detail::FanSystemModel_Impl>()->setMotorEfficiency(motorEfficiency);
1018 }
1019
1020 100 bool FanSystemModel::setMotorInAirStreamFraction(double motorInAirStreamFraction) {
1021
1/1
✓ Branch 3 taken 100 times.
100 return getImpl<detail::FanSystemModel_Impl>()->setMotorInAirStreamFraction(motorInAirStreamFraction);
1022 }
1023
1024 2 bool FanSystemModel::setDesignElectricPowerConsumption(double designElectricPowerConsumption) {
1025
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FanSystemModel_Impl>()->setDesignElectricPowerConsumption(designElectricPowerConsumption);
1026 }
1027
1028 99 void FanSystemModel::autosizeDesignElectricPowerConsumption() {
1029
1/1
✓ Branch 3 taken 99 times.
99 getImpl<detail::FanSystemModel_Impl>()->autosizeDesignElectricPowerConsumption();
1030 99 }
1031
1032 103 bool FanSystemModel::setDesignPowerSizingMethod(const std::string& designPowerSizingMethod) {
1033
1/1
✓ Branch 3 taken 103 times.
103 return getImpl<detail::FanSystemModel_Impl>()->setDesignPowerSizingMethod(designPowerSizingMethod);
1034 }
1035
1036 86 bool FanSystemModel::setElectricPowerPerUnitFlowRate(double electricPowerPerUnitFlowRate) {
1037
1/1
✓ Branch 3 taken 86 times.
86 return getImpl<detail::FanSystemModel_Impl>()->setElectricPowerPerUnitFlowRate(electricPowerPerUnitFlowRate);
1038 }
1039
1040 86 bool FanSystemModel::setElectricPowerPerUnitFlowRatePerUnitPressure(double electricPowerPerUnitFlowRatePerUnitPressure) {
1041
1/1
✓ Branch 3 taken 86 times.
86 return getImpl<detail::FanSystemModel_Impl>()->setElectricPowerPerUnitFlowRatePerUnitPressure(electricPowerPerUnitFlowRatePerUnitPressure);
1042 }
1043
1044 102 bool FanSystemModel::setFanTotalEfficiency(double fanTotalEfficiency) {
1045
1/1
✓ Branch 3 taken 102 times.
102 return getImpl<detail::FanSystemModel_Impl>()->setFanTotalEfficiency(fanTotalEfficiency);
1046 }
1047
1048 13 bool FanSystemModel::setElectricPowerFunctionofFlowFractionCurve(const Curve& curve) {
1049
1/1
✓ Branch 3 taken 13 times.
13 return getImpl<detail::FanSystemModel_Impl>()->setElectricPowerFunctionofFlowFractionCurve(curve);
1050 }
1051
1052 1 void FanSystemModel::resetElectricPowerFunctionofFlowFractionCurve() {
1053
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::FanSystemModel_Impl>()->resetElectricPowerFunctionofFlowFractionCurve();
1054 1 }
1055
1056 2 bool FanSystemModel::setNightVentilationModePressureRise(double nightVentilationModePressureRise) {
1057
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FanSystemModel_Impl>()->setNightVentilationModePressureRise(nightVentilationModePressureRise);
1058 }
1059
1060 ✗ void FanSystemModel::resetNightVentilationModePressureRise() {
1061 ✗ getImpl<detail::FanSystemModel_Impl>()->resetNightVentilationModePressureRise();
1062 ✗ }
1063
1064 2 bool FanSystemModel::setNightVentilationModeFlowFraction(double nightVentilationModeFlowFraction) {
1065
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FanSystemModel_Impl>()->setNightVentilationModeFlowFraction(nightVentilationModeFlowFraction);
1066 }
1067
1068 ✗ void FanSystemModel::resetNightVentilationModeFlowFraction() {
1069 ✗ getImpl<detail::FanSystemModel_Impl>()->resetNightVentilationModeFlowFraction();
1070 ✗ }
1071
1072 2 bool FanSystemModel::setMotorLossZone(const ThermalZone& thermalZone) {
1073
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FanSystemModel_Impl>()->setMotorLossZone(thermalZone);
1074 }
1075
1076 ✗ void FanSystemModel::resetMotorLossZone() {
1077 ✗ getImpl<detail::FanSystemModel_Impl>()->resetMotorLossZone();
1078 ✗ }
1079
1080 87 bool FanSystemModel::setMotorLossRadiativeFraction(double motorLossRadiativeFraction) {
1081
1/1
✓ Branch 3 taken 87 times.
87 return getImpl<detail::FanSystemModel_Impl>()->setMotorLossRadiativeFraction(motorLossRadiativeFraction);
1082 }
1083
1084 100 bool FanSystemModel::setEndUseSubcategory(const std::string& endUseSubcategory) {
1085
1/1
✓ Branch 3 taken 100 times.
100 return getImpl<detail::FanSystemModel_Impl>()->setEndUseSubcategory(endUseSubcategory);
1086 }
1087
1088 //bool FanSystemModel::setNumberofSpeeds(int numberofSpeeds) {
1089 //return getImpl<detail::FanSystemModel_Impl>()->setNumberofSpeeds(numberofSpeeds);
1090 //}
1091
1092 36 unsigned FanSystemModel::numberofSpeeds() const {
1093
1/1
✓ Branch 3 taken 36 times.
36 return getImpl<detail::FanSystemModel_Impl>()->numberofSpeeds();
1094 }
1095
1096 29 std::vector<FanSystemModelSpeed> FanSystemModel::speeds() const {
1097
1/1
✓ Branch 3 taken 29 times.
29 return getImpl<detail::FanSystemModel_Impl>()->speeds();
1098 }
1099
1100 ✗ boost::optional<unsigned> FanSystemModel::speedIndex(const FanSystemModelSpeed& speed) const {
1101 ✗ return getImpl<detail::FanSystemModel_Impl>()->speedIndex(speed);
1102 }
1103
1104 ✗ boost::optional<FanSystemModelSpeed> FanSystemModel::getSpeed(unsigned speedIndex) const {
1105 ✗ return getImpl<detail::FanSystemModel_Impl>()->getSpeed(speedIndex);
1106 }
1107
1108 2 bool FanSystemModel::addSpeed(const FanSystemModelSpeed& speed) {
1109
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FanSystemModel_Impl>()->addSpeed(speed);
1110 }
1111
1112 // Overloads, it creates a FanSystemModelSpeed wrapper, then call `addSpeed(const FanSystemModelSpeed&)`
1113 2 bool FanSystemModel::addSpeed(double flowFraction) {
1114
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FanSystemModel_Impl>()->addSpeed(flowFraction);
1115 }
1116
1117 2 bool FanSystemModel::addSpeed(double flowFraction, double electricPowerFraction) {
1118
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FanSystemModel_Impl>()->addSpeed(flowFraction, electricPowerFraction);
1119 }
1120
1121 2 bool FanSystemModel::removeSpeed(unsigned speedIndex) {
1122
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::FanSystemModel_Impl>()->removeSpeed(speedIndex);
1123 }
1124
1125 2 void FanSystemModel::removeAllSpeeds() {
1126
1/1
✓ Branch 3 taken 2 times.
2 getImpl<detail::FanSystemModel_Impl>()->removeAllSpeeds();
1127 2 }
1128
1129 9 bool FanSystemModel::setSpeeds(const std::vector<FanSystemModelSpeed>& speeds) {
1130
1/1
✓ Branch 3 taken 9 times.
9 return getImpl<detail::FanSystemModel_Impl>()->setSpeeds(speeds);
1131 }
1132
1133 ✗ AirflowNetworkFan FanSystemModel::getAirflowNetworkFan() {
1134 ✗ return getImpl<detail::FanSystemModel_Impl>()->getAirflowNetworkFan();
1135 }
1136
1137 ✗ boost::optional<AirflowNetworkFan> FanSystemModel::airflowNetworkFan() const {
1138 ✗ return getImpl<detail::FanSystemModel_Impl>()->airflowNetworkFan();
1139 }
1140
1141 /// @cond
1142
1/1
✓ Branch 2 taken 51 times.
51 FanSystemModel::FanSystemModel(std::shared_ptr<detail::FanSystemModel_Impl> impl) : StraightComponent(impl) {}
1143 /// @endcond
1144
1145 } // namespace model
1146 } // namespace openstudio
1147