GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 30.0% 9 / 0 / 30
Functions: 100.0% 1 / 0 / 1
Branches: 12.4% 15 / 0 / 121

src/energyplus/ForwardTranslator/ForwardTranslateGas.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 "../ForwardTranslator.hpp"
7
8 #include "../../model/Gas.hpp"
9
10 #include <utilities/idd/WindowMaterial_Gas_FieldEnums.hxx>
11 #include "../../utilities/idd/IddEnums.hpp"
12 #include <utilities/idd/IddEnums.hxx>
13
14 using namespace openstudio::model;
15
16 namespace openstudio {
17
18 namespace energyplus {
19
20 36 boost::optional<IdfObject> ForwardTranslator::translateGas(Gas& modelObject) {
21
2/2
✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
36 IdfObject idfObject(openstudio::IddObjectType::WindowMaterial_Gas);
22
23
1/1
✓ Branch 1 taken 36 times.
36 m_idfObjects.push_back(idfObject);
24
25
3/3
✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
✓ Branch 7 taken 36 times.
36 idfObject.setString(WindowMaterial_GasFields::Name, modelObject.name().get());
26
27
2/2
✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
36 idfObject.setString(WindowMaterial_GasFields::GasType, modelObject.gasType());
28
29
2/2
✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
36 idfObject.setDouble(WindowMaterial_GasFields::Thickness, modelObject.thickness());
30
31
4/5
✓ Branch 1 taken 36 times.
✓ Branch 4 taken 36 times.
✓ Branch 7 taken 36 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 36 times.
108 if (istringEqual("Custom", modelObject.gasType())) {
32
33 ✗ if (modelObject.customConductivityCoefficientA()) {
34 ✗ idfObject.setDouble(WindowMaterial_GasFields::ConductivityCoefficientA, modelObject.customConductivityCoefficientA().get());
35 } else {
36 ✗ LOG(Error, "Missing required input 'Conductivity Coefficient A' for WindowMaterial:Gas named '" << modelObject.name().get() << "'");
37 }
38
39 ✗ if (modelObject.customConductivityCoefficientB()) {
40 ✗ idfObject.setDouble(WindowMaterial_GasFields::ConductivityCoefficientB, modelObject.customConductivityCoefficientB().get());
41 } else {
42 ✗ LOG(Error, "Missing required input 'Conductivity Coefficient B' for WindowMaterial:Gas named '" << modelObject.name().get() << "'");
43 }
44
45 ✗ if (modelObject.customViscosityCoefficientA()) {
46 ✗ idfObject.setDouble(WindowMaterial_GasFields::ViscosityCoefficientA, modelObject.customViscosityCoefficientA().get());
47 } else {
48 ✗ LOG(Error, "Missing required input 'Viscosity Coefficient A' for WindowMaterial:Gas named '" << modelObject.name().get() << "'");
49 }
50
51 ✗ if (modelObject.customViscosityCoefficientB()) {
52 ✗ idfObject.setDouble(WindowMaterial_GasFields::ViscosityCoefficientB, modelObject.customViscosityCoefficientB().get());
53 } else {
54 ✗ LOG(Error, "Missing required input 'Viscosity Coefficient B' for WindowMaterial:Gas named '" << modelObject.name().get() << "'");
55 }
56
57 ✗ if (modelObject.customSpecificHeatCoefficientA()) {
58 ✗ idfObject.setDouble(WindowMaterial_GasFields::SpecificHeatCoefficientA, modelObject.customSpecificHeatCoefficientA().get());
59 } else {
60 ✗ LOG(Error, "Missing required input 'Specific Heat Coefficient A' for WindowMaterial:Gas named '" << modelObject.name().get() << "'");
61 }
62
63 ✗ if (modelObject.customSpecificHeatCoefficientB()) {
64 ✗ idfObject.setDouble(WindowMaterial_GasFields::SpecificHeatCoefficientB, modelObject.customSpecificHeatCoefficientB().get());
65 } else {
66 ✗ LOG(Error, "Missing required input 'Specific Heat Coefficient B' for WindowMaterial:Gas named '" << modelObject.name().get() << "'");
67 }
68
69 ✗ if (modelObject.customMolecularWeight()) {
70 ✗ idfObject.setDouble(WindowMaterial_GasFields::MolecularWeight, modelObject.customMolecularWeight().get());
71 } else {
72 ✗ LOG(Error, "Missing required input 'Molecular Weight' for WindowMaterial:Gas named '" << modelObject.name().get() << "'");
73 }
74 }
75
76
1/1
✓ Branch 1 taken 36 times.
72 return boost::optional<IdfObject>(idfObject);
77 36 }
78
79 } // namespace energyplus
80
81 } // namespace openstudio
82