src/model/AirLoopHVAC.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 "AirLoopHVAC.hpp" | ||
| 7 | #include "AirLoopHVAC_Impl.hpp" | ||
| 8 | #include "AirLoopHVACSupplyPlenum.hpp" | ||
| 9 | #include "AirLoopHVACSupplyPlenum_Impl.hpp" | ||
| 10 | #include "AirLoopHVACReturnPlenum.hpp" | ||
| 11 | #include "AirLoopHVACReturnPlenum_Impl.hpp" | ||
| 12 | #include "AirTerminalSingleDuctSeriesPIUReheat.hpp" | ||
| 13 | #include "AirTerminalSingleDuctSeriesPIUReheat_Impl.hpp" | ||
| 14 | #include "AirTerminalSingleDuctParallelPIUReheat.hpp" | ||
| 15 | #include "AirTerminalSingleDuctParallelPIUReheat_Impl.hpp" | ||
| 16 | #include "ConnectorSplitter.hpp" | ||
| 17 | #include "ConnectorSplitter_Impl.hpp" | ||
| 18 | #include "FanConstantVolume.hpp" | ||
| 19 | #include "FanConstantVolume_Impl.hpp" | ||
| 20 | #include "FanVariableVolume.hpp" | ||
| 21 | #include "FanVariableVolume_Impl.hpp" | ||
| 22 | #include "FanSystemModel.hpp" | ||
| 23 | #include "FanSystemModel_Impl.hpp" | ||
| 24 | #include "FanComponentModel.hpp" | ||
| 25 | #include "FanComponentModel_Impl.hpp" | ||
| 26 | #include "SizingSystem.hpp" | ||
| 27 | #include "SizingSystem_Impl.hpp" | ||
| 28 | #include "Node.hpp" | ||
| 29 | #include "Node_Impl.hpp" | ||
| 30 | #include "ZoneHVACComponent.hpp" | ||
| 31 | #include "ZoneHVACComponent_Impl.hpp" | ||
| 32 | #include "HVACComponent.hpp" | ||
| 33 | #include "HVACComponent_Impl.hpp" | ||
| 34 | #include "StraightComponent.hpp" | ||
| 35 | #include "StraightComponent_Impl.hpp" | ||
| 36 | #include "WaterToAirComponent.hpp" | ||
| 37 | #include "WaterToAirComponent_Impl.hpp" | ||
| 38 | #include "ThermalZone.hpp" | ||
| 39 | #include "ThermalZone_Impl.hpp" | ||
| 40 | #include "AirLoopHVACOutdoorAirSystem.hpp" | ||
| 41 | #include "AirLoopHVACOutdoorAirSystem_Impl.hpp" | ||
| 42 | #include "AirLoopHVACDedicatedOutdoorAirSystem.hpp" | ||
| 43 | #include "AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp" | ||
| 44 | #include "AirLoopHVACZoneSplitter.hpp" | ||
| 45 | #include "AirLoopHVACZoneSplitter_Impl.hpp" | ||
| 46 | #include "AirLoopHVACZoneMixer.hpp" | ||
| 47 | #include "AirLoopHVACZoneMixer_Impl.hpp" | ||
| 48 | |||
| 49 | #include "CoilHeatingWater.hpp" | ||
| 50 | #include "CoilHeatingWater_Impl.hpp" | ||
| 51 | #include "CoilCoolingWater.hpp" | ||
| 52 | #include "CoilCoolingWater_Impl.hpp" | ||
| 53 | #include "AirTerminalSingleDuctConstantVolumeCooledBeam.hpp" | ||
| 54 | #include "AirTerminalSingleDuctConstantVolumeCooledBeam_Impl.hpp" | ||
| 55 | #include "AirTerminalSingleDuctConstantVolumeFourPipeInduction.hpp" | ||
| 56 | #include "AirTerminalSingleDuctConstantVolumeFourPipeInduction_Impl.hpp" | ||
| 57 | #include "AirTerminalSingleDuctConstantVolumeFourPipeBeam.hpp" | ||
| 58 | #include "AirTerminalSingleDuctConstantVolumeFourPipeBeam_Impl.hpp" | ||
| 59 | #include "AvailabilityManagerAssignmentList.hpp" | ||
| 60 | #include "AvailabilityManagerAssignmentList_Impl.hpp" | ||
| 61 | #include "AvailabilityManager.hpp" | ||
| 62 | #include "AvailabilityManager_Impl.hpp" | ||
| 63 | #include "AvailabilityManagerNightCycle.hpp" | ||
| 64 | #include "AvailabilityManagerNightCycle_Impl.hpp" | ||
| 65 | |||
| 66 | #include "Model.hpp" | ||
| 67 | #include "Model_Impl.hpp" | ||
| 68 | #include "PortList.hpp" | ||
| 69 | #include "PortList_Impl.hpp" | ||
| 70 | #include "ScheduleYear.hpp" | ||
| 71 | #include "ScheduleYear_Impl.hpp" | ||
| 72 | #include "ScheduleTypeLimits.hpp" | ||
| 73 | #include "ScheduleTypeRegistry.hpp" | ||
| 74 | #include "SetpointManagerSingleZoneReheat.hpp" | ||
| 75 | #include "SetpointManagerSingleZoneReheat_Impl.hpp" | ||
| 76 | #include "SetpointManagerSingleZoneCooling.hpp" | ||
| 77 | #include "SetpointManagerSingleZoneCooling_Impl.hpp" | ||
| 78 | #include "SetpointManagerSingleZoneHeating.hpp" | ||
| 79 | #include "SetpointManagerSingleZoneHeating_Impl.hpp" | ||
| 80 | #include "../utilities/idd/IddEnums.hpp" | ||
| 81 | |||
| 82 | #include <utilities/idd/OS_AirLoopHVAC_FieldEnums.hxx> | ||
| 83 | #include <utilities/idd/OS_AirLoopHVAC_ZoneMixer_FieldEnums.hxx> | ||
| 84 | #include <utilities/idd/OS_AirLoopHVAC_OutdoorAirSystem_FieldEnums.hxx> | ||
| 85 | #include <utilities/idd/OS_Node_FieldEnums.hxx> | ||
| 86 | #include <utilities/idd/OS_AirLoopHVAC_ZoneSplitter_FieldEnums.hxx> | ||
| 87 | #include <utilities/idd/OS_AirTerminal_SingleDuct_ConstantVolume_NoReheat_FieldEnums.hxx> | ||
| 88 | #include <utilities/idd/OS_AvailabilityManagerAssignmentList_FieldEnums.hxx> | ||
| 89 | #include <utilities/idd/OS_Controller_OutdoorAir_FieldEnums.hxx> | ||
| 90 | #include <utilities/idd/IddEnums.hxx> | ||
| 91 | #include "../utilities/core/Compare.hpp" | ||
| 92 | #include "../utilities/core/Assert.hpp" | ||
| 93 | |||
| 94 | #include <array> | ||
| 95 | #include <algorithm> | ||
| 96 | |||
| 97 | namespace openstudio { | ||
| 98 | |||
| 99 | namespace model { | ||
| 100 | |||
| 101 | namespace detail { | ||
| 102 | |||
| 103 | 748 | AirLoopHVAC_Impl::AirLoopHVAC_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) : Loop_Impl(idfObject, model, keepHandle) { | |
| 104 |
4/6✓ Branch 1 taken 748 times.
✓ Branch 4 taken 748 times.
✓ Branch 7 taken 748 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 748 times.
✗ Branch 13 not taken.
|
748 | OS_ASSERT(idfObject.iddObject().type() == AirLoopHVAC::iddObjectType()); |
| 105 | 748 | } | |
| 106 | |||
| 107 | 43 | AirLoopHVAC_Impl::AirLoopHVAC_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 108 | 43 | : Loop_Impl(other, model, keepHandle) { | |
| 109 |
4/6✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
✓ Branch 7 taken 43 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 43 times.
✗ Branch 13 not taken.
|
43 | OS_ASSERT(other.iddObject().type() == AirLoopHVAC::iddObjectType()); |
| 110 | 43 | } | |
| 111 | |||
| 112 | 283 | AirLoopHVAC_Impl::AirLoopHVAC_Impl(const AirLoopHVAC_Impl& other, Model_Impl* model, bool keepHandle) : Loop_Impl(other, model, keepHandle) {} | |
| 113 | |||
| 114 | 1 | const std::vector<std::string>& AirLoopHVAC_Impl::outputVariableNames() const { | |
| 115 | static const std::vector<std::string> result{"Air System Simulation Cycle On Off Status", "HVAC System Solver Iteration Count", | ||
| 116 | "Air System Solver Iteration Count", "Air System Simulation Maximum Iteration Count", | ||
| 117 |
5/11✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 time.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 1 time.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
9 | "Air System Simulation Iteration Count", "Air System Component Model Simulation Calls"}; |
| 118 | 1 | return result; | |
| 119 | 3 | } | |
| 120 | |||
| 121 | 234 | IddObjectType AirLoopHVAC_Impl::iddObjectType() const { | |
| 122 | 234 | return AirLoopHVAC::iddObjectType(); | |
| 123 | } | ||
| 124 | |||
| 125 | 8 | std::vector<ScheduleTypeKey> AirLoopHVAC_Impl::getScheduleTypeKeys(const Schedule& /*schedule*/) const { | |
| 126 | 8 | std::vector<ScheduleTypeKey> result; | |
| 127 | // UnsignedVector fieldIndices = getSourceIndices(schedule.handle()); | ||
| 128 | // UnsignedVector::const_iterator b(fieldIndices.begin()), e(fieldIndices.end()); | ||
| 129 | // if (std::find(b,e,OS_AirLoopHVACFields::ReturnAirBypassFlowTemperatureSetpointScheduleName) != e) | ||
| 130 | // { | ||
| 131 | // result.push_back(ScheduleTypeKey("AirLoopHVAC","Return Air Bypass Flow Temperature Setpoint")); | ||
| 132 | // } | ||
| 133 | 8 | return result; | |
| 134 | } | ||
| 135 | |||
| 136 | 16689 | Node AirLoopHVAC_Impl::supplyInletNode() const { | |
| 137 | 16689 | OptionalModelObject optionalModelObject; | |
| 138 | 16689 | OptionalNode optionalNode; | |
| 139 |
1/1✓ Branch 1 taken 16689 times.
|
16689 | optionalModelObject = this->connectedObject(openstudio::OS_AirLoopHVACFields::SupplySideInletNodeName); |
| 140 |
1/2✓ Branch 0 taken 16689 times.
✗ Branch 1 not taken.
|
16689 | if (optionalModelObject) { |
| 141 |
2/2✓ Branch 1 taken 16689 times.
✓ Branch 4 taken 16689 times.
|
16689 | optionalNode = optionalModelObject->optionalCast<Node>(); |
| 142 | } | ||
| 143 |
2/2✓ Branch 1 taken 16689 times.
✓ Branch 4 taken 16689 times.
|
33378 | return optionalNode.get(); |
| 144 | 16689 | } | |
| 145 | |||
| 146 | 18445 | std::vector<Node> AirLoopHVAC_Impl::supplyOutletNodes() const { | |
| 147 | 18445 | std::vector<Node> nodeVector; | |
| 148 |
3/3✓ Branch 1 taken 18445 times.
✓ Branch 3 taken 18434 times.
✓ Branch 4 taken 11 times.
|
36890 | if (auto mo = this->connectedObject(openstudio::OS_AirLoopHVACFields::SupplySideOutletNodeA)) { |
| 149 |
2/2✓ Branch 1 taken 18434 times.
✓ Branch 4 taken 18434 times.
|
18434 | auto node = mo->optionalCast<Node>(); |
| 150 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 18434 times.
✗ Branch 4 not taken.
|
18434 | OS_ASSERT(node); |
| 151 |
2/2✓ Branch 1 taken 18434 times.
✓ Branch 4 taken 18434 times.
|
18434 | nodeVector.push_back(node.get()); |
| 152 | 36879 | } | |
| 153 |
3/3✓ Branch 1 taken 18445 times.
✓ Branch 3 taken 516 times.
✓ Branch 4 taken 17929 times.
|
36890 | if (auto mo = this->connectedObject(openstudio::OS_AirLoopHVACFields::SupplySideOutletNodeB)) { |
| 154 |
2/2✓ Branch 1 taken 516 times.
✓ Branch 4 taken 516 times.
|
516 | auto node = mo->optionalCast<Node>(); |
| 155 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 516 times.
✗ Branch 4 not taken.
|
516 | OS_ASSERT(node); |
| 156 |
2/2✓ Branch 1 taken 516 times.
✓ Branch 4 taken 516 times.
|
516 | nodeVector.push_back(node.get()); |
| 157 | 18961 | } | |
| 158 | 18445 | return nodeVector; | |
| 159 | ✗ | } | |
| 160 | |||
| 161 | 8868 | std::vector<Node> AirLoopHVAC_Impl::demandInletNodes() const { | |
| 162 | 8868 | std::vector<Node> nodeVector; | |
| 163 |
2/3✓ Branch 1 taken 8868 times.
✓ Branch 3 taken 8868 times.
✗ Branch 4 not taken.
|
17736 | if (auto mo = this->connectedObject(openstudio::OS_AirLoopHVACFields::DemandSideInletNodeA)) { |
| 164 |
2/2✓ Branch 1 taken 8868 times.
✓ Branch 4 taken 8868 times.
|
8868 | auto node = mo->optionalCast<Node>(); |
| 165 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 8868 times.
✗ Branch 4 not taken.
|
8868 | OS_ASSERT(node); |
| 166 |
2/2✓ Branch 1 taken 8868 times.
✓ Branch 4 taken 8868 times.
|
8868 | nodeVector.push_back(node.get()); |
| 167 | 17736 | } | |
| 168 |
3/3✓ Branch 1 taken 8868 times.
✓ Branch 3 taken 160 times.
✓ Branch 4 taken 8708 times.
|
17736 | if (auto mo = this->connectedObject(openstudio::OS_AirLoopHVACFields::DemandSideInletNodeB)) { |
| 169 |
2/2✓ Branch 1 taken 160 times.
✓ Branch 4 taken 160 times.
|
160 | auto node = mo->optionalCast<Node>(); |
| 170 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 160 times.
✗ Branch 4 not taken.
|
160 | OS_ASSERT(node); |
| 171 |
2/2✓ Branch 1 taken 160 times.
✓ Branch 4 taken 160 times.
|
160 | nodeVector.push_back(node.get()); |
| 172 | 9028 | } | |
| 173 | 8868 | return nodeVector; | |
| 174 | ✗ | } | |
| 175 | |||
| 176 | 9091 | Node AirLoopHVAC_Impl::demandOutletNode() const { | |
| 177 | 9091 | OptionalModelObject optionalModelObject; | |
| 178 | 9091 | OptionalNode optionalNode; | |
| 179 |
1/1✓ Branch 1 taken 9091 times.
|
9091 | optionalModelObject = this->connectedObject(openstudio::OS_AirLoopHVACFields::DemandSideOutletNodeName); |
| 180 |
1/2✓ Branch 0 taken 9091 times.
✗ Branch 1 not taken.
|
9091 | if (optionalModelObject) { |
| 181 |
2/2✓ Branch 1 taken 9091 times.
✓ Branch 4 taken 9091 times.
|
9091 | optionalNode = optionalModelObject->optionalCast<Node>(); |
| 182 | } | ||
| 183 |
2/2✓ Branch 1 taken 9091 times.
✓ Branch 4 taken 9091 times.
|
18182 | return optionalNode.get(); |
| 184 | 9091 | } | |
| 185 | |||
| 186 | 17 | std::vector<openstudio::IdfObject> AirLoopHVAC_Impl::remove() { | |
| 187 | 17 | ModelObjectVector modelObjects; | |
| 188 | 17 | ModelObjectVector::iterator it; | |
| 189 | |||
| 190 |
2/2✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
|
17 | sizingSystem().remove(); |
| 191 | |||
| 192 |
2/2✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
|
17 | availabilityManagerAssignmentList().remove(); |
| 193 | |||
| 194 |
3/3✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
|
34 | modelObjects = supplyComponents(); |
| 195 |
2/2✓ Branch 4 taken 117 times.
✓ Branch 5 taken 17 times.
|
134 | for (it = modelObjects.begin(); it != modelObjects.end(); ++it) { |
| 196 |
3/3✓ Branch 2 taken 117 times.
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 112 times.
|
234 | if (boost::optional<WaterToAirComponent> comp = it->optionalCast<WaterToAirComponent>()) { |
| 197 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | comp->removeFromAirLoopHVAC(); |
| 198 |
3/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 5 times.
|
5 | if (!comp->plantLoop()) { |
| 199 | ✗ | comp->remove(); | |
| 200 | } | ||
| 201 | 117 | } | |
| 202 | } | ||
| 203 | |||
| 204 |
1/1✓ Branch 1 taken 17 times.
|
17 | auto zones = thermalZones(); |
| 205 |
2/2✓ Branch 5 taken 12 times.
✓ Branch 6 taken 17 times.
|
29 | for (auto& zone : zones) { |
| 206 |
1/1✓ Branch 1 taken 12 times.
|
12 | removeBranchForZone(zone); |
| 207 | } | ||
| 208 | |||
| 209 |
3/3✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
|
34 | modelObjects = components(); |
| 210 | |||
| 211 |
1/1✓ Branch 1 taken 17 times.
|
17 | std::vector<openstudio::IdfObject> idfObjects = ModelObject_Impl::remove(); |
| 212 | |||
| 213 |
2/2✓ Branch 4 taken 268 times.
✓ Branch 5 taken 17 times.
|
285 | for (it = modelObjects.begin(); it != modelObjects.end(); ++it) { |
| 214 |
2/3✓ Branch 2 taken 268 times.
✓ Branch 4 taken 268 times.
✗ Branch 5 not taken.
|
536 | if (OptionalHVACComponent comp = it->optionalCast<HVACComponent>()) { |
| 215 |
3/3✓ Branch 2 taken 268 times.
✓ Branch 5 taken 198 times.
✓ Branch 6 taken 70 times.
|
268 | if (!it->handle().isNull()) { |
| 216 |
2/2✓ Branch 1 taken 198 times.
✓ Branch 4 taken 198 times.
|
198 | comp->disconnect(); |
| 217 |
2/2✓ Branch 1 taken 198 times.
✓ Branch 4 taken 198 times.
|
198 | comp->remove(); |
| 218 | } | ||
| 219 | 268 | } | |
| 220 | } | ||
| 221 | |||
| 222 | 34 | return idfObjects; | |
| 223 | 17 | } | |
| 224 | |||
| 225 | 62 | std::vector<ModelObject> AirLoopHVAC_Impl::components(openstudio::IddObjectType type) const { | |
| 226 | 62 | std::vector<ModelObject> result; | |
| 227 | |||
| 228 |
1/1✓ Branch 1 taken 62 times.
|
62 | result = Loop_Impl::components(type); |
| 229 | |||
| 230 |
1/1✓ Branch 1 taken 62 times.
|
62 | std::vector<ModelObject> oaComponents = this->oaComponents(type); |
| 231 | |||
| 232 |
1/1✓ Branch 5 taken 62 times.
|
62 | result.insert(result.end(), oaComponents.begin(), oaComponents.end()); |
| 233 | |||
| 234 | 124 | return result; | |
| 235 | 62 | } | |
| 236 | |||
| 237 | 3404 | OptionalAirLoopHVACOutdoorAirSystem AirLoopHVAC_Impl::airLoopHVACOutdoorAirSystem() const { | |
| 238 | 3404 | OptionalAirLoopHVACOutdoorAirSystem result; | |
| 239 | 3404 | ModelObjectVector modelObjects; | |
| 240 |
2/2✓ Branch 1 taken 3404 times.
✓ Branch 4 taken 3404 times.
|
3404 | modelObjects = supplyComponents(openstudio::IddObjectType::OS_AirLoopHVAC_OutdoorAirSystem); |
| 241 |
2/2✓ Branch 1 taken 1577 times.
✓ Branch 2 taken 1827 times.
|
3404 | if (modelObjects.size() == 1) { |
| 242 |
1/1✓ Branch 2 taken 1577 times.
|
1577 | return modelObjects.front().optionalCast<AirLoopHVACOutdoorAirSystem>(); |
| 243 | } | ||
| 244 | |||
| 245 | 1827 | return result; | |
| 246 | 3404 | } | |
| 247 | |||
| 248 | 24 | boost::optional<AirLoopHVACDedicatedOutdoorAirSystem> AirLoopHVAC_Impl::airLoopHVACDedicatedOutdoorAirSystem() const { | |
| 249 | std::vector<AirLoopHVACDedicatedOutdoorAirSystem> airLoopHVACDedicatedOutdoorAirSystems = | ||
| 250 |
3/3✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
✓ Branch 7 taken 24 times.
|
24 | getObject<ModelObject>().getModelObjectSources<AirLoopHVACDedicatedOutdoorAirSystem>(AirLoopHVACDedicatedOutdoorAirSystem::iddObjectType()); |
| 251 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 2 taken 20 times.
|
24 | if (airLoopHVACDedicatedOutdoorAirSystems.empty()) { |
| 252 | // no error | ||
| 253 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | } else if (airLoopHVACDedicatedOutdoorAirSystems.size() == 1) { |
| 254 |
1/1✓ Branch 2 taken 4 times.
|
4 | return airLoopHVACDedicatedOutdoorAirSystems[0]; |
| 255 | } else { | ||
| 256 | // error | ||
| 257 | } | ||
| 258 | 20 | return boost::none; | |
| 259 | 24 | } | |
| 260 | |||
| 261 | 365 | boost::optional<ThermalZone> AirLoopHVAC_Impl::zoneForLastBranch(Mixer& mixer) { | |
| 262 |
4/5✓ Branch 1 taken 365 times.
✓ Branch 4 taken 365 times.
✓ Branch 7 taken 365 times.
✓ Branch 11 taken 365 times.
✗ Branch 12 not taken.
|
730 | if (auto node = mixer.lastInletModelObject()->optionalCast<Node>()) { |
| 263 |
2/2✓ Branch 1 taken 365 times.
✓ Branch 4 taken 365 times.
|
365 | auto nodeinlet = node->inletModelObject(); |
| 264 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 365 times.
✗ Branch 4 not taken.
|
365 | OS_ASSERT(nodeinlet); |
| 265 |
2/2✓ Branch 1 taken 365 times.
✓ Branch 4 taken 365 times.
|
365 | auto pl = nodeinlet->optionalCast<PortList>(); |
| 266 |
2/2✓ Branch 0 taken 68 times.
✓ Branch 1 taken 297 times.
|
365 | if (pl) { |
| 267 |
3/3✓ Branch 1 taken 68 times.
✓ Branch 4 taken 68 times.
✓ Branch 7 taken 68 times.
|
68 | return pl->thermalZone(); |
| 268 | } | ||
| 269 | 798 | } | |
| 270 | 297 | return boost::none; | |
| 271 | } | ||
| 272 | |||
| 273 | 365 | boost::optional<HVACComponent> AirLoopHVAC_Impl::terminalForLastBranch(Mixer& mixer) { | |
| 274 | |||
| 275 | // can't constexpr std::array here since IddObjectType is not litteral... | ||
| 276 | const std::array<openstudio::IddObjectType, 5> invalidHVACCompTypes{ | ||
| 277 | openstudio::IddObjectType::OS_Node, | ||
| 278 | // Mixers | ||
| 279 | openstudio::IddObjectType::OS_AirLoopHVAC_ReturnPlenum, openstudio::IddObjectType::OS_AirLoopHVAC_ZoneMixer, | ||
| 280 | // Splitters | ||
| 281 |
5/5✓ Branch 1 taken 365 times.
✓ Branch 4 taken 365 times.
✓ Branch 7 taken 365 times.
✓ Branch 10 taken 365 times.
✓ Branch 13 taken 365 times.
|
365 | openstudio::IddObjectType::OS_AirLoopHVAC_SupplyPlenum, openstudio::IddObjectType::OS_AirLoopHVAC_ZoneSplitter}; |
| 282 | |||
| 283 |
3/3✓ Branch 1 taken 365 times.
✓ Branch 4 taken 365 times.
✓ Branch 7 taken 365 times.
|
365 | auto mixerInletNode = mixer.lastInletModelObject()->optionalCast<Node>(); |
| 284 |
1/2✓ Branch 0 taken 365 times.
✗ Branch 1 not taken.
|
365 | if (mixerInletNode) { |
| 285 |
2/2✓ Branch 1 taken 365 times.
✓ Branch 4 taken 365 times.
|
365 | auto upstreamComp = mixerInletNode->inletModelObject(); |
| 286 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 365 times.
✗ Branch 4 not taken.
|
365 | OS_ASSERT(upstreamComp); |
| 287 |
2/2✓ Branch 1 taken 365 times.
✓ Branch 4 taken 365 times.
|
365 | auto pl = upstreamComp->optionalCast<PortList>(); |
| 288 |
2/2✓ Branch 0 taken 68 times.
✓ Branch 1 taken 297 times.
|
365 | if (pl) { |
| 289 |
2/2✓ Branch 1 taken 68 times.
✓ Branch 4 taken 68 times.
|
68 | auto zone = pl->thermalZone(); |
| 290 |
3/3✓ Branch 1 taken 68 times.
✓ Branch 4 taken 68 times.
✓ Branch 7 taken 68 times.
|
68 | auto zoneInletNodes = subsetCastVector<Node>(zone.inletPortList().airLoopHVACModelObjects()); |
| 291 |
1/1✓ Branch 1 taken 68 times.
|
68 | auto airloop = mixer.airLoopHVAC(); |
| 292 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 68 times.
|
68 | if (!airloop) { |
| 293 | ✗ | return boost::none; | |
| 294 | } | ||
| 295 |
2/2✓ Branch 1 taken 68 times.
✓ Branch 4 taken 68 times.
|
68 | auto h = airloop->handle(); |
| 296 |
2/2✓ Branch 5 taken 68 times.
✓ Branch 6 taken 13 times.
|
81 | for (auto& zoneNode : zoneInletNodes) { |
| 297 |
1/1✓ Branch 1 taken 68 times.
|
68 | auto airloop = zoneNode.airLoopHVAC(); |
| 298 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 68 times.
✗ Branch 4 not taken.
|
68 | OS_ASSERT(airloop); |
| 299 |
4/5✓ Branch 1 taken 68 times.
✓ Branch 4 taken 68 times.
✓ Branch 7 taken 68 times.
✓ Branch 9 taken 68 times.
✗ Branch 10 not taken.
|
68 | if (h == airloop->handle()) { |
| 300 |
1/1✓ Branch 1 taken 68 times.
|
68 | auto mo = zoneNode.inletModelObject(); |
| 301 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 68 times.
✗ Branch 4 not taken.
|
68 | OS_ASSERT(mo); |
| 302 |
4/4✓ Branch 1 taken 68 times.
✓ Branch 4 taken 68 times.
✓ Branch 8 taken 55 times.
✓ Branch 9 taken 13 times.
|
68 | if (!mo->optionalCast<Splitter>()) { |
| 303 |
2/2✓ Branch 1 taken 55 times.
✓ Branch 4 taken 55 times.
|
55 | auto hvacComponent = mo->optionalCast<HVACComponent>(); |
| 304 |
1/2✓ Branch 0 taken 55 times.
✗ Branch 1 not taken.
|
55 | if (hvacComponent) { |
| 305 | 55 | return hvacComponent; | |
| 306 | } | ||
| 307 | 55 | } | |
| 308 | 68 | } | |
| 309 | 68 | } | |
| 310 |
9/9✓ Branch 1 taken 13 times.
✓ Branch 2 taken 55 times.
✓ Branch 4 taken 13 times.
✓ Branch 5 taken 55 times.
✓ Branch 7 taken 13 times.
✓ Branch 8 taken 55 times.
✓ Branch 10 taken 297 times.
✓ Branch 13 taken 297 times.
✓ Branch 18 taken 297 times.
|
475 | } else if (std::find(invalidHVACCompTypes.cbegin(), invalidHVACCompTypes.cend(), upstreamComp->iddObjectType()) |
| 311 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 2 taken 283 times.
|
297 | == invalidHVACCompTypes.cend()) { |
| 312 |
3/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 6 taken 14 times.
✗ Branch 7 not taken.
|
28 | if (auto hvacComponent = upstreamComp->optionalCast<HVACComponent>()) { |
| 313 | 14 | return hvacComponent; | |
| 314 | 14 | } | |
| 315 | } | ||
| 316 | 434 | } | |
| 317 | |||
| 318 | 296 | return boost::none; | |
| 319 | 365 | } | |
| 320 | |||
| 321 | 320 | bool AirLoopHVAC_Impl::isTerminalTypeValid(const HVACComponent& airTerminal) { | |
| 322 | |||
| 323 | 320 | bool loopIsDualDuct = isDualDuct(); | |
| 324 | // Dual duct terminals are derived from Mixer | ||
| 325 |
1/1✓ Branch 1 taken 320 times.
|
320 | bool terminalIsDualDuct = airTerminal.optionalCast<Mixer>().has_value(); |
| 326 | |||
| 327 | 320 | bool result = loopIsDualDuct == terminalIsDualDuct; | |
| 328 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 318 times.
|
320 | if (!result) { |
| 329 |
14/14✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 19 taken 2 times.
✓ Branch 22 taken 2 times.
✓ Branch 24 taken 1 time.
✓ Branch 25 taken 1 time.
✓ Branch 27 taken 2 times.
✓ Branch 32 taken 2 times.
✓ Branch 35 taken 2 times.
✓ Branch 38 taken 2 times.
|
2 | LOG(Warn, "Cannot assign " << airTerminal.nameString() << " to " << briefDescription() << " since it is of incorrect type, loop is " |
| 330 | << (loopIsDualDuct ? "dual duct." : "single duct.")); | ||
| 331 | } | ||
| 332 | 320 | return result; | |
| 333 | } | ||
| 334 | |||
| 335 | 369 | bool AirLoopHVAC_Impl::addBranchForZoneImpl(ThermalZone& thermalZone, AirLoopHVAC& airLoopHVAC, Splitter& splitter, Mixer& mixer, | |
| 336 | bool removeCurrentZones, OptionalHVACComponent& optAirTerminal) { | ||
| 337 |
1/1✓ Branch 1 taken 369 times.
|
369 | Model _model = thermalZone.model(); |
| 338 | |||
| 339 |
17/29✓ Branch 1 taken 277 times.
✓ Branch 2 taken 92 times.
✓ Branch 4 taken 277 times.
✓ Branch 7 taken 277 times.
✓ Branch 10 taken 277 times.
✓ Branch 12 taken 277 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 369 times.
✓ Branch 18 taken 369 times.
✓ Branch 20 taken 369 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 369 times.
✓ Branch 26 taken 369 times.
✗ Branch 28 not taken.
✓ Branch 29 taken 369 times.
✓ Branch 30 taken 369 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 369 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 277 times.
✓ Branch 37 taken 92 times.
✗ Branch 39 not taken.
✓ Branch 40 taken 369 times.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
|
738 | if ((optAirTerminal && _model != optAirTerminal->model()) || _model != splitter.model() || _model != mixer.model()) { |
| 340 | ✗ | return false; | |
| 341 | } | ||
| 342 | |||
| 343 |
10/12✓ Branch 1 taken 277 times.
✓ Branch 2 taken 92 times.
✓ Branch 4 taken 277 times.
✓ Branch 7 taken 277 times.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 276 times.
✓ Branch 12 taken 277 times.
✓ Branch 13 taken 92 times.
✓ Branch 15 taken 1 time.
✓ Branch 16 taken 368 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
1015 | if (optAirTerminal && optAirTerminal->airLoopHVAC()) { |
| 344 | 1 | return false; | |
| 345 | } | ||
| 346 | |||
| 347 |
2/3✓ Branch 1 taken 368 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 368 times.
|
368 | if (thermalZone.isPlenum()) { |
| 348 | ✗ | return false; | |
| 349 | } | ||
| 350 | |||
| 351 |
3/4✓ Branch 1 taken 368 times.
✓ Branch 4 taken 368 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 368 times.
|
368 | if (!airLoopHVAC.demandComponent(splitter.handle())) { |
| 352 | ✗ | return false; | |
| 353 | } | ||
| 354 | |||
| 355 |
3/4✓ Branch 1 taken 368 times.
✓ Branch 4 taken 368 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 368 times.
|
368 | if (!airLoopHVAC.demandComponent(mixer.handle())) { |
| 356 | ✗ | return false; | |
| 357 | } | ||
| 358 | |||
| 359 |
8/12✓ Branch 1 taken 276 times.
✓ Branch 2 taken 92 times.
✓ Branch 6 taken 276 times.
✓ Branch 9 taken 276 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 276 times.
✓ Branch 13 taken 276 times.
✓ Branch 14 taken 92 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 368 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
736 | if (optAirTerminal && !airLoopHVAC.getImpl<detail::AirLoopHVAC_Impl>()->isTerminalTypeValid(optAirTerminal.get())) { |
| 360 | ✗ | return false; | |
| 361 | } | ||
| 362 | |||
| 363 |
1/1✓ Branch 1 taken 368 times.
|
368 | auto currentloops = thermalZone.airLoopHVACs(); |
| 364 |
1/1✓ Branch 1 taken 368 times.
|
368 | auto h = airLoopHVAC.handle(); |
| 365 |
2/2✓ Branch 5 taken 11 times.
✓ Branch 6 taken 365 times.
|
376 | for (const auto& loop : currentloops) { |
| 366 |
4/4✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 6 taken 3 times.
✓ Branch 7 taken 8 times.
|
11 | if (h == loop.handle()) { |
| 367 | 3 | return false; | |
| 368 | } | ||
| 369 | } | ||
| 370 | |||
| 371 |
1/1✓ Branch 1 taken 365 times.
|
365 | auto lastThermalZone = zoneForLastBranch(mixer); |
| 372 |
1/1✓ Branch 1 taken 365 times.
|
365 | auto lastAirTerminal = terminalForLastBranch(mixer); |
| 373 |
3/3✓ Branch 1 taken 365 times.
✓ Branch 4 taken 365 times.
✓ Branch 7 taken 365 times.
|
730 | auto modelObjects = airLoopHVAC.demandComponents(splitter, mixer); |
| 374 |
1/1✓ Branch 1 taken 365 times.
|
365 | auto hasSupplyPlenum = !subsetCastVector<AirLoopHVACSupplyPlenum>(modelObjects).empty(); |
| 375 |
1/1✓ Branch 1 taken 365 times.
|
365 | auto hasReturnPlenum = !subsetCastVector<AirLoopHVACReturnPlenum>(modelObjects).empty(); |
| 376 | |||
| 377 | // If all of these conditions are met, then clone the "last" air terminal | ||
| 378 |
11/12✓ Branch 1 taken 89 times.
✓ Branch 2 taken 276 times.
✓ Branch 3 taken 83 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 83 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 40 times.
✓ Branch 8 taken 43 times.
✓ Branch 9 taken 33 times.
✓ Branch 10 taken 7 times.
✓ Branch 11 taken 33 times.
✓ Branch 12 taken 332 times.
|
488 | if ((!optAirTerminal) && (!hasSupplyPlenum) && (!hasReturnPlenum) && lastThermalZone && lastAirTerminal) { |
| 379 | // clone the air terminal | ||
| 380 |
1/1✓ Branch 1 taken 33 times.
|
33 | Model t_model = airLoopHVAC.model(); |
| 381 |
4/4✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
✓ Branch 7 taken 33 times.
✓ Branch 10 taken 33 times.
|
33 | auto airTerminal = lastAirTerminal->clone(t_model).cast<HVACComponent>(); |
| 382 |
1/1✓ Branch 1 taken 33 times.
|
33 | optAirTerminal = airTerminal; |
| 383 | |||
| 384 | // Reconnect the cloned terminal to the plant loop(s) | ||
| 385 | |||
| 386 | // Special case for FourPipeInduction for now, which has both a cooling and heating plantLoop | ||
| 387 |
5/5✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
✓ Branch 7 taken 33 times.
✓ Branch 10 taken 3 times.
✓ Branch 11 taken 30 times.
|
33 | if (lastAirTerminal->iddObjectType() == IddObjectType::OS_AirTerminal_SingleDuct_ConstantVolume_FourPipeInduction) { |
| 388 | |||
| 389 | // Safe to directly cast | ||
| 390 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | auto lastAtuFourPipe = lastAirTerminal->cast<AirTerminalSingleDuctConstantVolumeFourPipeInduction>(); |
| 391 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto newAtuFourPipe = airTerminal.cast<AirTerminalSingleDuctConstantVolumeFourPipeInduction>(); |
| 392 | |||
| 393 | // If the original ATU's heating coil has a plant loop, reconnect it here | ||
| 394 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 1 time.
|
6 | if (boost::optional<PlantLoop> _heatingPl = lastAtuFourPipe.heatingCoil().plantLoop()) { |
| 395 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | _heatingPl->addDemandBranchForComponent(newAtuFourPipe.heatingCoil()); |
| 396 | 3 | } | |
| 397 | |||
| 398 | // If the original ATU has a cooling coil, if it's a CoilCoolingWater, and the cooling coil has a plantLoop, reconnect it here | ||
| 399 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 2 times.
|
6 | if (lastAtuFourPipe.coolingCoil()) { |
| 400 |
4/5✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 11 taken 1 time.
✗ Branch 12 not taken.
|
2 | if (boost::optional<CoilCoolingWater> _lastCC = lastAtuFourPipe.coolingCoil()->optionalCast<CoilCoolingWater>()) { |
| 401 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (boost::optional<PlantLoop> _coolingPl = _lastCC->plantLoop()) { |
| 402 |
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 | _coolingPl->addDemandBranchForComponent(newAtuFourPipe.coolingCoil().get()); |
| 403 | 1 | } | |
| 404 | 1 | } | |
| 405 | } | ||
| 406 | |||
| 407 | // Special case for FourPipeInduction, which has both optional cooling and heating coils, that can or cannot be linked to some PlantLoops | ||
| 408 |
5/5✓ Branch 3 taken 30 times.
✓ Branch 6 taken 30 times.
✓ Branch 9 taken 30 times.
✓ Branch 12 taken 1 time.
✓ Branch 13 taken 29 times.
|
33 | } else if (lastAirTerminal->iddObjectType() == IddObjectType::OS_AirTerminal_SingleDuct_ConstantVolume_FourPipeBeam) { |
| 409 | |||
| 410 | // Safe to directly cast (checked iddObjectType already) | ||
| 411 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | auto lastAtuFourPipeBeam = lastAirTerminal->cast<AirTerminalSingleDuctConstantVolumeFourPipeBeam>(); |
| 412 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto newAtuFourPipeBeam = airTerminal.cast<AirTerminalSingleDuctConstantVolumeFourPipeBeam>(); |
| 413 | |||
| 414 | 1 | boost::optional<PlantLoop> _loop; | |
| 415 | |||
| 416 | // If the original ATU has a cooling coil, and the cooling coil has a plantLoop, reconnect it here | ||
| 417 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<HVACComponent> _hc = lastAtuFourPipeBeam.heatingCoil(); |
| 418 |
6/12✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 time.
✗ Branch 13 not taken.
✓ Branch 15 taken 1 time.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
3 | if (_hc && (_loop = _hc->plantLoop())) { |
| 419 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<HVACComponent> _hcClone = newAtuFourPipeBeam.heatingCoil(); |
| 420 | // FourPipeBeam::clone should clone and re-set the coils, so it should have worked | ||
| 421 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
|
1 | OS_ASSERT(_hcClone); |
| 422 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | _loop->addDemandBranchForComponent(*_hcClone); |
| 423 | 1 | } | |
| 424 | |||
| 425 | // If the original ATU has a cooling coil, and the cooling coil has a plantLoop, reconnect it here | ||
| 426 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<HVACComponent> _cc = lastAtuFourPipeBeam.coolingCoil(); |
| 427 |
6/12✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 time.
✗ Branch 13 not taken.
✓ Branch 15 taken 1 time.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
3 | if (_cc && (_loop = _cc->plantLoop())) { |
| 428 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<HVACComponent> _ccClone = newAtuFourPipeBeam.coolingCoil(); |
| 429 | // FourPipeBeam::clone should clone and re-set the coils, so it should have worked | ||
| 430 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
|
1 | OS_ASSERT(_ccClone); |
| 431 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | _loop->addDemandBranchForComponent(*_ccClone); |
| 432 | 1 | } | |
| 433 | |||
| 434 | // Special case for CooledBeam, which isn't a HVAComponent but a StraightComponent | ||
| 435 |
5/5✓ Branch 6 taken 29 times.
✓ Branch 9 taken 29 times.
✓ Branch 12 taken 29 times.
✓ Branch 15 taken 1 time.
✓ Branch 16 taken 28 times.
|
30 | } else if (lastAirTerminal->iddObjectType() == IddObjectType::OS_AirTerminal_SingleDuct_ConstantVolume_CooledBeam) { |
| 436 | |||
| 437 | // Safe to directly cast | ||
| 438 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | auto lastAtuCooledBeam = lastAirTerminal->cast<AirTerminalSingleDuctConstantVolumeCooledBeam>(); |
| 439 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto newAtuCooledBeam = airTerminal.cast<AirTerminalSingleDuctConstantVolumeCooledBeam>(); |
| 440 | |||
| 441 | // If the original ATU's coilCoolingCooledBeam has a plant loop, reconnect it here | ||
| 442 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
|
2 | if (boost::optional<PlantLoop> _coolingPl = lastAtuCooledBeam.coilCoolingCooledBeam().plantLoop()) { |
| 443 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | _coolingPl->addDemandBranchForComponent(newAtuCooledBeam.coilCoolingCooledBeam()); |
| 444 | 1 | } | |
| 445 | |||
| 446 | 1 | } else { | |
| 447 | |||
| 448 | // Default (old) behavior should work here, only a possible heating coil | ||
| 449 |
2/2✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
|
28 | boost::optional<PlantLoop> plantLoop = plantForAirTerminal(lastAirTerminal.get()); |
| 450 | |||
| 451 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 21 times.
|
28 | if (plantLoop) { |
| 452 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | setPlantForAirTerminal(airTerminal, plantLoop.get()); |
| 453 | } | ||
| 454 | 28 | } | |
| 455 | 33 | } | |
| 456 | |||
| 457 |
1/1✓ Branch 1 taken 365 times.
|
365 | thermalZone.setUseIdealAirLoads(false); |
| 458 | |||
| 459 | 365 | boost::optional<Node> node; | |
| 460 |
3/3✓ Branch 1 taken 365 times.
✓ Branch 4 taken 365 times.
✓ Branch 7 taken 365 times.
|
1095 | std::vector<ModelObject> objects = airLoopHVAC.demandComponents(splitter, mixer); |
| 461 | |||
| 462 |
6/6✓ Branch 0 taken 69 times.
✓ Branch 1 taken 296 times.
✓ Branch 3 taken 14 times.
✓ Branch 4 taken 55 times.
✓ Branch 5 taken 14 times.
✓ Branch 6 taken 351 times.
|
365 | if (lastAirTerminal && (!lastThermalZone)) { |
| 463 |
5/5✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✓ Branch 10 taken 14 times.
✓ Branch 13 taken 14 times.
|
28 | auto t_comps = airLoopHVAC.demandComponents(lastAirTerminal.get(), airLoopHVAC.demandOutletNode()); |
| 464 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✗ Branch 4 not taken.
|
14 | OS_ASSERT(t_comps.size() > 1); |
| 465 |
1/1✓ Branch 2 taken 14 times.
|
14 | auto t_comp = t_comps[1]; |
| 466 |
1/1✓ Branch 1 taken 14 times.
|
14 | node = t_comp.optionalCast<Node>(); |
| 467 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✗ Branch 4 not taken.
|
14 | OS_ASSERT(node); |
| 468 |
2/2✓ Branch 3 taken 281 times.
✓ Branch 4 taken 70 times.
|
365 | } else if (objects.size() == 3u) { |
| 469 |
1/1✓ Branch 2 taken 281 times.
|
281 | node = objects[1].optionalCast<Node>(); |
| 470 | } | ||
| 471 | |||
| 472 |
2/2✓ Branch 1 taken 70 times.
✓ Branch 2 taken 295 times.
|
365 | if (!node) { |
| 473 |
1/1✓ Branch 1 taken 70 times.
|
70 | int nextOutletPort = splitter.nextOutletPort(); |
| 474 |
1/1✓ Branch 1 taken 70 times.
|
70 | int nextInletPort = mixer.nextInletPort(); |
| 475 | |||
| 476 |
1/1✓ Branch 1 taken 70 times.
|
70 | Node newNode(_model); |
| 477 | |||
| 478 |
4/4✓ Branch 1 taken 70 times.
✓ Branch 4 taken 70 times.
✓ Branch 7 taken 70 times.
✓ Branch 10 taken 70 times.
|
70 | _model.connect(splitter, nextOutletPort, newNode, newNode.inletPort()); |
| 479 |
4/4✓ Branch 1 taken 70 times.
✓ Branch 4 taken 70 times.
✓ Branch 7 taken 70 times.
✓ Branch 10 taken 70 times.
|
70 | _model.connect(newNode, newNode.outletPort(), mixer, nextInletPort); |
| 480 | |||
| 481 |
1/1✓ Branch 1 taken 70 times.
|
70 | node = newNode; |
| 482 | 70 | } | |
| 483 | |||
| 484 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 365 times.
✗ Branch 4 not taken.
|
365 | OS_ASSERT(node); |
| 485 | |||
| 486 |
2/2✓ Branch 0 taken 356 times.
✓ Branch 1 taken 9 times.
|
365 | if (removeCurrentZones) { |
| 487 |
2/2✓ Branch 1 taken 356 times.
✓ Branch 4 taken 356 times.
|
356 | thermalZone.addToNode(node.get()); |
| 488 | } else { | ||
| 489 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | thermalZone.multiAddToNode(node.get()); |
| 490 | } | ||
| 491 | |||
| 492 |
2/2✓ Branch 0 taken 309 times.
✓ Branch 1 taken 56 times.
|
365 | if (optAirTerminal) { |
| 493 |
3/3✓ Branch 1 taken 309 times.
✓ Branch 4 taken 309 times.
✓ Branch 7 taken 309 times.
|
309 | optAirTerminal->addToNode(node.get()); |
| 494 | } | ||
| 495 | |||
| 496 | 365 | return true; | |
| 497 | 369 | } | |
| 498 | |||
| 499 | 28 | boost::optional<PlantLoop> AirLoopHVAC_Impl::plantForAirTerminal(HVACComponent& airTerminal) { | |
| 500 | // TODO: two problems | ||
| 501 | // One is that terminals such as AirTerminalSingleDuctConstantVolumeFourPipeInduction actually | ||
| 502 | // have both a heating and a cooling coil... | ||
| 503 | // The other is the CooledBeam terminal has a CoilCoolingCooledBeam that is a StraightComponent, no a WaterToAir one. | ||
| 504 |
2/2✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
|
28 | std::vector<WaterToAirComponent> comps = airTerminal.model().getModelObjects<WaterToAirComponent>(); |
| 505 | |||
| 506 |
2/2✓ Branch 5 taken 14 times.
✓ Branch 6 taken 21 times.
|
35 | for (const auto& elem : comps) { |
| 507 |
2/3✓ Branch 1 taken 14 times.
✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
|
28 | if (boost::optional<HVACComponent> comp = elem.containingHVACComponent()) { |
| 508 |
4/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 6 taken 7 times.
✓ Branch 7 taken 7 times.
|
14 | if (comp.get() == airTerminal) { |
| 509 |
2/3✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
|
14 | if (boost::optional<PlantLoop> plantLoop = elem.plantLoop()) { |
| 510 | 7 | return plantLoop; | |
| 511 | } else { | ||
| 512 | ✗ | return boost::none; | |
| 513 | 7 | } | |
| 514 | } | ||
| 515 | 14 | } | |
| 516 | } | ||
| 517 | |||
| 518 | 21 | return boost::none; | |
| 519 | 28 | } | |
| 520 | |||
| 521 | 7 | bool AirLoopHVAC_Impl::setPlantForAirTerminal(HVACComponent& airTerminal, PlantLoop& plantLoop) { | |
| 522 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | std::vector<WaterToAirComponent> comps = airTerminal.model().getModelObjects<WaterToAirComponent>(); |
| 523 | |||
| 524 |
1/2✓ Branch 5 taken 7 times.
✗ Branch 6 not taken.
|
7 | for (const auto& elem : comps) { |
| 525 |
2/3✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
|
14 | if (boost::optional<HVACComponent> comp = elem.containingHVACComponent()) { |
| 526 |
3/4✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 6 taken 7 times.
✗ Branch 7 not taken.
|
7 | if (comp.get() == airTerminal) { |
| 527 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | return plantLoop.addDemandBranchForComponent(elem); |
| 528 | } | ||
| 529 | 7 | } | |
| 530 | } | ||
| 531 | ✗ | return false; | |
| 532 | 7 | } | |
| 533 | |||
| 534 | 31 | bool AirLoopHVAC_Impl::removeBranchForZone(ThermalZone& thermalZone) { | |
| 535 |
1/1✓ Branch 1 taken 31 times.
|
31 | Model _model = model(); |
| 536 | |||
| 537 |
1/1✓ Branch 1 taken 31 times.
|
31 | auto splitter = zoneSplitter(); |
| 538 |
1/1✓ Branch 1 taken 31 times.
|
31 | auto mixer = zoneMixer(); |
| 539 |
1/1✓ Branch 1 taken 31 times.
|
31 | auto airloop = getObject<AirLoopHVAC>(); |
| 540 | |||
| 541 | // Before we go wrecking the loop, cleanly remove anything that is not a node or zone | ||
| 542 | // (ie terminals). This is important because dual duct terminals especially have to worry about | ||
| 543 | // the second duct on their removal. | ||
| 544 |
4/4✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
✓ Branch 7 taken 31 times.
✓ Branch 10 taken 31 times.
|
62 | auto modelObjects = subsetCastVector<HVACComponent>(demandComponents(splitter, thermalZone)); |
| 545 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
|
31 | if (modelObjects.empty()) { |
| 546 | ✗ | return false; | |
| 547 | } | ||
| 548 | |||
| 549 |
3/3✓ Branch 1 taken 65 times.
✓ Branch 5 taken 34 times.
✓ Branch 6 taken 31 times.
|
65 | for (unsigned i = 0; i < demandInletNodes().size(); ++i) { |
| 550 |
1/1✓ Branch 1 taken 34 times.
|
34 | thermalZone.removeSupplyPlenum(airloop, i); |
| 551 | } | ||
| 552 |
1/1✓ Branch 1 taken 31 times.
|
31 | thermalZone.removeReturnPlenum(airloop); |
| 553 | |||
| 554 |
2/2✓ Branch 5 taken 139 times.
✓ Branch 6 taken 31 times.
|
170 | for (auto& modelObject : modelObjects) { |
| 555 |
11/16✓ Branch 1 taken 139 times.
✓ Branch 4 taken 85 times.
✓ Branch 5 taken 54 times.
✓ Branch 7 taken 85 times.
✓ Branch 10 taken 54 times.
✓ Branch 11 taken 31 times.
✓ Branch 12 taken 85 times.
✓ Branch 13 taken 54 times.
✓ Branch 15 taken 139 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 54 times.
✓ Branch 19 taken 85 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
|
139 | if ((!modelObject.optionalCast<Node>()) && (!modelObject.optionalCast<ThermalZone>())) { |
| 556 |
1/1✓ Branch 1 taken 54 times.
|
54 | modelObject.remove(); |
| 557 | } | ||
| 558 | } | ||
| 559 | |||
| 560 |
4/4✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
✓ Branch 7 taken 31 times.
✓ Branch 10 taken 31 times.
|
62 | modelObjects = subsetCastVector<HVACComponent>(demandComponents(thermalZone, mixer)); |
| 561 |
1/1✓ Branch 3 taken 31 times.
|
31 | auto mixerInletObject = modelObjects[modelObjects.size() - 2].cast<HVACComponent>(); |
| 562 |
1/1✓ Branch 2 taken 31 times.
|
31 | auto zoneOutletObject = modelObjects[1].cast<HVACComponent>(); |
| 563 | |||
| 564 |
4/4✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
✓ Branch 7 taken 31 times.
✓ Branch 10 taken 31 times.
|
62 | modelObjects = subsetCastVector<HVACComponent>(demandComponents(splitter, thermalZone)); |
| 565 |
1/1✓ Branch 2 taken 31 times.
|
31 | auto splitterOutletObject = modelObjects[1].cast<HVACComponent>(); |
| 566 |
1/1✓ Branch 3 taken 31 times.
|
31 | auto zoneInletObject = modelObjects[modelObjects.size() - 2].cast<HVACComponent>(); |
| 567 | |||
| 568 |
4/4✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
✓ Branch 7 taken 31 times.
✓ Branch 10 taken 31 times.
|
62 | modelObjects = subsetCastVector<HVACComponent>(demandComponents(splitterOutletObject, mixerInletObject)); |
| 569 | |||
| 570 |
1/1✓ Branch 1 taken 31 times.
|
31 | auto inletPortList = thermalZone.inletPortList(); |
| 571 |
1/1✓ Branch 1 taken 31 times.
|
31 | auto returnPortList = thermalZone.returnPortList(); |
| 572 | |||
| 573 |
1/1✓ Branch 1 taken 31 times.
|
31 | auto inletportindex = inletPortList.portIndexForModelObject(zoneInletObject); |
| 574 |
2/2✓ Branch 3 taken 31 times.
✓ Branch 6 taken 31 times.
|
31 | inletPortList.getImpl<model::detail::PortList_Impl>()->removePort(inletPortList.port(inletportindex)); |
| 575 | |||
| 576 |
1/1✓ Branch 1 taken 31 times.
|
31 | auto returnportindex = returnPortList.portIndexForModelObject(zoneOutletObject); |
| 577 |
2/2✓ Branch 3 taken 31 times.
✓ Branch 6 taken 31 times.
|
31 | returnPortList.getImpl<model::detail::PortList_Impl>()->removePort(returnPortList.port(returnportindex)); |
| 578 | |||
| 579 |
3/3✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
✓ Branch 7 taken 31 times.
|
31 | splitter.removePortForBranch(splitter.branchIndexForOutletModelObject(splitterOutletObject)); |
| 580 |
2/2✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
|
31 | mixer.removePortForBranch(mixer.branchIndexForInletModelObject(mixerInletObject)); |
| 581 | |||
| 582 |
2/2✓ Branch 5 taken 93 times.
✓ Branch 6 taken 31 times.
|
124 | for (auto& modelObject : modelObjects) { |
| 583 |
3/3✓ Branch 1 taken 93 times.
✓ Branch 4 taken 31 times.
✓ Branch 5 taken 62 times.
|
186 | if (modelObject.optionalCast<ThermalZone>()) { |
| 584 | // This is to reset the cache | ||
| 585 | 31 | modelObject.getImpl<model::detail::HVACComponent_Impl>()->m_airLoopHVAC = boost::none; | |
| 586 | } else { | ||
| 587 |
1/1✓ Branch 1 taken 62 times.
|
62 | modelObject.remove(); |
| 588 | } | ||
| 589 | } | ||
| 590 | |||
| 591 | { | ||
| 592 | std::vector<SetpointManagerSingleZoneReheat> setpointManagers = | ||
| 593 |
3/3✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
✓ Branch 7 taken 31 times.
|
31 | subsetCastVector<SetpointManagerSingleZoneReheat>(supplyOutletNode().setpointManagers()); |
| 594 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 2 taken 19 times.
|
31 | if (!setpointManagers.empty()) { |
| 595 |
1/1✓ Branch 2 taken 12 times.
|
12 | SetpointManagerSingleZoneReheat spm = setpointManagers.front(); |
| 596 |
4/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 11 times.
✓ Branch 8 taken 1 time.
|
12 | if (spm.controlZone() == thermalZone) { |
| 597 |
1/1✓ Branch 1 taken 11 times.
|
11 | spm.resetControlZone(); |
| 598 | } | ||
| 599 | 12 | } | |
| 600 | 31 | } | |
| 601 | |||
| 602 | { | ||
| 603 | std::vector<SetpointManagerSingleZoneCooling> setpointManagers = | ||
| 604 |
3/3✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
✓ Branch 7 taken 31 times.
|
31 | subsetCastVector<SetpointManagerSingleZoneCooling>(supplyOutletNode().setpointManagers()); |
| 605 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
|
31 | if (!setpointManagers.empty()) { |
| 606 | ✗ | SetpointManagerSingleZoneCooling spm = setpointManagers.front(); | |
| 607 | ✗ | if (spm.controlZone() == thermalZone) { | |
| 608 | ✗ | spm.resetControlZone(); | |
| 609 | } | ||
| 610 | ✗ | } | |
| 611 | 31 | } | |
| 612 | |||
| 613 | { | ||
| 614 | std::vector<SetpointManagerSingleZoneHeating> setpointManagers = | ||
| 615 |
3/3✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
✓ Branch 7 taken 31 times.
|
31 | subsetCastVector<SetpointManagerSingleZoneHeating>(supplyOutletNode().setpointManagers()); |
| 616 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
|
31 | if (!setpointManagers.empty()) { |
| 617 | ✗ | SetpointManagerSingleZoneHeating spm = setpointManagers.front(); | |
| 618 | ✗ | if (spm.controlZone() == thermalZone) { | |
| 619 | ✗ | spm.resetControlZone(); | |
| 620 | } | ||
| 621 | ✗ | } | |
| 622 | 31 | } | |
| 623 | |||
| 624 |
10/16✓ Branch 1 taken 31 times.
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 26 times.
✓ Branch 7 taken 5 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 5 times.
✓ Branch 12 taken 5 times.
✓ Branch 13 taken 26 times.
✓ Branch 15 taken 31 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 26 times.
✓ Branch 19 taken 5 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
|
31 | if ((!splitter.lastOutletModelObject()) || (!mixer.lastInletModelObject())) { |
| 625 |
1/1✓ Branch 1 taken 26 times.
|
26 | Node newNode(_model); |
| 626 |
5/5✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
✓ Branch 10 taken 26 times.
✓ Branch 13 taken 26 times.
|
26 | _model.connect(splitter, splitter.nextOutletPort(), newNode, newNode.inletPort()); |
| 627 |
5/5✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
✓ Branch 10 taken 26 times.
✓ Branch 13 taken 26 times.
|
26 | _model.connect(newNode, newNode.outletPort(), mixer, mixer.nextInletPort()); |
| 628 | 26 | } | |
| 629 | |||
| 630 | 31 | return true; | |
| 631 | 31 | } | |
| 632 | |||
| 633 | 752 | AirLoopHVACZoneMixer AirLoopHVAC_Impl::zoneMixer() const { | |
| 634 |
2/2✓ Branch 1 taken 752 times.
✓ Branch 4 taken 752 times.
|
752 | auto result = getObject<ModelObject>().getModelObjectTarget<AirLoopHVACZoneMixer>(OS_AirLoopHVACFields::DemandMixerName); |
| 635 |
2/2✓ Branch 0 taken 742 times.
✓ Branch 1 taken 10 times.
|
752 | if (result) { |
| 636 |
2/2✓ Branch 1 taken 742 times.
✓ Branch 4 taken 742 times.
|
742 | return result.get(); |
| 637 | } | ||
| 638 | |||
| 639 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
10 | std::vector<AirLoopHVACZoneMixer> mixers = subsetCastVector<AirLoopHVACZoneMixer>(demandComponents(IddObjectType::OS_AirLoopHVAC_ZoneMixer)); |
| 640 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✗ Branch 4 not taken.
|
10 | OS_ASSERT(!mixers.empty()); |
| 641 |
1/1✓ Branch 2 taken 10 times.
|
10 | auto mixer = mixers.front(); |
| 642 | 10 | return mixer; | |
| 643 | 752 | } | |
| 644 | |||
| 645 | 714 | bool AirLoopHVAC_Impl::setZoneMixer(Mixer const& mixer) { | |
| 646 |
2/2✓ Branch 1 taken 714 times.
✓ Branch 4 taken 714 times.
|
714 | auto result = setPointer(OS_AirLoopHVACFields::DemandMixerName, mixer.handle()); |
| 647 | 714 | return result; | |
| 648 | } | ||
| 649 | |||
| 650 | 1057 | AirLoopHVACZoneSplitter AirLoopHVAC_Impl::zoneSplitter() const { | |
| 651 |
2/2✓ Branch 1 taken 1057 times.
✓ Branch 4 taken 1057 times.
|
1057 | auto result = getObject<ModelObject>().getModelObjectTarget<AirLoopHVACZoneSplitter>(OS_AirLoopHVACFields::DemandSplitterAName); |
| 652 |
1/2✓ Branch 0 taken 1057 times.
✗ Branch 1 not taken.
|
1057 | if (result) { |
| 653 |
2/2✓ Branch 1 taken 1057 times.
✓ Branch 4 taken 1057 times.
|
1057 | return result.get(); |
| 654 | } | ||
| 655 | |||
| 656 | auto splitters = subsetCastVector<AirLoopHVACZoneSplitter>( | ||
| 657 | ✗ | demandComponents(demandInletNode(), demandOutletNode(), IddObjectType::OS_AirLoopHVAC_ZoneSplitter)); | |
| 658 | ✗ | OS_ASSERT(splitters.size() == 1u); | |
| 659 | ✗ | auto splitter = splitters.front(); | |
| 660 | ✗ | return splitter; | |
| 661 | 1057 | } | |
| 662 | |||
| 663 | 732 | bool AirLoopHVAC_Impl::setZoneSplitter(Splitter const& splitter, int path) { | |
| 664 | 732 | bool result = false; | |
| 665 |
2/2✓ Branch 0 taken 714 times.
✓ Branch 1 taken 18 times.
|
732 | if (path == 0) { |
| 666 |
2/2✓ Branch 1 taken 714 times.
✓ Branch 4 taken 714 times.
|
714 | result = setPointer(OS_AirLoopHVACFields::DemandSplitterAName, splitter.handle()); |
| 667 | } else { | ||
| 668 |
2/2✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
|
18 | result = setPointer(OS_AirLoopHVACFields::DemandSplitterBName, splitter.handle()); |
| 669 | } | ||
| 670 | 732 | return result; | |
| 671 | } | ||
| 672 | |||
| 673 | 6 | void AirLoopHVAC_Impl::resetZoneSplitter(int path) { | |
| 674 | 6 | bool result = false; | |
| 675 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (path == 0) { |
| 676 | ✗ | result = setString(OS_AirLoopHVACFields::DemandSplitterAName, ""); | |
| 677 | } else { | ||
| 678 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
18 | result = setString(OS_AirLoopHVACFields::DemandSplitterBName, ""); |
| 679 | } | ||
| 680 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | OS_ASSERT(result); |
| 681 | 6 | } | |
| 682 | |||
| 683 | 92 | std::vector<AirLoopHVACZoneSplitter> AirLoopHVAC_Impl::zoneSplitters() const { | |
| 684 |
3/5✓ Branch 1 taken 92 times.
✓ Branch 3 taken 92 times.
✓ Branch 4 taken 92 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
276 | std::vector<AirLoopHVACZoneSplitter> splitters{zoneSplitter()}; |
| 685 |
1/1✓ Branch 1 taken 92 times.
|
92 | auto t_demandInletNodes = demandInletNodes(); |
| 686 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 2 taken 62 times.
|
92 | if (t_demandInletNodes.size() == 2u) { |
| 687 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | auto result = getObject<ModelObject>().getModelObjectTarget<AirLoopHVACZoneSplitter>(OS_AirLoopHVACFields::DemandSplitterBName); |
| 688 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if (result) { |
| 689 |
2/2✓ Branch 1 taken 30 times.
✓ Branch 4 taken 30 times.
|
30 | splitters.push_back(result.get()); |
| 690 | 30 | return splitters; | |
| 691 | } | ||
| 692 | |||
| 693 | ✗ | auto inletNode = t_demandInletNodes[1]; | |
| 694 | auto splitters2 = | ||
| 695 | ✗ | subsetCastVector<AirLoopHVACZoneSplitter>(demandComponents(inletNode, demandOutletNode(), IddObjectType::OS_AirLoopHVAC_ZoneSplitter)); | |
| 696 | ✗ | OS_ASSERT(splitters2.size() == 1u); | |
| 697 | ✗ | auto splitter = splitters2.front(); | |
| 698 | ✗ | splitters.push_back(splitter); | |
| 699 | 30 | } | |
| 700 | 62 | return splitters; | |
| 701 | 184 | } | |
| 702 | |||
| 703 | 10 | ModelObject AirLoopHVAC_Impl::clone(Model model) const { | |
| 704 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
10 | auto airLoopClone = Loop_Impl::clone(model).cast<AirLoopHVAC>(); |
| 705 | |||
| 706 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
20 | airLoopClone.setString(supplyInletPort(), ""); |
| 707 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
20 | airLoopClone.setString(supplyOutletPortA(), ""); |
| 708 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
20 | airLoopClone.setString(supplyOutletPortB(), ""); |
| 709 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
20 | airLoopClone.setString(demandInletPortA(), ""); |
| 710 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
20 | airLoopClone.setString(demandInletPortB(), ""); |
| 711 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
10 | airLoopClone.setString(demandOutletPort(), ""); |
| 712 | |||
| 713 | // Sizing:System was already cloned because it is declared as a child | ||
| 714 | // And because it has the setParent method overriden, no need to do anything | ||
| 715 | |||
| 716 | { | ||
| 717 |
4/4✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
|
10 | auto clone = availabilitySchedule().clone(model).cast<Schedule>(); |
| 718 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | airLoopClone.setPointer(OS_AirLoopHVACFields::AvailabilitySchedule, clone.handle()); |
| 719 | 10 | } | |
| 720 | |||
| 721 | { | ||
| 722 |
4/4✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
|
10 | auto avmListClone = availabilityManagerAssignmentList().clone(model).cast<AvailabilityManagerAssignmentList>(); |
| 723 |
4/4✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
|
10 | avmListClone.setName(airLoopClone.name().get() + " AvailabilityManagerAssigmentList"); |
| 724 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | airLoopClone.setPointer(OS_AirLoopHVACFields::AvailabilityManagerListName, avmListClone.handle()); |
| 725 | 10 | } | |
| 726 | |||
| 727 |
1/1✓ Branch 3 taken 10 times.
|
10 | airLoopClone.getImpl<detail::AirLoopHVAC_Impl>()->createTopology(); |
| 728 | |||
| 729 | struct HVACPath | ||
| 730 | { | ||
| 731 | 14 | HVACPath(const HVACComponent& t_originalStart, const HVACComponent& t_originalEnd, const HVACComponent& t_clonedStartOrEndOfPath, | |
| 732 | const Node& t_clonedAddNode, bool t_reverse) | ||
| 733 | 14 | : originalStart(t_originalStart), | |
| 734 |
1/1✓ Branch 1 taken 14 times.
|
14 | originalEnd(t_originalEnd), |
| 735 |
1/1✓ Branch 1 taken 14 times.
|
14 | clonedStartOrEndOfPath(t_clonedStartOrEndOfPath), |
| 736 |
1/1✓ Branch 1 taken 14 times.
|
14 | clonedAddNode(t_clonedAddNode), |
| 737 | 14 | reverse(t_reverse){}; | |
| 738 | |||
| 739 | HVACComponent originalStart; | ||
| 740 | HVACComponent originalEnd; | ||
| 741 | HVACComponent clonedStartOrEndOfPath; // If reverse is false, it's the start, if reverse is true, it's the end | ||
| 742 | Node clonedAddNode; | ||
| 743 | bool reverse; | ||
| 744 | }; | ||
| 745 | |||
| 746 | 10 | std::vector<HVACPath> pathsToHandle; | |
| 747 | |||
| 748 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 8 times.
|
10 | if (isDualDuct()) { |
| 749 | // Add the Splitter to make it a dual duct | ||
| 750 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto supplyInletNodeClone = airLoopClone.supplyInletNode(); |
| 751 |
1/1✓ Branch 1 taken 2 times.
|
2 | ConnectorSplitter supplySplitterClone(model); |
| 752 |
1/1✓ Branch 1 taken 2 times.
|
2 | supplySplitterClone.addToNode(supplyInletNodeClone); |
| 753 |
1/1✓ Branch 3 taken 2 times.
|
2 | airLoopClone.getImpl<detail::AirLoopHVAC_Impl>()->setSupplySplitter(supplySplitterClone); |
| 754 | |||
| 755 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto supplyOutletNodeClones = airLoopClone.supplyOutletNodes(); |
| 756 | |||
| 757 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | auto supplySplitter = this->supplySplitter().get(); |
| 758 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto supplyInletNode = this->supplyInletNode(); |
| 759 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto supplyOutletNodes = this->supplyOutletNodes(); |
| 760 | |||
| 761 |
1/1✓ Branch 1 taken 2 times.
|
2 | pathsToHandle.emplace_back(supplyInletNode, supplySplitter, supplySplitterClone, supplyInletNodeClone, true); |
| 762 |
1/1✓ Branch 3 taken 2 times.
|
2 | pathsToHandle.emplace_back(supplySplitter, supplyOutletNodes[0], supplySplitterClone, supplyOutletNodeClones[0], false); |
| 763 |
1/1✓ Branch 3 taken 2 times.
|
2 | pathsToHandle.emplace_back(supplySplitter, supplyOutletNodes[1], supplySplitterClone, supplyOutletNodeClones[1], false); |
| 764 | |||
| 765 | 2 | } else { | |
| 766 | |||
| 767 |
4/4✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✓ Branch 10 taken 8 times.
|
8 | pathsToHandle.emplace_back(this->supplyInletNode(), this->supplyOutletNode(), airLoopClone.supplyInletNode(), airLoopClone.supplyOutletNode(), |
| 768 |
1/1✓ Branch 1 taken 8 times.
|
16 | false); |
| 769 | } | ||
| 770 | |||
| 771 |
2/2✓ Branch 5 taken 14 times.
✓ Branch 6 taken 10 times.
|
24 | for (const auto& path : pathsToHandle) { |
| 772 | |||
| 773 |
3/3✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
|
28 | auto supplyComps = supplyComponents(path.originalStart, path.originalEnd); |
| 774 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 12 times.
|
14 | if (path.reverse) { |
| 775 |
1/1✓ Branch 3 taken 2 times.
|
2 | std::reverse(supplyComps.begin(), supplyComps.end()); |
| 776 | } | ||
| 777 |
1/1✓ Branch 1 taken 14 times.
|
14 | auto clonedAddNode = path.clonedAddNode; |
| 778 | 14 | std::vector<Node> supplyNodes; | |
| 779 | |||
| 780 |
2/2✓ Branch 5 taken 41 times.
✓ Branch 6 taken 14 times.
|
55 | for (const auto& comp : supplyComps) { |
| 781 |
4/4✓ Branch 1 taken 41 times.
✓ Branch 4 taken 41 times.
✓ Branch 7 taken 26 times.
✓ Branch 8 taken 15 times.
|
41 | if (comp.iddObjectType() == Node::iddObjectType()) { |
| 782 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | supplyNodes.push_back(comp.cast<Node>()); |
| 783 | // Don't want to clone the splitter... | ||
| 784 |
4/4✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
✓ Branch 7 taken 9 times.
✓ Branch 8 taken 6 times.
|
15 | } else if (comp.iddObjectType() != ConnectorSplitter::iddObjectType()) { |
| 785 |
3/3✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
|
9 | auto compClone = comp.clone(model).cast<HVACComponent>(); |
| 786 |
1/1✓ Branch 1 taken 9 times.
|
9 | compClone.addToNode(clonedAddNode); |
| 787 | // If the original component was also on a PlantLoop | ||
| 788 |
2/3✓ Branch 1 taken 9 times.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
|
18 | if (boost::optional<HVACComponent> hvacComp = comp.optionalCast<HVACComponent>()) { |
| 789 |
4/4✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 6 taken 6 times.
✓ Branch 7 taken 3 times.
|
18 | if (boost::optional<PlantLoop> pl = hvacComp->plantLoop()) { |
| 790 | // Connect the clone to the plantLoop too | ||
| 791 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
|
6 | pl->addDemandBranchForComponent(compClone); |
| 792 | 9 | } | |
| 793 | 9 | } | |
| 794 | 9 | } | |
| 795 | } | ||
| 796 | |||
| 797 | 14 | std::vector<ModelObject> supplyCompClones; | |
| 798 | |||
| 799 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 12 times.
|
14 | if (path.reverse) { |
| 800 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | supplyCompClones = airLoopClone.supplyComponents(path.clonedAddNode, path.clonedStartOrEndOfPath); |
| 801 |
1/1✓ Branch 3 taken 2 times.
|
2 | std::reverse(supplyCompClones.begin(), supplyCompClones.end()); |
| 802 | } else { | ||
| 803 |
3/3✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
|
24 | supplyCompClones = airLoopClone.supplyComponents(path.clonedStartOrEndOfPath, path.clonedAddNode); |
| 804 | } | ||
| 805 | |||
| 806 |
1/1✓ Branch 1 taken 14 times.
|
14 | auto supplyNodeClones = subsetCastVector<Node>(supplyCompClones); |
| 807 | |||
| 808 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 14 times.
✗ Branch 5 not taken.
|
14 | OS_ASSERT(supplyNodes.size() == supplyNodeClones.size()); |
| 809 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 2 taken 14 times.
|
40 | for (size_t i = 0; i < supplyNodes.size(); ++i) { |
| 810 |
1/1✓ Branch 2 taken 26 times.
|
26 | const auto node = supplyNodes[i]; |
| 811 |
1/1✓ Branch 2 taken 26 times.
|
26 | auto cloneNode = supplyNodeClones[i]; |
| 812 | |||
| 813 |
1/1✓ Branch 1 taken 26 times.
|
26 | auto spms = node.setpointManagers(); |
| 814 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 26 times.
|
26 | for (const auto& spm : spms) { |
| 815 | ✗ | auto spmclone = spm.clone(model).cast<SetpointManager>(); | |
| 816 | ✗ | spmclone.addToNode(cloneNode); | |
| 817 | ✗ | } | |
| 818 | 26 | } | |
| 819 | 14 | } | |
| 820 | |||
| 821 | // Demand Side: same regardless of whether it's a Dual Duct or not | ||
| 822 | |||
| 823 |
1/1✓ Branch 1 taken 10 times.
|
10 | auto terms = terminals(); |
| 824 | 10 | std::vector<IddObjectType> termtypes; | |
| 825 | |||
| 826 |
3/3✓ Branch 3 taken 10 times.
✓ Branch 6 taken 2 times.
✓ Branch 9 taken 2 times.
|
12 | std::for_each(terms.begin(), terms.end(), [&termtypes](const HVACComponent& comp) { termtypes.push_back(comp.iddObjectType()); }); |
| 827 | |||
| 828 | // std::unique only works on sorted vectors, need to sort | ||
| 829 |
1/1✓ Branch 3 taken 10 times.
|
10 | std::sort(termtypes.begin(), termtypes.end()); |
| 830 |
2/2✓ Branch 3 taken 10 times.
✓ Branch 7 taken 10 times.
|
10 | auto uniquetypes = std::vector<IddObjectType>(termtypes.begin(), std::unique(termtypes.begin(), termtypes.end())); |
| 831 | 10 | std::vector<HVACComponent> uniqueterms; | |
| 832 | |||
| 833 |
2/2✓ Branch 5 taken 2 times.
✓ Branch 6 taken 10 times.
|
12 | for (const auto& type : uniquetypes) { |
| 834 |
2/2✓ Branch 3 taken 2 times.
✓ Branch 6 taken 2 times.
|
4 | auto it = std::find_if(terms.begin(), terms.end(), [&type](const HVACComponent& comp) { return (type == comp.iddObjectType()); }); |
| 835 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | if (it != terms.end()) { |
| 836 |
1/1✓ Branch 2 taken 2 times.
|
2 | uniqueterms.push_back(*it); |
| 837 | } | ||
| 838 | } | ||
| 839 | |||
| 840 |
2/2✓ Branch 5 taken 2 times.
✓ Branch 6 taken 10 times.
|
12 | for (const auto& term : uniqueterms) { |
| 841 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | auto termclone = term.clone(model).cast<HVACComponent>(); |
| 842 |
1/1✓ Branch 1 taken 2 times.
|
2 | airLoopClone.addBranchForHVACComponent(termclone); |
| 843 | 2 | } | |
| 844 | |||
| 845 | 20 | return std::move(airLoopClone); | |
| 846 | 10 | } | |
| 847 | |||
| 848 | 10 | std::vector<HVACComponent> AirLoopHVAC_Impl::terminals() const { | |
| 849 |
4/4✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
|
20 | auto demandComps = subsetCastVector<HVACComponent>(demandComponents()); |
| 850 | |||
| 851 | 58 | auto notterminal = [](const HVACComponent& comp) { | |
| 852 | 58 | bool result = false; | |
| 853 |
1/1✓ Branch 1 taken 58 times.
|
58 | const auto type = comp.iddObjectType(); |
| 854 | |||
| 855 |
3/3✓ Branch 1 taken 58 times.
✓ Branch 4 taken 34 times.
✓ Branch 5 taken 24 times.
|
58 | if (type == Node::iddObjectType()) { |
| 856 | 34 | result = true; | |
| 857 |
3/3✓ Branch 1 taken 24 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 22 times.
|
24 | } else if (type == ThermalZone::iddObjectType()) { |
| 858 | 2 | result = true; | |
| 859 |
3/3✓ Branch 1 taken 22 times.
✓ Branch 4 taken 10 times.
✓ Branch 5 taken 12 times.
|
22 | } else if (type == AirLoopHVACZoneSplitter::iddObjectType()) { |
| 860 | 10 | result = true; | |
| 861 |
3/3✓ Branch 1 taken 12 times.
✓ Branch 4 taken 10 times.
✓ Branch 5 taken 2 times.
|
12 | } else if (type == AirLoopHVACZoneMixer::iddObjectType()) { |
| 862 | 10 | result = true; | |
| 863 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
2 | } else if (type == AirLoopHVACSupplyPlenum::iddObjectType()) { |
| 864 | ✗ | result = true; | |
| 865 |
2/3✓ Branch 1 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
2 | } else if (type == AirLoopHVACReturnPlenum::iddObjectType()) { |
| 866 | ✗ | result = true; | |
| 867 | } | ||
| 868 | |||
| 869 | 58 | return result; | |
| 870 | }; | ||
| 871 | |||
| 872 |
1/1✓ Branch 3 taken 10 times.
|
10 | auto end = std::remove_if(demandComps.begin(), demandComps.end(), notterminal); |
| 873 | |||
| 874 |
1/1✓ Branch 2 taken 10 times.
|
30 | return {demandComps.begin(), end}; |
| 875 | 10 | } | |
| 876 | |||
| 877 | 62 | std::vector<ModelObject> AirLoopHVAC_Impl::oaComponents(openstudio::IddObjectType type) const { | |
| 878 |
3/3✓ Branch 1 taken 62 times.
✓ Branch 4 taken 20 times.
✓ Branch 5 taken 42 times.
|
124 | if (airLoopHVACOutdoorAirSystem()) { |
| 879 |
3/3✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
|
20 | return airLoopHVACOutdoorAirSystem()->components(type); |
| 880 | } else { | ||
| 881 | 42 | return {}; | |
| 882 | } | ||
| 883 | } | ||
| 884 | |||
| 885 | 3 | boost::optional<Node> AirLoopHVAC_Impl::outdoorAirNode() const { | |
| 886 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 1 time.
|
6 | if (airLoopHVACOutdoorAirSystem()) { |
| 887 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | return airLoopHVACOutdoorAirSystem()->outboardOANode(); |
| 888 | } else { | ||
| 889 | 1 | return {}; | |
| 890 | } | ||
| 891 | } | ||
| 892 | |||
| 893 | 3 | boost::optional<Node> AirLoopHVAC_Impl::reliefAirNode() const { | |
| 894 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 1 time.
|
6 | if (airLoopHVACOutdoorAirSystem()) { |
| 895 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | return airLoopHVACOutdoorAirSystem()->outboardReliefNode(); |
| 896 | } else { | ||
| 897 | 1 | return {}; | |
| 898 | } | ||
| 899 | } | ||
| 900 | |||
| 901 | 1762 | Node AirLoopHVAC_Impl::supplyOutletNode() const { | |
| 902 |
2/2✓ Branch 1 taken 1762 times.
✓ Branch 5 taken 1762 times.
|
1762 | return supplyOutletNodes().front(); |
| 903 | } | ||
| 904 | |||
| 905 | 17 | Node AirLoopHVAC_Impl::demandInletNode() const { | |
| 906 |
2/2✓ Branch 1 taken 17 times.
✓ Branch 5 taken 17 times.
|
17 | return demandInletNodes().front(); |
| 907 | } | ||
| 908 | |||
| 909 | ✗ | std::vector<ModelObject> AirLoopHVAC_Impl::supplyOutletNodesAsModelObjects() { | |
| 910 | ✗ | ModelObjectVector result = castVector<ModelObject>(supplyOutletNodes()); | |
| 911 | ✗ | return result; | |
| 912 | } | ||
| 913 | |||
| 914 | ✗ | std::vector<ModelObject> AirLoopHVAC_Impl::demandInletNodesAsModelObjects() { | |
| 915 | ✗ | ModelObjectVector result = castVector<ModelObject>(demandInletNodes()); | |
| 916 | ✗ | return result; | |
| 917 | } | ||
| 918 | |||
| 919 | ✗ | boost::optional<ModelObject> AirLoopHVAC_Impl::demandOutletNodeAsModelObject() { | |
| 920 | ✗ | OptionalModelObject result = demandOutletNode(); | |
| 921 | ✗ | return result; | |
| 922 | } | ||
| 923 | |||
| 924 | ✗ | boost::optional<ModelObject> AirLoopHVAC_Impl::reliefAirNodeAsModelObject() { | |
| 925 | ✗ | OptionalModelObject result; | |
| 926 | ✗ | OptionalNode intermediate = reliefAirNode(); | |
| 927 | ✗ | if (intermediate) { | |
| 928 | ✗ | result = *intermediate; | |
| 929 | } | ||
| 930 | ✗ | return result; | |
| 931 | ✗ | } | |
| 932 | |||
| 933 | ✗ | boost::optional<ModelObject> AirLoopHVAC_Impl::zoneMixerAsModelObject() { | |
| 934 | ✗ | OptionalModelObject result = zoneMixer(); | |
| 935 | ✗ | return result; | |
| 936 | } | ||
| 937 | |||
| 938 | ✗ | boost::optional<ModelObject> AirLoopHVAC_Impl::zoneSplitterAsModelObject() { | |
| 939 | ✗ | OptionalModelObject result = zoneSplitter(); | |
| 940 | ✗ | return result; | |
| 941 | } | ||
| 942 | |||
| 943 | 420 | Splitter AirLoopHVAC_Impl::demandSplitter() const { | |
| 944 |
1/1✓ Branch 1 taken 420 times.
|
420 | return this->zoneSplitter(); |
| 945 | } | ||
| 946 | |||
| 947 | 49 | Mixer AirLoopHVAC_Impl::demandMixer() const { | |
| 948 |
1/1✓ Branch 1 taken 49 times.
|
49 | return this->zoneMixer(); |
| 949 | } | ||
| 950 | |||
| 951 | 89 | bool AirLoopHVAC_Impl::addBranchForZone(openstudio::model::ThermalZone& thermalZone) { | |
| 952 | 89 | boost::optional<HVACComponent> comp; | |
| 953 | |||
| 954 | // If the add is successful we will remove existing loops | ||
| 955 |
1/1✓ Branch 1 taken 89 times.
|
89 | auto loops = thermalZone.airLoopHVACs(); |
| 956 | |||
| 957 |
1/1✓ Branch 1 taken 89 times.
|
89 | auto thisloop = getObject<AirLoopHVAC>(); |
| 958 |
1/1✓ Branch 1 taken 89 times.
|
89 | auto splitter = thisloop.zoneSplitter(); |
| 959 |
1/1✓ Branch 1 taken 89 times.
|
89 | auto mixer = thisloop.zoneMixer(); |
| 960 |
1/1✓ Branch 1 taken 89 times.
|
89 | auto result = addBranchForZoneImpl(thermalZone, thisloop, splitter, mixer, true, comp); |
| 961 | |||
| 962 | //if ( result ) { | ||
| 963 | // for ( auto & loop : loops ) { | ||
| 964 | // loop.removeBranchForZone(thermalZone); | ||
| 965 | // } | ||
| 966 | //} | ||
| 967 | |||
| 968 | 89 | return result; | |
| 969 | 89 | } | |
| 970 | |||
| 971 | 271 | bool AirLoopHVAC_Impl::addBranchForZone(ThermalZone& thermalZone, HVACComponent& airTerminal) { | |
| 972 |
1/1✓ Branch 1 taken 271 times.
|
271 | boost::optional<HVACComponent> comp = airTerminal; |
| 973 | |||
| 974 | // If the add is successful we will remove existing loops | ||
| 975 |
1/1✓ Branch 1 taken 271 times.
|
271 | auto loops = thermalZone.airLoopHVACs(); |
| 976 | |||
| 977 |
1/1✓ Branch 1 taken 271 times.
|
271 | auto thisloop = getObject<AirLoopHVAC>(); |
| 978 |
1/1✓ Branch 1 taken 271 times.
|
271 | auto splitter = thisloop.zoneSplitter(); |
| 979 |
1/1✓ Branch 1 taken 271 times.
|
271 | auto mixer = thisloop.zoneMixer(); |
| 980 |
1/1✓ Branch 1 taken 271 times.
|
271 | auto result = addBranchForZoneImpl(thermalZone, thisloop, splitter, mixer, true, comp); |
| 981 | |||
| 982 | //if ( result ) { | ||
| 983 | // for ( auto & loop : loops ) { | ||
| 984 | // loop.removeBranchForZone(thermalZone); | ||
| 985 | // } | ||
| 986 | //} | ||
| 987 | |||
| 988 | 271 | return result; | |
| 989 | 271 | } | |
| 990 | |||
| 991 | 3 | bool AirLoopHVAC_Impl::multiAddBranchForZone(ThermalZone& thermalZone) { | |
| 992 | 3 | boost::optional<HVACComponent> comp; | |
| 993 | |||
| 994 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto thisloop = getObject<AirLoopHVAC>(); |
| 995 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto splitter = thisloop.zoneSplitter(); |
| 996 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto mixer = thisloop.zoneMixer(); |
| 997 | |||
| 998 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto result = addBranchForZoneImpl(thermalZone, thisloop, splitter, mixer, false, comp); |
| 999 | |||
| 1000 | 3 | return result; | |
| 1001 | 3 | } | |
| 1002 | |||
| 1003 | 6 | bool AirLoopHVAC_Impl::multiAddBranchForZone(ThermalZone& thermalZone, HVACComponent& airTerminal) { | |
| 1004 |
1/1✓ Branch 1 taken 6 times.
|
6 | boost::optional<HVACComponent> comp = airTerminal; |
| 1005 | |||
| 1006 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto thisloop = getObject<AirLoopHVAC>(); |
| 1007 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto splitter = thisloop.zoneSplitter(); |
| 1008 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto mixer = thisloop.zoneMixer(); |
| 1009 | |||
| 1010 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto result = addBranchForZoneImpl(thermalZone, thisloop, splitter, mixer, false, comp); |
| 1011 | |||
| 1012 | 6 | return result; | |
| 1013 | 6 | } | |
| 1014 | |||
| 1015 | // TODO: REMOVE! | ||
| 1016 | //bool AirLoopHVAC_Impl::addBranchForZoneImpl(ThermalZone & thermalZone, OptionalStraightComponent & airTerminal) | ||
| 1017 | //{ | ||
| 1018 | // boost::optional<HVACComponent> comp; | ||
| 1019 | |||
| 1020 | // if( airTerminal ) { | ||
| 1021 | // comp = airTerminal->cast<HVACComponent>(); | ||
| 1022 | // } | ||
| 1023 | |||
| 1024 | // // If the add is successful we will remove existing loops | ||
| 1025 | // // This is the only "Impl" version ofr addBranchForZone that does remove | ||
| 1026 | // // because the only place this method is called is from AirLoopHVAC::addBranchForZone(...) | ||
| 1027 | // auto loops = thermalZone.airLoopHVACs(); | ||
| 1028 | // auto result = addBranchForZoneImpl(thermalZone, comp); | ||
| 1029 | |||
| 1030 | // if ( result ) { | ||
| 1031 | // for ( auto & loop : loops ) { | ||
| 1032 | // loop.removeBranchForZone(thermalZone); | ||
| 1033 | // } | ||
| 1034 | // } | ||
| 1035 | |||
| 1036 | // return result; | ||
| 1037 | //} | ||
| 1038 | |||
| 1039 | //bool AirLoopHVAC_Impl::addBranchForZoneImpl(ThermalZone & thermalZone, OptionalHVACComponent & airTerminal) | ||
| 1040 | //{ | ||
| 1041 | // auto currentloops = thermalZone.airLoopHVACs(); | ||
| 1042 | // auto h = handle(); | ||
| 1043 | // for ( const auto & loop : currentloops ) { | ||
| 1044 | // if( h == loop.handle() ) { | ||
| 1045 | // return false; | ||
| 1046 | // } | ||
| 1047 | // } | ||
| 1048 | |||
| 1049 | // bool result = true; | ||
| 1050 | // bool complete = false; | ||
| 1051 | |||
| 1052 | // Splitter splitter = zoneSplitter(); | ||
| 1053 | // Mixer mixer = zoneMixer(); | ||
| 1054 | |||
| 1055 | // if( ! airTerminal ) | ||
| 1056 | // { | ||
| 1057 | // std::vector<ModelObject> modelObjects = demandComponents(splitter,mixer); | ||
| 1058 | // // Only clone last air terminal if there are no plenums | ||
| 1059 | // if( subsetCastVector<AirLoopHVACSupplyPlenum>(modelObjects).empty() && | ||
| 1060 | // subsetCastVector<AirLoopHVACReturnPlenum>(modelObjects).empty() ) | ||
| 1061 | // { | ||
| 1062 | // auto lastAirTerminal = terminalForLastBranch(mixer); | ||
| 1063 | // auto lastThermalZone = zoneForLastBranch(mixer); | ||
| 1064 | |||
| 1065 | // if(lastAirTerminal && lastThermalZone) | ||
| 1066 | // { | ||
| 1067 | // // clone the air terminal | ||
| 1068 | // Model t_model = model(); | ||
| 1069 | // airTerminal = lastAirTerminal->clone(t_model).cast<HVACComponent>(); | ||
| 1070 | |||
| 1071 | // // Reconnect the cloned terminal to the plant loop(s) | ||
| 1072 | |||
| 1073 | // // TODO: (Temporary?) Ugly hack for FourPipeInduction for now, which has both a cooling and heating plantLoop | ||
| 1074 | // if (lastAirTerminal->iddObjectType() == IddObjectType::OS_AirTerminal_SingleDuct_ConstantVolume_FourPipeInduction) { | ||
| 1075 | |||
| 1076 | // // Safe to directly cast | ||
| 1077 | // AirTerminalSingleDuctConstantVolumeFourPipeInduction lastAtuFourPipe = lastAirTerminal->cast<AirTerminalSingleDuctConstantVolumeFourPipeInduction>(); | ||
| 1078 | // AirTerminalSingleDuctConstantVolumeFourPipeInduction newAtuFourPipe = airTerminal->cast<AirTerminalSingleDuctConstantVolumeFourPipeInduction>(); | ||
| 1079 | |||
| 1080 | // // If the original ATU's heating coil has a plant loop, reconnect it here | ||
| 1081 | // if (boost::optional<PlantLoop> _heatingPl = lastAtuFourPipe.heatingCoil().plantLoop() ){ | ||
| 1082 | // _heatingPl->addDemandBranchForComponent(newAtuFourPipe.heatingCoil()); | ||
| 1083 | // } | ||
| 1084 | |||
| 1085 | // // If the original ATU has a cooling coil, if it's a CoilCoolingWater, and the cooling coil has a plantLoop, reconnect it here | ||
| 1086 | // if (lastAtuFourPipe.coolingCoil()) { | ||
| 1087 | // if (boost::optional<CoilCoolingWater> _lastCC = lastAtuFourPipe.coolingCoil()->cast<CoilCoolingWater>() ) { | ||
| 1088 | // if (boost::optional<PlantLoop> _coolingPl = _lastCC->plantLoop()) { | ||
| 1089 | // _coolingPl->addDemandBranchForComponent(newAtuFourPipe.coolingCoil().get()); | ||
| 1090 | // } | ||
| 1091 | // } | ||
| 1092 | // } | ||
| 1093 | |||
| 1094 | // // TODO: Another ugly hack for CooledBeam, which isn't a HVAComponent but a StraightComponent | ||
| 1095 | // } else if (lastAirTerminal->iddObjectType() == IddObjectType::OS_AirTerminal_SingleDuct_ConstantVolume_CooledBeam) { | ||
| 1096 | |||
| 1097 | // // Safe to directly cast | ||
| 1098 | // AirTerminalSingleDuctConstantVolumeCooledBeam lastAtuCooledBeam = lastAirTerminal->cast<AirTerminalSingleDuctConstantVolumeCooledBeam>(); | ||
| 1099 | // AirTerminalSingleDuctConstantVolumeCooledBeam newAtuCooledBeam = airTerminal->cast<AirTerminalSingleDuctConstantVolumeCooledBeam>(); | ||
| 1100 | |||
| 1101 | // // If the original ATU's coilCoolingCooledBeam has a plant loop, reconnect it here | ||
| 1102 | // if (boost::optional<PlantLoop> _coolingPl = lastAtuCooledBeam.coilCoolingCooledBeam().plantLoop() ){ | ||
| 1103 | // _coolingPl->addDemandBranchForComponent(newAtuCooledBeam.coilCoolingCooledBeam()); | ||
| 1104 | // } | ||
| 1105 | |||
| 1106 | // } else { | ||
| 1107 | |||
| 1108 | // // Default (old) behavior should work here, only a possible heating coil | ||
| 1109 | // boost::optional<PlantLoop> plantLoop = plantForAirTerminal(lastAirTerminal.get()); | ||
| 1110 | |||
| 1111 | // if( plantLoop ) { | ||
| 1112 | |||
| 1113 | // setPlantForAirTerminal(airTerminal.get(),plantLoop.get()); | ||
| 1114 | // } | ||
| 1115 | // } | ||
| 1116 | // } | ||
| 1117 | // else if(lastAirTerminal) | ||
| 1118 | // { | ||
| 1119 | // auto t_comps = demandComponents(lastAirTerminal.get(),demandOutletNode()); | ||
| 1120 | // OS_ASSERT(t_comps.size() > 1); | ||
| 1121 | // auto t_comp = t_comps[1]; | ||
| 1122 | // boost::optional<Node> node = t_comp.optionalCast<Node>(); | ||
| 1123 | // OS_ASSERT(node); | ||
| 1124 | // result = thermalZone.addToNode(node.get()); | ||
| 1125 | // complete = true; | ||
| 1126 | // } | ||
| 1127 | // } | ||
| 1128 | // } | ||
| 1129 | |||
| 1130 | // if( ! complete ) | ||
| 1131 | // { | ||
| 1132 | // AirLoopHVAC airLoopHVAC = getObject<AirLoopHVAC>(); | ||
| 1133 | // return addBranchForZoneImpl(thermalZone,airLoopHVAC,splitter,mixer,airTerminal); | ||
| 1134 | // } | ||
| 1135 | // else | ||
| 1136 | // { | ||
| 1137 | // return result; | ||
| 1138 | // } | ||
| 1139 | //} | ||
| 1140 | |||
| 1141 | 44 | bool AirLoopHVAC_Impl::addBranchForHVACComponent(HVACComponent& hvacComponent) { | |
| 1142 |
1/1✓ Branch 1 taken 44 times.
|
44 | Model _model = this->model(); |
| 1143 | |||
| 1144 |
3/4✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 44 times.
|
44 | if (hvacComponent.model() != _model) { |
| 1145 | ✗ | return false; | |
| 1146 | } | ||
| 1147 | |||
| 1148 |
3/3✓ Branch 1 taken 44 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 42 times.
|
44 | if (!isTerminalTypeValid(hvacComponent)) { |
| 1149 | 2 | return false; | |
| 1150 | } | ||
| 1151 | |||
| 1152 |
1/1✓ Branch 1 taken 42 times.
|
42 | Splitter splitter = this->demandSplitter(); |
| 1153 |
1/1✓ Branch 1 taken 42 times.
|
42 | Mixer mixer = this->demandMixer(); |
| 1154 | |||
| 1155 |
2/3✓ Branch 1 taken 42 times.
✓ Branch 5 taken 42 times.
✗ Branch 6 not taken.
|
42 | if (splitter.outletModelObjects().size() == 1u) { |
| 1156 |
2/3✓ Branch 1 taken 42 times.
✓ Branch 3 taken 42 times.
✗ Branch 4 not taken.
|
84 | if (boost::optional<ModelObject> mo = splitter.lastOutletModelObject()) { |
| 1157 |
3/4✓ Branch 1 taken 42 times.
✓ Branch 4 taken 42 times.
✓ Branch 6 taken 42 times.
✗ Branch 7 not taken.
|
84 | if (boost::optional<Node> node = mo->optionalCast<Node>()) { |
| 1158 |
16/22✓ Branch 1 taken 42 times.
✓ Branch 4 taken 42 times.
✓ Branch 7 taken 42 times.
✓ Branch 10 taken 42 times.
✓ Branch 12 taken 31 times.
✓ Branch 13 taken 11 times.
✓ Branch 15 taken 31 times.
✓ Branch 18 taken 31 times.
✓ Branch 21 taken 31 times.
✓ Branch 24 taken 31 times.
✓ Branch 26 taken 31 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 31 times.
✓ Branch 29 taken 11 times.
✓ Branch 31 taken 42 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 31 times.
✓ Branch 35 taken 11 times.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
|
42 | if ((node->outletModelObject().get() == mixer) && (node->inletModelObject().get() == splitter)) { |
| 1159 |
4/4✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
✓ Branch 6 taken 28 times.
✓ Branch 7 taken 3 times.
|
31 | if (hvacComponent.addToNode(node.get())) { |
| 1160 | 28 | return true; | |
| 1161 | } | ||
| 1162 | } | ||
| 1163 | 42 | } | |
| 1164 | 42 | } | |
| 1165 | } | ||
| 1166 | |||
| 1167 | int nextOutletPort; | ||
| 1168 | int nextInletPort; | ||
| 1169 | |||
| 1170 |
1/1✓ Branch 1 taken 14 times.
|
14 | nextOutletPort = splitter.nextOutletPort(); |
| 1171 |
1/1✓ Branch 1 taken 14 times.
|
14 | nextInletPort = mixer.nextInletPort(); |
| 1172 | |||
| 1173 |
1/1✓ Branch 1 taken 14 times.
|
14 | Node node(_model); |
| 1174 | |||
| 1175 |
4/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✓ Branch 10 taken 14 times.
|
14 | _model.connect(splitter, nextOutletPort, node, node.inletPort()); |
| 1176 |
4/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✓ Branch 10 taken 14 times.
|
14 | _model.connect(node, node.outletPort(), mixer, nextInletPort); |
| 1177 | |||
| 1178 |
3/3✓ Branch 1 taken 14 times.
✓ Branch 3 taken 11 times.
✓ Branch 4 taken 3 times.
|
14 | if (hvacComponent.addToNode(node)) { |
| 1179 | 11 | return true; | |
| 1180 | } else { | ||
| 1181 |
1/1✓ Branch 1 taken 3 times.
|
3 | node.remove(); |
| 1182 | |||
| 1183 | 3 | return false; | |
| 1184 | } | ||
| 1185 | 44 | } | |
| 1186 | |||
| 1187 | 468 | SizingSystem AirLoopHVAC_Impl::sizingSystem() const { | |
| 1188 | 468 | boost::optional<SizingSystem> sizingSystem; | |
| 1189 | |||
| 1190 | 468 | std::vector<SizingSystem> sizingObjects; | |
| 1191 | |||
| 1192 |
2/2✓ Branch 1 taken 468 times.
✓ Branch 4 taken 468 times.
|
468 | sizingObjects = getObject<AirLoopHVAC>().getModelObjectSources<SizingSystem>(); |
| 1193 | |||
| 1194 |
2/2✓ Branch 5 taken 467 times.
✓ Branch 6 taken 468 times.
|
935 | for (const auto& sizingObject : sizingObjects) { |
| 1195 | try { | ||
| 1196 |
5/6✓ Branch 1 taken 467 times.
✓ Branch 4 taken 467 times.
✓ Branch 7 taken 467 times.
✓ Branch 10 taken 467 times.
✓ Branch 13 taken 467 times.
✗ Branch 14 not taken.
|
467 | if (sizingObject.airLoopHVAC().handle() == this->handle()) { |
| 1197 |
1/1✓ Branch 1 taken 467 times.
|
467 | sizingSystem = sizingObject; |
| 1198 | } | ||
| 1199 | ✗ | } catch (...) { | |
| 1200 | ✗ | LOG(Debug, sizingObject.briefDescription() << " is not attached to an AirLoopHVAC object."); | |
| 1201 | ✗ | } | |
| 1202 | } | ||
| 1203 | |||
| 1204 |
2/2✓ Branch 0 taken 467 times.
✓ Branch 1 taken 1 time.
|
468 | if (sizingSystem) { |
| 1205 |
2/2✓ Branch 1 taken 467 times.
✓ Branch 4 taken 467 times.
|
934 | return sizingSystem.get(); |
| 1206 | } else { | ||
| 1207 |
17/17✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 20 taken 1 time.
✓ Branch 26 taken 1 time.
✓ Branch 29 taken 1 time.
✓ Branch 32 taken 1 time.
✓ Branch 35 taken 1 time.
✓ Branch 38 taken 1 time.
✓ Branch 41 taken 1 time.
✓ Branch 44 taken 1 time.
✓ Branch 47 taken 1 time.
✓ Branch 52 taken 1 time.
✓ Branch 55 taken 1 time.
|
1 | LOG_AND_THROW(briefDescription() << " missing Sizing:System object."); |
| 1208 | } | ||
| 1209 | 469 | } | |
| 1210 | |||
| 1211 | 125 | std::vector<ThermalZone> AirLoopHVAC_Impl::thermalZones() const { | |
| 1212 |
2/2✓ Branch 1 taken 125 times.
✓ Branch 4 taken 125 times.
|
125 | std::vector<ModelObject> objects = demandComponents(IddObjectType::OS_ThermalZone); |
| 1213 | //std::vector<ModelObject> v = this->demandComponents( IddObjectType::OS_AirLoopHVAC_ZoneSplitter ); | ||
| 1214 | |||
| 1215 | 125 | std::vector<ThermalZone> result; | |
| 1216 | |||
| 1217 |
2/2✓ Branch 4 taken 134 times.
✓ Branch 5 taken 125 times.
|
259 | for (const auto& elem : objects) { |
| 1218 |
2/2✓ Branch 1 taken 134 times.
✓ Branch 4 taken 134 times.
|
134 | result.push_back(elem.cast<ThermalZone>()); |
| 1219 | } | ||
| 1220 | |||
| 1221 | 250 | return result; | |
| 1222 | 125 | } | |
| 1223 | |||
| 1224 | 210 | std::vector<ModelObject> AirLoopHVAC_Impl::children() const { | |
| 1225 | 210 | std::vector<ModelObject> result; | |
| 1226 | |||
| 1227 |
2/2✓ Branch 1 taken 210 times.
✓ Branch 4 taken 210 times.
|
210 | result.push_back(sizingSystem()); |
| 1228 | |||
| 1229 | 210 | return result; | |
| 1230 | ✗ | } | |
| 1231 | |||
| 1232 | ✗ | boost::optional<double> AirLoopHVAC_Impl::designSupplyAirFlowRate() const { | |
| 1233 | ✗ | return getDouble(OS_AirLoopHVACFields::DesignSupplyAirFlowRate, true); | |
| 1234 | } | ||
| 1235 | |||
| 1236 | 201 | bool AirLoopHVAC_Impl::isDesignSupplyAirFlowRateAutosized() const { | |
| 1237 | 201 | bool result = false; | |
| 1238 |
1/1✓ Branch 1 taken 201 times.
|
201 | boost::optional<std::string> value = getString(OS_AirLoopHVACFields::DesignSupplyAirFlowRate, true); |
| 1239 |
1/2✓ Branch 0 taken 201 times.
✗ Branch 1 not taken.
|
201 | if (value) { |
| 1240 |
3/3✓ Branch 1 taken 201 times.
✓ Branch 4 taken 201 times.
✓ Branch 7 taken 201 times.
|
402 | result = openstudio::istringEqual(value.get(), "autosize"); |
| 1241 | } | ||
| 1242 | 201 | return result; | |
| 1243 | 201 | } | |
| 1244 | |||
| 1245 | 5 | bool AirLoopHVAC_Impl::setDesignSupplyAirFlowRate(boost::optional<double> designSupplyAirFlowRate) { | |
| 1246 | 5 | bool result(false); | |
| 1247 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (designSupplyAirFlowRate) { |
| 1248 | 5 | result = setDouble(OS_AirLoopHVACFields::DesignSupplyAirFlowRate, designSupplyAirFlowRate.get()); | |
| 1249 | } else { | ||
| 1250 | ✗ | resetDesignSupplyAirFlowRate(); | |
| 1251 | ✗ | result = true; | |
| 1252 | } | ||
| 1253 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | OS_ASSERT(result); |
| 1254 | 5 | return result; | |
| 1255 | } | ||
| 1256 | |||
| 1257 | ✗ | void AirLoopHVAC_Impl::resetDesignSupplyAirFlowRate() { | |
| 1258 | ✗ | bool result = setString(OS_AirLoopHVACFields::DesignSupplyAirFlowRate, ""); | |
| 1259 | ✗ | OS_ASSERT(result); | |
| 1260 | ✗ | } | |
| 1261 | |||
| 1262 | 704 | void AirLoopHVAC_Impl::autosizeDesignSupplyAirFlowRate() { | |
| 1263 |
2/2✓ Branch 1 taken 704 times.
✓ Branch 4 taken 704 times.
|
1408 | bool result = setString(OS_AirLoopHVACFields::DesignSupplyAirFlowRate, "autosize"); |
| 1264 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 704 times.
|
704 | OS_ASSERT(result); |
| 1265 | 704 | } | |
| 1266 | |||
| 1267 | 204 | double AirLoopHVAC_Impl::designReturnAirFlowFractionofSupplyAirFlow() const { | |
| 1268 |
1/1✓ Branch 1 taken 204 times.
|
204 | boost::optional<double> value = getDouble(OS_AirLoopHVACFields::DesignReturnAirFlowFractionofSupplyAirFlow, true); |
| 1269 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 204 times.
✗ Branch 4 not taken.
|
204 | OS_ASSERT(value); |
| 1270 |
1/1✓ Branch 1 taken 204 times.
|
408 | return value.get(); |
| 1271 | } | ||
| 1272 | |||
| 1273 | 707 | bool AirLoopHVAC_Impl::setDesignReturnAirFlowFractionofSupplyAirFlow(double designReturnAirFlowFractionofSupplyAirFlow) { | |
| 1274 | 707 | bool result = setDouble(OS_AirLoopHVACFields::DesignReturnAirFlowFractionofSupplyAirFlow, designReturnAirFlowFractionofSupplyAirFlow); | |
| 1275 | 707 | return result; | |
| 1276 | } | ||
| 1277 | |||
| 1278 | 284 | Schedule AirLoopHVAC_Impl::availabilitySchedule() const { | |
| 1279 |
2/2✓ Branch 1 taken 284 times.
✓ Branch 4 taken 284 times.
|
284 | auto result = getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_AirLoopHVACFields::AvailabilitySchedule); |
| 1280 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 284 times.
|
284 | if (!result) { |
| 1281 | ✗ | result = model().alwaysOnDiscreteSchedule(); | |
| 1282 | } | ||
| 1283 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 284 times.
✗ Branch 4 not taken.
|
284 | OS_ASSERT(result); |
| 1284 |
2/2✓ Branch 1 taken 284 times.
✓ Branch 4 taken 284 times.
|
568 | return result.get(); |
| 1285 | 284 | } | |
| 1286 | |||
| 1287 | 719 | bool AirLoopHVAC_Impl::setAvailabilitySchedule(Schedule& schedule) { | |
| 1288 | // TODO: deal with this in regards to the new AvailabilityManagerAssignmentList | ||
| 1289 | // Actually, no, this is going to end up in the Fan Schedule | ||
| 1290 |
2/2✓ Branch 1 taken 719 times.
✓ Branch 4 taken 719 times.
|
719 | auto result = setPointer(OS_AirLoopHVACFields::AvailabilitySchedule, schedule.handle()); |
| 1291 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 719 times.
✗ Branch 3 not taken.
|
719 | OS_ASSERT(result); |
| 1292 | |||
| 1293 | auto seriesPIUs = | ||
| 1294 |
3/3✓ Branch 1 taken 719 times.
✓ Branch 4 taken 719 times.
✓ Branch 7 taken 719 times.
|
719 | subsetCastVector<AirTerminalSingleDuctSeriesPIUReheat>(demandComponents(AirTerminalSingleDuctSeriesPIUReheat::iddObjectType())); |
| 1295 |
2/2✓ Branch 4 taken 1 time.
✓ Branch 5 taken 719 times.
|
720 | for (auto& piu : seriesPIUs) { |
| 1296 |
1/1✓ Branch 3 taken 1 time.
|
1 | result &= piu.getImpl<detail::AirTerminalSingleDuctSeriesPIUReheat_Impl>()->setFanAvailabilitySchedule(schedule); |
| 1297 | } | ||
| 1298 | |||
| 1299 | auto parallelPIUs = | ||
| 1300 |
3/3✓ Branch 1 taken 719 times.
✓ Branch 4 taken 719 times.
✓ Branch 7 taken 719 times.
|
719 | subsetCastVector<AirTerminalSingleDuctParallelPIUReheat>(demandComponents(AirTerminalSingleDuctParallelPIUReheat::iddObjectType())); |
| 1301 |
2/2✓ Branch 4 taken 1 time.
✓ Branch 5 taken 719 times.
|
720 | for (auto& piu : parallelPIUs) { |
| 1302 |
1/1✓ Branch 3 taken 1 time.
|
1 | result &= piu.getImpl<detail::AirTerminalSingleDuctParallelPIUReheat_Impl>()->setFanAvailabilitySchedule(schedule); |
| 1303 | } | ||
| 1304 | |||
| 1305 | 719 | return result; | |
| 1306 | 719 | } | |
| 1307 | |||
| 1308 | 13 | bool AirLoopHVAC_Impl::setNightCycleControlType(const std::string& controlType) { | |
| 1309 | 10 | auto createNightCycleManager = [&]() { | |
| 1310 | 10 | boost::optional<AvailabilityManagerNightCycle> result; | |
| 1311 |
1/1✓ Branch 1 taken 10 times.
|
10 | auto t_model = model(); |
| 1312 |
1/1✓ Branch 1 taken 10 times.
|
10 | AvailabilityManagerNightCycle nightCycle(t_model); |
| 1313 |
2/3✓ Branch 1 taken 10 times.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
|
10 | if (nightCycle.setControlType(controlType)) { |
| 1314 |
1/1✓ Branch 1 taken 10 times.
|
10 | result = nightCycle; |
| 1315 | } else { | ||
| 1316 | ✗ | nightCycle.remove(); | |
| 1317 | } | ||
| 1318 | 20 | return result; | |
| 1319 | 10 | }; | |
| 1320 | |||
| 1321 | // Loop through the current AVMs, if you find an AVM NightCycle, set its controlType | ||
| 1322 | // TODO: @kbenne: Unless the controType is "StayOff" in which case perhaps remove? what do you think? | ||
| 1323 |
3/3✓ Branch 1 taken 13 times.
✓ Branch 8 taken 17 times.
✓ Branch 9 taken 10 times.
|
27 | for (auto& t_availabilityManager : availabilityManagers()) { |
| 1324 |
3/3✓ Branch 1 taken 17 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 14 times.
|
34 | if (auto nightCycle = t_availabilityManager.optionalCast<AvailabilityManagerNightCycle>()) { |
| 1325 | /* | ||
| 1326 | *if ( openstudio::istringEqual(controlType, "StayOff") ) { | ||
| 1327 | * nightCycle->remove() | ||
| 1328 | * return true | ||
| 1329 | *} else { | ||
| 1330 | * return nightCycle->setControlType(controlType); | ||
| 1331 | *} | ||
| 1332 | */ | ||
| 1333 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | return nightCycle->setControlType(controlType); |
| 1334 | 17 | } | |
| 1335 | 13 | } | |
| 1336 | |||
| 1337 | // Else, add one | ||
| 1338 |
2/3✓ Branch 1 taken 10 times.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
|
20 | if (auto nightCycle = createNightCycleManager()) { |
| 1339 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | auto result = addAvailabilityManager(nightCycle.get()); |
| 1340 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
✗ Branch 3 not taken.
|
10 | OS_ASSERT(result); |
| 1341 | 10 | return true; | |
| 1342 | 10 | } | |
| 1343 | |||
| 1344 | ✗ | return false; | |
| 1345 | } | ||
| 1346 | |||
| 1347 | // boost::optional<Schedule> AirLoopHVAC_Impl::returnAirBypassFlowTemperatureSetpointSchedule() const | ||
| 1348 | // { | ||
| 1349 | // return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_AirLoopHVACFields::ReturnAirBypassFlowTemperatureSetpointScheduleName); | ||
| 1350 | // } | ||
| 1351 | |||
| 1352 | // bool AirLoopHVAC_Impl::setReturnAirBypassFlowTemperatureSetpointSchedule(Schedule & temperatureSetpointSchedule) | ||
| 1353 | // { | ||
| 1354 | // bool result = setSchedule(OS_AirLoopHVACFields::ReturnAirBypassFlowTemperatureSetpointScheduleName, | ||
| 1355 | // "AirLoopHVAC", | ||
| 1356 | // "Return Air Bypass Flow Temperature Setpoint", | ||
| 1357 | // temperatureSetpointSchedule); | ||
| 1358 | // return result; | ||
| 1359 | // } | ||
| 1360 | |||
| 1361 | // void AirLoopHVAC_Impl::resetReturnAirBypassFlowTemperatureSetpointSchedule() | ||
| 1362 | // { | ||
| 1363 | // bool result = setString(OS_AirLoopHVACFields::ReturnAirBypassFlowTemperatureSetpointScheduleName,""); | ||
| 1364 | // OS_ASSERT(result); | ||
| 1365 | // } | ||
| 1366 | |||
| 1367 | 3 | std::string AirLoopHVAC_Impl::nightCycleControlType() const { | |
| 1368 | // Loop through the current AVMs, if you find an AVM NightCycle, get its controlType | ||
| 1369 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 3 times.
|
3 | for (auto& t_availabilityManager : availabilityManagers()) { |
| 1370 | ✗ | if (auto nightCycle = t_availabilityManager.optionalCast<AvailabilityManagerNightCycle>()) { | |
| 1371 | ✗ | return nightCycle->controlType(); | |
| 1372 | ✗ | } | |
| 1373 | 3 | } | |
| 1374 | // Otherwise, return StayOff | ||
| 1375 |
1/1✓ Branch 1 taken 3 times.
|
6 | return "StayOff"; |
| 1376 | } | ||
| 1377 | |||
| 1378 | 10 | boost::optional<Node> AirLoopHVAC_Impl::mixedAirNode() const { | |
| 1379 | 10 | boost::optional<Node> result; | |
| 1380 | |||
| 1381 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 3 taken 9 times.
✓ Branch 4 taken 1 time.
|
20 | if (boost::optional<AirLoopHVACOutdoorAirSystem> oaSystem = airLoopHVACOutdoorAirSystem()) { |
| 1382 |
3/4✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 6 taken 9 times.
✗ Branch 7 not taken.
|
18 | if (boost::optional<ModelObject> mo = oaSystem->mixedAirModelObject()) { |
| 1383 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | result = mo->optionalCast<Node>(); |
| 1384 | 9 | } | |
| 1385 | 10 | } | |
| 1386 | |||
| 1387 | 10 | return result; | |
| 1388 | ✗ | } | |
| 1389 | |||
| 1390 | 4 | boost::optional<Node> AirLoopHVAC_Impl::returnAirNode() const { | |
| 1391 | 4 | boost::optional<Node> result; | |
| 1392 | |||
| 1393 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 1 time.
|
8 | if (boost::optional<AirLoopHVACOutdoorAirSystem> oaSystem = airLoopHVACOutdoorAirSystem()) { |
| 1394 |
3/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
|
6 | if (boost::optional<ModelObject> mo = oaSystem->returnAirModelObject()) { |
| 1395 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | result = mo->optionalCast<Node>(); |
| 1396 | 3 | } | |
| 1397 | 4 | } | |
| 1398 | |||
| 1399 | 4 | return result; | |
| 1400 | ✗ | } | |
| 1401 | |||
| 1402 | 54 | boost::optional<HVACComponent> lastFan(const std::vector<ModelObject>& comps) { | |
| 1403 | 54 | boost::optional<HVACComponent> result; | |
| 1404 | |||
| 1405 |
1/1✓ Branch 1 taken 54 times.
|
54 | auto constantVolumeFans = subsetCastVector<FanConstantVolume>(comps); |
| 1406 |
2/2✓ Branch 1 taken 39 times.
✓ Branch 2 taken 15 times.
|
54 | if (!constantVolumeFans.empty()) { |
| 1407 |
1/1✓ Branch 2 taken 39 times.
|
39 | result = constantVolumeFans.back(); |
| 1408 | } else { | ||
| 1409 |
1/1✓ Branch 1 taken 15 times.
|
15 | auto variableVolumeFans = subsetCastVector<FanVariableVolume>(comps); |
| 1410 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 13 times.
|
15 | if (!variableVolumeFans.empty()) { |
| 1411 |
1/1✓ Branch 2 taken 2 times.
|
2 | result = variableVolumeFans.back(); |
| 1412 | } else { | ||
| 1413 |
1/1✓ Branch 1 taken 13 times.
|
13 | auto systemModelFans = subsetCastVector<FanSystemModel>(comps); |
| 1414 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 2 taken 8 times.
|
13 | if (!systemModelFans.empty()) { |
| 1415 |
1/1✓ Branch 2 taken 5 times.
|
5 | result = systemModelFans.back(); |
| 1416 | } else { | ||
| 1417 |
1/1✓ Branch 1 taken 8 times.
|
8 | auto componentModelFans = subsetCastVector<FanComponentModel>(comps); |
| 1418 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 6 times.
|
8 | if (!componentModelFans.empty()) { |
| 1419 |
1/1✓ Branch 2 taken 2 times.
|
2 | result = componentModelFans.back(); |
| 1420 | } | ||
| 1421 | 8 | } | |
| 1422 | 13 | } | |
| 1423 | 15 | } | |
| 1424 | |||
| 1425 | 108 | return result; | |
| 1426 | 54 | } | |
| 1427 | |||
| 1428 | 52 | boost::optional<HVACComponent> AirLoopHVAC_Impl::supplyFan() const { | |
| 1429 | 52 | boost::optional<HVACComponent> result; | |
| 1430 | |||
| 1431 |
2/2✓ Branch 1 taken 52 times.
✓ Branch 4 taken 52 times.
|
52 | boost::optional<HVACComponent> start = supplyInletNode(); |
| 1432 |
3/3✓ Branch 1 taken 52 times.
✓ Branch 3 taken 43 times.
✓ Branch 4 taken 9 times.
|
104 | if (auto oaSystem = airLoopHVACOutdoorAirSystem()) { |
| 1433 |
2/2✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
|
43 | start = oaSystem.get(); |
| 1434 | 52 | } | |
| 1435 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
✗ Branch 4 not taken.
|
52 | OS_ASSERT(start); |
| 1436 |
1/1✓ Branch 1 taken 52 times.
|
52 | auto end = supplyOutletNode(); |
| 1437 | |||
| 1438 |
4/4✓ Branch 1 taken 52 times.
✓ Branch 4 taken 52 times.
✓ Branch 7 taken 52 times.
✓ Branch 10 taken 52 times.
|
104 | auto t_supplyComponents = supplyComponents(start.get(), end); |
| 1439 |
1/1✓ Branch 1 taken 52 times.
|
52 | result = lastFan(t_supplyComponents); |
| 1440 | |||
| 1441 | 104 | return result; | |
| 1442 | 52 | } | |
| 1443 | |||
| 1444 | 2 | boost::optional<HVACComponent> AirLoopHVAC_Impl::returnFan() const { | |
| 1445 | 2 | boost::optional<HVACComponent> result; | |
| 1446 | |||
| 1447 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto start = supplyInletNode(); |
| 1448 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto end = airLoopHVACOutdoorAirSystem(); |
| 1449 | |||
| 1450 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
|
2 | if (end) { |
| 1451 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
2 | auto t_supplyComponents = supplyComponents(start, end.get()); |
| 1452 |
1/1✓ Branch 1 taken 1 time.
|
1 | result = lastFan(t_supplyComponents); |
| 1453 | 1 | } | |
| 1454 | |||
| 1455 | 4 | return result; | |
| 1456 | 2 | } | |
| 1457 | |||
| 1458 | 1 | boost::optional<HVACComponent> AirLoopHVAC_Impl::reliefFan() const { | |
| 1459 | 1 | boost::optional<HVACComponent> result; | |
| 1460 | |||
| 1461 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto oaSystem = airLoopHVACOutdoorAirSystem()) { |
| 1462 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
2 | auto t_reliefComponents = oaSystem->reliefComponents(); |
| 1463 |
1/1✓ Branch 1 taken 1 time.
|
1 | result = lastFan(t_reliefComponents); |
| 1464 | 2 | } | |
| 1465 | |||
| 1466 | 1 | return result; | |
| 1467 | ✗ | } | |
| 1468 | |||
| 1469 | 332 | AvailabilityManagerAssignmentList AirLoopHVAC_Impl::availabilityManagerAssignmentList() const { | |
| 1470 | boost::optional<AvailabilityManagerAssignmentList> avmList = | ||
| 1471 |
2/2✓ Branch 1 taken 332 times.
✓ Branch 4 taken 332 times.
|
332 | getObject<ModelObject>().getModelObjectTarget<AvailabilityManagerAssignmentList>(OS_AirLoopHVACFields::AvailabilityManagerListName); |
| 1472 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if (avmList) { |
| 1473 |
2/2✓ Branch 1 taken 332 times.
✓ Branch 4 taken 332 times.
|
664 | return avmList.get(); |
| 1474 | } else { | ||
| 1475 | ✗ | LOG_AND_THROW(briefDescription() << "doesn't have an AvailabilityManagerAssignementList assigned, which shouldn't happen"); | |
| 1476 | } | ||
| 1477 | 332 | } | |
| 1478 | |||
| 1479 | 28 | bool AirLoopHVAC_Impl::addAvailabilityManager(const AvailabilityManager& availabilityManager) { | |
| 1480 | |||
| 1481 | // All types should be allowed here except HybridVentilation (special, stand-alone) | ||
| 1482 | // Except that OS diverged from E+ (where HybridVentilation is the one referencing the AirLoopHVAC) | ||
| 1483 | // In OS, you can add it to the AVM list (forward translation handles it) | ||
| 1484 | // TODO: perhaps should prevent the user from assigned twice an AVM:NightCycle? Or more generally twice the same | ||
| 1485 |
2/2✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
|
28 | return availabilityManagerAssignmentList().addAvailabilityManager(availabilityManager); |
| 1486 | } | ||
| 1487 | |||
| 1488 | ✗ | bool AirLoopHVAC_Impl::addAvailabilityManager(const AvailabilityManager& availabilityManager, unsigned priority) { | |
| 1489 | ✗ | return availabilityManagerAssignmentList().addAvailabilityManager(availabilityManager, priority); | |
| 1490 | } | ||
| 1491 | |||
| 1492 | 44 | std::vector<AvailabilityManager> AirLoopHVAC_Impl::availabilityManagers() const { | |
| 1493 | // TODO: add the AVM Scheduled and NigthCycle? | ||
| 1494 |
2/2✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
|
44 | return availabilityManagerAssignmentList().availabilityManagers(); |
| 1495 | } | ||
| 1496 | |||
| 1497 | ✗ | bool AirLoopHVAC_Impl::setAvailabilityManagers(const std::vector<AvailabilityManager>& avms) { | |
| 1498 | // TODO: should this affect the AVM Scheduled and NightCycle? | ||
| 1499 | ✗ | return availabilityManagerAssignmentList().setAvailabilityManagers(avms); | |
| 1500 | } | ||
| 1501 | |||
| 1502 | 1 | void AirLoopHVAC_Impl::resetAvailabilityManagers() { | |
| 1503 | // TODO: should this affect the AVM Scheduled and NightCycle? | ||
| 1504 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | availabilityManagerAssignmentList().resetAvailabilityManagers(); |
| 1505 | 1 | } | |
| 1506 | |||
| 1507 | ✗ | bool AirLoopHVAC_Impl::setAvailabilityManagerPriority(const AvailabilityManager& availabilityManager, unsigned priority) { | |
| 1508 | ✗ | return availabilityManagerAssignmentList().setAvailabilityManagerPriority(availabilityManager, priority); | |
| 1509 | } | ||
| 1510 | |||
| 1511 | ✗ | unsigned AirLoopHVAC_Impl::availabilityManagerPriority(const AvailabilityManager& availabilityManager) const { | |
| 1512 | ✗ | return availabilityManagerAssignmentList().availabilityManagerPriority(availabilityManager); | |
| 1513 | } | ||
| 1514 | |||
| 1515 | 1 | bool AirLoopHVAC_Impl::removeAvailabilityManager(const AvailabilityManager& avm) { | |
| 1516 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | return availabilityManagerAssignmentList().removeAvailabilityManager(avm); |
| 1517 | } | ||
| 1518 | ✗ | bool AirLoopHVAC_Impl::removeAvailabilityManager(unsigned priority) { | |
| 1519 | ✗ | return availabilityManagerAssignmentList().removeAvailabilityManager(priority); | |
| 1520 | } | ||
| 1521 | |||
| 1522 | 13 | unsigned AirLoopHVAC_Impl::supplyOutletPortA() const { | |
| 1523 | 13 | return OS_AirLoopHVACFields::SupplySideOutletNodeA; | |
| 1524 | } | ||
| 1525 | |||
| 1526 | 34 | unsigned AirLoopHVAC_Impl::supplyOutletPortB() const { | |
| 1527 | 34 | return OS_AirLoopHVACFields::SupplySideOutletNodeB; | |
| 1528 | } | ||
| 1529 | |||
| 1530 | 10 | unsigned AirLoopHVAC_Impl::supplyInletPort() const { | |
| 1531 | 10 | return OS_AirLoopHVACFields::SupplySideInletNodeName; | |
| 1532 | } | ||
| 1533 | |||
| 1534 | 10 | unsigned AirLoopHVAC_Impl::demandInletPortA() const { | |
| 1535 | 10 | return OS_AirLoopHVACFields::DemandSideInletNodeA; | |
| 1536 | } | ||
| 1537 | |||
| 1538 | 28 | unsigned AirLoopHVAC_Impl::demandInletPortB() const { | |
| 1539 | 28 | return OS_AirLoopHVACFields::DemandSideInletNodeB; | |
| 1540 | } | ||
| 1541 | |||
| 1542 | 10 | unsigned AirLoopHVAC_Impl::demandOutletPort() const { | |
| 1543 | 10 | return OS_AirLoopHVACFields::DemandSideOutletNodeName; | |
| 1544 | } | ||
| 1545 | |||
| 1546 | 612 | boost::optional<Splitter> AirLoopHVAC_Impl::supplySplitter() const { | |
| 1547 |
2/2✓ Branch 1 taken 612 times.
✓ Branch 4 taken 612 times.
|
612 | auto result = getObject<ModelObject>().getModelObjectTarget<Splitter>(OS_AirLoopHVACFields::SupplySplitterName); |
| 1548 |
2/2✓ Branch 0 taken 77 times.
✓ Branch 1 taken 535 times.
|
612 | if (result) { |
| 1549 |
2/2✓ Branch 1 taken 77 times.
✓ Branch 4 taken 77 times.
|
77 | return result.get(); |
| 1550 | } | ||
| 1551 | |||
| 1552 |
4/4✓ Branch 1 taken 535 times.
✓ Branch 4 taken 535 times.
✓ Branch 7 taken 535 times.
✓ Branch 10 taken 535 times.
|
1070 | auto splitters = subsetCastVector<Splitter>(supplyComponents()); |
| 1553 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 2 taken 522 times.
|
535 | if (!splitters.empty()) { |
| 1554 |
1/1✓ Branch 2 taken 13 times.
|
13 | auto splitter = splitters.front(); |
| 1555 |
1/1✓ Branch 1 taken 13 times.
|
13 | return splitter; |
| 1556 | 13 | } else { | |
| 1557 | 522 | return boost::none; | |
| 1558 | } | ||
| 1559 | 612 | } | |
| 1560 | |||
| 1561 | 18 | bool AirLoopHVAC_Impl::setSupplySplitter(Splitter const& splitter) { | |
| 1562 |
2/2✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
|
18 | auto result = setPointer(OS_AirLoopHVACFields::SupplySplitterName, splitter.handle()); |
| 1563 | 18 | return result; | |
| 1564 | } | ||
| 1565 | |||
| 1566 | 5 | void AirLoopHVAC_Impl::resetSupplySplitter() { | |
| 1567 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
10 | bool result = setString(OS_AirLoopHVACFields::SupplySplitterName, ""); |
| 1568 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | OS_ASSERT(result); |
| 1569 | 5 | } | |
| 1570 | |||
| 1571 | 3 | bool AirLoopHVAC_Impl::removeSupplySplitter() { | |
| 1572 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto t_supplySplitter = supplySplitter(); |
| 1573 | |||
| 1574 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
3 | if (!t_supplySplitter) { |
| 1575 | ✗ | return false; | |
| 1576 | } | ||
| 1577 | |||
| 1578 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto _model = model(); |
| 1579 | |||
| 1580 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | auto inletModelObject = t_supplySplitter->inletModelObject(); |
| 1581 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(inletModelObject); |
| 1582 | |||
| 1583 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | auto inletNode = inletModelObject->optionalCast<Node>(); |
| 1584 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(inletNode); |
| 1585 | |||
| 1586 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto t_supplyOutletNodes = supplyOutletNodes(); |
| 1587 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(t_supplyOutletNodes.size() == 2u); |
| 1588 | |||
| 1589 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | auto splitterOutletModelObjects = t_supplySplitter->outletModelObjects(); |
| 1590 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(splitterOutletModelObjects.size() == 2u); |
| 1591 | |||
| 1592 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto splitterOutletNodes = subsetCastVector<Node>(splitterOutletModelObjects); |
| 1593 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(splitterOutletNodes.size() == 2u); |
| 1594 | |||
| 1595 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 9 taken 3 times.
|
6 | auto comps0 = supplyComponents(splitterOutletNodes[0], t_supplyOutletNodes[0]); |
| 1596 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(!comps0.empty()); |
| 1597 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 9 taken 3 times.
|
6 | auto comps1 = supplyComponents(splitterOutletNodes[1], t_supplyOutletNodes[1]); |
| 1598 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(!comps1.empty()); |
| 1599 | |||
| 1600 |
2/2✓ Branch 3 taken 7 times.
✓ Branch 4 taken 3 times.
|
10 | for (auto it = comps0.begin(); it != comps0.end(); ++it) { |
| 1601 |
1/1✓ Branch 4 taken 7 times.
|
7 | it->getImpl<detail::HVACComponent_Impl>()->disconnect(); |
| 1602 | } | ||
| 1603 | |||
| 1604 |
2/2✓ Branch 3 taken 7 times.
✓ Branch 4 taken 3 times.
|
10 | for (auto it = comps1.begin(); it != comps1.end(); ++it) { |
| 1605 |
1/1✓ Branch 4 taken 7 times.
|
7 | it->getImpl<detail::HVACComponent_Impl>()->disconnect(); |
| 1606 | } | ||
| 1607 | |||
| 1608 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | t_supplySplitter->disconnect(); |
| 1609 | |||
| 1610 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto airLoopHVAC = getObject<AirLoopHVAC>(); |
| 1611 |
5/5✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 2 times.
✓ Branch 11 taken 1 time.
|
3 | if (inletNode.get() == supplyInletNode()) { |
| 1612 |
1/1✓ Branch 1 taken 2 times.
|
2 | Node supplyOutletNode(_model); |
| 1613 |
7/7✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 19 taken 2 times.
|
2 | _model.connect(inletNode.get(), inletNode->outletPort(), supplyOutletNode, supplyOutletNode.inletPort()); |
| 1614 |
5/5✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
|
2 | _model.connect(supplyOutletNode, supplyOutletNode.outletPort(), airLoopHVAC, supplyOutletPortA()); |
| 1615 | 2 | } else { | |
| 1616 |
7/7✓ 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 16 taken 1 time.
✓ Branch 19 taken 1 time.
|
1 | _model.connect(inletNode.get(), inletNode->outletPort(), airLoopHVAC, supplyOutletPortA()); |
| 1617 | } | ||
| 1618 | |||
| 1619 |
2/2✓ Branch 4 taken 7 times.
✓ Branch 5 taken 3 times.
|
10 | for (auto it = comps0.begin(); it != comps0.end(); ++it) { |
| 1620 |
2/3✓ Branch 2 taken 7 times.
✓ Branch 5 taken 7 times.
✗ Branch 6 not taken.
|
7 | if (!it->handle().isNull()) { |
| 1621 |
1/1✓ Branch 2 taken 7 times.
|
7 | it->remove(); |
| 1622 | } | ||
| 1623 | } | ||
| 1624 | |||
| 1625 |
2/2✓ Branch 4 taken 7 times.
✓ Branch 5 taken 3 times.
|
10 | for (auto it = comps1.begin(); it != comps1.end(); ++it) { |
| 1626 |
2/3✓ Branch 2 taken 7 times.
✓ Branch 5 taken 7 times.
✗ Branch 6 not taken.
|
7 | if (!it->handle().isNull()) { |
| 1627 |
1/1✓ Branch 2 taken 7 times.
|
7 | it->remove(); |
| 1628 | } | ||
| 1629 | } | ||
| 1630 | |||
| 1631 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | t_supplySplitter->remove(); |
| 1632 | |||
| 1633 | // reset supply splitter in AirLoopHVAC since it is removed | ||
| 1634 |
1/1✓ Branch 1 taken 3 times.
|
3 | resetSupplySplitter(); |
| 1635 | |||
| 1636 | 3 | return true; | |
| 1637 | 3 | } | |
| 1638 | |||
| 1639 | 3 | bool AirLoopHVAC_Impl::removeSupplySplitter(HVACComponent& hvacComponent) { | |
| 1640 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto t_supplySplitter = supplySplitter(); |
| 1641 | |||
| 1642 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
|
3 | if (!t_supplySplitter) { |
| 1643 | ✗ | return false; | |
| 1644 | } | ||
| 1645 | |||
| 1646 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto t_supplyOutletNodes = supplyOutletNodes(); |
| 1647 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(t_supplyOutletNodes.size() == 2u); |
| 1648 | |||
| 1649 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | auto splitterOutletModelObjects = t_supplySplitter->outletModelObjects(); |
| 1650 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(splitterOutletModelObjects.size() == 2u); |
| 1651 | |||
| 1652 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto splitterOutletNodes = subsetCastVector<Node>(splitterOutletModelObjects); |
| 1653 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(splitterOutletNodes.size() == 2u); |
| 1654 | |||
| 1655 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto systemStartComponent = supplyInletNode(); |
| 1656 | 3 | boost::optional<HVACComponent> systemEndComponent; | |
| 1657 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 6 taken 3 times.
|
3 | auto componentInletPort = t_supplySplitter->getImpl<detail::Splitter_Impl>()->inletPort(); |
| 1658 | 3 | boost::optional<unsigned> componentOutletPort; | |
| 1659 | |||
| 1660 | 3 | std::vector<ModelObject> removeComps; | |
| 1661 | |||
| 1662 | // Remove branch "0" if it contains hvacComponent | ||
| 1663 | { | ||
| 1664 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 9 taken 3 times.
|
6 | auto comps = supplyComponents(splitterOutletNodes[0], t_supplyOutletNodes[0]); |
| 1665 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(!comps.empty()); |
| 1666 |
3/3✓ Branch 4 taken 3 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 2 times.
|
3 | if (std::find(comps.begin(), comps.end(), hvacComponent) != comps.end()) { |
| 1667 |
1/1✓ Branch 1 taken 1 time.
|
1 | removeComps = comps; |
| 1668 |
2/2✓ Branch 3 taken 3 times.
✓ Branch 4 taken 1 time.
|
4 | for (auto it = comps.begin(); it != comps.end(); ++it) { |
| 1669 |
1/1✓ Branch 4 taken 3 times.
|
3 | it->getImpl<detail::HVACComponent_Impl>()->disconnect(); |
| 1670 | } | ||
| 1671 |
1/1✓ Branch 2 taken 1 time.
|
1 | systemEndComponent = t_supplyOutletNodes[1]; |
| 1672 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 6 taken 1 time.
✓ Branch 9 taken 1 time.
|
1 | componentOutletPort = t_supplySplitter->getImpl<detail::Splitter_Impl>()->outletPort(1); |
| 1673 | } | ||
| 1674 | 3 | } | |
| 1675 | |||
| 1676 | // Remove branch "1" if it contains hvacComponent | ||
| 1677 |
5/6✓ Branch 1 taken 1 time.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 1 time.
|
3 | if ((!systemEndComponent) || (!componentOutletPort)) { |
| 1678 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 9 taken 2 times.
|
4 | auto comps = supplyComponents(splitterOutletNodes[1], t_supplyOutletNodes[1]); |
| 1679 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
|
2 | OS_ASSERT(!comps.empty()); |
| 1680 |
3/3✓ Branch 4 taken 2 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 1 time.
|
2 | if (std::find(comps.begin(), comps.end(), hvacComponent) != comps.end()) { |
| 1681 |
1/1✓ Branch 1 taken 1 time.
|
1 | removeComps = comps; |
| 1682 |
2/2✓ Branch 4 taken 2 times.
✓ Branch 5 taken 1 time.
|
3 | for (auto it = comps.begin() + 1; it != comps.end(); ++it) { |
| 1683 |
1/1✓ Branch 4 taken 2 times.
|
2 | it->getImpl<detail::HVACComponent_Impl>()->disconnect(); |
| 1684 | } | ||
| 1685 |
1/1✓ Branch 2 taken 1 time.
|
1 | systemEndComponent = t_supplyOutletNodes[0]; |
| 1686 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 6 taken 1 time.
✓ Branch 9 taken 1 time.
|
1 | componentOutletPort = t_supplySplitter->getImpl<detail::Splitter_Impl>()->outletPort(0); |
| 1687 | } | ||
| 1688 | 2 | } | |
| 1689 | |||
| 1690 |
5/6✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 1 time.
✓ Branch 7 taken 2 times.
|
3 | if ((!systemEndComponent) || (!componentOutletPort)) { |
| 1691 | 1 | return false; | |
| 1692 | } | ||
| 1693 | |||
| 1694 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 6 taken 2 times.
|
4 | auto result = t_supplySplitter->getImpl<detail::Splitter_Impl>()->removeFromLoop(systemStartComponent, systemEndComponent.get(), |
| 1695 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | componentInletPort, componentOutletPort.get()); |
| 1696 | |||
| 1697 |
2/2✓ Branch 4 taken 6 times.
✓ Branch 5 taken 2 times.
|
8 | for (auto& comp : removeComps) { |
| 1698 |
1/1✓ Branch 1 taken 6 times.
|
6 | comp.remove(); |
| 1699 | } | ||
| 1700 | |||
| 1701 | // reset supply splitter in AirLoopHVAC since it is removed | ||
| 1702 |
1/1✓ Branch 1 taken 2 times.
|
2 | resetSupplySplitter(); |
| 1703 | |||
| 1704 | 2 | return result; | |
| 1705 | 3 | } | |
| 1706 | |||
| 1707 | 17 | boost::optional<Node> AirLoopHVAC_Impl::supplySplitterInletNode() const { | |
| 1708 |
3/3✓ Branch 1 taken 17 times.
✓ Branch 3 taken 14 times.
✓ Branch 4 taken 3 times.
|
34 | if (auto splitter = supplySplitter()) { |
| 1709 |
3/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 6 taken 14 times.
✗ Branch 7 not taken.
|
28 | if (auto mo = splitter->inletModelObject()) { |
| 1710 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | return mo->optionalCast<Node>(); |
| 1711 | 14 | } | |
| 1712 | 17 | } | |
| 1713 | |||
| 1714 | 3 | return boost::none; | |
| 1715 | } | ||
| 1716 | |||
| 1717 | 10 | std::vector<Node> AirLoopHVAC_Impl::supplySplitterOutletNodes() const { | |
| 1718 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 3 times.
|
20 | if (auto splitter = supplySplitter()) { |
| 1719 |
3/3✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
|
7 | return subsetCastVector<Node>(splitter->outletModelObjects()); |
| 1720 | 10 | } | |
| 1721 | |||
| 1722 | 3 | return {}; | |
| 1723 | } | ||
| 1724 | |||
| 1725 | 6 | bool AirLoopHVAC_Impl::removeDualDuctTerminalFromAirLoopHVAC(HVACComponent& terminal, const unsigned inletPortA, const unsigned inletPortB, | |
| 1726 | const unsigned outletPort) { | ||
| 1727 | 6 | bool result = true; | |
| 1728 | |||
| 1729 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto _model = terminal.model(); |
| 1730 | |||
| 1731 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto t_airLoopHVAC = terminal.airLoopHVAC(); |
| 1732 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
|
6 | if (!t_airLoopHVAC) { |
| 1733 | ✗ | result = false; | |
| 1734 | } | ||
| 1735 | |||
| 1736 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if (result) { |
| 1737 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | auto demandInletNodes = t_airLoopHVAC->demandInletNodes(); |
| 1738 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(demandInletNodes.size() == 2u); |
| 1739 | |||
| 1740 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | auto zoneSplitters = t_airLoopHVAC->zoneSplitters(); |
| 1741 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(zoneSplitters.size() == 2u); |
| 1742 | |||
| 1743 | // Assuming two paths, demandInletNodes[0] (path 0) and demandInletNodes[1] (path 1) | ||
| 1744 | // Disconnect from path 1 first. | ||
| 1745 | // If there are no other terminals / zones on the path 1, then remove the entire path | ||
| 1746 | // including any plenum and the path 1 zone splitter. | ||
| 1747 | // This effectively turns it back into a single duct system on the demand side. | ||
| 1748 | { | ||
| 1749 |
1/1✓ Branch 2 taken 6 times.
|
6 | auto zoneSplitter = zoneSplitters[1]; |
| 1750 |
1/1✓ Branch 2 taken 6 times.
|
6 | auto demandInletNode = demandInletNodes[1]; |
| 1751 | |||
| 1752 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto terminalInletModelObject = terminal.connectedObject(inletPortB); |
| 1753 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(terminalInletModelObject); |
| 1754 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | auto terminalInletNode = terminalInletModelObject->optionalCast<Node>(); |
| 1755 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(terminalInletNode); |
| 1756 | |||
| 1757 | // Get comps upstream and downstream of zone splitter for this leg | ||
| 1758 | // Exclude the zone splitter itself | ||
| 1759 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
12 | auto upstreamComps = t_airLoopHVAC->demandComponents(demandInletNode, zoneSplitter); |
| 1760 | 6 | upstreamComps.pop_back(); | |
| 1761 |
5/5✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 13 taken 6 times.
|
12 | auto downstreamComps = t_airLoopHVAC->demandComponents(zoneSplitter, terminalInletNode.get()); |
| 1762 |
1/1✓ Branch 3 taken 6 times.
|
6 | downstreamComps.erase(downstreamComps.begin()); |
| 1763 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(!downstreamComps.empty()); |
| 1764 | |||
| 1765 | 6 | boost::optional<AirLoopHVACSupplyPlenum> supplyPlenum; | |
| 1766 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto supplyPlenums = subsetCastVector<AirLoopHVACSupplyPlenum>(downstreamComps); |
| 1767 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
|
6 | if (!supplyPlenums.empty()) { |
| 1768 | ✗ | supplyPlenum = supplyPlenums.front(); | |
| 1769 | } | ||
| 1770 | |||
| 1771 | 6 | bool removePlenum = false; | |
| 1772 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (supplyPlenum) { |
| 1773 | ✗ | if (supplyPlenum->outletModelObjects().size() == 1u) { | |
| 1774 | ✗ | removePlenum = true; | |
| 1775 | } | ||
| 1776 | } | ||
| 1777 | 6 | bool removeSplitter = false; | |
| 1778 |
2/6✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
|
6 | if ((!supplyPlenum) || removePlenum) { |
| 1779 |
2/3✓ Branch 1 taken 6 times.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
|
6 | if (zoneSplitter.outletModelObjects().size() == 1u) { |
| 1780 | 6 | removeSplitter = true; | |
| 1781 | } | ||
| 1782 | } | ||
| 1783 | |||
| 1784 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (supplyPlenum) { |
| 1785 | ✗ | auto branchIndex = supplyPlenum->branchIndexForOutletModelObject(terminalInletNode.get()); | |
| 1786 | ✗ | supplyPlenum->removePortForBranch(branchIndex); | |
| 1787 | ✗ | if (removePlenum) { | |
| 1788 | ✗ | supplyPlenum->getImpl<detail::AirLoopHVACSupplyPlenum_Impl>()->disconnect(); | |
| 1789 | ✗ | supplyPlenum->remove(); | |
| 1790 | } | ||
| 1791 | } | ||
| 1792 | |||
| 1793 |
3/3✓ Branch 2 taken 6 times.
✓ Branch 5 taken 6 times.
✓ Branch 8 taken 6 times.
|
6 | zoneSplitter.removePortForBranch(zoneSplitter.branchIndexForOutletModelObject(downstreamComps.front())); |
| 1794 | |||
| 1795 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 6 taken 6 times.
|
6 | terminalInletNode->getImpl<detail::Node_Impl>()->disconnect(); |
| 1796 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | terminalInletNode->remove(); |
| 1797 | |||
| 1798 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if (removeSplitter) { |
| 1799 |
2/2✓ Branch 4 taken 6 times.
✓ Branch 5 taken 6 times.
|
12 | for (auto& comp : upstreamComps) { |
| 1800 |
1/1✓ Branch 3 taken 6 times.
|
6 | comp.getImpl<detail::Node_Impl>()->disconnect(); |
| 1801 |
1/1✓ Branch 1 taken 6 times.
|
6 | comp.remove(); |
| 1802 | } | ||
| 1803 |
1/1✓ Branch 1 taken 6 times.
|
6 | zoneSplitter.remove(); |
| 1804 | |||
| 1805 | // reset demand splitter B in AirLoopHVAC since it is removed | ||
| 1806 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 6 taken 6 times.
|
6 | t_airLoopHVAC->getImpl<detail::AirLoopHVAC_Impl>()->resetZoneSplitter(1); |
| 1807 | } | ||
| 1808 | 6 | } | |
| 1809 | |||
| 1810 | // Now disconnect path 0 | ||
| 1811 | { | ||
| 1812 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto terminalInletModelObject = terminal.connectedObject(inletPortA); |
| 1813 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(terminalInletModelObject); |
| 1814 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | auto terminalInletNode = terminalInletModelObject->optionalCast<Node>(); |
| 1815 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(terminalInletNode); |
| 1816 | |||
| 1817 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto targetModelObject = terminal.connectedObject(outletPort); |
| 1818 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(targetModelObject); |
| 1819 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto targetPort = terminal.connectedObjectPort(outletPort); |
| 1820 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(targetPort); |
| 1821 | |||
| 1822 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | auto sourceModelObject = terminalInletNode->inletModelObject(); |
| 1823 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(sourceModelObject); |
| 1824 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 9 taken 6 times.
✓ Branch 12 taken 6 times.
|
6 | auto sourcePort = terminalInletNode->connectedObjectPort(terminalInletNode->getImpl<detail::Node_Impl>()->inletPort()); |
| 1825 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
|
6 | OS_ASSERT(sourcePort); |
| 1826 | |||
| 1827 |
7/7✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 13 taken 6 times.
✓ Branch 16 taken 6 times.
✓ Branch 19 taken 6 times.
|
6 | _model.connect(sourceModelObject.get(), sourcePort.get(), targetModelObject.get(), targetPort.get()); |
| 1828 | |||
| 1829 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 6 taken 6 times.
|
6 | terminalInletNode->getImpl<detail::Node_Impl>()->disconnect(); |
| 1830 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | terminalInletNode->remove(); |
| 1831 | 6 | } | |
| 1832 | 6 | } | |
| 1833 | |||
| 1834 |
2/3✓ Branch 1 taken 6 times.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
|
6 | for (auto& thermalZone : _model.getConcreteModelObjects<ThermalZone>()) { |
| 1835 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto equipment = thermalZone.equipment(); |
| 1836 | |||
| 1837 |
2/3✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
|
6 | if (std::find(equipment.begin(), equipment.end(), terminal) != equipment.end()) { |
| 1838 |
1/1✓ Branch 1 taken 6 times.
|
6 | thermalZone.removeEquipment(terminal); |
| 1839 | 6 | break; | |
| 1840 | } | ||
| 1841 | 12 | } | |
| 1842 | |||
| 1843 | 6 | return result; | |
| 1844 | 6 | } | |
| 1845 | |||
| 1846 | 21 | bool AirLoopHVAC_Impl::addDualDuctTerminalToNode(HVACComponent& terminal, const unsigned inletPortA, const unsigned inletPortB, | |
| 1847 | const unsigned outletPort, Node& node) { | ||
| 1848 | // Initialize result to true, | ||
| 1849 | // then do a series of checks to make sure we can proceed. | ||
| 1850 | // If any check does not pass, set result = false, and use that to halt progress. | ||
| 1851 | 21 | bool result = true; | |
| 1852 | |||
| 1853 |
1/1✓ Branch 1 taken 21 times.
|
21 | Model _model = node.model(); |
| 1854 |
3/4✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 21 times.
|
21 | if (_model != terminal.model()) { |
| 1855 | ✗ | result = false; | |
| 1856 | } | ||
| 1857 | |||
| 1858 |
1/1✓ Branch 1 taken 21 times.
|
21 | auto t_airLoopHVAC = node.airLoopHVAC(); |
| 1859 |
3/6✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 21 times.
|
21 | if (result && !t_airLoopHVAC) { |
| 1860 | ✗ | result = false; | |
| 1861 | } | ||
| 1862 | |||
| 1863 |
1/1✓ Branch 1 taken 21 times.
|
21 | auto outlet = node.outletModelObject(); |
| 1864 |
3/6✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 21 times.
|
21 | if (result && !outlet) { |
| 1865 | ✗ | OS_ASSERT(outlet); | |
| 1866 | ✗ | result = false; | |
| 1867 | } | ||
| 1868 | |||
| 1869 |
1/1✓ Branch 1 taken 21 times.
|
21 | auto inlet = node.inletModelObject(); |
| 1870 |
3/6✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 21 times.
|
21 | if (result && !inlet) { |
| 1871 | ✗ | OS_ASSERT(inlet); | |
| 1872 | ✗ | result = false; | |
| 1873 | } | ||
| 1874 | |||
| 1875 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | auto sourcePort = node.connectedObjectPort(node.inletPort()); |
| 1876 |
3/6✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 21 times.
|
21 | if (result && !sourcePort) { |
| 1877 | ✗ | OS_ASSERT(sourcePort); | |
| 1878 | ✗ | result = false; | |
| 1879 | } | ||
| 1880 | |||
| 1881 |
6/12✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 21 times.
✓ Branch 6 taken 21 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 21 times.
✓ Branch 11 taken 21 times.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 21 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
21 | if (result && !inlet->optionalCast<Splitter>()) { |
| 1882 | ✗ | result = false; | |
| 1883 | } | ||
| 1884 | |||
| 1885 | 21 | boost::optional<ThermalZone> thermalZone; | |
| 1886 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if (result) { |
| 1887 |
4/4✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 6 taken 17 times.
✓ Branch 7 taken 4 times.
|
42 | if (auto portList = outlet->optionalCast<PortList>()) { |
| 1888 |
3/3✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
|
17 | thermalZone = portList->thermalZone(); |
| 1889 | 21 | } | |
| 1890 | } | ||
| 1891 | |||
| 1892 |
9/14✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 17 times.
✓ Branch 5 taken 4 times.
✓ Branch 8 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4 times.
✓ Branch 13 taken 4 times.
✓ Branch 14 taken 17 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 21 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
46 | if (result && !(thermalZone || outlet->optionalCast<Mixer>())) { |
| 1893 | ✗ | result = false; | |
| 1894 | } | ||
| 1895 | |||
| 1896 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if (result) { |
| 1897 |
1/1✓ Branch 1 taken 21 times.
|
21 | Node inletNode(_model); |
| 1898 | |||
| 1899 |
6/6✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✓ Branch 13 taken 21 times.
✓ Branch 16 taken 21 times.
|
21 | _model.connect(inlet.get(), sourcePort.get(), inletNode, inletNode.inletPort()); |
| 1900 | |||
| 1901 |
4/4✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
|
21 | _model.connect(inletNode, inletNode.outletPort(), terminal, inletPortA); |
| 1902 | |||
| 1903 |
4/4✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
|
21 | _model.connect(terminal, outletPort, node, node.inletPort()); |
| 1904 | |||
| 1905 | // Hook up other side of terminal | ||
| 1906 |
2/2✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
|
21 | auto inletNodes = t_airLoopHVAC->demandInletNodes(); |
| 1907 | 21 | boost::optional<AirLoopHVACZoneSplitter> zoneSplitter2; | |
| 1908 | |||
| 1909 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 2 taken 18 times.
|
21 | if (inletNodes.size() == 2) { |
| 1910 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | auto t_zoneSplitters = t_airLoopHVAC->zoneSplitters(); |
| 1911 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(t_zoneSplitters.size() == 2u); |
| 1912 |
1/1✓ Branch 2 taken 3 times.
|
3 | zoneSplitter2 = t_zoneSplitters[1]; |
| 1913 | 3 | } else { | |
| 1914 | // Make a second demand inlet node and zone splitter if required | ||
| 1915 |
1/1✓ Branch 1 taken 18 times.
|
18 | Node demandInletNode2(_model); |
| 1916 | |||
| 1917 |
7/7✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
✓ Branch 7 taken 18 times.
✓ Branch 12 taken 18 times.
✓ Branch 15 taken 18 times.
✓ Branch 18 taken 18 times.
✓ Branch 21 taken 18 times.
|
18 | _model.connect(t_airLoopHVAC.get(), t_airLoopHVAC->getImpl<detail::AirLoopHVAC_Impl>()->demandInletPortB(), demandInletNode2, |
| 1918 | demandInletNode2.inletPort()); | ||
| 1919 | |||
| 1920 |
2/2✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
|
18 | zoneSplitter2 = AirLoopHVACZoneSplitter(_model); |
| 1921 | |||
| 1922 | // add demand splitter B in AirLoopHVAC and save to field | ||
| 1923 |
3/3✓ Branch 1 taken 18 times.
✓ Branch 6 taken 18 times.
✓ Branch 9 taken 18 times.
|
18 | t_airLoopHVAC->getImpl<detail::AirLoopHVAC_Impl>()->setZoneSplitter(zoneSplitter2.get(), 1); |
| 1924 | |||
| 1925 |
7/7✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
✓ Branch 7 taken 18 times.
✓ Branch 10 taken 18 times.
✓ Branch 13 taken 18 times.
✓ Branch 16 taken 18 times.
✓ Branch 19 taken 18 times.
|
18 | _model.connect(demandInletNode2, demandInletNode2.outletPort(), zoneSplitter2.get(), zoneSplitter2->inletPort()); |
| 1926 | 18 | } | |
| 1927 | |||
| 1928 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 4 not taken.
|
21 | OS_ASSERT(zoneSplitter2); |
| 1929 |
1/1✓ Branch 1 taken 21 times.
|
21 | Node splitter2OutletNode(_model); |
| 1930 | |||
| 1931 |
7/7✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
✓ Branch 13 taken 21 times.
✓ Branch 16 taken 21 times.
✓ Branch 19 taken 21 times.
|
21 | _model.connect(zoneSplitter2.get(), zoneSplitter2->nextOutletPort(), splitter2OutletNode, splitter2OutletNode.inletPort()); |
| 1932 | |||
| 1933 |
4/4✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
✓ Branch 7 taken 21 times.
✓ Branch 10 taken 21 times.
|
21 | _model.connect(splitter2OutletNode, splitter2OutletNode.outletPort(), terminal, inletPortB); |
| 1934 | |||
| 1935 | // Add to zone equipment list | ||
| 1936 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 4 times.
|
21 | if (thermalZone) { |
| 1937 |
2/2✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
|
17 | thermalZone->addEquipment(terminal); |
| 1938 | } | ||
| 1939 | 21 | } | |
| 1940 | |||
| 1941 | 21 | return result; | |
| 1942 | 21 | } | |
| 1943 | |||
| 1944 | 348 | bool AirLoopHVAC_Impl::isDualDuct() const { | |
| 1945 |
1/1✓ Branch 1 taken 348 times.
|
696 | return supplySplitter() ? true : false; |
| 1946 | } | ||
| 1947 | |||
| 1948 | ✗ | boost::optional<double> AirLoopHVAC_Impl::autosizedDesignSupplyAirFlowRate() const { | |
| 1949 | ✗ | return getAutosizedValue("Design Supply Air Flow Rate", "m3/s"); | |
| 1950 | } | ||
| 1951 | |||
| 1952 | // Not part of the applySizingValues | ||
| 1953 | ✗ | boost::optional<double> AirLoopHVAC_Impl::autosizedSumMinimumHeatingAirFlowRates() const { | |
| 1954 | ✗ | return getAutosizedValue("Sum of Air Terminal Minimum Heating Flow Rates", "m3/s"); | |
| 1955 | } | ||
| 1956 | |||
| 1957 | // Not part of the applySizingValues | ||
| 1958 | ✗ | boost::optional<double> AirLoopHVAC_Impl::autosizedSumAirTerminalMaxAirFlowRate() const { | |
| 1959 | ✗ | return getAutosizedValue("Sum of Air Terminal Maximum Flow Rates", "m3/s"); | |
| 1960 | } | ||
| 1961 | |||
| 1962 | ✗ | void AirLoopHVAC_Impl::autosize() { | |
| 1963 | ✗ | autosizeDesignSupplyAirFlowRate(); | |
| 1964 | ✗ | } | |
| 1965 | |||
| 1966 | ✗ | void AirLoopHVAC_Impl::applySizingValues() { | |
| 1967 | ✗ | boost::optional<double> val; | |
| 1968 | ✗ | val = autosizedDesignSupplyAirFlowRate(); | |
| 1969 | ✗ | if (val) { | |
| 1970 | ✗ | setDesignSupplyAirFlowRate(val.get()); | |
| 1971 | } | ||
| 1972 | ✗ | } | |
| 1973 | |||
| 1974 | ✗ | std::vector<EMSActuatorNames> AirLoopHVAC_Impl::emsActuatorNames() const { | |
| 1975 | ✗ | std::vector<EMSActuatorNames> actuators{{"AirLoopHVAC", "Availability Status"}}; //takes value 0,1,2,3 | |
| 1976 | ✗ | return actuators; | |
| 1977 | ✗ | } | |
| 1978 | |||
| 1979 | ✗ | std::vector<std::string> AirLoopHVAC_Impl::emsInternalVariableNames() const { | |
| 1980 | ✗ | std::vector<std::string> types; | |
| 1981 | ✗ | return types; | |
| 1982 | } | ||
| 1983 | |||
| 1984 | 714 | void AirLoopHVAC_Impl::createTopology() { | |
| 1985 |
1/1✓ Branch 1 taken 714 times.
|
714 | auto m = model(); |
| 1986 |
1/1✓ Branch 1 taken 714 times.
|
714 | auto obj = getObject<model::AirLoopHVAC>(); |
| 1987 | |||
| 1988 | // supply side | ||
| 1989 |
1/1✓ Branch 1 taken 714 times.
|
714 | openstudio::model::Node supplyInletNode(m); |
| 1990 |
1/1✓ Branch 1 taken 714 times.
|
714 | openstudio::model::Node supplyOutletNode(m); |
| 1991 | |||
| 1992 |
3/3✓ Branch 1 taken 714 times.
✓ Branch 4 taken 714 times.
✓ Branch 7 taken 714 times.
|
714 | m.connect(obj, openstudio::OS_AirLoopHVACFields::SupplySideInletNodeName, supplyInletNode, openstudio::OS_NodeFields::InletPort); |
| 1993 |
3/3✓ Branch 1 taken 714 times.
✓ Branch 4 taken 714 times.
✓ Branch 7 taken 714 times.
|
714 | m.connect(supplyInletNode, openstudio::OS_NodeFields::OutletPort, supplyOutletNode, openstudio::OS_NodeFields::InletPort); |
| 1994 |
3/3✓ Branch 1 taken 714 times.
✓ Branch 4 taken 714 times.
✓ Branch 7 taken 714 times.
|
714 | m.connect(supplyOutletNode, openstudio::OS_NodeFields::OutletPort, obj, openstudio::OS_AirLoopHVACFields::SupplySideOutletNodeA); |
| 1995 | |||
| 1996 | // demand side | ||
| 1997 |
1/1✓ Branch 1 taken 714 times.
|
714 | Node demandInletNode(m); |
| 1998 |
1/1✓ Branch 1 taken 714 times.
|
714 | Node demandOutletNode(m); |
| 1999 |
1/1✓ Branch 1 taken 714 times.
|
714 | Node branchNode(m); |
| 2000 | |||
| 2001 |
4/4✓ Branch 1 taken 714 times.
✓ Branch 4 taken 714 times.
✓ Branch 7 taken 714 times.
✓ Branch 10 taken 714 times.
|
714 | m.connect(obj, openstudio::OS_AirLoopHVACFields::DemandSideInletNodeA, demandInletNode, demandInletNode.inletPort()); |
| 2002 |
4/4✓ Branch 1 taken 714 times.
✓ Branch 4 taken 714 times.
✓ Branch 7 taken 714 times.
✓ Branch 10 taken 714 times.
|
714 | m.connect(demandOutletNode, demandOutletNode.outletPort(), obj, openstudio::OS_AirLoopHVACFields::DemandSideOutletNodeName); |
| 2003 | |||
| 2004 |
1/1✓ Branch 1 taken 714 times.
|
714 | openstudio::model::AirLoopHVACZoneSplitter airLoopHVACZoneSplitter(m); |
| 2005 |
1/1✓ Branch 1 taken 714 times.
|
714 | setZoneSplitter(airLoopHVACZoneSplitter, 0); |
| 2006 |
1/1✓ Branch 1 taken 714 times.
|
714 | openstudio::model::AirLoopHVACZoneMixer airLoopHVACZoneMixer(m); |
| 2007 |
1/1✓ Branch 1 taken 714 times.
|
714 | setZoneMixer(airLoopHVACZoneMixer); |
| 2008 | |||
| 2009 |
5/5✓ Branch 1 taken 714 times.
✓ Branch 4 taken 714 times.
✓ Branch 7 taken 714 times.
✓ Branch 10 taken 714 times.
✓ Branch 13 taken 714 times.
|
714 | m.connect(demandInletNode, demandInletNode.outletPort(), airLoopHVACZoneSplitter, airLoopHVACZoneSplitter.inletPort()); |
| 2010 | |||
| 2011 |
5/5✓ Branch 1 taken 714 times.
✓ Branch 4 taken 714 times.
✓ Branch 7 taken 714 times.
✓ Branch 10 taken 714 times.
✓ Branch 13 taken 714 times.
|
714 | m.connect(airLoopHVACZoneSplitter, airLoopHVACZoneSplitter.nextOutletPort(), branchNode, branchNode.inletPort()); |
| 2012 | |||
| 2013 |
5/5✓ Branch 1 taken 714 times.
✓ Branch 4 taken 714 times.
✓ Branch 7 taken 714 times.
✓ Branch 10 taken 714 times.
✓ Branch 13 taken 714 times.
|
714 | m.connect(branchNode, branchNode.outletPort(), airLoopHVACZoneMixer, airLoopHVACZoneMixer.nextInletPort()); |
| 2014 | |||
| 2015 |
5/5✓ Branch 1 taken 714 times.
✓ Branch 4 taken 714 times.
✓ Branch 7 taken 714 times.
✓ Branch 10 taken 714 times.
✓ Branch 13 taken 714 times.
|
714 | m.connect(airLoopHVACZoneMixer, airLoopHVACZoneMixer.outletPort(), demandOutletNode, demandOutletNode.inletPort()); |
| 2016 | 714 | } | |
| 2017 | |||
| 2018 | } // namespace detail | ||
| 2019 | |||
| 2020 | 704 | AirLoopHVAC::AirLoopHVAC(Model& model, bool dualDuct) : Loop(iddObjectType(), model) { | |
| 2021 | 704 | auto impl = getImpl<detail::AirLoopHVAC_Impl>(); | |
| 2022 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 704 times.
✗ Branch 4 not taken.
|
704 | OS_ASSERT(impl); |
| 2023 | |||
| 2024 |
1/1✓ Branch 2 taken 704 times.
|
704 | impl->createTopology(); |
| 2025 | |||
| 2026 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 688 times.
|
704 | if (dualDuct) { |
| 2027 |
1/1✓ Branch 1 taken 16 times.
|
16 | auto n = supplyOutletNode(); |
| 2028 |
1/1✓ Branch 1 taken 16 times.
|
16 | ConnectorSplitter splitter(model); |
| 2029 |
1/1✓ Branch 1 taken 16 times.
|
16 | splitter.addToNode(n); |
| 2030 |
1/1✓ Branch 2 taken 16 times.
|
16 | impl->setSupplySplitter(splitter); |
| 2031 | 16 | } | |
| 2032 | |||
| 2033 | // Sizing:System | ||
| 2034 |
1/1✓ Branch 1 taken 704 times.
|
704 | SizingSystem sizingSystem(model, *this); |
| 2035 | |||
| 2036 | // AvailabilityManagerScheduled | ||
| 2037 | { | ||
| 2038 |
1/1✓ Branch 1 taken 704 times.
|
704 | auto schedule = model.alwaysOnDiscreteSchedule(); |
| 2039 |
1/1✓ Branch 1 taken 704 times.
|
704 | setAvailabilitySchedule(schedule); |
| 2040 | 704 | } | |
| 2041 | |||
| 2042 | // AvailabilityManagerAssignmentList | ||
| 2043 |
1/1✓ Branch 1 taken 704 times.
|
704 | AvailabilityManagerAssignmentList avmList(*this); |
| 2044 |
2/2✓ Branch 1 taken 704 times.
✓ Branch 4 taken 704 times.
|
704 | setPointer(OS_AirLoopHVACFields::AvailabilityManagerListName, avmList.handle()); |
| 2045 | |||
| 2046 | // E+ IDD Default | ||
| 2047 |
1/1✓ Branch 1 taken 704 times.
|
704 | autosizeDesignSupplyAirFlowRate(); |
| 2048 |
1/1✓ Branch 1 taken 704 times.
|
704 | setDesignReturnAirFlowFractionofSupplyAirFlow(1.0); |
| 2049 | 704 | } | |
| 2050 | |||
| 2051 |
1/1✓ Branch 3 taken 9451 times.
|
9451 | AirLoopHVAC::AirLoopHVAC(std::shared_ptr<detail::AirLoopHVAC_Impl> impl) : Loop(std::move(impl)) {} |
| 2052 | |||
| 2053 | 1108 | Node AirLoopHVAC::supplyInletNode() const { | |
| 2054 |
1/1✓ Branch 3 taken 1108 times.
|
1108 | return getImpl<detail::AirLoopHVAC_Impl>()->supplyInletNode(); |
| 2055 | } | ||
| 2056 | |||
| 2057 | 1178 | std::vector<Node> AirLoopHVAC::supplyOutletNodes() const { | |
| 2058 |
1/1✓ Branch 3 taken 1178 times.
|
1178 | return getImpl<detail::AirLoopHVAC_Impl>()->supplyOutletNodes(); |
| 2059 | } | ||
| 2060 | |||
| 2061 | 443 | std::vector<Node> AirLoopHVAC::demandInletNodes() const { | |
| 2062 |
1/1✓ Branch 3 taken 443 times.
|
443 | return getImpl<detail::AirLoopHVAC_Impl>()->demandInletNodes(); |
| 2063 | } | ||
| 2064 | |||
| 2065 | 836 | Node AirLoopHVAC::demandOutletNode() const { | |
| 2066 |
1/1✓ Branch 3 taken 836 times.
|
836 | return getImpl<detail::AirLoopHVAC_Impl>()->demandOutletNode(); |
| 2067 | } | ||
| 2068 | |||
| 2069 | 16 | std::vector<IdfObject> AirLoopHVAC::remove() { | |
| 2070 |
1/1✓ Branch 3 taken 16 times.
|
16 | return getImpl<detail::AirLoopHVAC_Impl>()->remove(); |
| 2071 | } | ||
| 2072 | |||
| 2073 | 3243 | OptionalAirLoopHVACOutdoorAirSystem AirLoopHVAC::airLoopHVACOutdoorAirSystem() const { | |
| 2074 |
1/1✓ Branch 3 taken 3243 times.
|
3243 | return getImpl<detail::AirLoopHVAC_Impl>()->airLoopHVACOutdoorAirSystem(); |
| 2075 | } | ||
| 2076 | |||
| 2077 | 24 | boost::optional<AirLoopHVACDedicatedOutdoorAirSystem> AirLoopHVAC::airLoopHVACDedicatedOutdoorAirSystem() const { | |
| 2078 |
1/1✓ Branch 3 taken 24 times.
|
24 | return getImpl<detail::AirLoopHVAC_Impl>()->airLoopHVACDedicatedOutdoorAirSystem(); |
| 2079 | } | ||
| 2080 | |||
| 2081 | 672 | AirLoopHVACZoneMixer AirLoopHVAC::zoneMixer() const { | |
| 2082 |
1/1✓ Branch 3 taken 672 times.
|
672 | return getImpl<detail::AirLoopHVAC_Impl>()->zoneMixer(); |
| 2083 | } | ||
| 2084 | |||
| 2085 | 514 | AirLoopHVACZoneSplitter AirLoopHVAC::zoneSplitter() const { | |
| 2086 |
1/1✓ Branch 3 taken 514 times.
|
514 | return getImpl<detail::AirLoopHVAC_Impl>()->zoneSplitter(); |
| 2087 | } | ||
| 2088 | |||
| 2089 | 92 | std::vector<AirLoopHVACZoneSplitter> AirLoopHVAC::zoneSplitters() const { | |
| 2090 |
1/1✓ Branch 3 taken 92 times.
|
92 | return getImpl<detail::AirLoopHVAC_Impl>()->zoneSplitters(); |
| 2091 | } | ||
| 2092 | |||
| 2093 | 32 | bool AirLoopHVAC::addBranchForZone(openstudio::model::ThermalZone& thermalZone, boost::optional<StraightComponent> optAirTerminal) { | |
| 2094 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 11 times.
|
32 | if (optAirTerminal) { |
| 2095 |
2/2✓ Branch 3 taken 21 times.
✓ Branch 6 taken 21 times.
|
21 | return getImpl<detail::AirLoopHVAC_Impl>()->addBranchForZone(thermalZone, optAirTerminal.get()); |
| 2096 | } else { | ||
| 2097 |
1/1✓ Branch 3 taken 11 times.
|
11 | return getImpl<detail::AirLoopHVAC_Impl>()->addBranchForZone(thermalZone); |
| 2098 | } | ||
| 2099 | } | ||
| 2100 | |||
| 2101 | 3 | bool AirLoopHVAC::multiAddBranchForZone(ThermalZone& thermalZone) { | |
| 2102 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::AirLoopHVAC_Impl>()->multiAddBranchForZone(thermalZone); |
| 2103 | } | ||
| 2104 | |||
| 2105 | 6 | bool AirLoopHVAC::multiAddBranchForZone(ThermalZone& thermalZone, HVACComponent& airTerminal) { | |
| 2106 |
1/1✓ Branch 3 taken 6 times.
|
6 | return getImpl<detail::AirLoopHVAC_Impl>()->multiAddBranchForZone(thermalZone, airTerminal); |
| 2107 | } | ||
| 2108 | |||
| 2109 | 10 | ModelObject AirLoopHVAC::clone(Model model) const { | |
| 2110 |
2/2✓ Branch 3 taken 10 times.
✓ Branch 6 taken 10 times.
|
10 | return getImpl<detail::AirLoopHVAC_Impl>()->clone(model); |
| 2111 | } | ||
| 2112 | |||
| 2113 | ✗ | std::vector<ModelObject> AirLoopHVAC::oaComponents(openstudio::IddObjectType type) const { | |
| 2114 | ✗ | return getImpl<detail::AirLoopHVAC_Impl>()->oaComponents(type); | |
| 2115 | } | ||
| 2116 | |||
| 2117 | 3 | boost::optional<Node> AirLoopHVAC::outdoorAirNode() const { | |
| 2118 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::AirLoopHVAC_Impl>()->outdoorAirNode(); |
| 2119 | } | ||
| 2120 | |||
| 2121 | 3 | boost::optional<Node> AirLoopHVAC::reliefAirNode() const { | |
| 2122 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::AirLoopHVAC_Impl>()->reliefAirNode(); |
| 2123 | } | ||
| 2124 | |||
| 2125 | 10 | boost::optional<Node> AirLoopHVAC::mixedAirNode() const { | |
| 2126 |
1/1✓ Branch 3 taken 10 times.
|
10 | return getImpl<detail::AirLoopHVAC_Impl>()->mixedAirNode(); |
| 2127 | } | ||
| 2128 | |||
| 2129 | 4 | boost::optional<Node> AirLoopHVAC::returnAirNode() const { | |
| 2130 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::AirLoopHVAC_Impl>()->returnAirNode(); |
| 2131 | } | ||
| 2132 | |||
| 2133 | 229 | boost::optional<Splitter> AirLoopHVAC::supplySplitter() const { | |
| 2134 |
1/1✓ Branch 3 taken 229 times.
|
229 | return getImpl<detail::AirLoopHVAC_Impl>()->supplySplitter(); |
| 2135 | } | ||
| 2136 | |||
| 2137 | 17 | boost::optional<Node> AirLoopHVAC::supplySplitterInletNode() const { | |
| 2138 |
1/1✓ Branch 3 taken 17 times.
|
17 | return getImpl<detail::AirLoopHVAC_Impl>()->supplySplitterInletNode(); |
| 2139 | } | ||
| 2140 | |||
| 2141 | 10 | std::vector<Node> AirLoopHVAC::supplySplitterOutletNodes() const { | |
| 2142 |
1/1✓ Branch 3 taken 10 times.
|
10 | return getImpl<detail::AirLoopHVAC_Impl>()->supplySplitterOutletNodes(); |
| 2143 | } | ||
| 2144 | |||
| 2145 | 1595 | Node AirLoopHVAC::supplyOutletNode() const { | |
| 2146 |
1/1✓ Branch 3 taken 1595 times.
|
1595 | return getImpl<detail::AirLoopHVAC_Impl>()->supplyOutletNode(); |
| 2147 | } | ||
| 2148 | |||
| 2149 | 13 | Node AirLoopHVAC::demandInletNode() const { | |
| 2150 |
1/1✓ Branch 3 taken 13 times.
|
13 | return getImpl<detail::AirLoopHVAC_Impl>()->demandInletNode(); |
| 2151 | } | ||
| 2152 | |||
| 2153 | 19 | bool AirLoopHVAC::removeBranchForZone(openstudio::model::ThermalZone& thermalZone) { | |
| 2154 |
1/1✓ Branch 3 taken 19 times.
|
19 | return getImpl<detail::AirLoopHVAC_Impl>()->removeBranchForZone(thermalZone); |
| 2155 | } | ||
| 2156 | |||
| 2157 | 17759 | IddObjectType AirLoopHVAC::iddObjectType() { | |
| 2158 |
1/1✓ Branch 1 taken 17759 times.
|
17759 | return {IddObjectType::OS_AirLoopHVAC}; |
| 2159 | } | ||
| 2160 | |||
| 2161 | 78 | bool AirLoopHVAC::addBranchForZone(openstudio::model::ThermalZone& thermalZone) { | |
| 2162 |
1/1✓ Branch 3 taken 78 times.
|
78 | return getImpl<detail::AirLoopHVAC_Impl>()->addBranchForZone(thermalZone); |
| 2163 | } | ||
| 2164 | |||
| 2165 | 250 | bool AirLoopHVAC::addBranchForZone(ThermalZone& thermalZone, HVACComponent& airTerminal) { | |
| 2166 |
1/1✓ Branch 3 taken 250 times.
|
250 | return getImpl<detail::AirLoopHVAC_Impl>()->addBranchForZone(thermalZone, airTerminal); |
| 2167 | } | ||
| 2168 | |||
| 2169 | 44 | bool AirLoopHVAC::addBranchForHVACComponent(HVACComponent& component) { | |
| 2170 |
1/1✓ Branch 3 taken 44 times.
|
44 | return getImpl<detail::AirLoopHVAC_Impl>()->addBranchForHVACComponent(component); |
| 2171 | } | ||
| 2172 | |||
| 2173 | 241 | SizingSystem AirLoopHVAC::sizingSystem() const { | |
| 2174 |
1/1✓ Branch 3 taken 240 times.
|
241 | return getImpl<detail::AirLoopHVAC_Impl>()->sizingSystem(); |
| 2175 | } | ||
| 2176 | |||
| 2177 | 108 | std::vector<ThermalZone> AirLoopHVAC::thermalZones() const { | |
| 2178 |
1/1✓ Branch 3 taken 108 times.
|
108 | return getImpl<detail::AirLoopHVAC_Impl>()->thermalZones(); |
| 2179 | } | ||
| 2180 | |||
| 2181 | ✗ | boost::optional<double> AirLoopHVAC::designSupplyAirFlowRate() const { | |
| 2182 | ✗ | return getImpl<detail::AirLoopHVAC_Impl>()->designSupplyAirFlowRate(); | |
| 2183 | } | ||
| 2184 | |||
| 2185 | 201 | bool AirLoopHVAC::isDesignSupplyAirFlowRateAutosized() const { | |
| 2186 |
1/1✓ Branch 3 taken 201 times.
|
201 | return getImpl<detail::AirLoopHVAC_Impl>()->isDesignSupplyAirFlowRateAutosized(); |
| 2187 | } | ||
| 2188 | |||
| 2189 | 5 | bool AirLoopHVAC::setDesignSupplyAirFlowRate(double designSupplyAirFlowRate) { | |
| 2190 |
2/2✓ Branch 3 taken 5 times.
✓ Branch 6 taken 5 times.
|
5 | return getImpl<detail::AirLoopHVAC_Impl>()->setDesignSupplyAirFlowRate(designSupplyAirFlowRate); |
| 2191 | } | ||
| 2192 | |||
| 2193 | ✗ | void AirLoopHVAC::resetDesignSupplyAirFlowRate() { | |
| 2194 | ✗ | getImpl<detail::AirLoopHVAC_Impl>()->resetDesignSupplyAirFlowRate(); | |
| 2195 | ✗ | } | |
| 2196 | |||
| 2197 | 704 | void AirLoopHVAC::autosizeDesignSupplyAirFlowRate() { | |
| 2198 |
1/1✓ Branch 3 taken 704 times.
|
704 | getImpl<detail::AirLoopHVAC_Impl>()->autosizeDesignSupplyAirFlowRate(); |
| 2199 | 704 | } | |
| 2200 | |||
| 2201 | 204 | double AirLoopHVAC::designReturnAirFlowFractionofSupplyAirFlow() const { | |
| 2202 |
1/1✓ Branch 3 taken 204 times.
|
204 | return getImpl<detail::AirLoopHVAC_Impl>()->designReturnAirFlowFractionofSupplyAirFlow(); |
| 2203 | } | ||
| 2204 | |||
| 2205 | 707 | bool AirLoopHVAC::setDesignReturnAirFlowFractionofSupplyAirFlow(double designReturnAirFlowFractionofSupplyAirFlow) { | |
| 2206 |
1/1✓ Branch 3 taken 707 times.
|
707 | return getImpl<detail::AirLoopHVAC_Impl>()->setDesignReturnAirFlowFractionofSupplyAirFlow(designReturnAirFlowFractionofSupplyAirFlow); |
| 2207 | } | ||
| 2208 | |||
| 2209 | 274 | Schedule AirLoopHVAC::availabilitySchedule() const { | |
| 2210 |
1/1✓ Branch 3 taken 274 times.
|
274 | return getImpl<detail::AirLoopHVAC_Impl>()->availabilitySchedule(); |
| 2211 | } | ||
| 2212 | |||
| 2213 | 719 | bool AirLoopHVAC::setAvailabilitySchedule(Schedule& schedule) { | |
| 2214 |
1/1✓ Branch 3 taken 719 times.
|
719 | return getImpl<detail::AirLoopHVAC_Impl>()->setAvailabilitySchedule(schedule); |
| 2215 | } | ||
| 2216 | |||
| 2217 | 13 | bool AirLoopHVAC::setNightCycleControlType(const std::string& controlType) { | |
| 2218 |
1/1✓ Branch 3 taken 13 times.
|
13 | return getImpl<detail::AirLoopHVAC_Impl>()->setNightCycleControlType(controlType); |
| 2219 | } | ||
| 2220 | |||
| 2221 | // boost::optional<Schedule> AirLoopHVAC::returnAirBypassFlowTemperatureSetpointSchedule() const | ||
| 2222 | // { | ||
| 2223 | // return getImpl<detail::AirLoopHVAC_Impl>()->returnAirBypassFlowTemperatureSetpointSchedule(); | ||
| 2224 | // } | ||
| 2225 | |||
| 2226 | // bool AirLoopHVAC::setReturnAirBypassFlowTemperatureSetpointSchedule(Schedule & temperatureSetpointSchedule) | ||
| 2227 | // { | ||
| 2228 | // return getImpl<detail::AirLoopHVAC_Impl>()->setReturnAirBypassFlowTemperatureSetpointSchedule(temperatureSetpointSchedule); | ||
| 2229 | // } | ||
| 2230 | |||
| 2231 | // void AirLoopHVAC::resetReturnAirBypassFlowTemperatureSetpointSchedule() | ||
| 2232 | // { | ||
| 2233 | // getImpl<detail::AirLoopHVAC_Impl>()->resetReturnAirBypassFlowTemperatureSetpointSchedule(); | ||
| 2234 | // } | ||
| 2235 | |||
| 2236 | 3 | std::string AirLoopHVAC::nightCycleControlType() const { | |
| 2237 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::AirLoopHVAC_Impl>()->nightCycleControlType(); |
| 2238 | } | ||
| 2239 | |||
| 2240 | 52 | boost::optional<HVACComponent> AirLoopHVAC::supplyFan() const { | |
| 2241 |
1/1✓ Branch 3 taken 52 times.
|
52 | return getImpl<detail::AirLoopHVAC_Impl>()->supplyFan(); |
| 2242 | } | ||
| 2243 | |||
| 2244 | 2 | boost::optional<HVACComponent> AirLoopHVAC::returnFan() const { | |
| 2245 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::AirLoopHVAC_Impl>()->returnFan(); |
| 2246 | } | ||
| 2247 | |||
| 2248 | 1 | boost::optional<HVACComponent> AirLoopHVAC::reliefFan() const { | |
| 2249 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::AirLoopHVAC_Impl>()->reliefFan(); |
| 2250 | } | ||
| 2251 | |||
| 2252 | 3 | bool AirLoopHVAC::removeSupplySplitter() { | |
| 2253 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::AirLoopHVAC_Impl>()->removeSupplySplitter(); |
| 2254 | } | ||
| 2255 | |||
| 2256 | 3 | bool AirLoopHVAC::removeSupplySplitter(HVACComponent& hvacComponent) { | |
| 2257 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::AirLoopHVAC_Impl>()->removeSupplySplitter(hvacComponent); |
| 2258 | } | ||
| 2259 | |||
| 2260 | 18 | bool AirLoopHVAC::isDualDuct() const { | |
| 2261 |
1/1✓ Branch 3 taken 18 times.
|
18 | return getImpl<detail::AirLoopHVAC_Impl>()->isDualDuct(); |
| 2262 | } | ||
| 2263 | |||
| 2264 | /* Prefered way to interact with the Availability Managers */ | ||
| 2265 | 28 | std::vector<AvailabilityManager> AirLoopHVAC::availabilityManagers() const { | |
| 2266 |
1/1✓ Branch 3 taken 28 times.
|
28 | return getImpl<detail::AirLoopHVAC_Impl>()->availabilityManagers(); |
| 2267 | } | ||
| 2268 | |||
| 2269 | ✗ | bool AirLoopHVAC::setAvailabilityManagers(const std::vector<AvailabilityManager>& avms) { | |
| 2270 | ✗ | return getImpl<detail::AirLoopHVAC_Impl>()->setAvailabilityManagers(avms); | |
| 2271 | } | ||
| 2272 | |||
| 2273 | 1 | void AirLoopHVAC::resetAvailabilityManagers() { | |
| 2274 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::AirLoopHVAC_Impl>()->resetAvailabilityManagers(); |
| 2275 | } | ||
| 2276 | |||
| 2277 | 18 | bool AirLoopHVAC::addAvailabilityManager(const AvailabilityManager& availabilityManager) { | |
| 2278 |
1/1✓ Branch 3 taken 18 times.
|
18 | return getImpl<detail::AirLoopHVAC_Impl>()->addAvailabilityManager(availabilityManager); |
| 2279 | } | ||
| 2280 | // End prefered way | ||
| 2281 | |||
| 2282 | ✗ | bool AirLoopHVAC::addAvailabilityManager(const AvailabilityManager& availabilityManager, unsigned priority) { | |
| 2283 | ✗ | return getImpl<detail::AirLoopHVAC_Impl>()->addAvailabilityManager(availabilityManager, priority); | |
| 2284 | } | ||
| 2285 | |||
| 2286 | ✗ | boost::optional<double> AirLoopHVAC::autosizedDesignSupplyAirFlowRate() const { | |
| 2287 | ✗ | return getImpl<detail::AirLoopHVAC_Impl>()->autosizedDesignSupplyAirFlowRate(); | |
| 2288 | } | ||
| 2289 | |||
| 2290 | ✗ | boost::optional<double> AirLoopHVAC::autosizedSumMinimumHeatingAirFlowRates() const { | |
| 2291 | ✗ | return getImpl<detail::AirLoopHVAC_Impl>()->autosizedSumMinimumHeatingAirFlowRates(); | |
| 2292 | } | ||
| 2293 | |||
| 2294 | ✗ | boost::optional<double> AirLoopHVAC::autosizedSumAirTerminalMaxAirFlowRate() const { | |
| 2295 | ✗ | return getImpl<detail::AirLoopHVAC_Impl>()->autosizedSumAirTerminalMaxAirFlowRate(); | |
| 2296 | } | ||
| 2297 | |||
| 2298 | ✗ | unsigned AirLoopHVAC::availabilityManagerPriority(const AvailabilityManager& availabilityManager) const { | |
| 2299 | ✗ | return getImpl<detail::AirLoopHVAC_Impl>()->availabilityManagerPriority(availabilityManager); | |
| 2300 | } | ||
| 2301 | |||
| 2302 | ✗ | bool AirLoopHVAC::setAvailabilityManagerPriority(const AvailabilityManager& availabilityManager, unsigned priority) { | |
| 2303 | ✗ | return getImpl<detail::AirLoopHVAC_Impl>()->setAvailabilityManagerPriority(availabilityManager, priority); | |
| 2304 | } | ||
| 2305 | |||
| 2306 | 1 | bool AirLoopHVAC::removeAvailabilityManager(const AvailabilityManager& availabilityManager) { | |
| 2307 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::AirLoopHVAC_Impl>()->removeAvailabilityManager(availabilityManager); |
| 2308 | } | ||
| 2309 | |||
| 2310 | ✗ | bool AirLoopHVAC::removeAvailabilityManager(unsigned priority) { | |
| 2311 | ✗ | return getImpl<detail::AirLoopHVAC_Impl>()->removeAvailabilityManager(priority); | |
| 2312 | } | ||
| 2313 | |||
| 2314 | } // namespace model | ||
| 2315 | |||
| 2316 | } // namespace openstudio | ||
| 2317 |