src/energyplus/ReverseTranslator/ReverseTranslateRefrigerationCompressor.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 "../ReverseTranslator.hpp" | ||
| 7 | #include "../../model/RefrigerationCompressor.hpp" | ||
| 8 | #include "../../model/RefrigerationCompressor_Impl.hpp" | ||
| 9 | #include "../../model/CurveBicubic.hpp" | ||
| 10 | #include "../../model/CurveBicubic_Impl.hpp" | ||
| 11 | #include <utilities/idd/Refrigeration_Compressor_FieldEnums.hxx> | ||
| 12 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 13 | #include <utilities/idd/IddEnums.hxx> | ||
| 14 | |||
| 15 | using namespace openstudio::model; | ||
| 16 | |||
| 17 | namespace openstudio { | ||
| 18 | |||
| 19 | namespace energyplus { | ||
| 20 | |||
| 21 | ✗ | OptionalModelObject ReverseTranslator::translateRefrigerationCompressor(const WorkspaceObject& workspaceObject) { | |
| 22 | ✗ | if (workspaceObject.iddObject().type() != IddObjectType::Refrigeration_Compressor) { | |
| 23 | ✗ | LOG(Error, "WorkspaceObject is not IddObjectType: Refrigeration_Compressor"); | |
| 24 | ✗ | return boost::none; | |
| 25 | } | ||
| 26 | |||
| 27 | ✗ | boost::optional<RefrigerationCompressor> refrigerationCompressor = RefrigerationCompressor(m_model); | |
| 28 | ✗ | boost::optional<WorkspaceObject> wo; | |
| 29 | |||
| 30 | ✗ | if (refrigerationCompressor) { | |
| 31 | ✗ | boost::optional<double> value; | |
| 32 | ✗ | boost::optional<std::string> s = workspaceObject.getString(Refrigeration_CompressorFields::Name); | |
| 33 | |||
| 34 | // Name | ||
| 35 | ✗ | if (s) { | |
| 36 | ✗ | refrigerationCompressor->setName(s.get()); | |
| 37 | } | ||
| 38 | |||
| 39 | // RefrigerationCompressorPowerCurveName | ||
| 40 | ✗ | if ((wo = workspaceObject.getTarget(Refrigeration_CompressorFields::RefrigerationCompressorPowerCurveName))) { | |
| 41 | ✗ | if (boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get())) { | |
| 42 | ✗ | if (boost::optional<CurveBicubic> curve = mo->optionalCast<CurveBicubic>()) { | |
| 43 | ✗ | refrigerationCompressor->setRefrigerationCompressorPowerCurve(curve.get()); | |
| 44 | ✗ | } | |
| 45 | ✗ | } | |
| 46 | } | ||
| 47 | // RefrigerationCompressorCapacityCurveName | ||
| 48 | ✗ | if ((wo = workspaceObject.getTarget(Refrigeration_CompressorFields::RefrigerationCompressorCapacityCurveName))) { | |
| 49 | ✗ | if (boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get())) { | |
| 50 | ✗ | if (boost::optional<CurveBicubic> curve = mo->optionalCast<CurveBicubic>()) { | |
| 51 | ✗ | refrigerationCompressor->setRefrigerationCompressorCapacityCurve(curve.get()); | |
| 52 | ✗ | } | |
| 53 | ✗ | } | |
| 54 | } | ||
| 55 | // RatedSuperheat | ||
| 56 | ✗ | value = workspaceObject.getDouble(Refrigeration_CompressorFields::RatedSuperheat); | |
| 57 | ✗ | if (value) { | |
| 58 | ✗ | refrigerationCompressor->setRatedSuperheat(value.get()); | |
| 59 | } | ||
| 60 | // RatedReturnGasTemperature | ||
| 61 | ✗ | value = workspaceObject.getDouble(Refrigeration_CompressorFields::RatedReturnGasTemperature); | |
| 62 | ✗ | if (value) { | |
| 63 | ✗ | refrigerationCompressor->setRatedReturnGasTemperature(value.get()); | |
| 64 | } | ||
| 65 | // RatedLiquidTemperature | ||
| 66 | ✗ | value = workspaceObject.getDouble(Refrigeration_CompressorFields::RatedLiquidTemperature); | |
| 67 | ✗ | if (value) { | |
| 68 | ✗ | refrigerationCompressor->setRatedLiquidTemperature(value.get()); | |
| 69 | } | ||
| 70 | // RatedSubcooling | ||
| 71 | ✗ | value = workspaceObject.getDouble(Refrigeration_CompressorFields::RatedSubcooling); | |
| 72 | ✗ | if (value) { | |
| 73 | ✗ | refrigerationCompressor->setRatedSubcooling(value.get()); | |
| 74 | } | ||
| 75 | // EndUseSubcategory | ||
| 76 | ✗ | s = workspaceObject.getString(Refrigeration_CompressorFields::EndUseSubcategory); | |
| 77 | ✗ | if (s) { | |
| 78 | ✗ | refrigerationCompressor->setEndUseSubcategory(s.get()); | |
| 79 | } | ||
| 80 | // ModeofOperation | ||
| 81 | // TranscriticalCompressorPowerCurveName | ||
| 82 | ✗ | if ((wo = workspaceObject.getTarget(Refrigeration_CompressorFields::TranscriticalCompressorPowerCurveName))) { | |
| 83 | ✗ | if (boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get())) { | |
| 84 | ✗ | if (boost::optional<CurveBicubic> curve = mo->optionalCast<CurveBicubic>()) { | |
| 85 | ✗ | refrigerationCompressor->setTranscriticalCompressorPowerCurve(curve.get()); | |
| 86 | ✗ | } | |
| 87 | ✗ | } | |
| 88 | } | ||
| 89 | // TranscriticalCompressorCapacityCurveName | ||
| 90 | ✗ | if ((wo = workspaceObject.getTarget(Refrigeration_CompressorFields::TranscriticalCompressorCapacityCurveName))) { | |
| 91 | ✗ | if (boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get())) { | |
| 92 | ✗ | if (boost::optional<CurveBicubic> curve = mo->optionalCast<CurveBicubic>()) { | |
| 93 | ✗ | refrigerationCompressor->setTranscriticalCompressorCapacityCurve(curve.get()); | |
| 94 | ✗ | } | |
| 95 | ✗ | } | |
| 96 | } | ||
| 97 | |||
| 98 | ✗ | return refrigerationCompressor.get(); | |
| 99 | ✗ | } else { | |
| 100 | ✗ | LOG(Error, "Unknown error translating " << workspaceObject.briefDescription()); | |
| 101 | |||
| 102 | ✗ | return boost::none; | |
| 103 | } | ||
| 104 | ✗ | } | |
| 105 | |||
| 106 | } // namespace energyplus | ||
| 107 | |||
| 108 | } // namespace openstudio | ||
| 109 |