src/model/SubSurface.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_SUBSURFACE_HPP | ||
| 7 | #define MODEL_SUBSURFACE_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "PlanarSurface.hpp" | ||
| 11 | #include "../utilities/core/Deprecated.hpp" | ||
| 12 | |||
| 13 | namespace openstudio { | ||
| 14 | namespace model { | ||
| 15 | |||
| 16 | class Surface; | ||
| 17 | class ShadingSurface; | ||
| 18 | class ShadingControl; | ||
| 19 | class ShadingSurfaceGroup; | ||
| 20 | class DaylightingDeviceShelf; | ||
| 21 | class DaylightingDeviceTubular; | ||
| 22 | class DaylightingDeviceLightWell; | ||
| 23 | class WindowPropertyFrameAndDivider; | ||
| 24 | class SurfacePropertyOtherSideCoefficients; | ||
| 25 | class SurfacePropertyOtherSideConditionsModel; | ||
| 26 | class SurfacePropertyConvectionCoefficients; | ||
| 27 | class SurfacePropertyLocalEnvironment; | ||
| 28 | class SurfacePropertyIncidentSolarMultiplier; | ||
| 29 | class AirflowNetworkSurface; | ||
| 30 | class AirflowNetworkDetailedOpening; | ||
| 31 | class AirflowNetworkSimpleOpening; | ||
| 32 | class AirflowNetworkCrack; | ||
| 33 | class AirflowNetworkEffectiveLeakageArea; | ||
| 34 | class AirflowNetworkHorizontalOpening; | ||
| 35 | class AirflowNetworkSpecifiedFlowRate; | ||
| 36 | |||
| 37 | namespace detail { | ||
| 38 | |||
| 39 | class SubSurface_Impl; | ||
| 40 | |||
| 41 | } // namespace detail | ||
| 42 | |||
| 43 | /** SubSurface is a PlanarSurface that wraps the OpenStudio IDD object 'OS_SubSurface'. */ | ||
| 44 | class MODEL_API SubSurface : public PlanarSurface | ||
| 45 | { | ||
| 46 | public: | ||
| 47 | /** @name Constructors and Destructors */ | ||
| 48 | //@{ | ||
| 49 | |||
| 50 | explicit SubSurface(const std::vector<Point3d>& vertices, const Model& model); | ||
| 51 | |||
| 52 | 168129 | virtual ~SubSurface() override = default; | |
| 53 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 54 | 27697 | SubSurface(const SubSurface& other) = default; | |
| 55 | 48032 | SubSurface(SubSurface&& other) = default; | |
| 56 | ✗ | SubSurface& operator=(const SubSurface&) = default; | |
| 57 | 255 | SubSurface& operator=(SubSurface&&) = default; | |
| 58 | |||
| 59 | //@} | ||
| 60 | /** @name Static Methods */ | ||
| 61 | //@{ | ||
| 62 | |||
| 63 | static IddObjectType iddObjectType(); | ||
| 64 | |||
| 65 | static std::vector<std::string> validSubSurfaceTypeValues(); | ||
| 66 | |||
| 67 | //@} | ||
| 68 | /** @name Getters */ | ||
| 69 | //@{ | ||
| 70 | |||
| 71 | std::string subSurfaceType() const; | ||
| 72 | |||
| 73 | bool isSubSurfaceTypeDefaulted() const; | ||
| 74 | |||
| 75 | boost::optional<double> viewFactortoGround() const; | ||
| 76 | |||
| 77 | bool isViewFactortoGroundDefaulted() const; | ||
| 78 | |||
| 79 | bool isViewFactortoGroundAutocalculated() const; | ||
| 80 | |||
| 81 | bool allowShadingControl() const; | ||
| 82 | |||
| 83 | OS_DEPRECATED(3, 1, 0) boost::optional<ShadingControl> shadingControl() const; | ||
| 84 | |||
| 85 | std::vector<ShadingControl> shadingControls() const; | ||
| 86 | |||
| 87 | unsigned int numberofShadingControls() const; | ||
| 88 | |||
| 89 | bool allowWindowPropertyFrameAndDivider() const; | ||
| 90 | |||
| 91 | boost::optional<WindowPropertyFrameAndDivider> windowPropertyFrameAndDivider() const; | ||
| 92 | |||
| 93 | double multiplier() const; | ||
| 94 | |||
| 95 | bool isMultiplierDefaulted() const; | ||
| 96 | |||
| 97 | boost::optional<double> numberofVertices() const; | ||
| 98 | |||
| 99 | bool isNumberofVerticesDefaulted() const; | ||
| 100 | |||
| 101 | bool isNumberofVerticesAutocalculated() const; | ||
| 102 | |||
| 103 | boost::optional<double> assemblyUFactor() const; | ||
| 104 | |||
| 105 | boost::optional<double> assemblySHGC() const; | ||
| 106 | |||
| 107 | boost::optional<double> assemblyVisibleTransmittance() const; | ||
| 108 | |||
| 109 | //@} | ||
| 110 | /** @name Setters */ | ||
| 111 | //@{ | ||
| 112 | |||
| 113 | bool setSubSurfaceType(const std::string& subSurfaceType); | ||
| 114 | |||
| 115 | void resetSubSurfaceType(); | ||
| 116 | |||
| 117 | bool setViewFactortoGround(boost::optional<double> viewFactortoGround); | ||
| 118 | |||
| 119 | bool setViewFactortoGround(double viewFactortoGround); | ||
| 120 | |||
| 121 | void resetViewFactortoGround(); | ||
| 122 | |||
| 123 | void autocalculateViewFactortoGround(); | ||
| 124 | |||
| 125 | // This method is deprecated, please use addShadingControl or addShadingControls. | ||
| 126 | // This will remove this SubSurface from any shading control(s) it is on (`removeAllShadingControls()`) then will call `addShadingControl(shadingControl)` | ||
| 127 | // NOTE: for backward compatibility with C++ interfaces, the argument is kept as `const ShadingControl&`, | ||
| 128 | // but internally this will do a const_cast since the ShadingControl will be mutated | ||
| 129 | OS_DEPRECATED(3, 1, 0) bool setShadingControl(const ShadingControl& shadingControl); | ||
| 130 | |||
| 131 | // Replaced with removeAllShadingControls | ||
| 132 | OS_DEPRECATED(3, 1, 0) void resetShadingControl(); | ||
| 133 | |||
| 134 | bool addShadingControl(ShadingControl& shadingControl); | ||
| 135 | |||
| 136 | bool addShadingControls(std::vector<ShadingControl>& shadingControls); | ||
| 137 | |||
| 138 | void removeShadingControl(ShadingControl& shadingControl); | ||
| 139 | |||
| 140 | void removeAllShadingControls(); | ||
| 141 | |||
| 142 | bool setWindowPropertyFrameAndDivider(const WindowPropertyFrameAndDivider& windowPropertyFrameAndDivider); | ||
| 143 | |||
| 144 | void resetWindowPropertyFrameAndDivider(); | ||
| 145 | |||
| 146 | bool setMultiplier(double multiplier); | ||
| 147 | |||
| 148 | void resetMultiplier(); | ||
| 149 | |||
| 150 | bool setNumberofVertices(boost::optional<double> numberofVertices); | ||
| 151 | |||
| 152 | bool setNumberofVertices(double numberofVertices); | ||
| 153 | |||
| 154 | void resetNumberofVertices(); | ||
| 155 | |||
| 156 | void autocalculateNumberofVertices(); | ||
| 157 | |||
| 158 | //@} | ||
| 159 | |||
| 160 | // TODO: test that area is correct with multiplier | ||
| 161 | |||
| 162 | /// get the surface | ||
| 163 | boost::optional<Surface> surface() const; | ||
| 164 | |||
| 165 | /// set the surface | ||
| 166 | bool setSurface(const Surface& surface); | ||
| 167 | |||
| 168 | /// get the adjacent subsurface | ||
| 169 | boost::optional<SubSurface> adjacentSubSurface() const; | ||
| 170 | |||
| 171 | /// set the adjacent subsurface, will fail unless both sub surfaces are parented by surfaces | ||
| 172 | /// which are adjacent | ||
| 173 | bool setAdjacentSubSurface(SubSurface& subSurface); | ||
| 174 | |||
| 175 | /// reset the adjacent subsurface, will clear references on both this and adjacent sub surface | ||
| 176 | void resetAdjacentSubSurface(); | ||
| 177 | |||
| 178 | /** Returns the SurfacePropertyConvectionCoefficients, if it exists. */ | ||
| 179 | // cppcheck-suppress [duplInheritedMember] because PlanarSurface is dumb and returns a vector | ||
| 180 | boost::optional<SurfacePropertyConvectionCoefficients> surfacePropertyConvectionCoefficients() const; | ||
| 181 | |||
| 182 | /** Returns the SurfacePropertyLocalEnvironment, if it exists. */ | ||
| 183 | boost::optional<SurfacePropertyLocalEnvironment> surfacePropertyLocalEnvironment() const; | ||
| 184 | |||
| 185 | /** Return the SurfacePropertyIncidentSolarMultiplier that points to this surface if any */ | ||
| 186 | boost::optional<SurfacePropertyIncidentSolarMultiplier> surfacePropertyIncidentSolarMultiplier() const; | ||
| 187 | |||
| 188 | /** Returns the adjacent SurfaceSurfacePropertyOtherSideCoefficients, if it exists. */ | ||
| 189 | boost::optional<SurfacePropertyOtherSideCoefficients> surfacePropertyOtherSideCoefficients() const; | ||
| 190 | |||
| 191 | /** Sets the SurfacePropertyOtherSideCoefficients. */ | ||
| 192 | bool setSurfacePropertyOtherSideCoefficients(const SurfacePropertyOtherSideCoefficients& otherSideCoefficients); | ||
| 193 | |||
| 194 | /** Resets the SurfacePropertyOtherSideCoefficients. */ | ||
| 195 | void resetSurfacePropertyOtherSideCoefficients(); | ||
| 196 | |||
| 197 | /** Returns the adjacent SurfacePropertyOtherSideConditionsModel, if it exists. */ | ||
| 198 | boost::optional<SurfacePropertyOtherSideConditionsModel> surfacePropertyOtherSideConditionsModel() const; | ||
| 199 | |||
| 200 | /** Sets the SurfacePropertyOtherSideConditionsModel. */ | ||
| 201 | bool setSurfacePropertyOtherSideConditionsModel(const SurfacePropertyOtherSideConditionsModel& otherSideModel); | ||
| 202 | |||
| 203 | /** Resets the SurfacePropertyOtherSideConditionsModel. */ | ||
| 204 | void resetSurfacePropertyOtherSideConditionsModel(); | ||
| 205 | |||
| 206 | /** Assign default sub surface type based on vertices. */ | ||
| 207 | void assignDefaultSubSurfaceType(); | ||
| 208 | |||
| 209 | /** Return the surface()'s outsideBoundaryCondition, or an empty string. */ | ||
| 210 | std::string outsideBoundaryCondition() const; | ||
| 211 | |||
| 212 | /** Add an overhang to the sub surface, only valid for fixed windows, operable windows, and glass doors. */ | ||
| 213 | // DLM: todo add argument for horizontal offset | ||
| 214 | boost::optional<ShadingSurface> addOverhang(double depth, double offset); | ||
| 215 | |||
| 216 | /** Add an overhang to the sub surface, only valid for fixed windows, operable windows, and glass doors. | ||
| 217 | * Offset is a fraction of the total window height, projection factor is based on height and offset. */ | ||
| 218 | // DLM: todo add argument for horizontal offset | ||
| 219 | boost::optional<ShadingSurface> addOverhangByProjectionFactor(double projectionFactor, double offsetFraction); | ||
| 220 | |||
| 221 | // DLM: todo add methods to create fins | ||
| 222 | |||
| 223 | /** Returns any shading surface groups associated with this sub surface. */ | ||
| 224 | std::vector<ShadingSurfaceGroup> shadingSurfaceGroups() const; | ||
| 225 | |||
| 226 | /** Returns true if this sub surface allows the addition of a daylighting light shelf. */ | ||
| 227 | bool allowDaylightingDeviceShelf() const; | ||
| 228 | |||
| 229 | /** Get the daylighting light shelf associated with this sub surface if there is one. */ | ||
| 230 | boost::optional<DaylightingDeviceShelf> daylightingDeviceShelf() const; | ||
| 231 | |||
| 232 | /** Add a new daylighting light shelf associated with this sub surface. Only succeeds if this is a fixed window, | ||
| 233 | * operable window, or glass door. Will return existing daylighting light shelf if there already is one. */ | ||
| 234 | boost::optional<DaylightingDeviceShelf> addDaylightingDeviceShelf() const; | ||
| 235 | |||
| 236 | /** Returns true if this sub surface allows the addition of a daylighting light tubular dome. */ | ||
| 237 | bool allowDaylightingDeviceTubularDome() const; | ||
| 238 | |||
| 239 | /** Returns true if this sub surface allows the addition of a daylighting light tubular diffuser. */ | ||
| 240 | bool allowDaylightingDeviceTubularDiffuser() const; | ||
| 241 | |||
| 242 | /** Get the daylighting light tubular associated with this sub surface if there is one. */ | ||
| 243 | boost::optional<DaylightingDeviceTubular> daylightingDeviceTubular() const; | ||
| 244 | |||
| 245 | /** Returns true if this sub surface allows the addition of a daylighting light light well. */ | ||
| 246 | bool allowDaylightingDeviceLightWell() const; | ||
| 247 | |||
| 248 | /** Get the daylighting light light well associated with this sub surface if there is one. */ | ||
| 249 | boost::optional<DaylightingDeviceLightWell> daylightingDeviceLightWell() const; | ||
| 250 | |||
| 251 | /** Add a new daylighting light well associated with this sub surface. Only succeeds if this is a fixed window, | ||
| 252 | * operable window, or glass door. Will return existing daylighting light well if there already is one. */ | ||
| 253 | boost::optional<DaylightingDeviceLightWell> addDaylightingDeviceLightWell() const; | ||
| 254 | |||
| 255 | AirflowNetworkSurface getAirflowNetworkSurface(const AirflowNetworkDetailedOpening& surfaceAirflowLeakage); | ||
| 256 | AirflowNetworkSurface getAirflowNetworkSurface(const AirflowNetworkSimpleOpening& surfaceAirflowLeakage); | ||
| 257 | AirflowNetworkSurface getAirflowNetworkSurface(const AirflowNetworkCrack& surfaceAirflowLeakage); | ||
| 258 | AirflowNetworkSurface getAirflowNetworkSurface(const AirflowNetworkEffectiveLeakageArea& surfaceAirflowLeakage); | ||
| 259 | AirflowNetworkSurface getAirflowNetworkSurface(const AirflowNetworkHorizontalOpening& surfaceAirflowLeakage); | ||
| 260 | AirflowNetworkSurface getAirflowNetworkSurface(const AirflowNetworkSpecifiedFlowRate& surfaceAirflowLeakage); | ||
| 261 | |||
| 262 | boost::optional<AirflowNetworkSurface> airflowNetworkSurface() const; | ||
| 263 | |||
| 264 | /* Get the total area of the sub surface rough area which includes the frame */ | ||
| 265 | double roughOpeningArea() const; | ||
| 266 | |||
| 267 | /* Get the rough opening vertices for the sub surface including the frame */ | ||
| 268 | std::vector<Point3d> roughOpeningVertices() const; | ||
| 269 | |||
| 270 | // Gets the total area of the frame | ||
| 271 | double frameArea() const; | ||
| 272 | |||
| 273 | // Gets the total area of the divider | ||
| 274 | double dividerArea() const; | ||
| 275 | |||
| 276 | // DLM: todo add methods to create light shelves by projection factor | ||
| 277 | |||
| 278 | //@} | ||
| 279 | /** @name Queries */ | ||
| 280 | //@{ | ||
| 281 | |||
| 282 | protected: | ||
| 283 | /// @cond | ||
| 284 | using ImplType = detail::SubSurface_Impl; | ||
| 285 | |||
| 286 | friend class Model; | ||
| 287 | friend class openstudio::IdfObject; | ||
| 288 | friend class openstudio::detail::IdfObject_Impl; | ||
| 289 | |||
| 290 | explicit SubSurface(std::shared_ptr<detail::SubSurface_Impl> impl); | ||
| 291 | |||
| 292 | /// @endcond | ||
| 293 | private: | ||
| 294 | − | REGISTER_LOGGER("openstudio.model.SubSurface"); | |
| 295 | }; | ||
| 296 | |||
| 297 | /// Applys a skylight pattern to exterior roofs in selected spaces. | ||
| 298 | /// Pattern should be in Building coordinates, on the z = 0 plane, with normal in positive z direction. | ||
| 299 | /// Returns new sub surfaces created. | ||
| 300 | MODEL_API std::vector<SubSurface> applySkylightPattern(const std::vector<std::vector<Point3d>>& pattern, const std::vector<Space>& spaces, | ||
| 301 | const boost::optional<ConstructionBase>& construction); | ||
| 302 | |||
| 303 | /** \relates SubSurface*/ | ||
| 304 | using OptionalSubSurface = boost::optional<SubSurface>; | ||
| 305 | |||
| 306 | /** \relates SubSurface*/ | ||
| 307 | using SubSurfaceVector = std::vector<SubSurface>; | ||
| 308 | |||
| 309 | } // namespace model | ||
| 310 | } // namespace openstudio | ||
| 311 | |||
| 312 | #endif // MODEL_SUBSURFACE_HPP | ||
| 313 |