src/energyplus/ForwardTranslator/ForwardTranslateChillerElectricASHRAE205.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 | |||
| 9 | #include "../../model/ChillerElectricASHRAE205.hpp" | ||
| 10 | |||
| 11 | #include "../../model/Schedule.hpp" | ||
| 12 | #include "../../model/ExternalFile.hpp" | ||
| 13 | #include "../../model/ThermalZone.hpp" | ||
| 14 | |||
| 15 | #include "../../model/Node.hpp" | ||
| 16 | #include "../../model/Node_Impl.hpp" | ||
| 17 | |||
| 18 | #include <utilities/idd/Chiller_Electric_ASHRAE205_FieldEnums.hxx> | ||
| 19 | // #include "../../utilities/idd/IddEnums.hpp" | ||
| 20 | #include <utilities/idd/IddEnums.hxx> | ||
| 21 | |||
| 22 | using namespace openstudio::model; | ||
| 23 | |||
| 24 | namespace openstudio { | ||
| 25 | |||
| 26 | namespace energyplus { | ||
| 27 | |||
| 28 | 4 | boost::optional<IdfObject> ForwardTranslator::translateChillerElectricASHRAE205(model::ChillerElectricASHRAE205& modelObject) { | |
| 29 | |||
| 30 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | path filePath = modelObject.representationFile().filePath(); |
| 31 |
2/3✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
|
4 | if (!openstudio::filesystem::exists(filePath)) { |
| 32 | ✗ | LOG(Warn, modelObject.briefDescription() << "will not be translated, cannot find the representation file '" << filePath << "'"); | |
| 33 | ✗ | return boost::none; | |
| 34 | } | ||
| 35 | |||
| 36 | // make the path correct for this system | ||
| 37 |
1/1✓ Branch 1 taken 4 times.
|
4 | filePath = openstudio::filesystem::system_complete(filePath); |
| 38 | |||
| 39 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 5 taken 3 times.
✓ Branch 6 taken 1 time.
|
4 | if (!modelObject.chilledWaterLoop()) { |
| 40 |
7/7✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 14 taken 3 times.
✓ Branch 17 taken 3 times.
✓ Branch 20 taken 3 times.
|
3 | LOG(Warn, modelObject.briefDescription() << "will not be translated, it not on a Chilled Water Loop."); |
| 41 | 3 | return boost::none; | |
| 42 | } | ||
| 43 | |||
| 44 | // Instantiate an IdfObject of the class to store the values | ||
| 45 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Chiller_Electric_ASHRAE205, modelObject); |
| 46 | |||
| 47 | // Representation File Name: Required String | ||
| 48 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::RepresentationFileName, openstudio::toString(filePath)); |
| 49 | |||
| 50 | // Performance Interpolation Method | ||
| 51 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::string performanceInterpolationMethod = modelObject.performanceInterpolationMethod(); |
| 52 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::PerformanceInterpolationMethod, performanceInterpolationMethod); |
| 53 | |||
| 54 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (modelObject.isRatedCapacityAutosized()) { |
| 55 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::RatedCapacity, "Autosize"); |
| 56 | } else { | ||
| 57 | ✗ | idfObject.setDouble(Chiller_Electric_ASHRAE205Fields::RatedCapacity, modelObject.ratedCapacity().get()); | |
| 58 | } | ||
| 59 | |||
| 60 | // Sizing Factor: Optional Double | ||
| 61 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(Chiller_Electric_ASHRAE205Fields::SizingFactor, modelObject.sizingFactor()); |
| 62 | |||
| 63 | // Ambient Temperature Indicator: Required String | ||
| 64 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::string ambientTemperatureIndicator = modelObject.ambientTemperatureIndicator(); |
| 65 | 1 | bool ambientTempOk = false; | |
| 66 | |||
| 67 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 time.
|
2 | if (openstudio::istringEqual("Schedule", ambientTemperatureIndicator)) { |
| 68 | // Ambient Temperature Schedule Name: Optional Object | ||
| 69 | ✗ | if (boost::optional<Schedule> _ambientTemperatureSchedule = modelObject.ambientTemperatureSchedule()) { | |
| 70 | ✗ | if (boost::optional<IdfObject> _owo = translateAndMapModelObject(_ambientTemperatureSchedule.get())) { | |
| 71 | ✗ | idfObject.setString(Chiller_Electric_ASHRAE205Fields::AmbientTemperatureScheduleName, _owo->nameString()); | |
| 72 | ✗ | ambientTempOk = true; | |
| 73 | ✗ | } | |
| 74 | ✗ | } | |
| 75 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
|
2 | } else if (openstudio::istringEqual("Zone", ambientTemperatureIndicator)) { |
| 76 | // Ambient Temperature Zone Name: Optional Object | ||
| 77 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<ThermalZone> _ambientTemperatureZone = modelObject.ambientTemperatureZone()) { |
| 78 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (boost::optional<IdfObject> _owo = translateAndMapModelObject(_ambientTemperatureZone.get())) { |
| 79 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::AmbientTemperatureZoneName, _owo->nameString()); |
| 80 | 1 | ambientTempOk = true; | |
| 81 | 1 | } | |
| 82 | 1 | } | |
| 83 | ✗ | } else if (openstudio::istringEqual("Outdoors", ambientTemperatureIndicator)) { | |
| 84 | ✗ | ambientTempOk = true; | |
| 85 | } | ||
| 86 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (!ambientTempOk) { |
| 87 | ✗ | LOG(Warn, "For " << modelObject.briefDescription() << " the Ambient Temperature Indicator is " << ambientTemperatureIndicator | |
| 88 | << " but the required objects don't match. Falling back to 'Outdoors'"); | ||
| 89 | ✗ | ambientTemperatureIndicator = "Outdoors"; | |
| 90 | } | ||
| 91 | |||
| 92 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::AmbientTemperatureIndicator, ambientTemperatureIndicator); |
| 93 | |||
| 94 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 time.
|
2 | if (openstudio::istringEqual("Outdoors", ambientTemperatureIndicator)) { |
| 95 | ✗ | std::string oaNodeName = modelObject.nameString() + " OA Node"; | |
| 96 | ✗ | if (boost::optional<std::string> s_ = modelObject.ambientTemperatureOutdoorAirNodeName()) { | |
| 97 | ✗ | oaNodeName = s_.get(); | |
| 98 | ✗ | } | |
| 99 | |||
| 100 | ✗ | idfObject.setString(Chiller_Electric_ASHRAE205Fields::AmbientTemperatureOutdoorAirNodeName, oaNodeName); | |
| 101 | |||
| 102 | ✗ | IdfObject _oaNodeList(openstudio::IddObjectType::OutdoorAir_NodeList); | |
| 103 | ✗ | _oaNodeList.setString(0, oaNodeName); | |
| 104 | ✗ | m_idfObjects.push_back(_oaNodeList); | |
| 105 | ✗ | } | |
| 106 | |||
| 107 | // Chilled Water Node Names: Required Nodes | ||
| 108 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto node_ = modelObject.chilledWaterInletNode()) { |
| 109 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::ChilledWaterInletNodeName, node_->nameString()); |
| 110 | 1 | } | |
| 111 | |||
| 112 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto node_ = modelObject.chilledWaterOutletNode()) { |
| 113 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::ChilledWaterOutletNodeName, node_->nameString()); |
| 114 | 1 | } | |
| 115 | |||
| 116 | // Optional Nodes | ||
| 117 | |||
| 118 | // Condenser | ||
| 119 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto node_ = modelObject.condenserInletNode()) { |
| 120 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::CondenserInletNodeName, node_->nameString()); |
| 121 | 1 | } | |
| 122 | |||
| 123 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto node_ = modelObject.condenserOutletNode()) { |
| 124 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::CondenserOutletNodeName, node_->nameString()); |
| 125 | 1 | } | |
| 126 | |||
| 127 | // Heat Recovery | ||
| 128 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
2 | if (auto node_ = modelObject.heatRecoveryInletNode()) { |
| 129 | ✗ | idfObject.setString(Chiller_Electric_ASHRAE205Fields::HeatRecoveryInletNodeName, node_->nameString()); | |
| 130 | 1 | } | |
| 131 | |||
| 132 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
2 | if (auto node_ = modelObject.heatRecoveryOutletNode()) { |
| 133 | ✗ | idfObject.setString(Chiller_Electric_ASHRAE205Fields::HeatRecoveryOutletNodeName, node_->nameString()); | |
| 134 | 1 | } | |
| 135 | |||
| 136 | // Oil Cooler | ||
| 137 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto node_ = modelObject.oilCoolerInletNode()) { |
| 138 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::OilCoolerInletNodeName, node_->nameString()); |
| 139 | 1 | } | |
| 140 | |||
| 141 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto node_ = modelObject.oilCoolerOutletNode()) { |
| 142 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::OilCoolerOutletNodeName, node_->nameString()); |
| 143 | 1 | } | |
| 144 | |||
| 145 | // Auxiliary | ||
| 146 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto node_ = modelObject.auxiliaryInletNode()) { |
| 147 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::AuxiliaryInletNodeName, node_->nameString()); |
| 148 | 1 | } | |
| 149 | |||
| 150 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto node_ = modelObject.auxiliaryOutletNode()) { |
| 151 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::AuxiliaryOutletNodeName, node_->nameString()); |
| 152 | 1 | } | |
| 153 | |||
| 154 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
1 | if (modelObject.isChilledWaterMaximumRequestedFlowRateAutosized()) { |
| 155 | ✗ | idfObject.setString(Chiller_Electric_ASHRAE205Fields::ChilledWaterMaximumRequestedFlowRate, "Autosize"); | |
| 156 | } else { | ||
| 157 | // ChilledWater Maximum Requested Flow Rate: boost::optional<double> | ||
| 158 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<double> _chilledWaterMaximumRequestedFlowRate = modelObject.chilledWaterMaximumRequestedFlowRate()) { |
| 159 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(Chiller_Electric_ASHRAE205Fields::ChilledWaterMaximumRequestedFlowRate, _chilledWaterMaximumRequestedFlowRate.get()); |
| 160 | } | ||
| 161 | } | ||
| 162 | |||
| 163 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
1 | if (modelObject.isCondenserMaximumRequestedFlowRateAutosized()) { |
| 164 | ✗ | idfObject.setString(Chiller_Electric_ASHRAE205Fields::CondenserMaximumRequestedFlowRate, "Autosize"); | |
| 165 | } else { | ||
| 166 | // Condenser Maximum Requested Flow Rate: boost::optional<double> | ||
| 167 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<double> _condenserMaximumRequestedFlowRate = modelObject.condenserMaximumRequestedFlowRate()) { |
| 168 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(Chiller_Electric_ASHRAE205Fields::CondenserMaximumRequestedFlowRate, _condenserMaximumRequestedFlowRate.get()); |
| 169 | } | ||
| 170 | } | ||
| 171 | |||
| 172 | // Chiller Flow Mode: Optional String | ||
| 173 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::ChillerFlowMode, modelObject.chillerFlowMode()); |
| 174 | |||
| 175 | // Oil Cooler Design Flow Rate: boost::optional<double> | ||
| 176 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<double> _oilCoolerDesignFlowRate = modelObject.oilCoolerDesignFlowRate()) { |
| 177 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(Chiller_Electric_ASHRAE205Fields::OilCoolerDesignFlowRate, _oilCoolerDesignFlowRate.get()); |
| 178 | } | ||
| 179 | |||
| 180 | // Auxiliary Cooling Design Flow Rate: boost::optional<double> | ||
| 181 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<double> _auxiliaryCoolingDesignFlowRate = modelObject.auxiliaryCoolingDesignFlowRate()) { |
| 182 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(Chiller_Electric_ASHRAE205Fields::AuxiliaryCoolingDesignFlowRate, _auxiliaryCoolingDesignFlowRate.get()); |
| 183 | } | ||
| 184 | |||
| 185 | // End-Use Subcategory: Optional String | ||
| 186 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (!modelObject.isEndUseSubcategoryDefaulted()) { |
| 187 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(Chiller_Electric_ASHRAE205Fields::EndUseSubcategory, modelObject.endUseSubcategory()); |
| 188 | } | ||
| 189 | |||
| 190 |
1/1✓ Branch 1 taken 1 time.
|
1 | return idfObject; |
| 191 | 4 | } // End of translate function | |
| 192 | |||
| 193 | } // end namespace energyplus | ||
| 194 | } // end namespace openstudio | ||
| 195 |