src/energyplus/ForwardTranslator/ForwardTranslateEvaporativeCoolerIndirectResearchSpecial.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/EvaporativeCoolerIndirectResearchSpecial.hpp" | ||
| 9 | #include "../../model/EvaporativeCoolerIndirectResearchSpecial_Impl.hpp" | ||
| 10 | #include "../../model/Node.hpp" | ||
| 11 | #include "../../model/Node_Impl.hpp" | ||
| 12 | #include "../../model/Curve.hpp" | ||
| 13 | #include "../../model/Curve_Impl.hpp" | ||
| 14 | #include "../../model/Schedule.hpp" | ||
| 15 | #include "../../utilities/idf/Workspace.hpp" | ||
| 16 | #include "../../utilities/core/Logger.hpp" | ||
| 17 | #include <utilities/idd/EvaporativeCooler_Indirect_ResearchSpecial_FieldEnums.hxx> | ||
| 18 | #include <utilities/idd/IddEnums.hxx> | ||
| 19 | |||
| 20 | using namespace openstudio::model; | ||
| 21 | |||
| 22 | namespace openstudio { | ||
| 23 | |||
| 24 | namespace energyplus { | ||
| 25 | |||
| 26 | boost::optional<IdfObject> | ||
| 27 | 3 | ForwardTranslator::translateEvaporativeCoolerIndirectResearchSpecial(EvaporativeCoolerIndirectResearchSpecial& modelObject) { | |
| 28 | 3 | OptionalString s; | |
| 29 | 3 | OptionalDouble d; | |
| 30 | 3 | OptionalModelObject temp; | |
| 31 | |||
| 32 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | IdfObject idfObject(IddObjectType::EvaporativeCooler_Indirect_ResearchSpecial); |
| 33 | |||
| 34 |
1/1✓ Branch 1 taken 3 times.
|
3 | m_idfObjects.push_back(idfObject); |
| 35 | |||
| 36 | // Name | ||
| 37 |
1/1✓ Branch 1 taken 3 times.
|
3 | s = modelObject.name(); |
| 38 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (s) { |
| 39 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | idfObject.setName(*s); |
| 40 | } | ||
| 41 | |||
| 42 | // AvailabilityScheduleName | ||
| 43 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<Schedule> sched = modelObject.availabilitySchedule(); |
| 44 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (sched) { |
| 45 | ✗ | boost::optional<IdfObject> _sched = translateAndMapModelObject(sched.get()); | |
| 46 | ✗ | OS_ASSERT(_sched); | |
| 47 | ✗ | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::AvailabilityScheduleName, _sched->name().get()); | |
| 48 | ✗ | } | |
| 49 | |||
| 50 | // CoolerMaximumEffectiveness | ||
| 51 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.coolerMaximumEffectiveness(); |
| 52 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 53 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | idfObject.setDouble(EvaporativeCooler_Indirect_ResearchSpecialFields::CoolerWetbulbDesignEffectiveness, d.get()); |
| 54 | } | ||
| 55 | |||
| 56 | // RecirculatingWaterPumpPowerConsumption | ||
| 57 |
1/1✓ Branch 1 taken 3 times.
|
3 | d = modelObject.recirculatingWaterPumpPowerConsumption(); |
| 58 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
3 | if (modelObject.isRecirculatingWaterPumpPowerConsumptionAutosized()) { |
| 59 | ✗ | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::RecirculatingWaterPumpDesignPower, "Autosize"); | |
| 60 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | } else if (d) { |
| 61 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | idfObject.setDouble(EvaporativeCooler_Indirect_ResearchSpecialFields::RecirculatingWaterPumpDesignPower, d.get()); |
| 62 | } | ||
| 63 | |||
| 64 | // SecondaryFanFlowRate | ||
| 65 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
3 | if (modelObject.isSecondaryFanFlowRateAutosized()) { |
| 66 | ✗ | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::SecondaryAirDesignFlowRate, "Autosize"); | |
| 67 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
6 | } else if ((d = modelObject.secondaryFanFlowRate())) { |
| 68 | ✗ | idfObject.setDouble(EvaporativeCooler_Indirect_ResearchSpecialFields::SecondaryAirDesignFlowRate, d.get()); | |
| 69 | } | ||
| 70 | |||
| 71 | // SecondaryFanTotalEfficiency | ||
| 72 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto fanEff = modelObject.secondaryFanTotalEfficiency(); |
| 73 | |||
| 74 | // SecondaryFanDeltaPressure | ||
| 75 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto fanDp = modelObject.secondaryFanDeltaPressure(); |
| 76 | |||
| 77 | // SecondaryAirFanSizingSpecificPower | ||
| 78 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (fanEff > 0.0) { |
| 79 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setDouble(EvaporativeCooler_Indirect_ResearchSpecialFields::SecondaryAirFanSizingSpecificPower, fanDp / fanEff); |
| 80 | } | ||
| 81 | |||
| 82 | // PrimaryAirInletNodeName | ||
| 83 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
6 | if (boost::optional<model::ModelObject> mo = modelObject.inletModelObject()) { |
| 84 | ✗ | OS_ASSERT(mo->optionalCast<model::Node>()); | |
| 85 | ✗ | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::PrimaryAirInletNodeName, mo->name().get()); | |
| 86 | 3 | } | |
| 87 | |||
| 88 | // PrimaryAirOutletNodeName | ||
| 89 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
6 | if (boost::optional<model::ModelObject> mo = modelObject.outletModelObject()) { |
| 90 | ✗ | OS_ASSERT(mo->optionalCast<model::Node>()); | |
| 91 | ✗ | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::PrimaryAirOutletNodeName, mo->name().get()); | |
| 92 | ✗ | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::SensorNodeName, mo->name().get()); | |
| 93 | 3 | } | |
| 94 | |||
| 95 | // DewpointEffectivenessFactor | ||
| 96 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.dewpointEffectivenessFactor(); |
| 97 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 98 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | idfObject.setDouble(EvaporativeCooler_Indirect_ResearchSpecialFields::DewpointEffectivenessFactor, d.get()); |
| 99 | } | ||
| 100 | |||
| 101 | // DriftLossFraction | ||
| 102 |
1/1✓ Branch 1 taken 3 times.
|
3 | d = modelObject.driftLossFraction(); |
| 103 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 104 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | idfObject.setDouble(EvaporativeCooler_Indirect_ResearchSpecialFields::DriftLossFraction, d.get()); |
| 105 | } | ||
| 106 | |||
| 107 | // BlowdownConcentrationRatio | ||
| 108 |
1/1✓ Branch 1 taken 3 times.
|
3 | d = modelObject.blowdownConcentrationRatio(); |
| 109 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (d) { |
| 110 | ✗ | idfObject.setDouble(EvaporativeCooler_Indirect_ResearchSpecialFields::BlowdownConcentrationRatio, d.get()); | |
| 111 | } | ||
| 112 | |||
| 113 | // ReliefAirInletNodeName | ||
| 114 | 3 | if (boost::optional<model::Node> node = | |
| 115 |
2/3✓ Branch 3 taken 3 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 3 times.
|
6 | modelObject.getImpl<model::detail::EvaporativeCoolerIndirectResearchSpecial_Impl>()->reliefAirInletNode()) { |
| 116 | ✗ | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::ReliefAirInletNodeName, node->name().get()); | |
| 117 | 3 | } | |
| 118 | |||
| 119 | // Secondary Air Inlet Node Name | ||
| 120 | { | ||
| 121 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | IdfObject inletNode(openstudio::IddObjectType::OutdoorAir_NodeList); |
| 122 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | auto inletNodeName = modelObject.name().get() + " Secondary Air Inlet"; |
| 123 |
1/1✓ Branch 1 taken 3 times.
|
3 | inletNode.setString(0, inletNodeName); |
| 124 |
1/1✓ Branch 1 taken 3 times.
|
3 | m_idfObjects.push_back(inletNode); |
| 125 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::SecondaryAirInletNodeName, inletNodeName); |
| 126 | 3 | } | |
| 127 | |||
| 128 | // Secondary Air Outlet Node Name | ||
| 129 | { | ||
| 130 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | auto outletNodeName = modelObject.name().get() + " Secondary Air Outlet"; |
| 131 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::SecondaryAirOutletNodeName, outletNodeName); |
| 132 | 3 | } | |
| 133 | |||
| 134 | // WetbulbEffectivenessFlowRatioModifierCurveName | ||
| 135 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
6 | if (auto curve = modelObject.wetbulbEffectivenessFlowRatioModifierCurve()) { |
| 136 | ✗ | auto _curve = translateAndMapModelObject(curve.get()); | |
| 137 | ✗ | OS_ASSERT(_curve); | |
| 138 | ✗ | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::WetbulbEffectivenessFlowRatioModifierCurveName, _curve->name().get()); | |
| 139 | 3 | } | |
| 140 | |||
| 141 | // CoolerDrybulbDesignEffectiveness | ||
| 142 |
1/1✓ Branch 1 taken 3 times.
|
3 | d = modelObject.coolerDrybulbDesignEffectiveness(); |
| 143 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (d) { |
| 144 | ✗ | idfObject.setDouble(EvaporativeCooler_Indirect_ResearchSpecialFields::CoolerDrybulbDesignEffectiveness, d.get()); | |
| 145 | } | ||
| 146 | |||
| 147 | // DrybulbEffectivenessFlowRatioModifierCurveName | ||
| 148 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
6 | if (auto curve = modelObject.drybulbEffectivenessFlowRatioModifierCurve()) { |
| 149 | ✗ | auto _curve = translateAndMapModelObject(curve.get()); | |
| 150 | ✗ | OS_ASSERT(_curve); | |
| 151 | ✗ | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::DrybulbEffectivenessFlowRatioModifierCurveName, _curve->name().get()); | |
| 152 | 3 | } | |
| 153 | |||
| 154 | // WaterPumpPowerSizingFactor | ||
| 155 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.waterPumpPowerSizingFactor(); |
| 156 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 157 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | idfObject.setDouble(EvaporativeCooler_Indirect_ResearchSpecialFields::WaterPumpPowerSizingFactor, d.get()); |
| 158 | } | ||
| 159 | |||
| 160 | // WaterPumpPowerModifierCurveName | ||
| 161 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
6 | if (auto curve = modelObject.waterPumpPowerModifierCurve()) { |
| 162 | ✗ | auto _curve = translateAndMapModelObject(curve.get()); | |
| 163 | ✗ | OS_ASSERT(_curve); | |
| 164 | ✗ | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::WaterPumpPowerModifierCurveName, _curve->name().get()); | |
| 165 | 3 | } | |
| 166 | |||
| 167 | // SecondaryAirFlowScalingFactor | ||
| 168 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.secondaryAirFlowScalingFactor(); |
| 169 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 170 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | idfObject.setDouble(EvaporativeCooler_Indirect_ResearchSpecialFields::SecondaryAirFlowScalingFactor, d.get()); |
| 171 | } | ||
| 172 | |||
| 173 | // SecondaryAirFanDesignPower | ||
| 174 |
1/1✓ Branch 1 taken 3 times.
|
3 | d = modelObject.secondaryAirFanDesignPower(); |
| 175 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
3 | if (modelObject.isSecondaryAirFanDesignPowerAutosized()) { |
| 176 | ✗ | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::SecondaryAirFanDesignPower, "Autosize"); | |
| 177 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | } else if (d) { |
| 178 | ✗ | idfObject.setDouble(EvaporativeCooler_Indirect_ResearchSpecialFields::SecondaryAirFanDesignPower, d.get()); | |
| 179 | } | ||
| 180 | |||
| 181 | // SecondaryAirFanPowerModifierCurveName | ||
| 182 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
6 | if (auto curve = modelObject.secondaryAirFanPowerModifierCurve()) { |
| 183 | ✗ | auto _curve = translateAndMapModelObject(curve.get()); | |
| 184 | ✗ | OS_ASSERT(_curve); | |
| 185 | ✗ | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::SecondaryAirFanPowerModifierCurveName, _curve->name().get()); | |
| 186 | 3 | } | |
| 187 | |||
| 188 | // PrimaryDesignAirFlowRate | ||
| 189 |
1/1✓ Branch 1 taken 3 times.
|
3 | d = modelObject.primaryDesignAirFlowRate(); |
| 190 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
3 | if (modelObject.isPrimaryDesignAirFlowRateAutosized()) { |
| 191 | ✗ | idfObject.setString(EvaporativeCooler_Indirect_ResearchSpecialFields::PrimaryAirDesignFlowRate, "Autosize"); | |
| 192 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | } else if (d) { |
| 193 | ✗ | idfObject.setDouble(EvaporativeCooler_Indirect_ResearchSpecialFields::PrimaryAirDesignFlowRate, d.get()); | |
| 194 | } | ||
| 195 | |||
| 196 |
1/1✓ Branch 1 taken 3 times.
|
6 | return boost::optional<IdfObject>(idfObject); |
| 197 | 3 | } | |
| 198 | |||
| 199 | } // namespace energyplus | ||
| 200 | |||
| 201 | } // namespace openstudio | ||
| 202 |