src/model/PlanarSurface.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_PLANARSURFACE_HPP | ||
| 7 | #define MODEL_PLANARSURFACE_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "ParentObject.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | |||
| 14 | class Plane; | ||
| 15 | class Point3d; | ||
| 16 | class Vector3d; | ||
| 17 | |||
| 18 | namespace model { | ||
| 19 | |||
| 20 | class PlanarSurfaceGroup; | ||
| 21 | class Space; | ||
| 22 | class ConstructionBase; | ||
| 23 | class GeneratorPhotovoltaic; | ||
| 24 | class SurfacePropertyConvectionCoefficients; | ||
| 25 | |||
| 26 | namespace detail { | ||
| 27 | class PlanarSurface_Impl; | ||
| 28 | } // namespace detail | ||
| 29 | |||
| 30 | // clang-format off | ||
| 31 | |||
| 32 | /** \class FilmResistanceType | ||
| 33 | * | ||
| 34 | * \relates PlanarSurface */ | ||
| 35 |
8/22openstudio::model::FilmResistanceType::buildStringVec[abi:cxx11](bool):
✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 3 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✓ Branch 17 taken 21 times.
✓ Branch 20 taken 21 times.
✓ Branch 23 taken 18 times.
✓ Branch 24 taken 6 times.
✓ Branch 25 taken 3 times.
✓ Branch 26 taken 3 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 3 times.
openstudio::model::FilmResistanceType::enumName[abi:cxx11]():
✗ Branch 1 not taken.
openstudio::model::operator<<(std::ostream&, openstudio::model::FilmResistanceType const&):
✗ Branch 1 not taken.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
|
63 | OPENSTUDIO_ENUM(FilmResistanceType, |
| 36 | ((StillAir_HorizontalSurface_HeatFlowsUpward)) | ||
| 37 | ((StillAir_45DegreeSurface_HeatFlowsUpward)) | ||
| 38 | ((StillAir_VerticalSurface)) | ||
| 39 | ((StillAir_45DegreeSurface_HeatFlowsDownward)) | ||
| 40 | ((StillAir_HorizontalSurface_HeatFlowsDownward)) | ||
| 41 | ((MovingAir_15mph)) | ||
| 42 | ((MovingAir_7p5mph)) | ||
| 43 | ); | ||
| 44 | |||
| 45 | // clang-format on | ||
| 46 | |||
| 47 | /** PlanarSurface is an abstract class derived from ParentObject. | ||
| 48 | * | ||
| 49 | * PlanarSurface is a pure virtual class to consolodate functions | ||
| 50 | * dealing with surface geometry. | ||
| 51 | * | ||
| 52 | * \todo There is too much functionality in this class that is not common to | ||
| 53 | * all derived classes. These members need to be factored out of PlanarSurface. | ||
| 54 | */ | ||
| 55 | class MODEL_API PlanarSurface : public ParentObject | ||
| 56 | { | ||
| 57 | public: | ||
| 58 | /** @name Constructors and Destructors */ | ||
| 59 | //@{ | ||
| 60 | |||
| 61 | 7825634 | virtual ~PlanarSurface() override = default; | |
| 62 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 63 | 111372 | PlanarSurface(const PlanarSurface& other) = default; | |
| 64 | 2770221 | PlanarSurface(PlanarSurface&& other) = default; | |
| 65 | 278 | PlanarSurface& operator=(const PlanarSurface&) = default; | |
| 66 | 886812 | PlanarSurface& operator=(PlanarSurface&&) = default; | |
| 67 | |||
| 68 | //@} | ||
| 69 | /** @name Getters */ | ||
| 70 | //@{ | ||
| 71 | |||
| 72 | /// Returns the construction object. | ||
| 73 | /// If the planar surface is paired with an adjacent planar surface, attempts to resolve any surface matching conflict. | ||
| 74 | boost::optional<ConstructionBase> construction() const; | ||
| 75 | |||
| 76 | /// Returns the construction object and the search distance that was needed to find the construction. | ||
| 77 | /// Does not consider adjacent planar surfaces. | ||
| 78 | boost::optional<std::pair<ConstructionBase, int>> constructionWithSearchDistance() const; | ||
| 79 | |||
| 80 | /// Returns true if the construction is not directly referenced by this surface . | ||
| 81 | bool isConstructionDefaulted() const; | ||
| 82 | |||
| 83 | /// Returns the containing PlanarSurfaceGroup if available. | ||
| 84 | boost::optional<PlanarSurfaceGroup> planarSurfaceGroup() const; | ||
| 85 | |||
| 86 | /// Returns the containing Space if available. | ||
| 87 | boost::optional<Space> space() const; | ||
| 88 | |||
| 89 | /// Returns the vertices. | ||
| 90 | std::vector<Point3d> vertices() const; | ||
| 91 | |||
| 92 | //@} | ||
| 93 | /** @name Setters */ | ||
| 94 | //@{ | ||
| 95 | |||
| 96 | /// Sets the vertices. | ||
| 97 | bool setVertices(const std::vector<Point3d>& vertices); | ||
| 98 | |||
| 99 | /// Sets the construction object. | ||
| 100 | bool setConstruction(const ConstructionBase& construction); | ||
| 101 | |||
| 102 | /// Resets the construction object. | ||
| 103 | void resetConstruction(); | ||
| 104 | |||
| 105 | //@} | ||
| 106 | |||
| 107 | /** Find PlanarSurfaces within angular range, specified in degrees in the site coordinate system, an unset optional means no limit. | ||
| 108 | Values for degrees from North are between 0 and 360 and for degrees tilt they are between 0 and 180. | ||
| 109 | Note that maxDegreesFromNorth may be less than minDegreesFromNorth, | ||
| 110 | e.g. to search between NorthWest and NorthEast set minDegreesFromNorth = 315 and maxDegreesFromNorth = 45. | ||
| 111 | The value of maxDegreesTilt must be greater than or equal to minDegreesTilt. A tolerance of one degree is applied by default. | ||
| 112 | */ | ||
| 113 | static std::vector<PlanarSurface> findPlanarSurfaces(const std::vector<PlanarSurface>& planarSurfaces, | ||
| 114 | boost::optional<double> minDegreesFromNorth, boost::optional<double> maxDegreesFromNorth, | ||
| 115 | boost::optional<double> minDegreesTilt, boost::optional<double> maxDegreesTilt, | ||
| 116 | double tol = 1); | ||
| 117 | |||
| 118 | /** Film resistances from ASHRAE Fundamentals, Chapter 25, Table 1 for non-reflective surfaces. | ||
| 119 | * Units of m^2*K/W. */ | ||
| 120 | static double filmResistance(const FilmResistanceType& type); | ||
| 121 | |||
| 122 | /** Film resistance of still air on surface with tilt (rad). Horizontal roof has tilt of 0 rad; | ||
| 123 | * horizontal floor/slab has tilt of pi rad. */ | ||
| 124 | static double stillAirFilmResistance(double tilt); | ||
| 125 | |||
| 126 | /// Checks if this surface is an air wall, returns true if it's a ConstructionAirBoundary | ||
| 127 | bool isAirWall() const; | ||
| 128 | |||
| 129 | /// Computes the surface's gross area (m^2). | ||
| 130 | double grossArea() const; | ||
| 131 | |||
| 132 | /// Reports if user should subtract this surface's net area from parent's gross area | ||
| 133 | /// to compute parent's net area (e.g. true for a window). | ||
| 134 | bool subtractFromGrossArea() const; | ||
| 135 | |||
| 136 | /// Computes the surface's net area (m^2). | ||
| 137 | double netArea() const; | ||
| 138 | |||
| 139 | /// Returns the outward normal vector in local coordinates. | ||
| 140 | /// Throws openstudio::Exception if cannot compute outward normal for this surface. | ||
| 141 | Vector3d outwardNormal() const; | ||
| 142 | |||
| 143 | /// Returns the surface's tilt measured as angle between outward normal and local up (radians). | ||
| 144 | /// Throws openstudio::Exception if cannot compute outward normal for this surface. | ||
| 145 | double tilt() const; | ||
| 146 | |||
| 147 | /// Returns the surface's azimuth measured clockwise as angle between outward normal and local North (radians). | ||
| 148 | /// Throws openstudio::Exception if cannot compute outward normal for this surface. | ||
| 149 | double azimuth() const; | ||
| 150 | |||
| 151 | // Returns the u-factor of this surface. Includes standard film coefficients, does not consider any custom SurfacePropertyConvectionCoefficients. | ||
| 152 | boost::optional<double> uFactor() const; | ||
| 153 | |||
| 154 | /** Sets the u-factor of this surface in W/m^2*K, if possible. Value should already include appropriate | ||
| 155 | * standard film coefficients, assuming still air indoors and 15 mph outdoor air speed. | ||
| 156 | * Does not consider any custom SurfacePropertyConvectionCoefficients */ | ||
| 157 | bool setUFactor(double value); | ||
| 158 | |||
| 159 | // Returns the thermal conductance of this surface in W/m^2*K. Does not include film coefficients. | ||
| 160 | boost::optional<double> thermalConductance() const; | ||
| 161 | |||
| 162 | // Sets the conductance of this surface in W/m^2*K, if possible. Value should not include any film coefficients. | ||
| 163 | bool setThermalConductance(double value); | ||
| 164 | |||
| 165 | // Returns the heat capacity of this surface in J/m^2*K, if available. | ||
| 166 | boost::optional<double> heatCapacity() const; | ||
| 167 | |||
| 168 | // Returns interior visible absorptance (unitless), if available. | ||
| 169 | boost::optional<double> interiorVisibleAbsorptance() const; | ||
| 170 | |||
| 171 | /// Returns exterior visible absorptance (unitless), if available. | ||
| 172 | boost::optional<double> exteriorVisibleAbsorptance() const; | ||
| 173 | |||
| 174 | /// Returns visible transmittance (unitless), if available. | ||
| 175 | /// May require EnergyPlus simulation output. | ||
| 176 | boost::optional<double> visibleTransmittance() const; | ||
| 177 | |||
| 178 | /// Check if this planar surface's vertices are equal to the other's in the building coordinate system | ||
| 179 | bool equalVertices(const PlanarSurface& other) const; | ||
| 180 | |||
| 181 | /// Check if this planar surface's vertices are reverse equal to the other's in the building coordinate system | ||
| 182 | bool reverseEqualVertices(const PlanarSurface& other) const; | ||
| 183 | |||
| 184 | /// Get the plane, throws openstudio::Exception if cannot compute plane for this surface. | ||
| 185 | Plane plane() const; | ||
| 186 | |||
| 187 | /// Get a triangulation of this surface, subsurfaces will be replaced by holes in the triangulation | ||
| 188 | virtual std::vector<std::vector<Point3d>> triangulation() const; | ||
| 189 | |||
| 190 | /// Return the centroid of this planar surface's vertices | ||
| 191 | Point3d centroid() const; | ||
| 192 | |||
| 193 | /// Returns any solar hot water collectors associated with this surface. | ||
| 194 | std::vector<ModelObject> solarCollectors() const; | ||
| 195 | |||
| 196 | /// Returns any generator photovoltaics associated with this surface. | ||
| 197 | std::vector<GeneratorPhotovoltaic> generatorPhotovoltaics() const; | ||
| 198 | |||
| 199 | /// Returns any SurfacePropertyConvectionCoefficients associated with this surface, does not return SurfacePropertyConvectionCoefficientsMultipleSurface. | ||
| 200 | std::vector<SurfacePropertyConvectionCoefficients> surfacePropertyConvectionCoefficients() const; | ||
| 201 | |||
| 202 | bool isConvex() const; | ||
| 203 | |||
| 204 | protected: | ||
| 205 | /** @name Constructors and Destructors */ | ||
| 206 | //@{ | ||
| 207 | |||
| 208 | /// Constructs a new PlanarSurface object in the model. | ||
| 209 | PlanarSurface(IddObjectType type, const std::vector<Point3d>& vertices, const Model& model); | ||
| 210 | |||
| 211 | //@} | ||
| 212 | |||
| 213 | /// @cond | ||
| 214 | |||
| 215 | using ImplType = detail::PlanarSurface_Impl; | ||
| 216 | |||
| 217 | friend class Model; | ||
| 218 | friend class openstudio::IdfObject; | ||
| 219 | friend class openstudio::detail::IdfObject_Impl; | ||
| 220 | |||
| 221 | // constructor | ||
| 222 | explicit PlanarSurface(std::shared_ptr<detail::PlanarSurface_Impl> impl); | ||
| 223 | |||
| 224 | private: | ||
| 225 | − | REGISTER_LOGGER("openstudio.model.PlanarSurface"); | |
| 226 | |||
| 227 | /// @endcond | ||
| 228 | }; | ||
| 229 | |||
| 230 | /** \relates PlanarSurface */ | ||
| 231 | using OptionalPlanarSurface = boost::optional<PlanarSurface>; | ||
| 232 | |||
| 233 | /** \relates PlanarSurface */ | ||
| 234 | using PlanarSurfaceVector = std::vector<PlanarSurface>; | ||
| 235 | |||
| 236 | } // namespace model | ||
| 237 | } // namespace openstudio | ||
| 238 | |||
| 239 | #endif //MODEL_PLANARSURFACE_HPP | ||
| 240 |