src/model/Mixer.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_MIXER_HPP | ||
| 7 | #define MODEL_MIXER_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "HVACComponent.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | |||
| 14 | namespace model { | ||
| 15 | |||
| 16 | namespace detail { | ||
| 17 | class Mixer_Impl; | ||
| 18 | }; | ||
| 19 | |||
| 20 | class MODEL_API Mixer : public HVACComponent | ||
| 21 | { | ||
| 22 | public: | ||
| 23 | 10494 | virtual ~Mixer() override = default; | |
| 24 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 25 | 1756 | Mixer(const Mixer& other) = default; | |
| 26 | 4289 | Mixer(Mixer&& other) = default; | |
| 27 | ✗ | Mixer& operator=(const Mixer&) = default; | |
| 28 | ✗ | Mixer& operator=(Mixer&&) = default; | |
| 29 | |||
| 30 | /** Returns the outlet port to the zone mixer. */ | ||
| 31 | virtual unsigned outletPort() const; | ||
| 32 | |||
| 33 | /** Returns the inlet port for branchIndex. Branches consequtively | ||
| 34 | * indexed starting from 0. | ||
| 35 | */ | ||
| 36 | virtual unsigned inletPort(unsigned branchIndex) const; | ||
| 37 | |||
| 38 | /** Returns the next available inlet port. This will be the first port | ||
| 39 | * with no connected objects */ | ||
| 40 | virtual unsigned nextInletPort() const; | ||
| 41 | |||
| 42 | /** Returns the optional ModelObject connected to the outlet port. | ||
| 43 | * If there is no connected object then the optional will be false. | ||
| 44 | */ | ||
| 45 | virtual boost::optional<ModelObject> outletModelObject() const; | ||
| 46 | |||
| 47 | /** Returns the optional ModelObject connected to the branch designated by branchIndex. | ||
| 48 | * If there is no connected object then the optional will be false. | ||
| 49 | */ | ||
| 50 | virtual boost::optional<ModelObject> inletModelObject(unsigned branchIndex) const; | ||
| 51 | |||
| 52 | /** Returns the optional ModelObject connected to the last branch of the mixer. | ||
| 53 | * If there are no connections to the mixer's inlet ports, then the | ||
| 54 | * optional will be false. | ||
| 55 | */ | ||
| 56 | virtual boost::optional<ModelObject> lastInletModelObject() const; | ||
| 57 | |||
| 58 | /** Returns a vector of all objects connected to the mixer's inlet ports. | ||
| 59 | * If no objects are connected to the mixer then an empty vector will be returned. | ||
| 60 | */ | ||
| 61 | virtual std::vector<ModelObject> inletModelObjects() const; | ||
| 62 | |||
| 63 | /** Returns a new port after the branch specified by branchIndex */ | ||
| 64 | virtual unsigned newInletPortAfterBranch(unsigned branchIndex); | ||
| 65 | |||
| 66 | /** Returns the branch index for the ModelObject specified by modelObject. | ||
| 67 | * The specified object must be connected to an inlet port of the mixer. | ||
| 68 | */ | ||
| 69 | virtual unsigned branchIndexForInletModelObject(const ModelObject& modelObject) const; | ||
| 70 | |||
| 71 | /** Returns the index of the next available branch */ | ||
| 72 | virtual unsigned nextBranchIndex() const; | ||
| 73 | |||
| 74 | /** Effectively disconnects anything connected to the inlet port | ||
| 75 | * at the specified branch index. All branches after the specified | ||
| 76 | * branch index are moved to the next lower branch index, thereby | ||
| 77 | * removing any unconnected ports between branches. | ||
| 78 | */ | ||
| 79 | virtual void removePortForBranch(unsigned branchIndex); | ||
| 80 | |||
| 81 | protected: | ||
| 82 | Mixer(IddObjectType type, const Model& model); | ||
| 83 | |||
| 84 | using ImplType = detail::Mixer_Impl; | ||
| 85 | |||
| 86 | friend class Model; | ||
| 87 | |||
| 88 | friend class openstudio::IdfObject; | ||
| 89 | |||
| 90 | explicit Mixer(std::shared_ptr<ImplType> impl); | ||
| 91 | |||
| 92 | private: | ||
| 93 | REGISTER_LOGGER("openstudio.model.Mixer"); | ||
| 94 | }; | ||
| 95 | |||
| 96 | using OptionalMixer = boost::optional<Mixer>; | ||
| 97 | |||
| 98 | } // namespace model | ||
| 99 | |||
| 100 | } // namespace openstudio | ||
| 101 | |||
| 102 | #endif // MODEL_MIXER_HPP | ||
| 103 |