src/energyplus/ForwardTranslator/ForwardTranslateChillerAbsorptionIndirect.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/Model.hpp" | ||
| 8 | #include "../../model/Schedule.hpp" | ||
| 9 | #include "../../model/Schedule_Impl.hpp" | ||
| 10 | #include "../../model/Node.hpp" | ||
| 11 | #include "../../model/Node_Impl.hpp" | ||
| 12 | #include "../../model/ChillerAbsorptionIndirect.hpp" | ||
| 13 | #include "../../model/ChillerAbsorptionIndirect_Impl.hpp" | ||
| 14 | #include "../../model/Curve.hpp" | ||
| 15 | #include "../../model/Curve_Impl.hpp" | ||
| 16 | #include "../../utilities/core/Logger.hpp" | ||
| 17 | #include "../../utilities/core/Assert.hpp" | ||
| 18 | #include <utilities/idd/Chiller_Absorption_Indirect_FieldEnums.hxx> | ||
| 19 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 20 | #include <utilities/idd/IddEnums.hxx> | ||
| 21 | #include <utilities/idd/IddFactory.hxx> | ||
| 22 | |||
| 23 | using namespace openstudio::model; | ||
| 24 | |||
| 25 | using namespace std; | ||
| 26 | |||
| 27 | namespace openstudio { | ||
| 28 | |||
| 29 | namespace energyplus { | ||
| 30 | |||
| 31 | ✗ | boost::optional<IdfObject> ForwardTranslator::translateChillerAbsorptionIndirect(ChillerAbsorptionIndirect& modelObject) { | |
| 32 | ✗ | IdfObject idfObject(IddObjectType::Chiller_Absorption_Indirect); | |
| 33 | |||
| 34 | ✗ | m_idfObjects.push_back(idfObject); | |
| 35 | |||
| 36 | // Name | ||
| 37 | ✗ | if (auto s = modelObject.name()) { | |
| 38 | ✗ | idfObject.setName(*s); | |
| 39 | ✗ | } | |
| 40 | |||
| 41 | // ChilledWaterInletNodeName | ||
| 42 | ✗ | if (auto mo = modelObject.supplyInletModelObject()) { | |
| 43 | ✗ | if (auto node = mo->optionalCast<Node>()) { | |
| 44 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::ChilledWaterInletNodeName, node->name().get()); | |
| 45 | ✗ | } | |
| 46 | ✗ | } | |
| 47 | |||
| 48 | // ChilledWaterOutletNodeName | ||
| 49 | ✗ | if (auto mo = modelObject.supplyOutletModelObject()) { | |
| 50 | ✗ | if (auto node = mo->optionalCast<Node>()) { | |
| 51 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::ChilledWaterOutletNodeName, node->name().get()); | |
| 52 | ✗ | } | |
| 53 | ✗ | } | |
| 54 | |||
| 55 | // CondenserInletNodeName | ||
| 56 | ✗ | if (auto mo = modelObject.demandInletModelObject()) { | |
| 57 | ✗ | if (auto node = mo->optionalCast<Node>()) { | |
| 58 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::CondenserInletNodeName, node->name().get()); | |
| 59 | ✗ | } | |
| 60 | ✗ | } | |
| 61 | |||
| 62 | // CondenserOutletNodeName | ||
| 63 | ✗ | if (auto mo = modelObject.demandOutletModelObject()) { | |
| 64 | ✗ | if (auto node = mo->optionalCast<Node>()) { | |
| 65 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::CondenserOutletNodeName, node->name().get()); | |
| 66 | ✗ | } | |
| 67 | ✗ | } | |
| 68 | |||
| 69 | ✗ | if (auto mo = modelObject.tertiaryInletModelObject()) { | |
| 70 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::GeneratorInletNodeName, mo->name().get()); | |
| 71 | ✗ | } | |
| 72 | |||
| 73 | ✗ | if (auto mo = modelObject.tertiaryOutletModelObject()) { | |
| 74 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::GeneratorOutletNodeName, mo->name().get()); | |
| 75 | ✗ | } | |
| 76 | |||
| 77 | ✗ | if (modelObject.isNominalCapacityAutosized()) { | |
| 78 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::NominalCapacity, "Autosize"); | |
| 79 | ✗ | } else if (auto value = modelObject.nominalCapacity()) { | |
| 80 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::NominalCapacity, value.get()); | |
| 81 | } | ||
| 82 | |||
| 83 | ✗ | if (modelObject.isNominalPumpingPowerAutosized()) { | |
| 84 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::NominalPumpingPower, "Autosize"); | |
| 85 | ✗ | } else if (auto value = modelObject.nominalPumpingPower()) { | |
| 86 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::NominalPumpingPower, value.get()); | |
| 87 | } | ||
| 88 | |||
| 89 | { | ||
| 90 | ✗ | auto value = modelObject.minimumPartLoadRatio(); | |
| 91 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::MinimumPartLoadRatio, value); | |
| 92 | } | ||
| 93 | |||
| 94 | { | ||
| 95 | ✗ | auto value = modelObject.maximumPartLoadRatio(); | |
| 96 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::MaximumPartLoadRatio, value); | |
| 97 | } | ||
| 98 | |||
| 99 | { | ||
| 100 | ✗ | auto value = modelObject.optimumPartLoadRatio(); | |
| 101 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::OptimumPartLoadRatio, value); | |
| 102 | } | ||
| 103 | |||
| 104 | { | ||
| 105 | ✗ | auto value = modelObject.designCondenserInletTemperature(); | |
| 106 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::DesignCondenserInletTemperature, value); | |
| 107 | } | ||
| 108 | |||
| 109 | { | ||
| 110 | ✗ | auto value = modelObject.condenserInletTemperatureLowerLimit(); | |
| 111 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::CondenserInletTemperatureLowerLimit, value); | |
| 112 | } | ||
| 113 | |||
| 114 | { | ||
| 115 | ✗ | auto value = modelObject.chilledWaterOutletTemperatureLowerLimit(); | |
| 116 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::ChilledWaterOutletTemperatureLowerLimit, value); | |
| 117 | } | ||
| 118 | |||
| 119 | ✗ | if (modelObject.isDesignChilledWaterFlowRateAutosized()) { | |
| 120 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::DesignChilledWaterFlowRate, "Autosize"); | |
| 121 | ✗ | } else if (auto value = modelObject.designChilledWaterFlowRate()) { | |
| 122 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::DesignChilledWaterFlowRate, value.get()); | |
| 123 | } | ||
| 124 | |||
| 125 | ✗ | if (modelObject.isDesignCondenserWaterFlowRateAutosized()) { | |
| 126 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::DesignCondenserWaterFlowRate, "Autosize"); | |
| 127 | ✗ | } else if (auto value = modelObject.designCondenserWaterFlowRate()) { | |
| 128 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::DesignCondenserWaterFlowRate, value.get()); | |
| 129 | } | ||
| 130 | |||
| 131 | { | ||
| 132 | ✗ | auto value = modelObject.chillerFlowMode(); | |
| 133 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::ChillerFlowMode, value); | |
| 134 | ✗ | } | |
| 135 | |||
| 136 | { | ||
| 137 | ✗ | auto curve = modelObject.generatorHeatInputFunctionofPartLoadRatioCurve(); | |
| 138 | ✗ | auto idf = translateAndMapModelObject(curve); | |
| 139 | ✗ | OS_ASSERT(idf); | |
| 140 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::GeneratorHeatInputFunctionofPartLoadRatioCurveName, idf->name().get()); | |
| 141 | ✗ | } | |
| 142 | |||
| 143 | { | ||
| 144 | ✗ | auto curve = modelObject.pumpElectricInputFunctionofPartLoadRatioCurve(); | |
| 145 | ✗ | auto idf = translateAndMapModelObject(curve); | |
| 146 | ✗ | OS_ASSERT(idf); | |
| 147 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::PumpElectricInputFunctionofPartLoadRatioCurveName, idf->name().get()); | |
| 148 | ✗ | } | |
| 149 | |||
| 150 | { | ||
| 151 | ✗ | auto curve = modelObject.capacityCorrectionFunctionofCondenserTemperatureCurve(); | |
| 152 | ✗ | auto idf = translateAndMapModelObject(curve); | |
| 153 | ✗ | OS_ASSERT(idf); | |
| 154 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::CapacityCorrectionFunctionofCondenserTemperatureCurveName, idf->name().get()); | |
| 155 | ✗ | } | |
| 156 | |||
| 157 | { | ||
| 158 | ✗ | auto curve = modelObject.capacityCorrectionFunctionofChilledWaterTemperatureCurve(); | |
| 159 | ✗ | auto idf = translateAndMapModelObject(curve); | |
| 160 | ✗ | OS_ASSERT(idf); | |
| 161 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::CapacityCorrectionFunctionofChilledWaterTemperatureCurveName, idf->name().get()); | |
| 162 | ✗ | } | |
| 163 | |||
| 164 | { | ||
| 165 | ✗ | auto curve = modelObject.capacityCorrectionFunctionofGeneratorTemperatureCurve(); | |
| 166 | ✗ | auto idf = translateAndMapModelObject(curve); | |
| 167 | ✗ | OS_ASSERT(idf); | |
| 168 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::CapacityCorrectionFunctionofGeneratorTemperatureCurveName, idf->name().get()); | |
| 169 | ✗ | } | |
| 170 | |||
| 171 | { | ||
| 172 | ✗ | auto curve = modelObject.generatorHeatInputCorrectionFunctionofCondenserTemperatureCurve(); | |
| 173 | ✗ | auto idf = translateAndMapModelObject(curve); | |
| 174 | ✗ | OS_ASSERT(idf); | |
| 175 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::GeneratorHeatInputCorrectionFunctionofCondenserTemperatureCurveName, idf->name().get()); | |
| 176 | ✗ | } | |
| 177 | |||
| 178 | { | ||
| 179 | ✗ | auto curve = modelObject.generatorHeatInputCorrectionFunctionofChilledWaterTemperatureCurve(); | |
| 180 | ✗ | auto idf = translateAndMapModelObject(curve); | |
| 181 | ✗ | OS_ASSERT(idf); | |
| 182 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::GeneratorHeatInputCorrectionFunctionofChilledWaterTemperatureCurveName, | |
| 183 | ✗ | idf->name().get()); | |
| 184 | ✗ | } | |
| 185 | |||
| 186 | { | ||
| 187 | ✗ | auto value = modelObject.generatorHeatSourceType(); | |
| 188 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::GeneratorHeatSourceType, value); | |
| 189 | ✗ | } | |
| 190 | |||
| 191 | ✗ | if (modelObject.generatorLoop()) { | |
| 192 | ✗ | if (modelObject.isDesignGeneratorFluidFlowRateAutosized()) { | |
| 193 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::DesignGeneratorFluidFlowRate, "Autosize"); | |
| 194 | ✗ | } else if (auto value = modelObject.designGeneratorFluidFlowRate()) { | |
| 195 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::DesignGeneratorFluidFlowRate, value.get()); | |
| 196 | } | ||
| 197 | } else { | ||
| 198 | ✗ | idfObject.setString(Chiller_Absorption_IndirectFields::DesignGeneratorFluidFlowRate, ""); | |
| 199 | } | ||
| 200 | |||
| 201 | { | ||
| 202 | ✗ | auto value = modelObject.temperatureLowerLimitGeneratorInlet(); | |
| 203 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::TemperatureLowerLimitGeneratorInlet, value); | |
| 204 | } | ||
| 205 | |||
| 206 | { | ||
| 207 | ✗ | auto value = modelObject.degreeofSubcoolinginSteamGenerator(); | |
| 208 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::DegreeofSubcoolinginSteamGenerator, value); | |
| 209 | } | ||
| 210 | |||
| 211 | { | ||
| 212 | ✗ | auto value = modelObject.degreeofSubcoolinginSteamCondensateLoop(); | |
| 213 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::DegreeofSubcoolinginSteamCondensateLoop, value); | |
| 214 | } | ||
| 215 | |||
| 216 | { | ||
| 217 | ✗ | auto value = modelObject.sizingFactor(); | |
| 218 | ✗ | idfObject.setDouble(Chiller_Absorption_IndirectFields::SizingFactor, value); | |
| 219 | } | ||
| 220 | |||
| 221 | ✗ | return idfObject; | |
| 222 | ✗ | } | |
| 223 | |||
| 224 | } // namespace energyplus | ||
| 225 | |||
| 226 | } // namespace openstudio | ||
| 227 |