src/model/AirLoopHVAC.hpp
| 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 | #ifndef MODEL_AIRLOOPHVAC_HPP | ||
| 7 | #define MODEL_AIRLOOPHVAC_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "Loop.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | |||
| 14 | namespace model { | ||
| 15 | |||
| 16 | namespace detail { | ||
| 17 | class AirLoopHVAC_Impl; | ||
| 18 | }; | ||
| 19 | |||
| 20 | class Node; | ||
| 21 | class AirLoopHVACOutdoorAirSystem; | ||
| 22 | class AirLoopHVACDedicatedOutdoorAirSystem; | ||
| 23 | class AirLoopHVACZoneSplitter; | ||
| 24 | class AirLoopHVACZoneMixer; | ||
| 25 | class AirLoopHVACSupplyPlenum; | ||
| 26 | class AirLoopHVACReturnPlenum; | ||
| 27 | class StraightComponent; | ||
| 28 | class ThermalZone; | ||
| 29 | class SizingSystem; | ||
| 30 | class AvailabilityManager; | ||
| 31 | |||
| 32 | /** AirLoopHVAC is an interface to the EnergyPlus IDD object named "AirLoopHVAC" | ||
| 33 | * | ||
| 34 | * The purpose of this class is to simplify the construction and manipulation | ||
| 35 | * air loops in energyplus. Presently, only single zone air loops with one | ||
| 36 | * supply branch are supported, however more complicated air loop topologies | ||
| 37 | * are planned, including all of those supported by EnergyPlus. | ||
| 38 | */ | ||
| 39 | class MODEL_API AirLoopHVAC : public Loop | ||
| 40 | { | ||
| 41 | public: | ||
| 42 | /** Constructs a new AirLoopHVAC object and places it inside the | ||
| 43 | * model. The air loop is fully initialized with the companion objects | ||
| 44 | * that are needed for a basic air loop in EnergyPlus. These objects include: | ||
| 45 | * supply inlet node, supply outlet node, demand inlet node, demand outlet node, | ||
| 46 | * zone splitter, zone mixer, and zone hvac equipment connections. | ||
| 47 | * | ||
| 48 | * If dualDuct is true, then there will be a supply spiltter and two supply outlet nodes | ||
| 49 | * connected into the system topology. | ||
| 50 | * | ||
| 51 | * The two paths / ducts / decks of a dual duct style system are identified by indexes | ||
| 52 | * 0 and 1. If dual duct, key methods including supplyOutletNodes(), demandInletNodes(), and zoneSplitters(), | ||
| 53 | * will return a vector with exactly two items. Item 0 in the supplyOutletNodes vector matches to item | ||
| 54 | * 0 in the demandInletNodes vector, and the zoneSplitters vector. In this way the interface avoids | ||
| 55 | * declaring the paths as heating, cooling, ventilation, etc. It is the client's responsibilty to choose | ||
| 56 | * what types of equipment to apply to the two branches. Note that these indexes carry through to the terminals. | ||
| 57 | * Dual duct terminals are Mixer objects which have the method inletModelObjects(branchIndex). The branchIndex 0 | ||
| 58 | * will be connected to demandInletNodes()[0] path. | ||
| 59 | */ | ||
| 60 | explicit AirLoopHVAC(Model& model, bool dualDuct = false); | ||
| 61 | |||
| 62 | 27673 | virtual ~AirLoopHVAC() override = default; | |
| 63 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 64 | 10499 | AirLoopHVAC(const AirLoopHVAC& other) = default; | |
| 65 | 7027 | AirLoopHVAC(AirLoopHVAC&& other) = default; | |
| 66 | ✗ | AirLoopHVAC& operator=(const AirLoopHVAC&) = default; | |
| 67 | 22 | AirLoopHVAC& operator=(AirLoopHVAC&&) = default; | |
| 68 | |||
| 69 | boost::optional<double> designSupplyAirFlowRate() const; | ||
| 70 | |||
| 71 | bool isDesignSupplyAirFlowRateAutosized() const; | ||
| 72 | |||
| 73 | bool setDesignSupplyAirFlowRate(double designSupplyAirFlowRate); | ||
| 74 | |||
| 75 | void resetDesignSupplyAirFlowRate(); | ||
| 76 | |||
| 77 | void autosizeDesignSupplyAirFlowRate(); | ||
| 78 | |||
| 79 | double designReturnAirFlowFractionofSupplyAirFlow() const; | ||
| 80 | |||
| 81 | bool setDesignReturnAirFlowFractionofSupplyAirFlow(double designReturnAirFlowFractionofSupplyAirFlow); | ||
| 82 | |||
| 83 | /** Returns the supply inlet node. */ | ||
| 84 | Node supplyInletNode() const override; | ||
| 85 | |||
| 86 | /** Returns the supply outlet nodes. | ||
| 87 | * Single duct systems have one supply outlet node. | ||
| 88 | * Dual duct systems have two supply outlet nodes. | ||
| 89 | */ | ||
| 90 | std::vector<Node> supplyOutletNodes() const override; | ||
| 91 | |||
| 92 | /** Returns the first supply outlet Node. */ | ||
| 93 | Node supplyOutletNode() const override; | ||
| 94 | |||
| 95 | /** Returns the demand inlet nodes. | ||
| 96 | * Single duct systems have one demand inlet node. | ||
| 97 | * Dual duct systems have two demand inlet nodes. | ||
| 98 | */ | ||
| 99 | std::vector<Node> demandInletNodes() const override; | ||
| 100 | |||
| 101 | /** Returns the first demand inlet Node. */ | ||
| 102 | Node demandInletNode() const override; | ||
| 103 | |||
| 104 | /** Returns the demand outlet node */ | ||
| 105 | Node demandOutletNode() const override; | ||
| 106 | |||
| 107 | /** Returns the outdoor air node. This is the outermost node from which | ||
| 108 | * outdoor air is introduced into the air loop. This node only exists if there | ||
| 109 | * is an outdoor air system within the air loop. A freshly constructed | ||
| 110 | * AirLoopHVAC object will not have an outdoor air system. | ||
| 111 | */ | ||
| 112 | boost::optional<Node> outdoorAirNode() const; | ||
| 113 | |||
| 114 | /** Returns the relief air node. This is the outermost node from which | ||
| 115 | * air is relieved from the air loop to the outdoor air. This node only exists | ||
| 116 | * if there is an outdoor air system within the air loop. A freshly | ||
| 117 | * constructed AirLoopHVAC object will not have an outdoor air system. | ||
| 118 | */ | ||
| 119 | boost::optional<Node> reliefAirNode() const; | ||
| 120 | |||
| 121 | /** Returns the mixed air node. This is the mixed air node of the outdoor | ||
| 122 | * air mixer of the air loop. This node only exists if there is an outdoor air | ||
| 123 | * system within the air loop. A freshly constructed AirLoopHVAC object | ||
| 124 | * will not have an outdoor air system. | ||
| 125 | */ | ||
| 126 | boost::optional<Node> mixedAirNode() const; | ||
| 127 | |||
| 128 | /** Returns the return air node. This is the return air node of the outdoor | ||
| 129 | * air mixer of the air loop. This node only exists if there is an outdoor air | ||
| 130 | * system within the air loop. A freshly constructed AirLoopHVAC object | ||
| 131 | * will not have an outdoor air system. In many cases this node will be the | ||
| 132 | * same as the supply inlet node, because there is often no hvac equipment | ||
| 133 | * before the outdoor air mixer. | ||
| 134 | */ | ||
| 135 | boost::optional<Node> returnAirNode() const; | ||
| 136 | |||
| 137 | /** Returns true if the system is "dual duct" | ||
| 138 | * ie. there is a supply splitter | ||
| 139 | */ | ||
| 140 | bool isDualDuct() const; | ||
| 141 | |||
| 142 | /** Returns the supply side splitter. | ||
| 143 | * If the system is a dual duct then it will have a supply side splitter. | ||
| 144 | */ | ||
| 145 | boost::optional<Splitter> supplySplitter() const; | ||
| 146 | |||
| 147 | /** If this is a dual duct system, remove the supply side splitter. | ||
| 148 | * If this is not a dual duct system, there is no supply side splitter and the method will return false. | ||
| 149 | * | ||
| 150 | * The system will become a single duct. Dual duct terminals may remain on the demand side, and those must be | ||
| 151 | * resolved separately by removing the zones served by dual ducts or changing to single duct terminals. | ||
| 152 | * | ||
| 153 | * The components downstream of the splitter will also be removed. | ||
| 154 | */ | ||
| 155 | bool removeSupplySplitter(); | ||
| 156 | |||
| 157 | /** If this is a dual duct system, remove the supply side splitter. | ||
| 158 | * If this is not a dual duct system, there is no supply side splitter and the method will return false. | ||
| 159 | * | ||
| 160 | * The system will become a single duct. Dual duct terminals may remain on the demand side, and those must be | ||
| 161 | * resolved separately by removing the zones served by dual ducts or changing to single duct terminals. | ||
| 162 | * | ||
| 163 | * The dual duct branch containing hvacComponent will be removed. | ||
| 164 | * The remaining branch will be integrated into the loop. | ||
| 165 | * If hvacComponent is not found on either dual duct branch | ||
| 166 | * the method will return false. This will be the case if hvacComponent is not found on the system's supplyComponents(), | ||
| 167 | * or upstream of the splitter. | ||
| 168 | */ | ||
| 169 | bool removeSupplySplitter(HVACComponent& hvacComponent); | ||
| 170 | |||
| 171 | /** Returns the supply side splitter inlet node. If the system is a dual duct | ||
| 172 | * or has a return air bypass then it will have a supply side splitter. | ||
| 173 | */ | ||
| 174 | boost::optional<Node> supplySplitterInletNode() const; | ||
| 175 | |||
| 176 | /** Returns the supply side splitter outlet nodes. If the system is a dual duct | ||
| 177 | * or has a return air bypass then it will have a supply side splitter. | ||
| 178 | */ | ||
| 179 | std::vector<Node> supplySplitterOutletNodes() const; | ||
| 180 | |||
| 181 | /** Returns the first zone splitter. | ||
| 182 | */ | ||
| 183 | AirLoopHVACZoneSplitter zoneSplitter() const; | ||
| 184 | |||
| 185 | /** Returns the zone splitters. | ||
| 186 | * Single duct systems have one zone splitter, dual duct systems have two. | ||
| 187 | */ | ||
| 188 | std::vector<AirLoopHVACZoneSplitter> zoneSplitters() const; | ||
| 189 | |||
| 190 | /** Returns the zone mixer, if it doesn't exist then it makes one. */ | ||
| 191 | AirLoopHVACZoneMixer zoneMixer() const; | ||
| 192 | |||
| 193 | /** Returns all of the components on the outdoor air system including the mixer itself. | ||
| 194 | * If type is given then the results will be limited to the given IddObjectType. | ||
| 195 | */ | ||
| 196 | std::vector<ModelObject> oaComponents(openstudio::IddObjectType type = openstudio::IddObjectType("Catchall")) const; | ||
| 197 | |||
| 198 | /** Returns the AirLoopHVACOutdoorAirSystem object associated with the air loop. | ||
| 199 | * A freshly constructed AirLoopHVAC object will not have an outdoor air system | ||
| 200 | * and this method will return a false optional. | ||
| 201 | */ | ||
| 202 | boost::optional<AirLoopHVACOutdoorAirSystem> airLoopHVACOutdoorAirSystem() const; | ||
| 203 | |||
| 204 | /** Returns the AirLoopHVACDedicatedOutdoorAirSystem object associated with the air loop. | ||
| 205 | * A freshly constructed AirLoopHVAC object will not have a dedicated outdoor air system | ||
| 206 | * and this method will return a false optional. | ||
| 207 | */ | ||
| 208 | boost::optional<AirLoopHVACDedicatedOutdoorAirSystem> airLoopHVACDedicatedOutdoorAirSystem() const; | ||
| 209 | |||
| 210 | /** Returns the fan in the mixed air stream (after outdoor air system) of the air system. | ||
| 211 | * If there is no outdoor air system or there are multiple fans in the mixed air stream, | ||
| 212 | * then the fan closest to the supply outlet node will be returned. | ||
| 213 | */ | ||
| 214 | boost::optional<HVACComponent> supplyFan() const; | ||
| 215 | |||
| 216 | /** Returns the fan in the return air stream (before the outdoor air system. | ||
| 217 | * If there is no outdoor air system then this method will return false. | ||
| 218 | * If there are multiple fans, then return the fan nearest the oa system. | ||
| 219 | */ | ||
| 220 | boost::optional<HVACComponent> returnFan() const; | ||
| 221 | |||
| 222 | /** Returns the most outboard fan on the relief air stream of the outdoor air system */ | ||
| 223 | boost::optional<HVACComponent> reliefFan() const; | ||
| 224 | |||
| 225 | /** Adds a new branch on the demand side of the air loop for a zone labeled zoneLabel | ||
| 226 | * and returns true if the operation was successful. The method will return false if the Zone | ||
| 227 | * is already connected to an air loop. | ||
| 228 | * New code should favor addBranchForZone(ThermalZone &) or addBranchForZone(ThermalZone &, HVACComponent&). | ||
| 229 | */ | ||
| 230 | bool addBranchForZone(openstudio::model::ThermalZone& thermalZone, boost::optional<StraightComponent> optAirTerminal); | ||
| 231 | |||
| 232 | /** Overloaded version of addBranchForZone() **/ | ||
| 233 | bool addBranchForZone(openstudio::model::ThermalZone& thermalZone); | ||
| 234 | |||
| 235 | /** Overloaded version of addBranchForZone() **/ | ||
| 236 | bool addBranchForZone(ThermalZone& thermalZone, HVACComponent& airTerminal); | ||
| 237 | |||
| 238 | /** This method has the same function as addBranchForZone, except it will not | ||
| 239 | * disconnect any air loops that are already attached to the zone. | ||
| 240 | **/ | ||
| 241 | bool multiAddBranchForZone(ThermalZone& thermalZone); | ||
| 242 | |||
| 243 | /** Overloaded version of addBranchForZone() **/ | ||
| 244 | bool multiAddBranchForZone(ThermalZone& thermalZone, HVACComponent& airTerminal); | ||
| 245 | |||
| 246 | /** Adds a new branch on the demand side of the air loop with the specified airTerminal. | ||
| 247 | * Returns true if the airTerminal was accepted, otherwise false. The argument, hvacComponent, | ||
| 248 | * can be an air terminal, AirLoopHVACSupplyPlenum, or airLoopHVACReturnPlenum. | ||
| 249 | **/ | ||
| 250 | bool addBranchForHVACComponent(HVACComponent& hvacComponent); | ||
| 251 | |||
| 252 | /** Removes the Zone identified by zoneLabel from the air loop and returns true | ||
| 253 | * upon successful removal. | ||
| 254 | **/ | ||
| 255 | bool removeBranchForZone(openstudio::model::ThermalZone& thermalZone); | ||
| 256 | |||
| 257 | /** Returns the Sizing:System object associated with this air loop. **/ | ||
| 258 | SizingSystem sizingSystem() const; | ||
| 259 | |||
| 260 | /** Returns the ThermalZone objects attached to this air loop. **/ | ||
| 261 | std::vector<ThermalZone> thermalZones() const; | ||
| 262 | |||
| 263 | /** Returns the availability schedule when this system is allowed to run. **/ | ||
| 264 | Schedule availabilitySchedule() const; | ||
| 265 | |||
| 266 | /** Set the availability schedule for when this system is allowed to run. **/ | ||
| 267 | bool setAvailabilitySchedule(Schedule& schedule); | ||
| 268 | |||
| 269 | /** Configure the system to night cycle | ||
| 270 | * This is a convenience for creating and attaching a new AvailabilityManagerNightCycle. | ||
| 271 | * Valid options are StayOff, CycleOnAny, and CycleOnAnyZoneFansOnly **/ | ||
| 272 | bool setNightCycleControlType(const std::string& controlType); | ||
| 273 | |||
| 274 | /** Returns a string indicating if the system is configured to night cycle | ||
| 275 | * If there is no AvailabilityManagerNightCycle this method will return StayOff **/ | ||
| 276 | std::string nightCycleControlType() const; | ||
| 277 | |||
| 278 | // returnAirBypassFlowTemperatureSetpointSchedule is not possible currently in OS, uncomment in future | ||
| 279 | |||
| 280 | /** Returns the temperature setpoint schedule when this system tries to determine the required mass | ||
| 281 | * flow rate through a return air bypass duct. If there is a temperature setpoint schedule, | ||
| 282 | * the forward translator will create a SetpointManager:ReturnAirBypassFlow object. **/ | ||
| 283 | // boost::optional<Schedule> returnAirBypassFlowTemperatureSetpointSchedule() const; | ||
| 284 | |||
| 285 | /** Set the temperature setpoint schedule for when this system tries to determine the required mass | ||
| 286 | * flow rate through a return air bypass duct. **/ | ||
| 287 | // bool setReturnAirBypassFlowTemperatureSetpointSchedule(Schedule & temperatureSetpointSchedule); | ||
| 288 | |||
| 289 | /** Reset the temperature setpoint schedule for when this system tries to determine the required mass | ||
| 290 | * flow rate through a return air bypass duct. **/ | ||
| 291 | // void resetReturnAirBypassFlowTemperatureSetpointSchedule(); | ||
| 292 | |||
| 293 | /* | ||
| 294 | * Return all AvailabilityManagers assigned to this list, in the priority order | ||
| 295 | * AvailabilityManagers are used to override the system availabilitySchedule() with one of OpenStudio's | ||
| 296 | * supported AvailabilityManager types. | ||
| 297 | */ | ||
| 298 | std::vector<AvailabilityManager> availabilityManagers() const; | ||
| 299 | |||
| 300 | /* | ||
| 301 | * Add a new AvailabilityManager at the end of the list (priority = last). | ||
| 302 | */ | ||
| 303 | bool addAvailabilityManager(const AvailabilityManager& availabilityManager); | ||
| 304 | |||
| 305 | /* | ||
| 306 | * Add a new AvailabilityManager to the list which a given priority (1 to x). | ||
| 307 | * Internally calls addAvailabilityManager then setPriority, see remarks there | ||
| 308 | */ | ||
| 309 | bool addAvailabilityManager(const AvailabilityManager& availabilityManager, unsigned priority); | ||
| 310 | |||
| 311 | /* | ||
| 312 | * Set all availabilityManagers using a list of AvailabilityManagers | ||
| 313 | */ | ||
| 314 | bool setAvailabilityManagers(const std::vector<AvailabilityManager>& avms); | ||
| 315 | |||
| 316 | /* | ||
| 317 | * Removes all AvailabilityManagers assigned (TODO: should that affect the availabilitySchedule?) | ||
| 318 | */ | ||
| 319 | void resetAvailabilityManagers(); | ||
| 320 | |||
| 321 | /* | ||
| 322 | * Remove the given AvailabilityManager from this AvailabilityManagerAssignmentList | ||
| 323 | */ | ||
| 324 | bool removeAvailabilityManager(const AvailabilityManager& avm); | ||
| 325 | |||
| 326 | /* | ||
| 327 | * Remove the availabilityManager at the given priority | ||
| 328 | * Returns false if the priority isn't between 1 and the number of AVMs | ||
| 329 | */ | ||
| 330 | bool removeAvailabilityManager(unsigned priority); | ||
| 331 | |||
| 332 | /* | ||
| 333 | * You can shuffle the priority of a given AvailabilityManager after having added it | ||
| 334 | * If priority is below 1, it's reset to 1. | ||
| 335 | * If priority is greater than the number of availability managers, will reset to last | ||
| 336 | */ | ||
| 337 | bool setAvailabilityManagerPriority(const AvailabilityManager& availabilityManager, unsigned priority); | ||
| 338 | |||
| 339 | /* | ||
| 340 | * Get the priority of the AvailabilityManager given as argument | ||
| 341 | */ | ||
| 342 | unsigned availabilityManagerPriority(const AvailabilityManager& availabilityManager) const; | ||
| 343 | |||
| 344 | std::vector<openstudio::IdfObject> remove() override; | ||
| 345 | |||
| 346 | ModelObject clone(Model model) const override; | ||
| 347 | |||
| 348 | static IddObjectType iddObjectType(); | ||
| 349 | |||
| 350 | boost::optional<double> autosizedDesignSupplyAirFlowRate() const; | ||
| 351 | |||
| 352 | // Not part of the applySizingValues | ||
| 353 | boost::optional<double> autosizedSumMinimumHeatingAirFlowRates() const; | ||
| 354 | |||
| 355 | // Not part of the applySizingValues | ||
| 356 | boost::optional<double> autosizedSumAirTerminalMaxAirFlowRate() const; | ||
| 357 | |||
| 358 | protected: | ||
| 359 | friend class Model; | ||
| 360 | |||
| 361 | friend class openstudio::IdfObject; | ||
| 362 | friend class openstudio::detail::IdfObject_Impl; | ||
| 363 | |||
| 364 | /// @cond | ||
| 365 | |||
| 366 | using ImplType = detail::AirLoopHVAC_Impl; | ||
| 367 | |||
| 368 | explicit AirLoopHVAC(std::shared_ptr<ImplType> impl); | ||
| 369 | |||
| 370 | private: | ||
| 371 | REGISTER_LOGGER("openstudio.model.AirLoopHVAC"); | ||
| 372 | |||
| 373 | /// @endcond | ||
| 374 | }; | ||
| 375 | |||
| 376 | // optional AirLoopHVAC | ||
| 377 | using OptionalAirLoopHVAC = boost::optional<AirLoopHVAC>; | ||
| 378 | |||
| 379 | // vector of AirLoopHVAC | ||
| 380 | using AirLoopHVACVector = std::vector<AirLoopHVAC>; | ||
| 381 | |||
| 382 | } // namespace model | ||
| 383 | |||
| 384 | } // namespace openstudio | ||
| 385 | |||
| 386 | #endif // MODEL_AIRLOOPHVAC_HPP | ||
| 387 |