GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 96.5% 55 / 0 / 57
Functions: 100.0% 1 / 0 / 1
Branches: 80.9% 89 / 0 / 110

src/energyplus/ForwardTranslator/ForwardTranslateStandardGlazing.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 #include "../../model/StandardGlazing.hpp"
8 #include <utilities/idd/OS_WindowMaterial_Glazing_FieldEnums.hxx>
9
10 #include <utilities/idd/WindowMaterial_Glazing_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 45 boost::optional<IdfObject> ForwardTranslator::translateStandardGlazing(StandardGlazing& modelObject) {
21
2/2
✓ Branch 1 taken 45 times.
✓ Branch 4 taken 45 times.
45 IdfObject idfObject(openstudio::IddObjectType::WindowMaterial_Glazing);
22
23
1/1
✓ Branch 1 taken 45 times.
45 m_idfObjects.push_back(idfObject);
24
25
3/3
✓ Branch 1 taken 45 times.
✓ Branch 4 taken 45 times.
✓ Branch 7 taken 45 times.
45 idfObject.setString(WindowMaterial_GlazingFields::Name, modelObject.name().get());
26
27 45 std::string opticalDataType;
28
1/1
✓ Branch 1 taken 45 times.
45 OptionalString s = modelObject.getString(OS_WindowMaterial_GlazingFields::OpticalDataType, false, true);
29
1/2
✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
45 if (s) {
30
2/2
✓ Branch 1 taken 45 times.
✓ Branch 4 taken 45 times.
45 opticalDataType = *s;
31
2/2
✓ Branch 1 taken 45 times.
✓ Branch 4 taken 45 times.
45 idfObject.setString(WindowMaterial_GlazingFields::OpticalDataType, *s);
32 } else {
33 ✗ LOG(Error, "Missing required input 'Optical Data Type' for WindowMaterial:Glazing named '" << modelObject.name().get() << "'");
34 }
35
36
4/4
✓ Branch 1 taken 45 times.
✓ Branch 4 taken 45 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 44 times.
90 if (istringEqual("Spectral", opticalDataType)) {
37
1/1
✓ Branch 1 taken 1 time.
1 s = modelObject.getString(OS_WindowMaterial_GlazingFields::WindowGlassSpectralDataSetName, false, true);
38
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (s) {
39
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(WindowMaterial_GlazingFields::WindowGlassSpectralDataSetName, *s);
40 }
41 }
42
43
1/1
✓ Branch 1 taken 45 times.
45 OptionalDouble d = modelObject.getDouble(OS_WindowMaterial_GlazingFields::Thickness, false);
44
1/2
✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
45 if (d) {
45
2/2
✓ Branch 1 taken 45 times.
✓ Branch 4 taken 45 times.
45 idfObject.setDouble(WindowMaterial_GlazingFields::Thickness, *d);
46 } else {
47 ✗ LOG(Error, "Missing required input 'Thickness' for WindowMaterial:Glazing named '" << modelObject.name().get() << "'");
48 }
49
50
4/4
✓ Branch 1 taken 45 times.
✓ Branch 4 taken 45 times.
✓ Branch 7 taken 44 times.
✓ Branch 8 taken 1 time.
90 if (istringEqual("SpectralAverage", opticalDataType)) {
51
1/1
✓ Branch 1 taken 44 times.
44 d = modelObject.getDouble(OS_WindowMaterial_GlazingFields::SolarTransmittanceatNormalIncidence, false);
52
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 6 times.
44 if (d) {
53
2/2
✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
38 idfObject.setDouble(WindowMaterial_GlazingFields::SolarTransmittanceatNormalIncidence, *d);
54 }
55
56
1/1
✓ Branch 1 taken 44 times.
44 d = modelObject.getDouble(OS_WindowMaterial_GlazingFields::FrontSideSolarReflectanceatNormalIncidence, false);
57
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 6 times.
44 if (d) {
58
2/2
✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
38 idfObject.setDouble(WindowMaterial_GlazingFields::FrontSideSolarReflectanceatNormalIncidence, *d);
59 }
60
61
1/1
✓ Branch 1 taken 44 times.
44 d = modelObject.getDouble(OS_WindowMaterial_GlazingFields::BackSideSolarReflectanceatNormalIncidence, false);
62
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 6 times.
44 if (d) {
63
2/2
✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
38 idfObject.setDouble(WindowMaterial_GlazingFields::BackSideSolarReflectanceatNormalIncidence, *d);
64 }
65
66
1/1
✓ Branch 1 taken 44 times.
44 d = modelObject.getDouble(OS_WindowMaterial_GlazingFields::VisibleTransmittanceatNormalIncidence, false);
67
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 6 times.
44 if (d) {
68
2/2
✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
38 idfObject.setDouble(WindowMaterial_GlazingFields::VisibleTransmittanceatNormalIncidence, *d);
69 }
70
71
1/1
✓ Branch 1 taken 44 times.
44 d = modelObject.getDouble(OS_WindowMaterial_GlazingFields::FrontSideVisibleReflectanceatNormalIncidence, false);
72
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 6 times.
44 if (d) {
73
2/2
✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
38 idfObject.setDouble(WindowMaterial_GlazingFields::FrontSideVisibleReflectanceatNormalIncidence, *d);
74 }
75
76
1/1
✓ Branch 1 taken 44 times.
44 d = modelObject.getDouble(OS_WindowMaterial_GlazingFields::BackSideVisibleReflectanceatNormalIncidence, false);
77
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 6 times.
44 if (d) {
78
2/2
✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
38 idfObject.setDouble(WindowMaterial_GlazingFields::BackSideVisibleReflectanceatNormalIncidence, *d);
79 }
80 }
81
82
1/1
✓ Branch 1 taken 45 times.
45 d = modelObject.getDouble(OS_WindowMaterial_GlazingFields::InfraredTransmittanceatNormalIncidence, false);
83
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 7 times.
45 if (d) {
84
2/2
✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
38 idfObject.setDouble(WindowMaterial_GlazingFields::InfraredTransmittanceatNormalIncidence, *d);
85 }
86
87
1/1
✓ Branch 1 taken 45 times.
45 d = modelObject.getDouble(OS_WindowMaterial_GlazingFields::FrontSideInfraredHemisphericalEmissivity, false);
88
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 7 times.
45 if (d) {
89
2/2
✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
38 idfObject.setDouble(WindowMaterial_GlazingFields::FrontSideInfraredHemisphericalEmissivity, *d);
90 }
91
92
1/1
✓ Branch 1 taken 45 times.
45 d = modelObject.getDouble(OS_WindowMaterial_GlazingFields::BackSideInfraredHemisphericalEmissivity, false);
93
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 7 times.
45 if (d) {
94
2/2
✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
38 idfObject.setDouble(WindowMaterial_GlazingFields::BackSideInfraredHemisphericalEmissivity, *d);
95 }
96
97
1/1
✓ Branch 1 taken 45 times.
45 d = modelObject.getDouble(OS_WindowMaterial_GlazingFields::Conductivity, false);
98
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 7 times.
45 if (d) {
99
2/2
✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
38 idfObject.setDouble(WindowMaterial_GlazingFields::Conductivity, *d);
100 }
101
102
1/1
✓ Branch 1 taken 45 times.
45 d = modelObject.getDouble(OS_WindowMaterial_GlazingFields::DirtCorrectionFactorforSolarandVisibleTransmittance, false);
103
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 44 times.
45 if (d) {
104
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(WindowMaterial_GlazingFields::DirtCorrectionFactorforSolarandVisibleTransmittance, *d);
105 }
106
107
1/1
✓ Branch 1 taken 45 times.
45 s = modelObject.getString(OS_WindowMaterial_GlazingFields::SolarDiffusing, false, true);
108
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 44 times.
45 if (s) {
109
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(WindowMaterial_GlazingFields::SolarDiffusing, *s);
110 }
111
112
1/1
✓ Branch 1 taken 45 times.
90 return boost::optional<IdfObject>(idfObject);
113 45 }
114
115 } // namespace energyplus
116
117 } // namespace openstudio
118