src/energyplus/ForwardTranslator/ForwardTranslateCoolingTowerVariableSpeed.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/CoolingTowerVariableSpeed.hpp" | ||
| 9 | #include "../../model/CoolingTowerVariableSpeed_Impl.hpp" | ||
| 10 | #include "../../model/Schedule.hpp" | ||
| 11 | #include "../../model/Schedule_Impl.hpp" | ||
| 12 | #include "../../model/CurveCubic.hpp" | ||
| 13 | #include "../../model/CurveCubic_Impl.hpp" | ||
| 14 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 15 | #include "../../utilities/idf/Workspace.hpp" | ||
| 16 | #include "../../utilities/idf/WorkspaceObjectOrder.hpp" | ||
| 17 | #include "../../utilities/core/Logger.hpp" | ||
| 18 | #include <utilities/idd/CoolingTower_VariableSpeed_FieldEnums.hxx> | ||
| 19 | #include <utilities/idd/IddEnums.hxx> | ||
| 20 | |||
| 21 | using namespace openstudio::model; | ||
| 22 | |||
| 23 | namespace openstudio { | ||
| 24 | |||
| 25 | namespace energyplus { | ||
| 26 | |||
| 27 | ✗ | boost::optional<IdfObject> ForwardTranslator::translateCoolingTowerVariableSpeed(CoolingTowerVariableSpeed& modelObject) { | |
| 28 | ✗ | OptionalString s; | |
| 29 | ✗ | OptionalDouble d; | |
| 30 | ✗ | OptionalModelObject temp; | |
| 31 | |||
| 32 | ✗ | IdfObject idfObject(IddObjectType::CoolingTower_VariableSpeed); | |
| 33 | |||
| 34 | ✗ | m_idfObjects.push_back(idfObject); | |
| 35 | |||
| 36 | // Name | ||
| 37 | |||
| 38 | ✗ | s = modelObject.name(); | |
| 39 | ✗ | if (s) { | |
| 40 | ✗ | idfObject.setName(*s); | |
| 41 | } | ||
| 42 | |||
| 43 | // WaterInletNodeName | ||
| 44 | |||
| 45 | ✗ | temp = modelObject.inletModelObject(); | |
| 46 | ✗ | if (temp) { | |
| 47 | ✗ | idfObject.setString(openstudio::CoolingTower_VariableSpeedFields::WaterInletNodeName, temp->name().get()); | |
| 48 | } | ||
| 49 | |||
| 50 | // WaterOutletNodeName | ||
| 51 | |||
| 52 | ✗ | temp = modelObject.outletModelObject(); | |
| 53 | ✗ | if (temp) { | |
| 54 | ✗ | idfObject.setString(openstudio::CoolingTower_VariableSpeedFields::WaterOutletNodeName, temp->name().get()); | |
| 55 | } | ||
| 56 | |||
| 57 | // ModelType | ||
| 58 | |||
| 59 | ✗ | if ((s = modelObject.modelType())) { | |
| 60 | ✗ | idfObject.setString(CoolingTower_VariableSpeedFields::ModelType, s.get()); | |
| 61 | } | ||
| 62 | |||
| 63 | // ModelCoefficient | ||
| 64 | |||
| 65 | ✗ | if (boost::optional<ModelObject> mo = modelObject.modelCoefficient()) { | |
| 66 | ✗ | if (boost::optional<IdfObject> _mo = translateAndMapModelObject(mo.get())) { | |
| 67 | ✗ | idfObject.setString(CoolingTower_VariableSpeedFields::ModelCoefficientName, _mo->name().get()); | |
| 68 | ✗ | } | |
| 69 | ✗ | } | |
| 70 | |||
| 71 | // DesignInletAirWetBulbTemperature | ||
| 72 | |||
| 73 | ✗ | if ((d = modelObject.designInletAirWetBulbTemperature())) { | |
| 74 | ✗ | idfObject.setDouble(CoolingTower_VariableSpeedFields::DesignInletAirWetBulbTemperature, d.get()); | |
| 75 | } | ||
| 76 | |||
| 77 | // DesignApproachTemperature | ||
| 78 | |||
| 79 | ✗ | if ((d = modelObject.designApproachTemperature())) { | |
| 80 | ✗ | idfObject.setDouble(CoolingTower_VariableSpeedFields::DesignApproachTemperature, d.get()); | |
| 81 | } | ||
| 82 | |||
| 83 | // DesignRangeTemperature | ||
| 84 | |||
| 85 | ✗ | if ((d = modelObject.designRangeTemperature())) { | |
| 86 | ✗ | idfObject.setDouble(CoolingTower_VariableSpeedFields::DesignRangeTemperature, d.get()); | |
| 87 | } | ||
| 88 | |||
| 89 | // DesignWaterFlowRate | ||
| 90 | |||
| 91 | ✗ | if ((d = modelObject.designWaterFlowRate())) { | |
| 92 | ✗ | idfObject.setDouble(openstudio::CoolingTower_VariableSpeedFields::DesignWaterFlowRate, d.get()); | |
| 93 | ✗ | } else if (modelObject.isDesignAirFlowRateAutosized()) { | |
| 94 | ✗ | idfObject.setString(openstudio::CoolingTower_VariableSpeedFields::DesignWaterFlowRate, "Autosize"); | |
| 95 | } | ||
| 96 | |||
| 97 | // DesignAirFlowRate | ||
| 98 | |||
| 99 | ✗ | if ((d = modelObject.designAirFlowRate())) { | |
| 100 | ✗ | idfObject.setDouble(openstudio::CoolingTower_VariableSpeedFields::DesignAirFlowRate, d.get()); | |
| 101 | ✗ | } else if (modelObject.isDesignAirFlowRateAutosized()) { | |
| 102 | ✗ | idfObject.setString(openstudio::CoolingTower_VariableSpeedFields::DesignAirFlowRate, "Autosize"); | |
| 103 | } | ||
| 104 | |||
| 105 | // DesignFanPower | ||
| 106 | |||
| 107 | ✗ | if ((d = modelObject.designFanPower())) { | |
| 108 | ✗ | idfObject.setDouble(CoolingTower_VariableSpeedFields::DesignFanPower, d.get()); | |
| 109 | ✗ | } else if (modelObject.isDesignFanPowerAutosized()) { | |
| 110 | ✗ | idfObject.setString(CoolingTower_VariableSpeedFields::DesignFanPower, "Autosize"); | |
| 111 | } | ||
| 112 | |||
| 113 | // FanPowerRatioFunctionofAirFlowRateRatioCurve | ||
| 114 | |||
| 115 | ✗ | if (boost::optional<CurveCubic> curve = modelObject.fanPowerRatioFunctionofAirFlowRateRatioCurve()) { | |
| 116 | ✗ | if (boost::optional<IdfObject> _curve = translateAndMapModelObject(curve.get())) { | |
| 117 | ✗ | idfObject.setString(CoolingTower_VariableSpeedFields::FanPowerRatioFunctionofAirFlowRateRatioCurveName, _curve->name().get()); | |
| 118 | ✗ | } | |
| 119 | ✗ | } | |
| 120 | |||
| 121 | // MinimumAirFlowRateRatio | ||
| 122 | |||
| 123 | ✗ | if ((d = modelObject.minimumAirFlowRateRatio())) { | |
| 124 | ✗ | idfObject.setDouble(CoolingTower_VariableSpeedFields::MinimumAirFlowRateRatio, d.get()); | |
| 125 | } | ||
| 126 | |||
| 127 | // FractionofTowerCapacityinFreeConvectionRegime | ||
| 128 | |||
| 129 | ✗ | if ((d = modelObject.fractionofTowerCapacityinFreeConvectionRegime())) { | |
| 130 | ✗ | idfObject.setDouble(CoolingTower_VariableSpeedFields::FractionofTowerCapacityinFreeConvectionRegime, d.get()); | |
| 131 | } | ||
| 132 | |||
| 133 | // BasinHeaterCapacity | ||
| 134 | |||
| 135 | ✗ | if ((d = modelObject.basinHeaterCapacity())) { | |
| 136 | ✗ | idfObject.setDouble(openstudio::CoolingTower_VariableSpeedFields::BasinHeaterCapacity, d.get()); | |
| 137 | } | ||
| 138 | |||
| 139 | // BasinHeaterSetpointTemperature | ||
| 140 | |||
| 141 | ✗ | if ((d = modelObject.basinHeaterSetpointTemperature())) { | |
| 142 | ✗ | idfObject.setDouble(openstudio::CoolingTower_VariableSpeedFields::BasinHeaterSetpointTemperature, d.get()); | |
| 143 | } | ||
| 144 | |||
| 145 | // BasinHeaterOperatingSchedule | ||
| 146 | |||
| 147 | ✗ | if ((temp = modelObject.basinHeaterOperatingSchedule())) { | |
| 148 | ✗ | if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(temp.get())) { | |
| 149 | ✗ | idfObject.setString(openstudio::CoolingTower_VariableSpeedFields::BasinHeaterOperatingScheduleName, _schedule->name().get()); | |
| 150 | ✗ | } | |
| 151 | } | ||
| 152 | |||
| 153 | // EvaporationLossMode | ||
| 154 | |||
| 155 | ✗ | if ((s = modelObject.evaporationLossMode())) { | |
| 156 | ✗ | idfObject.setString(openstudio::CoolingTower_VariableSpeedFields::EvaporationLossMode, s.get()); | |
| 157 | } | ||
| 158 | |||
| 159 | // EvaporationLossFactor | ||
| 160 | |||
| 161 | ✗ | if ((d = modelObject.evaporationLossFactor())) { | |
| 162 | ✗ | idfObject.setDouble(openstudio::CoolingTower_VariableSpeedFields::EvaporationLossFactor, d.get()); | |
| 163 | } | ||
| 164 | |||
| 165 | // DriftLossPercent | ||
| 166 | |||
| 167 | ✗ | if ((d = modelObject.driftLossPercent())) { | |
| 168 | ✗ | idfObject.setDouble(openstudio::CoolingTower_VariableSpeedFields::DriftLossPercent, d.get()); | |
| 169 | } | ||
| 170 | |||
| 171 | // BlowdownCalculationMode | ||
| 172 | |||
| 173 | ✗ | if ((s = modelObject.blowdownCalculationMode())) { | |
| 174 | ✗ | idfObject.setString(openstudio::CoolingTower_VariableSpeedFields::BlowdownCalculationMode, s.get()); | |
| 175 | } | ||
| 176 | |||
| 177 | // BlowdownConcentrationRatio | ||
| 178 | |||
| 179 | ✗ | if ((d = modelObject.blowdownConcentrationRatio())) { | |
| 180 | ✗ | idfObject.setDouble(openstudio::CoolingTower_VariableSpeedFields::BlowdownConcentrationRatio, d.get()); | |
| 181 | } | ||
| 182 | |||
| 183 | // BlowdownMakeupWaterUsageScheduleName | ||
| 184 | |||
| 185 | ✗ | if ((temp = modelObject.blowdownMakeupWaterUsageSchedule())) { | |
| 186 | ✗ | if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(temp.get())) { | |
| 187 | ✗ | idfObject.setString(openstudio::CoolingTower_VariableSpeedFields::BlowdownMakeupWaterUsageScheduleName, _schedule->name().get()); | |
| 188 | ✗ | } | |
| 189 | } | ||
| 190 | |||
| 191 | // NumberofCells | ||
| 192 | |||
| 193 | ✗ | if (boost::optional<int> n = modelObject.numberofCells()) { | |
| 194 | ✗ | idfObject.setUnsigned(openstudio::CoolingTower_VariableSpeedFields::NumberofCells, n.get()); | |
| 195 | } | ||
| 196 | |||
| 197 | // CellControl | ||
| 198 | |||
| 199 | ✗ | if ((s = modelObject.cellControl())) { | |
| 200 | ✗ | idfObject.setString(openstudio::CoolingTower_VariableSpeedFields::CellControl, s.get()); | |
| 201 | } | ||
| 202 | |||
| 203 | // CellMinimumWaterFlowRateFraction | ||
| 204 | |||
| 205 | ✗ | if ((d = modelObject.cellMinimumWaterFlowRateFraction())) { | |
| 206 | ✗ | idfObject.setDouble(openstudio::CoolingTower_VariableSpeedFields::CellMinimumWaterFlowRateFraction, d.get()); | |
| 207 | } | ||
| 208 | |||
| 209 | // CellMaximumWaterFlowRateFraction | ||
| 210 | |||
| 211 | ✗ | if ((d = modelObject.cellMaximumWaterFlowRateFraction())) { | |
| 212 | ✗ | idfObject.setDouble(openstudio::CoolingTower_VariableSpeedFields::CellMaximumWaterFlowRateFraction, d.get()); | |
| 213 | } | ||
| 214 | |||
| 215 | // SizingFactor | ||
| 216 | |||
| 217 | ✗ | if ((d = modelObject.sizingFactor())) { | |
| 218 | ✗ | idfObject.setDouble(openstudio::CoolingTower_VariableSpeedFields::SizingFactor, d.get()); | |
| 219 | } | ||
| 220 | |||
| 221 | ✗ | if ((s = modelObject.endUseSubcategory())) { | |
| 222 | ✗ | idfObject.setString(openstudio::CoolingTower_VariableSpeedFields::EndUseSubcategory, s.get()); | |
| 223 | } | ||
| 224 | |||
| 225 | ✗ | return boost::optional<IdfObject>(idfObject); | |
| 226 | ✗ | } | |
| 227 | |||
| 228 | } // namespace energyplus | ||
| 229 | |||
| 230 | } // namespace openstudio | ||
| 231 |