src/energyplus/ReverseTranslator/ReverseTranslateMaterialNoMass.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/MasslessOpaqueMaterial.hpp" | ||
| 9 | #include "../../model/MasslessOpaqueMaterial_Impl.hpp" | ||
| 10 | |||
| 11 | #include <utilities/idd/Material_NoMass_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 | 31 | OptionalModelObject ReverseTranslator::translateMaterialNoMass(const WorkspaceObject& workspaceObject) { | |
| 22 | 31 | OptionalModelObject result; | |
| 23 |
4/5✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
✓ Branch 7 taken 31 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 31 times.
|
31 | if (workspaceObject.iddObject().type() != IddObjectType::Material_NoMass) { |
| 24 | ✗ | LOG(Error, "WorkspaceObject is not IddObjectType: Material:NoMass"); | |
| 25 | ✗ | return result; | |
| 26 | } | ||
| 27 | |||
| 28 |
2/2✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
|
31 | openstudio::model::MasslessOpaqueMaterial MOMat(m_model); |
| 29 |
1/1✓ Branch 1 taken 31 times.
|
31 | OptionalString optS = workspaceObject.name(); |
| 30 |
1/2✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
|
31 | if (optS) { |
| 31 |
2/2✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
|
31 | MOMat.setName(*optS); |
| 32 | } | ||
| 33 | |||
| 34 |
1/1✓ Branch 1 taken 31 times.
|
31 | optS = workspaceObject.getString(Material_NoMassFields::Roughness); |
| 35 |
1/2✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
|
31 | if (optS) { |
| 36 |
2/2✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
|
31 | MOMat.setRoughness(*optS); |
| 37 | } | ||
| 38 | |||
| 39 |
1/1✓ Branch 1 taken 31 times.
|
31 | OptionalDouble d = workspaceObject.getDouble(Material_NoMassFields::ThermalResistance); |
| 40 |
1/2✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
|
31 | if (d) { |
| 41 |
2/2✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
|
31 | MOMat.setThermalResistance(*d); |
| 42 | } | ||
| 43 | |||
| 44 |
1/1✓ Branch 1 taken 31 times.
|
31 | d = workspaceObject.getDouble(Material_NoMassFields::ThermalAbsorptance); |
| 45 |
1/2✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
|
31 | if (d) { |
| 46 |
2/2✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
|
31 | MOMat.setThermalAbsorptance(*d); |
| 47 | } | ||
| 48 | |||
| 49 |
1/1✓ Branch 1 taken 31 times.
|
31 | d = workspaceObject.getDouble(Material_NoMassFields::SolarAbsorptance); |
| 50 |
1/2✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
|
31 | if (d) { |
| 51 |
2/2✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
|
31 | MOMat.setSolarAbsorptance(*d); |
| 52 | } | ||
| 53 | |||
| 54 |
1/1✓ Branch 1 taken 31 times.
|
31 | d = workspaceObject.getDouble(Material_NoMassFields::VisibleAbsorptance); |
| 55 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 3 times.
|
31 | if (d) { |
| 56 |
2/2✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
|
28 | MOMat.setVisibleAbsorptance(*d); |
| 57 | } | ||
| 58 | |||
| 59 | // Inside-face absorptance fields have no IDD default and inherit the exterior value when blank. | ||
| 60 |
1/1✓ Branch 1 taken 31 times.
|
31 | d = workspaceObject.getDouble(Material_NoMassFields::ThermalAbsorptanceInsideFace); |
| 61 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 29 times.
|
31 | if (d) { |
| 62 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | MOMat.setThermalAbsorptanceInsideFace(*d); |
| 63 | } | ||
| 64 | |||
| 65 |
1/1✓ Branch 1 taken 31 times.
|
31 | d = workspaceObject.getDouble(Material_NoMassFields::SolarAbsorptanceInsideFace); |
| 66 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 29 times.
|
31 | if (d) { |
| 67 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | MOMat.setSolarAbsorptanceInsideFace(*d); |
| 68 | } | ||
| 69 | |||
| 70 |
1/1✓ Branch 1 taken 31 times.
|
31 | d = workspaceObject.getDouble(Material_NoMassFields::VisibleAbsorptanceInsideFace); |
| 71 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 29 times.
|
31 | if (d) { |
| 72 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | MOMat.setVisibleAbsorptanceInsideFace(*d); |
| 73 | } | ||
| 74 | |||
| 75 |
1/1✓ Branch 1 taken 31 times.
|
31 | result = MOMat; |
| 76 | 31 | return result; | |
| 77 | 31 | } | |
| 78 | |||
| 79 | } // namespace energyplus | ||
| 80 | |||
| 81 | } // namespace openstudio | ||
| 82 |