src/model/PlantLoop.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_PLANTLOOP_HPP | ||
| 7 | #define MODEL_PLANTLOOP_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "Loop.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | |||
| 14 | namespace model { | ||
| 15 | |||
| 16 | namespace detail { | ||
| 17 | class PlantLoop_Impl; | ||
| 18 | }; | ||
| 19 | |||
| 20 | class Node; | ||
| 21 | class Splitter; | ||
| 22 | class Mixer; | ||
| 23 | class HVACComponent; | ||
| 24 | class SizingPlant; | ||
| 25 | class PlantEquipmentOperationScheme; | ||
| 26 | class PlantEquipmentOperationHeatingLoad; | ||
| 27 | class PlantEquipmentOperationCoolingLoad; | ||
| 28 | class Schedule; | ||
| 29 | class AvailabilityManager; | ||
| 30 | |||
| 31 | /** PlantLoop is an interface to the EnergyPlus IDD object | ||
| 32 | * named "PlantLoop" | ||
| 33 | * | ||
| 34 | * The purpose of this class is to simplify the construction and manipulation | ||
| 35 | * of the EnergyPlus PlantLoop object. | ||
| 36 | */ | ||
| 37 | class MODEL_API PlantLoop : public Loop | ||
| 38 | { | ||
| 39 | |||
| 40 | public: | ||
| 41 | /** Constructs a new PlantLoop object and places it inside the | ||
| 42 | * model. The loop is fully initialized with all companion objects. | ||
| 43 | */ | ||
| 44 | explicit PlantLoop(Model& model); | ||
| 45 | |||
| 46 | 24057 | virtual ~PlantLoop() override = default; | |
| 47 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 48 | 4797 | PlantLoop(const PlantLoop& other) = default; | |
| 49 | 10060 | PlantLoop(PlantLoop&& other) = default; | |
| 50 | ✗ | PlantLoop& operator=(const PlantLoop&) = default; | |
| 51 | 147 | PlantLoop& operator=(PlantLoop&&) = default; | |
| 52 | |||
| 53 | static std::vector<std::string> loadDistributionSchemeValues(); | ||
| 54 | |||
| 55 | static std::vector<std::string> validLoadDistributionSchemeValues(); | ||
| 56 | |||
| 57 | static std::vector<std::string> fluidTypeValues(); | ||
| 58 | |||
| 59 | static std::vector<std::string> validFluidTypeValues(); | ||
| 60 | |||
| 61 | static std::vector<std::string> commonPipeSimulationValues(); | ||
| 62 | |||
| 63 | static std::vector<std::string> validCommonPipeSimulationValues(); | ||
| 64 | |||
| 65 | /** Prior to OS 1.11.0 the options where | ||
| 66 | Optimal, Sequential, and Uniform. | ||
| 67 | E+ changed the available options to. | ||
| 68 | Optimal, SequentialLoad, UniformLoad, UniformPLR, SequentialUniformPLR | ||
| 69 | in version 8.2.0. | ||
| 70 | |||
| 71 | OS did not catch up to the new options until 1.11.0. In 1.11.0 existing OS files will | ||
| 72 | be upgraded to use the new options. Sequential will be version translated to | ||
| 73 | SequentialLoad and Uniform will be translated to UniformLoad. | ||
| 74 | |||
| 75 | Existing API clients may continue using the old enumerations of Sequential and Uniform, however | ||
| 76 | these options are deprecated. | ||
| 77 | |||
| 78 | The current options supported by OS are now consisitent with E+, | ||
| 79 | Optimal, SequentialLoad, UniformLoad, UniformPLR, SequentialUniformPLR | ||
| 80 | **/ | ||
| 81 | std::string loadDistributionScheme(); | ||
| 82 | |||
| 83 | bool setLoadDistributionScheme(const std::string& scheme); | ||
| 84 | |||
| 85 | std::string fluidType(); | ||
| 86 | |||
| 87 | bool setFluidType(const std::string& value); | ||
| 88 | |||
| 89 | bool setGlycolConcentration(int glycolConcentration); | ||
| 90 | |||
| 91 | int glycolConcentration() const; | ||
| 92 | |||
| 93 | Node loopTemperatureSetpointNode(); | ||
| 94 | |||
| 95 | bool setLoopTemperatureSetpointNode(Node& node); | ||
| 96 | |||
| 97 | double maximumLoopTemperature(); | ||
| 98 | |||
| 99 | bool setMaximumLoopTemperature(double value); | ||
| 100 | |||
| 101 | double minimumLoopTemperature(); | ||
| 102 | |||
| 103 | bool setMinimumLoopTemperature(double value); | ||
| 104 | |||
| 105 | boost::optional<double> maximumLoopFlowRate(); | ||
| 106 | |||
| 107 | bool setMaximumLoopFlowRate(double value); | ||
| 108 | |||
| 109 | bool isMaximumLoopFlowRateAutosized(); | ||
| 110 | |||
| 111 | void autosizeMaximumLoopFlowRate(); | ||
| 112 | |||
| 113 | boost::optional<double> minimumLoopFlowRate(); | ||
| 114 | |||
| 115 | bool setMinimumLoopFlowRate(double value); | ||
| 116 | |||
| 117 | bool isMinimumLoopFlowRateAutosized(); | ||
| 118 | |||
| 119 | void autosizeMinimumLoopFlowRate(); | ||
| 120 | |||
| 121 | boost::optional<double> plantLoopVolume(); | ||
| 122 | |||
| 123 | bool setPlantLoopVolume(double value); | ||
| 124 | |||
| 125 | bool isPlantLoopVolumeAutocalculated(); | ||
| 126 | |||
| 127 | void autocalculatePlantLoopVolume(); | ||
| 128 | |||
| 129 | std::string commonPipeSimulation() const; | ||
| 130 | |||
| 131 | bool isCommonPipeSimulationDefaulted() const; | ||
| 132 | |||
| 133 | bool setCommonPipeSimulation(const std::string& value); | ||
| 134 | |||
| 135 | void resetCommonPipeSimulation(); | ||
| 136 | |||
| 137 | /** In OpenStudio there are three levels of "priority" for PlantEquipmentOperationScheme instances. | ||
| 138 | * Priority here means that if there are multiple operation schemes that list the same equipment, | ||
| 139 | * the one with the highest priority will define operation for that equipment. | ||
| 140 | * The operation scheme defined for primaryPlantEquipmentOperationScheme() is the highest priority, | ||
| 141 | * followed by any component setpoint operation. Heating and cooling load operation, | ||
| 142 | * defined by plantEquipmentOperationHeatingLoad() and plantEquipmentOperationCoolingLoad() has the lowest priority. | ||
| 143 | * | ||
| 144 | * No operation scheme is required for plant operation. OpenStudio will provide suitable defaults if none are provied. | ||
| 145 | * If any operation schemes, including primary, heating load, or cooling load, are defined then the default logic is | ||
| 146 | * entirely disabled. | ||
| 147 | * | ||
| 148 | * OpenStudio does not define a PlantEquipmentOperationComponentSetpoint, which is defined in EnergyPlus, | ||
| 149 | * but the funcitonality is supported. In OpenStudio placing a setpoint manager on a component outlet | ||
| 150 | * node will trigger OpenStudio to produce a component setpoint operation scheme on export to EnergyPlus. | ||
| 151 | * This component setpoint behavior is in place even if there are other primary, heating load, or cooling load schemes defined. | ||
| 152 | */ | ||
| 153 | boost::optional<PlantEquipmentOperationHeatingLoad> plantEquipmentOperationHeatingLoad() const; | ||
| 154 | |||
| 155 | bool setPlantEquipmentOperationHeatingLoad(const PlantEquipmentOperationHeatingLoad& plantOperation); | ||
| 156 | |||
| 157 | void resetPlantEquipmentOperationHeatingLoad(); | ||
| 158 | |||
| 159 | /** Set the hours of operation for which the PlantEquipmentOperationHeatingLoad, if any, applies. **/ | ||
| 160 | bool setPlantEquipmentOperationHeatingLoadSchedule(Schedule&); | ||
| 161 | |||
| 162 | void resetPlantEquipmentOperationHeatingLoadSchedule(); | ||
| 163 | |||
| 164 | boost::optional<Schedule> plantEquipmentOperationHeatingLoadSchedule() const; | ||
| 165 | |||
| 166 | boost::optional<PlantEquipmentOperationCoolingLoad> plantEquipmentOperationCoolingLoad() const; | ||
| 167 | |||
| 168 | bool setPlantEquipmentOperationCoolingLoad(const PlantEquipmentOperationCoolingLoad& plantOperation); | ||
| 169 | |||
| 170 | void resetPlantEquipmentOperationCoolingLoad(); | ||
| 171 | |||
| 172 | /** Set the hours of operation for which the PlantEquipmentOperationCoolingLoad, if any, applies. **/ | ||
| 173 | bool setPlantEquipmentOperationCoolingLoadSchedule(Schedule&); | ||
| 174 | |||
| 175 | boost::optional<Schedule> plantEquipmentOperationCoolingLoadSchedule() const; | ||
| 176 | |||
| 177 | void resetPlantEquipmentOperationCoolingLoadSchedule(); | ||
| 178 | |||
| 179 | boost::optional<PlantEquipmentOperationScheme> primaryPlantEquipmentOperationScheme() const; | ||
| 180 | |||
| 181 | bool setPrimaryPlantEquipmentOperationScheme(const PlantEquipmentOperationScheme& plantOperation); | ||
| 182 | |||
| 183 | void resetPrimaryPlantEquipmentOperationScheme(); | ||
| 184 | |||
| 185 | /** Set the hours of operation for which the PrimaryPlantEquipmentOperationScheme, if any, applies. **/ | ||
| 186 | bool setPrimaryPlantEquipmentOperationSchemeSchedule(Schedule&); | ||
| 187 | |||
| 188 | void resetPrimaryPlantEquipmentOperationSchemeSchedule(); | ||
| 189 | |||
| 190 | boost::optional<Schedule> primaryPlantEquipmentOperationSchemeSchedule() const; | ||
| 191 | |||
| 192 | /** Set the hours of operation for which the ComponentSetpointOperationScheme, if any, applies. | ||
| 193 | * The existance of ComponentSetpointOperationSchemes is controlled by the existance of | ||
| 194 | * setpoint managers on the plant component outlet nodes. | ||
| 195 | **/ | ||
| 196 | bool setComponentSetpointOperationSchemeSchedule(Schedule&); | ||
| 197 | |||
| 198 | void resetComponentSetpointOperationSchemeSchedule(); | ||
| 199 | |||
| 200 | boost::optional<Schedule> componentSetpointOperationSchemeSchedule() const; | ||
| 201 | |||
| 202 | Node supplyInletNode() const override; | ||
| 203 | |||
| 204 | Node supplyOutletNode() const override; | ||
| 205 | |||
| 206 | std::vector<Node> supplyOutletNodes() const override; | ||
| 207 | |||
| 208 | Node demandInletNode() const override; | ||
| 209 | |||
| 210 | std::vector<Node> demandInletNodes() const override; | ||
| 211 | |||
| 212 | Node demandOutletNode() const override; | ||
| 213 | |||
| 214 | /** Returns the supply side Mixer. **/ | ||
| 215 | Mixer supplyMixer() const; | ||
| 216 | |||
| 217 | /** Returns the supply side Splitter. **/ | ||
| 218 | Splitter supplySplitter() const; | ||
| 219 | |||
| 220 | /** Returns the demand side Mixer. **/ | ||
| 221 | Mixer demandMixer(); // cppcheck-suppress [duplInheritedMember] for documentation purposes | ||
| 222 | |||
| 223 | /** Returns the demand side Splitter. **/ | ||
| 224 | Splitter demandSplitter(); // cppcheck-suppress [duplInheritedMember] for documentation purposes | ||
| 225 | |||
| 226 | /** Adds a new demand branch for component and returns a bool indicating success. | ||
| 227 | */ | ||
| 228 | bool addSupplyBranchForComponent(HVACComponent hvacComponent); | ||
| 229 | |||
| 230 | /** Removes the demand side branch that contains the specified hvacComponent. | ||
| 231 | * Does not remove the component from the model, but may remove surrounding, | ||
| 232 | * components on the branch if they are not attached to other HVAC objects. | ||
| 233 | */ | ||
| 234 | bool removeSupplyBranchWithComponent(HVACComponent hvacComponent); | ||
| 235 | |||
| 236 | /** Adds a new demand branch for component and returns a bool indicating success. | ||
| 237 | * This method will create a new ControllerWaterCoil if hvacComponent is a | ||
| 238 | * CoilCoolingWater or a CoilHeatingWater. | ||
| 239 | */ | ||
| 240 | bool addDemandBranchForComponent(HVACComponent hvacComponent, bool tertiary = false); | ||
| 241 | |||
| 242 | /** Removes the demand side branch that contains the specified hvacComponent. | ||
| 243 | * Does not remove the component from the model, but may remove surrounding, | ||
| 244 | * components on the branch if they are not attached to other HVAC objects. | ||
| 245 | */ | ||
| 246 | bool removeDemandBranchWithComponent(HVACComponent hvacComponent); | ||
| 247 | |||
| 248 | virtual std::vector<openstudio::IdfObject> remove() override; | ||
| 249 | |||
| 250 | virtual ModelObject clone(Model model) const override; | ||
| 251 | |||
| 252 | static IddObjectType iddObjectType(); | ||
| 253 | |||
| 254 | SizingPlant sizingPlant() const; | ||
| 255 | |||
| 256 | boost::optional<double> autosizedMaximumLoopFlowRate() const; | ||
| 257 | |||
| 258 | boost::optional<double> autosizedPlantLoopVolume() const; | ||
| 259 | |||
| 260 | /* | ||
| 261 | * Return all AvailabilityManagers assigned to this list, in the priority order | ||
| 262 | * AvailabilityManagers are used to override the system availabilitySchedule() with one of OpenStudio's | ||
| 263 | * supported AvailabilityManager types. | ||
| 264 | */ | ||
| 265 | std::vector<AvailabilityManager> availabilityManagers() const; | ||
| 266 | |||
| 267 | /* | ||
| 268 | * Add a new AvailabilityManager at the end of the list (priority = last). | ||
| 269 | */ | ||
| 270 | bool addAvailabilityManager(const AvailabilityManager& availabilityManager); | ||
| 271 | |||
| 272 | /* | ||
| 273 | * Add a new AvailabilityManager to the list which a given priority (1 to x). | ||
| 274 | * Internally calls addAvailabilityManager then setPriority, see remarks there | ||
| 275 | */ | ||
| 276 | bool addAvailabilityManager(const AvailabilityManager& availabilityManager, unsigned priority); | ||
| 277 | |||
| 278 | /* | ||
| 279 | * Set all availabilityManagers using a list of AvailabilityManagers | ||
| 280 | */ | ||
| 281 | bool setAvailabilityManagers(const std::vector<AvailabilityManager>& avms); | ||
| 282 | |||
| 283 | /* | ||
| 284 | * Removes all AvailabilityManagers assigned (TODO: should that affect the availabilitySchedule?) | ||
| 285 | */ | ||
| 286 | void resetAvailabilityManagers(); | ||
| 287 | |||
| 288 | /* | ||
| 289 | * Remove the given AvailabilityManager from this AvailabilityManagerAssignmentList | ||
| 290 | */ | ||
| 291 | bool removeAvailabilityManager(const AvailabilityManager& avm); | ||
| 292 | |||
| 293 | /* | ||
| 294 | * Remove the availabilityManager at the given priority | ||
| 295 | * Returns false if the priority isn't between 1 and the number of AVMs | ||
| 296 | */ | ||
| 297 | bool removeAvailabilityManager(unsigned priority); | ||
| 298 | |||
| 299 | /* | ||
| 300 | * You can shuffle the priority of a given AvailabilityManager after having added it | ||
| 301 | * If priority is below 1, it's reset to 1. | ||
| 302 | * If priority is greater than the number of availability managers, will reset to last | ||
| 303 | */ | ||
| 304 | bool setAvailabilityManagerPriority(const AvailabilityManager& availabilityManager, unsigned priority); | ||
| 305 | |||
| 306 | /* | ||
| 307 | * Get the priority of the AvailabilityManager given as argument | ||
| 308 | */ | ||
| 309 | unsigned availabilityManagerPriority(const AvailabilityManager& availabilityManager) const; | ||
| 310 | |||
| 311 | protected: | ||
| 312 | friend class Model; | ||
| 313 | |||
| 314 | friend class openstudio::IdfObject; | ||
| 315 | friend class openstudio::detail::IdfObject_Impl; | ||
| 316 | |||
| 317 | /// @cond | ||
| 318 | |||
| 319 | using ImplType = detail::PlantLoop_Impl; | ||
| 320 | |||
| 321 | explicit PlantLoop(std::shared_ptr<ImplType> impl); | ||
| 322 | |||
| 323 | private: | ||
| 324 | unsigned supplyInletPort() const; | ||
| 325 | |||
| 326 | unsigned supplyOutletPort() const; | ||
| 327 | |||
| 328 | unsigned demandInletPort() const; | ||
| 329 | |||
| 330 | unsigned demandOutletPort() const; | ||
| 331 | |||
| 332 | REGISTER_LOGGER("openstudio.model.PlantLoop"); | ||
| 333 | |||
| 334 | /// @endcond | ||
| 335 | }; | ||
| 336 | |||
| 337 | /** \relates PlantLoop */ | ||
| 338 | using OptionalPlantLoop = boost::optional<PlantLoop>; | ||
| 339 | |||
| 340 | } // namespace model | ||
| 341 | } // namespace openstudio | ||
| 342 | |||
| 343 | #endif // MODEL_PLANTLOOP_HPP | ||
| 344 |