GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 59.5% 351 / 0 / 590
Functions: 87.5% 7 / 0 / 8
Branches: 43.1% 592 / 0 / 1372

src/sdd/MapEnvelope.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 "ReverseTranslator.hpp"
7 #include "ForwardTranslator.hpp"
8
9 #include "../model/Model.hpp"
10 #include "../model/ModelObject.hpp"
11 #include "../model/ModelObject_Impl.hpp"
12 #include "../model/Construction.hpp"
13 #include "../model/Construction_Impl.hpp"
14 #include "../model/MasslessOpaqueMaterial.hpp"
15 #include "../model/MasslessOpaqueMaterial_Impl.hpp"
16 #include "../model/AirGap.hpp"
17 #include "../model/AirGap_Impl.hpp"
18 #include "../model/StandardOpaqueMaterial.hpp"
19 #include "../model/StandardOpaqueMaterial_Impl.hpp"
20 #include "../model/ConstructionWithInternalSource.hpp"
21 #include "../model/ConstructionWithInternalSource_Impl.hpp"
22 #include "../model/FFactorGroundFloorConstruction.hpp"
23 #include "../model/FFactorGroundFloorConstruction_Impl.hpp"
24 #include "../model/CFactorUndergroundWallConstruction.hpp"
25 #include "../model/CFactorUndergroundWallConstruction_Impl.hpp"
26 #include "../model/FenestrationMaterial.hpp"
27 #include "../model/FenestrationMaterial_Impl.hpp"
28 #include "../model/ModelPartitionMaterial.hpp"
29 #include "../model/ModelPartitionMaterial_Impl.hpp"
30 #include "../model/SimpleGlazing.hpp"
31 #include "../model/SimpleGlazing_Impl.hpp"
32 #include "../model/StandardsInformationConstruction.hpp"
33 #include "../model/StandardsInformationConstruction_Impl.hpp"
34 #include "../model/StandardsInformationMaterial.hpp"
35 #include "../model/StandardsInformationMaterial_Impl.hpp"
36
37 #include "../utilities/units/QuantityConverter.hpp"
38 #include "../utilities/units/Quantity.hpp"
39 #include "../utilities/units/IPUnit.hpp"
40 #include "../utilities/units/SIUnit.hpp"
41 #include "../utilities/units/BTUUnit.hpp"
42 #include "../utilities/units/WhUnit.hpp"
43 #include "../utilities/core/Assert.hpp"
44 #include "../utilities/core/StringHelpers.hpp"
45
46 #include <pugixml.hpp>
47
48 namespace openstudio {
49 namespace sdd {
50
51 7 boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateConstructAssembly(const pugi::xml_node& element,
52 openstudio::model::Model& model) {
53 7 boost::optional<openstudio::model::ModelObject> result;
54
55
1/1
✓ Branch 1 taken 7 times.
7 pugi::xml_node nameElement = element.child("Name");
56 7 std::string name;
57
2/3
✓ Branch 1 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
7 if (!nameElement) {
58 ✗ LOG(Error, "ConsAssm element 'Name' is empty.")
59 } else {
60
4/4
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✓ Branch 10 taken 7 times.
7 name = escapeName(nameElement.text().as_string());
61 }
62
63
1/1
✓ Branch 1 taken 7 times.
7 pugi::xml_node specificationElement = element.child("SpecMthd");
64
2/3
✓ Branch 1 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
7 if (!specificationElement) {
65 ✗ LOG(Error, "ConsAssm element 'SpecMthd' is empty for construction named '" << name << "'. Construction will not be created");
66 ✗ return boost::none;
67 }
68
69
7/7
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✓ Branch 10 taken 7 times.
✓ Branch 13 taken 7 times.
✓ Branch 17 taken 5 times.
✓ Branch 18 taken 2 times.
21 if (openstudio::istringEqual(specificationElement.text().as_string(), "Layers")) {
70
71
1/1
✓ Branch 1 taken 5 times.
5 openstudio::model::Construction construction(model);
72
1/1
✓ Branch 1 taken 5 times.
5 construction.setName(name);
73
74 5 std::vector<model::Material> materials;
75
6/6
✓ Branch 1 taken 5 times.
✓ Branch 6 taken 11 times.
✓ Branch 9 taken 11 times.
✓ Branch 12 taken 16 times.
✓ Branch 14 taken 11 times.
✓ Branch 15 taken 5 times.
16 for (const pugi::xml_node& materialElement : element.children("MatRef")) {
76
4/4
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✓ Branch 10 taken 11 times.
11 std::string materialName = escapeName(materialElement.text().as_string());
77
1/1
✓ Branch 1 taken 11 times.
11 boost::optional<model::Material> material = model.getModelObjectByName<model::Material>(materialName);
78
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 11 times.
11 if (!material) {
79 ✗ LOG(Error, "Construction: " << construction.name().get() << " references material: " << materialName << " that is not defined.");
80
81 // DLM: what to do? Remove the construction?
82 } else {
83
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 materials.push_back(*material);
84 }
85 11 }
86
87
1/1
✓ Branch 1 taken 5 times.
5 bool test = construction.setLayers(materials);
88
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (!test) {
89 ✗ LOG(Error, "Failed to set material layers for Construction: " << construction.name().get() << ".");
90
91 // DLM: what to do? Remove the construction?
92 }
93
94
1/1
✓ Branch 1 taken 5 times.
5 bool wasFastNaming = model.fastNaming();
95
1/1
✓ Branch 1 taken 5 times.
5 model.setFastNaming(false);
96
97 5 auto n = (unsigned)materials.size();
98
1/1
✓ Branch 1 taken 5 times.
5 construction.ensureUniqueLayers();
99
1/1
✓ Branch 1 taken 5 times.
5 materials = construction.layers(); // DLM: get materials again in case new ones were cloned
100
101
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
5 OS_ASSERT(n == materials.size());
102
103
1/1
✓ Branch 1 taken 5 times.
5 model.setFastNaming(wasFastNaming);
104
105
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 if (n > 0) {
106
107 // DLM: are these fields only on layered constructions?
108
1/1
✓ Branch 1 taken 5 times.
5 pugi::xml_node extRoughnessElement = element.child("ExtRoughness"); // enumerated value
109
1/1
✓ Branch 1 taken 5 times.
5 pugi::xml_node extSolAbsElement = element.child("ExtSolAbs");
110
1/1
✓ Branch 1 taken 5 times.
5 pugi::xml_node extThrmlAbsElement = element.child("ExtThrmlAbs");
111
1/1
✓ Branch 1 taken 5 times.
5 pugi::xml_node extVisAbsElement = element.child("ExtVisAbs");
112
1/1
✓ Branch 1 taken 5 times.
5 pugi::xml_node intSolAbsElement = element.child("IntSolAbs");
113
1/1
✓ Branch 1 taken 5 times.
5 pugi::xml_node intThrmlAbsElement = element.child("IntThrmlAbs");
114
1/1
✓ Branch 1 taken 5 times.
5 pugi::xml_node intVisAbsElement = element.child("IntVisAbs");
115
116
2/3
✓ Branch 2 taken 5 times.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
10 if (materials[0].optionalCast<model::StandardOpaqueMaterial>()) {
117
1/1
✓ Branch 2 taken 5 times.
5 auto extMaterial = materials[0].cast<model::StandardOpaqueMaterial>();
118
119
1/1
✓ Branch 1 taken 5 times.
5 std::string roughness = "MediumRough";
120
2/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
5 if (extRoughnessElement) {
121
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 roughness = extRoughnessElement.text().as_string();
122 }
123
1/1
✓ Branch 1 taken 5 times.
5 extMaterial.setRoughness(roughness);
124
125
2/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
5 if (extThrmlAbsElement) {
126
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 extMaterial.setThermalAbsorptance(extThrmlAbsElement.text().as_double());
127 }
128
129
2/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
5 if (extSolAbsElement) {
130
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 extMaterial.setSolarAbsorptance(extSolAbsElement.text().as_double());
131 }
132
133
2/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
5 if (extVisAbsElement) {
134
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 extMaterial.setVisibleAbsorptance(extVisAbsElement.text().as_double());
135 }
136
0/3
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
5 } else if (materials[0].optionalCast<model::MasslessOpaqueMaterial>()) {
137 ✗ auto extMaterial = materials[0].cast<model::MasslessOpaqueMaterial>();
138
139 ✗ std::string roughness = "MediumRough";
140 ✗ if (extRoughnessElement) {
141 ✗ roughness = extRoughnessElement.text().as_string();
142 }
143 ✗ extMaterial.setRoughness(roughness);
144
145 ✗ if (extThrmlAbsElement) {
146 ✗ extMaterial.setThermalAbsorptance(extThrmlAbsElement.text().as_double());
147 }
148
149 ✗ if (extSolAbsElement) {
150 ✗ extMaterial.setSolarAbsorptance(extSolAbsElement.text().as_double());
151 }
152
153 ✗ if (extVisAbsElement) {
154 ✗ extMaterial.setVisibleAbsorptance(extVisAbsElement.text().as_double());
155 }
156 ✗ }
157
158 // DLM: if only one layer use properties from exterior material
159
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 time.
5 if (n > 1) {
160
2/3
✓ Branch 2 taken 4 times.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
8 if (materials[n - 1].optionalCast<model::StandardOpaqueMaterial>()) {
161
1/1
✓ Branch 2 taken 4 times.
4 auto intMaterial = materials[n - 1].cast<model::StandardOpaqueMaterial>();
162
163
2/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
4 if (intThrmlAbsElement) {
164
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
4 intMaterial.setThermalAbsorptance(intThrmlAbsElement.text().as_double());
165 }
166
167
2/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
4 if (intSolAbsElement) {
168
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
4 intMaterial.setSolarAbsorptance(intSolAbsElement.text().as_double());
169 }
170
171
2/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
4 if (intVisAbsElement) {
172
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
4 intMaterial.setVisibleAbsorptance(intVisAbsElement.text().as_double());
173 }
174
0/3
✗ Branch 3 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
4 } else if (materials[n - 1].optionalCast<model::MasslessOpaqueMaterial>()) {
175 ✗ auto intMaterial = materials[n - 1].cast<model::MasslessOpaqueMaterial>();
176
177 ✗ if (intThrmlAbsElement) {
178 ✗ intMaterial.setThermalAbsorptance(intThrmlAbsElement.text().as_double());
179 }
180
181 ✗ if (intSolAbsElement) {
182 ✗ intMaterial.setSolarAbsorptance(intSolAbsElement.text().as_double());
183 }
184
185 ✗ if (intVisAbsElement) {
186 ✗ intMaterial.setVisibleAbsorptance(intVisAbsElement.text().as_double());
187 }
188 ✗ }
189 }
190 }
191
192
1/1
✓ Branch 1 taken 5 times.
5 result = construction;
193
194
7/7
✓ Branch 3 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 9 taken 2 times.
✓ Branch 12 taken 2 times.
✓ Branch 15 taken 2 times.
✓ Branch 19 taken 1 time.
✓ Branch 20 taken 1 time.
11 } else if (openstudio::istringEqual(specificationElement.text().as_string(), "CFactor")) {
195
196 // DLM: per input from David Reddy this construction will be cloned
197 // for each surface that uses it and height set per surface
198 //
199
200
1/1
✓ Branch 1 taken 1 time.
1 pugi::xml_node cFactorElement = element.child("CFactor");
201
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
1 if (!cFactorElement) {
202 ✗ LOG(Error, "ConsAssm required element 'CFactor' is empty for construction named '" << name << "'. Construction will not be created");
203 ✗ return boost::none;
204 }
205
206
1/1
✓ Branch 1 taken 1 time.
1 openstudio::model::CFactorUndergroundWallConstruction construction(model);
207
1/1
✓ Branch 1 taken 1 time.
1 construction.setName(name);
208
209 // sdd units = Btu/(hr*ft^2*F), os units = W/(m^2*K)
210
5/5
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
✓ Branch 14 taken 1 time.
1 Quantity cFactorIP(cFactorElement.text().as_double(), BTUUnit(BTUExpnt(1, -2, -1, -1)));
211
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 OptionalQuantity cFactorSI = QuantityConverter::instance().convert(cFactorIP, UnitSystem(UnitSystem::Wh));
212
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(cFactorSI);
213
6/8
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
✓ Branch 14 taken 1 time.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 time.
✗ Branch 19 not taken.
1 OS_ASSERT(cFactorSI->units() == WhUnit(WhExpnt(1, 0, -2, -1)));
214
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 construction.setCFactor(cFactorSI->value());
215
216
1/1
✓ Branch 1 taken 1 time.
1 result = construction;
217
218
6/7
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 20 taken 1 time.
✗ Branch 21 not taken.
4 } else if (openstudio::istringEqual(specificationElement.text().as_string(), "FFactor")) {
219
220 // DLM: per input from David Reddy this construction will be cloned
221 // for each surface that uses it and area and perimeter set per surface
222
223
1/1
✓ Branch 1 taken 1 time.
1 pugi::xml_node fFactorElement = element.child("FFactor");
224
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
1 if (!fFactorElement) {
225 ✗ LOG(Error, "ConsAssm required element 'FFactor' is empty for construction named '" << name << "'. Construction will not be created");
226 ✗ return boost::none;
227 }
228
229
1/1
✓ Branch 1 taken 1 time.
1 openstudio::model::FFactorGroundFloorConstruction construction(model);
230
1/1
✓ Branch 1 taken 1 time.
1 construction.setName(name);
231
232 // sdd units = Btu/(hr*ft*F), os units = W/(m*K)
233
5/5
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
✓ Branch 14 taken 1 time.
1 Quantity fFactorIP(fFactorElement.text().as_double(), BTUUnit(BTUExpnt(1, -1, -1, -1)));
234
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 OptionalQuantity fFactorSI = QuantityConverter::instance().convert(fFactorIP, UnitSystem(UnitSystem::Wh));
235
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(fFactorSI);
236
6/8
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
✓ Branch 14 taken 1 time.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 time.
✗ Branch 19 not taken.
1 OS_ASSERT(fFactorSI->units() == WhUnit(WhExpnt(1, 0, -1, -1)));
237
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 construction.setFFactor(fFactorSI->value());
238
239
1/1
✓ Branch 1 taken 1 time.
1 result = construction;
240
241
0/5
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
1 } else if (openstudio::istringEqual(specificationElement.text().as_string(), "UFactor")) {
242
243 // DLM: todo create object, do we need this now?
244 }
245
246 7 return result;
247 7 }
248
249 ✗ boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateDoorConstruction(const pugi::xml_node& element,
250 openstudio::model::Model& model) {
251 //SIExpnt(int kg=0,int m=0,int s=0,int K=0,..)
252 //IPExpnt(int lbm=0,int ft=0,int s=0,int R=0,..)
253 //BTUExpnt(int btu=0,int ft=0,int h=0,int R=0,..)
254 //WhExpnt(int W=0,int h=0,int m=0,int K=0,..)
255
256 ✗ UnitSystem siSys(UnitSystem::SI);
257 ✗ UnitSystem whSys(UnitSystem::Wh);
258
259 ✗ pugi::xml_node nameElement = element.child("Name");
260 ✗ pugi::xml_node uFactorElement = element.child("UFactorSim"); // Btu/h-ft2-F
261
262 ✗ if (!nameElement) {
263 ✗ LOG(Error, "DrCons element 'Name' is empty. Construction will not be created.");
264 }
265 ✗ if (!uFactorElement) {
266 ✗ LOG(Error, "DrCons element 'UFactorSim' is empty. Construction will not be created.");
267 }
268
269 ✗ if (nameElement && uFactorElement) {
270
271 // sdd units = Btu/(hr*ft^2*F), os units = W/m^2-K
272 ✗ Quantity uFactorIP(uFactorElement.text().as_double(), BTUUnit(BTUExpnt(1, -2, -1, -1)));
273 ✗ OptionalQuantity uFactorWh = QuantityConverter::instance().convert(uFactorIP, whSys);
274 ✗ OS_ASSERT(uFactorWh);
275 ✗ OS_ASSERT(uFactorWh->units() == WhUnit(WhExpnt(1, 0, -2, -1)));
276
277 // m^2-K/W
278 ✗ double rValueSI = 1.0 / uFactorWh->value();
279
280 // 5.6783 hr-ft2-F/Btu = 1 m^2-K/W
281 ✗ const double intFilmRValueSI = 0.170 / 5.6783; // 0.170 hr-ft2-F/Btu
282 ✗ const double extFilmRValueSI = 0.680 / 5.6783; // 0.680 hr-ft2-F/Btu
283
284 // if total rvalue is less than sum of interior and exterior film rvalue, surface coefficients will be added to door separately
285 ✗ rValueSI = std::max(rValueSI - intFilmRValueSI - extFilmRValueSI, 0.001);
286
287 ✗ std::string name = escapeName(nameElement.text().as_string());
288
289 ✗ model::MasslessOpaqueMaterial material(model);
290 ✗ material.setName(name + " Material");
291 ✗ material.setRoughness("MediumSmooth");
292 ✗ material.setThermalResistance(rValueSI);
293
294 ✗ openstudio::model::MaterialVector layers;
295 ✗ layers.push_back(material);
296
297 ✗ openstudio::model::Construction construction(model);
298 ✗ construction.setName(name);
299 ✗ construction.setLayers(layers);
300
301 ✗ return construction;
302 ✗ }
303
304 ✗ return boost::none;
305 }
306
307 1 boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateFenestrationConstruction(const pugi::xml_node& element,
308 openstudio::model::Model& model) {
309 //SIExpnt(int kg=0,int m=0,int s=0,int K=0,..)
310 //IPExpnt(int lbm=0,int ft=0,int s=0,int R=0,..)
311 //BTUExpnt(int btu=0,int ft=0,int h=0,int R=0,..)
312 //WhExpnt(int W=0,int h=0,int m=0,int K=0,..)
313
314
1/1
✓ Branch 1 taken 1 time.
1 UnitSystem siSys(UnitSystem::SI);
315
1/1
✓ Branch 1 taken 1 time.
1 UnitSystem whSys(UnitSystem::Wh);
316
317
1/1
✓ Branch 1 taken 1 time.
1 pugi::xml_node nameElement = element.child("Name");
318
1/1
✓ Branch 1 taken 1 time.
1 pugi::xml_node shgcElement = element.child("SHGC"); // unitless
319
1/1
✓ Branch 1 taken 1 time.
1 pugi::xml_node uFactorElement = element.child("UFactorSim"); // Btu/h-ft2-F
320
1/1
✓ Branch 1 taken 1 time.
1 pugi::xml_node vtElement = element.child("VT"); // unitless
321
322
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
1 if (!nameElement) {
323 ✗ LOG(Error, "FenCons element 'Name' is empty. Construction will not be created.");
324 }
325
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
1 if (!shgcElement) {
326 ✗ LOG(Error, "FenCons element 'SHGC' is empty. Construction will not be created.");
327 }
328
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
1 if (!uFactorElement) {
329 ✗ LOG(Error, "FenCons element 'UFactorSim' is empty. Construction will not be created.");
330 }
331
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
1 if (!vtElement) {
332 ✗ LOG(Error, "FenCons element 'VT' is empty. Construction will not be created.");
333 }
334
335
9/14
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 time.
✓ Branch 13 taken 1 time.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 time.
✓ Branch 18 taken 1 time.
✗ Branch 19 not taken.
✓ Branch 20 taken 1 time.
✗ Branch 21 not taken.
1 if (nameElement && shgcElement && uFactorElement && vtElement) {
336
337
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 std::string name = escapeName(nameElement.text().as_string());
338
339
1/1
✓ Branch 1 taken 1 time.
1 openstudio::model::SimpleGlazing material(model);
340
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 material.setName(name + " Material");
341
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 material.setSolarHeatGainCoefficient(shgcElement.text().as_double());
342
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 material.setVisibleTransmittance(vtElement.text().as_double());
343
344 // sdd units = Btu/(hr*ft^2*F), os units = W/m^2-K
345
5/5
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
✓ Branch 14 taken 1 time.
1 Quantity uFactorIP(uFactorElement.text().as_double(), BTUUnit(BTUExpnt(1, -2, -1, -1)));
346
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 OptionalQuantity uFactorWh = QuantityConverter::instance().convert(uFactorIP, whSys);
347
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(uFactorWh);
348
6/8
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
✓ Branch 14 taken 1 time.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 time.
✗ Branch 19 not taken.
1 OS_ASSERT(uFactorWh->units() == WhUnit(WhExpnt(1, 0, -2, -1)));
349
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 material.setUFactor(uFactorWh->value());
350
351 1 openstudio::model::MaterialVector layers;
352
1/1
✓ Branch 1 taken 1 time.
1 layers.push_back(material);
353
354
1/1
✓ Branch 1 taken 1 time.
1 openstudio::model::Construction construction(model);
355
1/1
✓ Branch 1 taken 1 time.
1 construction.setName(name);
356
1/1
✓ Branch 1 taken 1 time.
1 construction.setLayers(layers);
357
358
1/1
✓ Branch 1 taken 1 time.
1 return construction;
359 1 }
360 ✗ return boost::none;
361 }
362
363 11 boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateMaterial(const pugi::xml_node& element,
364 openstudio::model::Model& model) {
365
366 //SIExpnt(int kg=0,int m=0,int s=0,int K=0,..)
367 //IPExpnt(int lbm=0,int ft=0,int s=0,int R=0,..)
368 //BTUExpnt(int btu=0,int ft=0,int h=0,int R=0,..)
369 //WhExpnt(int W=0,int h=0,int m=0,int K=0,..)
370
371
1/1
✓ Branch 1 taken 11 times.
11 UnitSystem siSys(UnitSystem::SI);
372
1/1
✓ Branch 1 taken 11 times.
11 UnitSystem whSys(UnitSystem::Wh);
373
374
1/1
✓ Branch 1 taken 11 times.
11 pugi::xml_node nameElement = element.child("Name");
375 //pugi::xml_node roughnessElement = element.child("Roughness"); // {VeryRough, Rough, MediumRough, MediumSmooth, Smooth, VerySmooth}
376
1/1
✓ Branch 1 taken 11 times.
11 pugi::xml_node thicknessElement = element.child("Thkns"); // in
377
1/1
✓ Branch 1 taken 11 times.
11 pugi::xml_node thermalConductivityElement = element.child("ThrmlCndct"); // Btu/(hr*ft*F)
378
1/1
✓ Branch 1 taken 11 times.
11 pugi::xml_node densityElement = element.child("Dens"); // lb/ft^3 // DLM: is this right? schema says could also be lb/ft^2
379
1/1
✓ Branch 1 taken 11 times.
11 pugi::xml_node specificHeatElement = element.child("SpecHt"); // Btu/(lb*F)
380 //pugi::xml_node thermalAbsorptanceElement = element.child("ThrmlAbs"); // 0-1
381 //pugi::xml_node solarAbsorbanceElement = element.child("SolAbs"); // 0-1
382 //pugi::xml_node visibleAbsorptanceElement = element.child("VisAbs"); // 0-1
383
1/1
✓ Branch 1 taken 11 times.
11 pugi::xml_node rValueElement = element.child("RVal"); // hr*ft2*degF/Btu
384
385
2/3
✓ Branch 1 taken 11 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 11 times.
11 if (!nameElement) {
386 ✗ LOG(Error, "Mat element 'Name' is empty. Material will not be created.");
387 ✗ return boost::none;
388 }
389
390
4/4
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✓ Branch 10 taken 11 times.
11 std::string name = escapeName(nameElement.text().as_string());
391
392 /*
393 OS:Material
394 Name - required
395 Roughness - default to MediumRough
396 Thickness - required, m
397 Conductivity - required, W/m-K
398 Density - required, kg/m3
399 Specific Heat - required, J/kg-K
400 Thermal Absorptance, IDD default of 0.9
401 Solar Absorptance, IDD default of 0.7
402 Visible Absorptance, IDD default of 0.7
403 */
404
11/17
✓ Branch 1 taken 11 times.
✓ Branch 3 taken 11 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 11 times.
✓ Branch 8 taken 11 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 11 times.
✓ Branch 13 taken 11 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 11 times.
✓ Branch 18 taken 11 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 11 times.
✓ Branch 23 taken 11 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 11 times.
✗ Branch 26 not taken.
11 if (nameElement && thicknessElement && thermalConductivityElement && densityElement && specificHeatElement) {
405
406
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 openstudio::model::StandardOpaqueMaterial material(model);
407
408
1/1
✓ Branch 1 taken 11 times.
11 material.setName(name);
409
410 // DLM: set on construction
411 //std::string roughness = "MediumRough";
412 //if (roughnessElement) {
413 // roughness = roughnessElement.text().as_string();
414 //}
415 //material.setRoughness(roughness);
416
417 // sdd units = in, os units = m
418
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 double thicknessInches = thicknessElement.text().as_double();
419 11 double thicknessFeet = thicknessInches / 12.0;
420
3/3
✓ Branch 1 taken 11 times.
✓ Branch 5 taken 11 times.
✓ Branch 8 taken 11 times.
11 Quantity thicknessIP(thicknessFeet, IPUnit(IPExpnt(0, 1, 0)));
421
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 OptionalQuantity thicknessSI = QuantityConverter::instance().convert(thicknessIP, siSys);
422
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 11 times.
✗ Branch 4 not taken.
11 OS_ASSERT(thicknessSI);
423
6/8
✓ Branch 1 taken 11 times.
✓ Branch 5 taken 11 times.
✓ Branch 8 taken 11 times.
✓ Branch 11 taken 11 times.
✓ Branch 14 taken 11 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 11 times.
✗ Branch 19 not taken.
11 OS_ASSERT(thicknessSI->units() == SIUnit(SIExpnt(0, 1, 0)));
424
3/3
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
11 material.setThickness(thicknessSI->value());
425
426 // sdd units = Btu/(hr*ft*F), os units = W/m-K
427
5/5
✓ Branch 1 taken 11 times.
✓ Branch 5 taken 11 times.
✓ Branch 8 taken 11 times.
✓ Branch 11 taken 11 times.
✓ Branch 14 taken 11 times.
11 Quantity thermalConductivityIP(thermalConductivityElement.text().as_double(), BTUUnit(BTUExpnt(1, -1, -1, -1)));
428
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 OptionalQuantity thermalConductivityWh = QuantityConverter::instance().convert(thermalConductivityIP, whSys);
429
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 11 times.
✗ Branch 4 not taken.
11 OS_ASSERT(thermalConductivityWh);
430
6/8
✓ Branch 1 taken 11 times.
✓ Branch 5 taken 11 times.
✓ Branch 8 taken 11 times.
✓ Branch 11 taken 11 times.
✓ Branch 14 taken 11 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 11 times.
✗ Branch 19 not taken.
11 OS_ASSERT(thermalConductivityWh->units() == WhUnit(WhExpnt(1, 0, -1, -1)));
431
3/3
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
11 material.setThermalConductivity(thermalConductivityWh->value());
432
433 // sdd units = lb/ft^3, os units = kg/m3
434
5/5
✓ Branch 1 taken 11 times.
✓ Branch 5 taken 11 times.
✓ Branch 8 taken 11 times.
✓ Branch 11 taken 11 times.
✓ Branch 14 taken 11 times.
11 Quantity densityIP(densityElement.text().as_double(), IPUnit(IPExpnt(1, -3, 0)));
435
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 OptionalQuantity densitySI = QuantityConverter::instance().convert(densityIP, siSys);
436
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 11 times.
✗ Branch 4 not taken.
11 OS_ASSERT(densitySI);
437
6/8
✓ Branch 1 taken 11 times.
✓ Branch 5 taken 11 times.
✓ Branch 8 taken 11 times.
✓ Branch 11 taken 11 times.
✓ Branch 14 taken 11 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 11 times.
✗ Branch 19 not taken.
11 OS_ASSERT(densitySI->units() == SIUnit(SIExpnt(1, -3, 0)));
438
3/3
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
11 material.setDensity(densitySI->value());
439
440 // sdd units = Btu/(lb*F), os units = J/kg-K = m^2/(s^2*K)
441
8/8
✓ Branch 1 taken 11 times.
✓ Branch 5 taken 11 times.
✓ Branch 8 taken 11 times.
✓ Branch 12 taken 11 times.
✓ Branch 15 taken 11 times.
✓ Branch 18 taken 11 times.
✓ Branch 21 taken 11 times.
✓ Branch 24 taken 11 times.
33 Quantity specificHeatIP(specificHeatElement.text().as_double(), BTUUnit(BTUExpnt(1, 0, 0, -1)) * IPUnit(IPExpnt(-1)));
442
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 OptionalQuantity specificHeatSI = QuantityConverter::instance().convert(specificHeatIP, siSys);
443
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 11 times.
✗ Branch 4 not taken.
11 OS_ASSERT(specificHeatSI);
444
6/8
✓ Branch 1 taken 11 times.
✓ Branch 5 taken 11 times.
✓ Branch 8 taken 11 times.
✓ Branch 11 taken 11 times.
✓ Branch 14 taken 11 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 11 times.
✗ Branch 19 not taken.
11 OS_ASSERT(specificHeatSI->units() == SIUnit(SIExpnt(0, 2, -2, -1)));
445
3/3
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
11 material.setSpecificHeat(specificHeatSI->value());
446
447 // DLM: set on construction
448 //if (thermalAbsorptanceElement) {
449 // material.setThermalAbsorptance(thermalAbsorptanceElement.text().as_double());
450 //}
451
452 // DLM: set on construction
453 //if (solarAbsorbanceElement) {
454 // material.setSolarAbsorptance(solarAbsorbanceElement.text().as_double());
455 //}
456
457 // DLM: set on construction
458 //if (visibleAbsorptanceElement) {
459 // material.setVisibleAbsorptance(visibleAbsorptanceElement.text().as_double());
460 //}
461
462
1/1
✓ Branch 1 taken 11 times.
11 return material;
463 11 }
464
465 /*
466 OS:Material:NoMass,
467 Name - required
468 Roughness - default to MediumRough
469 Thermal Resistance - required, m2-K/W
470 Thermal Absorptance, IDD default of 0.9
471 Solar Absorptance, IDD default of 0.7
472 Visible Absorptance, IDD default of 0.7
473 */
474 ✗ if (nameElement && rValueElement) {
475
476 ✗ openstudio::model::MasslessOpaqueMaterial material(model);
477
478 ✗ material.setName(name);
479
480 // DLM: set on construction
481 //std::string roughness = "MediumRough";
482 //if (roughnessElement) {
483 // roughness = roughnessElement.text().as_string();
484 //}
485 //material.setRoughness(roughness);
486
487 // sdd units = hr*ft2*degF/Btu, os units = m2-K/W
488 ✗ Quantity rValueIP(rValueElement.text().as_double(), BTUUnit(BTUExpnt(-1, 2, 1, 1)));
489 ✗ OptionalQuantity rValueWh = QuantityConverter::instance().convert(rValueIP, whSys);
490 ✗ OS_ASSERT(rValueWh);
491 ✗ OS_ASSERT(rValueWh->units() == WhUnit(WhExpnt(-1, 0, 2, 1)));
492 ✗ material.setThermalResistance(rValueWh->value());
493
494 // DLM: set on construction
495 //if (thermalAbsorptanceElement) {
496 // material.setThermalAbsorptance(thermalAbsorptanceElement.text().as_double());
497 //}
498
499 // DLM: set on construction
500 //if (solarAbsorbanceElement) {
501 // material.setSolarAbsorptance(solarAbsorbanceElement.text().as_double());
502 //}
503
504 // DLM: set on construction
505 //if (visibleAbsorptanceElement) {
506 // material.setVisibleAbsorptance(visibleAbsorptanceElement.text().as_double());
507 //}
508
509 ✗ return material;
510 ✗ }
511
512 ✗ LOG(Error, "Material named '" << name << "' could not be created.")
513
514 ✗ return boost::none;
515 11 }
516
517 4 boost::optional<pugi::xml_node> ForwardTranslator::translateConstructionBase(const openstudio::model::ConstructionBase& constructionBase,
518 pugi::xml_node& root) {
519 4 boost::optional<pugi::xml_node> result;
520
521
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 1 time.
8 if (constructionBase.optionalCast<model::LayeredConstruction>()) {
522
1/1
✓ Branch 1 taken 3 times.
3 auto construction = constructionBase.cast<model::LayeredConstruction>();
523
1/1
✓ Branch 1 taken 3 times.
3 model::StandardsInformationConstruction info = constructionBase.standardsInformation();
524
525 // TODO: unused
526 3 [[maybe_unused]] bool heated = false;
527
2/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
6 if (construction.optionalCast<model::Construction>()) {
528 3 heated = false;
529 ✗ } else if (construction.optionalCast<model::ConstructionWithInternalSource>()) {
530 ✗ heated = true;
531 } else {
532 ✗ return boost::none;
533 }
534
535 // check if any layer has not been translated, constructions using simple glazing material will
536 // be skipped here because the simple glazing material is not recorded as mapped
537
1/1
✓ Branch 1 taken 3 times.
3 std::vector<model::Material> layers = construction.layers();
538
2/2
✓ Branch 5 taken 10 times.
✓ Branch 6 taken 3 times.
13 for (const model::Material& material : layers) {
539
3/4
✓ Branch 2 taken 10 times.
✓ Branch 5 taken 10 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 10 times.
10 if (m_translatedObjects.find(material.handle()) == m_translatedObjects.end()) {
540 ✗ return boost::none;
541 }
542 }
543
544
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 result = root.append_child("ConsAssm");
545
546 // name
547
4/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
3 std::string name = escapeName(construction.name().get());
548
549
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 pugi::xml_node subElement = result->append_child("Name");
550
2/2
✓ Branch 1 taken 3 times.
✓ Branch 5 taken 3 times.
3 subElement.text().set(name.c_str());
551
552 // DLM: prescribed, not input
553 // specification method
554 //pugi::xml_node specMthdElement = result->append_child("SpecMthd");
555 //specMthdElement.text().set("Layers");
556
557 // SDD:
558 // CompatibleSurfType - required, done
559 // ExtSolAbs - optional, done
560 // ExtThrmlAbs - optional, done
561 // ExtVisAbs - optional, done
562 // IntSolAbs - optional, done
563 // IntThrmlAbs - optional, done
564 // IntVisAbs - optional, done
565 // SlabType - optional, skipping until we better handle slabs
566 // SlabInsOrientation - optional, skipping until we better handle slabs
567 // SlabInsThrmlR - optional, skipping until we better handle slabs
568 // FieldAppliedCoating - optional, skipping
569 // CRRCInitialRefl - optional, skipping
570 // CRRCAgedRefl - optional, skipping
571 // CRRCInitialEmittance - optional, skipping
572 // CRRCAgedEmittance - optional, skipping
573 // CRRCInitialSRI - optional, skipping
574 // CRRCAgedSRI - optional, skipping
575 // CRRCProdID - optional, skipping
576
577 3 boost::optional<std::string> compatibleSurfType;
578
1/1
✓ Branch 1 taken 3 times.
3 boost::optional<std::string> intendedSurfaceType = info.intendedSurfaceType();
579
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 if (intendedSurfaceType) {
580 ✗ if (istringEqual("ExteriorWall", *intendedSurfaceType)) {
581 ✗ compatibleSurfType = "ExteriorWall";
582 ✗ } else if (istringEqual("AtticRoof", *intendedSurfaceType) || istringEqual("ExteriorRoof", *intendedSurfaceType)) {
583 ✗ compatibleSurfType = "Roof";
584 ✗ } else if (istringEqual("ExteriorFloor", *intendedSurfaceType)) {
585 ✗ compatibleSurfType = "ExteriorFloor";
586 ✗ } else if (istringEqual("GroundContactWall", *intendedSurfaceType)) {
587 ✗ compatibleSurfType = "UndergroundWall";
588 ✗ } else if (istringEqual("GroundContactFloor", *intendedSurfaceType)) {
589 ✗ compatibleSurfType = "UndergroundFloor";
590 ✗ } else if (istringEqual("InteriorWall", *intendedSurfaceType)) {
591 ✗ compatibleSurfType = "InteriorWall";
592 ✗ } else if (istringEqual("InteriorCeiling", *intendedSurfaceType)) {
593 ✗ compatibleSurfType = "Ceiling";
594 ✗ } else if (istringEqual("InteriorFloor", *intendedSurfaceType)) {
595 ✗ compatibleSurfType = "InteriorFloor";
596 } else {
597 // DLM: warn?
598 }
599 }
600
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 if (compatibleSurfType) {
601 ✗ pugi::xml_node compatibleSurfTypeElement = result->append_child("CompatibleSurfType");
602 ✗ compatibleSurfTypeElement.text() = (*compatibleSurfType).c_str();
603 } else {
604 // DLM: warn?
605 }
606
607 3 auto n = (unsigned)layers.size();
608
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (n > 0) {
609
610 3 std::string extRoughness;
611 3 boost::optional<double> extSolarAbsorptance;
612 3 boost::optional<double> extThermalAbsorptance;
613 3 boost::optional<double> extVisibleAbsorptance;
614 3 boost::optional<double> intSolarAbsorptance;
615 3 boost::optional<double> intThermalAbsorptance;
616 3 boost::optional<double> intVisibleAbsorptance;
617
618
2/3
✓ Branch 2 taken 3 times.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
6 if (layers[0].optionalCast<model::StandardOpaqueMaterial>()) {
619
1/1
✓ Branch 2 taken 3 times.
3 auto extMaterial = layers[0].cast<model::StandardOpaqueMaterial>();
620
1/1
✓ Branch 1 taken 3 times.
3 extRoughness = extMaterial.roughness();
621
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 extSolarAbsorptance = extMaterial.solarAbsorptance();
622
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 extThermalAbsorptance = extMaterial.thermalAbsorptance();
623
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 extVisibleAbsorptance = extMaterial.visibleAbsorptance();
624
0/3
✗ Branch 3 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
3 } else if (layers[0].optionalCast<model::MasslessOpaqueMaterial>()) {
625 ✗ auto extMaterial = layers[0].cast<model::MasslessOpaqueMaterial>();
626 ✗ extRoughness = extMaterial.roughness();
627 ✗ extSolarAbsorptance = extMaterial.solarAbsorptance();
628 ✗ extThermalAbsorptance = extMaterial.thermalAbsorptance();
629 ✗ extVisibleAbsorptance = extMaterial.visibleAbsorptance();
630 ✗ }
631
632
3/3
✓ Branch 2 taken 3 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 1 time.
6 if (layers[n - 1].optionalCast<model::StandardOpaqueMaterial>()) {
633
1/1
✓ Branch 2 taken 2 times.
2 auto intMaterial = layers[n - 1].cast<model::StandardOpaqueMaterial>();
634
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 intSolarAbsorptance = intMaterial.solarAbsorptance();
635
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 intThermalAbsorptance = intMaterial.thermalAbsorptance();
636
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 intVisibleAbsorptance = intMaterial.visibleAbsorptance();
637
2/3
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
4 } else if (layers[n - 1].optionalCast<model::MasslessOpaqueMaterial>()) {
638
1/1
✓ Branch 2 taken 1 time.
1 auto intMaterial = layers[n - 1].cast<model::MasslessOpaqueMaterial>();
639
1/1
✓ Branch 1 taken 1 time.
1 intSolarAbsorptance = intMaterial.solarAbsorptance();
640
1/1
✓ Branch 1 taken 1 time.
1 intThermalAbsorptance = intMaterial.thermalAbsorptance();
641
1/1
✓ Branch 1 taken 1 time.
1 intVisibleAbsorptance = intMaterial.visibleAbsorptance();
642 1 }
643
644 // DLM: Not input
645 // ext roughness
646 //if (!extRoughness.empty()) {
647 // pugi::xml_node roughnessElement = result->append_child("ExtRoughness");
648 // roughnessElement.text() = openstudio::string_conversions::number(*extRoughness).c_str()
649 //}
650
651 // DLM: Not input
652 // ext solarAbsorptance
653 //if (extSolarAbsorptance) {
654 // pugi::xml_node solarAbsorptanceElement = result->append_child("ExtSolAbs");
655 // solarAbsorptanceElement.text() = openstudio::string_conversions::number(*extSolarAbsorptance).c_str();
656 //}
657
658 // DLM: Not input
659 // ext thermalAbsorptance
660 //if (extThermalAbsorptance) {
661 // pugi::xml_node thermalAbsorptanceElement = result->append_child("ExtThrmlAbs");
662 // thermalAbsorptanceElement.text() = openstudio::string_conversions::number(*extThermalAbsorptance).c_str();
663 //}
664
665 // DLM: Not input
666 // ext visibleAbsorptance
667 //if (extVisibleAbsorptance) {
668 // pugi::xml_node visibleAbsorptanceElement = result->append_child("ExtVisAbs");
669 // visibleAbsorptanceElement.text() = openstudio::string_conversions::number(*extVisibleAbsorptance).c_str();
670 //}
671
672 // DLM: Not input
673 // int solarAbsorptance
674 //if (intSolarAbsorptance) {
675 // pugi::xml_node solarAbsorptanceElement = result->append_child("IntSolAbs");
676 // solarAbsorptanceElement.text() = openstudio::string_conversions::number(*intSolarAbsorptance).c_str();
677 //}
678
679 // DLM: Not input
680 // int thermalAbsorptance
681 //if (intThermalAbsorptance) {
682 // pugi::xml_node thermalAbsorptanceElement = result->append_child("IntThrmlAbs");
683 // thermalAbsorptanceElement.text() = openstudio::string_conversions::number(*intThermalAbsorptance).c_str();
684 //}
685
686 // DLM: Not input
687 // int visibleAbsorptance
688 //if (intVisibleAbsorptance) {
689 // pugi::xml_node visibleAbsorptanceElement = result->append_child("IntVisAbs");
690 // visibleAbsorptanceElement.text() = openstudio::string_conversions::number(*intVisibleAbsorptance).c_str();
691 //}
692 3 }
693
694
2/2
✓ Branch 5 taken 10 times.
✓ Branch 6 taken 3 times.
13 for (const model::Material& material : layers) {
695
696 // materialReference
697
3/3
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
10 std::string materialName = material.name().get();
698
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 pugi::xml_node materialReferenceElement = result->append_child("MatRef");
699
4/4
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 8 taken 10 times.
✓ Branch 11 taken 10 times.
10 materialReferenceElement.text() = escapeName(materialName).c_str();
700 10 }
701
702
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 m_translatedObjects[construction.handle()] = *result;
703
704
5/9
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 time.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 time.
5 } else if (constructionBase.optionalCast<model::FFactorGroundFloorConstruction>()) {
705 // DLM: I think this is out of date
706 ✗ auto construction = constructionBase.cast<model::FFactorGroundFloorConstruction>();
707
708 ✗ result = root.append_child("ConsAssm");
709
710 // name
711 ✗ std::string name = construction.name().get();
712 ✗ pugi::xml_node nameElement = result->append_child("Name");
713 ✗ nameElement.text() = escapeName(name).c_str();
714
715 // DLM: prescribed, not input
716 // specification method
717 //pugi::xml_node specMthdElement = result->append_child("SpecMthd");
718 //specMthdElement.text() = "FFactor";
719
720 // DLM: not input
721 // specification method
722 //pugi::xml_node fFactorElement = result->append_child("FFactor");
723 //// sdd units = Btu/(hr*ft*F), os units = W/(m*K)
724 //Quantity fFactorSI(construction.fFactor(), WhUnit(WhExpnt(1,0,-1,-1)));
725 //OptionalQuantity fFactorIP = QuantityConverter::instance().convert(fFactorSI, UnitSystem(UnitSystem::BTU));
726 //OS_ASSERT(fFactorIP);
727 //OS_ASSERT(fFactorIP->units() == BTUUnit(BTUExpnt(1,-1,-1,-1)));
728 //fFactorElement.text() = openstudio::string_conversions::number(fFactorIP->value()).c_str();
729
730 // DLM: cannot write out
731 //<IntSolAbs>0.7</IntSolAbs>
732 //<IntThrmlAbs>0.9</IntThrmlAbs>
733 //<IntVisAbs>0.5</IntVisAbs>
734 //<MatRef index="0">NACM_Concrete 4in</MatRef>
735 //<MatRef index="1">NACM_Carpet Pad</MatRef>
736
737 ✗ m_translatedObjects[construction.handle()] = *result;
738
739
2/3
✓ Branch 3 taken 1 time.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 time.
2 } else if (constructionBase.optionalCast<model::CFactorUndergroundWallConstruction>()) {
740 // DLM: I think this is out of date
741 ✗ auto construction = constructionBase.cast<model::CFactorUndergroundWallConstruction>();
742
743 ✗ result = root.append_child("ConsAssm");
744
745 // name
746 ✗ std::string name = construction.name().get();
747 ✗ pugi::xml_node nameElement = result->append_child("Name");
748 ✗ nameElement.text() = escapeName(name).c_str();
749
750 // DLM: prescribed, not input
751 // specification method
752 //pugi::xml_node specMthdElement = result->append_child("SpecMthd");
753 //specMthdElement.text() = "CFactor";
754
755 // DLM: not input
756 // specification method
757 //pugi::xml_node cFactorElement = result->append_child("CFactor");
758 //// sdd units = Btu/(hr*ft^2*F), os units = W/(m^2*K)
759 //Quantity cFactorSI(construction.cFactor(), WhUnit(WhExpnt(1,0,-2,-1)));
760 //OptionalQuantity cFactorIP = QuantityConverter::instance().convert(cFactorSI, UnitSystem(UnitSystem::BTU));
761 //OS_ASSERT(cFactorIP);
762 //OS_ASSERT(cFactorIP->units() == BTUUnit(BTUExpnt(1,-2,-1,-1)));
763 //cFactorElement.text() = openstudio::string_conversions::number(cFactorIP->value()).c_str();
764
765 // DLM: cannot write out
766 //<IntSolAbs>0.7</IntSolAbs>
767 //<IntThrmlAbs>0.9</IntThrmlAbs>
768 //<IntVisAbs>0.5</IntVisAbs>
769 //<MatRef index="0">NACM_Concrete 4in</MatRef>
770 //<MatRef index="1">NACM_Carpet Pad</MatRef>
771
772 ✗ m_translatedObjects[construction.handle()] = *result;
773 ✗ }
774
775 // TODO: handle u-factor constructions
776
777 4 return result;
778 4 }
779
780 1 boost::optional<pugi::xml_node> ForwardTranslator::translateDoorConstruction(const openstudio::model::ConstructionBase& constructionBase,
781 pugi::xml_node& root) {
782 1 boost::optional<pugi::xml_node> result;
783
784
1/1
✓ Branch 1 taken 1 time.
1 UnitSystem ipSys(UnitSystem::IP);
785
1/1
✓ Branch 1 taken 1 time.
1 UnitSystem btuSys(UnitSystem::BTU);
786
787
2/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
2 if (constructionBase.optionalCast<model::Construction>()) {
788
1/1
✓ Branch 1 taken 1 time.
1 auto construction = constructionBase.cast<model::Construction>();
789
1/1
✓ Branch 1 taken 1 time.
1 model::StandardsInformationConstruction info = constructionBase.standardsInformation();
790
791
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 result = root.append_child("DrCons");
792
793 // name
794
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 std::string name = construction.name().get();
795
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 pugi::xml_node nameElement = result->append_child("Name");
796
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
1 nameElement.text() = escapeName(name).c_str();
797
798 // SDD:
799 // Type - required, skipping
800 // CertificationMthd - required, defaulted to NFRC unless missing performance data
801 // UFactor - optional, done
802 // Open - optional, done
803
804 1 boost::optional<std::string> type;
805
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<std::string> certificationMthd = std::string("NFRCRated");
806 1 boost::optional<double> uFactor;
807 1 boost::optional<std::string> open;
808
809 // can only get UFactor for special cases
810
1/1
✓ Branch 1 taken 1 time.
1 std::vector<model::Material> layers = construction.layers();
811
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (layers.size() == 1) {
812
2/3
✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
2 if (layers[0].optionalCast<model::MasslessOpaqueMaterial>()) {
813
814
1/1
✓ Branch 2 taken 1 time.
1 auto material = layers[0].cast<model::MasslessOpaqueMaterial>();
815
816 // os units = W/m2-K, sdd units = Btu/(hr*f2t*F)
817
4/4
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
1 Quantity uFactorSI(material.thermalConductance(), WhUnit(WhExpnt(1, 0, -2, -1)));
818
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 OptionalQuantity uFactorIP = QuantityConverter::instance().convert(uFactorSI, btuSys);
819
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(uFactorIP);
820
6/8
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
✓ Branch 14 taken 1 time.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 time.
✗ Branch 19 not taken.
1 OS_ASSERT(uFactorIP->units() == BTUUnit(BTUExpnt(1, -2, -1, -1)));
821
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 uFactor = uFactorIP->value();
822 1 }
823 }
824
825
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
1 if (!uFactor) {
826 ✗ certificationMthd.reset();
827 }
828
829
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<std::string> fenestrationType = info.fenestrationType();
830
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (fenestrationType) {
831 ✗ if (istringEqual("Swinging Door", *fenestrationType)) {
832 ✗ open = "Swinging";
833 ✗ } else if (istringEqual("Non-Swinging Door", *fenestrationType)) {
834 ✗ open = "NonSwinging";
835 }
836 }
837
838 // write the xml
839
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (type) {
840 ✗ pugi::xml_node typeElement = result->append_child("Type");
841 ✗ typeElement.text() = type.get().c_str();
842 }
843
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (certificationMthd) {
844
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 pugi::xml_node certificationMthdElement = result->append_child("CertificationMthd");
845
3/3
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
1 certificationMthdElement.text() = certificationMthd.get().c_str();
846 }
847
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (uFactor) {
848
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 pugi::xml_node uFactorElement = result->append_child("UFactor");
849
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
1 uFactorElement.text() = openstudio::string_conversions::number(*uFactor).c_str();
850 } else {
851 //Do not want this logged, http://code.google.com/p/cbecc/issues/detail?id=695
852 //LOG(Error, "Could not calculate UFactor for DrCons '" << name << "'");
853 }
854
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (open) {
855 ✗ pugi::xml_node openElement = result->append_child("Open");
856 ✗ openElement.text() = open.get().c_str();
857 }
858
859 // mark the construction as translated, not the material
860
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 m_translatedObjects[construction.handle()] = result.get();
861 1 }
862
863 2 return result;
864 ✗ }
865
866 1 boost::optional<pugi::xml_node> ForwardTranslator::translateFenestrationConstruction(const openstudio::model::ConstructionBase& constructionBase,
867 pugi::xml_node& root) {
868 1 boost::optional<pugi::xml_node> result;
869
870
1/1
✓ Branch 1 taken 1 time.
1 UnitSystem ipSys(UnitSystem::IP);
871
1/1
✓ Branch 1 taken 1 time.
1 UnitSystem btuSys(UnitSystem::BTU);
872
873
2/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
2 if (constructionBase.optionalCast<model::Construction>()) {
874
1/1
✓ Branch 1 taken 1 time.
1 auto construction = constructionBase.cast<model::Construction>();
875
1/1
✓ Branch 1 taken 1 time.
1 model::StandardsInformationConstruction info = constructionBase.standardsInformation();
876
877
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 result = root.append_child("FenCons");
878
879 // name
880
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 std::string name = construction.name().get();
881
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 pugi::xml_node nameElement = result->append_child("Name");
882
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
1 nameElement.text() = escapeName(name).c_str();
883
884 // SDD:
885 // FenType - required, done
886 // FenProdType - optional, done
887 // AssmContext - required, done
888 // CertificationMthd - required, defaulted to NFRCRated unless field fabricated or missing performance data, might be incorrect?
889 // SkyltGlz - optional, done
890 // SkyltCurb - optional, done
891 // OperableWinConfiguration - optional, skipping
892 // GreenhouseGardenWin - optional, skipping
893 // FenFrm - optional, done
894 // FenPanes - optional, done
895 // GlzTint - optional, done
896 // WinDivider - optional, done
897 // Diffusing - optional, skipping
898 // SHGC - optional, done
899 // SHGCCOG - optional, not supported
900 // UFactor - optional, done
901 // UFactorCOG - optional, not supported
902 // VT - optional, done
903 // VTCOG - optional, not supported
904
905
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<std::string> fenestrationType = info.fenestrationType();
906 1 boost::optional<std::string> fenType;
907 1 boost::optional<std::string> fenProdType;
908 1 boost::optional<std::string> skyltGlz;
909 1 boost::optional<std::string> skyltCurb;
910 1 boost::optional<std::string> operableWinConfiguration;
911 1 boost::optional<std::string> glzTint;
912
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (fenestrationType) {
913 ✗ if (istringEqual("Glass Skylight with Curb", *fenestrationType)) {
914 ✗ fenType = "Skylight";
915 ✗ skyltGlz = "Glass";
916 ✗ skyltCurb = "CurbMounted";
917 ✗ } else if (istringEqual("Plastic Skylight with Curb", *fenestrationType)) {
918 ✗ fenType = "Skylight";
919 ✗ skyltGlz = "Plastic";
920 ✗ skyltCurb = "CurbMounted";
921 ✗ } else if (istringEqual("Glass Skylight without Curb", *fenestrationType)) {
922 ✗ fenType = "Skylight";
923 ✗ skyltGlz = "Glass";
924 ✗ skyltCurb = "DeckMounted";
925 ✗ } else if (istringEqual("Plastic Skylight without Curb", *fenestrationType)) {
926 ✗ fenType = "Skylight";
927 ✗ skyltGlz = "Plastic";
928 ✗ skyltCurb = "DeckMounted";
929 } else {
930 ✗ fenType = "VerticalFenestration";
931
932 ✗ if (istringEqual("Fixed Window", *fenestrationType)) {
933 ✗ fenProdType = "FixedWindow";
934 ✗ } else if (istringEqual("Operable Window", *fenestrationType)) {
935 ✗ fenProdType = "OperableWindow";
936
937 // DLM: todo set operableWinConfiguration
938 //operableWinConfiguration = "CasementAwning" or "Sliding"
939 ✗ } else if (istringEqual("Curtain Wall", *fenestrationType)) {
940 ✗ fenProdType = "CurtainWall";
941 ✗ } else if (istringEqual("Glazed Door", *fenestrationType)) {
942 ✗ fenProdType = "GlazedDoor";
943 } else {
944 // 'Swinging Door' or 'Non-Swinging Door'
945 // These should have been grouped with door constructions, potentially warn
946 }
947
948 ✗ boost::optional<std::string> fenestrationTint = info.fenestrationTint();
949 ✗ if (fenestrationTint) {
950 ✗ if (istringEqual("Clear", *fenestrationTint)) {
951 ✗ glzTint = "ClearGlazing";
952 } else {
953 ✗ glzTint = "TintedGlazing";
954 }
955 }
956 ✗ }
957 }
958
959 1 boost::optional<std::string> assmContext;
960
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<std::string> certificationMthd = std::string("NFRCRated"); // default
961
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<std::string> fenestrationAssemblyContext = info.fenestrationAssemblyContext();
962
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (fenestrationAssemblyContext) {
963 ✗ if (istringEqual("Manufactured", *fenestrationAssemblyContext)) {
964 ✗ assmContext = "Manufactured";
965 ✗ } else if (istringEqual("Field Fabricated", *fenestrationAssemblyContext)) {
966 ✗ assmContext = "FieldFabricated";
967 ✗ certificationMthd = "CECDefaultPerformance"; // right?
968 ✗ } else if (istringEqual("Site Built", *fenestrationAssemblyContext)) {
969 ✗ assmContext = "SiteBuilt";
970 }
971 }
972
973 1 boost::optional<std::string> greenhouseGardenWin;
974
975 1 boost::optional<std::string> fenFrm;
976
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<std::string> fenestrationFrameType = info.fenestrationFrameType();
977
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (fenestrationFrameType) {
978 ✗ if (istringEqual("Metal Framing", *fenestrationFrameType)) {
979 ✗ fenFrm = "MetalFraming";
980 ✗ } else if (istringEqual("Metal Framing with Thermal Break", *fenestrationFrameType)) {
981 ✗ fenFrm = "MetalFramingWithThermalBreak";
982 ✗ } else if (istringEqual("Non-Metal Framing", *fenestrationFrameType)) {
983 ✗ fenFrm = "NonMetalFraming";
984 }
985 }
986
987 1 boost::optional<std::string> fenPanes;
988
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<std::string> fenestrationNumberOfPanes = info.fenestrationNumberOfPanes();
989
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (fenestrationNumberOfPanes) {
990 ✗ if (istringEqual("Single Pane", *fenestrationNumberOfPanes)) {
991 ✗ fenPanes = "SinglePane";
992 ✗ } else if (istringEqual("Double Pane", *fenestrationNumberOfPanes)) {
993 ✗ fenPanes = "DoublePane";
994 ✗ } else if (istringEqual("Triple Pane", *fenestrationNumberOfPanes)) {
995 ✗ fenPanes = "DoublePane";
996 ✗ } else if (istringEqual("Quadruple Pane", *fenestrationNumberOfPanes)) {
997 ✗ fenPanes = "DoublePane";
998 ✗ } else if (istringEqual("Glass Block", *fenestrationNumberOfPanes)) {
999 ✗ fenPanes = "GlassBlock";
1000 }
1001 }
1002
1003 1 boost::optional<std::string> winDivider;
1004
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<std::string> fenestrationDividerType = info.fenestrationDividerType();
1005
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (fenestrationDividerType) {
1006 ✗ if (istringEqual("True Divided Lite", *fenestrationDividerType)) {
1007 ✗ winDivider = "TrueDividedLite";
1008 ✗ } else if (istringEqual("Between Panes < 7/16\"", *fenestrationDividerType)) {
1009 ✗ winDivider = "DividerBtwnPanesLessThan7_16in";
1010 ✗ } else if (istringEqual("Between Panes >= 7/16\"", *fenestrationDividerType)) {
1011 ✗ winDivider = "DividerBtwnPanesGreaterThanOrEqualTo7_16in";
1012 }
1013 }
1014
1015 1 boost::optional<std::string> diffusing;
1016
1017 1 boost::optional<double> shgc;
1018 1 boost::optional<double> uFactor;
1019 1 boost::optional<double> vt;
1020
1021 // can only get SHGC, TVis, UFactor for special cases
1022
1/1
✓ Branch 1 taken 1 time.
1 std::vector<model::Material> layers = construction.layers();
1023
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (layers.size() == 1) {
1024
2/3
✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
2 if (layers[0].optionalCast<model::SimpleGlazing>()) {
1025
1026
1/1
✓ Branch 2 taken 1 time.
1 auto simpleGlazing = layers[0].cast<model::SimpleGlazing>();
1027
1028
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 shgc = simpleGlazing.solarHeatGainCoefficient();
1029
1030 // os units = W/m2-K, sdd units = Btu/(hr*f2t*F)
1031
4/4
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
1 Quantity uFactorSI(simpleGlazing.uFactor(), WhUnit(WhExpnt(1, 0, -2, -1)));
1032
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 OptionalQuantity uFactorIP = QuantityConverter::instance().convert(uFactorSI, btuSys);
1033
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(uFactorIP);
1034
6/8
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
✓ Branch 14 taken 1 time.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 time.
✗ Branch 19 not taken.
1 OS_ASSERT(uFactorIP->units() == BTUUnit(BTUExpnt(1, -2, -1, -1)));
1035
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 uFactor = uFactorIP->value();
1036
1037
1/1
✓ Branch 1 taken 1 time.
1 vt = simpleGlazing.visibleTransmittance();
1038 1 }
1039 }
1040
1041 // if performance is not known use defaults if possible
1042
4/8
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 time.
1 if (!shgc || !uFactor || !vt) {
1043 ✗ if (fenFrm && fenPanes) {
1044 ✗ certificationMthd = "CECDefaultPerformance";
1045 }
1046 }
1047
1048 // write to XML
1049
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (fenType) {
1050 ✗ pugi::xml_node fenTypeElement = result->append_child("FenType");
1051 ✗ fenTypeElement.text() = fenType.get().c_str();
1052 }
1053
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (fenProdType) {
1054 ✗ pugi::xml_node fenProdTypeElement = result->append_child("FenProdType");
1055 ✗ fenProdTypeElement.text() = fenProdType.get().c_str();
1056 }
1057
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (assmContext) {
1058 ✗ pugi::xml_node assmContextElement = result->append_child("AssmContext");
1059 ✗ assmContextElement.text() = assmContext.get().c_str();
1060 }
1061
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (certificationMthd) {
1062
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 pugi::xml_node certificationMthdElement = result->append_child("CertificationMthd");
1063
3/3
✓ Branch 1 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
1 certificationMthdElement.text() = certificationMthd.get().c_str();
1064 }
1065
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (skyltGlz) {
1066 ✗ pugi::xml_node skyltGlzElement = result->append_child("SkyltGlz");
1067 ✗ skyltGlzElement.text() = skyltGlz.get().c_str();
1068 }
1069
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (skyltCurb) {
1070 ✗ pugi::xml_node skyltCurbElement = result->append_child("SkyltCurb");
1071 ✗ skyltCurbElement.text() = skyltCurb.get().c_str();
1072 }
1073
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (operableWinConfiguration) {
1074 ✗ pugi::xml_node operableWinConfigurationElement = result->append_child("OperableWinConfiguration");
1075 ✗ operableWinConfigurationElement.text() = operableWinConfiguration.get().c_str();
1076 }
1077
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (greenhouseGardenWin) {
1078 ✗ pugi::xml_node greenhouseGardenWinElement = result->append_child("GreenhouseGardenWin");
1079 ✗ greenhouseGardenWinElement.text() = greenhouseGardenWin.get().c_str();
1080 }
1081
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (fenFrm) {
1082 ✗ pugi::xml_node fenFrmElement = result->append_child("FenFrm");
1083 ✗ fenFrmElement.text() = fenFrm.get().c_str();
1084 }
1085
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (fenPanes) {
1086 ✗ pugi::xml_node fenPanesElement = result->append_child("FenPanes");
1087 ✗ fenPanesElement.text() = fenPanes.get().c_str();
1088 }
1089
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (glzTint) {
1090 ✗ pugi::xml_node glzTintElement = result->append_child("GlzTint");
1091 ✗ glzTintElement.text() = glzTint.get().c_str();
1092 }
1093
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (winDivider) {
1094 ✗ pugi::xml_node winDividerElement = result->append_child("WinDivider");
1095 ✗ winDividerElement.text() = glzTint.get().c_str();
1096 }
1097
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (diffusing) {
1098 ✗ pugi::xml_node diffusingElement = result->append_child("Diffusing");
1099 ✗ diffusingElement.text() = diffusing.get().c_str();
1100 }
1101
1102 // Numbers
1103
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (shgc) {
1104
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 pugi::xml_node shgcElement = result->append_child("SHGC");
1105
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
1 shgcElement.text() = openstudio::string_conversions::number(*shgc).c_str();
1106 } else {
1107 //Do not want this logged, http://code.google.com/p/cbecc/issues/detail?id=695
1108 //LOG(Error, "Could not calculate SHGC for FenCons '" << name << "'");
1109 }
1110
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (uFactor) {
1111
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 pugi::xml_node uFactorElement = result->append_child("UFactor");
1112
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
1 uFactorElement.text() = openstudio::string_conversions::number(*uFactor).c_str();
1113 } else {
1114 //Do not want this logged, http://code.google.com/p/cbecc/issues/detail?id=695
1115 //LOG(Error, "Could not calculate UFactor for FenCons '" << name << "'");
1116 }
1117
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (vt) {
1118
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 pugi::xml_node vtElement = result->append_child("VT");
1119
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✓ Branch 11 taken 1 time.
1 vtElement.text() = openstudio::string_conversions::number(*vt).c_str();
1120 } else {
1121 //Do not want this logged, http://code.google.com/p/cbecc/issues/detail?id=695
1122 //LOG(Error, "Could not calculate VT for FenCons '" << name << "'");
1123 }
1124
1125 // mark the construction as translated, not the material
1126
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 m_translatedObjects[construction.handle()] = result.get();
1127 1 }
1128
1129 2 return result;
1130 ✗ }
1131
1132 16 boost::optional<pugi::xml_node> ForwardTranslator::translateMaterial(const openstudio::model::Material& material, pugi::xml_node& root) {
1133
1134
9/14
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 10 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 2 times.
✓ Branch 14 taken 16 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 2 times.
✓ Branch 18 taken 14 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
62 if (!(material.optionalCast<model::StandardOpaqueMaterial>() || material.optionalCast<model::MasslessOpaqueMaterial>()
1135
7/9
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 12 times.
✓ Branch 8 taken 6 times.
✓ Branch 9 taken 10 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
24 || material.optionalCast<model::AirGap>())) {
1136 2 return boost::none;
1137 }
1138
1139
1/1
✓ Branch 1 taken 14 times.
14 model::StandardsInformationMaterial info = material.standardsInformation();
1140
1141
1/1
✓ Branch 1 taken 14 times.
14 pugi::xml_node result = root.append_child("Mat");
1142
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 m_translatedObjects[material.handle()] = result;
1143
1144 // name
1145
3/3
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
14 std::string name = material.name().get();
1146
1/1
✓ Branch 1 taken 14 times.
14 pugi::xml_node nameElement = result.append_child("Name");
1147
4/4
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 8 taken 14 times.
✓ Branch 11 taken 14 times.
14 nameElement.text() = escapeName(name).c_str();
1148
1149 // SDD:
1150 // CodeCat - compulsory, done
1151 // CodeItem - compulsory, done
1152 // FrmMat - optional, done
1153 // FrmConfig - optional, done
1154 // FrmDepth - optional, done
1155 // CavityIns - optional, done
1156 // CavityInsOpt - optional, done
1157 // CompositeMatNotes - optional, skipping
1158 // HeaderIns - optional, not used
1159 // CMUWt - optional, not used
1160 // CMUFill - optional, not used
1161 // SpandrelPanelIns - optional, not used
1162 // ICCESRptNum - optional, skipping
1163 // InsOutsdWtrprfMemb - optional, skipping
1164
1165
1/1
✓ Branch 1 taken 14 times.
14 boost::optional<std::string> standardsCategory = info.standardsCategory();
1166
2/7
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 14 times.
14 if (standardsCategory && info.isCompositeMaterial()) {
1167 ✗ standardsCategory = "Composite";
1168 }
1169
1170
1/1
✓ Branch 1 taken 14 times.
14 boost::optional<std::string> standardsIdentifier = info.standardsIdentifier();
1171
1/1
✓ Branch 1 taken 14 times.
14 boost::optional<std::string> compositeFramingMaterial = info.compositeFramingMaterial();
1172
1/1
✓ Branch 1 taken 14 times.
14 boost::optional<std::string> compositeFramingConfiguration = info.compositeFramingConfiguration();
1173
1/1
✓ Branch 1 taken 14 times.
14 boost::optional<std::string> compositeFramingDepth = info.compositeFramingDepth();
1174
1/1
✓ Branch 1 taken 14 times.
14 boost::optional<std::string> compositeFramingSize = info.compositeFramingSize();
1175
1/1
✓ Branch 1 taken 14 times.
14 boost::optional<std::string> compositeCavityInsulation = info.compositeCavityInsulation();
1176
1177
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (standardsCategory) {
1178 ✗ pugi::xml_node element = result.append_child("CodeCat");
1179 ✗ element.text() = standardsCategory.get().c_str();
1180 }
1181
1182
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (standardsIdentifier) {
1183 ✗ pugi::xml_node element = result.append_child("CodeItem");
1184 ✗ element.text() = standardsIdentifier.get().c_str();
1185 }
1186
1187
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (compositeFramingMaterial) {
1188 ✗ pugi::xml_node element = result.append_child("FrmMat");
1189 ✗ element.text() = compositeFramingMaterial.get().c_str();
1190 }
1191
1192
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (compositeFramingConfiguration) {
1193 ✗ pugi::xml_node element = result.append_child("FrmConfig");
1194 ✗ element.text() = compositeFramingConfiguration.get().c_str();
1195 }
1196
1197
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (compositeFramingDepth) {
1198 ✗ pugi::xml_node element = result.append_child("FrmDepth");
1199 ✗ element.text() = compositeFramingDepth.get().c_str();
1200 }
1201
1202
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (compositeCavityInsulation) {
1203
1204 // DLM: this is a stupid switch, this should get fixed in CBECC rules
1205 ✗ if (compositeFramingMaterial && istringEqual("Metal", *compositeFramingMaterial)) {
1206 ✗ std::string value = compositeCavityInsulation.get();
1207 try {
1208 ✗ auto valueNum = boost::lexical_cast<double>(value);
1209 ✗ value = "R-" + std::to_string(valueNum);
1210 ✗ } catch (const boost::bad_lexical_cast&) {
1211 ✗ }
1212 ✗ pugi::xml_node element = result.append_child("CavityInsOpt");
1213 ✗ element.text() = value.c_str();
1214
1215 ✗ } else {
1216 ✗ pugi::xml_node element = result.append_child("CavityIns");
1217 ✗ element.text() = compositeCavityInsulation.get().c_str();
1218 }
1219 }
1220
1221
1/1
✓ Branch 1 taken 14 times.
14 return result;
1222 14 }
1223
1224 } // namespace sdd
1225 } // namespace openstudio
1226