src/energyplus/ForwardTranslator/ForwardTranslateRefrigerationTranscriticalSystem.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/RefrigerationTranscriticalSystem.hpp" | ||
| 9 | #include "../../model/ThermalZone.hpp" | ||
| 10 | #include "../../model/RefrigerationCase.hpp" | ||
| 11 | #include "../../model/RefrigerationCompressor.hpp" | ||
| 12 | #include "../../model/RefrigerationGasCoolerAirCooled.hpp" | ||
| 13 | #include "../../model/RefrigerationWalkIn.hpp" | ||
| 14 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 15 | |||
| 16 | #include <utilities/idd/Refrigeration_TranscriticalSystem_FieldEnums.hxx> | ||
| 17 | #include <utilities/idd/Refrigeration_CaseAndWalkInList_FieldEnums.hxx> | ||
| 18 | #include <utilities/idd/Refrigeration_CompressorList_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::translateRefrigerationTranscriticalSystem(RefrigerationTranscriticalSystem& modelObject) { | |
| 33 | ✗ | OptionalModelObject temp; | |
| 34 | ✗ | boost::optional<std::string> s; | |
| 35 | ✗ | boost::optional<double> d; | |
| 36 | ✗ | std::string name; | |
| 37 | |||
| 38 | // Name | ||
| 39 | ✗ | IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Refrigeration_TranscriticalSystem, modelObject); | |
| 40 | |||
| 41 | //MediumTemperatureRefrigeratedCaseAndWalkInListName | ||
| 42 | ✗ | std::vector<RefrigerationCase> mediumTemperatureCases = modelObject.mediumTemperatureCases(); | |
| 43 | ✗ | std::vector<RefrigerationWalkIn> mediumTemperatureWalkins = modelObject.mediumTemperatureWalkins(); | |
| 44 | |||
| 45 | ✗ | if (!mediumTemperatureCases.empty() || !mediumTemperatureWalkins.empty()) { | |
| 46 | // Name | ||
| 47 | ✗ | name = " Medium Temperature Case and Walkin List"; | |
| 48 | ✗ | idfObject.setString(Refrigeration_TranscriticalSystemFields::MediumTemperatureRefrigeratedCaseorWalkinorCaseAndWalkInListName, | |
| 49 | ✗ | idfObject.name().get() + name); | |
| 50 | |||
| 51 | ✗ | IdfObject _caseAndWalkinList(IddObjectType::Refrigeration_CaseAndWalkInList); | |
| 52 | |||
| 53 | ✗ | m_idfObjects.push_back(_caseAndWalkinList); | |
| 54 | |||
| 55 | ✗ | _caseAndWalkinList.setName(idfObject.name().get() + name); | |
| 56 | |||
| 57 | ✗ | for (auto& mediumTemperatureCase : mediumTemperatureCases) { | |
| 58 | ✗ | boost::optional<IdfObject> _case = translateAndMapModelObject(mediumTemperatureCase); | |
| 59 | |||
| 60 | ✗ | if (_case) { | |
| 61 | ✗ | IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup(); | |
| 62 | |||
| 63 | ✗ | eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName, _case->name().get()); | |
| 64 | ✗ | } | |
| 65 | ✗ | } | |
| 66 | |||
| 67 | ✗ | for (auto& mediumTemperatureWalkin : mediumTemperatureWalkins) { | |
| 68 | ✗ | boost::optional<IdfObject> _walkin = translateAndMapModelObject(mediumTemperatureWalkin); | |
| 69 | |||
| 70 | ✗ | if (_walkin) { | |
| 71 | ✗ | IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup(); | |
| 72 | |||
| 73 | ✗ | eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName, _walkin->name().get()); | |
| 74 | ✗ | } | |
| 75 | ✗ | } | |
| 76 | ✗ | } | |
| 77 | |||
| 78 | //LowTemperatureRefrigeratedCaseAndWalkInListName | ||
| 79 | ✗ | std::vector<RefrigerationCase> lowTemperatureCases = modelObject.lowTemperatureCases(); | |
| 80 | ✗ | std::vector<RefrigerationWalkIn> lowTemperatureWalkins = modelObject.lowTemperatureWalkins(); | |
| 81 | |||
| 82 | ✗ | if (!lowTemperatureCases.empty() || !lowTemperatureWalkins.empty()) { | |
| 83 | // Name | ||
| 84 | ✗ | name = " Low Temperature Case and Walkin List"; | |
| 85 | ✗ | idfObject.setString(Refrigeration_TranscriticalSystemFields::LowTemperatureRefrigeratedCaseorWalkinorCaseAndWalkInListName, | |
| 86 | ✗ | idfObject.name().get() + name); | |
| 87 | |||
| 88 | ✗ | IdfObject _caseAndWalkinList(IddObjectType::Refrigeration_CaseAndWalkInList); | |
| 89 | |||
| 90 | ✗ | m_idfObjects.push_back(_caseAndWalkinList); | |
| 91 | |||
| 92 | ✗ | _caseAndWalkinList.setName(idfObject.name().get() + name); | |
| 93 | |||
| 94 | ✗ | for (auto& lowTemperatureCase : lowTemperatureCases) { | |
| 95 | ✗ | boost::optional<IdfObject> _case = translateAndMapModelObject(lowTemperatureCase); | |
| 96 | |||
| 97 | ✗ | if (_case) { | |
| 98 | ✗ | IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup(); | |
| 99 | |||
| 100 | ✗ | eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName, _case->name().get()); | |
| 101 | ✗ | } | |
| 102 | ✗ | } | |
| 103 | |||
| 104 | ✗ | for (auto& lowTemperatureWalkin : lowTemperatureWalkins) { | |
| 105 | ✗ | boost::optional<IdfObject> _walkin = translateAndMapModelObject(lowTemperatureWalkin); | |
| 106 | |||
| 107 | ✗ | if (_walkin) { | |
| 108 | ✗ | IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup(); | |
| 109 | |||
| 110 | ✗ | eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName, _walkin->name().get()); | |
| 111 | ✗ | } | |
| 112 | ✗ | } | |
| 113 | ✗ | } | |
| 114 | |||
| 115 | // SystemType | ||
| 116 | ✗ | if ((!mediumTemperatureCases.empty() || !mediumTemperatureWalkins.empty()) && (!lowTemperatureCases.empty() || !lowTemperatureWalkins.empty())) { | |
| 117 | ✗ | idfObject.setString(Refrigeration_TranscriticalSystemFields::SystemType, "TwoStage"); | |
| 118 | } else { | ||
| 119 | ✗ | idfObject.setString(Refrigeration_TranscriticalSystemFields::SystemType, "SingleStage"); | |
| 120 | } | ||
| 121 | |||
| 122 | // RefrigerationGasCoolerName | ||
| 123 | ✗ | if (boost::optional<RefrigerationGasCoolerAirCooled> refrigerationGasCooler = modelObject.refrigerationGasCooler()) { | |
| 124 | ✗ | boost::optional<IdfObject> _refrigerationGasCooler = translateAndMapModelObject(refrigerationGasCooler.get()); | |
| 125 | |||
| 126 | ✗ | if (_refrigerationGasCooler && _refrigerationGasCooler->name()) { | |
| 127 | ✗ | idfObject.setString(Refrigeration_TranscriticalSystemFields::RefrigerationGasCoolerName, _refrigerationGasCooler->name().get()); | |
| 128 | } | ||
| 129 | ✗ | } | |
| 130 | |||
| 131 | //HighPressureCompressorListName | ||
| 132 | ✗ | std::vector<RefrigerationCompressor> highPressureCompressors = modelObject.highPressureCompressors(); | |
| 133 | |||
| 134 | ✗ | if (!highPressureCompressors.empty()) { | |
| 135 | // Name | ||
| 136 | ✗ | name = " High Pressure Compressor List"; | |
| 137 | ✗ | idfObject.setString(Refrigeration_TranscriticalSystemFields::HighPressureCompressororCompressorListName, idfObject.name().get() + name); | |
| 138 | |||
| 139 | ✗ | IdfObject _compressorList(IddObjectType::Refrigeration_CompressorList); | |
| 140 | |||
| 141 | ✗ | m_idfObjects.push_back(_compressorList); | |
| 142 | |||
| 143 | ✗ | _compressorList.setName(idfObject.name().get() + name); | |
| 144 | |||
| 145 | ✗ | for (auto& highPressureCompressor : highPressureCompressors) { | |
| 146 | ✗ | boost::optional<IdfObject> _compressor = translateAndMapModelObject(highPressureCompressor); | |
| 147 | |||
| 148 | ✗ | if (_compressor) { | |
| 149 | ✗ | IdfExtensibleGroup eg = _compressorList.pushExtensibleGroup(); | |
| 150 | |||
| 151 | ✗ | eg.setString(Refrigeration_CompressorListExtensibleFields::RefrigerationCompressorName, _compressor->name().get()); | |
| 152 | ✗ | } | |
| 153 | ✗ | } | |
| 154 | ✗ | } | |
| 155 | |||
| 156 | //LowPressureCompressorListName | ||
| 157 | ✗ | std::vector<RefrigerationCompressor> lowPressureCompressors = modelObject.lowPressureCompressors(); | |
| 158 | |||
| 159 | ✗ | if (!lowPressureCompressors.empty()) { | |
| 160 | // Name | ||
| 161 | ✗ | name = " Low Pressure Compressor List"; | |
| 162 | ✗ | idfObject.setString(Refrigeration_TranscriticalSystemFields::LowPressureCompressororCompressorListName, idfObject.name().get() + name); | |
| 163 | |||
| 164 | ✗ | IdfObject _compressorList(IddObjectType::Refrigeration_CompressorList); | |
| 165 | |||
| 166 | ✗ | m_idfObjects.push_back(_compressorList); | |
| 167 | |||
| 168 | ✗ | _compressorList.setName(idfObject.name().get() + name); | |
| 169 | |||
| 170 | ✗ | for (auto& lowPressureCompressor : lowPressureCompressors) { | |
| 171 | ✗ | boost::optional<IdfObject> _compressor = translateAndMapModelObject(lowPressureCompressor); | |
| 172 | |||
| 173 | ✗ | if (_compressor) { | |
| 174 | ✗ | IdfExtensibleGroup eg = _compressorList.pushExtensibleGroup(); | |
| 175 | |||
| 176 | ✗ | eg.setString(Refrigeration_CompressorListExtensibleFields::RefrigerationCompressorName, _compressor->name().get()); | |
| 177 | ✗ | } | |
| 178 | ✗ | } | |
| 179 | ✗ | } | |
| 180 | |||
| 181 | // ReceiverPressure | ||
| 182 | ✗ | d = modelObject.receiverPressure(); | |
| 183 | ✗ | if (d) { | |
| 184 | ✗ | idfObject.setDouble(Refrigeration_TranscriticalSystemFields::ReceiverPressure, d.get()); | |
| 185 | } | ||
| 186 | |||
| 187 | // SubcoolerEffectiveness | ||
| 188 | ✗ | d = modelObject.subcoolerEffectiveness(); | |
| 189 | ✗ | if (d) { | |
| 190 | ✗ | idfObject.setDouble(Refrigeration_TranscriticalSystemFields::SubcoolerEffectiveness, d.get()); | |
| 191 | } | ||
| 192 | |||
| 193 | // RefrigerationSystemWorkingFluidType | ||
| 194 | ✗ | s = modelObject.refrigerationSystemWorkingFluidType(); | |
| 195 | ✗ | if (s) { | |
| 196 | ✗ | boost::optional<IdfObject> fluidProperties = createFluidProperties(s.get()); | |
| 197 | ✗ | if (fluidProperties) { | |
| 198 | ✗ | boost::optional<std::string> value = fluidProperties.get().getString(FluidProperties_NameFields::FluidName, true); | |
| 199 | ✗ | if (value) { | |
| 200 | ✗ | idfObject.setString(Refrigeration_TranscriticalSystemFields::RefrigerationSystemWorkingFluidType, value.get()); | |
| 201 | } | ||
| 202 | ✗ | } | |
| 203 | ✗ | } | |
| 204 | |||
| 205 | // SumUASuctionPipingforMediumTemperatureLoads | ||
| 206 | ✗ | d = modelObject.sumUASuctionPipingforMediumTemperatureLoads(); | |
| 207 | ✗ | if (d) { | |
| 208 | ✗ | idfObject.setDouble(Refrigeration_TranscriticalSystemFields::SumUASuctionPipingforMediumTemperatureLoads, d.get()); | |
| 209 | } | ||
| 210 | |||
| 211 | // MediumTemperatureSuctionPipingZoneName | ||
| 212 | ✗ | if (boost::optional<ThermalZone> mediumTemperatureSuctionPipingZone = modelObject.mediumTemperatureSuctionPipingZone()) { | |
| 213 | ✗ | boost::optional<IdfObject> _mediumTemperatureSuctionPipingZone = translateAndMapModelObject(mediumTemperatureSuctionPipingZone.get()); | |
| 214 | |||
| 215 | ✗ | if (_mediumTemperatureSuctionPipingZone && _mediumTemperatureSuctionPipingZone->name()) { | |
| 216 | ✗ | idfObject.setString(Refrigeration_TranscriticalSystemFields::MediumTemperatureSuctionPipingZoneName, | |
| 217 | ✗ | _mediumTemperatureSuctionPipingZone->name().get()); | |
| 218 | } | ||
| 219 | ✗ | } | |
| 220 | |||
| 221 | // SumUASuctionPipingforLowTemperatureLoads | ||
| 222 | ✗ | d = modelObject.sumUASuctionPipingforLowTemperatureLoads(); | |
| 223 | ✗ | if (d) { | |
| 224 | ✗ | idfObject.setDouble(Refrigeration_TranscriticalSystemFields::SumUASuctionPipingforLowTemperatureLoads, d.get()); | |
| 225 | } | ||
| 226 | |||
| 227 | // LowTemperatureSuctionPipingZoneName | ||
| 228 | ✗ | if (boost::optional<ThermalZone> lowTemperatureSuctionPipingZone = modelObject.lowTemperatureSuctionPipingZone()) { | |
| 229 | ✗ | boost::optional<IdfObject> _lowTemperatureSuctionPipingZone = translateAndMapModelObject(lowTemperatureSuctionPipingZone.get()); | |
| 230 | |||
| 231 | ✗ | if (_lowTemperatureSuctionPipingZone && _lowTemperatureSuctionPipingZone->name()) { | |
| 232 | ✗ | idfObject.setString(Refrigeration_TranscriticalSystemFields::LowTemperatureSuctionPipingZoneName, | |
| 233 | ✗ | _lowTemperatureSuctionPipingZone->name().get()); | |
| 234 | } | ||
| 235 | ✗ | } | |
| 236 | |||
| 237 | // EndUseSubcategory | ||
| 238 | ✗ | s = modelObject.endUseSubcategory(); | |
| 239 | ✗ | if (s) { | |
| 240 | ✗ | idfObject.setString(Refrigeration_TranscriticalSystemFields::EndUseSubcategory, s.get()); | |
| 241 | } | ||
| 242 | |||
| 243 | ✗ | return idfObject; | |
| 244 | ✗ | } | |
| 245 | } // namespace energyplus | ||
| 246 | } // namespace openstudio | ||
| 247 |