src/model/GasMixture.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_GASMIXTURE_HPP | ||
| 7 | #define MODEL_GASMIXTURE_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 GasMixture_Impl; | ||
| 19 | |||
| 20 | } // namespace detail | ||
| 21 | |||
| 22 | /** GasMixture is a GasLayer that wraps the OpenStudio IDD object 'OS:WindowMaterial:GasMixture'. */ | ||
| 23 | class MODEL_API GasMixture : public GasLayer | ||
| 24 | { | ||
| 25 | public: | ||
| 26 | /** @name Constructors and Destructors */ | ||
| 27 | //@{ | ||
| 28 | |||
| 29 | explicit GasMixture(const Model& model, int numberofGasesinMixture = 4, double thickness = 0.003, | ||
| 30 | // Valid gas types: Air, Argon, Krypton, Xenon | ||
| 31 | std::string gas1Type = "Air", double gas1Fraction = .97, std::string gas2Type = "Argon", double gas2Fraction = 0.01, | ||
| 32 | std::string gas3Type = "Krypton", double gas3Fraction = 0.01, std::string gas4Type = "Xenon", double gas4Fraction = 0.01); | ||
| 33 | |||
| 34 | 7 | virtual ~GasMixture() override = default; | |
| 35 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 36 | ✗ | GasMixture(const GasMixture& other) = default; | |
| 37 | 2 | GasMixture(GasMixture&& other) = default; | |
| 38 | 1 | GasMixture& operator=(const GasMixture&) = default; | |
| 39 | ✗ | GasMixture& operator=(GasMixture&&) = default; | |
| 40 | |||
| 41 | //@} | ||
| 42 | /** @name Static Methods */ | ||
| 43 | //@{ | ||
| 44 | |||
| 45 | static std::vector<std::string> validGasTypes(); | ||
| 46 | |||
| 47 | static IddObjectType iddObjectType(); | ||
| 48 | |||
| 49 | static std::vector<std::string> gas1TypeValues(); | ||
| 50 | |||
| 51 | static std::vector<std::string> gas2TypeValues(); | ||
| 52 | |||
| 53 | static std::vector<std::string> gas3TypeValues(); | ||
| 54 | |||
| 55 | static std::vector<std::string> gas4TypeValues(); | ||
| 56 | |||
| 57 | //@} | ||
| 58 | /** @name Getters */ | ||
| 59 | //@{ | ||
| 60 | |||
| 61 | /** Get the type of gas at index, where index starts at 0. Throws if unavailable. */ | ||
| 62 | std::string getGasType(unsigned index) const; | ||
| 63 | |||
| 64 | /** Get the mixture fraction of the gas at index, where index starts at 0. Throws if | ||
| 65 | * unavailable. */ | ||
| 66 | double getGasFraction(unsigned index) const; | ||
| 67 | |||
| 68 | /** The conductivity (W/m*K) at temperature (K). */ | ||
| 69 | double getThermalConductivity(double temperature) const; | ||
| 70 | |||
| 71 | /** The conductance (W/m^2*K) at temperature (K). */ | ||
| 72 | double getThermalConductance(double temperature) const; | ||
| 73 | |||
| 74 | /** The resistivity (m*K/W) at temperature (K). */ | ||
| 75 | double getThermalResistivity(double temperature) const; | ||
| 76 | |||
| 77 | /** The resistance (m^2*K/W) at temperature (K). */ | ||
| 78 | double getThermalResistance(double temperature) const; | ||
| 79 | |||
| 80 | /** The viscosity (kg/m*s) of the mixture at temperature (K). */ | ||
| 81 | double getViscosity(double temperature) const; | ||
| 82 | |||
| 83 | /** The specific heat (J/kg*K) of the mixture at temperature (K). */ | ||
| 84 | double getSpecificHeat(double temperature) const; | ||
| 85 | |||
| 86 | double thickness() const; | ||
| 87 | |||
| 88 | int numberofGasesinMixture() const; | ||
| 89 | |||
| 90 | std::string gas1Type() const; | ||
| 91 | |||
| 92 | double gas1Fraction() const; | ||
| 93 | |||
| 94 | std::string gas2Type() const; | ||
| 95 | |||
| 96 | double gas2Fraction() const; | ||
| 97 | |||
| 98 | std::string gas3Type() const; | ||
| 99 | |||
| 100 | boost::optional<double> gas3Fraction() const; | ||
| 101 | |||
| 102 | std::string gas4Type() const; | ||
| 103 | |||
| 104 | boost::optional<double> gas4Fraction() const; | ||
| 105 | |||
| 106 | //@} | ||
| 107 | /** @name Setters */ | ||
| 108 | //@{ | ||
| 109 | |||
| 110 | /** Set the gas at index, if index <= numGases and index < 4. \sa validGasTypes */ | ||
| 111 | bool setGas(unsigned index, const std::string& type, double fraction); | ||
| 112 | |||
| 113 | /** Set the type of gas at index, if index < numGases. \sa validGasTypes */ | ||
| 114 | bool setGasType(unsigned index, const std::string& type); | ||
| 115 | |||
| 116 | /** Set the fraction of gas at index, if index < numGases. */ | ||
| 117 | bool setGasFraction(unsigned index, double fraction); | ||
| 118 | |||
| 119 | /** Append gas if numGases < 4. \sa validGasTypes */ | ||
| 120 | bool addGas(const std::string& type, double fraction); | ||
| 121 | |||
| 122 | /** Set the gas fractions. Length of vector should be equal to numGases, and sum should be | ||
| 123 | * openstudio::equal(1.0). If all fractions except the last is < 1.0, will set last fraction | ||
| 124 | * value if necessary (and issue warning). */ | ||
| 125 | bool setFractions(const std::vector<double>& fractions); | ||
| 126 | |||
| 127 | /** Assign gas fraction at index to 1.0 - sum(other gas fractions), if index < numGases. */ | ||
| 128 | bool balanceFractions(unsigned index); | ||
| 129 | |||
| 130 | bool setThickness(double thickness); | ||
| 131 | |||
| 132 | bool setNumberofGasesinMixture(int numberofGasesinMixture); | ||
| 133 | |||
| 134 | bool setGas1Type(const std::string& gas1Type); | ||
| 135 | |||
| 136 | void resetGas1Type(); | ||
| 137 | |||
| 138 | bool setGas1Fraction(double gas1Fraction); | ||
| 139 | |||
| 140 | void resetGas1Fraction(); | ||
| 141 | |||
| 142 | bool setGas2Type(const std::string& gas2Type); | ||
| 143 | |||
| 144 | void resetGas2Type(); | ||
| 145 | |||
| 146 | bool setGas2Fraction(double gas2Fraction); | ||
| 147 | |||
| 148 | void resetGas2Fraction(); | ||
| 149 | |||
| 150 | bool setGas3Type(const std::string& gas3Type); | ||
| 151 | |||
| 152 | void resetGas3Type(); | ||
| 153 | |||
| 154 | bool setGas3Fraction(double gas3Fraction); | ||
| 155 | |||
| 156 | void resetGas3Fraction(); | ||
| 157 | |||
| 158 | bool setGas4Type(const std::string& gas4Type); | ||
| 159 | |||
| 160 | void resetGas4Type(); | ||
| 161 | |||
| 162 | bool setGas4Fraction(double gas4Fraction); | ||
| 163 | |||
| 164 | void resetGas4Fraction(); | ||
| 165 | |||
| 166 | //@} | ||
| 167 | /** @name Queries */ | ||
| 168 | //@{ | ||
| 169 | |||
| 170 | unsigned numGases() const; | ||
| 171 | |||
| 172 | //@} | ||
| 173 | /** @name Other */ | ||
| 174 | //@{ | ||
| 175 | |||
| 176 | //@} | ||
| 177 | protected: | ||
| 178 | /// @cond | ||
| 179 | using ImplType = detail::GasMixture_Impl; | ||
| 180 | |||
| 181 | explicit GasMixture(std::shared_ptr<detail::GasMixture_Impl> impl); | ||
| 182 | |||
| 183 | friend class detail::GasMixture_Impl; | ||
| 184 | friend class Model; | ||
| 185 | friend class IdfObject; | ||
| 186 | friend class openstudio::detail::IdfObject_Impl; | ||
| 187 | /// @endcond | ||
| 188 | private: | ||
| 189 | REGISTER_LOGGER("openstudio.model.GasMixture"); | ||
| 190 | }; | ||
| 191 | |||
| 192 | /** \relates GasMixture*/ | ||
| 193 | using OptionalGasMixture = boost::optional<GasMixture>; | ||
| 194 | |||
| 195 | /** \relates GasMixture*/ | ||
| 196 | using GasMixtureVector = std::vector<GasMixture>; | ||
| 197 | |||
| 198 | } // namespace model | ||
| 199 | } // namespace openstudio | ||
| 200 | |||
| 201 | #endif // MODEL_GASMIXTURE_HPP | ||
| 202 |