GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 84.9% 259 / 0 / 305
Functions: 90.8% 79 / 0 / 87
Branches: 49.3% 214 / 0 / 434

src/model/SwimmingPoolIndoor.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 "SwimmingPoolIndoor.hpp"
7 #include "SwimmingPoolIndoor_Impl.hpp"
8
9 #include "Model.hpp"
10 #include "Model_Impl.hpp"
11 #include "Surface.hpp"
12 #include "Surface_Impl.hpp"
13 #include "Schedule.hpp"
14 #include "Schedule_Impl.hpp"
15 #include "Node.hpp"
16 #include "Node_Impl.hpp"
17 #include "PlantLoop.hpp"
18 #include "PlantLoop_Impl.hpp"
19 #include "ScheduleRuleset.hpp"
20 #include "ScheduleTypeLimits.hpp"
21 #include "ScheduleTypeRegistry.hpp"
22
23 #include "../utilities/core/Assert.hpp"
24 #include "../utilities/data/DataEnums.hpp"
25
26 #include <utilities/idd/IddEnums.hxx>
27 #include <utilities/idd/OS_SwimmingPool_Indoor_FieldEnums.hxx>
28
29 namespace openstudio {
30 namespace model {
31
32 namespace detail {
33
34 4 SwimmingPoolIndoor_Impl::SwimmingPoolIndoor_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
35 4 : StraightComponent_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() == SwimmingPoolIndoor::iddObjectType());
37 4 }
38
39 ✗ SwimmingPoolIndoor_Impl::SwimmingPoolIndoor_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
40 ✗ : StraightComponent_Impl(other, model, keepHandle) {
41 ✗ OS_ASSERT(other.iddObject().type() == SwimmingPoolIndoor::iddObjectType());
42 ✗ }
43
44 4 SwimmingPoolIndoor_Impl::SwimmingPoolIndoor_Impl(const SwimmingPoolIndoor_Impl& other, Model_Impl* model, bool keepHandle)
45 4 : StraightComponent_Impl(other, model, keepHandle) {}
46
47 ✗ const std::vector<std::string>& SwimmingPoolIndoor_Impl::outputVariableNames() const {
48 static std::vector<std::string> result{"Indoor Pool Makeup Water Rate",
49 "Indoor Pool Makeup Water Volume",
50 "Indoor Pool Makeup Water Temperature",
51 "Indoor Pool Water Temperature",
52 "Indoor Pool Inlet Water Temperature",
53 "Indoor Pool Inlet Water Mass Flow Rate",
54 "Indoor Pool Miscellaneous Equipment Power",
55 "Indoor Pool Miscellaneous Equipment Energy",
56 "Indoor Pool Water Heating Rate",
57 "Indoor Pool Water Heating Energy",
58 "Indoor Pool Radiant to Convection by Cover",
59 "Indoor Pool People Heat Gain",
60 "Indoor Pool Current Activity Factor",
61 "Indoor Pool Current Cover Factor",
62 "Indoor Pool Saturation Pressure at Pool Temperature",
63 "Indoor Pool Partial Pressure of Water Vapor in Air",
64 "Indoor Pool Current Cover Evaporation Factor",
65 "Indoor Pool Current Cover Convective Factor",
66 "Indoor Pool Current Cover SW Radiation Factor",
67 "Indoor Pool Current Cover LW Radiation Factor",
68 "Indoor Pool Evaporative Heat Loss Rate",
69 ✗ "Indoor Pool Evaporative Heat Loss Energy"};
70 ✗ return result;
71 ✗ }
72
73 ✗ IddObjectType SwimmingPoolIndoor_Impl::iddObjectType() const {
74 ✗ return SwimmingPoolIndoor::iddObjectType();
75 }
76
77 ✗ std::vector<ScheduleTypeKey> SwimmingPoolIndoor_Impl::getScheduleTypeKeys(const Schedule& schedule) const {
78 ✗ std::vector<ScheduleTypeKey> result;
79 ✗ UnsignedVector fieldIndices = getSourceIndices(schedule.handle());
80 ✗ UnsignedVector::const_iterator b(fieldIndices.begin());
81 ✗ UnsignedVector::const_iterator e(fieldIndices.end());
82 ✗ if (std::find(b, e, OS_SwimmingPool_IndoorFields::ActivityFactorScheduleName) != e) {
83 ✗ result.push_back(ScheduleTypeKey("SwimmingPoolIndoor", "Activity Factor"));
84 }
85 ✗ if (std::find(b, e, OS_SwimmingPool_IndoorFields::MakeupWaterSupplyScheduleName) != e) {
86 ✗ result.push_back(ScheduleTypeKey("SwimmingPoolIndoor", "Make-up Water Supply"));
87 }
88 ✗ if (std::find(b, e, OS_SwimmingPool_IndoorFields::CoverScheduleName) != e) {
89 ✗ result.push_back(ScheduleTypeKey("SwimmingPoolIndoor", "Cover"));
90 }
91 ✗ if (std::find(b, e, OS_SwimmingPool_IndoorFields::SetpointTemperatureSchedule) != e) {
92 ✗ result.push_back(ScheduleTypeKey("SwimmingPoolIndoor", "Setpoint Temperature Schedule"));
93 }
94 ✗ if (std::find(b, e, OS_SwimmingPool_IndoorFields::PeopleSchedule) != e) {
95 ✗ result.push_back(ScheduleTypeKey("SwimmingPoolIndoor", "People Schedule"));
96 }
97 ✗ if (std::find(b, e, OS_SwimmingPool_IndoorFields::PeopleHeatGainSchedule) != e) {
98 ✗ result.push_back(ScheduleTypeKey("SwimmingPoolIndoor", "People Heat Gain Schedule"));
99 }
100 ✗ return result;
101 ✗ }
102
103 16 unsigned SwimmingPoolIndoor_Impl::inletPort() const {
104 16 return OS_SwimmingPool_IndoorFields::PoolWaterInletNode;
105 }
106
107 26 unsigned SwimmingPoolIndoor_Impl::outletPort() const {
108 26 return OS_SwimmingPool_IndoorFields::PoolWaterOutletNode;
109 }
110
111 6 bool SwimmingPoolIndoor_Impl::addToNode(Node& node) {
112
3/3
✓ Branch 1 taken 6 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 2 times.
12 if (boost::optional<PlantLoop> plant = node.plantLoop()) {
113
5/5
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 3 times.
✓ Branch 11 taken 1 time.
8 if (plant->demandComponent(node.handle())) {
114
1/1
✓ Branch 1 taken 3 times.
3 return StraightComponent_Impl::addToNode(node);
115 }
116 6 }
117
118 3 return false;
119 }
120
121 3 Surface SwimmingPoolIndoor_Impl::surface() const {
122
1/1
✓ Branch 1 taken 3 times.
3 boost::optional<Surface> value = optionalSurface();
123
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
3 if (!value) {
124 ✗ LOG_AND_THROW(briefDescription() << " does not have an Surface attached.");
125 }
126
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
6 return value.get();
127 3 }
128
129 3 double SwimmingPoolIndoor_Impl::averageDepth() const {
130
1/1
✓ Branch 1 taken 3 times.
3 boost::optional<double> value = getDouble(OS_SwimmingPool_IndoorFields::AverageDepth, true);
131
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
3 OS_ASSERT(value);
132
1/1
✓ Branch 1 taken 3 times.
6 return value.get();
133 }
134
135 3 Schedule SwimmingPoolIndoor_Impl::activityFactorSchedule() const {
136
1/1
✓ Branch 1 taken 3 times.
3 boost::optional<Schedule> value = optionalActivityFactorSchedule();
137
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
3 if (!value) {
138 ✗ LOG_AND_THROW(briefDescription() << " does not have an Activity Factor Schedule attached.");
139 }
140
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
6 return value.get();
141 3 }
142
143 3 Schedule SwimmingPoolIndoor_Impl::makeupWaterSupplySchedule() const {
144
1/1
✓ Branch 1 taken 3 times.
3 boost::optional<Schedule> value = optionalMakeupWaterSupplySchedule();
145
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
3 if (!value) {
146 ✗ LOG_AND_THROW(briefDescription() << " does not have an Makeup Water Supply Schedule attached.");
147 }
148
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
6 return value.get();
149 3 }
150
151 3 Schedule SwimmingPoolIndoor_Impl::coverSchedule() const {
152
1/1
✓ Branch 1 taken 3 times.
3 boost::optional<Schedule> value = optionalCoverSchedule();
153
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
3 if (!value) {
154 ✗ LOG_AND_THROW(briefDescription() << " does not have an Cover Schedule attached.");
155 }
156
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
6 return value.get();
157 3 }
158
159 4 double SwimmingPoolIndoor_Impl::coverEvaporationFactor() const {
160
1/1
✓ Branch 1 taken 4 times.
4 boost::optional<double> value = getDouble(OS_SwimmingPool_IndoorFields::CoverEvaporationFactor, true);
161
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
4 OS_ASSERT(value);
162
1/1
✓ Branch 1 taken 4 times.
8 return value.get();
163 }
164
165 4 double SwimmingPoolIndoor_Impl::coverConvectionFactor() const {
166
1/1
✓ Branch 1 taken 4 times.
4 boost::optional<double> value = getDouble(OS_SwimmingPool_IndoorFields::CoverConvectionFactor, true);
167
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
4 OS_ASSERT(value);
168
1/1
✓ Branch 1 taken 4 times.
8 return value.get();
169 }
170
171 4 double SwimmingPoolIndoor_Impl::coverShortWavelengthRadiationFactor() const {
172
1/1
✓ Branch 1 taken 4 times.
4 boost::optional<double> value = getDouble(OS_SwimmingPool_IndoorFields::CoverShortWavelengthRadiationFactor, true);
173
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
4 OS_ASSERT(value);
174
1/1
✓ Branch 1 taken 4 times.
8 return value.get();
175 }
176
177 4 double SwimmingPoolIndoor_Impl::coverLongWavelengthRadiationFactor() const {
178
1/1
✓ Branch 1 taken 4 times.
4 boost::optional<double> value = getDouble(OS_SwimmingPool_IndoorFields::CoverLongWavelengthRadiationFactor, true);
179
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
4 OS_ASSERT(value);
180
1/1
✓ Branch 1 taken 4 times.
8 return value.get();
181 }
182
183 4 double SwimmingPoolIndoor_Impl::poolHeatingSystemMaximumWaterFlowRate() const {
184
1/1
✓ Branch 1 taken 4 times.
4 boost::optional<double> value = getDouble(OS_SwimmingPool_IndoorFields::PoolHeatingSystemMaximumWaterFlowRate, true);
185
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
4 OS_ASSERT(value);
186
1/1
✓ Branch 1 taken 4 times.
8 return value.get();
187 }
188
189 4 double SwimmingPoolIndoor_Impl::poolMiscellaneousEquipmentPower() const {
190
1/1
✓ Branch 1 taken 4 times.
4 boost::optional<double> value = getDouble(OS_SwimmingPool_IndoorFields::PoolMiscellaneousEquipmentPower, true);
191
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
4 OS_ASSERT(value);
192
1/1
✓ Branch 1 taken 4 times.
8 return value.get();
193 }
194
195 3 Schedule SwimmingPoolIndoor_Impl::setpointTemperatureSchedule() const {
196
1/1
✓ Branch 1 taken 3 times.
3 boost::optional<Schedule> value = optionalSetpointTemperatureSchedule();
197
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
3 if (!value) {
198 ✗ LOG_AND_THROW(briefDescription() << " does not have an Setpoint Temperature Schedule attached.");
199 }
200
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
6 return value.get();
201 3 }
202
203 4 double SwimmingPoolIndoor_Impl::maximumNumberofPeople() const {
204
1/1
✓ Branch 1 taken 4 times.
4 boost::optional<double> value = getDouble(OS_SwimmingPool_IndoorFields::MaximumNumberofPeople, true);
205
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
4 OS_ASSERT(value);
206
1/1
✓ Branch 1 taken 4 times.
8 return value.get();
207 }
208
209 3 Schedule SwimmingPoolIndoor_Impl::peopleSchedule() const {
210
1/1
✓ Branch 1 taken 3 times.
3 boost::optional<Schedule> value = optionalPeopleSchedule();
211
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
3 if (!value) {
212 ✗ LOG_AND_THROW(briefDescription() << " does not have an People Schedule attached.");
213 }
214
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
6 return value.get();
215 3 }
216
217 3 Schedule SwimmingPoolIndoor_Impl::peopleHeatGainSchedule() const {
218
1/1
✓ Branch 1 taken 3 times.
3 boost::optional<Schedule> value = optionalPeopleHeatGainSchedule();
219
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
3 if (!value) {
220 ✗ LOG_AND_THROW(briefDescription() << " does not have an People Heat Gain Schedule attached.");
221 }
222
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
6 return value.get();
223 3 }
224
225 6 bool SwimmingPoolIndoor_Impl::setSurface(const Surface& floorSurface) {
226
5/5
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 11 taken 2 times.
✓ Branch 12 taken 4 times.
12 if (!openstudio::istringEqual(floorSurface.surfaceType(), "Floor")) {
227
14/14
✓ 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 22 taken 2 times.
✓ Branch 25 taken 2 times.
✓ Branch 28 taken 2 times.
✓ Branch 31 taken 2 times.
✓ Branch 37 taken 2 times.
✓ Branch 40 taken 2 times.
✓ Branch 43 taken 2 times.
2 LOG(Error, "Only surfaceTypes of 'Floor' accepted: Unable to set " << briefDescription() << "'s Surface to "
228 << floorSurface.briefDescription() << " which has a surface Type of '"
229 << floorSurface.surfaceType() << "'.");
230 2 return false;
231 }
232
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 bool result = setPointer(OS_SwimmingPool_IndoorFields::SurfaceName, floorSurface.handle());
233 4 return result;
234 }
235
236 5 bool SwimmingPoolIndoor_Impl::setAverageDepth(double averageDepth) {
237 5 bool result = setDouble(OS_SwimmingPool_IndoorFields::AverageDepth, averageDepth);
238 5 return result;
239 }
240
241 5 bool SwimmingPoolIndoor_Impl::setActivityFactorSchedule(Schedule& schedule) {
242
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
20 bool result = setSchedule(OS_SwimmingPool_IndoorFields::ActivityFactorScheduleName, "SwimmingPoolIndoor", "Activity Factor", schedule);
243 5 return result;
244 }
245
246 5 bool SwimmingPoolIndoor_Impl::setMakeupWaterSupplySchedule(Schedule& schedule) {
247
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
20 bool result = setSchedule(OS_SwimmingPool_IndoorFields::MakeupWaterSupplyScheduleName, "SwimmingPoolIndoor", "Make-up Water Supply", schedule);
248 5 return result;
249 }
250
251 5 bool SwimmingPoolIndoor_Impl::setCoverSchedule(Schedule& schedule) {
252
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
20 bool result = setSchedule(OS_SwimmingPool_IndoorFields::CoverScheduleName, "SwimmingPoolIndoor", "Cover", schedule);
253 5 return result;
254 }
255
256 6 bool SwimmingPoolIndoor_Impl::setCoverEvaporationFactor(double coverEvaporationFactor) {
257 6 bool result = setDouble(OS_SwimmingPool_IndoorFields::CoverEvaporationFactor, coverEvaporationFactor);
258 6 return result;
259 }
260
261 6 bool SwimmingPoolIndoor_Impl::setCoverConvectionFactor(double coverConvectionFactor) {
262 6 bool result = setDouble(OS_SwimmingPool_IndoorFields::CoverConvectionFactor, coverConvectionFactor);
263 6 return result;
264 }
265
266 6 bool SwimmingPoolIndoor_Impl::setCoverShortWavelengthRadiationFactor(double coverShortWavelengthRadiationFactor) {
267 6 bool result = setDouble(OS_SwimmingPool_IndoorFields::CoverShortWavelengthRadiationFactor, coverShortWavelengthRadiationFactor);
268 6 return result;
269 }
270
271 6 bool SwimmingPoolIndoor_Impl::setCoverLongWavelengthRadiationFactor(double coverLongWavelengthRadiationFactor) {
272 6 bool result = setDouble(OS_SwimmingPool_IndoorFields::CoverLongWavelengthRadiationFactor, coverLongWavelengthRadiationFactor);
273 6 return result;
274 }
275
276 6 bool SwimmingPoolIndoor_Impl::setPoolHeatingSystemMaximumWaterFlowRate(double poolHeatingSystemMaximumWaterFlowRate) {
277 6 bool result = setDouble(OS_SwimmingPool_IndoorFields::PoolHeatingSystemMaximumWaterFlowRate, poolHeatingSystemMaximumWaterFlowRate);
278 6 return result;
279 }
280
281 6 bool SwimmingPoolIndoor_Impl::setPoolMiscellaneousEquipmentPower(double poolMiscellaneousEquipmentPower) {
282 6 bool result = setDouble(OS_SwimmingPool_IndoorFields::PoolMiscellaneousEquipmentPower, poolMiscellaneousEquipmentPower);
283 6 return result;
284 }
285
286 5 bool SwimmingPoolIndoor_Impl::setSetpointTemperatureSchedule(Schedule& schedule) {
287 bool result =
288
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
20 setSchedule(OS_SwimmingPool_IndoorFields::SetpointTemperatureSchedule, "SwimmingPoolIndoor", "Setpoint Temperature Schedule", schedule);
289 5 return result;
290 }
291
292 6 bool SwimmingPoolIndoor_Impl::setMaximumNumberofPeople(double maximumNumberofPeople) {
293 6 bool result = setDouble(OS_SwimmingPool_IndoorFields::MaximumNumberofPeople, maximumNumberofPeople);
294 6 return result;
295 }
296
297 5 bool SwimmingPoolIndoor_Impl::setPeopleSchedule(Schedule& schedule) {
298
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
20 bool result = setSchedule(OS_SwimmingPool_IndoorFields::PeopleSchedule, "SwimmingPoolIndoor", "People Schedule", schedule);
299 5 return result;
300 }
301
302 5 bool SwimmingPoolIndoor_Impl::setPeopleHeatGainSchedule(Schedule& schedule) {
303
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
20 bool result = setSchedule(OS_SwimmingPool_IndoorFields::PeopleHeatGainSchedule, "SwimmingPoolIndoor", "People Heat Gain Schedule", schedule);
304 5 return result;
305 }
306
307 3 boost::optional<Surface> SwimmingPoolIndoor_Impl::optionalSurface() const {
308
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 return getObject<ModelObject>().getModelObjectTarget<Surface>(OS_SwimmingPool_IndoorFields::SurfaceName);
309 }
310
311 3 boost::optional<Schedule> SwimmingPoolIndoor_Impl::optionalActivityFactorSchedule() const {
312
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_SwimmingPool_IndoorFields::ActivityFactorScheduleName);
313 }
314
315 3 boost::optional<Schedule> SwimmingPoolIndoor_Impl::optionalMakeupWaterSupplySchedule() const {
316
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_SwimmingPool_IndoorFields::MakeupWaterSupplyScheduleName);
317 }
318
319 3 boost::optional<Schedule> SwimmingPoolIndoor_Impl::optionalCoverSchedule() const {
320
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_SwimmingPool_IndoorFields::CoverScheduleName);
321 }
322
323 3 boost::optional<Schedule> SwimmingPoolIndoor_Impl::optionalSetpointTemperatureSchedule() const {
324
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_SwimmingPool_IndoorFields::SetpointTemperatureSchedule);
325 }
326
327 3 boost::optional<Schedule> SwimmingPoolIndoor_Impl::optionalPeopleSchedule() const {
328
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_SwimmingPool_IndoorFields::PeopleSchedule);
329 }
330
331 3 boost::optional<Schedule> SwimmingPoolIndoor_Impl::optionalPeopleHeatGainSchedule() const {
332
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_SwimmingPool_IndoorFields::PeopleHeatGainSchedule);
333 }
334
335 // convenience
336 8 boost::optional<Node> SwimmingPoolIndoor_Impl::poolWaterInletNode() const {
337 8 boost::optional<Node> result;
338
339
3/3
✓ Branch 1 taken 8 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 3 times.
16 if (auto mo = inletModelObject()) {
340
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 result = mo->optionalCast<Node>();
341 8 }
342 8 return result;
343 ✗ }
344
345 8 boost::optional<Node> SwimmingPoolIndoor_Impl::poolWaterOutletNode() const {
346 8 boost::optional<Node> result;
347
348
3/3
✓ Branch 1 taken 8 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 3 times.
16 if (auto mo = outletModelObject()) {
349
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 result = mo->optionalCast<Node>();
350 8 }
351 8 return result;
352 ✗ }
353
354 ✗ ComponentType SwimmingPoolIndoor_Impl::componentType() const {
355 ✗ return ComponentType::None;
356 }
357
358 ✗ std::vector<FuelType> SwimmingPoolIndoor_Impl::coolingFuelTypes() const {
359 ✗ return {};
360 }
361
362 ✗ std::vector<FuelType> SwimmingPoolIndoor_Impl::heatingFuelTypes() const {
363 ✗ return {};
364 }
365
366 ✗ std::vector<AppGFuelType> SwimmingPoolIndoor_Impl::appGHeatingFuelTypes() const {
367 ✗ return {};
368 }
369
370 } // namespace detail
371
372 4 SwimmingPoolIndoor::SwimmingPoolIndoor(const Model& model, const Surface& floorSurface)
373 4 : StraightComponent(SwimmingPoolIndoor::iddObjectType(), model) {
374
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 5 not taken.
4 OS_ASSERT(getImpl<detail::SwimmingPoolIndoor_Impl>());
375
376 // Appropriately handle the following required object-list fields.
377 // OS_SwimmingPool_IndoorFields::SurfaceName
378 // OS_SwimmingPool_IndoorFields::ActivityFactorScheduleName
379 // OS_SwimmingPool_IndoorFields::MakeupWaterSupplyScheduleName
380 // OS_SwimmingPool_IndoorFields::CoverScheduleName
381 // OS_SwimmingPool_IndoorFields::PoolWaterInletNode
382 // OS_SwimmingPool_IndoorFields::PoolWaterOutletNode
383 // OS_SwimmingPool_IndoorFields::SetpointTemperatureSchedule
384 // OS_SwimmingPool_IndoorFields::PeopleSchedule
385 // OS_SwimmingPool_IndoorFields::PeopleHeatGainSchedule
386
387
1/1
✓ Branch 1 taken 4 times.
4 bool ok = setSurface(floorSurface);
388
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 3 times.
4 if (!ok) {
389
17/17
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 20 taken 1 time.
✓ Branch 26 taken 1 time.
✓ Branch 29 taken 1 time.
✓ Branch 32 taken 1 time.
✓ Branch 35 taken 1 time.
✓ Branch 38 taken 1 time.
✓ Branch 41 taken 1 time.
✓ Branch 44 taken 1 time.
✓ Branch 47 taken 1 time.
✓ Branch 52 taken 1 time.
✓ Branch 55 taken 1 time.
1 LOG_AND_THROW(floorSurface.briefDescription() << " is not a valid surface for a SwimmingPool:Indoor object");
390 }
391
392 // IDD Defaults
393
1/1
✓ Branch 1 taken 3 times.
3 setCoverEvaporationFactor(0.0);
394
1/1
✓ Branch 1 taken 3 times.
3 setCoverConvectionFactor(0.0);
395
1/1
✓ Branch 1 taken 3 times.
3 setCoverShortWavelengthRadiationFactor(0.0);
396
1/1
✓ Branch 1 taken 3 times.
3 setCoverLongWavelengthRadiationFactor(0.0);
397
398 // No IDD defaults
399
400 // It makes sense to assume zero
401
1/1
✓ Branch 1 taken 3 times.
3 setPoolMiscellaneousEquipmentPower(0.0);
402 // Abritrary depth of 2m...
403
1/1
✓ Branch 1 taken 3 times.
3 setAverageDepth(2.0);
404
405 // Assume pool is always uncovered
406
1/1
✓ Branch 1 taken 3 times.
3 auto alwaysOff = model.alwaysOffDiscreteSchedule();
407
1/1
✓ Branch 1 taken 3 times.
3 ok = setCoverSchedule(alwaysOff);
408
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
3 OS_ASSERT(ok);
409
410
1/1
✓ Branch 1 taken 3 times.
3 auto alwaysOn = model.alwaysOnDiscreteSchedule();
411
1/1
✓ Branch 1 taken 3 times.
3 ok = setPeopleSchedule(alwaysOn);
412
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
3 OS_ASSERT(ok);
413
414
1/1
✓ Branch 1 taken 3 times.
3 ok = setActivityFactorSchedule(alwaysOn);
415
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
3 OS_ASSERT(ok);
416
417 // These don't have defaults in the E+ IDD, and are hard to make sensible defaults for, so use numbers from 5ZoneSwimmingPool
418
1/1
✓ Branch 1 taken 3 times.
3 setPoolHeatingSystemMaximumWaterFlowRate(0.1);
419
1/1
✓ Branch 1 taken 3 times.
3 setMaximumNumberofPeople(15.0);
420
421 // 16.67? take as arg to Ctor?
422
1/1
✓ Branch 1 taken 3 times.
3 auto makeUpSch = ScheduleRuleset(model, 16.67);
423
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 makeUpSch.setName("Pool MakeUp Water Temperature Schedule");
424
1/1
✓ Branch 1 taken 3 times.
3 ok = setMakeupWaterSupplySchedule(makeUpSch);
425
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
3 OS_ASSERT(ok);
426
427 // Assume 300W? take as arg to Ctor?
428
1/1
✓ Branch 1 taken 3 times.
3 auto gainSch = ScheduleRuleset(model, 300.0);
429
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 gainSch.setName("Pool People Heat Gain Schedule");
430
1/1
✓ Branch 1 taken 3 times.
3 ok = setPeopleHeatGainSchedule(gainSch);
431
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
3 OS_ASSERT(ok);
432
433
1/1
✓ Branch 1 taken 3 times.
3 auto tempSch = ScheduleRuleset(model, 27.0);
434
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 tempSch.setName("Pool Setpoint Temperature Schedule");
435
1/1
✓ Branch 1 taken 3 times.
3 ok = setSetpointTemperatureSchedule(tempSch);
436
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
3 OS_ASSERT(ok);
437 4 }
438
439 7736 IddObjectType SwimmingPoolIndoor::iddObjectType() {
440
1/1
✓ Branch 1 taken 7736 times.
7736 return {IddObjectType::OS_SwimmingPool_Indoor};
441 }
442
443 3 Surface SwimmingPoolIndoor::surface() const {
444
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::SwimmingPoolIndoor_Impl>()->surface();
445 }
446
447 3 double SwimmingPoolIndoor::averageDepth() const {
448
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::SwimmingPoolIndoor_Impl>()->averageDepth();
449 }
450
451 3 Schedule SwimmingPoolIndoor::activityFactorSchedule() const {
452
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::SwimmingPoolIndoor_Impl>()->activityFactorSchedule();
453 }
454
455 3 Schedule SwimmingPoolIndoor::makeupWaterSupplySchedule() const {
456
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::SwimmingPoolIndoor_Impl>()->makeupWaterSupplySchedule();
457 }
458
459 3 Schedule SwimmingPoolIndoor::coverSchedule() const {
460
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::SwimmingPoolIndoor_Impl>()->coverSchedule();
461 }
462
463 4 double SwimmingPoolIndoor::coverEvaporationFactor() const {
464
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::SwimmingPoolIndoor_Impl>()->coverEvaporationFactor();
465 }
466
467 4 double SwimmingPoolIndoor::coverConvectionFactor() const {
468
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::SwimmingPoolIndoor_Impl>()->coverConvectionFactor();
469 }
470
471 4 double SwimmingPoolIndoor::coverShortWavelengthRadiationFactor() const {
472
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::SwimmingPoolIndoor_Impl>()->coverShortWavelengthRadiationFactor();
473 }
474
475 4 double SwimmingPoolIndoor::coverLongWavelengthRadiationFactor() const {
476
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::SwimmingPoolIndoor_Impl>()->coverLongWavelengthRadiationFactor();
477 }
478
479 4 double SwimmingPoolIndoor::poolHeatingSystemMaximumWaterFlowRate() const {
480
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::SwimmingPoolIndoor_Impl>()->poolHeatingSystemMaximumWaterFlowRate();
481 }
482
483 4 double SwimmingPoolIndoor::poolMiscellaneousEquipmentPower() const {
484
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::SwimmingPoolIndoor_Impl>()->poolMiscellaneousEquipmentPower();
485 }
486
487 3 Schedule SwimmingPoolIndoor::setpointTemperatureSchedule() const {
488
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setpointTemperatureSchedule();
489 }
490
491 4 double SwimmingPoolIndoor::maximumNumberofPeople() const {
492
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::SwimmingPoolIndoor_Impl>()->maximumNumberofPeople();
493 }
494
495 3 Schedule SwimmingPoolIndoor::peopleSchedule() const {
496
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::SwimmingPoolIndoor_Impl>()->peopleSchedule();
497 }
498
499 3 Schedule SwimmingPoolIndoor::peopleHeatGainSchedule() const {
500
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::SwimmingPoolIndoor_Impl>()->peopleHeatGainSchedule();
501 }
502
503 6 bool SwimmingPoolIndoor::setSurface(const Surface& floorSurface) {
504
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setSurface(floorSurface);
505 }
506
507 5 bool SwimmingPoolIndoor::setAverageDepth(double averageDepth) {
508
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setAverageDepth(averageDepth);
509 }
510
511 5 bool SwimmingPoolIndoor::setActivityFactorSchedule(Schedule& schedule) {
512
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setActivityFactorSchedule(schedule);
513 }
514
515 5 bool SwimmingPoolIndoor::setMakeupWaterSupplySchedule(Schedule& schedule) {
516
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setMakeupWaterSupplySchedule(schedule);
517 }
518
519 5 bool SwimmingPoolIndoor::setCoverSchedule(Schedule& schedule) {
520
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setCoverSchedule(schedule);
521 }
522
523 6 bool SwimmingPoolIndoor::setCoverEvaporationFactor(double coverEvaporationFactor) {
524
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setCoverEvaporationFactor(coverEvaporationFactor);
525 }
526
527 6 bool SwimmingPoolIndoor::setCoverConvectionFactor(double coverConvectionFactor) {
528
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setCoverConvectionFactor(coverConvectionFactor);
529 }
530
531 6 bool SwimmingPoolIndoor::setCoverShortWavelengthRadiationFactor(double coverShortWavelengthRadiationFactor) {
532
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setCoverShortWavelengthRadiationFactor(coverShortWavelengthRadiationFactor);
533 }
534
535 6 bool SwimmingPoolIndoor::setCoverLongWavelengthRadiationFactor(double coverLongWavelengthRadiationFactor) {
536
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setCoverLongWavelengthRadiationFactor(coverLongWavelengthRadiationFactor);
537 }
538
539 6 bool SwimmingPoolIndoor::setPoolHeatingSystemMaximumWaterFlowRate(double poolHeatingSystemMaximumWaterFlowRate) {
540
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setPoolHeatingSystemMaximumWaterFlowRate(poolHeatingSystemMaximumWaterFlowRate);
541 }
542
543 6 bool SwimmingPoolIndoor::setPoolMiscellaneousEquipmentPower(double poolMiscellaneousEquipmentPower) {
544
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setPoolMiscellaneousEquipmentPower(poolMiscellaneousEquipmentPower);
545 }
546
547 5 bool SwimmingPoolIndoor::setSetpointTemperatureSchedule(Schedule& schedule) {
548
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setSetpointTemperatureSchedule(schedule);
549 }
550
551 6 bool SwimmingPoolIndoor::setMaximumNumberofPeople(double maximumNumberofPeople) {
552
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setMaximumNumberofPeople(maximumNumberofPeople);
553 }
554
555 5 bool SwimmingPoolIndoor::setPeopleSchedule(Schedule& schedule) {
556
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setPeopleSchedule(schedule);
557 }
558
559 5 bool SwimmingPoolIndoor::setPeopleHeatGainSchedule(Schedule& schedule) {
560
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::SwimmingPoolIndoor_Impl>()->setPeopleHeatGainSchedule(schedule);
561 }
562
563 /// @cond
564
1/1
✓ Branch 2 taken 2 times.
2 SwimmingPoolIndoor::SwimmingPoolIndoor(std::shared_ptr<detail::SwimmingPoolIndoor_Impl> impl) : StraightComponent(impl) {}
565 /// @endcond
566
567 8 boost::optional<Node> SwimmingPoolIndoor::poolWaterInletNode() const {
568
1/1
✓ Branch 3 taken 8 times.
8 return getImpl<detail::SwimmingPoolIndoor_Impl>()->poolWaterInletNode();
569 }
570
571 8 boost::optional<Node> SwimmingPoolIndoor::poolWaterOutletNode() const {
572
1/1
✓ Branch 3 taken 8 times.
8 return getImpl<detail::SwimmingPoolIndoor_Impl>()->poolWaterOutletNode();
573 }
574
575 } // namespace model
576 } // namespace openstudio
577