src/energyplus/ForwardTranslator/ForwardTranslateMaterialPropertyPhaseChange.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/MaterialPropertyPhaseChange.hpp" | ||
| 10 | #include "../../model/MaterialPropertyPhaseChange_Impl.hpp" | ||
| 11 | #include "../../model/Material.hpp" | ||
| 12 | #include "../../model/Material_Impl.hpp" | ||
| 13 | |||
| 14 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 15 | |||
| 16 | #include <utilities/idd/MaterialProperty_PhaseChange_FieldEnums.hxx> | ||
| 17 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 18 | #include <utilities/idd/IddEnums.hxx> | ||
| 19 | |||
| 20 | using namespace openstudio::model; | ||
| 21 | |||
| 22 | using namespace std; | ||
| 23 | |||
| 24 | namespace openstudio { | ||
| 25 | |||
| 26 | namespace energyplus { | ||
| 27 | |||
| 28 | 2 | boost::optional<IdfObject> ForwardTranslator::translateMaterialPropertyPhaseChange(MaterialPropertyPhaseChange& modelObject) { | |
| 29 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 1 time.
|
2 | if (modelObject.temperatureEnthalpys().size() < 4) { |
| 30 |
7/7✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 20 taken 1 time.
|
1 | LOG(Warn, modelObject.briefDescription() << " cannot be translated as it has less than 4 temperature-enthalpy pairs."); |
| 31 | 1 | return boost::none; | |
| 32 | } | ||
| 33 | |||
| 34 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject idfObject = createAndRegisterIdfObject(openstudio::IddObjectType::MaterialProperty_PhaseChange, modelObject); |
| 35 | |||
| 36 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(MaterialProperty_PhaseChangeFields::Name, modelObject.material().nameString()); |
| 37 | |||
| 38 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(MaterialProperty_PhaseChangeFields::TemperatureCoefficientforThermalConductivity, |
| 39 | modelObject.temperatureCoefficientforThermalConductivity()); | ||
| 40 | |||
| 41 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::vector<TemperatureEnthalpy> temperatureEnthalpys = modelObject.temperatureEnthalpys(); |
| 42 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (!temperatureEnthalpys.empty()) { |
| 43 |
2/2✓ Branch 5 taken 4 times.
✓ Branch 6 taken 1 time.
|
5 | for (const TemperatureEnthalpy& temperatureEnthalpy : temperatureEnthalpys) { |
| 44 |
1/1✓ Branch 1 taken 4 times.
|
4 | auto eg = idfObject.pushExtensibleGroup(); |
| 45 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | eg.setDouble(MaterialProperty_PhaseChangeExtensibleFields::Temperature, temperatureEnthalpy.temperature()); |
| 46 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | eg.setDouble(MaterialProperty_PhaseChangeExtensibleFields::Enthalpy, temperatureEnthalpy.enthalpy()); |
| 47 | 4 | } | |
| 48 | } | ||
| 49 | |||
| 50 |
1/1✓ Branch 1 taken 1 time.
|
1 | return idfObject; |
| 51 | 1 | } | |
| 52 | |||
| 53 | } // namespace energyplus | ||
| 54 | |||
| 55 | } // namespace openstudio | ||
| 56 |