src/model/AvailabilityManagerAssignmentList.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 "AvailabilityManagerAssignmentList.hpp" | ||
| 7 | #include "AvailabilityManagerAssignmentList_Impl.hpp" | ||
| 8 | |||
| 9 | #include "AvailabilityManager_Impl.hpp" | ||
| 10 | #include "AvailabilityManager.hpp" | ||
| 11 | |||
| 12 | #include "Loop_Impl.hpp" | ||
| 13 | #include "Loop.hpp" | ||
| 14 | #include "AirLoopHVAC_Impl.hpp" | ||
| 15 | #include "AirLoopHVAC.hpp" | ||
| 16 | #include "PlantLoop_Impl.hpp" | ||
| 17 | #include "PlantLoop.hpp" | ||
| 18 | #include "Model.hpp" | ||
| 19 | #include "ZoneHVACComponent.hpp" | ||
| 20 | #include "ZoneHVACComponent_Impl.hpp" | ||
| 21 | |||
| 22 | // for the containingZoneHVACComponent method | ||
| 23 | #include "ZoneHVACFourPipeFanCoil.hpp" | ||
| 24 | #include "ZoneHVACFourPipeFanCoil_Impl.hpp" | ||
| 25 | |||
| 26 | #include <utilities/idd/IddEnums.hxx> | ||
| 27 | #include <utilities/idd/OS_AvailabilityManagerAssignmentList_FieldEnums.hxx> | ||
| 28 | |||
| 29 | #include "../utilities/core/Assert.hpp" | ||
| 30 | #include "../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 31 | #include "../utilities/idf/WorkspaceExtensibleGroup.hpp" | ||
| 32 | |||
| 33 | namespace openstudio { | ||
| 34 | namespace model { | ||
| 35 | |||
| 36 | namespace detail { | ||
| 37 | |||
| 38 | 1292 | AvailabilityManagerAssignmentList_Impl::AvailabilityManagerAssignmentList_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 39 | 1292 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 40 |
4/6✓ Branch 1 taken 1292 times.
✓ Branch 4 taken 1292 times.
✓ Branch 7 taken 1292 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1292 times.
✗ Branch 13 not taken.
|
1292 | OS_ASSERT(idfObject.iddObject().type() == AvailabilityManagerAssignmentList::iddObjectType()); |
| 41 | 1292 | } | |
| 42 | |||
| 43 | 57 | AvailabilityManagerAssignmentList_Impl::AvailabilityManagerAssignmentList_Impl(const openstudio::detail::WorkspaceObject_Impl& other, | |
| 44 | 57 | Model_Impl* model, bool keepHandle) | |
| 45 | 57 | : ModelObject_Impl(other, model, keepHandle) { | |
| 46 |
4/6✓ Branch 1 taken 57 times.
✓ Branch 4 taken 57 times.
✓ Branch 7 taken 57 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 57 times.
✗ Branch 13 not taken.
|
57 | OS_ASSERT(other.iddObject().type() == AvailabilityManagerAssignmentList::iddObjectType()); |
| 47 | 57 | } | |
| 48 | |||
| 49 | 538 | AvailabilityManagerAssignmentList_Impl::AvailabilityManagerAssignmentList_Impl(const AvailabilityManagerAssignmentList_Impl& other, | |
| 50 | 538 | Model_Impl* model, bool keepHandle) | |
| 51 | 538 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 52 | |||
| 53 | 1 | const std::vector<std::string>& AvailabilityManagerAssignmentList_Impl::outputVariableNames() const { | |
| 54 |
2/4✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | static const std::vector<std::string> result; |
| 55 | // Not appropriate: no specific output | ||
| 56 | 1 | return result; | |
| 57 | } | ||
| 58 | |||
| 59 | 1 | IddObjectType AvailabilityManagerAssignmentList_Impl::iddObjectType() const { | |
| 60 | 1 | return AvailabilityManagerAssignmentList::iddObjectType(); | |
| 61 | } | ||
| 62 | |||
| 63 | /* | ||
| 64 | * TODO: Clone all the AVMs | ||
| 65 | * The Ctor gets a loop though... Perhaps should have a clone(Loop loop) method instead? | ||
| 66 | * It's meant to be called in the Loop.clone method anwyays... | ||
| 67 | * TODO: This will need to change once ZOneHVAC equipment can have an AVMList too... | ||
| 68 | */ | ||
| 69 | 12 | ModelObject AvailabilityManagerAssignmentList_Impl::clone(Model model) const { | |
| 70 | // Create a new, blank, one | ||
| 71 |
1/1✓ Branch 1 taken 12 times.
|
12 | AvailabilityManagerAssignmentList avmListClone(model); |
| 72 | |||
| 73 | // Clone all AVMs and populate the clone | ||
| 74 |
1/1✓ Branch 1 taken 12 times.
|
12 | std::vector<AvailabilityManager> avmVector = availabilityManagers(); |
| 75 |
2/2✓ Branch 5 taken 30 times.
✓ Branch 6 taken 12 times.
|
42 | for (const AvailabilityManager& avm : avmVector) { |
| 76 |
3/3✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
✓ Branch 7 taken 30 times.
|
30 | auto avmClone = avm.clone(model).cast<AvailabilityManager>(); |
| 77 |
1/1✓ Branch 1 taken 30 times.
|
30 | bool ok = avmListClone.addAvailabilityManager(avmClone); |
| 78 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
✗ Branch 3 not taken.
|
30 | OS_ASSERT(ok); |
| 79 | 30 | } | |
| 80 | 24 | return std::move(avmListClone); | |
| 81 | 12 | } | |
| 82 | |||
| 83 | 7 | unsigned AvailabilityManagerAssignmentList_Impl::availabilityManagerPriority(const AvailabilityManager& avm) const { | |
| 84 | |||
| 85 | // TODO: perhaps I chould explicitly check that the avm is | ||
| 86 | // 1. in the same model | ||
| 87 | // 2. in the avm list | ||
| 88 | // In order to LOG a helpful message to the user. | ||
| 89 | 7 | boost::optional<unsigned> result; | |
| 90 | |||
| 91 |
1/1✓ Branch 1 taken 7 times.
|
7 | std::vector<IdfExtensibleGroup> groups = extensibleGroups(); |
| 92 | |||
| 93 | 7 | int i = 1; | |
| 94 | |||
| 95 |
1/2✓ Branch 5 taken 14 times.
✗ Branch 6 not taken.
|
14 | for (const auto& group : groups) { |
| 96 | boost::optional<WorkspaceObject> wo = | ||
| 97 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | group.cast<WorkspaceExtensibleGroup>().getTarget(OS_AvailabilityManagerAssignmentListExtensibleFields::AvailabilityManagerName); |
| 98 | |||
| 99 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✗ Branch 4 not taken.
|
14 | OS_ASSERT(wo); |
| 100 | |||
| 101 |
6/6✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✓ Branch 10 taken 14 times.
✓ Branch 12 taken 7 times.
✓ Branch 13 taken 7 times.
|
14 | if (wo->handle() == avm.handle()) { |
| 102 |
1/1✓ Branch 1 taken 7 times.
|
7 | result = i; |
| 103 | 7 | break; | |
| 104 | } | ||
| 105 | 7 | i++; | |
| 106 | 14 | } | |
| 107 | |||
| 108 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
|
7 | if (!result.is_initialized()) { |
| 109 | ✗ | LOG(Warn, avm.briefDescription() << " wasn't found in " << this->briefDescription()); | |
| 110 | // Should we return 0 for eg? | ||
| 111 | } | ||
| 112 | |||
| 113 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 4 not taken.
|
7 | OS_ASSERT(result); |
| 114 | |||
| 115 |
1/1✓ Branch 1 taken 7 times.
|
14 | return result.get(); |
| 116 | 7 | } | |
| 117 | |||
| 118 | 621 | std::vector<AvailabilityManager> AvailabilityManagerAssignmentList_Impl::availabilityManagers() const { | |
| 119 | 621 | std::vector<AvailabilityManager> result; | |
| 120 | |||
| 121 |
1/1✓ Branch 1 taken 621 times.
|
621 | std::vector<IdfExtensibleGroup> groups = extensibleGroups(); |
| 122 | |||
| 123 |
2/2✓ Branch 5 taken 548 times.
✓ Branch 6 taken 621 times.
|
1169 | for (const auto& group : groups) { |
| 124 | boost::optional<WorkspaceObject> wo = | ||
| 125 |
2/2✓ Branch 1 taken 548 times.
✓ Branch 4 taken 548 times.
|
548 | group.cast<WorkspaceExtensibleGroup>().getTarget(OS_AvailabilityManagerAssignmentListExtensibleFields::AvailabilityManagerName); |
| 126 | |||
| 127 |
2/2✓ Branch 0 taken 527 times.
✓ Branch 1 taken 21 times.
|
548 | if (wo) { |
| 128 |
3/3✓ Branch 1 taken 527 times.
✓ Branch 4 taken 527 times.
✓ Branch 7 taken 527 times.
|
527 | result.push_back(wo->cast<AvailabilityManager>()); |
| 129 | } | ||
| 130 | 548 | } | |
| 131 | |||
| 132 | 1242 | return result; | |
| 133 | 621 | } | |
| 134 | |||
| 135 | 136 | bool AvailabilityManagerAssignmentList_Impl::addAvailabilityManager(const AvailabilityManager& avm) { | |
| 136 |
3/3✓ Branch 1 taken 136 times.
✓ Branch 4 taken 136 times.
✓ Branch 7 taken 136 times.
|
136 | auto eg = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>(); |
| 137 | |||
| 138 |
2/2✓ Branch 1 taken 136 times.
✓ Branch 4 taken 136 times.
|
136 | bool ok = eg.setPointer(OS_AvailabilityManagerAssignmentListExtensibleFields::AvailabilityManagerName, avm.handle()); |
| 139 | |||
| 140 | 136 | return ok; | |
| 141 | 136 | } | |
| 142 | |||
| 143 | 4 | bool AvailabilityManagerAssignmentList_Impl::addAvailabilityManager(const AvailabilityManager& avm, unsigned priority) { | |
| 144 | 4 | bool ok = addAvailabilityManager(avm); | |
| 145 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | OS_ASSERT(ok); |
| 146 | 4 | ok = setAvailabilityManagerPriority(avm, priority); | |
| 147 | 4 | return ok; | |
| 148 | } | ||
| 149 | |||
| 150 | 6 | bool AvailabilityManagerAssignmentList_Impl::setAvailabilityManagerPriority(const AvailabilityManager& avm, unsigned priority) { | |
| 151 |
1/1✓ Branch 1 taken 6 times.
|
6 | std::vector<AvailabilityManager> avmVector = availabilityManagers(); |
| 152 | |||
| 153 |
2/4✓ Branch 4 taken 6 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 10 not taken.
|
6 | OS_ASSERT(std::find(avmVector.begin(), avmVector.end(), avm) != avmVector.end()); |
| 154 | |||
| 155 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 5 times.
|
6 | if (priority > avmVector.size()) { |
| 156 | 1 | priority = avmVector.size(); | |
| 157 | } | ||
| 158 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 5 times.
|
6 | if (priority < 1) { |
| 159 | 1 | priority = 1; | |
| 160 | } | ||
| 161 | |||
| 162 |
2/2✓ Branch 3 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | avmVector.erase(std::find(avmVector.begin(), avmVector.end(), avm)); |
| 163 | |||
| 164 |
1/1✓ Branch 4 taken 6 times.
|
6 | avmVector.insert(avmVector.begin() + (priority - 1), avm); |
| 165 | |||
| 166 | // Clear the extensible groups, and redo them | ||
| 167 |
1/1✓ Branch 1 taken 6 times.
|
6 | clearExtensibleGroups(); |
| 168 |
2/2✓ Branch 5 taken 23 times.
✓ Branch 6 taken 6 times.
|
29 | for (const AvailabilityManager& a : avmVector) { |
| 169 |
1/1✓ Branch 1 taken 23 times.
|
23 | bool ok = addAvailabilityManager(a); |
| 170 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 23 times.
✗ Branch 3 not taken.
|
23 | OS_ASSERT(ok); |
| 171 | } | ||
| 172 | 6 | return true; | |
| 173 | 6 | } | |
| 174 | |||
| 175 | 2 | bool AvailabilityManagerAssignmentList_Impl::setAvailabilityManagers(const std::vector<AvailabilityManager>& avms) { | |
| 176 | // Clear the extensible groups, and redo them | ||
| 177 |
1/1✓ Branch 1 taken 2 times.
|
2 | clearExtensibleGroups(); |
| 178 |
2/2✓ Branch 5 taken 6 times.
✓ Branch 6 taken 2 times.
|
8 | for (const AvailabilityManager& a : avms) { |
| 179 |
1/1✓ Branch 1 taken 6 times.
|
6 | bool ok = addAvailabilityManager(a); |
| 180 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 3 not taken.
|
6 | OS_ASSERT(ok); |
| 181 | } | ||
| 182 | 2 | return true; | |
| 183 | } | ||
| 184 | |||
| 185 | 4 | void AvailabilityManagerAssignmentList_Impl::resetAvailabilityManagers() { | |
| 186 |
1/1✓ Branch 1 taken 4 times.
|
4 | clearExtensibleGroups(); |
| 187 | 4 | } | |
| 188 | |||
| 189 | 3 | bool AvailabilityManagerAssignmentList_Impl::removeAvailabilityManager(const AvailabilityManager& avm) { | |
| 190 | |||
| 191 |
1/1✓ Branch 1 taken 3 times.
|
3 | std::vector<AvailabilityManager> avmVector = availabilityManagers(); |
| 192 | |||
| 193 |
2/4✓ Branch 4 taken 3 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 3 times.
✗ Branch 10 not taken.
|
3 | OS_ASSERT(std::find(avmVector.begin(), avmVector.end(), avm) != avmVector.end()); |
| 194 | |||
| 195 |
2/2✓ Branch 3 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | avmVector.erase(std::find(avmVector.begin(), avmVector.end(), avm)); |
| 196 | |||
| 197 | // Clear the extensible groups, and redo them | ||
| 198 |
1/1✓ Branch 1 taken 3 times.
|
3 | clearExtensibleGroups(); |
| 199 |
2/2✓ Branch 5 taken 14 times.
✓ Branch 6 taken 3 times.
|
17 | for (const AvailabilityManager& a : avmVector) { |
| 200 |
1/1✓ Branch 1 taken 14 times.
|
14 | bool ok = addAvailabilityManager(a); |
| 201 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
✗ Branch 3 not taken.
|
14 | OS_ASSERT(ok); |
| 202 | } | ||
| 203 | 3 | return true; | |
| 204 | 3 | } | |
| 205 | |||
| 206 | 2 | bool AvailabilityManagerAssignmentList_Impl::removeAvailabilityManager(const unsigned priority) { | |
| 207 | |||
| 208 |
1/1✓ Branch 1 taken 2 times.
|
2 | std::vector<AvailabilityManager> avmVector = availabilityManagers(); |
| 209 | |||
| 210 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
|
2 | if ((priority > avmVector.size()) || (priority < 1)) { |
| 211 | ✗ | LOG(Warn, "Priority of '" << priority << " is out of bounds for " << briefDescription()); | |
| 212 | ✗ | return false; | |
| 213 | } | ||
| 214 | |||
| 215 | // Clear the extensible groups, and redo them | ||
| 216 |
1/1✓ Branch 1 taken 2 times.
|
2 | clearExtensibleGroups(); |
| 217 | // priority starts at one | ||
| 218 | |||
| 219 | 2 | unsigned i = 1; | |
| 220 | 2 | bool result = false; | |
| 221 | |||
| 222 |
2/2✓ Branch 4 taken 6 times.
✓ Branch 5 taken 2 times.
|
8 | for (const AvailabilityManager& a : avmVector) { |
| 223 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 4 times.
|
6 | if (i == priority) { |
| 224 | 2 | result = true; | |
| 225 | } else { | ||
| 226 |
1/1✓ Branch 1 taken 4 times.
|
4 | bool ok = addAvailabilityManager(a); |
| 227 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
|
4 | OS_ASSERT(ok); |
| 228 | } | ||
| 229 | 6 | ++i; | |
| 230 | } | ||
| 231 | 2 | return result; | |
| 232 | 2 | } | |
| 233 | |||
| 234 | 30 | boost::optional<AirLoopHVAC> AvailabilityManagerAssignmentList_Impl::airLoopHVAC() const { | |
| 235 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | std::vector<AirLoopHVAC> airLoops = this->model().getConcreteModelObjects<AirLoopHVAC>(); |
| 236 | |||
| 237 |
2/2✓ Branch 5 taken 29 times.
✓ Branch 6 taken 1 time.
|
30 | for (auto& airLoop : airLoops) { |
| 238 | // Call the Impl one (there is no public) | ||
| 239 |
1/1✓ Branch 3 taken 29 times.
|
29 | AvailabilityManagerAssignmentList avmList = airLoop.getImpl<detail::AirLoopHVAC_Impl>()->availabilityManagerAssignmentList(); |
| 240 | |||
| 241 |
4/5✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
✓ Branch 7 taken 29 times.
✓ Branch 9 taken 29 times.
✗ Branch 10 not taken.
|
29 | if (avmList.handle() == this->handle()) { |
| 242 |
1/1✓ Branch 1 taken 29 times.
|
29 | return airLoop; |
| 243 | } | ||
| 244 | 29 | } | |
| 245 | 1 | return boost::none; | |
| 246 | 30 | } | |
| 247 | |||
| 248 | 3 | boost::optional<PlantLoop> AvailabilityManagerAssignmentList_Impl::plantLoop() const { | |
| 249 | 3 | boost::optional<PlantLoop> plantLoop; | |
| 250 | // try with getModelObjectSources instead | ||
| 251 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | std::vector<PlantLoop> plantLoops = getObject<ModelObject>().getModelObjectSources<PlantLoop>(PlantLoop::iddObjectType()); |
| 252 | |||
| 253 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
3 | if (!plantLoops.empty()) { |
| 254 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
3 | if (plantLoops.size() > 1u) { |
| 255 | ✗ | LOG(Error, briefDescription() << " is referenced by more than one plantLoop, returning the first"); | |
| 256 | } | ||
| 257 |
1/1✓ Branch 2 taken 3 times.
|
3 | plantLoop = plantLoops[0]; |
| 258 | } | ||
| 259 | /* | ||
| 260 | * std::vector<PlantLoop> plantLoops = this->model().getConcreteModelObjects<PlantLoop>(); | ||
| 261 | * | ||
| 262 | * for( auto & plantLoop : plantLoops) | ||
| 263 | * { | ||
| 264 | * // Call the Impl one (there is no public) | ||
| 265 | * AvailabilityManagerAssignmentList avmList = plantLoop.getImpl<detail::PlantLoop_Impl>()->availabilityManagerAssignmentList(); | ||
| 266 | * if (avmList.handle() == this->handle()) | ||
| 267 | * { | ||
| 268 | * return plantLoop; | ||
| 269 | * } | ||
| 270 | * } | ||
| 271 | */ | ||
| 272 | 6 | return plantLoop; | |
| 273 | 3 | } | |
| 274 | |||
| 275 | 28 | boost::optional<Loop> AvailabilityManagerAssignmentList_Impl::loop() const { | |
| 276 |
3/3✓ Branch 1 taken 28 times.
✓ Branch 3 taken 27 times.
✓ Branch 4 taken 1 time.
|
56 | if (boost::optional<AirLoopHVAC> airLoopHVAC = this->airLoopHVAC()) { |
| 277 |
2/2✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
|
27 | return airLoopHVAC->optionalCast<Loop>(); |
| 278 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if (boost::optional<PlantLoop> plantLoop = this->plantLoop()) { |
| 279 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | return plantLoop->optionalCast<Loop>(); |
| 280 | } else { | ||
| 281 | ✗ | return boost::none; | |
| 282 | 29 | } | |
| 283 | } | ||
| 284 | |||
| 285 | ✗ | boost::optional<ZoneHVACComponent> AvailabilityManagerAssignmentList_Impl::containingZoneHVACComponent() const { | |
| 286 | |||
| 287 | ✗ | boost::optional<ZoneHVACComponent> result; | |
| 288 | |||
| 289 | // E+ V8-8-0 IDD, list of objects that reference SystemAvailabilityManagerLists | ||
| 290 | // ZoneHVAC:FourPipeFanCoil | ||
| 291 | std::vector<ZoneHVACFourPipeFanCoil> zoneHVACFourPipeFanCoils = | ||
| 292 | ✗ | getObject<ModelObject>().getModelObjectSources<ZoneHVACFourPipeFanCoil>(ZoneHVACFourPipeFanCoil::iddObjectType()); | |
| 293 | |||
| 294 | ✗ | if (!zoneHVACFourPipeFanCoils.empty()) { | |
| 295 | ✗ | if (zoneHVACFourPipeFanCoils.size() > 1u) { | |
| 296 | ✗ | LOG(Error, briefDescription() << " is referenced by more than one zoneHVACFourPipeFanCoils, returning the first"); | |
| 297 | } | ||
| 298 | ✗ | return zoneHVACFourPipeFanCoils[0]; | |
| 299 | } | ||
| 300 | |||
| 301 | /* | ||
| 302 | *for( const auto & zoneHVACFourPipeFanCoil : zoneHVACFourPipeFanCoils ) | ||
| 303 | *{ | ||
| 304 | * if( boost::optional<HVACComponent> coil = zoneHVACFourPipeFanCoil.supplyAirFan() ) | ||
| 305 | * { | ||
| 306 | * if( coil->handle() == this->handle() ) | ||
| 307 | * { | ||
| 308 | * return zoneHVACFourPipeFanCoil; | ||
| 309 | * } | ||
| 310 | * } | ||
| 311 | *} | ||
| 312 | */ | ||
| 313 | |||
| 314 | // ZoneHVAC:WindowAirConditioner | ||
| 315 | // ZoneHVAC:PackagedTerminalAirConditioner | ||
| 316 | // ZoneHVAC:PackagedTerminalHeatPump | ||
| 317 | // ZoneHVAC:WaterToAirHeatPump | ||
| 318 | // ZoneHVAC:EnergyRecoveryVentilator | ||
| 319 | // ZoneHVAC:UnitVentilator | ||
| 320 | // ZoneHVAC:UnitHeater | ||
| 321 | // ZoneHVAC:EvaporativeCoolerUnit | ||
| 322 | // ZoneHVAC:OutdoorAirUnit | ||
| 323 | // ZoneHVAC:TerminalUnit:VariableRefrigerantFlow | ||
| 324 | // ZoneHVAC:VentilatedSlab | ||
| 325 | |||
| 326 | // For this to work, would need ZoneHVACComponent to have a static iddObjectType defined | ||
| 327 | /* | ||
| 328 | * std::vector<ZoneHVACComponent> zoneHVACComps = getObject<ModelObject>().getModelObjectSources<ZoneHVACComponent>(ZoneHVACComponent::iddObjectType()); | ||
| 329 | * | ||
| 330 | * if( zoneHVACComps.size() > 0u) { | ||
| 331 | * if( zoneHVACComps.size() > 1u) { | ||
| 332 | * LOG(Error, briefDescription() << " is referenced by more than one ZoneHVACComponent, returning the first"); | ||
| 333 | * } | ||
| 334 | * result = zoneHVACComps[0]; | ||
| 335 | * } | ||
| 336 | */ | ||
| 337 | |||
| 338 | ✗ | return result; | |
| 339 | ✗ | } | |
| 340 | |||
| 341 | } // namespace detail | ||
| 342 | |||
| 343 | /* | ||
| 344 | * Ctor, accepts Loop as an input parameter (for now that's the only thing that accepts an AVMlist in OS, but ZoneHVAC stuff should too) | ||
| 345 | */ | ||
| 346 | 1222 | AvailabilityManagerAssignmentList::AvailabilityManagerAssignmentList(const Loop& loop) | |
| 347 |
3/3✓ Branch 1 taken 1222 times.
✓ Branch 4 taken 1222 times.
✓ Branch 7 taken 1222 times.
|
1222 | : ModelObject(AvailabilityManagerAssignmentList::iddObjectType(), loop.model()) { |
| 348 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 1222 times.
✗ Branch 5 not taken.
|
1222 | OS_ASSERT(getImpl<detail::AvailabilityManagerAssignmentList_Impl>()); |
| 349 | |||
| 350 |
4/4✓ Branch 1 taken 1222 times.
✓ Branch 4 taken 1222 times.
✓ Branch 7 taken 1222 times.
✓ Branch 10 taken 1222 times.
|
1222 | this->setName(loop.name().get() + " AvailabilityManagerAssignmentList"); |
| 351 | 1222 | } | |
| 352 | |||
| 353 | 12 | AvailabilityManagerAssignmentList::AvailabilityManagerAssignmentList(const Model& model) | |
| 354 | 12 | : ModelObject(AvailabilityManagerAssignmentList::iddObjectType(), model) { | |
| 355 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
✗ Branch 5 not taken.
|
12 | OS_ASSERT(getImpl<detail::AvailabilityManagerAssignmentList_Impl>()); |
| 356 | 12 | } | |
| 357 | |||
| 358 | 10225 | IddObjectType AvailabilityManagerAssignmentList::iddObjectType() { | |
| 359 |
1/1✓ Branch 1 taken 10225 times.
|
10225 | return {IddObjectType::OS_AvailabilityManagerAssignmentList}; |
| 360 | } | ||
| 361 | |||
| 362 | 598 | std::vector<AvailabilityManager> AvailabilityManagerAssignmentList::availabilityManagers() const { | |
| 363 |
1/1✓ Branch 3 taken 598 times.
|
598 | return getImpl<detail::AvailabilityManagerAssignmentList_Impl>()->availabilityManagers(); |
| 364 | } | ||
| 365 | |||
| 366 | 2 | bool AvailabilityManagerAssignmentList::setAvailabilityManagers(const std::vector<AvailabilityManager>& avms) { | |
| 367 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::AvailabilityManagerAssignmentList_Impl>()->setAvailabilityManagers(avms); |
| 368 | } | ||
| 369 | |||
| 370 | 4 | void AvailabilityManagerAssignmentList::resetAvailabilityManagers() { | |
| 371 |
1/1✓ Branch 3 taken 4 times.
|
4 | getImpl<detail::AvailabilityManagerAssignmentList_Impl>()->resetAvailabilityManagers(); |
| 372 | 4 | } | |
| 373 | |||
| 374 | 85 | bool AvailabilityManagerAssignmentList::addAvailabilityManager(const AvailabilityManager& avm) { | |
| 375 |
1/1✓ Branch 3 taken 85 times.
|
85 | return getImpl<detail::AvailabilityManagerAssignmentList_Impl>()->addAvailabilityManager(avm); |
| 376 | } | ||
| 377 | 4 | bool AvailabilityManagerAssignmentList::addAvailabilityManager(const AvailabilityManager& avm, unsigned priority) { | |
| 378 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::AvailabilityManagerAssignmentList_Impl>()->addAvailabilityManager(avm, priority); |
| 379 | } | ||
| 380 | |||
| 381 | 3 | bool AvailabilityManagerAssignmentList::removeAvailabilityManager(const AvailabilityManager& avm) { | |
| 382 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::AvailabilityManagerAssignmentList_Impl>()->removeAvailabilityManager(avm); |
| 383 | } | ||
| 384 | 2 | bool AvailabilityManagerAssignmentList::removeAvailabilityManager(unsigned priority) { | |
| 385 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::AvailabilityManagerAssignmentList_Impl>()->removeAvailabilityManager(priority); |
| 386 | } | ||
| 387 | |||
| 388 | 7 | unsigned AvailabilityManagerAssignmentList::availabilityManagerPriority(const AvailabilityManager& avm) const { | |
| 389 |
1/1✓ Branch 3 taken 7 times.
|
7 | return getImpl<detail::AvailabilityManagerAssignmentList_Impl>()->availabilityManagerPriority(avm); |
| 390 | } | ||
| 391 | 2 | bool AvailabilityManagerAssignmentList::setAvailabilityManagerPriority(const AvailabilityManager& avm, unsigned priority) { | |
| 392 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::AvailabilityManagerAssignmentList_Impl>()->setAvailabilityManagerPriority(avm, priority); |
| 393 | } | ||
| 394 | |||
| 395 | 28 | boost::optional<Loop> AvailabilityManagerAssignmentList::loop() const { | |
| 396 |
1/1✓ Branch 3 taken 28 times.
|
28 | return getImpl<detail::AvailabilityManagerAssignmentList_Impl>()->loop(); |
| 397 | } | ||
| 398 | 2 | boost::optional<AirLoopHVAC> AvailabilityManagerAssignmentList::airLoopHVAC() const { | |
| 399 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::AvailabilityManagerAssignmentList_Impl>()->airLoopHVAC(); |
| 400 | } | ||
| 401 | 2 | boost::optional<PlantLoop> AvailabilityManagerAssignmentList::plantLoop() const { | |
| 402 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::AvailabilityManagerAssignmentList_Impl>()->plantLoop(); |
| 403 | } | ||
| 404 | ✗ | boost::optional<ZoneHVACComponent> AvailabilityManagerAssignmentList::containingZoneHVACComponent() const { | |
| 405 | ✗ | return getImpl<detail::AvailabilityManagerAssignmentList_Impl>()->containingZoneHVACComponent(); | |
| 406 | } | ||
| 407 | |||
| 408 | /// @cond | ||
| 409 | 1137 | AvailabilityManagerAssignmentList::AvailabilityManagerAssignmentList(std::shared_ptr<detail::AvailabilityManagerAssignmentList_Impl> impl) | |
| 410 |
1/1✓ Branch 2 taken 1137 times.
|
1137 | : ModelObject(impl) {} |
| 411 | /// @endcond | ||
| 412 | |||
| 413 | } // namespace model | ||
| 414 | } // namespace openstudio | ||
| 415 |