src/model/LayeredConstruction.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_LAYEREDCONSTRUCTION_HPP | ||
| 7 | #define MODEL_LAYEREDCONSTRUCTION_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "ConstructionBase.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | namespace model { | ||
| 14 | |||
| 15 | class Material; | ||
| 16 | class OpaqueMaterial; | ||
| 17 | class FenestrationMaterial; | ||
| 18 | class ModelPartitionMaterial; | ||
| 19 | |||
| 20 | namespace detail { | ||
| 21 | class LayeredConstruction_Impl; | ||
| 22 | } | ||
| 23 | |||
| 24 | /** LayeredConstruction is a ConstructionBase that serves as a base class to concrete construction | ||
| 25 | * classes that are composed of Material layers. */ | ||
| 26 | class MODEL_API LayeredConstruction : public ConstructionBase | ||
| 27 | { | ||
| 28 | public: | ||
| 29 | /** @name Constructors and Destructors */ | ||
| 30 | //@{ | ||
| 31 | |||
| 32 | 18523 | virtual ~LayeredConstruction() override = default; | |
| 33 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 34 | 97 | LayeredConstruction(const LayeredConstruction& other) = default; | |
| 35 | 5720 | LayeredConstruction(LayeredConstruction&& other) = default; | |
| 36 | 3 | LayeredConstruction& operator=(const LayeredConstruction&) = default; | |
| 37 | 2 | LayeredConstruction& operator=(LayeredConstruction&&) = default; | |
| 38 | |||
| 39 | //@} | ||
| 40 | /** @name Static Methods */ | ||
| 41 | //@{ | ||
| 42 | |||
| 43 | /** Returns true if materials defines a valid EnergyPlus construction. Returns false if layers are empty. | ||
| 44 | * Checks the following rules if first layer is an OpaqueMaterial: | ||
| 45 | * | ||
| 46 | * \li AirGap must have non-AirGap on either side. | ||
| 47 | * \li RoofVegetation must be the exterior layer. | ||
| 48 | * | ||
| 49 | * Checks the following rules if first layer is a FenestrationMaterial: | ||
| 50 | * | ||
| 51 | * \li SimpleGlazing cannot be combined with other \link Glazing Glazings \endlink or any | ||
| 52 | * \link GasLayer GasLayers\endlink. | ||
| 53 | * \li \link GasLayer GasLayers\endlink must have non-GasLayer on either side. | ||
| 54 | * \li Ultimately, \link GasLayer GasLayers\endlink must have Glazing on either side. | ||
| 55 | * | ||
| 56 | * Checks the following rules if first layer is a ModelPartitionMaterial: | ||
| 57 | * | ||
| 58 | * \li Layer size is 1 | ||
| 59 | * | ||
| 60 | * \todo Verify that this is a comprehensive and accurate list. | ||
| 61 | */ | ||
| 62 | static bool layersAreValid(const std::vector<Material>& materials); | ||
| 63 | static bool layersAreValid(const std::vector<OpaqueMaterial>& opaqueMaterials); | ||
| 64 | static bool layersAreValid(const std::vector<FenestrationMaterial>& fenestrationMaterials); | ||
| 65 | |||
| 66 | //@} | ||
| 67 | /** @name Getters */ | ||
| 68 | //@{ | ||
| 69 | |||
| 70 | /** Returns the material layers that make up this construction. Listed in order from outside in, | ||
| 71 | * that is, the Material at index 0 faces out from the point of view of the Zone, should this | ||
| 72 | * LayeredConstruction be associated with a PlanarSurface. */ | ||
| 73 | std::vector<Material> layers() const; | ||
| 74 | |||
| 75 | /** Get the Material at layerIndex, where layerIndex is between 0 and numLayers() - 1. Throws a | ||
| 76 | * openstudio::Exception if layerIndex >= numLayers. */ | ||
| 77 | Material getLayer(unsigned layerIndex) const; | ||
| 78 | |||
| 79 | //@} | ||
| 80 | /** @name Setters */ | ||
| 81 | //@{ | ||
| 82 | |||
| 83 | /** Erases the Material at layerIndex, if possible. Must have 0 <= layerIndex < numLayers, and | ||
| 84 | * resulting construction must satisfy layersAreValid. */ | ||
| 85 | bool eraseLayer(unsigned layerIndex); | ||
| 86 | |||
| 87 | /** Insert opaqueMaterial at layerIndex, if possible. Must have 0 <= layerIndex <= numLayers, | ||
| 88 | * and this construction must have no layers or satisfy isOpaque == true. Furthermore, the | ||
| 89 | * resulting construction must satisfy layersAreValid. */ | ||
| 90 | bool insertLayer(unsigned layerIndex, const Material& material); | ||
| 91 | |||
| 92 | /** Set the layer at layerIndex to opaqueMaterial, if possible. Must have 0 <= layerIndex < | ||
| 93 | * numLayers, and this construction must satisfy isOpaque == true. Furthermore, the | ||
| 94 | * resulting construction must satisfy layersAreValid. */ | ||
| 95 | bool setLayer(unsigned layerIndex, const Material& material); | ||
| 96 | |||
| 97 | /** Set the construction to use opaqueMaterials as its layers, if layersAreValid(opaqueMaterials). | ||
| 98 | * Clears out all previous Material layers. */ | ||
| 99 | bool setLayers(const std::vector<Material>& materials); | ||
| 100 | |||
| 101 | /** Sets the construction to use modelPartitionMaterial. Clears out all previous Material | ||
| 102 | * layers. */ | ||
| 103 | bool setLayer(const ModelPartitionMaterial& modelPartitionMaterial); | ||
| 104 | |||
| 105 | //@} | ||
| 106 | /** @name Queries */ | ||
| 107 | //@{ | ||
| 108 | |||
| 109 | /** Returns true if this is a symmetric layered construction. */ | ||
| 110 | bool isSymmetric() const; | ||
| 111 | |||
| 112 | /** Returns true if this construction has the same layers as other one. */ | ||
| 113 | bool equalLayers(const LayeredConstruction& other) const; | ||
| 114 | |||
| 115 | /** Returns true if this construction has the same layers but in reverse order as other one. */ | ||
| 116 | bool reverseEqualLayers(const LayeredConstruction& other) const; | ||
| 117 | |||
| 118 | /** Returns layer indices that do not actually point to a Material. Before simulation, the | ||
| 119 | * returned vector should be empty. */ | ||
| 120 | std::vector<unsigned> nullLayers() const; | ||
| 121 | |||
| 122 | /** Returns the number of non-null layers in this construction. */ | ||
| 123 | unsigned numLayers() const; | ||
| 124 | |||
| 125 | /** Returns the indices from which this construction points to material. */ | ||
| 126 | std::vector<unsigned> getLayerIndices(const Material& material) const; | ||
| 127 | |||
| 128 | //@} | ||
| 129 | /** @name Standards Methods */ | ||
| 130 | //@{ | ||
| 131 | |||
| 132 | /** Returns the layer designated as insulation, if such a designation has been made. */ | ||
| 133 | boost::optional<OpaqueMaterial> insulation() const; | ||
| 134 | |||
| 135 | /** Notes that insulationLayer is the perturbable insulation layer. Only works if | ||
| 136 | * insulationLayer is already in this construction. */ | ||
| 137 | bool setInsulation(const OpaqueMaterial& insulationLayer); | ||
| 138 | |||
| 139 | /** Removes any existing insulation layer designations. Does not touch the actual composition | ||
| 140 | * of the construction. */ | ||
| 141 | void resetInsulation(); | ||
| 142 | |||
| 143 | /** Ensures that all materials in this construction are used by this construction only. Allows standards | ||
| 144 | * to then appply standards specified material properties to each layer (e.g. SRI). */ | ||
| 145 | void ensureUniqueLayers(); | ||
| 146 | |||
| 147 | //@} | ||
| 148 | protected: | ||
| 149 | /// @cond | ||
| 150 | using ImplType = detail::LayeredConstruction_Impl; | ||
| 151 | |||
| 152 | friend class Model; | ||
| 153 | friend class openstudio::IdfObject; | ||
| 154 | friend class openstudio::detail::IdfObject_Impl; | ||
| 155 | friend class detail::LayeredConstruction_Impl; | ||
| 156 | |||
| 157 | LayeredConstruction(IddObjectType type, const Model& model); | ||
| 158 | |||
| 159 | explicit LayeredConstruction(std::shared_ptr<detail::LayeredConstruction_Impl> impl); | ||
| 160 | |||
| 161 | /// @endcond | ||
| 162 | private: | ||
| 163 | − | REGISTER_LOGGER("openstudio.model.LayeredConstruction"); | |
| 164 | }; | ||
| 165 | |||
| 166 | /** \relates LayeredConstruction */ | ||
| 167 | using OptionalLayeredConstruction = boost::optional<LayeredConstruction>; | ||
| 168 | |||
| 169 | /** \relates LayeredConstruction */ | ||
| 170 | using LayeredConstructionVector = std::vector<LayeredConstruction>; | ||
| 171 | |||
| 172 | } // namespace model | ||
| 173 | } // namespace openstudio | ||
| 174 | |||
| 175 | #endif // MODEL_LAYEREDCONSTRUCTION_HPP | ||
| 176 |