GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 80.7% 180 / 0 / 223
Functions: 80.6% 25 / 0 / 31
Branches: 64.8% 175 / 0 / 270

src/model/PlantEquipmentOperationRangeBasedScheme.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 "PlantEquipmentOperationRangeBasedScheme.hpp"
7 #include "PlantEquipmentOperationRangeBasedScheme_Impl.hpp"
8 #include "PlantEquipmentOperationScheme.hpp"
9 #include "PlantEquipmentOperationScheme_Impl.hpp"
10 #include "Model.hpp"
11 #include "Model_Impl.hpp"
12 #include "HVACComponent.hpp"
13 #include "HVACComponent_Impl.hpp"
14 #include "ModelObjectList.hpp"
15 #include "ModelObjectList_Impl.hpp"
16 #include "../utilities/core/Assert.hpp"
17 #include "../utilities/idf/IdfExtensibleGroup.hpp"
18 #include "../utilities/idf/WorkspaceExtensibleGroup.hpp"
19 #include "../utilities/math/FloatCompare.hpp"
20
21 namespace openstudio {
22
23 namespace model {
24
25 // These are the same for heating and cooling load range schemes
26 enum LoadExtensibleFields
27 {
28 LOADRANGEFIELDS_LOWERLIMIT,
29 LOADRANGEFIELDS_UPPERLIMIT,
30 LOADRANGEFIELDS_RANGEEQUIPMENTLISTNAME
31 };
32
33 namespace detail {
34
35 ✗ PlantEquipmentOperationRangeBasedScheme_Impl::PlantEquipmentOperationRangeBasedScheme_Impl(IddObjectType type, Model_Impl* model)
36 ✗ : PlantEquipmentOperationScheme_Impl(type, model) {}
37
38 9 PlantEquipmentOperationRangeBasedScheme_Impl::PlantEquipmentOperationRangeBasedScheme_Impl(const IdfObject& idfObject, Model_Impl* model,
39 9 bool keepHandle)
40 9 : PlantEquipmentOperationScheme_Impl(idfObject, model, keepHandle) {}
41
42 ✗ PlantEquipmentOperationRangeBasedScheme_Impl::PlantEquipmentOperationRangeBasedScheme_Impl(const openstudio::detail::WorkspaceObject_Impl& other,
43 ✗ Model_Impl* model, bool keepHandle)
44 ✗ : PlantEquipmentOperationScheme_Impl(other, model, keepHandle) {}
45
46 2 bool PlantEquipmentOperationRangeBasedScheme_Impl::addLoadRange(double upperLimit, const std::vector<HVACComponent>& equipment) {
47
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
2 if (upperLimit < minimumLowerLimit()) {
48 ✗ return false;
49 }
50
51 2 unsigned i = 0;
52
2/3
✓ Branch 1 taken 2 times.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
2 for (auto& eg : extensibleGroups()) {
53
1/1
✓ Branch 1 taken 2 times.
2 const auto& t_upperLimit = eg.getDouble(LOADRANGEFIELDS_UPPERLIMIT);
54
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(t_upperLimit);
55
1/1
✓ Branch 1 taken 2 times.
2 const auto& t_lowerLimit = eg.getDouble(LOADRANGEFIELDS_LOWERLIMIT);
56
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(t_lowerLimit);
57
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
2 if (upperLimit < t_upperLimit) {
58
1/1
✓ Branch 1 taken 2 times.
2 eg.setDouble(LOADRANGEFIELDS_LOWERLIMIT, upperLimit);
59 // Create new eg and insert
60
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 auto newEg = getObject<IdfObject>().insertExtensibleGroup(i).cast<WorkspaceExtensibleGroup>();
61
1/1
✓ Branch 1 taken 2 times.
2 auto m = model();
62
1/1
✓ Branch 1 taken 2 times.
2 ModelObjectList modelObjectList(m);
63
64 // Remove duplicates
65 //auto equipmentCopy = equipment;
66 //std::sort( equipmentCopy.begin(), equipmentCopy.end() );
67 //equipmentCopy.erase( unique( equipmentCopy.begin(), equipmentCopy.end() ), equipmentCopy.end() );
68
69 // Remove duplicates primitively so that the order is preserved
70 2 std::vector<HVACComponent> equipmentCopy;
71
2/2
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 2 times.
4 for (const auto& mo : equipment) {
72
2/3
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
2 if (std::find(equipmentCopy.begin(), equipmentCopy.end(), mo) == equipmentCopy.end()) {
73
1/1
✓ Branch 1 taken 2 times.
2 equipmentCopy.push_back(mo);
74 }
75 }
76
2/2
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 2 times.
4 for (const auto& mo : equipmentCopy) {
77
1/1
✓ Branch 1 taken 2 times.
2 modelObjectList.addModelObject(mo);
78 }
79
80
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 newEg.setPointer(LOADRANGEFIELDS_RANGEEQUIPMENTLISTNAME, modelObjectList.handle());
81
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 newEg.setDouble(LOADRANGEFIELDS_LOWERLIMIT, t_lowerLimit.get());
82
1/1
✓ Branch 1 taken 2 times.
2 newEg.setDouble(LOADRANGEFIELDS_UPPERLIMIT, upperLimit);
83 2 return true;
84 2 }
85 ✗ ++i;
86 2 }
87
88 ✗ return false;
89 }
90
91 1 std::vector<HVACComponent> PlantEquipmentOperationRangeBasedScheme_Impl::removeLoadRange(double upperLimit) {
92
1/1
✓ Branch 1 taken 1 time.
1 auto t_extensibleGroups = extensibleGroups();
93
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
1 if (t_extensibleGroups.size() == 1u) {
94 ✗ return {};
95 }
96
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
1 if (upperLimit >= maximumUpperLimit()) {
97 ✗ return {};
98 }
99
100
1/2
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
1 for (auto eg = t_extensibleGroups.begin(); eg != t_extensibleGroups.end(); ++eg) {
101
1/1
✓ Branch 2 taken 1 time.
1 const auto& t_upperLimit = eg->getDouble(LOADRANGEFIELDS_UPPERLIMIT);
102
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(t_upperLimit);
103
2/3
✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
1 if (equal(upperLimit, t_upperLimit.get())) {
104
1/1
✓ Branch 2 taken 1 time.
1 const auto& t_lowerLimit = eg->getDouble(LOADRANGEFIELDS_LOWERLIMIT);
105
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(t_lowerLimit);
106 1 auto nextEg = (eg + 1);
107
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 5 not taken.
1 OS_ASSERT(nextEg != t_extensibleGroups.end());
108
2/2
✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
1 nextEg->setDouble(LOADRANGEFIELDS_LOWERLIMIT, t_lowerLimit.get());
109
110
2/2
✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
1 const auto& wo = eg->cast<WorkspaceExtensibleGroup>().getTarget(LOADRANGEFIELDS_RANGEEQUIPMENTLISTNAME);
111
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(wo);
112
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 const auto& modelObjectList = wo->optionalCast<ModelObjectList>();
113
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(modelObjectList);
114
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 auto result = subsetCastVector<HVACComponent>(modelObjectList->modelObjects());
115
116
2/2
✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
1 eraseExtensibleGroup(eg->groupIndex());
117
118 1 return result;
119 1 }
120 }
121
122 ✗ return {};
123 1 }
124
125 9 std::vector<double> PlantEquipmentOperationRangeBasedScheme_Impl::loadRangeUpperLimits() const {
126 9 std::vector<double> result;
127
128
3/3
✓ Branch 1 taken 9 times.
✓ Branch 8 taken 11 times.
✓ Branch 9 taken 9 times.
20 for (const auto& eg : extensibleGroups()) {
129
1/1
✓ Branch 1 taken 11 times.
11 const auto& value = eg.getDouble(LOADRANGEFIELDS_UPPERLIMIT);
130
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 11 times.
✗ Branch 4 not taken.
11 OS_ASSERT(value);
131
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 result.push_back(value.get());
132 9 }
133
134 9 return result;
135 ✗ }
136
137 12 std::vector<HVACComponent> PlantEquipmentOperationRangeBasedScheme_Impl::equipment(double upperLimit) const {
138
2/3
✓ Branch 1 taken 12 times.
✓ Branch 8 taken 14 times.
✗ Branch 9 not taken.
14 for (const auto& eg : extensibleGroups()) {
139
1/1
✓ Branch 1 taken 14 times.
14 const auto& value = eg.getDouble(LOADRANGEFIELDS_UPPERLIMIT);
140
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✗ Branch 4 not taken.
14 OS_ASSERT(value);
141
3/3
✓ Branch 2 taken 14 times.
✓ Branch 5 taken 12 times.
✓ Branch 6 taken 2 times.
14 if (equal(value.get(), upperLimit)) {
142
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 const auto& wo = eg.cast<WorkspaceExtensibleGroup>().getTarget(LOADRANGEFIELDS_RANGEEQUIPMENTLISTNAME);
143
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 4 not taken.
12 OS_ASSERT(wo);
144
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 const auto& modelObjectList = wo->optionalCast<ModelObjectList>();
145
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 4 not taken.
12 OS_ASSERT(modelObjectList);
146
3/3
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
12 return subsetCastVector<HVACComponent>(modelObjectList->modelObjects());
147 12 }
148 12 }
149
150 ✗ return {};
151 }
152
153 ✗ bool PlantEquipmentOperationRangeBasedScheme_Impl::addEquipment(double upperLimit, const HVACComponent& equipment) {
154 ✗ for (const auto& eg : extensibleGroups()) {
155 ✗ const auto& value = eg.getDouble(LOADRANGEFIELDS_UPPERLIMIT);
156 ✗ OS_ASSERT(value);
157 ✗ if (equal(value.get(), upperLimit)) {
158 ✗ const auto& wo = eg.cast<WorkspaceExtensibleGroup>().getTarget(2);
159 ✗ OS_ASSERT(wo);
160 ✗ auto modelObjectList = wo->optionalCast<ModelObjectList>();
161 ✗ OS_ASSERT(modelObjectList);
162 ✗ auto currentEquipment = modelObjectList->modelObjects();
163 ✗ if (std::find(currentEquipment.begin(), currentEquipment.end(), equipment) == currentEquipment.end()) {
164 ✗ return modelObjectList->addModelObject(equipment);
165 }
166 ✗ }
167 ✗ }
168
169 ✗ return false;
170 }
171
172 12 bool PlantEquipmentOperationRangeBasedScheme_Impl::addEquipment(const HVACComponent& equipment) {
173
1/1
✓ Branch 1 taken 12 times.
12 const auto& egs = extensibleGroups();
174
175
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 4 not taken.
12 OS_ASSERT(!egs.empty());
176
177 12 const auto& eg = egs.back();
178
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 const auto& wo = eg.cast<WorkspaceExtensibleGroup>().getTarget(2);
179
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 4 not taken.
12 OS_ASSERT(wo);
180
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 auto modelObjectList = wo->optionalCast<ModelObjectList>();
181
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 4 not taken.
12 OS_ASSERT(modelObjectList);
182
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 auto currentEquipment = modelObjectList->modelObjects();
183
3/3
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 11 times.
✓ Branch 8 taken 1 time.
12 if (std::find(currentEquipment.begin(), currentEquipment.end(), equipment) == currentEquipment.end()) {
184
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 return modelObjectList->addModelObject(equipment);
185 }
186
187 1 return false;
188 12 }
189
190 4 bool PlantEquipmentOperationRangeBasedScheme_Impl::removeEquipment(double upperLimit, const HVACComponent& equipment) {
191
2/3
✓ Branch 1 taken 4 times.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
4 for (const auto& eg : extensibleGroups()) {
192
1/1
✓ Branch 1 taken 4 times.
4 const auto& value = eg.getDouble(LOADRANGEFIELDS_UPPERLIMIT);
193
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
4 OS_ASSERT(value);
194
2/3
✓ Branch 2 taken 4 times.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
4 if (equal(value.get(), upperLimit)) {
195
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 const auto& wo = eg.cast<WorkspaceExtensibleGroup>().getTarget(LOADRANGEFIELDS_RANGEEQUIPMENTLISTNAME);
196
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
4 OS_ASSERT(wo);
197
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 auto modelObjectList = wo->optionalCast<ModelObjectList>();
198
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
4 OS_ASSERT(modelObjectList);
199
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 const auto& modelObjects = modelObjectList->modelObjects();
200
4/4
✓ Branch 2 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 11 taken 3 times.
✓ Branch 12 taken 1 time.
4 if (std::find(modelObjects.begin(), modelObjects.end(), equipment.cast<ModelObject>()) != modelObjects.end()) {
201
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 modelObjectList->removeModelObject(equipment);
202 3 return true;
203 } else {
204 1 return false;
205 }
206 4 }
207 4 }
208
209 ✗ return false;
210 }
211
212 2 bool PlantEquipmentOperationRangeBasedScheme_Impl::removeEquipment(const HVACComponent& equipment) {
213 2 bool result = false;
214
1/1
✓ Branch 1 taken 2 times.
2 auto upperLimits = loadRangeUpperLimits();
215
2/2
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 2 times.
4 for (const auto& limit : upperLimits) {
216
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
2 if (removeEquipment(limit, equipment)) {
217 2 result = true;
218 }
219 }
220
221 2 return result;
222 2 }
223
224 10 void PlantEquipmentOperationRangeBasedScheme_Impl::clearLoadRanges() {
225
1/1
✓ Branch 1 taken 10 times.
10 clearExtensibleGroups();
226
227
3/3
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
10 auto eg = getObject<WorkspaceObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>();
228
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 model::ModelObjectList modelObjectList(model());
229
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 eg.setPointer(LOADRANGEFIELDS_RANGEEQUIPMENTLISTNAME, modelObjectList.handle());
230
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 eg.setDouble(LOADRANGEFIELDS_LOWERLIMIT, minimumLowerLimit());
231
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 eg.setDouble(LOADRANGEFIELDS_UPPERLIMIT, maximumUpperLimit());
232 10 }
233
234 4 PlantEquipmentOperationRangeBasedScheme_Impl::PlantEquipmentOperationRangeBasedScheme_Impl(
235 4 const PlantEquipmentOperationRangeBasedScheme_Impl& other, Model_Impl* model, bool keepHandles)
236 4 : PlantEquipmentOperationScheme_Impl(other, model, keepHandles) {}
237
238 2 bool PlantEquipmentOperationRangeBasedScheme_Impl::replaceEquipment(double upperLimit, const std::vector<HVACComponent>& equipment) {
239
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
2 if (upperLimit < minimumLowerLimit()) {
240 ✗ return false;
241 }
242
243 2 [[maybe_unused]] unsigned i = 0;
244
2/3
✓ Branch 1 taken 2 times.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
2 for (auto& eg : extensibleGroups()) {
245
1/1
✓ Branch 1 taken 2 times.
2 const auto& t_upperLimit = eg.getDouble(LOADRANGEFIELDS_UPPERLIMIT);
246
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(t_upperLimit);
247
2/3
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
2 if (equal(upperLimit, t_upperLimit.get())) {
248
1/1
✓ Branch 1 taken 2 times.
2 auto m = model();
249
250 // Remove duplicates primitively so that the order is preserved
251 2 std::vector<HVACComponent> equipmentCopy;
252
2/2
✓ Branch 5 taken 5 times.
✓ Branch 6 taken 2 times.
7 for (const auto& mo : equipment) {
253
2/3
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
5 if (std::find(equipmentCopy.begin(), equipmentCopy.end(), mo) == equipmentCopy.end()) {
254
1/1
✓ Branch 1 taken 5 times.
5 equipmentCopy.push_back(mo);
255 }
256 }
257
258
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
4 if (auto target = eg.cast<WorkspaceExtensibleGroup>().getTarget(LOADRANGEFIELDS_RANGEEQUIPMENTLISTNAME)) {
259
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 auto modelObjectList = target->cast<model::ModelObjectList>();
260
1/1
✓ Branch 1 taken 2 times.
2 modelObjectList.removeAllModelObjects();
261
2/2
✓ Branch 5 taken 5 times.
✓ Branch 6 taken 2 times.
7 for (const auto& mo : equipmentCopy) {
262
1/1
✓ Branch 1 taken 5 times.
5 modelObjectList.addModelObject(mo);
263 }
264 2 } else {
265 ✗ ModelObjectList modelObjectList(m);
266 ✗ for (const auto& mo : equipmentCopy) {
267 ✗ modelObjectList.addModelObject(mo);
268 }
269 ✗ eg.cast<WorkspaceExtensibleGroup>().setPointer(LOADRANGEFIELDS_RANGEEQUIPMENTLISTNAME, modelObjectList.handle());
270 2 }
271 2 return true;
272 2 }
273 ✗ ++i;
274 2 }
275
276 ✗ return false;
277 }
278
279 ✗ bool PlantEquipmentOperationRangeBasedScheme_Impl::replaceEquipment(const std::vector<HVACComponent>& equipment) {
280 ✗ return replaceEquipment(loadRangeUpperLimits().front(), equipment);
281 }
282
283 1 ModelObject PlantEquipmentOperationRangeBasedScheme_Impl::clone(Model model) const {
284
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 auto clone = PlantEquipmentOperationScheme_Impl::clone(model).cast<model::PlantEquipmentOperationRangeBasedScheme>();
285
286
1/1
✓ Branch 1 taken 1 time.
1 clone.clearLoadRanges();
287
3/3
✓ Branch 1 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 9 taken 1 time.
2 for (const auto& limit : loadRangeUpperLimits()) {
288
1/1
✓ Branch 1 taken 1 time.
1 auto equip = equipment(limit);
289
2/3
✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
1 if (equal(limit, maximumUpperLimit())) {
290
1/1
✓ Branch 1 taken 1 time.
1 clone.replaceEquipment(limit, equip);
291 } else {
292 ✗ clone.addLoadRange(limit, equip);
293 }
294 2 }
295
296 2 return std::move(clone);
297 1 }
298
299 } // namespace detail
300
301 9 PlantEquipmentOperationRangeBasedScheme::PlantEquipmentOperationRangeBasedScheme(IddObjectType type, const Model& model)
302 9 : PlantEquipmentOperationScheme(type, model) {
303
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 9 times.
✗ Branch 5 not taken.
9 OS_ASSERT(getImpl<detail::PlantEquipmentOperationRangeBasedScheme_Impl>());
304
305
1/1
✓ Branch 1 taken 9 times.
9 clearLoadRanges();
306 9 }
307
308 8 PlantEquipmentOperationRangeBasedScheme::PlantEquipmentOperationRangeBasedScheme(
309 8 std::shared_ptr<detail::PlantEquipmentOperationRangeBasedScheme_Impl> p)
310
1/1
✓ Branch 3 taken 8 times.
8 : PlantEquipmentOperationScheme(std::move(p)) {}
311
312 2 bool PlantEquipmentOperationRangeBasedScheme::addLoadRange(double upperLimit, const std::vector<HVACComponent>& equipment) {
313
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::PlantEquipmentOperationRangeBasedScheme_Impl>()->addLoadRange(upperLimit, equipment);
314 }
315
316 1 std::vector<HVACComponent> PlantEquipmentOperationRangeBasedScheme::removeLoadRange(double upperLimit) {
317
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::PlantEquipmentOperationRangeBasedScheme_Impl>()->removeLoadRange(upperLimit);
318 }
319
320 6 std::vector<double> PlantEquipmentOperationRangeBasedScheme::loadRangeUpperLimits() const {
321
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::PlantEquipmentOperationRangeBasedScheme_Impl>()->loadRangeUpperLimits();
322 }
323
324 11 std::vector<HVACComponent> PlantEquipmentOperationRangeBasedScheme::equipment(double upperLimit) const {
325
1/1
✓ Branch 3 taken 11 times.
11 return getImpl<detail::PlantEquipmentOperationRangeBasedScheme_Impl>()->equipment(upperLimit);
326 }
327
328 ✗ bool PlantEquipmentOperationRangeBasedScheme::addEquipment(double upperLimit, const HVACComponent& equipment) {
329 ✗ return getImpl<detail::PlantEquipmentOperationRangeBasedScheme_Impl>()->addEquipment(upperLimit, equipment);
330 }
331
332 12 bool PlantEquipmentOperationRangeBasedScheme::addEquipment(const HVACComponent& equipment) {
333
1/1
✓ Branch 3 taken 12 times.
12 return getImpl<detail::PlantEquipmentOperationRangeBasedScheme_Impl>()->addEquipment(equipment);
334 }
335
336 2 bool PlantEquipmentOperationRangeBasedScheme::removeEquipment(double upperLimit, const HVACComponent& equipment) {
337
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::PlantEquipmentOperationRangeBasedScheme_Impl>()->removeEquipment(upperLimit, equipment);
338 }
339
340 2 bool PlantEquipmentOperationRangeBasedScheme::removeEquipment(const HVACComponent& equipment) {
341
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::PlantEquipmentOperationRangeBasedScheme_Impl>()->removeEquipment(equipment);
342 }
343
344 10 void PlantEquipmentOperationRangeBasedScheme::clearLoadRanges() {
345
1/1
✓ Branch 3 taken 10 times.
10 return getImpl<detail::PlantEquipmentOperationRangeBasedScheme_Impl>()->clearLoadRanges();
346 }
347
348 1 double PlantEquipmentOperationRangeBasedScheme::maximumUpperLimit() const {
349
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::PlantEquipmentOperationRangeBasedScheme_Impl>()->maximumUpperLimit();
350 }
351
352 2 double PlantEquipmentOperationRangeBasedScheme::minimumLowerLimit() const {
353
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::PlantEquipmentOperationRangeBasedScheme_Impl>()->minimumLowerLimit();
354 }
355
356 2 bool PlantEquipmentOperationRangeBasedScheme::replaceEquipment(double upperLimit, const std::vector<HVACComponent>& equipment) {
357
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::PlantEquipmentOperationRangeBasedScheme_Impl>()->replaceEquipment(upperLimit, equipment);
358 }
359
360 ✗ bool PlantEquipmentOperationRangeBasedScheme::replaceEquipment(const std::vector<HVACComponent>& equipment) {
361 ✗ return getImpl<detail::PlantEquipmentOperationRangeBasedScheme_Impl>()->replaceEquipment(equipment);
362 }
363
364 } // namespace model
365
366 } // namespace openstudio
367