src/energyplus/ForwardTranslator/ForwardTranslateMasslessOpaqueMaterial.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 | |||
| 8 | #include "../../model/Model.hpp" | ||
| 9 | #include "../../model/MasslessOpaqueMaterial.hpp" | ||
| 10 | #include "../../model/MasslessOpaqueMaterial_Impl.hpp" | ||
| 11 | #include "../../model/MaterialPropertyMoisturePenetrationDepthSettings.hpp" | ||
| 12 | #include "../../model/MaterialPropertyMoisturePenetrationDepthSettings_Impl.hpp" | ||
| 13 | #include "../../model/MaterialPropertyPhaseChange.hpp" | ||
| 14 | #include "../../model/MaterialPropertyPhaseChange_Impl.hpp" | ||
| 15 | #include "../../model/MaterialPropertyPhaseChangeHysteresis.hpp" | ||
| 16 | #include "../../model/MaterialPropertyPhaseChangeHysteresis_Impl.hpp" | ||
| 17 | |||
| 18 | #include <utilities/idd/Material_NoMass_FieldEnums.hxx> | ||
| 19 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 20 | #include <utilities/idd/IddEnums.hxx> | ||
| 21 | |||
| 22 | using namespace openstudio::model; | ||
| 23 | |||
| 24 | using namespace std; | ||
| 25 | |||
| 26 | namespace openstudio { | ||
| 27 | |||
| 28 | namespace energyplus { | ||
| 29 | |||
| 30 | 44 | boost::optional<IdfObject> ForwardTranslator::translateMasslessOpaqueMaterial(MasslessOpaqueMaterial& modelObject) { | |
| 31 |
2/2✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
|
44 | IdfObject idfObject(openstudio::IddObjectType::Material_NoMass); |
| 32 | |||
| 33 |
1/1✓ Branch 1 taken 44 times.
|
44 | m_idfObjects.push_back(idfObject); |
| 34 | |||
| 35 |
3/3✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
✓ Branch 7 taken 44 times.
|
44 | idfObject.setString(openstudio::Material_NoMassFields::Name, modelObject.name().get()); |
| 36 | |||
| 37 |
2/2✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
|
44 | idfObject.setString(openstudio::Material_NoMassFields::Roughness, modelObject.roughness()); |
| 38 | |||
| 39 |
2/2✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
|
44 | idfObject.setDouble(openstudio::Material_NoMassFields::ThermalResistance, modelObject.thermalResistance()); |
| 40 | |||
| 41 |
1/1✓ Branch 1 taken 44 times.
|
44 | OptionalDouble d = modelObject.thermalAbsorptance(); |
| 42 |
1/2✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
|
44 | if (d) { |
| 43 |
2/2✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
|
44 | idfObject.setDouble(openstudio::Material_NoMassFields::ThermalAbsorptance, *d); |
| 44 | } | ||
| 45 | |||
| 46 |
1/1✓ Branch 1 taken 44 times.
|
44 | d = modelObject.solarAbsorptance(); |
| 47 |
1/2✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
|
44 | if (d) { |
| 48 |
2/2✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
|
44 | idfObject.setDouble(openstudio::Material_NoMassFields::SolarAbsorptance, *d); |
| 49 | } | ||
| 50 | |||
| 51 |
1/1✓ Branch 1 taken 44 times.
|
44 | d = modelObject.visibleAbsorptance(); |
| 52 |
1/2✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
|
44 | if (d) { |
| 53 |
2/2✓ Branch 1 taken 44 times.
✓ Branch 4 taken 44 times.
|
44 | idfObject.setDouble(openstudio::Material_NoMassFields::VisibleAbsorptance, *d); |
| 54 | } | ||
| 55 | |||
| 56 | // Inside-face absorptance fields have no IDD default and inherit the exterior value when blank. | ||
| 57 |
3/3✓ Branch 1 taken 44 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 43 times.
|
44 | if (!modelObject.isThermalAbsorptanceInsideFaceDefaulted()) { |
| 58 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setDouble(openstudio::Material_NoMassFields::ThermalAbsorptanceInsideFace, modelObject.thermalAbsorptanceInsideFace().get()); |
| 59 | } | ||
| 60 | |||
| 61 |
3/3✓ Branch 1 taken 44 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 43 times.
|
44 | if (!modelObject.isSolarAbsorptanceInsideFaceDefaulted()) { |
| 62 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setDouble(openstudio::Material_NoMassFields::SolarAbsorptanceInsideFace, modelObject.solarAbsorptanceInsideFace().get()); |
| 63 | } | ||
| 64 | |||
| 65 |
3/3✓ Branch 1 taken 44 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 43 times.
|
44 | if (!modelObject.isVisibleAbsorptanceInsideFaceDefaulted()) { |
| 66 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setDouble(openstudio::Material_NoMassFields::VisibleAbsorptanceInsideFace, modelObject.visibleAbsorptanceInsideFace().get()); |
| 67 | } | ||
| 68 | |||
| 69 | // Call the translation of these objects, which has two advantages: | ||
| 70 | // * will not translate them if they are orphaned (=not referencing a material), and, | ||
| 71 | // * makes the order of these objects in the IDF deterministic | ||
| 72 |
2/3✓ Branch 1 taken 44 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 44 times.
|
88 | if (boost::optional<MaterialPropertyMoisturePenetrationDepthSettings> _empd = modelObject.materialPropertyMoisturePenetrationDepthSettings()) { |
| 73 | ✗ | translateAndMapModelObject(_empd.get()); | |
| 74 | 44 | } | |
| 75 | |||
| 76 |
2/3✓ Branch 1 taken 44 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 44 times.
|
88 | if (boost::optional<MaterialPropertyPhaseChange> _phaseChange = modelObject.materialPropertyPhaseChange()) { |
| 77 | ✗ | translateAndMapModelObject(_phaseChange.get()); | |
| 78 | 44 | } | |
| 79 | |||
| 80 |
2/3✓ Branch 1 taken 44 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 44 times.
|
88 | if (boost::optional<MaterialPropertyPhaseChangeHysteresis> _phaseChangeHysteresis = modelObject.materialPropertyPhaseChangeHysteresis()) { |
| 81 | ✗ | translateAndMapModelObject(_phaseChangeHysteresis.get()); | |
| 82 | 44 | } | |
| 83 | |||
| 84 |
1/1✓ Branch 1 taken 44 times.
|
88 | return boost::optional<IdfObject>(idfObject); |
| 85 | 44 | } | |
| 86 | |||
| 87 | } // namespace energyplus | ||
| 88 | |||
| 89 | } // namespace openstudio | ||
| 90 |