src/energyplus/ForwardTranslator/ForwardTranslateSurfacePropertyOtherSideCoefficients.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/SurfacePropertyOtherSideCoefficients.hpp" | ||
| 10 | #include "../../model/SurfacePropertyOtherSideCoefficients_Impl.hpp" | ||
| 11 | #include "../../model/Schedule.hpp" | ||
| 12 | |||
| 13 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 14 | |||
| 15 | #include <utilities/idd/SurfaceProperty_OtherSideCoefficients_FieldEnums.hxx> | ||
| 16 | |||
| 17 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 18 | #include <utilities/idd/IddEnums.hxx> | ||
| 19 | #include <utilities/idd/IddFactory.hxx> | ||
| 20 | |||
| 21 | #include "../../utilities/core/Assert.hpp" | ||
| 22 | |||
| 23 | using namespace openstudio::model; | ||
| 24 | |||
| 25 | using namespace std; | ||
| 26 | |||
| 27 | namespace openstudio { | ||
| 28 | |||
| 29 | namespace energyplus { | ||
| 30 | |||
| 31 | boost::optional<IdfObject> | ||
| 32 | 1 | ForwardTranslator::translateSurfacePropertyOtherSideCoefficients(model::SurfacePropertyOtherSideCoefficients& modelObject) { | |
| 33 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::SurfaceProperty_OtherSideCoefficients, modelObject); |
| 34 | |||
| 35 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> combinedConvectiveRadiativeFilmCoefficient = modelObject.combinedConvectiveRadiativeFilmCoefficient(); |
| 36 | |||
| 37 |
1/1✓ Branch 1 taken 1 time.
|
1 | double constantTemperature = modelObject.constantTemperature(); |
| 38 |
1/1✓ Branch 1 taken 1 time.
|
1 | double constantTemperatureCoefficient = modelObject.constantTemperatureCoefficient(); |
| 39 |
1/1✓ Branch 1 taken 1 time.
|
1 | double externalDryBulbTemperatureCoefficient = modelObject.externalDryBulbTemperatureCoefficient(); |
| 40 |
1/1✓ Branch 1 taken 1 time.
|
1 | double groundTemperatureCoefficient = modelObject.groundTemperatureCoefficient(); |
| 41 |
1/1✓ Branch 1 taken 1 time.
|
1 | double windSpeedCoefficient = modelObject.windSpeedCoefficient(); |
| 42 |
1/1✓ Branch 1 taken 1 time.
|
1 | double zoneAirTemperatureCoefficient = modelObject.zoneAirTemperatureCoefficient(); |
| 43 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<Schedule> constantTemperatureSchedule = modelObject.constantTemperatureSchedule(); |
| 44 |
1/1✓ Branch 1 taken 1 time.
|
1 | bool sinusoidalVariationofConstantTemperatureCoefficient = modelObject.sinusoidalVariationofConstantTemperatureCoefficient(); |
| 45 |
1/1✓ Branch 1 taken 1 time.
|
1 | double periodofSinusoidalVariation = modelObject.periodofSinusoidalVariation(); |
| 46 |
1/1✓ Branch 1 taken 1 time.
|
1 | double previousOtherSideTemperatureCoefficient = modelObject.previousOtherSideTemperatureCoefficient(); |
| 47 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> minimumOtherSideTemperatureLimit = modelObject.minimumOtherSideTemperatureLimit(); |
| 48 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> maximumOtherSideTemperatureLimit = modelObject.maximumOtherSideTemperatureLimit(); |
| 49 | |||
| 50 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (combinedConvectiveRadiativeFilmCoefficient) { |
| 51 | ✗ | idfObject.setDouble(SurfaceProperty_OtherSideCoefficientsFields::CombinedConvective_RadiativeFilmCoefficient, | |
| 52 | ✗ | *combinedConvectiveRadiativeFilmCoefficient); | |
| 53 | } else { | ||
| 54 | // required in E+, this indicates that the coefficient should be computed as a function of the other variables | ||
| 55 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(SurfaceProperty_OtherSideCoefficientsFields::CombinedConvective_RadiativeFilmCoefficient, 0.0); |
| 56 | } | ||
| 57 | |||
| 58 | 1 | bool isConstantTemperatureScheduled = false; | |
| 59 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (constantTemperatureSchedule) { |
| 60 | ✗ | boost::optional<IdfObject> sch = translateAndMapModelObject(*constantTemperatureSchedule); | |
| 61 | ✗ | if (sch && sch->name()) { | |
| 62 | isConstantTemperatureScheduled = | ||
| 63 | ✗ | idfObject.setString(SurfaceProperty_OtherSideCoefficientsFields::ConstantTemperatureScheduleName, sch->name().get()); | |
| 64 | } | ||
| 65 | ✗ | } | |
| 66 | |||
| 67 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (!isConstantTemperatureScheduled) { |
| 68 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(SurfaceProperty_OtherSideCoefficientsFields::ConstantTemperature, constantTemperature); |
| 69 | } | ||
| 70 | |||
| 71 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(SurfaceProperty_OtherSideCoefficientsFields::ConstantTemperatureCoefficient, constantTemperatureCoefficient); |
| 72 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(SurfaceProperty_OtherSideCoefficientsFields::ExternalDryBulbTemperatureCoefficient, externalDryBulbTemperatureCoefficient); |
| 73 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(SurfaceProperty_OtherSideCoefficientsFields::GroundTemperatureCoefficient, groundTemperatureCoefficient); |
| 74 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(SurfaceProperty_OtherSideCoefficientsFields::WindSpeedCoefficient, windSpeedCoefficient); |
| 75 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(SurfaceProperty_OtherSideCoefficientsFields::ZoneAirTemperatureCoefficient, zoneAirTemperatureCoefficient); |
| 76 | |||
| 77 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (!isConstantTemperatureScheduled) { |
| 78 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (sinusoidalVariationofConstantTemperatureCoefficient) { |
| 79 | ✗ | idfObject.setString(SurfaceProperty_OtherSideCoefficientsFields::SinusoidalVariationofConstantTemperatureCoefficient, "Yes"); | |
| 80 | } else { | ||
| 81 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | idfObject.setString(SurfaceProperty_OtherSideCoefficientsFields::SinusoidalVariationofConstantTemperatureCoefficient, "No"); |
| 82 | } | ||
| 83 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(SurfaceProperty_OtherSideCoefficientsFields::PeriodofSinusoidalVariation, periodofSinusoidalVariation); |
| 84 | } | ||
| 85 | |||
| 86 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setDouble(SurfaceProperty_OtherSideCoefficientsFields::PreviousOtherSideTemperatureCoefficient, |
| 87 | previousOtherSideTemperatureCoefficient); | ||
| 88 | |||
| 89 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (minimumOtherSideTemperatureLimit) { |
| 90 | ✗ | idfObject.setDouble(SurfaceProperty_OtherSideCoefficientsFields::MinimumOtherSideTemperatureLimit, *minimumOtherSideTemperatureLimit); | |
| 91 | } | ||
| 92 | |||
| 93 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (maximumOtherSideTemperatureLimit) { |
| 94 | ✗ | idfObject.setDouble(SurfaceProperty_OtherSideCoefficientsFields::MaximumOtherSideTemperatureLimit, *maximumOtherSideTemperatureLimit); | |
| 95 | } | ||
| 96 | |||
| 97 |
1/1✓ Branch 1 taken 1 time.
|
2 | return idfObject; |
| 98 | 1 | } | |
| 99 | |||
| 100 | } // namespace energyplus | ||
| 101 | |||
| 102 | } // namespace openstudio | ||
| 103 |