src/model/FanConstantVolume.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 "FanConstantVolume.hpp" | ||
| 7 | #include "FanConstantVolume_Impl.hpp" | ||
| 8 | #include "AirLoopHVAC.hpp" | ||
| 9 | #include "AirLoopHVAC_Impl.hpp" | ||
| 10 | #include "ZoneHVACComponent.hpp" | ||
| 11 | #include "ZoneHVACComponent_Impl.hpp" | ||
| 12 | #include "ZoneHVACFourPipeFanCoil.hpp" | ||
| 13 | #include "ZoneHVACFourPipeFanCoil_Impl.hpp" | ||
| 14 | #include "ZoneHVACPackagedTerminalHeatPump.hpp" | ||
| 15 | #include "ZoneHVACPackagedTerminalHeatPump_Impl.hpp" | ||
| 16 | #include "ZoneHVACPackagedTerminalAirConditioner.hpp" | ||
| 17 | #include "ZoneHVACPackagedTerminalAirConditioner_Impl.hpp" | ||
| 18 | #include "ZoneHVACUnitHeater.hpp" | ||
| 19 | #include "ZoneHVACUnitHeater_Impl.hpp" | ||
| 20 | #include "ZoneHVACUnitVentilator.hpp" | ||
| 21 | #include "ZoneHVACUnitVentilator_Impl.hpp" | ||
| 22 | #include "ZoneHVACEvaporativeCoolerUnit.hpp" | ||
| 23 | #include "ZoneHVACEvaporativeCoolerUnit_Impl.hpp" | ||
| 24 | #include "AirLoopHVACOutdoorAirSystem.hpp" | ||
| 25 | #include "AirLoopHVACOutdoorAirSystem_Impl.hpp" | ||
| 26 | #include "AirTerminalSingleDuctParallelPIUReheat.hpp" | ||
| 27 | #include "AirTerminalSingleDuctParallelPIUReheat_Impl.hpp" | ||
| 28 | #include "AirTerminalSingleDuctSeriesPIUReheat.hpp" | ||
| 29 | #include "AirTerminalSingleDuctSeriesPIUReheat_Impl.hpp" | ||
| 30 | #include "AirLoopHVACUnitaryHeatPumpAirToAir.hpp" | ||
| 31 | #include "AirLoopHVACUnitaryHeatPumpAirToAir_Impl.hpp" | ||
| 32 | #include "AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass.hpp" | ||
| 33 | #include "AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass_Impl.hpp" | ||
| 34 | #include "AirLoopHVACUnitarySystem.hpp" | ||
| 35 | #include "AirLoopHVACUnitarySystem_Impl.hpp" | ||
| 36 | #include "AirflowNetworkFan.hpp" | ||
| 37 | #include "AirflowNetworkFan_Impl.hpp" | ||
| 38 | #include "SetpointManagerMixedAir.hpp" | ||
| 39 | #include "Node.hpp" | ||
| 40 | #include "Node_Impl.hpp" | ||
| 41 | #include "Schedule.hpp" | ||
| 42 | #include "Schedule_Impl.hpp" | ||
| 43 | #include "Model.hpp" | ||
| 44 | #include <utilities/idd/OS_Fan_ConstantVolume_FieldEnums.hxx> | ||
| 45 | #include <utilities/idd/IddEnums.hxx> | ||
| 46 | #include "../utilities/core/Compare.hpp" | ||
| 47 | #include "../utilities/core/Assert.hpp" | ||
| 48 | #include "../utilities/data/DataEnums.hpp" | ||
| 49 | |||
| 50 | namespace openstudio { | ||
| 51 | |||
| 52 | namespace model { | ||
| 53 | |||
| 54 | namespace detail { | ||
| 55 | |||
| 56 | 395 | FanConstantVolume_Impl::FanConstantVolume_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 57 | 395 | : StraightComponent_Impl(idfObject, model, keepHandle) { | |
| 58 |
4/6✓ Branch 1 taken 395 times.
✓ Branch 4 taken 395 times.
✓ Branch 7 taken 395 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 395 times.
✗ Branch 13 not taken.
|
395 | OS_ASSERT(idfObject.iddObject().type() == FanConstantVolume::iddObjectType()); |
| 59 | 395 | } | |
| 60 | |||
| 61 | 44 | FanConstantVolume_Impl::FanConstantVolume_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 62 | 44 | : StraightComponent_Impl(other, model, keepHandle) { | |
| 63 |
4/6✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
✓ Branch 7 taken 44 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 44 times.
✗ Branch 13 not taken.
|
44 | OS_ASSERT(other.iddObject().type() == FanConstantVolume::iddObjectType()); |
| 64 | 44 | } | |
| 65 | |||
| 66 | 212 | FanConstantVolume_Impl::FanConstantVolume_Impl(const FanConstantVolume_Impl& other, Model_Impl* model, bool keepHandle) | |
| 67 | 212 | : StraightComponent_Impl(other, model, keepHandle) {} | |
| 68 | |||
| 69 | 1 | const std::vector<std::string>& FanConstantVolume_Impl::outputVariableNames() const { | |
| 70 | static const std::vector<std::string> results{"Fan Electricity Rate", "Fan Rise in Air Temperature", "Fan Heat Gain to Air", | ||
| 71 |
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 5 times.
✓ Branch 11 taken 1 time.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
8 | "Fan Electricity Energy", "Fan Air Mass Flow Rate"}; |
| 72 | 1 | return results; | |
| 73 | 3 | } | |
| 74 | |||
| 75 | 1528 | IddObjectType FanConstantVolume_Impl::iddObjectType() const { | |
| 76 | 1528 | return FanConstantVolume::iddObjectType(); | |
| 77 | } | ||
| 78 | |||
| 79 | ✗ | std::vector<ScheduleTypeKey> FanConstantVolume_Impl::getScheduleTypeKeys(const Schedule& schedule) const { | |
| 80 | // TODO: Check schedule display names. | ||
| 81 | ✗ | std::vector<ScheduleTypeKey> result; | |
| 82 | ✗ | UnsignedVector fieldIndices = getSourceIndices(schedule.handle()); | |
| 83 | ✗ | UnsignedVector::const_iterator b(fieldIndices.begin()); | |
| 84 | ✗ | UnsignedVector::const_iterator e(fieldIndices.end()); | |
| 85 | ✗ | if (std::find(b, e, OS_Fan_ConstantVolumeFields::AvailabilityScheduleName) != e) { | |
| 86 | ✗ | result.push_back(ScheduleTypeKey("FanConstantVolume", "Availability")); | |
| 87 | } | ||
| 88 | ✗ | return result; | |
| 89 | ✗ | } | |
| 90 | |||
| 91 | 1281 | unsigned FanConstantVolume_Impl::inletPort() const { | |
| 92 | 1281 | return OS_Fan_ConstantVolumeFields::AirInletNodeName; | |
| 93 | } | ||
| 94 | |||
| 95 | 7839 | unsigned FanConstantVolume_Impl::outletPort() const { | |
| 96 | 7839 | return OS_Fan_ConstantVolumeFields::AirOutletNodeName; | |
| 97 | } | ||
| 98 | |||
| 99 | 63 | Schedule FanConstantVolume_Impl::availabilitySchedule() const { | |
| 100 |
1/1✓ Branch 1 taken 63 times.
|
63 | boost::optional<Schedule> value = optionalAvailabilitySchedule(); |
| 101 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 63 times.
|
63 | if (!value) { |
| 102 | // it is an error if we get here, however we don't want to crash | ||
| 103 | // so we hook up to global always on schedule | ||
| 104 | ✗ | LOG(Error, "Required availability schedule not set, using 'Always On' schedule"); | |
| 105 | ✗ | value = this->model().alwaysOnDiscreteSchedule(); | |
| 106 | ✗ | OS_ASSERT(value); | |
| 107 | ✗ | const_cast<FanConstantVolume_Impl*>(this)->setAvailabilitySchedule(*value); | |
| 108 | ✗ | value = optionalAvailabilitySchedule(); | |
| 109 | } | ||
| 110 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 63 times.
✗ Branch 4 not taken.
|
63 | OS_ASSERT(value); |
| 111 |
2/2✓ Branch 1 taken 63 times.
✓ Branch 4 taken 63 times.
|
126 | return value.get(); |
| 112 | 63 | } | |
| 113 | |||
| 114 | 373 | bool FanConstantVolume_Impl::setAvailabilitySchedule(Schedule& schedule) { | |
| 115 |
2/3✓ Branch 1 taken 373 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 373 times.
|
746 | if (boost::optional<AirLoopHVAC> _airLoop = airLoopHVAC()) { |
| 116 | ✗ | LOG(Info, briefDescription() << " is connected to an AirLoopHVAC '" << _airLoop->nameString() | |
| 117 | << "', therefore its Availability Schedule will be overriden by the AirLoopHVAC's one."); | ||
| 118 | 373 | } | |
| 119 |
3/3✓ Branch 1 taken 373 times.
✓ Branch 4 taken 373 times.
✓ Branch 7 taken 373 times.
|
1492 | bool result = setSchedule(OS_Fan_ConstantVolumeFields::AvailabilityScheduleName, "FanConstantVolume", "Availability", schedule); |
| 120 | 373 | return result; | |
| 121 | } | ||
| 122 | |||
| 123 | 99 | double FanConstantVolume_Impl::fanTotalEfficiency() const { | |
| 124 |
2/2✓ Branch 1 taken 99 times.
✓ Branch 4 taken 99 times.
|
99 | return this->getDouble(OS_Fan_ConstantVolumeFields::FanTotalEfficiency, true).get(); |
| 125 | } | ||
| 126 | |||
| 127 | 1 | bool FanConstantVolume_Impl::setFanTotalEfficiency(double val) { | |
| 128 | 1 | return this->setDouble(OS_Fan_ConstantVolumeFields::FanTotalEfficiency, val); | |
| 129 | } | ||
| 130 | |||
| 131 | 99 | double FanConstantVolume_Impl::pressureRise() const { | |
| 132 |
2/2✓ Branch 1 taken 99 times.
✓ Branch 4 taken 99 times.
|
99 | return this->getDouble(OS_Fan_ConstantVolumeFields::PressureRise, true).get(); |
| 133 | } | ||
| 134 | |||
| 135 | 14 | bool FanConstantVolume_Impl::setPressureRise(double val) { | |
| 136 | 14 | return this->setDouble(OS_Fan_ConstantVolumeFields::PressureRise, val); | |
| 137 | } | ||
| 138 | |||
| 139 | 99 | double FanConstantVolume_Impl::motorEfficiency() const { | |
| 140 |
2/2✓ Branch 1 taken 99 times.
✓ Branch 4 taken 99 times.
|
99 | return this->getDouble(OS_Fan_ConstantVolumeFields::MotorEfficiency, true).get(); |
| 141 | } | ||
| 142 | |||
| 143 | 1 | bool FanConstantVolume_Impl::setMotorEfficiency(double val) { | |
| 144 | 1 | return this->setDouble(OS_Fan_ConstantVolumeFields::MotorEfficiency, val); | |
| 145 | } | ||
| 146 | |||
| 147 | 99 | double FanConstantVolume_Impl::motorInAirstreamFraction() const { | |
| 148 |
2/2✓ Branch 1 taken 99 times.
✓ Branch 4 taken 99 times.
|
99 | return this->getDouble(OS_Fan_ConstantVolumeFields::MotorInAirstreamFraction, true).get(); |
| 149 | } | ||
| 150 | |||
| 151 | 1 | bool FanConstantVolume_Impl::setMotorInAirstreamFraction(double val) { | |
| 152 | 1 | return this->setDouble(OS_Fan_ConstantVolumeFields::MotorInAirstreamFraction, val); | |
| 153 | } | ||
| 154 | |||
| 155 | 98 | std::string FanConstantVolume_Impl::endUseSubcategory() const { | |
| 156 |
3/3✓ Branch 1 taken 98 times.
✓ Branch 4 taken 98 times.
✓ Branch 7 taken 98 times.
|
98 | return this->getString(OS_Fan_ConstantVolumeFields::EndUseSubcategory).get(); |
| 157 | } | ||
| 158 | |||
| 159 | 351 | bool FanConstantVolume_Impl::setEndUseSubcategory(const std::string& val) { | |
| 160 | 351 | return this->setString(OS_Fan_ConstantVolumeFields::EndUseSubcategory, val); | |
| 161 | } | ||
| 162 | |||
| 163 | 197 | bool FanConstantVolume_Impl::addToNode(Node& node) { | |
| 164 |
1/1✓ Branch 1 taken 197 times.
|
197 | auto oaSystem = node.airLoopHVACOutdoorAirSystem(); |
| 165 |
1/1✓ Branch 1 taken 197 times.
|
197 | auto airLoop = node.airLoopHVAC(); |
| 166 | |||
| 167 |
19/24✓ Branch 1 taken 194 times.
✓ Branch 2 taken 3 times.
✓ Branch 4 taken 194 times.
✓ Branch 7 taken 194 times.
✓ Branch 10 taken 194 times.
✓ Branch 13 taken 4 times.
✓ Branch 14 taken 190 times.
✓ Branch 15 taken 4 times.
✓ Branch 16 taken 3 times.
✓ Branch 18 taken 4 times.
✓ Branch 21 taken 4 times.
✓ Branch 24 taken 4 times.
✓ Branch 27 taken 4 times.
✗ Branch 28 not taken.
✓ Branch 29 taken 4 times.
✓ Branch 30 taken 193 times.
✓ Branch 32 taken 194 times.
✓ Branch 33 taken 3 times.
✓ Branch 35 taken 194 times.
✓ Branch 36 taken 3 times.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
|
599 | if ((airLoop && airLoop->supplyComponent(node.handle())) || (oaSystem && oaSystem->component(node.handle()))) { |
| 168 |
2/3✓ Branch 1 taken 194 times.
✓ Branch 3 taken 194 times.
✗ Branch 4 not taken.
|
194 | if (StraightComponent_Impl::addToNode(node)) { |
| 169 |
2/2✓ Branch 0 taken 193 times.
✓ Branch 1 taken 1 time.
|
194 | if (airLoop) { |
| 170 |
2/2✓ Branch 1 taken 193 times.
✓ Branch 4 taken 193 times.
|
193 | SetpointManagerMixedAir::updateFanInletOutletNodes(airLoop.get()); |
| 171 | } | ||
| 172 | 194 | return true; | |
| 173 | } | ||
| 174 | } | ||
| 175 | |||
| 176 | 3 | return false; | |
| 177 | 197 | } | |
| 178 | |||
| 179 | 13 | std::vector<openstudio::IdfObject> FanConstantVolume_Impl::remove() { | |
| 180 | 13 | return StraightComponent_Impl::remove(); | |
| 181 | } | ||
| 182 | |||
| 183 | 20 | ModelObject FanConstantVolume_Impl::clone(Model model) const { | |
| 184 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | return StraightComponent_Impl::clone(model); |
| 185 | } | ||
| 186 | |||
| 187 | 63 | boost::optional<Schedule> FanConstantVolume_Impl::optionalAvailabilitySchedule() const { | |
| 188 |
2/2✓ Branch 1 taken 63 times.
✓ Branch 4 taken 63 times.
|
63 | return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_Fan_ConstantVolumeFields::AvailabilityScheduleName); |
| 189 | } | ||
| 190 | |||
| 191 | ✗ | boost::optional<ModelObject> FanConstantVolume_Impl::availabilityScheduleAsModelObject() const { | |
| 192 | ✗ | OptionalModelObject result = availabilitySchedule(); | |
| 193 | ✗ | return result; | |
| 194 | } | ||
| 195 | |||
| 196 | ✗ | bool FanConstantVolume_Impl::setAvailibiltyScheduleAsModelObject(const boost::optional<ModelObject>& modelObject) { | |
| 197 | ✗ | if (modelObject) { | |
| 198 | ✗ | OptionalSchedule intermediate = modelObject->optionalCast<Schedule>(); | |
| 199 | ✗ | if (intermediate) { | |
| 200 | ✗ | Schedule schedule(*intermediate); | |
| 201 | ✗ | return setAvailabilitySchedule(schedule); | |
| 202 | ✗ | } | |
| 203 | ✗ | } | |
| 204 | ✗ | return false; | |
| 205 | } | ||
| 206 | |||
| 207 | 14 | boost::optional<HVACComponent> FanConstantVolume_Impl::containingHVACComponent() const { | |
| 208 | // Process all types that might contain a CoilHeatingWater object. | ||
| 209 | |||
| 210 | // AirLoopHVACUnitarySystem | ||
| 211 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | std::vector<AirLoopHVACUnitarySystem> airLoopHVACUnitarySystems = this->model().getConcreteModelObjects<AirLoopHVACUnitarySystem>(); |
| 212 | |||
| 213 |
2/2✓ Branch 5 taken 1 time.
✓ Branch 6 taken 13 times.
|
14 | for (const auto& airLoopHVACUnitarySystem : airLoopHVACUnitarySystems) { |
| 214 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<HVACComponent> fan = airLoopHVACUnitarySystem.supplyFan()) { |
| 215 |
5/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 12 taken 1 time.
✗ Branch 13 not taken.
|
1 | if (fan->handle() == this->handle()) { |
| 216 |
1/1✓ Branch 1 taken 1 time.
|
1 | return airLoopHVACUnitarySystem; |
| 217 | } | ||
| 218 | 1 | } | |
| 219 | } | ||
| 220 | |||
| 221 | // AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass | ||
| 222 | std::vector<AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass> bypassSystems = | ||
| 223 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | this->model().getConcreteModelObjects<AirLoopHVACUnitaryHeatCoolVAVChangeoverBypass>(); |
| 224 | |||
| 225 |
2/2✓ Branch 5 taken 2 times.
✓ Branch 6 taken 11 times.
|
13 | for (const auto& bypassSystem : bypassSystems) { |
| 226 |
3/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
|
4 | if (boost::optional<HVACComponent> fan = bypassSystem.supplyAirFan()) { |
| 227 |
5/6✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
|
2 | if (fan->handle() == this->handle()) { |
| 228 |
1/1✓ Branch 1 taken 2 times.
|
2 | return bypassSystem; |
| 229 | } | ||
| 230 | 2 | } | |
| 231 | } | ||
| 232 | |||
| 233 | // AirTerminalSingleDuctParallelPIUReheat | ||
| 234 | |||
| 235 | 11 | std::vector<AirTerminalSingleDuctParallelPIUReheat> airTerminalSingleDuctParallelPIUReheatObjects; | |
| 236 | |||
| 237 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | airTerminalSingleDuctParallelPIUReheatObjects = this->model().getConcreteModelObjects<AirTerminalSingleDuctParallelPIUReheat>(); |
| 238 | |||
| 239 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 11 times.
|
11 | for (const auto& airTerminalSingleDuctParallelPIUReheatObject : airTerminalSingleDuctParallelPIUReheatObjects) { |
| 240 | ✗ | if (boost::optional<HVACComponent> fan = airTerminalSingleDuctParallelPIUReheatObject.fan()) { | |
| 241 | ✗ | if (fan->handle() == this->handle()) { | |
| 242 | ✗ | return airTerminalSingleDuctParallelPIUReheatObject; | |
| 243 | } | ||
| 244 | ✗ | } | |
| 245 | } | ||
| 246 | |||
| 247 | // AirTerminalSingleDuctSeriesPIUReheat | ||
| 248 | |||
| 249 | 11 | std::vector<AirTerminalSingleDuctSeriesPIUReheat> airTerminalSingleDuctSeriesPIUReheatObjects; | |
| 250 | |||
| 251 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | airTerminalSingleDuctSeriesPIUReheatObjects = this->model().getConcreteModelObjects<AirTerminalSingleDuctSeriesPIUReheat>(); |
| 252 | |||
| 253 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 11 times.
|
11 | for (const auto& airTerminalSingleDuctSeriesPIUReheatObject : airTerminalSingleDuctSeriesPIUReheatObjects) { |
| 254 | ✗ | if (boost::optional<HVACComponent> fan = airTerminalSingleDuctSeriesPIUReheatObject.fan()) { | |
| 255 | ✗ | if (fan->handle() == this->handle()) { | |
| 256 | ✗ | return airTerminalSingleDuctSeriesPIUReheatObject; | |
| 257 | } | ||
| 258 | ✗ | } | |
| 259 | } | ||
| 260 | |||
| 261 | // AirLoopHVACUnitaryHeatPumpAirToAir | ||
| 262 | |||
| 263 | 11 | std::vector<AirLoopHVACUnitaryHeatPumpAirToAir> airLoopHVACUnitaryHeatPumpAirToAirs; | |
| 264 | |||
| 265 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | airLoopHVACUnitaryHeatPumpAirToAirs = this->model().getConcreteModelObjects<AirLoopHVACUnitaryHeatPumpAirToAir>(); |
| 266 | |||
| 267 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 11 times.
|
11 | for (const auto& airLoopHVACUnitaryHeatPumpAirToAir : airLoopHVACUnitaryHeatPumpAirToAirs) { |
| 268 | ✗ | if (boost::optional<HVACComponent> fan = airLoopHVACUnitaryHeatPumpAirToAir.supplyAirFan()) { | |
| 269 | ✗ | if (fan->handle() == this->handle()) { | |
| 270 | ✗ | return airLoopHVACUnitaryHeatPumpAirToAir; | |
| 271 | } | ||
| 272 | ✗ | } | |
| 273 | } | ||
| 274 | |||
| 275 | 11 | return boost::none; | |
| 276 | 14 | } | |
| 277 | |||
| 278 | 12 | boost::optional<ZoneHVACComponent> FanConstantVolume_Impl::containingZoneHVACComponent() const { | |
| 279 | // ZoneHVACFourPipeFanCoil | ||
| 280 | |||
| 281 | 12 | std::vector<ZoneHVACFourPipeFanCoil> zoneHVACFourPipeFanCoils; | |
| 282 | |||
| 283 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | zoneHVACFourPipeFanCoils = this->model().getConcreteModelObjects<ZoneHVACFourPipeFanCoil>(); |
| 284 | |||
| 285 |
2/2✓ Branch 5 taken 1 time.
✓ Branch 6 taken 11 times.
|
12 | for (const auto& zoneHVACFourPipeFanCoil : zoneHVACFourPipeFanCoils) { |
| 286 |
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<HVACComponent> fan = zoneHVACFourPipeFanCoil.supplyAirFan()) { |
| 287 |
5/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 12 taken 1 time.
✗ Branch 13 not taken.
|
1 | if (fan->handle() == this->handle()) { |
| 288 |
1/1✓ Branch 1 taken 1 time.
|
1 | return zoneHVACFourPipeFanCoil; |
| 289 | } | ||
| 290 | 1 | } | |
| 291 | } | ||
| 292 | |||
| 293 | // ZoneHVACPackagedTerminalAirConditioner | ||
| 294 | |||
| 295 | 11 | std::vector<ZoneHVACPackagedTerminalAirConditioner> zoneHVACPackagedTerminalAirConditioners; | |
| 296 | |||
| 297 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | zoneHVACPackagedTerminalAirConditioners = this->model().getConcreteModelObjects<ZoneHVACPackagedTerminalAirConditioner>(); |
| 298 | |||
| 299 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 11 times.
|
11 | for (const auto& zoneHVACPackagedTerminalAirConditioner : zoneHVACPackagedTerminalAirConditioners) { |
| 300 | ✗ | if (boost::optional<HVACComponent> fan = zoneHVACPackagedTerminalAirConditioner.supplyAirFan()) { | |
| 301 | ✗ | if (fan->handle() == this->handle()) { | |
| 302 | ✗ | return zoneHVACPackagedTerminalAirConditioner; | |
| 303 | } | ||
| 304 | ✗ | } | |
| 305 | } | ||
| 306 | |||
| 307 | // ZoneHVACPackagedTerminalHeatPump | ||
| 308 | |||
| 309 | 11 | std::vector<ZoneHVACPackagedTerminalHeatPump> zoneHVACPackagedTerminalHeatPumps; | |
| 310 | |||
| 311 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | zoneHVACPackagedTerminalHeatPumps = this->model().getConcreteModelObjects<ZoneHVACPackagedTerminalHeatPump>(); |
| 312 | |||
| 313 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 11 times.
|
11 | for (const auto& zoneHVACPackagedTerminalHeatPump : zoneHVACPackagedTerminalHeatPumps) { |
| 314 | ✗ | if (boost::optional<HVACComponent> fan = zoneHVACPackagedTerminalHeatPump.supplyAirFan()) { | |
| 315 | ✗ | if (fan->handle() == this->handle()) { | |
| 316 | ✗ | return zoneHVACPackagedTerminalHeatPump; | |
| 317 | } | ||
| 318 | ✗ | } | |
| 319 | } | ||
| 320 | |||
| 321 | // ZoneHVACUnitHeater | ||
| 322 | |||
| 323 | 11 | std::vector<ZoneHVACUnitHeater> zoneHVACUnitHeater; | |
| 324 | |||
| 325 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | zoneHVACUnitHeater = this->model().getConcreteModelObjects<ZoneHVACUnitHeater>(); |
| 326 | |||
| 327 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 11 times.
|
11 | for (const auto& elem : zoneHVACUnitHeater) { |
| 328 | ✗ | if (boost::optional<HVACComponent> fan = elem.supplyAirFan()) { | |
| 329 | ✗ | if (fan->handle() == this->handle()) { | |
| 330 | ✗ | return elem; | |
| 331 | } | ||
| 332 | ✗ | } | |
| 333 | } | ||
| 334 | |||
| 335 | // ZoneHVACUnitVentilator | ||
| 336 | |||
| 337 | 11 | std::vector<ZoneHVACUnitVentilator> zoneHVACUnitVentilator; | |
| 338 | |||
| 339 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | zoneHVACUnitVentilator = this->model().getConcreteModelObjects<ZoneHVACUnitVentilator>(); |
| 340 | |||
| 341 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 11 times.
|
11 | for (const auto& elem : zoneHVACUnitVentilator) { |
| 342 | ✗ | if (boost::optional<HVACComponent> fan = elem.supplyAirFan()) { | |
| 343 | ✗ | if (fan->handle() == this->handle()) { | |
| 344 | ✗ | return elem; | |
| 345 | } | ||
| 346 | ✗ | } | |
| 347 | } | ||
| 348 | |||
| 349 | // ZoneHVACEvaporativeCoolerUnit | ||
| 350 | 11 | std::vector<ZoneHVACEvaporativeCoolerUnit> zoneHVACEvaporativeCoolerUnit; | |
| 351 | |||
| 352 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | zoneHVACEvaporativeCoolerUnit = this->model().getConcreteModelObjects<ZoneHVACEvaporativeCoolerUnit>(); |
| 353 | |||
| 354 |
1/2✗ Branch 5 not taken.
✓ Branch 6 taken 11 times.
|
11 | for (const auto& elem : zoneHVACEvaporativeCoolerUnit) { |
| 355 | ✗ | if (boost::optional<HVACComponent> fan = elem.supplyAirFan()) { | |
| 356 | ✗ | if (fan->handle() == this->handle()) { | |
| 357 | ✗ | return elem; | |
| 358 | } | ||
| 359 | ✗ | } | |
| 360 | } | ||
| 361 | |||
| 362 | 11 | return boost::none; | |
| 363 | 12 | } | |
| 364 | |||
| 365 | 99 | boost::optional<double> FanConstantVolume_Impl::maximumFlowRate() const { | |
| 366 | 99 | return getDouble(OS_Fan_ConstantVolumeFields::MaximumFlowRate, true); | |
| 367 | } | ||
| 368 | |||
| 369 | 2 | bool FanConstantVolume_Impl::isMaximumFlowRateAutosized() const { | |
| 370 | 2 | bool result = false; | |
| 371 |
1/1✓ Branch 1 taken 2 times.
|
2 | boost::optional<std::string> value = getString(OS_Fan_ConstantVolumeFields::MaximumFlowRate, true); |
| 372 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (value) { |
| 373 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
4 | result = openstudio::istringEqual(value.get(), "autosize"); |
| 374 | } | ||
| 375 | 2 | return result; | |
| 376 | 2 | } | |
| 377 | |||
| 378 | 1 | bool FanConstantVolume_Impl::setMaximumFlowRate(boost::optional<double> maximumFlowRate) { | |
| 379 | 1 | bool result(false); | |
| 380 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (maximumFlowRate) { |
| 381 | 1 | result = setDouble(OS_Fan_ConstantVolumeFields::MaximumFlowRate, maximumFlowRate.get()); | |
| 382 | } else { | ||
| 383 | ✗ | resetMaximumFlowRate(); | |
| 384 | ✗ | result = true; | |
| 385 | } | ||
| 386 | 1 | return result; | |
| 387 | } | ||
| 388 | |||
| 389 | ✗ | void FanConstantVolume_Impl::resetMaximumFlowRate() { | |
| 390 | ✗ | bool result = setString(OS_Fan_ConstantVolumeFields::MaximumFlowRate, ""); | |
| 391 | ✗ | OS_ASSERT(result); | |
| 392 | ✗ | } | |
| 393 | |||
| 394 | ✗ | void FanConstantVolume_Impl::autosizeMaximumFlowRate() { | |
| 395 | ✗ | bool result = setString(OS_Fan_ConstantVolumeFields::MaximumFlowRate, "autosize"); | |
| 396 | ✗ | OS_ASSERT(result); | |
| 397 | ✗ | } | |
| 398 | |||
| 399 | 1 | AirflowNetworkFan FanConstantVolume_Impl::getAirflowNetworkFan() { | |
| 400 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto opt = airflowNetworkFan(); |
| 401 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (opt) { |
| 402 | ✗ | return opt.get(); | |
| 403 | } | ||
| 404 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | return AirflowNetworkFan(model(), handle()); |
| 405 | 1 | } | |
| 406 | |||
| 407 | 1 | boost::optional<AirflowNetworkFan> FanConstantVolume_Impl::airflowNetworkFan() const { | |
| 408 | std::vector<AirflowNetworkFan> myAFNitems = | ||
| 409 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | getObject<ModelObject>().getModelObjectSources<AirflowNetworkFan>(AirflowNetworkFan::iddObjectType()); |
| 410 | 1 | auto count = myAFNitems.size(); | |
| 411 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (count == 1) { |
| 412 | ✗ | return myAFNitems[0]; | |
| 413 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | } else if (count > 1) { |
| 414 | ✗ | LOG(Warn, briefDescription() << " has more than one AirflowNetwork EquivalentDuct attached, returning first."); | |
| 415 | ✗ | return myAFNitems[0]; | |
| 416 | } | ||
| 417 | 1 | return boost::none; | |
| 418 | 1 | } | |
| 419 | |||
| 420 | ✗ | boost::optional<double> FanConstantVolume_Impl::autosizedMaximumFlowRate() const { | |
| 421 | ✗ | return getAutosizedValue("Design Size Maximum Flow Rate", "m3/s"); | |
| 422 | } | ||
| 423 | |||
| 424 | ✗ | void FanConstantVolume_Impl::autosize() { | |
| 425 | ✗ | autosizeMaximumFlowRate(); | |
| 426 | ✗ | } | |
| 427 | |||
| 428 | ✗ | void FanConstantVolume_Impl::applySizingValues() { | |
| 429 | ✗ | boost::optional<double> val; | |
| 430 | ✗ | val = autosizedMaximumFlowRate(); | |
| 431 | ✗ | if (val) { | |
| 432 | ✗ | setMaximumFlowRate(val.get()); | |
| 433 | } | ||
| 434 | ✗ | } | |
| 435 | |||
| 436 | ✗ | std::vector<EMSActuatorNames> FanConstantVolume_Impl::emsActuatorNames() const { | |
| 437 | std::vector<EMSActuatorNames> actuators{ | ||
| 438 | ✗ | {"Fan", "Fan Air Mass Flow Rate"}, {"Fan", "Fan Pressure Rise"}, {"Fan", "Fan Total Efficiency"}, {"Fan", "Fan Autosized Air Flow Rate"}}; | |
| 439 | ✗ | return actuators; | |
| 440 | ✗ | } | |
| 441 | |||
| 442 | ✗ | std::vector<std::string> FanConstantVolume_Impl::emsInternalVariableNames() const { | |
| 443 | ✗ | std::vector<std::string> types{"Fan Maximum Mass Flow Rate", "Fan Nominal Pressure Rise", "Fan Nominal Total Efficiency"}; | |
| 444 | ✗ | return types; | |
| 445 | ✗ | } | |
| 446 | |||
| 447 | ✗ | ComponentType FanConstantVolume_Impl::componentType() const { | |
| 448 | ✗ | return ComponentType::None; | |
| 449 | } | ||
| 450 | |||
| 451 | ✗ | std::vector<FuelType> FanConstantVolume_Impl::coolingFuelTypes() const { | |
| 452 | ✗ | return {}; | |
| 453 | } | ||
| 454 | |||
| 455 | ✗ | std::vector<FuelType> FanConstantVolume_Impl::heatingFuelTypes() const { | |
| 456 | ✗ | return {}; | |
| 457 | } | ||
| 458 | |||
| 459 | ✗ | std::vector<AppGFuelType> FanConstantVolume_Impl::appGHeatingFuelTypes() const { | |
| 460 | ✗ | return {}; | |
| 461 | } | ||
| 462 | |||
| 463 | } // namespace detail | ||
| 464 | |||
| 465 | // create a new FanConstantVolume object in the model's workspace | ||
| 466 | 263 | FanConstantVolume::FanConstantVolume(const Model& model, Schedule& s) : StraightComponent(FanConstantVolume::iddObjectType(), model) { | |
| 467 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 263 times.
✗ Branch 5 not taken.
|
263 | OS_ASSERT(getImpl<detail::FanConstantVolume_Impl>()); |
| 468 |
2/2✓ Branch 1 taken 263 times.
✓ Branch 4 taken 263 times.
|
526 | setString(openstudio::OS_Fan_ConstantVolumeFields::MaximumFlowRate, "AutoSize"); |
| 469 |
1/1✓ Branch 1 taken 263 times.
|
263 | setAvailabilitySchedule(s); |
| 470 |
2/2✓ Branch 1 taken 263 times.
✓ Branch 4 taken 263 times.
|
263 | setEndUseSubcategory(""); |
| 471 | 263 | } | |
| 472 | |||
| 473 | 87 | FanConstantVolume::FanConstantVolume(const Model& model) : StraightComponent(FanConstantVolume::iddObjectType(), model) { | |
| 474 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 87 times.
✗ Branch 5 not taken.
|
87 | OS_ASSERT(getImpl<detail::FanConstantVolume_Impl>()); |
| 475 |
2/2✓ Branch 1 taken 87 times.
✓ Branch 4 taken 87 times.
|
174 | setString(openstudio::OS_Fan_ConstantVolumeFields::MaximumFlowRate, "AutoSize"); |
| 476 |
1/1✓ Branch 1 taken 87 times.
|
87 | auto s = model.alwaysOnDiscreteSchedule(); |
| 477 |
1/1✓ Branch 1 taken 87 times.
|
87 | setAvailabilitySchedule(s); |
| 478 |
2/2✓ Branch 1 taken 87 times.
✓ Branch 4 taken 87 times.
|
87 | setEndUseSubcategory(""); |
| 479 | 87 | } | |
| 480 | |||
| 481 |
1/1✓ Branch 3 taken 1054 times.
|
1054 | FanConstantVolume::FanConstantVolume(std::shared_ptr<detail::FanConstantVolume_Impl> p) : StraightComponent(std::move(p)) {} |
| 482 | |||
| 483 | 63 | Schedule FanConstantVolume::availabilitySchedule() const { | |
| 484 |
1/1✓ Branch 3 taken 63 times.
|
63 | return getImpl<detail::FanConstantVolume_Impl>()->availabilitySchedule(); |
| 485 | } | ||
| 486 | 373 | bool FanConstantVolume::setAvailabilitySchedule(Schedule& s) { | |
| 487 |
1/1✓ Branch 3 taken 373 times.
|
373 | return getImpl<detail::FanConstantVolume_Impl>()->setAvailabilitySchedule(s); |
| 488 | } | ||
| 489 | |||
| 490 | ✗ | double FanConstantVolume::fanTotalEfficiency() const { | |
| 491 | ✗ | return getImpl<detail::FanConstantVolume_Impl>()->fanTotalEfficiency(); | |
| 492 | } | ||
| 493 | |||
| 494 | ✗ | bool FanConstantVolume::setFanTotalEfficiency(double val) { | |
| 495 | ✗ | return getImpl<detail::FanConstantVolume_Impl>()->setFanTotalEfficiency(val); | |
| 496 | } | ||
| 497 | |||
| 498 | 99 | double FanConstantVolume::fanEfficiency() const { | |
| 499 |
1/1✓ Branch 3 taken 99 times.
|
99 | return getImpl<detail::FanConstantVolume_Impl>()->fanTotalEfficiency(); |
| 500 | } | ||
| 501 | |||
| 502 | 1 | bool FanConstantVolume::setFanEfficiency(double val) { | |
| 503 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::FanConstantVolume_Impl>()->setFanTotalEfficiency(val); |
| 504 | } | ||
| 505 | |||
| 506 | 99 | double FanConstantVolume::pressureRise() const { | |
| 507 |
1/1✓ Branch 3 taken 99 times.
|
99 | return getImpl<detail::FanConstantVolume_Impl>()->pressureRise(); |
| 508 | } | ||
| 509 | |||
| 510 | 14 | bool FanConstantVolume::setPressureRise(double val) { | |
| 511 |
1/1✓ Branch 3 taken 14 times.
|
14 | return getImpl<detail::FanConstantVolume_Impl>()->setPressureRise(val); |
| 512 | } | ||
| 513 | |||
| 514 | 99 | double FanConstantVolume::motorEfficiency() const { | |
| 515 |
1/1✓ Branch 3 taken 99 times.
|
99 | return getImpl<detail::FanConstantVolume_Impl>()->motorEfficiency(); |
| 516 | } | ||
| 517 | |||
| 518 | 1 | bool FanConstantVolume::setMotorEfficiency(double val) { | |
| 519 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::FanConstantVolume_Impl>()->setMotorEfficiency(val); |
| 520 | } | ||
| 521 | |||
| 522 | 99 | double FanConstantVolume::motorInAirstreamFraction() const { | |
| 523 |
1/1✓ Branch 3 taken 99 times.
|
99 | return getImpl<detail::FanConstantVolume_Impl>()->motorInAirstreamFraction(); |
| 524 | } | ||
| 525 | |||
| 526 | 1 | bool FanConstantVolume::setMotorInAirstreamFraction(double val) { | |
| 527 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::FanConstantVolume_Impl>()->setMotorInAirstreamFraction(val); |
| 528 | } | ||
| 529 | |||
| 530 | 98 | std::string FanConstantVolume::endUseSubcategory() const { | |
| 531 |
1/1✓ Branch 3 taken 98 times.
|
98 | return getImpl<detail::FanConstantVolume_Impl>()->endUseSubcategory(); |
| 532 | } | ||
| 533 | |||
| 534 | 351 | bool FanConstantVolume::setEndUseSubcategory(const std::string& val) { | |
| 535 |
1/1✓ Branch 3 taken 351 times.
|
351 | return getImpl<detail::FanConstantVolume_Impl>()->setEndUseSubcategory(val); |
| 536 | } | ||
| 537 | |||
| 538 | 10046 | IddObjectType FanConstantVolume::iddObjectType() { | |
| 539 |
1/1✓ Branch 1 taken 10046 times.
|
10046 | IddObjectType result(IddObjectType::OS_Fan_ConstantVolume); |
| 540 | 10046 | return result; | |
| 541 | } | ||
| 542 | |||
| 543 | 99 | boost::optional<double> FanConstantVolume::maximumFlowRate() const { | |
| 544 |
1/1✓ Branch 3 taken 99 times.
|
99 | return getImpl<detail::FanConstantVolume_Impl>()->maximumFlowRate(); |
| 545 | } | ||
| 546 | |||
| 547 | 2 | bool FanConstantVolume::isMaximumFlowRateAutosized() const { | |
| 548 |
1/1✓ Branch 3 taken 2 times.
|
2 | return getImpl<detail::FanConstantVolume_Impl>()->isMaximumFlowRateAutosized(); |
| 549 | } | ||
| 550 | |||
| 551 | 1 | bool FanConstantVolume::setMaximumFlowRate(double maximumFlowRate) { | |
| 552 |
2/2✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
|
1 | return getImpl<detail::FanConstantVolume_Impl>()->setMaximumFlowRate(maximumFlowRate); |
| 553 | } | ||
| 554 | |||
| 555 | ✗ | void FanConstantVolume::resetMaximumFlowRate() { | |
| 556 | ✗ | getImpl<detail::FanConstantVolume_Impl>()->resetMaximumFlowRate(); | |
| 557 | ✗ | } | |
| 558 | |||
| 559 | ✗ | void FanConstantVolume::autosizeMaximumFlowRate() { | |
| 560 | ✗ | getImpl<detail::FanConstantVolume_Impl>()->autosizeMaximumFlowRate(); | |
| 561 | ✗ | } | |
| 562 | |||
| 563 | 1 | AirflowNetworkFan FanConstantVolume::getAirflowNetworkFan() { | |
| 564 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::FanConstantVolume_Impl>()->getAirflowNetworkFan(); |
| 565 | } | ||
| 566 | |||
| 567 | ✗ | boost::optional<AirflowNetworkFan> FanConstantVolume::airflowNetworkFan() const { | |
| 568 | ✗ | return getImpl<detail::FanConstantVolume_Impl>()->airflowNetworkFan(); | |
| 569 | } | ||
| 570 | |||
| 571 | ✗ | boost::optional<double> FanConstantVolume::autosizedMaximumFlowRate() const { | |
| 572 | ✗ | return getImpl<detail::FanConstantVolume_Impl>()->autosizedMaximumFlowRate(); | |
| 573 | } | ||
| 574 | } // namespace model | ||
| 575 | } // namespace openstudio | ||
| 576 |