src/model/ZoneHVACEquipmentList.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 "ZoneHVACEquipmentList.hpp" | ||
| 7 | #include "ZoneHVACEquipmentList_Impl.hpp" | ||
| 8 | #include "ZoneHVACComponent.hpp" | ||
| 9 | #include "ZoneHVACComponent_Impl.hpp" | ||
| 10 | #include "ThermalZone.hpp" | ||
| 11 | #include "ThermalZone_Impl.hpp" | ||
| 12 | #include "ScheduleConstant.hpp" | ||
| 13 | #include "ScheduleConstant_Impl.hpp" | ||
| 14 | #include "Model.hpp" | ||
| 15 | |||
| 16 | #include <utilities/idd/IddFactory.hxx> | ||
| 17 | #include <utilities/idd/OS_ZoneHVAC_EquipmentList_FieldEnums.hxx> | ||
| 18 | #include <utilities/idd/IddEnums.hxx> | ||
| 19 | #include "../utilities/core/Assert.hpp" | ||
| 20 | #include "ModelExtensibleGroup.hpp" | ||
| 21 | |||
| 22 | namespace openstudio { | ||
| 23 | namespace model { | ||
| 24 | |||
| 25 | namespace detail { | ||
| 26 | |||
| 27 | 3741 | ZoneHVACEquipmentList_Impl::ZoneHVACEquipmentList_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 28 | 3741 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 29 |
4/6✓ Branch 1 taken 3741 times.
✓ Branch 4 taken 3741 times.
✓ Branch 7 taken 3741 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 3741 times.
✗ Branch 13 not taken.
|
3741 | OS_ASSERT(idfObject.iddObject().type() == ZoneHVACEquipmentList::iddObjectType()); |
| 30 | 3741 | } | |
| 31 | |||
| 32 | 1357 | ZoneHVACEquipmentList_Impl::ZoneHVACEquipmentList_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 33 | 1357 | : ModelObject_Impl(other, model, keepHandle) { | |
| 34 |
4/6✓ Branch 1 taken 1357 times.
✓ Branch 4 taken 1357 times.
✓ Branch 7 taken 1357 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1357 times.
✗ Branch 13 not taken.
|
1357 | OS_ASSERT(other.iddObject().type() == ZoneHVACEquipmentList::iddObjectType()); |
| 35 | 1357 | } | |
| 36 | |||
| 37 | 610 | ZoneHVACEquipmentList_Impl::ZoneHVACEquipmentList_Impl(const ZoneHVACEquipmentList_Impl& other, Model_Impl* model, bool keepHandle) | |
| 38 | 610 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 39 | |||
| 40 | 1 | const std::vector<std::string>& ZoneHVACEquipmentList_Impl::outputVariableNames() const { | |
| 41 |
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; |
| 42 | 1 | return result; | |
| 43 | } | ||
| 44 | |||
| 45 | 1 | IddObjectType ZoneHVACEquipmentList_Impl::iddObjectType() const { | |
| 46 | 1 | return ZoneHVACEquipmentList::iddObjectType(); | |
| 47 | } | ||
| 48 | |||
| 49 | ✗ | std::vector<ScheduleTypeKey> ZoneHVACEquipmentList_Impl::getScheduleTypeKeys(const Schedule& schedule) const { | |
| 50 | ✗ | std::vector<ScheduleTypeKey> result; | |
| 51 | |||
| 52 | // This is unusual, but the schedules here are in the Extensible Fields (and only there) | ||
| 53 | // UnsignedVector fieldIndices = getSourceIndices(schedule.handle()); | ||
| 54 | ✗ | UnsignedVector fieldIndices; | |
| 55 | ✗ | for (const ModelExtensibleGroup& group : castVector<ModelExtensibleGroup>(extensibleGroups())) { | |
| 56 | ✗ | UnsignedVector thisFieldIndices = group.getSourceFieldIndices(schedule.handle()); | |
| 57 | ✗ | fieldIndices.insert(fieldIndices.end(), thisFieldIndices.begin(), thisFieldIndices.end()); | |
| 58 | ✗ | } | |
| 59 | |||
| 60 | // Make unique, have to sort before calling unique, unique only works on consecutive elements | ||
| 61 | ✗ | std::sort(fieldIndices.begin(), fieldIndices.end()); | |
| 62 | ✗ | fieldIndices.erase(std::unique(fieldIndices.begin(), fieldIndices.end()), fieldIndices.end()); | |
| 63 | |||
| 64 | ✗ | UnsignedVector::const_iterator b(fieldIndices.begin()); | |
| 65 | ✗ | UnsignedVector::const_iterator e(fieldIndices.end()); | |
| 66 | ✗ | if (std::find(b, e, OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentSequentialCoolingFractionScheduleName) != e) { | |
| 67 | ✗ | result.push_back(ScheduleTypeKey("ZoneHVACEquipmentList", "Sequential Cooling Fraction")); | |
| 68 | } | ||
| 69 | ✗ | if (std::find(b, e, OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentSequentialHeatingFractionScheduleName) != e) { | |
| 70 | ✗ | result.push_back(ScheduleTypeKey("ZoneHVACEquipmentList", "Sequential Heating Fraction")); | |
| 71 | } | ||
| 72 | |||
| 73 | ✗ | return result; | |
| 74 | ✗ | } | |
| 75 | |||
| 76 | 435 | std::string ZoneHVACEquipmentList_Impl::loadDistributionScheme() const { | |
| 77 |
1/1✓ Branch 1 taken 435 times.
|
435 | auto value = getString(OS_ZoneHVAC_EquipmentListFields::LoadDistributionScheme, true); |
| 78 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 435 times.
✗ Branch 4 not taken.
|
435 | OS_ASSERT(value); |
| 79 |
2/2✓ Branch 1 taken 435 times.
✓ Branch 4 taken 435 times.
|
870 | return value.get(); |
| 80 | 435 | } | |
| 81 | |||
| 82 | 9 | bool ZoneHVACEquipmentList_Impl::setLoadDistributionScheme(const std::string& scheme) { | |
| 83 |
1/1✓ Branch 1 taken 9 times.
|
9 | auto thisScheme = scheme; |
| 84 | // Backward compat | ||
| 85 |
3/4✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 9 times.
|
18 | if (istringEqual(thisScheme, "Sequential")) { |
| 86 | ✗ | thisScheme = "SequentialLoad"; | |
| 87 |
3/4✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 9 times.
|
18 | } else if (istringEqual(thisScheme, "Uniform")) { |
| 88 | ✗ | thisScheme = "UniformLoad"; | |
| 89 | } | ||
| 90 | |||
| 91 | // Reset the Sequential Cooling/Heating fractions if not 'SequentialLoad' | ||
| 92 |
4/4✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 6 times.
✓ Branch 8 taken 3 times.
|
18 | if (!istringEqual(thisScheme, "SequentialLoad")) { |
| 93 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 7 taken 5 times.
✓ Branch 8 taken 6 times.
|
11 | for (IdfExtensibleGroup& eg : extensibleGroups()) { |
| 94 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
10 | eg.setString(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentSequentialCoolingFractionScheduleName, ""); |
| 95 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
10 | eg.setString(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentSequentialHeatingFractionScheduleName, ""); |
| 96 | // TODO: delete existing schedule(s) if not tied to anything else | ||
| 97 | 6 | } | |
| 98 | } | ||
| 99 | |||
| 100 |
1/1✓ Branch 1 taken 9 times.
|
18 | return setString(OS_ZoneHVAC_EquipmentListFields::LoadDistributionScheme, thisScheme); |
| 101 | 9 | } | |
| 102 | |||
| 103 | 447 | bool ZoneHVACEquipmentList_Impl::addEquipment(const ModelObject& equipment) { | |
| 104 | |||
| 105 | // Get max priorities before pushing an extensible group | ||
| 106 |
1/1✓ Branch 1 taken 447 times.
|
447 | unsigned heatingCount = this->equipmentInHeatingOrder().size(); |
| 107 |
1/1✓ Branch 1 taken 447 times.
|
447 | unsigned coolingCount = this->equipmentInCoolingOrder().size(); |
| 108 | |||
| 109 |
3/3✓ Branch 1 taken 447 times.
✓ Branch 4 taken 447 times.
✓ Branch 7 taken 447 times.
|
447 | auto eg = getObject<ModelObject>().pushExtensibleGroup().cast<ModelExtensibleGroup>(); |
| 110 | |||
| 111 |
2/2✓ Branch 1 taken 447 times.
✓ Branch 4 taken 447 times.
|
447 | bool ok = eg.setPointer(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipment, equipment.handle()); |
| 112 | |||
| 113 |
1/2✓ Branch 0 taken 447 times.
✗ Branch 1 not taken.
|
447 | if (ok) { |
| 114 |
1/1✓ Branch 1 taken 447 times.
|
447 | eg.setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentCoolingSequence, coolingCount + 1); |
| 115 |
1/1✓ Branch 1 taken 447 times.
|
447 | eg.setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentHeatingorNoLoadSequence, heatingCount + 1); |
| 116 | } else { | ||
| 117 | ✗ | getObject<ModelObject>().eraseExtensibleGroup(eg.groupIndex()); | |
| 118 | } | ||
| 119 | 447 | return ok; | |
| 120 | 447 | } | |
| 121 | |||
| 122 | 34 | bool ZoneHVACEquipmentList_Impl::setCoolingPriority(const ModelObject& equipment, unsigned priority) { | |
| 123 |
1/1✓ Branch 1 taken 34 times.
|
34 | std::vector<ModelObject> equipmentVector = equipmentInCoolingOrder(); |
| 124 | |||
| 125 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 33 times.
|
34 | if (priority > equipmentVector.size()) { |
| 126 | 1 | priority = equipmentVector.size(); | |
| 127 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
|
33 | } else if (priority < 1) { |
| 128 | // TODO: Temp, until E+ actually allows zero priority (=unavailable) like the IDD seems to indicate | ||
| 129 | ✗ | priority = 1; | |
| 130 | } | ||
| 131 | |||
| 132 |
1/1✓ Branch 1 taken 34 times.
|
34 | boost::optional<ModelExtensibleGroup> _eg = getGroupForModelObject(equipment); |
| 133 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 33 times.
|
34 | if (!_eg) { |
| 134 |
7/7✓ 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.
|
1 | LOG(Warn, "Cannot set cooling priority of an equipment that isn't in the ZoneHVACEquipmentList for " << briefDescription()); |
| 135 | 1 | return false; | |
| 136 | } else { | ||
| 137 | // Set the priority of this one, in case we actually put it to zero | ||
| 138 |
2/2✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
|
33 | bool success = _eg->setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentCoolingSequence, priority); |
| 139 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
✗ Branch 3 not taken.
|
33 | OS_ASSERT(success); |
| 140 | } | ||
| 141 | |||
| 142 |
2/2✓ Branch 3 taken 33 times.
✓ Branch 7 taken 33 times.
|
33 | equipmentVector.erase(std::find(equipmentVector.begin(), equipmentVector.end(), equipment)); |
| 143 | |||
| 144 | // If supplied priority isn't zero, we have to insert it where it belongs | ||
| 145 |
1/2✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
|
33 | if (priority > 0) { |
| 146 |
1/1✓ Branch 4 taken 33 times.
|
33 | equipmentVector.insert(equipmentVector.begin() + (priority - 1), equipment); |
| 147 | } else { | ||
| 148 | // If zero, we just remove it from the list of available equipment (no insertion needed now) | ||
| 149 | // and we reset the Sequential Cooling Fraction | ||
| 150 | ✗ | _eg->setString(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentSequentialCoolingFractionScheduleName, ""); | |
| 151 | // TODO: delete existing schedule(s) if not tied to anything else | ||
| 152 | } | ||
| 153 | |||
| 154 | 33 | unsigned newPriority = 1; | |
| 155 | |||
| 156 |
2/2✓ Branch 5 taken 37 times.
✓ Branch 6 taken 33 times.
|
70 | for (const auto& equipment : equipmentVector) { |
| 157 |
1/1✓ Branch 1 taken 37 times.
|
37 | boost::optional<ModelExtensibleGroup> eg = getGroupForModelObject(equipment); |
| 158 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
✗ Branch 4 not taken.
|
37 | OS_ASSERT(eg); |
| 159 |
2/2✓ Branch 1 taken 37 times.
✓ Branch 4 taken 37 times.
|
37 | eg->setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentCoolingSequence, newPriority); |
| 160 | |||
| 161 | 37 | newPriority++; | |
| 162 | 37 | } | |
| 163 | 33 | return true; | |
| 164 | 34 | } | |
| 165 | |||
| 166 | 36 | bool ZoneHVACEquipmentList_Impl::setHeatingPriority(const ModelObject& equipment, unsigned priority) { | |
| 167 |
1/1✓ Branch 1 taken 36 times.
|
36 | std::vector<ModelObject> equipmentVector = equipmentInHeatingOrder(); |
| 168 | |||
| 169 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 35 times.
|
36 | if (priority > equipmentVector.size()) { |
| 170 | 1 | priority = equipmentVector.size(); | |
| 171 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 33 times.
|
35 | } else if (priority < 1) { |
| 172 | // TODO: Temp, until E+ actually allows zero priority (=unavailable) like the IDD seems to indicate | ||
| 173 | 2 | priority = 1; | |
| 174 | } | ||
| 175 |
1/1✓ Branch 1 taken 36 times.
|
36 | boost::optional<ModelExtensibleGroup> _eg = getGroupForModelObject(equipment); |
| 176 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 35 times.
|
36 | if (!_eg) { |
| 177 |
7/7✓ 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.
|
1 | LOG(Warn, "Cannot set Heating priority of an equipment that isn't in the ZoneHVACEquipmentList for " << briefDescription()); |
| 178 | 1 | return false; | |
| 179 | } else { | ||
| 180 | // Set the priority of this one, in case we actually put it to zero | ||
| 181 |
2/2✓ Branch 1 taken 35 times.
✓ Branch 4 taken 35 times.
|
35 | bool success = _eg->setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentHeatingorNoLoadSequence, priority); |
| 182 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
✗ Branch 3 not taken.
|
35 | OS_ASSERT(success); |
| 183 | } | ||
| 184 | |||
| 185 |
2/2✓ Branch 3 taken 35 times.
✓ Branch 7 taken 35 times.
|
35 | equipmentVector.erase(std::find(equipmentVector.begin(), equipmentVector.end(), equipment)); |
| 186 | |||
| 187 | // If supplied priority isn't zero, we have to insert it where it belongs | ||
| 188 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if (priority > 0) { |
| 189 |
1/1✓ Branch 4 taken 35 times.
|
35 | equipmentVector.insert(equipmentVector.begin() + (priority - 1), equipment); |
| 190 | } else { | ||
| 191 | // If zero, we just remove it from the list of available equipment (no insertion needed now) | ||
| 192 | // and we reset the Sequential Heating Fraction | ||
| 193 | ✗ | _eg->setString(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentSequentialHeatingFractionScheduleName, ""); | |
| 194 | // TODO: delete existing schedule(s) if not tied to anything else | ||
| 195 | } | ||
| 196 | |||
| 197 | 35 | unsigned newPriority = 1; | |
| 198 | |||
| 199 |
2/2✓ Branch 5 taken 39 times.
✓ Branch 6 taken 35 times.
|
74 | for (const auto& equipment : equipmentVector) { |
| 200 |
1/1✓ Branch 1 taken 39 times.
|
39 | boost::optional<ModelExtensibleGroup> eg = getGroupForModelObject(equipment); |
| 201 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
✗ Branch 4 not taken.
|
39 | OS_ASSERT(eg); |
| 202 |
2/2✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
|
39 | eg->setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentHeatingorNoLoadSequence, newPriority); |
| 203 | |||
| 204 | 39 | newPriority++; | |
| 205 | 39 | } | |
| 206 | 35 | return true; | |
| 207 | 36 | } | |
| 208 | |||
| 209 | 454 | boost::optional<ModelExtensibleGroup> ZoneHVACEquipmentList_Impl::getGroupForModelObject(const ModelObject& modelObject) const { | |
| 210 | 454 | boost::optional<ModelExtensibleGroup> result; | |
| 211 | |||
| 212 |
1/1✓ Branch 1 taken 454 times.
|
454 | std::vector<IdfExtensibleGroup> groups = extensibleGroups(); |
| 213 | |||
| 214 |
2/2✓ Branch 5 taken 527 times.
✓ Branch 6 taken 6 times.
|
533 | for (const auto& group : groups) { |
| 215 |
2/2✓ Branch 1 taken 527 times.
✓ Branch 4 taken 527 times.
|
527 | boost::optional<WorkspaceObject> wo = group.cast<ModelExtensibleGroup>().getTarget(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipment); |
| 216 | |||
| 217 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 527 times.
✗ Branch 4 not taken.
|
527 | OS_ASSERT(wo); |
| 218 | |||
| 219 |
6/6✓ Branch 1 taken 527 times.
✓ Branch 4 taken 527 times.
✓ Branch 7 taken 527 times.
✓ Branch 10 taken 527 times.
✓ Branch 12 taken 448 times.
✓ Branch 13 taken 79 times.
|
527 | if (wo->handle() == modelObject.handle()) { |
| 220 |
2/2✓ Branch 1 taken 448 times.
✓ Branch 4 taken 448 times.
|
448 | result = group.cast<ModelExtensibleGroup>(); |
| 221 | |||
| 222 | 448 | break; | |
| 223 | } | ||
| 224 | 527 | } | |
| 225 | |||
| 226 | 908 | return result; | |
| 227 | 454 | } | |
| 228 | |||
| 229 | 1217 | std::vector<ModelObject> ZoneHVACEquipmentList_Impl::equipment() const { | |
| 230 | 1217 | std::vector<ModelObject> result; | |
| 231 | |||
| 232 |
1/1✓ Branch 1 taken 1217 times.
|
1217 | std::vector<IdfExtensibleGroup> groups = extensibleGroups(); |
| 233 | |||
| 234 |
2/2✓ Branch 5 taken 701 times.
✓ Branch 6 taken 1217 times.
|
1918 | for (const auto& group : groups) { |
| 235 |
2/2✓ Branch 1 taken 701 times.
✓ Branch 4 taken 701 times.
|
701 | boost::optional<WorkspaceObject> wo = group.cast<ModelExtensibleGroup>().getTarget(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipment); |
| 236 | |||
| 237 |
1/2✓ Branch 0 taken 701 times.
✗ Branch 1 not taken.
|
701 | if (wo) { |
| 238 |
3/3✓ Branch 1 taken 701 times.
✓ Branch 4 taken 701 times.
✓ Branch 7 taken 701 times.
|
701 | result.push_back(wo->cast<ModelObject>()); |
| 239 | } | ||
| 240 | 701 | } | |
| 241 | |||
| 242 | 2434 | return result; | |
| 243 | 1217 | } | |
| 244 | |||
| 245 | 678 | std::vector<ModelObject> ZoneHVACEquipmentList_Impl::equipmentInHeatingOrder() const { | |
| 246 | 678 | std::map<unsigned, ModelObject> equipmentMap; | |
| 247 | |||
| 248 |
1/1✓ Branch 1 taken 678 times.
|
678 | std::vector<IdfExtensibleGroup> groups = extensibleGroups(); |
| 249 | |||
| 250 |
2/2✓ Branch 5 taken 278 times.
✓ Branch 6 taken 678 times.
|
956 | for (const auto& group : groups) { |
| 251 |
2/2✓ Branch 1 taken 278 times.
✓ Branch 4 taken 278 times.
|
278 | unsigned heatingPriority = group.getUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentHeatingorNoLoadSequence).get(); |
| 252 | |||
| 253 | // Filter out equipment having a priority of 0 (=unavailable for heating) | ||
| 254 |
1/2✓ Branch 0 taken 278 times.
✗ Branch 1 not taken.
|
278 | if (heatingPriority > 0) { |
| 255 | boost::optional<WorkspaceObject> wo = | ||
| 256 |
2/2✓ Branch 1 taken 278 times.
✓ Branch 4 taken 278 times.
|
278 | group.cast<ModelExtensibleGroup>().getTarget(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipment); |
| 257 | |||
| 258 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 278 times.
✗ Branch 4 not taken.
|
278 | OS_ASSERT(wo); |
| 259 | |||
| 260 |
2/2✓ Branch 1 taken 278 times.
✓ Branch 4 taken 278 times.
|
278 | auto mo = wo->cast<ModelObject>(); |
| 261 | |||
| 262 |
2/2✓ Branch 1 taken 278 times.
✓ Branch 4 taken 278 times.
|
278 | equipmentMap.insert(std::make_pair(heatingPriority, mo)); |
| 263 | 278 | } | |
| 264 | } | ||
| 265 | |||
| 266 | 678 | std::vector<ModelObject> equipmentVector; | |
| 267 | |||
| 268 |
2/2✓ Branch 1 taken 278 times.
✓ Branch 2 taken 678 times.
|
956 | for (unsigned i = 1; i <= equipmentMap.size(); i++) { |
| 269 |
2/2✓ Branch 1 taken 278 times.
✓ Branch 5 taken 278 times.
|
278 | ModelObject mo = equipmentMap.find(i)->second; |
| 270 | |||
| 271 |
1/1✓ Branch 1 taken 278 times.
|
278 | equipmentVector.push_back(mo); |
| 272 | 278 | } | |
| 273 | |||
| 274 | 1356 | return equipmentVector; | |
| 275 | 678 | } | |
| 276 | |||
| 277 | 676 | std::vector<ModelObject> ZoneHVACEquipmentList_Impl::equipmentInCoolingOrder() const { | |
| 278 | 676 | std::map<unsigned, ModelObject> equipmentMap; | |
| 279 | |||
| 280 |
1/1✓ Branch 1 taken 676 times.
|
676 | std::vector<IdfExtensibleGroup> groups = extensibleGroups(); |
| 281 | |||
| 282 |
2/2✓ Branch 5 taken 280 times.
✓ Branch 6 taken 676 times.
|
956 | for (const auto& group : groups) { |
| 283 |
2/2✓ Branch 1 taken 280 times.
✓ Branch 4 taken 280 times.
|
280 | unsigned coolingPriority = group.getUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentCoolingSequence).get(); |
| 284 | |||
| 285 | // Filter out equipment having a priority of 0 (=unavailable for cooling) | ||
| 286 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if (coolingPriority > 0) { |
| 287 | |||
| 288 | boost::optional<WorkspaceObject> wo = | ||
| 289 |
2/2✓ Branch 1 taken 280 times.
✓ Branch 4 taken 280 times.
|
280 | group.cast<ModelExtensibleGroup>().getTarget(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipment); |
| 290 | |||
| 291 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 280 times.
✗ Branch 4 not taken.
|
280 | OS_ASSERT(wo); |
| 292 | |||
| 293 |
2/2✓ Branch 1 taken 280 times.
✓ Branch 4 taken 280 times.
|
280 | auto mo = wo->cast<ModelObject>(); |
| 294 | |||
| 295 |
2/2✓ Branch 1 taken 280 times.
✓ Branch 4 taken 280 times.
|
280 | equipmentMap.insert(std::make_pair(coolingPriority, mo)); |
| 296 | 280 | } | |
| 297 | } | ||
| 298 | |||
| 299 | 676 | std::vector<ModelObject> equipmentVector; | |
| 300 | |||
| 301 |
2/2✓ Branch 1 taken 280 times.
✓ Branch 2 taken 676 times.
|
956 | for (unsigned i = 1; i <= equipmentMap.size(); i++) { |
| 302 |
2/2✓ Branch 1 taken 280 times.
✓ Branch 5 taken 280 times.
|
280 | ModelObject mo = equipmentMap.find(i)->second; |
| 303 | |||
| 304 |
1/1✓ Branch 1 taken 280 times.
|
280 | equipmentVector.push_back(mo); |
| 305 | 280 | } | |
| 306 | |||
| 307 | 1352 | return equipmentVector; | |
| 308 | 676 | } | |
| 309 | |||
| 310 | 2558 | ThermalZone ZoneHVACEquipmentList_Impl::thermalZone() const { | |
| 311 |
1/1✓ Branch 1 taken 2558 times.
|
2558 | boost::optional<WorkspaceObject> wo = getTarget(OS_ZoneHVAC_EquipmentListFields::ThermalZone); |
| 312 | |||
| 313 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 2558 times.
✗ Branch 4 not taken.
|
2558 | OS_ASSERT(wo); |
| 314 | |||
| 315 |
2/2✓ Branch 1 taken 2558 times.
✓ Branch 4 taken 2558 times.
|
5116 | return wo->cast<ThermalZone>(); |
| 316 | 2558 | } | |
| 317 | |||
| 318 | 65 | bool ZoneHVACEquipmentList_Impl::removeEquipment(const ModelObject& equipment) { | |
| 319 | 65 | bool result = false; | |
| 320 | |||
| 321 |
1/1✓ Branch 1 taken 65 times.
|
65 | std::vector<ModelObject> coolingVector = equipmentInCoolingOrder(); |
| 322 |
1/1✓ Branch 1 taken 65 times.
|
65 | std::vector<ModelObject> heatingVector = equipmentInHeatingOrder(); |
| 323 | |||
| 324 |
1/1✓ Branch 1 taken 65 times.
|
65 | std::vector<IdfExtensibleGroup> groups = extensibleGroups(); |
| 325 | |||
| 326 |
1/2✓ Branch 5 taken 67 times.
✗ Branch 6 not taken.
|
67 | for (const auto& group : groups) { |
| 327 |
2/2✓ Branch 1 taken 67 times.
✓ Branch 4 taken 67 times.
|
67 | boost::optional<WorkspaceObject> wo = group.cast<ModelExtensibleGroup>().getTarget(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipment); |
| 328 | |||
| 329 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 67 times.
✗ Branch 4 not taken.
|
67 | OS_ASSERT(wo); |
| 330 | |||
| 331 |
6/6✓ Branch 1 taken 67 times.
✓ Branch 4 taken 67 times.
✓ Branch 7 taken 67 times.
✓ Branch 10 taken 67 times.
✓ Branch 12 taken 65 times.
✓ Branch 13 taken 2 times.
|
67 | if (wo->handle() == equipment.handle()) { |
| 332 |
3/3✓ Branch 1 taken 65 times.
✓ Branch 4 taken 65 times.
✓ Branch 7 taken 65 times.
|
65 | getObject<ModelObject>().eraseExtensibleGroup(group.groupIndex()); |
| 333 | // Found it | ||
| 334 | 65 | result = true; | |
| 335 | 65 | break; | |
| 336 | } | ||
| 337 | 67 | } | |
| 338 | |||
| 339 |
2/2✓ Branch 3 taken 65 times.
✓ Branch 7 taken 65 times.
|
65 | coolingVector.erase(std::find(coolingVector.begin(), coolingVector.end(), equipment)); |
| 340 |
2/2✓ Branch 3 taken 65 times.
✓ Branch 7 taken 65 times.
|
65 | heatingVector.erase(std::find(heatingVector.begin(), heatingVector.end(), equipment)); |
| 341 | |||
| 342 | 65 | unsigned priority = 1; | |
| 343 | |||
| 344 |
2/2✓ Branch 5 taken 5 times.
✓ Branch 6 taken 65 times.
|
70 | for (const auto& elem : coolingVector) { |
| 345 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<ModelExtensibleGroup> eg = getGroupForModelObject(elem); |
| 346 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(eg); |
| 347 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | eg->setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentCoolingSequence, priority); |
| 348 | |||
| 349 | 5 | priority++; | |
| 350 | 5 | } | |
| 351 | |||
| 352 | 65 | priority = 1; | |
| 353 | |||
| 354 |
2/2✓ Branch 5 taken 5 times.
✓ Branch 6 taken 65 times.
|
70 | for (const auto& elem : heatingVector) { |
| 355 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<ModelExtensibleGroup> eg = getGroupForModelObject(elem); |
| 356 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(eg); |
| 357 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | eg->setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentHeatingorNoLoadSequence, priority); |
| 358 | |||
| 359 | 5 | priority++; | |
| 360 | 5 | } | |
| 361 | |||
| 362 | 65 | return result; | |
| 363 | 65 | } | |
| 364 | |||
| 365 | 142 | unsigned ZoneHVACEquipmentList_Impl::heatingPriority(const ModelObject& equipment) const { | |
| 366 | 142 | boost::optional<unsigned> result; | |
| 367 | |||
| 368 |
1/1✓ Branch 1 taken 142 times.
|
142 | boost::optional<ModelExtensibleGroup> _eg = getGroupForModelObject(equipment); |
| 369 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 141 times.
|
142 | if (!_eg) { |
| 370 |
7/7✓ 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.
|
1 | LOG(Warn, "Cannot get Heating Priority of an equipment that isn't in the ZoneHVACEquipmentList for " << briefDescription()); |
| 371 | 1 | return 0; | |
| 372 | } else { | ||
| 373 |
2/2✓ Branch 1 taken 141 times.
✓ Branch 4 taken 141 times.
|
141 | result = _eg->getUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentHeatingorNoLoadSequence); |
| 374 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 141 times.
✗ Branch 4 not taken.
|
141 | OS_ASSERT(result); |
| 375 | |||
| 376 |
1/1✓ Branch 1 taken 141 times.
|
141 | return result.get(); |
| 377 | } | ||
| 378 | 142 | } | |
| 379 | |||
| 380 | 146 | unsigned ZoneHVACEquipmentList_Impl::coolingPriority(const ModelObject& equipment) const { | |
| 381 | 146 | boost::optional<unsigned> result; | |
| 382 | |||
| 383 |
1/1✓ Branch 1 taken 146 times.
|
146 | boost::optional<ModelExtensibleGroup> _eg = getGroupForModelObject(equipment); |
| 384 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 145 times.
|
146 | if (!_eg) { |
| 385 |
7/7✓ 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.
|
1 | LOG(Warn, "Cannot get Cooling Priority of an equipment that isn't in the ZoneHVACEquipmentList for " << briefDescription()); |
| 386 | 1 | return 0; | |
| 387 | } else { | ||
| 388 |
2/2✓ Branch 1 taken 145 times.
✓ Branch 4 taken 145 times.
|
145 | result = _eg->getUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentCoolingSequence); |
| 389 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 145 times.
✗ Branch 4 not taken.
|
145 | OS_ASSERT(result); |
| 390 | |||
| 391 |
1/1✓ Branch 1 taken 145 times.
|
145 | return result.get(); |
| 392 | } | ||
| 393 | 146 | } | |
| 394 | |||
| 395 | 149 | boost::optional<Schedule> ZoneHVACEquipmentList_Impl::sequentialCoolingFractionSchedule(const ModelObject& equipment) const { | |
| 396 | |||
| 397 | 149 | boost::optional<Schedule> result; | |
| 398 | |||
| 399 |
13/22✓ Branch 1 taken 149 times.
✓ Branch 4 taken 149 times.
✓ Branch 7 taken 149 times.
✓ Branch 9 taken 142 times.
✓ Branch 10 taken 7 times.
✓ Branch 12 taken 142 times.
✓ Branch 14 taken 141 times.
✓ Branch 15 taken 1 time.
✓ Branch 16 taken 149 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 149 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 149 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 141 times.
✓ Branch 25 taken 8 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
|
447 | if ((openstudio::istringEqual(loadDistributionScheme(), "SequentialLoad")) && (coolingPriority(equipment) > 0)) { |
| 400 | |||
| 401 |
1/1✓ Branch 1 taken 141 times.
|
141 | std::vector<IdfExtensibleGroup> groups = extensibleGroups(); |
| 402 | |||
| 403 |
2/2✓ Branch 5 taken 178 times.
✓ Branch 6 taken 133 times.
|
311 | for (const auto& group : groups) { |
| 404 | boost::optional<WorkspaceObject> wo = | ||
| 405 |
2/2✓ Branch 1 taken 178 times.
✓ Branch 4 taken 178 times.
|
178 | group.cast<ModelExtensibleGroup>().getTarget(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipment); |
| 406 | |||
| 407 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 178 times.
✗ Branch 4 not taken.
|
178 | OS_ASSERT(wo); |
| 408 | |||
| 409 |
6/6✓ Branch 1 taken 178 times.
✓ Branch 4 taken 178 times.
✓ Branch 7 taken 178 times.
✓ Branch 10 taken 178 times.
✓ Branch 12 taken 141 times.
✓ Branch 13 taken 37 times.
|
178 | if (wo->handle() == equipment.handle()) { |
| 410 |
1/1✓ Branch 1 taken 141 times.
|
282 | boost::optional<WorkspaceObject> wo2 = group.cast<ModelExtensibleGroup>().getTarget( |
| 411 |
1/1✓ Branch 1 taken 141 times.
|
141 | OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentSequentialCoolingFractionScheduleName); |
| 412 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 133 times.
|
141 | if (wo2) { |
| 413 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | result = wo2->optionalCast<Schedule>(); |
| 414 | 8 | break; | |
| 415 | } | ||
| 416 | 141 | } | |
| 417 | 178 | } | |
| 418 | 141 | } | |
| 419 | |||
| 420 | 149 | return result; | |
| 421 | ✗ | } | |
| 422 | |||
| 423 | 147 | boost::optional<Schedule> ZoneHVACEquipmentList_Impl::sequentialHeatingFractionSchedule(const ModelObject& equipment) const { | |
| 424 | |||
| 425 | 147 | boost::optional<Schedule> result; | |
| 426 | |||
| 427 |
13/22✓ Branch 1 taken 147 times.
✓ Branch 4 taken 147 times.
✓ Branch 7 taken 147 times.
✓ Branch 9 taken 140 times.
✓ Branch 10 taken 7 times.
✓ Branch 12 taken 140 times.
✓ Branch 14 taken 139 times.
✓ Branch 15 taken 1 time.
✓ Branch 16 taken 147 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 147 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 147 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 139 times.
✓ Branch 25 taken 8 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
|
441 | if ((openstudio::istringEqual(loadDistributionScheme(), "SequentialLoad")) && (heatingPriority(equipment) > 0)) { |
| 428 | |||
| 429 |
1/1✓ Branch 1 taken 139 times.
|
139 | std::vector<IdfExtensibleGroup> groups = extensibleGroups(); |
| 430 | |||
| 431 |
2/2✓ Branch 5 taken 177 times.
✓ Branch 6 taken 133 times.
|
310 | for (const auto& group : groups) { |
| 432 | boost::optional<WorkspaceObject> wo = | ||
| 433 |
2/2✓ Branch 1 taken 177 times.
✓ Branch 4 taken 177 times.
|
177 | group.cast<ModelExtensibleGroup>().getTarget(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipment); |
| 434 | |||
| 435 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 177 times.
✗ Branch 4 not taken.
|
177 | OS_ASSERT(wo); |
| 436 | |||
| 437 |
6/6✓ Branch 1 taken 177 times.
✓ Branch 4 taken 177 times.
✓ Branch 7 taken 177 times.
✓ Branch 10 taken 177 times.
✓ Branch 12 taken 139 times.
✓ Branch 13 taken 38 times.
|
177 | if (wo->handle() == equipment.handle()) { |
| 438 |
1/1✓ Branch 1 taken 139 times.
|
278 | boost::optional<WorkspaceObject> wo2 = group.cast<ModelExtensibleGroup>().getTarget( |
| 439 |
1/1✓ Branch 1 taken 139 times.
|
139 | OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentSequentialHeatingFractionScheduleName); |
| 440 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 133 times.
|
139 | if (wo2) { |
| 441 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | result = wo2->optionalCast<Schedule>(); |
| 442 | 6 | break; | |
| 443 | } | ||
| 444 | 139 | } | |
| 445 | 177 | } | |
| 446 | 139 | } | |
| 447 | |||
| 448 | 147 | return result; | |
| 449 | ✗ | } | |
| 450 | |||
| 451 | 6 | bool ZoneHVACEquipmentList_Impl::setSequentialCoolingFractionSchedule(const ModelObject& equipment, Schedule& schedule) { | |
| 452 |
4/5✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 6 times.
|
6 | if (schedule.model() != model()) { |
| 453 | ✗ | LOG(Info, "Cannot set Sequential Cooling Fraction for equipment " << equipment.nameString() | |
| 454 | << " with a schedule that isn't part of the same model."); | ||
| 455 | ✗ | return false; | |
| 456 | } | ||
| 457 | |||
| 458 |
1/1✓ Branch 1 taken 6 times.
|
6 | boost::optional<ModelExtensibleGroup> eg = getGroupForModelObject(equipment); |
| 459 | |||
| 460 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 5 times.
|
6 | if (!eg) { |
| 461 |
8/8✓ 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 17 taken 1 time.
✓ Branch 20 taken 1 time.
✓ Branch 23 taken 1 time.
|
1 | LOG(Info, |
| 462 | "Cannot set Sequential Cooling Fraction for equipment " << equipment.nameString() << " that isn't part of the ZoneHVACEquipmentList."); | ||
| 463 | 1 | return false; | |
| 464 | } | ||
| 465 |
5/5✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 4 times.
|
10 | if (!openstudio::istringEqual(loadDistributionScheme(), "SequentialLoad")) { |
| 466 |
5/5✓ 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.
|
1 | LOG(Info, "Cannot set Sequential Cooling Fraction for a Load Distribution Scheme other than 'SequentialLoad'"); |
| 467 | 1 | return false; | |
| 468 | } | ||
| 469 | |||
| 470 |
2/3✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
|
4 | if (coolingPriority(equipment) == 0) { |
| 471 | ✗ | LOG(Info, "Cannot set Sequential Cooling Fraction for an equipment that doesn't have a cooling priority strictly greater than zero."); | |
| 472 | ✗ | return false; | |
| 473 | } | ||
| 474 | |||
| 475 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
16 | bool result = eg->setSchedule(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentSequentialCoolingFractionScheduleName, |
| 476 | "ZoneHVACEquipmentList", "Sequential Cooling Fraction", schedule); | ||
| 477 | 4 | return result; | |
| 478 | 6 | } | |
| 479 | |||
| 480 | 4 | bool ZoneHVACEquipmentList_Impl::setSequentialHeatingFractionSchedule(const ModelObject& equipment, Schedule& schedule) { | |
| 481 |
4/5✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4 times.
|
4 | if (schedule.model() != model()) { |
| 482 | ✗ | LOG(Info, "Cannot set Sequential Cooling Fraction for equipment " << equipment.nameString() | |
| 483 | << " with a schedule that isn't part of the same model."); | ||
| 484 | ✗ | return false; | |
| 485 | } | ||
| 486 | |||
| 487 |
1/1✓ Branch 1 taken 4 times.
|
4 | boost::optional<ModelExtensibleGroup> eg = getGroupForModelObject(equipment); |
| 488 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 3 times.
|
4 | if (!eg) { |
| 489 |
8/8✓ 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 17 taken 1 time.
✓ Branch 20 taken 1 time.
✓ Branch 23 taken 1 time.
|
1 | LOG(Info, |
| 490 | "Cannot set Sequential Heating Fraction for equipment " << equipment.nameString() << " that isn't part of the ZoneHVACEquipmentList."); | ||
| 491 | 1 | return false; | |
| 492 | } | ||
| 493 |
5/5✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 2 times.
|
6 | if (!openstudio::istringEqual(loadDistributionScheme(), "SequentialLoad")) { |
| 494 |
5/5✓ 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.
|
1 | LOG(Info, "Cannot set Sequential Heating Fraction for a Load Distribution Scheme other than 'SequentialLoad'"); |
| 495 | 1 | return false; | |
| 496 | } | ||
| 497 | |||
| 498 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
|
2 | if (heatingPriority(equipment) == 0) { |
| 499 | ✗ | LOG(Info, "Cannot set Sequential Heating Fraction for an equipment that doesn't have a heating priority strictly greater than zero."); | |
| 500 | ✗ | return false; | |
| 501 | } | ||
| 502 | |||
| 503 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
8 | bool result = eg->setSchedule(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentSequentialHeatingFractionScheduleName, |
| 504 | "ZoneHVACEquipmentList", "Sequential Heating Fraction", schedule); | ||
| 505 | 2 | return result; | |
| 506 | 4 | } | |
| 507 | |||
| 508 | // Deprecated | ||
| 509 | |||
| 510 | ✗ | boost::optional<double> ZoneHVACEquipmentList_Impl::sequentialCoolingFraction(const ModelObject& equipment) const { | |
| 511 | |||
| 512 | ✗ | boost::optional<double> result; | |
| 513 | |||
| 514 | ✗ | if (boost::optional<Schedule> _schedule = sequentialCoolingFractionSchedule(equipment)) { | |
| 515 | ✗ | if (boost::optional<ScheduleConstant> _schConstant = _schedule->optionalCast<ScheduleConstant>()) { | |
| 516 | ✗ | result = boost::optional<double>(_schConstant->value()); | |
| 517 | } else { | ||
| 518 | ✗ | LOG(Warn, "This deprecated method cannot return a double when the " | |
| 519 | "'Zone Equipment Sequential Cooling Fraction Schedule' isn't a Schedule:Constant, " | ||
| 520 | "here the schedule is a '" | ||
| 521 | << _schedule->iddObject().name() << ". Occurred for " << briefDescription()); | ||
| 522 | ✗ | } | |
| 523 | ✗ | } | |
| 524 | |||
| 525 | ✗ | return result; | |
| 526 | } | ||
| 527 | |||
| 528 | ✗ | boost::optional<double> ZoneHVACEquipmentList_Impl::sequentialHeatingFraction(const ModelObject& equipment) const { | |
| 529 | |||
| 530 | ✗ | boost::optional<double> result; | |
| 531 | |||
| 532 | ✗ | if (boost::optional<Schedule> _schedule = sequentialHeatingFractionSchedule(equipment)) { | |
| 533 | ✗ | if (boost::optional<ScheduleConstant> _schConstant = _schedule->optionalCast<ScheduleConstant>()) { | |
| 534 | ✗ | result = boost::optional<double>(_schConstant->value()); | |
| 535 | } else { | ||
| 536 | ✗ | LOG(Warn, "This deprecated method cannot return a double when the " | |
| 537 | "'Zone Equipment Sequential Heating Fraction Schedule' isn't a Schedule:Constant, " | ||
| 538 | "here the schedule is a '" | ||
| 539 | << _schedule->iddObject().name() << ". Occurred for " << briefDescription()); | ||
| 540 | ✗ | } | |
| 541 | ✗ | } | |
| 542 | |||
| 543 | ✗ | return result; | |
| 544 | } | ||
| 545 | |||
| 546 | ✗ | bool ZoneHVACEquipmentList_Impl::setSequentialCoolingFraction(const ModelObject& equipment, double fraction) { | |
| 547 | ✗ | Model model = this->model(); | |
| 548 | ✗ | ScheduleConstant schedule(model); | |
| 549 | ✗ | schedule.setValue(fraction); | |
| 550 | |||
| 551 | ✗ | return setSequentialCoolingFractionSchedule(equipment, schedule); | |
| 552 | ✗ | } | |
| 553 | |||
| 554 | ✗ | bool ZoneHVACEquipmentList_Impl::setSequentialHeatingFraction(const ModelObject& equipment, double fraction) { | |
| 555 | ✗ | Model model = this->model(); | |
| 556 | ✗ | ScheduleConstant schedule(model); | |
| 557 | ✗ | schedule.setValue(fraction); | |
| 558 | |||
| 559 | ✗ | return setSequentialHeatingFractionSchedule(equipment, schedule); | |
| 560 | ✗ | } | |
| 561 | |||
| 562 | } // namespace detail | ||
| 563 | |||
| 564 | 2383 | ZoneHVACEquipmentList::ZoneHVACEquipmentList(const ThermalZone& thermalZone) | |
| 565 |
3/3✓ Branch 1 taken 2383 times.
✓ Branch 4 taken 2383 times.
✓ Branch 7 taken 2383 times.
|
2383 | : ModelObject(ZoneHVACEquipmentList::iddObjectType(), thermalZone.model()) { |
| 566 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 2383 times.
✗ Branch 5 not taken.
|
2383 | OS_ASSERT(getImpl<detail::ZoneHVACEquipmentList_Impl>()); |
| 567 | |||
| 568 |
2/2✓ Branch 1 taken 2383 times.
✓ Branch 4 taken 2383 times.
|
2383 | setPointer(OS_ZoneHVAC_EquipmentListFields::ThermalZone, thermalZone.handle()); |
| 569 | 2383 | } | |
| 570 | |||
| 571 | 17646 | IddObjectType ZoneHVACEquipmentList::iddObjectType() { | |
| 572 |
1/1✓ Branch 1 taken 17646 times.
|
17646 | return {IddObjectType::OS_ZoneHVAC_EquipmentList}; |
| 573 | } | ||
| 574 | |||
| 575 | 131 | std::string ZoneHVACEquipmentList::loadDistributionScheme() const { | |
| 576 |
1/1✓ Branch 3 taken 131 times.
|
131 | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->loadDistributionScheme(); |
| 577 | } | ||
| 578 | |||
| 579 | ✗ | std::vector<std::string> ZoneHVACEquipmentList::loadDistributionSchemeValues() { | |
| 580 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ZoneHVAC_EquipmentListFields::LoadDistributionScheme); | |
| 581 | } | ||
| 582 | |||
| 583 | ✗ | std::vector<std::string> ZoneHVACEquipmentList::validLoadDistributionSchemeValues() { | |
| 584 | ✗ | return loadDistributionSchemeValues(); | |
| 585 | } | ||
| 586 | |||
| 587 | 9 | bool ZoneHVACEquipmentList::setLoadDistributionScheme(const std::string& scheme) { | |
| 588 |
1/1✓ Branch 3 taken 9 times.
|
9 | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->setLoadDistributionScheme(scheme); |
| 589 | } | ||
| 590 | |||
| 591 | 447 | bool ZoneHVACEquipmentList::addEquipment(const ModelObject& equipment) { | |
| 592 |
1/1✓ Branch 3 taken 447 times.
|
447 | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->addEquipment(equipment); |
| 593 | } | ||
| 594 | |||
| 595 | 34 | bool ZoneHVACEquipmentList::setCoolingPriority(const ModelObject& equipment, unsigned priority) { | |
| 596 |
1/1✓ Branch 3 taken 34 times.
|
34 | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->setCoolingPriority(equipment, priority); |
| 597 | } | ||
| 598 | |||
| 599 | 36 | bool ZoneHVACEquipmentList::setHeatingPriority(const ModelObject& equipment, unsigned priority) { | |
| 600 |
1/1✓ Branch 3 taken 36 times.
|
36 | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->setHeatingPriority(equipment, priority); |
| 601 | } | ||
| 602 | |||
| 603 | 1217 | std::vector<ModelObject> ZoneHVACEquipmentList::equipment() const { | |
| 604 |
1/1✓ Branch 3 taken 1217 times.
|
1217 | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->equipment(); |
| 605 | } | ||
| 606 | |||
| 607 | 130 | std::vector<ModelObject> ZoneHVACEquipmentList::equipmentInHeatingOrder() const { | |
| 608 |
1/1✓ Branch 3 taken 130 times.
|
130 | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->equipmentInHeatingOrder(); |
| 609 | } | ||
| 610 | |||
| 611 | 130 | std::vector<ModelObject> ZoneHVACEquipmentList::equipmentInCoolingOrder() const { | |
| 612 |
1/1✓ Branch 3 taken 130 times.
|
130 | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->equipmentInCoolingOrder(); |
| 613 | } | ||
| 614 | |||
| 615 | 2558 | ThermalZone ZoneHVACEquipmentList::thermalZone() const { | |
| 616 |
1/1✓ Branch 3 taken 2558 times.
|
2558 | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->thermalZone(); |
| 617 | } | ||
| 618 | |||
| 619 | 65 | bool ZoneHVACEquipmentList::removeEquipment(const ModelObject& equipment) { | |
| 620 |
1/1✓ Branch 3 taken 65 times.
|
65 | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->removeEquipment(equipment); |
| 621 | } | ||
| 622 | |||
| 623 | ✗ | unsigned ZoneHVACEquipmentList::heatingPriority(const ModelObject& equipment) const { | |
| 624 | ✗ | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->heatingPriority(equipment); | |
| 625 | } | ||
| 626 | |||
| 627 | ✗ | unsigned ZoneHVACEquipmentList::coolingPriority(const ModelObject& equipment) const { | |
| 628 | ✗ | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->coolingPriority(equipment); | |
| 629 | } | ||
| 630 | |||
| 631 | 149 | boost::optional<Schedule> ZoneHVACEquipmentList::sequentialCoolingFractionSchedule(const ModelObject& equipment) const { | |
| 632 |
1/1✓ Branch 3 taken 149 times.
|
149 | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->sequentialCoolingFractionSchedule(equipment); |
| 633 | } | ||
| 634 | |||
| 635 | 6 | bool ZoneHVACEquipmentList::setSequentialCoolingFractionSchedule(const ModelObject& equipment, Schedule& schedule) { | |
| 636 |
1/1✓ Branch 3 taken 6 times.
|
6 | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->setSequentialCoolingFractionSchedule(equipment, schedule); |
| 637 | } | ||
| 638 | |||
| 639 | 147 | boost::optional<Schedule> ZoneHVACEquipmentList::sequentialHeatingFractionSchedule(const ModelObject& equipment) const { | |
| 640 |
1/1✓ Branch 3 taken 147 times.
|
147 | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->sequentialHeatingFractionSchedule(equipment); |
| 641 | } | ||
| 642 | |||
| 643 | 4 | bool ZoneHVACEquipmentList::setSequentialHeatingFractionSchedule(const ModelObject& equipment, Schedule& schedule) { | |
| 644 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->setSequentialHeatingFractionSchedule(equipment, schedule); |
| 645 | } | ||
| 646 | |||
| 647 | // DEPRECATED | ||
| 648 | ✗ | boost::optional<double> ZoneHVACEquipmentList::sequentialCoolingFraction(const ModelObject& equipment) const { | |
| 649 | ✗ | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->sequentialCoolingFraction(equipment); | |
| 650 | } | ||
| 651 | |||
| 652 | ✗ | bool ZoneHVACEquipmentList::setSequentialCoolingFraction(const ModelObject& equipment, double fraction) { | |
| 653 | ✗ | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->setSequentialCoolingFraction(equipment, fraction); | |
| 654 | } | ||
| 655 | |||
| 656 | ✗ | boost::optional<double> ZoneHVACEquipmentList::sequentialHeatingFraction(const ModelObject& equipment) const { | |
| 657 | ✗ | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->sequentialHeatingFraction(equipment); | |
| 658 | } | ||
| 659 | |||
| 660 | ✗ | bool ZoneHVACEquipmentList::setSequentialHeatingFraction(const ModelObject& equipment, double fraction) { | |
| 661 | ✗ | return getImpl<detail::ZoneHVACEquipmentList_Impl>()->setSequentialHeatingFraction(equipment, fraction); | |
| 662 | } | ||
| 663 | |||
| 664 | /// @cond | ||
| 665 |
1/1✓ Branch 3 taken 2562 times.
|
2562 | ZoneHVACEquipmentList::ZoneHVACEquipmentList(std::shared_ptr<detail::ZoneHVACEquipmentList_Impl> impl) : ModelObject(std::move(impl)) {} |
| 666 | /// @endcond | ||
| 667 | |||
| 668 | } // namespace model | ||
| 669 | } // namespace openstudio | ||
| 670 |