src/energyplus/ReverseTranslator/ReverseTranslateMaterial.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 | |||
| 8 | #include "../../model/StandardOpaqueMaterial.hpp" | ||
| 9 | #include "../../model/StandardOpaqueMaterial_Impl.hpp" | ||
| 10 | |||
| 11 | #include <utilities/idd/Material_FieldEnums.hxx> | ||
| 12 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 13 | #include <utilities/idd/IddEnums.hxx> | ||
| 14 | |||
| 15 | using namespace openstudio::model; | ||
| 16 | |||
| 17 | namespace openstudio { | ||
| 18 | |||
| 19 | namespace energyplus { | ||
| 20 | |||
| 21 | 251 | OptionalModelObject ReverseTranslator::translateMaterial(const WorkspaceObject& workspaceObject) { | |
| 22 | 251 | OptionalModelObject result; | |
| 23 |
4/5✓ Branch 1 taken 251 times.
✓ Branch 4 taken 251 times.
✓ Branch 7 taken 251 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 251 times.
|
251 | if (workspaceObject.iddObject().type() != IddObjectType::Material) { |
| 24 | ✗ | LOG(Error, "WorkspaceObject is not IddObjectType: Material"); | |
| 25 | ✗ | return result; | |
| 26 | } | ||
| 27 | |||
| 28 |
2/2✓ Branch 1 taken 251 times.
✓ Branch 4 taken 251 times.
|
251 | openstudio::model::StandardOpaqueMaterial mat(m_model); |
| 29 |
1/1✓ Branch 1 taken 251 times.
|
251 | OptionalString optS = workspaceObject.name(); |
| 30 |
1/2✓ Branch 0 taken 251 times.
✗ Branch 1 not taken.
|
251 | if (optS) { |
| 31 |
2/2✓ Branch 1 taken 251 times.
✓ Branch 4 taken 251 times.
|
251 | mat.setName(*optS); |
| 32 | } | ||
| 33 | |||
| 34 |
1/1✓ Branch 1 taken 251 times.
|
251 | optS = workspaceObject.getString(MaterialFields::Roughness); |
| 35 |
1/2✓ Branch 0 taken 251 times.
✗ Branch 1 not taken.
|
251 | if (optS) { |
| 36 |
2/2✓ Branch 1 taken 251 times.
✓ Branch 4 taken 251 times.
|
251 | mat.setRoughness(*optS); |
| 37 | } | ||
| 38 | |||
| 39 |
1/1✓ Branch 1 taken 251 times.
|
251 | OptionalDouble od = workspaceObject.getDouble(MaterialFields::Thickness); |
| 40 |
1/2✓ Branch 0 taken 251 times.
✗ Branch 1 not taken.
|
251 | if (od) { |
| 41 |
2/2✓ Branch 1 taken 251 times.
✓ Branch 4 taken 251 times.
|
251 | mat.setThickness(*od); |
| 42 | } | ||
| 43 | |||
| 44 |
1/1✓ Branch 1 taken 251 times.
|
251 | od = workspaceObject.getDouble(MaterialFields::Conductivity); |
| 45 |
1/2✓ Branch 0 taken 251 times.
✗ Branch 1 not taken.
|
251 | if (od) { |
| 46 |
2/2✓ Branch 1 taken 251 times.
✓ Branch 4 taken 251 times.
|
251 | mat.setThermalConductivity(*od); |
| 47 | } | ||
| 48 | |||
| 49 |
1/1✓ Branch 1 taken 251 times.
|
251 | od = workspaceObject.getDouble(MaterialFields::Density); |
| 50 |
1/2✓ Branch 0 taken 251 times.
✗ Branch 1 not taken.
|
251 | if (od) { |
| 51 |
2/2✓ Branch 1 taken 251 times.
✓ Branch 4 taken 251 times.
|
251 | mat.setDensity(*od); |
| 52 | } | ||
| 53 | |||
| 54 |
1/1✓ Branch 1 taken 251 times.
|
251 | od = workspaceObject.getDouble(MaterialFields::SpecificHeat); |
| 55 |
1/2✓ Branch 0 taken 251 times.
✗ Branch 1 not taken.
|
251 | if (od) { |
| 56 |
2/2✓ Branch 1 taken 251 times.
✓ Branch 4 taken 251 times.
|
251 | mat.setSpecificHeat(*od); |
| 57 | } | ||
| 58 | |||
| 59 |
1/1✓ Branch 1 taken 251 times.
|
251 | od = workspaceObject.getDouble(MaterialFields::ThermalAbsorptance); |
| 60 |
2/2✓ Branch 0 taken 191 times.
✓ Branch 1 taken 60 times.
|
251 | if (od) { |
| 61 |
1/1✓ Branch 1 taken 191 times.
|
191 | mat.setThermalAbsorptance(od); |
| 62 | } | ||
| 63 | |||
| 64 |
1/1✓ Branch 1 taken 251 times.
|
251 | od = workspaceObject.getDouble(MaterialFields::SolarAbsorptance); |
| 65 |
2/2✓ Branch 0 taken 191 times.
✓ Branch 1 taken 60 times.
|
251 | if (od) { |
| 66 |
1/1✓ Branch 1 taken 191 times.
|
191 | mat.setSolarAbsorptance(od); |
| 67 | } | ||
| 68 | |||
| 69 |
1/1✓ Branch 1 taken 251 times.
|
251 | od = workspaceObject.getDouble(MaterialFields::VisibleAbsorptance); |
| 70 |
2/2✓ Branch 0 taken 191 times.
✓ Branch 1 taken 60 times.
|
251 | if (od) { |
| 71 |
1/1✓ Branch 1 taken 191 times.
|
191 | mat.setVisibleAbsorptance(od); |
| 72 | } | ||
| 73 | |||
| 74 | // Inside-face absorptance fields have no IDD default and inherit the exterior value when blank. | ||
| 75 |
1/1✓ Branch 1 taken 251 times.
|
251 | od = workspaceObject.getDouble(MaterialFields::ThermalAbsorptanceInsideFace); |
| 76 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 249 times.
|
251 | if (od) { |
| 77 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | mat.setThermalAbsorptanceInsideFace(*od); |
| 78 | } | ||
| 79 | |||
| 80 |
1/1✓ Branch 1 taken 251 times.
|
251 | od = workspaceObject.getDouble(MaterialFields::SolarAbsorptanceInsideFace); |
| 81 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 249 times.
|
251 | if (od) { |
| 82 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | mat.setSolarAbsorptanceInsideFace(*od); |
| 83 | } | ||
| 84 | |||
| 85 |
1/1✓ Branch 1 taken 251 times.
|
251 | od = workspaceObject.getDouble(MaterialFields::VisibleAbsorptanceInsideFace); |
| 86 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 249 times.
|
251 | if (od) { |
| 87 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | mat.setVisibleAbsorptanceInsideFace(*od); |
| 88 | } | ||
| 89 | |||
| 90 |
1/1✓ Branch 1 taken 251 times.
|
251 | result = mat; |
| 91 | 251 | return result; | |
| 92 | 251 | } | |
| 93 | |||
| 94 | } // namespace energyplus | ||
| 95 | |||
| 96 | } // namespace openstudio | ||
| 97 |