GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 63.8% 291 / 0 / 456
Functions: 73.6% 92 / 0 / 125
Branches: 29.1% 146 / 0 / 501

src/model/Gas.cpp
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 #include "Gas.hpp"
7 #include "Gas_Impl.hpp"
8
9 #include "../utilities/idf/ValidityReport.hpp"
10
11 #include <utilities/idd/IddFactory.hxx>
12
13 #include <utilities/idd/OS_WindowMaterial_Gas_FieldEnums.hxx>
14 #include <utilities/idd/IddEnums.hxx>
15
16 #include "../utilities/units/Unit.hpp"
17
18 #include "../utilities/core/Assert.hpp"
19
20 namespace openstudio {
21 namespace model {
22
23 namespace detail {
24
25 222 Gas_Impl::Gas_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) : GasLayer_Impl(idfObject, model, keepHandle) {
26
4/6
✓ Branch 1 taken 222 times.
✓ Branch 4 taken 222 times.
✓ Branch 7 taken 222 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 222 times.
✗ Branch 13 not taken.
222 OS_ASSERT(idfObject.iddObject().type() == Gas::iddObjectType());
27 222 }
28
29 32 Gas_Impl::Gas_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
30 32 : GasLayer_Impl(other, model, keepHandle) {
31
4/6
✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
✓ Branch 7 taken 32 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 32 times.
✗ Branch 13 not taken.
32 OS_ASSERT(other.iddObject().type() == Gas::iddObjectType());
32 32 }
33
34 65 Gas_Impl::Gas_Impl(const Gas_Impl& other, Model_Impl* model, bool keepHandle) : GasLayer_Impl(other, model, keepHandle) {}
35
36 1 const std::vector<std::string>& Gas_Impl::outputVariableNames() const {
37
2/4
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
1 static const std::vector<std::string> result;
38 1 return result;
39 }
40
41 ✗ IddObjectType Gas_Impl::iddObjectType() const {
42 ✗ return Gas::iddObjectType();
43 }
44
45 75 std::string Gas_Impl::gasType() const {
46
1/1
✓ Branch 1 taken 75 times.
75 boost::optional<std::string> value = getString(OS_WindowMaterial_GasFields::GasType, true);
47
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 75 times.
✗ Branch 4 not taken.
75 OS_ASSERT(value);
48
2/2
✓ Branch 1 taken 75 times.
✓ Branch 4 taken 75 times.
150 return value.get();
49 75 }
50
51 37 double Gas_Impl::thickness() const {
52
1/1
✓ Branch 1 taken 37 times.
37 boost::optional<double> value = getDouble(OS_WindowMaterial_GasFields::Thickness, true);
53
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
✗ Branch 4 not taken.
37 OS_ASSERT(value);
54
1/1
✓ Branch 1 taken 37 times.
74 return value.get();
55 }
56
57 ✗ double Gas_Impl::getThermalConductivity(double temperature) const {
58 ✗ std::string gasType = this->gasType();
59 ✗ std::vector<double> coeffs;
60 ✗ if (openstudio::istringEqual(gasType, "Air")) {
61 ✗ coeffs = FenestrationMaterial::airThermalConductivityCoefficients();
62 ✗ } else if (openstudio::istringEqual(gasType, "Argon")) {
63 ✗ coeffs = FenestrationMaterial::argonThermalConductivityCoefficients();
64 ✗ } else if (openstudio::istringEqual(gasType, "Krypton")) {
65 ✗ coeffs = FenestrationMaterial::kryptonThermalConductivityCoefficients();
66 ✗ } else if (openstudio::istringEqual(gasType, "Xenon")) {
67 ✗ coeffs = FenestrationMaterial::xenonThermalConductivityCoefficients();
68 ✗ } else if (openstudio::istringEqual(gasType, "Custom")) {
69 ✗ OptionalDouble A = customConductivityCoefficientA();
70 ✗ OptionalDouble B = customConductivityCoefficientB();
71 ✗ OptionalDouble C = customConductivityCoefficientC();
72 ✗ if (!(A && B && C)) {
73 ✗ LOG_AND_THROW("Model" << briefDescription() << " has gasType == 'Custom', but no "
74 << "conductivity coefficients set. Cannot calculate thermal conductivity.");
75 }
76 ✗ coeffs[0] = *A;
77 ✗ coeffs[1] = *B;
78 ✗ coeffs[2] = *C;
79 } else {
80 ✗ LOG_AND_THROW("Unknown gasType listed in " << briefDescription() << ".");
81 }
82
83 ✗ return coeffs[0] + (coeffs[1] * temperature) + (coeffs[2] * ::pow(temperature, 2));
84 ✗ }
85
86 ✗ double Gas_Impl::getThermalConductance(double temperature) const {
87 ✗ return getThermalConductivity(temperature) / thickness();
88 }
89
90 ✗ double Gas_Impl::getThermalResistivity(double temperature) const {
91 ✗ return 1.0 / getThermalConductivity(temperature);
92 }
93
94 ✗ double Gas_Impl::getThermalResistance(double temperature) const {
95 ✗ return 1.0 / getThermalConductance(temperature);
96 }
97
98 ✗ double Gas_Impl::getViscosity(double temperature) const {
99 ✗ std::string gasType = this->gasType();
100 ✗ std::vector<double> coeffs(3);
101 ✗ if (openstudio::istringEqual(gasType, "Air")) {
102 ✗ coeffs = FenestrationMaterial::airViscosityCoefficients();
103 ✗ } else if (openstudio::istringEqual(gasType, "Argon")) {
104 ✗ coeffs = FenestrationMaterial::argonViscosityCoefficients();
105 ✗ } else if (openstudio::istringEqual(gasType, "Krypton")) {
106 ✗ coeffs = FenestrationMaterial::kryptonViscosityCoefficients();
107 ✗ } else if (openstudio::istringEqual(gasType, "Xenon")) {
108 ✗ coeffs = FenestrationMaterial::xenonViscosityCoefficients();
109 ✗ } else if (openstudio::istringEqual(gasType, "Custom")) {
110 ✗ OptionalDouble A = customViscosityCoefficientA();
111 ✗ OptionalDouble B = customViscosityCoefficientB();
112 ✗ OptionalDouble C = customViscosityCoefficientC();
113 ✗ if (!(A && B && C)) {
114 ✗ LOG_AND_THROW("Gas " << briefDescription() << " has gasType == 'Custom', but no "
115 << "viscosity coefficients set. Cannot calculate viscosity.");
116 }
117 ✗ coeffs[0] = *A;
118 ✗ coeffs[1] = *B;
119 ✗ coeffs[2] = *C;
120 } else {
121 ✗ LOG_AND_THROW("Unknown gasType listed in " << briefDescription() << ".");
122 }
123
124 ✗ return coeffs[0] + (coeffs[1] * temperature) + (coeffs[2] * ::pow(temperature, 2));
125 ✗ }
126
127 ✗ double Gas_Impl::getSpecificHeat(double temperature) const {
128 ✗ std::string gasType = this->gasType();
129 ✗ std::vector<double> coeffs;
130 ✗ if (openstudio::istringEqual(gasType, "Air")) {
131 ✗ coeffs = FenestrationMaterial::airSpecificHeatCoefficients();
132 ✗ } else if (openstudio::istringEqual(gasType, "Argon")) {
133 ✗ coeffs = FenestrationMaterial::argonSpecificHeatCoefficients();
134 ✗ } else if (openstudio::istringEqual(gasType, "Krypton")) {
135 ✗ coeffs = FenestrationMaterial::kryptonSpecificHeatCoefficients();
136 ✗ } else if (openstudio::istringEqual(gasType, "Xenon")) {
137 ✗ coeffs = FenestrationMaterial::xenonSpecificHeatCoefficients();
138 ✗ } else if (openstudio::istringEqual(gasType, "Custom")) {
139 ✗ OptionalDouble A = customSpecificHeatCoefficientA();
140 ✗ OptionalDouble B = customSpecificHeatCoefficientB();
141 ✗ OptionalDouble C = customSpecificHeatCoefficientC();
142 ✗ if (!(A && B && C)) {
143 ✗ LOG_AND_THROW("Model" << briefDescription() << " has gasType == 'Custom', but no "
144 << "specific heat coefficients set. Cannot calculate specific heat.");
145 }
146 ✗ coeffs[0] = *A;
147 ✗ coeffs[1] = *B;
148 ✗ coeffs[2] = *C;
149 } else {
150 ✗ LOG_AND_THROW("Unknown gasType listed in " << briefDescription() << ".");
151 }
152
153 ✗ return coeffs[0] + (coeffs[1] * temperature) + (coeffs[2] * ::pow(temperature, 2));
154 ✗ }
155
156 1 boost::optional<double> Gas_Impl::customConductivityCoefficientA() const {
157 1 return getDouble(OS_WindowMaterial_GasFields::ConductivityCoefficientA, true);
158 }
159
160 ✗ boost::optional<double> Gas_Impl::customConductivityCoefficientB() const {
161 ✗ return getDouble(OS_WindowMaterial_GasFields::ConductivityCoefficientB, true);
162 }
163
164 ✗ boost::optional<double> Gas_Impl::customConductivityCoefficientC() const {
165 ✗ return getDouble(OS_WindowMaterial_GasFields::ConductivityCoefficientC, true);
166 }
167
168 1 boost::optional<double> Gas_Impl::customViscosityCoefficientA() const {
169 1 return getDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientA, true);
170 }
171
172 ✗ boost::optional<double> Gas_Impl::customViscosityCoefficientB() const {
173 ✗ return getDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientB, true);
174 }
175
176 ✗ boost::optional<double> Gas_Impl::customViscosityCoefficientC() const {
177 ✗ return getDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientC, true);
178 }
179
180 1 boost::optional<double> Gas_Impl::customSpecificHeatCoefficientA() const {
181 1 return getDouble(OS_WindowMaterial_GasFields::SpecificHeatCoefficientA, true);
182 }
183
184 ✗ boost::optional<double> Gas_Impl::customSpecificHeatCoefficientB() const {
185 ✗ return getDouble(OS_WindowMaterial_GasFields::SpecificHeatCoefficientB, true);
186 }
187
188 ✗ boost::optional<double> Gas_Impl::customSpecificHeatCoefficientC() const {
189 ✗ return getDouble(OS_WindowMaterial_GasFields::SpecificHeatCoefficientC, true);
190 }
191
192 ✗ boost::optional<double> Gas_Impl::customMolecularWeight() const {
193 ✗ return getDouble(OS_WindowMaterial_GasFields::MolecularWeight, true);
194 }
195
196 1 bool Gas_Impl::setCustomConductivity(double A, double B, double C) {
197
198
1/1
✓ Branch 1 taken 1 time.
1 OptionalDouble oldAValue = customConductivityCoefficientA();
199
1/1
✓ Branch 1 taken 1 time.
1 bool result = setDouble(OS_WindowMaterial_GasFields::ConductivityCoefficientA, A);
200
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (!result) {
201 ✗ return false;
202 }
203
204
1/1
✓ Branch 1 taken 1 time.
1 result = setDouble(OS_WindowMaterial_GasFields::ConductivityCoefficientB, B);
205
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (!result) {
206 // reset A to previous value
207 ✗ if (oldAValue) {
208 ✗ setDouble(OS_WindowMaterial_GasFields::ConductivityCoefficientA, *oldAValue);
209 } else {
210 ✗ setString(OS_WindowMaterial_GasFields::ConductivityCoefficientA, "");
211 }
212 }
213
214
1/1
✓ Branch 1 taken 1 time.
1 setDouble(OS_WindowMaterial_GasFields::ConductivityCoefficientC, C);
215
216 1 return result;
217 }
218
219 1 bool Gas_Impl::setCustomViscosity(double A, double B, double C) {
220
1/1
✓ Branch 1 taken 1 time.
1 OptionalDouble oldAValue = customViscosityCoefficientA();
221
1/1
✓ Branch 1 taken 1 time.
1 bool result = setDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientA, A);
222
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (!result) {
223 ✗ return false;
224 }
225
226
1/1
✓ Branch 1 taken 1 time.
1 result = setDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientB, B);
227
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (!result) {
228 // reset A to previous value
229 ✗ if (oldAValue) {
230 ✗ setDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientA, *oldAValue);
231 } else {
232 ✗ setString(OS_WindowMaterial_GasFields::ViscosityCoefficientA, "");
233 }
234 }
235
236
1/1
✓ Branch 1 taken 1 time.
1 setDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientC, C);
237
238 1 return result;
239 }
240
241 1 bool Gas_Impl::setCustomSpecificHeat(double A, double B, double C) {
242
1/1
✓ Branch 1 taken 1 time.
1 OptionalDouble oldAValue = customSpecificHeatCoefficientA();
243
1/1
✓ Branch 1 taken 1 time.
1 bool result = setDouble(OS_WindowMaterial_GasFields::SpecificHeatCoefficientA, A);
244
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (!result) {
245 ✗ return false;
246 }
247
248
1/1
✓ Branch 1 taken 1 time.
1 result = setDouble(OS_WindowMaterial_GasFields::SpecificHeatCoefficientB, B);
249
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (!result) {
250 // reset A to previous value
251 ✗ if (oldAValue) {
252 ✗ setDouble(OS_WindowMaterial_GasFields::SpecificHeatCoefficientA, *oldAValue);
253 } else {
254 ✗ setString(OS_WindowMaterial_GasFields::SpecificHeatCoefficientA, "");
255 }
256 }
257
258
1/1
✓ Branch 1 taken 1 time.
1 setDouble(OS_WindowMaterial_GasFields::SpecificHeatCoefficientC, C);
259
260 1 return result;
261 }
262
263 1 bool Gas_Impl::setCustomMolecularWeight(double value) {
264 1 return setDouble(OS_WindowMaterial_GasFields::MolecularWeight, value);
265 }
266
267 3 boost::optional<double> Gas_Impl::conductivityCoefficientA() const {
268 3 return getDouble(OS_WindowMaterial_GasFields::ConductivityCoefficientA, true);
269 }
270
271 3 boost::optional<double> Gas_Impl::conductivityCoefficientB() const {
272 3 return getDouble(OS_WindowMaterial_GasFields::ConductivityCoefficientB, true);
273 }
274
275 3 boost::optional<double> Gas_Impl::conductivityCoefficientC() const {
276 3 return getDouble(OS_WindowMaterial_GasFields::ConductivityCoefficientC, true);
277 }
278
279 3 boost::optional<double> Gas_Impl::viscosityCoefficientA() const {
280 3 return getDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientA, true);
281 }
282
283 3 boost::optional<double> Gas_Impl::viscosityCoefficientB() const {
284 3 return getDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientB, true);
285 }
286
287 3 boost::optional<double> Gas_Impl::viscosityCoefficientC() const {
288 3 return getDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientC, true);
289 }
290
291 3 boost::optional<double> Gas_Impl::specificHeatCoefficientA() const {
292 3 return getDouble(OS_WindowMaterial_GasFields::SpecificHeatCoefficientA, true);
293 }
294
295 3 boost::optional<double> Gas_Impl::specificHeatCoefficientB() const {
296 3 return getDouble(OS_WindowMaterial_GasFields::SpecificHeatCoefficientB, true);
297 }
298
299 3 boost::optional<double> Gas_Impl::specificHeatCoefficientC() const {
300 3 return getDouble(OS_WindowMaterial_GasFields::SpecificHeatCoefficientC, true);
301 }
302
303 3 boost::optional<double> Gas_Impl::molecularWeight() const {
304 3 return getDouble(OS_WindowMaterial_GasFields::MolecularWeight, true);
305 }
306
307 3 boost::optional<double> Gas_Impl::specificHeatRatio() const {
308 3 return getDouble(OS_WindowMaterial_GasFields::SpecificHeatRatio, true);
309 }
310
311 377 bool Gas_Impl::setGasType(const std::string& gasType) {
312 377 bool result = setString(OS_WindowMaterial_GasFields::GasType, gasType);
313 377 return result;
314 }
315
316 372 bool Gas_Impl::setThickness(double thickness) {
317 372 bool result = setDouble(OS_WindowMaterial_GasFields::Thickness, thickness);
318 372 return result;
319 }
320
321 1 bool Gas_Impl::setConductivityCoefficientA(boost::optional<double> conductivityCoefficientA) {
322 1 bool result(false);
323
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (conductivityCoefficientA) {
324 1 result = setDouble(OS_WindowMaterial_GasFields::ConductivityCoefficientA, conductivityCoefficientA.get());
325 } else {
326 ✗ resetConductivityCoefficientA();
327 ✗ result = true;
328 }
329
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
330 1 return result;
331 }
332
333 1 void Gas_Impl::resetConductivityCoefficientA() {
334
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_WindowMaterial_GasFields::ConductivityCoefficientA, "");
335
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
336 1 }
337
338 1 bool Gas_Impl::setConductivityCoefficientB(boost::optional<double> conductivityCoefficientB) {
339 1 bool result(false);
340
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (conductivityCoefficientB) {
341 1 result = setDouble(OS_WindowMaterial_GasFields::ConductivityCoefficientB, conductivityCoefficientB.get());
342 } else {
343 ✗ resetConductivityCoefficientB();
344 ✗ result = true;
345 }
346
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
347 1 return result;
348 }
349
350 1 void Gas_Impl::resetConductivityCoefficientB() {
351
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_WindowMaterial_GasFields::ConductivityCoefficientB, "");
352
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
353 1 }
354
355 1 bool Gas_Impl::setConductivityCoefficientC(boost::optional<double> conductivityCoefficientC) {
356 1 bool result(false);
357
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (conductivityCoefficientC) {
358 1 result = setDouble(OS_WindowMaterial_GasFields::ConductivityCoefficientC, conductivityCoefficientC.get());
359 } else {
360 ✗ resetConductivityCoefficientC();
361 ✗ result = true;
362 }
363
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
364 1 return result;
365 }
366
367 1 void Gas_Impl::resetConductivityCoefficientC() {
368
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_WindowMaterial_GasFields::ConductivityCoefficientC, "");
369
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
370 1 }
371
372 1 bool Gas_Impl::setViscosityCoefficientA(boost::optional<double> viscosityCoefficientA) {
373 1 bool result(false);
374
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (viscosityCoefficientA) {
375 1 result = setDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientA, viscosityCoefficientA.get());
376 } else {
377 ✗ resetViscosityCoefficientA();
378 ✗ result = true;
379 }
380 1 return result;
381 }
382
383 1 void Gas_Impl::resetViscosityCoefficientA() {
384
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_WindowMaterial_GasFields::ViscosityCoefficientA, "");
385
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
386 1 }
387
388 1 bool Gas_Impl::setViscosityCoefficientB(boost::optional<double> viscosityCoefficientB) {
389 1 bool result(false);
390
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (viscosityCoefficientB) {
391 1 result = setDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientB, viscosityCoefficientB.get());
392 } else {
393 ✗ resetViscosityCoefficientB();
394 ✗ result = true;
395 }
396
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
397 1 return result;
398 }
399
400 1 void Gas_Impl::resetViscosityCoefficientB() {
401
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_WindowMaterial_GasFields::ViscosityCoefficientB, "");
402
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
403 1 }
404
405 1 bool Gas_Impl::setViscosityCoefficientC(boost::optional<double> viscosityCoefficientC) {
406 1 bool result(false);
407
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (viscosityCoefficientC) {
408 1 result = setDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientC, viscosityCoefficientC.get());
409 } else {
410 ✗ resetViscosityCoefficientC();
411 ✗ result = true;
412 }
413
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
414 1 return result;
415 }
416
417 1 void Gas_Impl::resetViscosityCoefficientC() {
418
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_WindowMaterial_GasFields::ViscosityCoefficientC, "");
419
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
420 1 }
421
422 1 bool Gas_Impl::setSpecificHeatCoefficientA(boost::optional<double> specificHeatCoefficientA) {
423 1 bool result(false);
424
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (specificHeatCoefficientA) {
425 1 result = setDouble(OS_WindowMaterial_GasFields::SpecificHeatCoefficientA, specificHeatCoefficientA.get());
426 } else {
427 ✗ resetSpecificHeatCoefficientA();
428 ✗ result = true;
429 }
430 1 return result;
431 }
432
433 1 void Gas_Impl::resetSpecificHeatCoefficientA() {
434
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_WindowMaterial_GasFields::SpecificHeatCoefficientA, "");
435
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
436 1 }
437
438 1 bool Gas_Impl::setSpecificHeatCoefficientB(boost::optional<double> specificHeatCoefficientB) {
439 1 bool result(false);
440
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (specificHeatCoefficientB) {
441 1 result = setDouble(OS_WindowMaterial_GasFields::SpecificHeatCoefficientB, specificHeatCoefficientB.get());
442 } else {
443 ✗ resetSpecificHeatCoefficientB();
444 ✗ result = true;
445 }
446
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
447 1 return result;
448 }
449
450 1 void Gas_Impl::resetSpecificHeatCoefficientB() {
451
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_WindowMaterial_GasFields::SpecificHeatCoefficientB, "");
452
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
453 1 }
454
455 1 bool Gas_Impl::setSpecificHeatCoefficientC(boost::optional<double> specificHeatCoefficientC) {
456 1 bool result(false);
457
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (specificHeatCoefficientC) {
458 1 result = setDouble(OS_WindowMaterial_GasFields::SpecificHeatCoefficientC, specificHeatCoefficientC.get());
459 } else {
460 ✗ resetSpecificHeatCoefficientC();
461 ✗ result = true;
462 }
463
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
464 1 return result;
465 }
466
467 1 void Gas_Impl::resetSpecificHeatCoefficientC() {
468
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_WindowMaterial_GasFields::SpecificHeatCoefficientC, "");
469
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
470 1 }
471
472 1 bool Gas_Impl::setMolecularWeight(boost::optional<double> molecularWeight) {
473 1 bool result(false);
474
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (molecularWeight) {
475 1 result = setDouble(OS_WindowMaterial_GasFields::MolecularWeight, molecularWeight.get());
476 } else {
477 ✗ resetMolecularWeight();
478 ✗ result = true;
479 }
480 1 return result;
481 }
482
483 1 void Gas_Impl::resetMolecularWeight() {
484
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_WindowMaterial_GasFields::MolecularWeight, "");
485
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
486 1 }
487
488 1 bool Gas_Impl::setSpecificHeatRatio(boost::optional<double> specificHeatRatio) {
489 1 bool result(false);
490
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (specificHeatRatio) {
491 1 result = setDouble(OS_WindowMaterial_GasFields::SpecificHeatRatio, specificHeatRatio.get());
492 } else {
493 ✗ resetSpecificHeatRatio();
494 ✗ result = true;
495 }
496 1 return result;
497 }
498
499 1 void Gas_Impl::resetSpecificHeatRatio() {
500
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_WindowMaterial_GasFields::SpecificHeatRatio, "");
501
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
502 1 }
503
504 ✗ std::vector<std::string> Gas_Impl::gasTypeValues() const {
505 ✗ return Gas::gasTypeValues();
506 }
507
508 } // namespace detail
509
510 189 Gas::Gas(const Model& model, std::string gasType, double thickness) : GasLayer(Gas::iddObjectType(), model) {
511
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 189 times.
✗ Branch 5 not taken.
189 OS_ASSERT(getImpl<detail::Gas_Impl>());
512
513 // TODO: Appropriately handle the following required object-list fields.
514 189 bool ok = true;
515 // ok = setHandle();
516
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
✗ Branch 3 not taken.
189 OS_ASSERT(ok);
517
1/1
✓ Branch 1 taken 189 times.
189 ok = setGasType(gasType);
518
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
✗ Branch 3 not taken.
189 OS_ASSERT(ok);
519
1/1
✓ Branch 1 taken 189 times.
189 ok = setThickness(thickness);
520
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
✗ Branch 3 not taken.
189 OS_ASSERT(ok);
521 189 }
522
523 ✗ std::vector<std::string> Gas::validGasTypes() {
524 ✗ static const StringVector result = getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_WindowMaterial_GasFields::GasType);
525 ✗ OS_ASSERT(!result.empty());
526 ✗ return result;
527 }
528
529 8043 IddObjectType Gas::iddObjectType() {
530
1/1
✓ Branch 1 taken 8043 times.
8043 return {IddObjectType::OS_WindowMaterial_Gas};
531 }
532
533 ✗ std::vector<std::string> Gas::gasTypeValues() {
534 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_WindowMaterial_GasFields::GasType);
535 }
536
537 75 std::string Gas::gasType() const {
538
1/1
✓ Branch 3 taken 75 times.
75 return getImpl<detail::Gas_Impl>()->gasType();
539 }
540
541 ✗ double Gas::getThermalConductivity(double temperature) const {
542 ✗ return getImpl<detail::Gas_Impl>()->getThermalConductivity(temperature);
543 }
544
545 ✗ double Gas::getThermalConductance(double temperature) const {
546 ✗ return getImpl<detail::Gas_Impl>()->getThermalConductance(temperature);
547 }
548
549 ✗ double Gas::getThermalResistivity(double temperature) const {
550 ✗ return getImpl<detail::Gas_Impl>()->getThermalResistivity(temperature);
551 }
552
553 ✗ double Gas::getThermalResistance(double temperature) const {
554 ✗ return getImpl<detail::Gas_Impl>()->getThermalResistance(temperature);
555 }
556
557 ✗ double Gas::getViscosity(double temperature) const {
558 ✗ return getImpl<detail::Gas_Impl>()->getViscosity(temperature);
559 }
560
561 ✗ double Gas::getSpecificHeat(double temperature) const {
562 ✗ return getImpl<detail::Gas_Impl>()->getSpecificHeat(temperature);
563 }
564
565 ✗ boost::optional<double> Gas::customConductivityCoefficientA() const {
566 ✗ return getImpl<detail::Gas_Impl>()->customConductivityCoefficientA();
567 }
568
569 ✗ boost::optional<double> Gas::customConductivityCoefficientB() const {
570 ✗ return getImpl<detail::Gas_Impl>()->customConductivityCoefficientB();
571 }
572
573 ✗ boost::optional<double> Gas::customConductivityCoefficientC() const {
574 ✗ return getImpl<detail::Gas_Impl>()->customConductivityCoefficientC();
575 }
576
577 ✗ boost::optional<double> Gas::customViscosityCoefficientA() const {
578 ✗ return getImpl<detail::Gas_Impl>()->customViscosityCoefficientA();
579 }
580
581 ✗ boost::optional<double> Gas::customViscosityCoefficientB() const {
582 ✗ return getImpl<detail::Gas_Impl>()->customViscosityCoefficientB();
583 }
584
585 ✗ boost::optional<double> Gas::customViscosityCoefficientC() const {
586 ✗ return getImpl<detail::Gas_Impl>()->customViscosityCoefficientC();
587 }
588
589 ✗ boost::optional<double> Gas::customSpecificHeatCoefficientA() const {
590 ✗ return getImpl<detail::Gas_Impl>()->customSpecificHeatCoefficientA();
591 }
592
593 ✗ boost::optional<double> Gas::customSpecificHeatCoefficientB() const {
594 ✗ return getImpl<detail::Gas_Impl>()->customSpecificHeatCoefficientB();
595 }
596
597 ✗ boost::optional<double> Gas::customSpecificHeatCoefficientC() const {
598 ✗ return getImpl<detail::Gas_Impl>()->customSpecificHeatCoefficientC();
599 }
600
601 ✗ boost::optional<double> Gas::customMolecularWeight() const {
602 ✗ return getImpl<detail::Gas_Impl>()->customMolecularWeight();
603 }
604
605 37 double Gas::thickness() const {
606
1/1
✓ Branch 3 taken 37 times.
37 return getImpl<detail::Gas_Impl>()->thickness();
607 }
608
609 3 boost::optional<double> Gas::conductivityCoefficientA() const {
610
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::Gas_Impl>()->conductivityCoefficientA();
611 }
612
613 3 boost::optional<double> Gas::conductivityCoefficientB() const {
614
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::Gas_Impl>()->conductivityCoefficientB();
615 }
616
617 3 boost::optional<double> Gas::conductivityCoefficientC() const {
618
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::Gas_Impl>()->conductivityCoefficientC();
619 }
620
621 3 boost::optional<double> Gas::viscosityCoefficientA() const {
622
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::Gas_Impl>()->viscosityCoefficientA();
623 }
624
625 3 boost::optional<double> Gas::viscosityCoefficientB() const {
626
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::Gas_Impl>()->viscosityCoefficientB();
627 }
628
629 3 boost::optional<double> Gas::viscosityCoefficientC() const {
630
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::Gas_Impl>()->viscosityCoefficientC();
631 }
632
633 3 boost::optional<double> Gas::specificHeatCoefficientA() const {
634
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::Gas_Impl>()->specificHeatCoefficientA();
635 }
636
637 3 boost::optional<double> Gas::specificHeatCoefficientB() const {
638
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::Gas_Impl>()->specificHeatCoefficientB();
639 }
640
641 3 boost::optional<double> Gas::specificHeatCoefficientC() const {
642
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::Gas_Impl>()->specificHeatCoefficientC();
643 }
644
645 3 boost::optional<double> Gas::molecularWeight() const {
646
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::Gas_Impl>()->molecularWeight();
647 }
648
649 3 boost::optional<double> Gas::specificHeatRatio() const {
650
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::Gas_Impl>()->specificHeatRatio();
651 }
652
653 377 bool Gas::setGasType(const std::string& gasType) {
654
1/1
✓ Branch 3 taken 377 times.
377 return getImpl<detail::Gas_Impl>()->setGasType(gasType);
655 }
656
657 1 bool Gas::setCustomConductivity(double A, double B, double C) {
658
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setCustomConductivity(A, B, C);
659 }
660
661 1 bool Gas::setCustomViscosity(double A, double B, double C) {
662
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setCustomViscosity(A, B, C);
663 }
664
665 1 bool Gas::setCustomSpecificHeat(double A, double B, double C) {
666
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setCustomSpecificHeat(A, B, C);
667 }
668
669 1 bool Gas::setCustomMolecularWeight(double value) {
670
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setCustomMolecularWeight(value);
671 }
672
673 372 bool Gas::setThickness(double thickness) {
674
1/1
✓ Branch 3 taken 372 times.
372 return getImpl<detail::Gas_Impl>()->setThickness(thickness);
675 }
676
677 1 bool Gas::setConductivityCoefficientA(double conductivityCoefficientA) {
678
2/2
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setConductivityCoefficientA(conductivityCoefficientA);
679 }
680
681 1 void Gas::resetConductivityCoefficientA() {
682
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::Gas_Impl>()->resetConductivityCoefficientA();
683 1 }
684
685 1 bool Gas::setConductivityCoefficientB(double conductivityCoefficientB) {
686
2/2
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setConductivityCoefficientB(conductivityCoefficientB);
687 }
688
689 1 void Gas::resetConductivityCoefficientB() {
690
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::Gas_Impl>()->resetConductivityCoefficientB();
691 1 }
692
693 1 bool Gas::setConductivityCoefficientC(double conductivityCoefficientC) {
694
2/2
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setConductivityCoefficientC(conductivityCoefficientC);
695 }
696
697 1 void Gas::resetConductivityCoefficientC() {
698
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::Gas_Impl>()->resetConductivityCoefficientC();
699 1 }
700
701 1 bool Gas::setViscosityCoefficientA(double viscosityCoefficientA) {
702
2/2
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setViscosityCoefficientA(viscosityCoefficientA);
703 }
704
705 1 void Gas::resetViscosityCoefficientA() {
706
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::Gas_Impl>()->resetViscosityCoefficientA();
707 1 }
708
709 1 bool Gas::setViscosityCoefficientB(double viscosityCoefficientB) {
710
2/2
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setViscosityCoefficientB(viscosityCoefficientB);
711 }
712
713 1 void Gas::resetViscosityCoefficientB() {
714
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::Gas_Impl>()->resetViscosityCoefficientB();
715 1 }
716
717 1 bool Gas::setViscosityCoefficientC(double viscosityCoefficientC) {
718
2/2
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setViscosityCoefficientC(viscosityCoefficientC);
719 }
720
721 1 void Gas::resetViscosityCoefficientC() {
722
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::Gas_Impl>()->resetViscosityCoefficientC();
723 1 }
724
725 1 bool Gas::setSpecificHeatCoefficientA(double specificHeatCoefficientA) {
726
2/2
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setSpecificHeatCoefficientA(specificHeatCoefficientA);
727 }
728
729 1 void Gas::resetSpecificHeatCoefficientA() {
730
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::Gas_Impl>()->resetSpecificHeatCoefficientA();
731 1 }
732
733 1 bool Gas::setSpecificHeatCoefficientB(double specificHeatCoefficientB) {
734
2/2
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setSpecificHeatCoefficientB(specificHeatCoefficientB);
735 }
736
737 1 void Gas::resetSpecificHeatCoefficientB() {
738
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::Gas_Impl>()->resetSpecificHeatCoefficientB();
739 1 }
740
741 1 bool Gas::setSpecificHeatCoefficientC(double specificHeatCoefficientC) {
742
2/2
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setSpecificHeatCoefficientC(specificHeatCoefficientC);
743 }
744
745 1 void Gas::resetSpecificHeatCoefficientC() {
746
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::Gas_Impl>()->resetSpecificHeatCoefficientC();
747 1 }
748
749 1 bool Gas::setMolecularWeight(double molecularWeight) {
750
2/2
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setMolecularWeight(molecularWeight);
751 }
752
753 1 void Gas::resetMolecularWeight() {
754
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::Gas_Impl>()->resetMolecularWeight();
755 1 }
756
757 1 bool Gas::setSpecificHeatRatio(double specificHeatRatio) {
758
2/2
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
1 return getImpl<detail::Gas_Impl>()->setSpecificHeatRatio(specificHeatRatio);
759 }
760
761 1 void Gas::resetSpecificHeatRatio() {
762
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::Gas_Impl>()->resetSpecificHeatRatio();
763 1 }
764
765 /// @cond
766
1/1
✓ Branch 3 taken 38 times.
38 Gas::Gas(std::shared_ptr<detail::Gas_Impl> impl) : GasLayer(std::move(impl)) {}
767 /// @endcond
768
769 } // namespace model
770 } // namespace openstudio
771