src/energyplus/ForwardTranslator/ForwardTranslateRefrigerationSecondarySystem.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/RefrigerationSecondarySystem.hpp" | ||
| 9 | #include "../../model/ThermalZone.hpp" | ||
| 10 | #include "../../model/CurveCubic.hpp" | ||
| 11 | #include "../../model/RefrigerationAirChiller.hpp" | ||
| 12 | #include "../../model/RefrigerationCase.hpp" | ||
| 13 | #include "../../model/RefrigerationWalkIn.hpp" | ||
| 14 | |||
| 15 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 16 | |||
| 17 | #include <utilities/idd/Refrigeration_SecondarySystem_FieldEnums.hxx> | ||
| 18 | #include <utilities/idd/Refrigeration_CaseAndWalkInList_FieldEnums.hxx> | ||
| 19 | #include <utilities/idd/FluidProperties_Name_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 | using namespace std; | ||
| 27 | |||
| 28 | namespace openstudio { | ||
| 29 | |||
| 30 | namespace energyplus { | ||
| 31 | |||
| 32 | ✗ | boost::optional<IdfObject> ForwardTranslator::translateRefrigerationSecondarySystem(RefrigerationSecondarySystem& modelObject) { | |
| 33 | ✗ | OptionalModelObject temp; | |
| 34 | ✗ | boost::optional<std::string> s; | |
| 35 | ✗ | boost::optional<double> d; | |
| 36 | ✗ | boost::optional<int> i; | |
| 37 | ✗ | std::string name; | |
| 38 | |||
| 39 | // Name | ||
| 40 | ✗ | IdfObject refrigerationSecondarySystem = createRegisterAndNameIdfObject(openstudio::IddObjectType::Refrigeration_SecondarySystem, modelObject); | |
| 41 | |||
| 42 | //RefrigeratedCaseorWalkinorCaseAndWalkInListName | ||
| 43 | ✗ | std::vector<RefrigerationCase> cases = modelObject.cases(); | |
| 44 | ✗ | std::vector<RefrigerationWalkIn> walkins = modelObject.walkins(); | |
| 45 | ✗ | std::vector<RefrigerationAirChiller> airChillers = modelObject.airChillers(); | |
| 46 | |||
| 47 | ✗ | if (!cases.empty() || !walkins.empty() || !airChillers.empty()) { | |
| 48 | // Name | ||
| 49 | ✗ | name = " Case and Walkin List"; | |
| 50 | ✗ | refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::RefrigeratedCaseorWalkinorCaseAndWalkInListName, | |
| 51 | ✗ | refrigerationSecondarySystem.name().get() + name); | |
| 52 | |||
| 53 | ✗ | IdfObject _caseAndWalkinList(IddObjectType::Refrigeration_CaseAndWalkInList); | |
| 54 | |||
| 55 | ✗ | m_idfObjects.push_back(_caseAndWalkinList); | |
| 56 | |||
| 57 | ✗ | _caseAndWalkinList.setName(refrigerationSecondarySystem.name().get() + name); | |
| 58 | |||
| 59 | ✗ | for (auto& elem : cases) { | |
| 60 | ✗ | boost::optional<IdfObject> _case = translateAndMapModelObject(elem); | |
| 61 | |||
| 62 | ✗ | if (_case) { | |
| 63 | ✗ | IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup(); | |
| 64 | |||
| 65 | ✗ | eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName, _case->name().get()); | |
| 66 | ✗ | } | |
| 67 | ✗ | } | |
| 68 | |||
| 69 | ✗ | for (auto& elem : walkins) { | |
| 70 | ✗ | boost::optional<IdfObject> _walkin = translateAndMapModelObject(elem); | |
| 71 | |||
| 72 | ✗ | if (_walkin) { | |
| 73 | ✗ | IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup(); | |
| 74 | |||
| 75 | ✗ | eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName, _walkin->name().get()); | |
| 76 | ✗ | } | |
| 77 | ✗ | } | |
| 78 | |||
| 79 | ✗ | for (auto& elem : airChillers) { | |
| 80 | ✗ | boost::optional<IdfObject> _airChiller = translateAndMapModelObject(elem); | |
| 81 | |||
| 82 | ✗ | if (_airChiller) { | |
| 83 | ✗ | IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup(); | |
| 84 | |||
| 85 | ✗ | eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName, _airChiller->name().get()); | |
| 86 | ✗ | } | |
| 87 | ✗ | } | |
| 88 | ✗ | } | |
| 89 | |||
| 90 | //CirculatingFluidType | ||
| 91 | //CirculatingFluidName | ||
| 92 | ✗ | s = modelObject.circulatingFluidName(); | |
| 93 | ✗ | if (s) { | |
| 94 | ✗ | i = modelObject.glycolConcentration(); | |
| 95 | ✗ | boost::optional<IdfObject> fluidProperties; | |
| 96 | ✗ | if (i && (istringEqual(s.get(), "PropyleneGlycol") || istringEqual(s.get(), "EthyleneGlycol"))) { | |
| 97 | ✗ | fluidProperties = createFluidProperties(s.get(), i.get()); | |
| 98 | ✗ | refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::CirculatingFluidType, "FluidAlwaysLiquid"); | |
| 99 | } else { | ||
| 100 | ✗ | fluidProperties = createFluidProperties(s.get()); | |
| 101 | ✗ | refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::CirculatingFluidType, "FluidPhaseChange"); | |
| 102 | } | ||
| 103 | ✗ | if (fluidProperties) { | |
| 104 | ✗ | boost::optional<std::string> value = fluidProperties.get().getString(FluidProperties_NameFields::FluidName, true); | |
| 105 | ✗ | if (value) { | |
| 106 | ✗ | refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::CirculatingFluidName, value.get()); | |
| 107 | } | ||
| 108 | ✗ | } | |
| 109 | ✗ | } | |
| 110 | |||
| 111 | //EvaporatorCapacity | ||
| 112 | ✗ | d = modelObject.evaporatorCapacity(); | |
| 113 | ✗ | if (d) { | |
| 114 | ✗ | refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::EvaporatorCapacity, d.get()); | |
| 115 | } | ||
| 116 | |||
| 117 | //EvaporatorFlowRateforSecondaryFluid | ||
| 118 | ✗ | d = modelObject.evaporatorFlowRateforSecondaryFluid(); | |
| 119 | ✗ | if (d) { | |
| 120 | ✗ | refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::EvaporatorFlowRateforSecondaryFluid, d.get()); | |
| 121 | } | ||
| 122 | |||
| 123 | //EvaporatorEvaporatingTemperature | ||
| 124 | ✗ | d = modelObject.evaporatorEvaporatingTemperature(); | |
| 125 | ✗ | if (d) { | |
| 126 | ✗ | refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::EvaporatorEvaporatingTemperature, d.get()); | |
| 127 | } | ||
| 128 | |||
| 129 | //EvaporatorApproachTemperatureDifference | ||
| 130 | ✗ | d = modelObject.evaporatorApproachTemperatureDifference(); | |
| 131 | ✗ | if (d) { | |
| 132 | ✗ | refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::EvaporatorApproachTemperatureDifference, d.get()); | |
| 133 | } | ||
| 134 | |||
| 135 | //EvaporatorRangeTemperatureDifference | ||
| 136 | ✗ | d = modelObject.evaporatorRangeTemperatureDifference(); | |
| 137 | ✗ | if (d) { | |
| 138 | ✗ | refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::EvaporatorRangeTemperatureDifference, d.get()); | |
| 139 | } | ||
| 140 | |||
| 141 | //NumberofPumpsinLoop | ||
| 142 | ✗ | i = modelObject.numberofPumpsinLoop(); | |
| 143 | ✗ | if (i) { | |
| 144 | ✗ | refrigerationSecondarySystem.setInt(Refrigeration_SecondarySystemFields::NumberofPumpsinLoop, i.get()); | |
| 145 | } | ||
| 146 | |||
| 147 | //TotalPumpFlowRate | ||
| 148 | ✗ | d = modelObject.totalPumpFlowRate(); | |
| 149 | ✗ | if (d) { | |
| 150 | ✗ | refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::TotalPumpFlowRate, d.get()); | |
| 151 | } | ||
| 152 | |||
| 153 | //TotalPumpPower | ||
| 154 | ✗ | d = modelObject.totalPumpPower(); | |
| 155 | ✗ | if (d) { | |
| 156 | ✗ | refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::TotalPumpPower, d.get()); | |
| 157 | } | ||
| 158 | |||
| 159 | //TotalPumpHead | ||
| 160 | ✗ | d = modelObject.totalPumpHead(); | |
| 161 | ✗ | if (d) { | |
| 162 | ✗ | refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::TotalPumpHead, d.get()); | |
| 163 | } | ||
| 164 | |||
| 165 | //PhaseChangeCirculatingRate | ||
| 166 | ✗ | d = modelObject.phaseChangeCirculatingRate(); | |
| 167 | ✗ | if (d) { | |
| 168 | ✗ | refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::PhaseChangeCirculatingRate, d.get()); | |
| 169 | } | ||
| 170 | |||
| 171 | //PumpDriveType | ||
| 172 | ✗ | s = modelObject.pumpDriveType(); | |
| 173 | ✗ | if (s) { | |
| 174 | ✗ | refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::PumpDriveType, s.get()); | |
| 175 | } | ||
| 176 | |||
| 177 | //VariableSpeedPumpCubicCurveName | ||
| 178 | ✗ | boost::optional<CurveCubic> variableSpeedPumpCubicCurve = modelObject.variableSpeedPumpCubicCurve(); | |
| 179 | |||
| 180 | ✗ | if (variableSpeedPumpCubicCurve) { | |
| 181 | ✗ | boost::optional<IdfObject> _variableSpeedPumpCubicCurve = translateAndMapModelObject(variableSpeedPumpCubicCurve.get()); | |
| 182 | |||
| 183 | ✗ | if (_variableSpeedPumpCubicCurve && _variableSpeedPumpCubicCurve->name()) { | |
| 184 | ✗ | refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::VariableSpeedPumpCubicCurveName, | |
| 185 | ✗ | _variableSpeedPumpCubicCurve->name().get()); | |
| 186 | } | ||
| 187 | ✗ | } | |
| 188 | |||
| 189 | //PumpMotorHeattoFluid | ||
| 190 | ✗ | d = modelObject.pumpMotorHeattoFluid(); | |
| 191 | ✗ | if (d) { | |
| 192 | ✗ | refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::PumpMotorHeattoFluid, d.get()); | |
| 193 | } | ||
| 194 | |||
| 195 | //SumUADistributionPiping | ||
| 196 | ✗ | d = modelObject.sumUADistributionPiping(); | |
| 197 | ✗ | if (d) { | |
| 198 | ✗ | refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::SumUADistributionPiping, d.get()); | |
| 199 | } | ||
| 200 | |||
| 201 | //DistributionPipingZoneName | ||
| 202 | ✗ | boost::optional<ThermalZone> distributionPipingZone = modelObject.distributionPipingZone(); | |
| 203 | |||
| 204 | ✗ | if (distributionPipingZone) { | |
| 205 | ✗ | boost::optional<IdfObject> _distributionPipingZone = translateAndMapModelObject(distributionPipingZone.get()); | |
| 206 | |||
| 207 | ✗ | if (_distributionPipingZone && _distributionPipingZone->name()) { | |
| 208 | ✗ | refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::DistributionPipingZoneName, | |
| 209 | ✗ | _distributionPipingZone->name().get()); | |
| 210 | } | ||
| 211 | ✗ | } | |
| 212 | |||
| 213 | //SumUAReceiver_SeparatorShell | ||
| 214 | ✗ | d = modelObject.sumUAReceiverSeparatorShell(); | |
| 215 | ✗ | if (d) { | |
| 216 | ✗ | refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::SumUAReceiver_SeparatorShell, d.get()); | |
| 217 | } | ||
| 218 | |||
| 219 | //Receiver_SeparatorZoneName | ||
| 220 | ✗ | boost::optional<ThermalZone> receiverSeparatorZone = modelObject.receiverSeparatorZone(); | |
| 221 | |||
| 222 | ✗ | if (receiverSeparatorZone) { | |
| 223 | ✗ | boost::optional<IdfObject> _receiverSeparatorZone = translateAndMapModelObject(receiverSeparatorZone.get()); | |
| 224 | |||
| 225 | ✗ | if (_receiverSeparatorZone && _receiverSeparatorZone->name()) { | |
| 226 | ✗ | refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::Receiver_SeparatorZoneName, _receiverSeparatorZone->name().get()); | |
| 227 | } | ||
| 228 | ✗ | } | |
| 229 | |||
| 230 | //EvaporatorRefrigerantInventory | ||
| 231 | ✗ | d = modelObject.evaporatorRefrigerantInventory(); | |
| 232 | ✗ | if (d) { | |
| 233 | ✗ | refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::EvaporatorRefrigerantInventory, d.get()); | |
| 234 | } | ||
| 235 | |||
| 236 | //EndUseSubcategory | ||
| 237 | ✗ | s = modelObject.endUseSubcategory(); | |
| 238 | ✗ | if (s) { | |
| 239 | ✗ | refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::EndUseSubcategory, s.get()); | |
| 240 | } | ||
| 241 | |||
| 242 | ✗ | return refrigerationSecondarySystem; | |
| 243 | ✗ | } | |
| 244 | } // namespace energyplus | ||
| 245 | } // namespace openstudio | ||
| 246 |