src/energyplus/ForwardTranslator/ForwardTranslateGroundHeatExchangerHorizontalTrench.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 | #include "../../model/GroundHeatExchangerHorizontalTrench.hpp" | ||
| 8 | #include "../../model/GroundHeatExchangerHorizontalTrench_Impl.hpp" | ||
| 9 | #include "../../model/Model.hpp" | ||
| 10 | #include "../../model/Node.hpp" | ||
| 11 | #include "../../model/Node_Impl.hpp" | ||
| 12 | #include "../../utilities/core/Assert.hpp" | ||
| 13 | #include <utilities/idd/GroundHeatExchanger_HorizontalTrench_FieldEnums.hxx> | ||
| 14 | #include <utilities/idd/IddEnums.hxx> | ||
| 15 | |||
| 16 | using namespace openstudio::model; | ||
| 17 | using namespace std; | ||
| 18 | |||
| 19 | namespace openstudio { | ||
| 20 | |||
| 21 | namespace energyplus { | ||
| 22 | |||
| 23 | 3 | boost::optional<IdfObject> ForwardTranslator::translateGroundHeatExchangerHorizontalTrench(GroundHeatExchangerHorizontalTrench& modelObject) { | |
| 24 | 3 | boost::optional<std::string> s; | |
| 25 | 3 | boost::optional<double> value; | |
| 26 | |||
| 27 | // UndisturbedGroundTemperatureModelName, is required, so start by that | ||
| 28 |
1/1✓ Branch 1 taken 3 times.
|
3 | ModelObject undisturbedGroundTemperatureModel = modelObject.undisturbedGroundTemperatureModel(); |
| 29 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<IdfObject> _undisturbedGroundTemperatureModel = translateAndMapModelObject(undisturbedGroundTemperatureModel); |
| 30 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (_undisturbedGroundTemperatureModel) { |
| 31 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | s = _undisturbedGroundTemperatureModel->name().get(); |
| 32 | } else { | ||
| 33 | ✗ | LOG(Warn, modelObject.briefDescription() << " cannot be translated as its undisturbed ground temperature model object cannot be translated: " | |
| 34 | << undisturbedGroundTemperatureModel.briefDescription() << "."); | ||
| 35 | ✗ | return boost::none; | |
| 36 | } | ||
| 37 | |||
| 38 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::GroundHeatExchanger_HorizontalTrench, modelObject); |
| 39 | |||
| 40 | // UndisturbedGroundTemperatureModelName | ||
| 41 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | idfObject.setString(GroundHeatExchanger_HorizontalTrenchFields::UndisturbedGroundTemperatureModelName, s.get()); |
| 42 | |||
| 43 | // UndisturbedGroundTemperatureModelType | ||
| 44 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setString(GroundHeatExchanger_HorizontalTrenchFields::UndisturbedGroundTemperatureModelType, |
| 45 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
6 | _undisturbedGroundTemperatureModel->iddObject().name()); |
| 46 | |||
| 47 | // InletNodeName | ||
| 48 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
6 | if (auto mo = modelObject.inletModelObject()) { |
| 49 |
3/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
|
6 | if (auto node = mo->optionalCast<Node>()) { |
| 50 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | idfObject.setString(GroundHeatExchanger_HorizontalTrenchFields::InletNodeName, node->name().get()); |
| 51 | 3 | } | |
| 52 | 3 | } | |
| 53 | |||
| 54 | // OutletNodeName | ||
| 55 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
6 | if (auto mo = modelObject.outletModelObject()) { |
| 56 |
3/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
|
6 | if (auto node = mo->optionalCast<Node>()) { |
| 57 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | idfObject.setString(GroundHeatExchanger_HorizontalTrenchFields::OutletNodeName, node->name().get()); |
| 58 | 3 | } | |
| 59 | 3 | } | |
| 60 | |||
| 61 | // DesignFlowRate | ||
| 62 | { | ||
| 63 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.designFlowRate(); |
| 64 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::DesignFlowRate, value); |
| 65 | } | ||
| 66 | |||
| 67 | // TrenchLengthinPipeAxialDirection | ||
| 68 | { | ||
| 69 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.trenchLengthinPipeAxialDirection(); |
| 70 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::TrenchLengthinPipeAxialDirection, value); |
| 71 | } | ||
| 72 | |||
| 73 | // NumberofTrenches | ||
| 74 | { | ||
| 75 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.numberofTrenches(); |
| 76 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setInt(GroundHeatExchanger_HorizontalTrenchFields::NumberofTrenches, value); |
| 77 | } | ||
| 78 | |||
| 79 | // HorizontalSpacingBetweenPipes | ||
| 80 | { | ||
| 81 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.horizontalSpacingBetweenPipes(); |
| 82 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::HorizontalSpacingBetweenPipes, value); |
| 83 | } | ||
| 84 | |||
| 85 | // PipeInnerDiameter | ||
| 86 | { | ||
| 87 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.pipeInnerDiameter(); |
| 88 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::PipeInnerDiameter, value); |
| 89 | } | ||
| 90 | |||
| 91 | // PipeOuterDiameter | ||
| 92 | { | ||
| 93 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.pipeOuterDiameter(); |
| 94 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::PipeOuterDiameter, value); |
| 95 | } | ||
| 96 | |||
| 97 | // BurialDepth | ||
| 98 | { | ||
| 99 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.burialDepth(); |
| 100 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::BurialDepth, value); |
| 101 | } | ||
| 102 | |||
| 103 | // SoilThermalConductivity | ||
| 104 | { | ||
| 105 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.soilThermalConductivity(); |
| 106 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::SoilThermalConductivity, value); |
| 107 | } | ||
| 108 | |||
| 109 | // SoilDensity | ||
| 110 | { | ||
| 111 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.soilDensity(); |
| 112 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::SoilDensity, value); |
| 113 | } | ||
| 114 | |||
| 115 | // SoilSpecificHeat | ||
| 116 | { | ||
| 117 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.soilSpecificHeat(); |
| 118 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::SoilSpecificHeat, value); |
| 119 | } | ||
| 120 | |||
| 121 | // PipeThermalConductivity | ||
| 122 | { | ||
| 123 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.pipeThermalConductivity(); |
| 124 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::PipeThermalConductivity, value); |
| 125 | } | ||
| 126 | |||
| 127 | // PipeDensity | ||
| 128 | { | ||
| 129 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.pipeDensity(); |
| 130 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::PipeDensity, value); |
| 131 | } | ||
| 132 | |||
| 133 | // PipeSpecificHeat | ||
| 134 | { | ||
| 135 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.pipeSpecificHeat(); |
| 136 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::PipeSpecificHeat, value); |
| 137 | } | ||
| 138 | |||
| 139 | // SoilMoistureContentPercent | ||
| 140 | { | ||
| 141 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.soilMoistureContentPercent(); |
| 142 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::SoilMoistureContentPercent, value); |
| 143 | } | ||
| 144 | |||
| 145 | // SoilMoistureContentPercentatSaturation | ||
| 146 | { | ||
| 147 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.soilMoistureContentPercentatSaturation(); |
| 148 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::SoilMoistureContentPercentatSaturation, value); |
| 149 | } | ||
| 150 | |||
| 151 | // EvapotranspirationGroundCoverParameter | ||
| 152 | { | ||
| 153 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto value = modelObject.evapotranspirationGroundCoverParameter(); |
| 154 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(GroundHeatExchanger_HorizontalTrenchFields::EvapotranspirationGroundCoverParameter, value); |
| 155 | } | ||
| 156 | |||
| 157 |
1/1✓ Branch 1 taken 3 times.
|
3 | return idfObject; |
| 158 | 3 | } | |
| 159 | |||
| 160 | } // namespace energyplus | ||
| 161 | } // namespace openstudio | ||
| 162 |