GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 35 / 0 / 35
Functions: 100.0% 1 / 0 / 1
Branches: 95.4% 62 / 0 / 65

src/energyplus/ForwardTranslator/ForwardTranslateStandardOpaqueMaterial.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/StandardOpaqueMaterial.hpp"
9 #include "../../model/StandardOpaqueMaterial_Impl.hpp"
10 #include "../../model/MaterialPropertyMoisturePenetrationDepthSettings.hpp"
11 #include "../../model/MaterialPropertyMoisturePenetrationDepthSettings_Impl.hpp"
12 #include "../../model/MaterialPropertyPhaseChange.hpp"
13 #include "../../model/MaterialPropertyPhaseChange_Impl.hpp"
14 #include "../../model/MaterialPropertyPhaseChangeHysteresis.hpp"
15 #include "../../model/MaterialPropertyPhaseChangeHysteresis_Impl.hpp"
16
17 #include <utilities/idd/Material_FieldEnums.hxx>
18 #include "../../utilities/idd/IddEnums.hpp"
19 #include <utilities/idd/IddEnums.hxx>
20
21 using namespace openstudio::model;
22
23 using namespace std;
24
25 namespace openstudio {
26
27 namespace energyplus {
28
29 578 boost::optional<IdfObject> ForwardTranslator::translateStandardOpaqueMaterial(StandardOpaqueMaterial& modelObject) {
30
2/2
✓ Branch 1 taken 578 times.
✓ Branch 4 taken 578 times.
578 IdfObject idfObject(openstudio::IddObjectType::Material);
31
32
1/1
✓ Branch 1 taken 578 times.
578 m_idfObjects.push_back(idfObject);
33
34
3/3
✓ Branch 1 taken 578 times.
✓ Branch 4 taken 578 times.
✓ Branch 7 taken 578 times.
578 idfObject.setString(openstudio::MaterialFields::Name, modelObject.name().get());
35
36
2/2
✓ Branch 1 taken 578 times.
✓ Branch 4 taken 578 times.
578 idfObject.setString(openstudio::MaterialFields::Roughness, modelObject.roughness());
37
38
2/2
✓ Branch 1 taken 578 times.
✓ Branch 4 taken 578 times.
578 idfObject.setDouble(openstudio::MaterialFields::Thickness, modelObject.thickness());
39
40
2/2
✓ Branch 1 taken 578 times.
✓ Branch 4 taken 578 times.
578 idfObject.setDouble(openstudio::MaterialFields::Conductivity, modelObject.thermalConductivity());
41
42
2/2
✓ Branch 1 taken 578 times.
✓ Branch 4 taken 578 times.
578 idfObject.setDouble(openstudio::MaterialFields::Density, modelObject.density());
43
44
2/2
✓ Branch 1 taken 578 times.
✓ Branch 4 taken 578 times.
578 idfObject.setDouble(openstudio::MaterialFields::SpecificHeat, modelObject.specificHeat());
45
46
2/2
✓ Branch 1 taken 578 times.
✓ Branch 4 taken 578 times.
578 OptionalDouble d = modelObject.thermalAbsorptance();
47
1/2
✓ Branch 0 taken 578 times.
✗ Branch 1 not taken.
578 if (d) {
48
2/2
✓ Branch 1 taken 578 times.
✓ Branch 4 taken 578 times.
578 idfObject.setDouble(openstudio::MaterialFields::ThermalAbsorptance, *d);
49 }
50
51
2/2
✓ Branch 1 taken 578 times.
✓ Branch 4 taken 578 times.
578 d = modelObject.solarAbsorptance();
52
1/2
✓ Branch 0 taken 578 times.
✗ Branch 1 not taken.
578 if (d) {
53
2/2
✓ Branch 1 taken 578 times.
✓ Branch 4 taken 578 times.
578 idfObject.setDouble(openstudio::MaterialFields::SolarAbsorptance, *d);
54 }
55
56
2/2
✓ Branch 1 taken 578 times.
✓ Branch 4 taken 578 times.
578 d = modelObject.visibleAbsorptance();
57
1/2
✓ Branch 0 taken 578 times.
✗ Branch 1 not taken.
578 if (d) {
58
2/2
✓ Branch 1 taken 578 times.
✓ Branch 4 taken 578 times.
578 idfObject.setDouble(openstudio::MaterialFields::VisibleAbsorptance, *d);
59 }
60
61 // Inside-face absorptance fields have no IDD default and inherit the exterior value when blank.
62
3/3
✓ Branch 1 taken 578 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 577 times.
578 if (!modelObject.isThermalAbsorptanceInsideFaceDefaulted()) {
63
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(openstudio::MaterialFields::ThermalAbsorptanceInsideFace, modelObject.thermalAbsorptanceInsideFace());
64 }
65
66
3/3
✓ Branch 1 taken 578 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 577 times.
578 if (!modelObject.isSolarAbsorptanceInsideFaceDefaulted()) {
67
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(openstudio::MaterialFields::SolarAbsorptanceInsideFace, modelObject.solarAbsorptanceInsideFace());
68 }
69
70
3/3
✓ Branch 1 taken 578 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 577 times.
578 if (!modelObject.isVisibleAbsorptanceInsideFaceDefaulted()) {
71
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(openstudio::MaterialFields::VisibleAbsorptanceInsideFace, modelObject.visibleAbsorptanceInsideFace());
72 }
73
74 // Call the translation of these objects, which has two advantages:
75 // * will not translate them if they are orphaned (=not referencing a material), and,
76 // * makes the order of these objects in the IDF deterministic
77
3/3
✓ Branch 1 taken 578 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 577 times.
1156 if (boost::optional<MaterialPropertyMoisturePenetrationDepthSettings> _empd = modelObject.materialPropertyMoisturePenetrationDepthSettings()) {
78
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 translateAndMapModelObject(_empd.get());
79 578 }
80
81
3/3
✓ Branch 1 taken 578 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 576 times.
1156 if (boost::optional<MaterialPropertyPhaseChange> _phaseChange = modelObject.materialPropertyPhaseChange()) {
82
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 translateAndMapModelObject(_phaseChange.get());
83 578 }
84
85
3/3
✓ Branch 1 taken 578 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 577 times.
1156 if (boost::optional<MaterialPropertyPhaseChangeHysteresis> _phaseChangeHysteresis = modelObject.materialPropertyPhaseChangeHysteresis()) {
86
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 translateAndMapModelObject(_phaseChangeHysteresis.get());
87 578 }
88
89
1/1
✓ Branch 1 taken 578 times.
1156 return boost::optional<IdfObject>(idfObject);
90 578 }
91
92 } // namespace energyplus
93
94 } // namespace openstudio
95