src/energyplus/ForwardTranslator/ForwardTranslateRefrigerationCompressorRack.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/RefrigerationCompressorRack.hpp" | ||
| 9 | #include "../../model/Curve.hpp" | ||
| 10 | #include "../../model/Schedule.hpp" | ||
| 11 | #include "../../model/ThermalZone.hpp" | ||
| 12 | #include "../../model/RefrigerationAirChiller.hpp" | ||
| 13 | #include "../../model/RefrigerationCase.hpp" | ||
| 14 | #include "../../model/RefrigerationWalkIn.hpp" | ||
| 15 | |||
| 16 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 17 | |||
| 18 | #include <utilities/idd/Refrigeration_CompressorRack_FieldEnums.hxx> | ||
| 19 | #include <utilities/idd/Refrigeration_CaseAndWalkInList_FieldEnums.hxx> | ||
| 20 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 21 | #include <utilities/idd/IddEnums.hxx> | ||
| 22 | #include <utilities/idd/IddFactory.hxx> | ||
| 23 | |||
| 24 | using namespace openstudio::model; | ||
| 25 | |||
| 26 | namespace openstudio { | ||
| 27 | |||
| 28 | namespace energyplus { | ||
| 29 | |||
| 30 | ✗ | boost::optional<IdfObject> ForwardTranslator::translateRefrigerationCompressorRack(RefrigerationCompressorRack& modelObject) { | |
| 31 | ✗ | OptionalModelObject temp; | |
| 32 | ✗ | boost::optional<std::string> s; | |
| 33 | ✗ | boost::optional<double> d; | |
| 34 | ✗ | boost::optional<int> i; | |
| 35 | ✗ | std::string name; | |
| 36 | |||
| 37 | // Name | ||
| 38 | ✗ | IdfObject object = createRegisterAndNameIdfObject(openstudio::IddObjectType::Refrigeration_CompressorRack, modelObject); | |
| 39 | |||
| 40 | // Heat Rejection Location | ||
| 41 | ✗ | s = modelObject.heatRejectionLocation(); | |
| 42 | ✗ | if (s) { | |
| 43 | ✗ | object.setString(Refrigeration_CompressorRackFields::HeatRejectionLocation, s.get()); | |
| 44 | } | ||
| 45 | |||
| 46 | // Design Compressor Rack COP | ||
| 47 | ✗ | d = modelObject.designCompressorRackCOP(); | |
| 48 | ✗ | if (d) { | |
| 49 | ✗ | object.setDouble(Refrigeration_CompressorRackFields::DesignCompressorRackCOP, d.get()); | |
| 50 | } | ||
| 51 | |||
| 52 | // Compressor Rack COP Function of Temperature Curve Name | ||
| 53 | ✗ | boost::optional<Curve> compressorRackCOPFunctionofTemperatureCurve = modelObject.compressorRackCOPFunctionofTemperatureCurve(); | |
| 54 | |||
| 55 | ✗ | if (compressorRackCOPFunctionofTemperatureCurve) { | |
| 56 | boost::optional<IdfObject> _compressorRackCOPFunctionofTemperatureCurve = | ||
| 57 | ✗ | translateAndMapModelObject(compressorRackCOPFunctionofTemperatureCurve.get()); | |
| 58 | |||
| 59 | ✗ | if (_compressorRackCOPFunctionofTemperatureCurve && _compressorRackCOPFunctionofTemperatureCurve->name()) { | |
| 60 | ✗ | object.setString(Refrigeration_CompressorRackFields::CompressorRackCOPFunctionofTemperatureCurveName, | |
| 61 | ✗ | _compressorRackCOPFunctionofTemperatureCurve->name().get()); | |
| 62 | } | ||
| 63 | ✗ | } | |
| 64 | |||
| 65 | // Design Condenser Fan Power | ||
| 66 | ✗ | d = modelObject.designCondenserFanPower(); | |
| 67 | ✗ | if (d) { | |
| 68 | ✗ | object.setDouble(Refrigeration_CompressorRackFields::DesignCondenserFanPower, d.get()); | |
| 69 | } | ||
| 70 | |||
| 71 | // Condenser Fan Power Function of Temperature Curve Name | ||
| 72 | ✗ | boost::optional<Curve> condenserFanPowerFunctionofTemperatureCurve = modelObject.condenserFanPowerFunctionofTemperatureCurve(); | |
| 73 | |||
| 74 | ✗ | if (condenserFanPowerFunctionofTemperatureCurve) { | |
| 75 | boost::optional<IdfObject> _condenserFanPowerFunctionofTemperatureCurve = | ||
| 76 | ✗ | translateAndMapModelObject(condenserFanPowerFunctionofTemperatureCurve.get()); | |
| 77 | |||
| 78 | ✗ | if (_condenserFanPowerFunctionofTemperatureCurve && _condenserFanPowerFunctionofTemperatureCurve->name()) { | |
| 79 | ✗ | object.setString(Refrigeration_CompressorRackFields::CondenserFanPowerFunctionofTemperatureCurveName, | |
| 80 | ✗ | _condenserFanPowerFunctionofTemperatureCurve->name().get()); | |
| 81 | } | ||
| 82 | ✗ | } | |
| 83 | |||
| 84 | // Condenser Type | ||
| 85 | ✗ | s = modelObject.condenserType(); | |
| 86 | ✗ | if (s) { | |
| 87 | ✗ | object.setString(Refrigeration_CompressorRackFields::CondenserType, s.get()); | |
| 88 | } | ||
| 89 | |||
| 90 | // Water-Cooled Condenser Inlet Node Name | ||
| 91 | ✗ | if ((temp = modelObject.inletModelObject())) { | |
| 92 | ✗ | if (temp->name()) { | |
| 93 | ✗ | object.setString(Refrigeration_CompressorRackFields::WaterCooledCondenserInletNodeName, temp->name().get()); | |
| 94 | } | ||
| 95 | } | ||
| 96 | |||
| 97 | // Water-Cooled Condenser Outlet Node Name | ||
| 98 | ✗ | if ((temp = modelObject.outletModelObject())) { | |
| 99 | ✗ | if (temp->name()) { | |
| 100 | ✗ | object.setString(Refrigeration_CompressorRackFields::WaterCooledCondenserOutletNodeName, temp->name().get()); | |
| 101 | } | ||
| 102 | } | ||
| 103 | |||
| 104 | // Water-Cooled Loop Flow Type | ||
| 105 | ✗ | s = modelObject.waterCooledLoopFlowType(); | |
| 106 | ✗ | if (s) { | |
| 107 | ✗ | object.setString(Refrigeration_CompressorRackFields::WaterCooledLoopFlowType, s.get()); | |
| 108 | } | ||
| 109 | |||
| 110 | // Water-Cooled Condenser Outlet Temperature Schedule Name | ||
| 111 | ✗ | boost::optional<Schedule> waterCooledCondenserOutletTemperatureSchedule = modelObject.waterCooledCondenserOutletTemperatureSchedule(); | |
| 112 | |||
| 113 | ✗ | if (waterCooledCondenserOutletTemperatureSchedule) { | |
| 114 | boost::optional<IdfObject> _waterCooledCondenserOutletTemperatureSchedule = | ||
| 115 | ✗ | translateAndMapModelObject(waterCooledCondenserOutletTemperatureSchedule.get()); | |
| 116 | |||
| 117 | ✗ | if (_waterCooledCondenserOutletTemperatureSchedule && _waterCooledCondenserOutletTemperatureSchedule->name()) { | |
| 118 | ✗ | object.setString(Refrigeration_CompressorRackFields::WaterCooledCondenserOutletTemperatureScheduleName, | |
| 119 | ✗ | _waterCooledCondenserOutletTemperatureSchedule->name().get()); | |
| 120 | } | ||
| 121 | ✗ | } | |
| 122 | |||
| 123 | // Water-Cooled Condenser Design Flow Rate | ||
| 124 | ✗ | d = modelObject.waterCooledCondenserDesignFlowRate(); | |
| 125 | ✗ | if (d) { | |
| 126 | ✗ | object.setDouble(Refrigeration_CompressorRackFields::WaterCooledCondenserDesignFlowRate, d.get()); | |
| 127 | } | ||
| 128 | |||
| 129 | // Water-Cooled Condenser Maximum Flow Rate | ||
| 130 | ✗ | d = modelObject.waterCooledCondenserMaximumFlowRate(); | |
| 131 | ✗ | if (d) { | |
| 132 | ✗ | object.setDouble(Refrigeration_CompressorRackFields::WaterCooledCondenserMaximumFlowRate, d.get()); | |
| 133 | } | ||
| 134 | |||
| 135 | // Water-Cooled Condenser Maximum Water Outlet Temperature | ||
| 136 | ✗ | d = modelObject.waterCooledCondenserMaximumWaterOutletTemperature(); | |
| 137 | ✗ | if (d) { | |
| 138 | ✗ | object.setDouble(Refrigeration_CompressorRackFields::WaterCooledCondenserMaximumWaterOutletTemperature, d.get()); | |
| 139 | } | ||
| 140 | |||
| 141 | // Water-Cooled Condenser Minimum Water Inlet Temperature | ||
| 142 | ✗ | d = modelObject.waterCooledCondenserMinimumWaterInletTemperature(); | |
| 143 | ✗ | if (d) { | |
| 144 | ✗ | object.setDouble(Refrigeration_CompressorRackFields::WaterCooledCondenserMinimumWaterInletTemperature, d.get()); | |
| 145 | } | ||
| 146 | |||
| 147 | // Evaporative Condenser Availability Schedule Name | ||
| 148 | ✗ | boost::optional<Schedule> evaporativeCondenserAvailabilitySchedule = modelObject.evaporativeCondenserAvailabilitySchedule(); | |
| 149 | |||
| 150 | ✗ | if (evaporativeCondenserAvailabilitySchedule) { | |
| 151 | boost::optional<IdfObject> _evaporativeCondenserAvailabilitySchedule = | ||
| 152 | ✗ | translateAndMapModelObject(evaporativeCondenserAvailabilitySchedule.get()); | |
| 153 | |||
| 154 | ✗ | if (_evaporativeCondenserAvailabilitySchedule && _evaporativeCondenserAvailabilitySchedule->name()) { | |
| 155 | ✗ | object.setString(Refrigeration_CompressorRackFields::EvaporativeCondenserAvailabilityScheduleName, | |
| 156 | ✗ | _evaporativeCondenserAvailabilitySchedule->name().get()); | |
| 157 | } | ||
| 158 | ✗ | } | |
| 159 | |||
| 160 | // Evaporative Condenser Effectiveness | ||
| 161 | ✗ | d = modelObject.evaporativeCondenserEffectiveness(); | |
| 162 | ✗ | if (d) { | |
| 163 | ✗ | object.setDouble(Refrigeration_CompressorRackFields::EvaporativeCondenserEffectiveness, d.get()); | |
| 164 | } | ||
| 165 | |||
| 166 | // Evaporative Condenser Air Flow Rate | ||
| 167 | ✗ | d = modelObject.evaporativeCondenserAirFlowRate(); | |
| 168 | ✗ | if (d) { | |
| 169 | ✗ | object.setDouble(Refrigeration_CompressorRackFields::EvaporativeCondenserAirFlowRate, d.get()); | |
| 170 | } | ||
| 171 | |||
| 172 | // Basin Heater Capacity | ||
| 173 | ✗ | d = modelObject.basinHeaterCapacity(); | |
| 174 | ✗ | if (d) { | |
| 175 | ✗ | object.setDouble(Refrigeration_CompressorRackFields::BasinHeaterCapacity, d.get()); | |
| 176 | } | ||
| 177 | |||
| 178 | // Basin Heater Setpoint Temperature | ||
| 179 | ✗ | d = modelObject.basinHeaterSetpointTemperature(); | |
| 180 | ✗ | if (d) { | |
| 181 | ✗ | object.setDouble(Refrigeration_CompressorRackFields::BasinHeaterSetpointTemperature, d.get()); | |
| 182 | } | ||
| 183 | |||
| 184 | // Design Evaporative Condenser Water Pump Power | ||
| 185 | ✗ | d = modelObject.designEvaporativeCondenserWaterPumpPower(); | |
| 186 | ✗ | if (d) { | |
| 187 | ✗ | object.setDouble(Refrigeration_CompressorRackFields::DesignEvaporativeCondenserWaterPumpPower, d.get()); | |
| 188 | } | ||
| 189 | |||
| 190 | // Evaporative Water Supply Tank Name | ||
| 191 | ✗ | object.setString(Refrigeration_CompressorRackFields::EvaporativeWaterSupplyTankName, ""); | |
| 192 | |||
| 193 | // Condenser Air Inlet Node Name | ||
| 194 | ✗ | object.setString(Refrigeration_CompressorRackFields::CondenserAirInletNodeName, ""); | |
| 195 | |||
| 196 | // End-Use Subcategory | ||
| 197 | ✗ | s = modelObject.endUseSubcategory(); | |
| 198 | ✗ | if (s) { | |
| 199 | ✗ | object.setString(Refrigeration_CompressorRackFields::EndUseSubcategory, s.get()); | |
| 200 | } | ||
| 201 | |||
| 202 | // Refrigeration Case Name or WalkIn Name or CaseAndWalkInList Name | ||
| 203 | ✗ | std::vector<RefrigerationCase> cases = modelObject.cases(); | |
| 204 | ✗ | std::vector<RefrigerationWalkIn> walkins = modelObject.walkins(); | |
| 205 | ✗ | std::vector<RefrigerationAirChiller> airChillers = modelObject.airChillers(); | |
| 206 | |||
| 207 | ✗ | if (!cases.empty() || !walkins.empty() || !airChillers.empty()) { | |
| 208 | // Name | ||
| 209 | ✗ | name = " Case and Walkin List"; | |
| 210 | ✗ | object.setString(Refrigeration_CompressorRackFields::RefrigerationCaseNameorWalkInNameorCaseAndWalkInListName, object.name().get() + name); | |
| 211 | |||
| 212 | ✗ | IdfObject _caseAndWalkinList(IddObjectType::Refrigeration_CaseAndWalkInList); | |
| 213 | |||
| 214 | ✗ | m_idfObjects.push_back(_caseAndWalkinList); | |
| 215 | |||
| 216 | ✗ | _caseAndWalkinList.setName(object.name().get() + name); | |
| 217 | |||
| 218 | ✗ | for (auto& elem : cases) { | |
| 219 | ✗ | boost::optional<IdfObject> _case = translateAndMapModelObject(elem); | |
| 220 | |||
| 221 | ✗ | if (_case) { | |
| 222 | ✗ | IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup(); | |
| 223 | |||
| 224 | ✗ | eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName, _case->name().get()); | |
| 225 | ✗ | } | |
| 226 | ✗ | } | |
| 227 | |||
| 228 | ✗ | for (auto& elem : walkins) { | |
| 229 | ✗ | boost::optional<IdfObject> _walkin = translateAndMapModelObject(elem); | |
| 230 | |||
| 231 | ✗ | if (_walkin) { | |
| 232 | ✗ | IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup(); | |
| 233 | |||
| 234 | ✗ | eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName, _walkin->name().get()); | |
| 235 | ✗ | } | |
| 236 | ✗ | } | |
| 237 | |||
| 238 | ✗ | for (auto& elem : airChillers) { | |
| 239 | ✗ | boost::optional<IdfObject> _airChiller = translateAndMapModelObject(elem); | |
| 240 | |||
| 241 | ✗ | if (_airChiller) { | |
| 242 | ✗ | IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup(); | |
| 243 | |||
| 244 | ✗ | eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName, _airChiller->name().get()); | |
| 245 | ✗ | } | |
| 246 | ✗ | } | |
| 247 | ✗ | } | |
| 248 | |||
| 249 | // Heat Rejection Zone Name | ||
| 250 | ✗ | boost::optional<ThermalZone> heatRejectionZone = modelObject.heatRejectionZone(); | |
| 251 | |||
| 252 | ✗ | if (heatRejectionZone) { | |
| 253 | ✗ | boost::optional<IdfObject> _heatRejectionZone = translateAndMapModelObject(heatRejectionZone.get()); | |
| 254 | |||
| 255 | ✗ | if (_heatRejectionZone && _heatRejectionZone->name()) { | |
| 256 | ✗ | object.setString(Refrigeration_CompressorRackFields::HeatRejectionZoneName, _heatRejectionZone->name().get()); | |
| 257 | } | ||
| 258 | ✗ | } | |
| 259 | |||
| 260 | ✗ | return object; | |
| 261 | ✗ | } | |
| 262 | } // namespace energyplus | ||
| 263 | } // namespace openstudio | ||
| 264 |