src/model/Gas.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_GAS_HPP | ||
| 7 | #define MODEL_GAS_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "GasLayer.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | |||
| 14 | namespace model { | ||
| 15 | |||
| 16 | namespace detail { | ||
| 17 | |||
| 18 | class Gas_Impl; | ||
| 19 | |||
| 20 | } // namespace detail | ||
| 21 | |||
| 22 | /** Gas is a GasLayer that wraps the OpenStudio IDD object 'OS:WindowMaterial:Gas'. */ | ||
| 23 | class MODEL_API Gas : public GasLayer | ||
| 24 | { | ||
| 25 | public: | ||
| 26 | /** @name Constructors and Destructors */ | ||
| 27 | //@{ | ||
| 28 | |||
| 29 | explicit Gas(const Model& model, std::string gasType = "Air", double thickness = 0.003); | ||
| 30 | |||
| 31 | 228 | virtual ~Gas() override = default; | |
| 32 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 33 | ✗ | Gas(const Gas& other) = default; | |
| 34 | 2 | Gas(Gas&& other) = default; | |
| 35 | 1 | Gas& operator=(const Gas&) = default; | |
| 36 | ✗ | Gas& operator=(Gas&&) = default; | |
| 37 | |||
| 38 | //@} | ||
| 39 | /** @name Static Methods */ | ||
| 40 | //@{ | ||
| 41 | |||
| 42 | static std::vector<std::string> validGasTypes(); | ||
| 43 | |||
| 44 | static IddObjectType iddObjectType(); | ||
| 45 | |||
| 46 | static std::vector<std::string> gasTypeValues(); | ||
| 47 | |||
| 48 | //@} | ||
| 49 | |||
| 50 | /** @name Getters */ | ||
| 51 | //@{ | ||
| 52 | |||
| 53 | /** Gets the gas type. */ | ||
| 54 | std::string gasType() const; | ||
| 55 | |||
| 56 | /** The conductivity (W/m*K) at temperature (K). Will throw if gasType == "Custom" and | ||
| 57 | * necessary values are not available. */ | ||
| 58 | double getThermalConductivity(double temperature) const; | ||
| 59 | |||
| 60 | /** The conductance (W/m^2*K) at temperature (K). Will throw if gasType == "Custom" and | ||
| 61 | * necessary values are not available. */ | ||
| 62 | double getThermalConductance(double temperature) const; | ||
| 63 | |||
| 64 | /** The resistivity (m*K/W) at temperature (K). Will throw if gasType == "Custom" and | ||
| 65 | * necessary values are not available. */ | ||
| 66 | double getThermalResistivity(double temperature) const; | ||
| 67 | |||
| 68 | /** The resistance (m^2*K/W) at temperature (K). Will throw if gasType == "Custom" and | ||
| 69 | * necessary values are not available. */ | ||
| 70 | double getThermalResistance(double temperature) const; | ||
| 71 | |||
| 72 | /** The viscosity (kg/m*s) at temperature (K). Will throw if gasType == "Custom" and | ||
| 73 | * necessary values are not available. */ | ||
| 74 | double getViscosity(double temperature) const; | ||
| 75 | |||
| 76 | /** The specific heat (J/kg*K) at temperature (K). Will throw if gasType == "Custom" and | ||
| 77 | * necessary values are not available. */ | ||
| 78 | double getSpecificHeat(double temperature) const; | ||
| 79 | |||
| 80 | /** The first conductivity coefficient of gasType "Custom" (W/m*K). The conductivity (W/m*K) = | ||
| 81 | * A (W/m*K) + B (W/m*K^2) * temperature (K) + C (W/m*K^3) * temperature (K^2). */ | ||
| 82 | boost::optional<double> customConductivityCoefficientA() const; | ||
| 83 | |||
| 84 | /** The second conductivity coefficient of gasType "Custom" (W/m*K^2). The conductivity (W/m*K) = | ||
| 85 | * A (W/m*K) + B (W/m*K^2) * temperature (K) + C (W/m*K^3) * temperature (K^2). */ | ||
| 86 | boost::optional<double> customConductivityCoefficientB() const; | ||
| 87 | |||
| 88 | /** The third conductivity coefficient of gasType "Custom" (W/m*K^3). The conductivity (W/m*K) = | ||
| 89 | * A (W/m*K) + B (W/m*K^2) * temperature (K) + C (W/m*K^3) * temperature (K^2). */ | ||
| 90 | boost::optional<double> customConductivityCoefficientC() const; | ||
| 91 | |||
| 92 | /** The first viscosity coefficient of gasType "Custom" (kg/m*s). The viscosity (kg/m*s) = | ||
| 93 | * A (kg/m*s) + B (kg/m*s*K) * temperature (K) + C (kg/m*s*K^2) * temperature (K^2). */ | ||
| 94 | boost::optional<double> customViscosityCoefficientA() const; | ||
| 95 | |||
| 96 | /** The second viscosity coefficient of gasType "Custom" (kg/m*s). The viscosity (kg/m*s) = | ||
| 97 | * A (kg/m*s) + B (kg/m*s*K) * temperature (K) + C (kg/m*s*K^2) * temperature (K^2). */ | ||
| 98 | boost::optional<double> customViscosityCoefficientB() const; | ||
| 99 | |||
| 100 | /** The third viscosity coefficient of gasType "Custom" (kg/m*s). The viscosity (kg/m*s) = | ||
| 101 | * A (kg/m*s) + B (kg/m*s*K) * temperature (K) + C (kg/m*s*K^2) * temperature (K^2). */ | ||
| 102 | boost::optional<double> customViscosityCoefficientC() const; | ||
| 103 | |||
| 104 | /** The first specific heat coefficient of gasType "Custom" (J/kg*K). The specific heat (J/kg*K) | ||
| 105 | * = A (J/kg*K) + B (J/kg*K^2) * temperature (K) + C (J/kg*K^3) * temperature (K^2). */ | ||
| 106 | boost::optional<double> customSpecificHeatCoefficientA() const; | ||
| 107 | |||
| 108 | /** The second specific heat coefficient of gasType "Custom" (J/kg*K). The specific heat (J/kg*K) | ||
| 109 | * = A (J/kg*K) + B (J/kg*K^2) * temperature (K) + C (J/kg*K^3) * temperature (K^2). */ | ||
| 110 | boost::optional<double> customSpecificHeatCoefficientB() const; | ||
| 111 | |||
| 112 | /** The third specific heat coefficient of gasType "Custom" (J/kg*K). The specific heat (J/kg*K) | ||
| 113 | * = A (J/kg*K) + B (J/kg*K^2) * temperature (K) + C (J/kg*K^3) * temperature (K^2). */ | ||
| 114 | boost::optional<double> customSpecificHeatCoefficientC() const; | ||
| 115 | |||
| 116 | /** The molecular weight (u) of gasType "Custom". */ | ||
| 117 | boost::optional<double> customMolecularWeight() const; | ||
| 118 | |||
| 119 | boost::optional<double> specificHeatRatio() const; | ||
| 120 | |||
| 121 | double thickness() const; | ||
| 122 | |||
| 123 | boost::optional<double> conductivityCoefficientA() const; | ||
| 124 | |||
| 125 | boost::optional<double> conductivityCoefficientB() const; | ||
| 126 | |||
| 127 | boost::optional<double> conductivityCoefficientC() const; | ||
| 128 | |||
| 129 | boost::optional<double> viscosityCoefficientA() const; | ||
| 130 | |||
| 131 | boost::optional<double> viscosityCoefficientB() const; | ||
| 132 | |||
| 133 | boost::optional<double> viscosityCoefficientC() const; | ||
| 134 | |||
| 135 | boost::optional<double> specificHeatCoefficientA() const; | ||
| 136 | |||
| 137 | boost::optional<double> specificHeatCoefficientB() const; | ||
| 138 | |||
| 139 | boost::optional<double> specificHeatCoefficientC() const; | ||
| 140 | |||
| 141 | boost::optional<double> molecularWeight() const; | ||
| 142 | |||
| 143 | //@} | ||
| 144 | /** @name Setters */ | ||
| 145 | //@{ | ||
| 146 | |||
| 147 | /** If gasType() == "Custom", thermalConductivity (W/m*K) = A + B*temperature + C*temperature^2. */ | ||
| 148 | bool setCustomConductivity(double A, double B, double C); | ||
| 149 | |||
| 150 | /** If gasType() == "Custom", viscosity (g/m*s) = A + B*temperature + C*temperature^2. */ | ||
| 151 | bool setCustomViscosity(double A, double B, double C); | ||
| 152 | |||
| 153 | /** If gasType() == "Custom", specific heat (J/kg*K) = A + B*temperature + C*temperature^2. */ | ||
| 154 | bool setCustomSpecificHeat(double A, double B, double C); | ||
| 155 | |||
| 156 | /** If gasType() == "Custom", specifies the molecular weight of the gas. */ | ||
| 157 | bool setCustomMolecularWeight(double value); | ||
| 158 | |||
| 159 | bool setGasType(const std::string& gasType); | ||
| 160 | |||
| 161 | bool setThickness(double thickness); | ||
| 162 | |||
| 163 | bool setConductivityCoefficientA(double conductivityCoefficientA); | ||
| 164 | |||
| 165 | void resetConductivityCoefficientA(); | ||
| 166 | |||
| 167 | bool setConductivityCoefficientB(double conductivityCoefficientB); | ||
| 168 | |||
| 169 | void resetConductivityCoefficientB(); | ||
| 170 | |||
| 171 | bool setConductivityCoefficientC(double conductivityCoefficientC); | ||
| 172 | |||
| 173 | void resetConductivityCoefficientC(); | ||
| 174 | |||
| 175 | bool setViscosityCoefficientA(double viscosityCoefficientA); | ||
| 176 | |||
| 177 | void resetViscosityCoefficientA(); | ||
| 178 | |||
| 179 | bool setViscosityCoefficientB(double viscosityCoefficientB); | ||
| 180 | |||
| 181 | void resetViscosityCoefficientB(); | ||
| 182 | |||
| 183 | bool setViscosityCoefficientC(double viscosityCoefficientC); | ||
| 184 | |||
| 185 | void resetViscosityCoefficientC(); | ||
| 186 | |||
| 187 | bool setSpecificHeatCoefficientA(double specificHeatCoefficientA); | ||
| 188 | |||
| 189 | void resetSpecificHeatCoefficientA(); | ||
| 190 | |||
| 191 | bool setSpecificHeatCoefficientB(double specificHeatCoefficientB); | ||
| 192 | |||
| 193 | void resetSpecificHeatCoefficientB(); | ||
| 194 | |||
| 195 | bool setSpecificHeatCoefficientC(double specificHeatCoefficientC); | ||
| 196 | |||
| 197 | void resetSpecificHeatCoefficientC(); | ||
| 198 | |||
| 199 | bool setMolecularWeight(double molecularWeight); | ||
| 200 | |||
| 201 | void resetMolecularWeight(); | ||
| 202 | |||
| 203 | bool setSpecificHeatRatio(double specificHeatRatio); | ||
| 204 | |||
| 205 | void resetSpecificHeatRatio(); | ||
| 206 | |||
| 207 | //@} | ||
| 208 | /** @name Other */ | ||
| 209 | //@{ | ||
| 210 | |||
| 211 | //@} | ||
| 212 | protected: | ||
| 213 | /// @cond | ||
| 214 | using ImplType = detail::Gas_Impl; | ||
| 215 | |||
| 216 | explicit Gas(std::shared_ptr<detail::Gas_Impl> impl); | ||
| 217 | |||
| 218 | friend class detail::Gas_Impl; | ||
| 219 | friend class Model; | ||
| 220 | friend class IdfObject; | ||
| 221 | friend class openstudio::detail::IdfObject_Impl; | ||
| 222 | /// @endcond | ||
| 223 | private: | ||
| 224 | REGISTER_LOGGER("openstudio.model.Gas"); | ||
| 225 | }; | ||
| 226 | |||
| 227 | /** \relates Gas*/ | ||
| 228 | using OptionalGas = boost::optional<Gas>; | ||
| 229 | |||
| 230 | /** \relates Gas*/ | ||
| 231 | using GasVector = std::vector<Gas>; | ||
| 232 | |||
| 233 | } // namespace model | ||
| 234 | } // namespace openstudio | ||
| 235 | |||
| 236 | #endif // MODEL_GAS_HPP | ||
| 237 |