MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / translateMaterial

Method translateMaterial

src/gbxml/MapEnvelope.cpp:169–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167 }
168
169 boost::optional<openstudio::model::ModelObject> ReverseTranslator::translateMaterial(const pugi::xml_node& element,
170 openstudio::model::Model& model) {
171 boost::optional<openstudio::model::ModelObject> result;
172
173 auto rvalueElement = element.child("R-value");
174 auto densityElement = element.child("Density");
175 auto conductivityElement = element.child("Conductivity");
176 auto thicknessElement = element.child("Thickness");
177 auto specificHeatElement = element.child("SpecificHeat");
178 auto roughnessElement = element.child("Roughness");
179
180 boost::optional<double> extir;
181 boost::optional<double> extsolar;
182 boost::optional<double> extvisible;
183
184 for (auto& absorptanceEl : element.children("Absorptance")) {
185 if (istringEqual("Fraction", absorptanceEl.attribute("unit").value())) {
186 if (istringEqual("ExtIR", absorptanceEl.attribute("type").value())) {
187 extir = absorptanceEl.text().as_double();
188 } else if (istringEqual("ExtSolar", absorptanceEl.attribute("type").value())) {
189 extsolar = absorptanceEl.text().as_double();
190 } else if (istringEqual("ExtVisible", absorptanceEl.attribute("type").value())) {
191 extvisible = absorptanceEl.text().as_double();
192 }
193 }
194 }
195
196 if (!(densityElement.empty() || conductivityElement.empty() || thicknessElement.empty() || specificHeatElement.empty())) {
197
198 double density = densityElement.text().as_double();
199 double conductivity = conductivityElement.text().as_double();
200 double thickness = thicknessElement.text().as_double();
201 double specificHeat = specificHeatElement.text().as_double();
202
203 std::string roughness = "MediumRough"; // TODO: Shouldn't that be the same default as OS (Smooth)?
204 if (!roughnessElement.empty()) {
205 roughness = roughnessElement.attribute("value").value();
206 }
207
208 openstudio::model::StandardOpaqueMaterial material(model);
209 result = material;
210
211 translateId(element, material);
212 translateName(element, material);
213
214 material.setDensity(density);
215 material.setThermalConductivity(conductivity);
216 material.setThickness(thickness);
217 material.setSpecificHeat(specificHeat);
218 material.setRoughness(roughness);
219 if (extir) {
220 material.setThermalAbsorptance(*extir);
221 }
222 if (extsolar) {
223 material.setSolarAbsorptance(*extsolar);
224 }
225 if (extvisible) {
226 material.setVisibleAbsorptance(*extvisible);

Callers

nothing calls this directly

Calls 15

istringEqualFunction · 0.85
childrenMethod · 0.45
valueMethod · 0.45
attributeMethod · 0.45
emptyMethod · 0.45
setDensityMethod · 0.45
setThicknessMethod · 0.45
setSpecificHeatMethod · 0.45
setRoughnessMethod · 0.45
setThermalAbsorptanceMethod · 0.45
setSolarAbsorptanceMethod · 0.45

Tested by

no test coverage detected