src/energyplus/ForwardTranslator/ForwardTranslateAirTerminalSingleDuctConstantVolumeFourPipeInduction.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/AirTerminalSingleDuctConstantVolumeFourPipeInduction.hpp" | ||
| 8 | #include "../../model/AirTerminalSingleDuctConstantVolumeFourPipeInduction_Impl.hpp" | ||
| 9 | #include "../../model/Schedule.hpp" | ||
| 10 | #include "../../model/Schedule_Impl.hpp" | ||
| 11 | #include "../../model/Node.hpp" | ||
| 12 | #include "../../model/Node_Impl.hpp" | ||
| 13 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 14 | #include <utilities/idd/AirTerminal_SingleDuct_ConstantVolume_FourPipeInduction_FieldEnums.hxx> | ||
| 15 | #include <utilities/idd/AirLoopHVAC_ZoneMixer_FieldEnums.hxx> | ||
| 16 | #include <utilities/idd/Coil_Cooling_Water_FieldEnums.hxx> | ||
| 17 | #include <utilities/idd/Coil_Heating_Water_FieldEnums.hxx> | ||
| 18 | #include <utilities/idd/ZoneHVAC_AirDistributionUnit_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 | ✗ | boost::optional<IdfObject> ForwardTranslator::translateAirTerminalSingleDuctConstantVolumeFourPipeInduction( | |
| 29 | AirTerminalSingleDuctConstantVolumeFourPipeInduction& modelObject) { | ||
| 30 | ✗ | OptionalString s; | |
| 31 | ✗ | OptionalDouble d; | |
| 32 | ✗ | OptionalModelObject temp; | |
| 33 | |||
| 34 | ✗ | IdfObject _airDistributionUnit(openstudio::IddObjectType::ZoneHVAC_AirDistributionUnit); | |
| 35 | ✗ | _airDistributionUnit.setName(modelObject.name().get() + " Air Distribution Unit"); | |
| 36 | ✗ | m_idfObjects.push_back(_airDistributionUnit); | |
| 37 | |||
| 38 | // Name | ||
| 39 | IdfObject idfObject = | ||
| 40 | ✗ | createRegisterAndNameIdfObject(openstudio::IddObjectType::AirTerminal_SingleDuct_ConstantVolume_FourPipeInduction, modelObject); | |
| 41 | |||
| 42 | // Availability Schedule Name | ||
| 43 | ✗ | if ((temp = modelObject.availabilitySchedule())) { | |
| 44 | ✗ | if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(temp.get())) { | |
| 45 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::AvailabilityScheduleName, _schedule->name().get()); | |
| 46 | ✗ | } | |
| 47 | } | ||
| 48 | |||
| 49 | // Maximum Total Air Flow Rate | ||
| 50 | ✗ | if ((d = modelObject.maximumTotalAirFlowRate())) { | |
| 51 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::MaximumTotalAirFlowRate, d.get()); | |
| 52 | ✗ | } else if (modelObject.isMaximumTotalAirFlowRateAutosized()) { | |
| 53 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::MaximumTotalAirFlowRate, "Autosize"); | |
| 54 | } | ||
| 55 | |||
| 56 | // Induction Ratio | ||
| 57 | ✗ | if ((d = modelObject.inductionRatio())) { | |
| 58 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::InductionRatio, d.get()); | |
| 59 | } | ||
| 60 | |||
| 61 | // Supply Air Inlet Node Name | ||
| 62 | ✗ | if (auto node = modelObject.inletModelObject()) { | |
| 63 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::SupplyAirInletNodeName, node->name().get()); | |
| 64 | ✗ | } | |
| 65 | |||
| 66 | // Induced Air Inlet Node Name | ||
| 67 | ✗ | if (auto node = modelObject.inducedAirInletNode()) { | |
| 68 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::InducedAirInletNodeName, node->name().get()); | |
| 69 | ✗ | } | |
| 70 | |||
| 71 | // Air Outlet Node Name | ||
| 72 | ✗ | if (auto node = modelObject.outletModelObject()) { | |
| 73 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::AirOutletNodeName, node->name().get()); | |
| 74 | ✗ | } | |
| 75 | |||
| 76 | // Hot Water Inlet Node Name | ||
| 77 | // deprecated | ||
| 78 | |||
| 79 | // Cold Water Inlet Node Name | ||
| 80 | //deprecated | ||
| 81 | |||
| 82 | // Heating Coil Object Type | ||
| 83 | // Heating Coil Name | ||
| 84 | ✗ | boost::optional<IdfObject> _heatingCoil; | |
| 85 | { | ||
| 86 | ✗ | auto heatingCoil = modelObject.heatingCoil(); | |
| 87 | ✗ | if ((_heatingCoil = translateAndMapModelObject(heatingCoil))) { | |
| 88 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::HeatingCoilObjectType, _heatingCoil->iddObject().name()); | |
| 89 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::HeatingCoilName, _heatingCoil->name().get()); | |
| 90 | } | ||
| 91 | ✗ | } | |
| 92 | |||
| 93 | // Maximum Hot Water Flow Rate | ||
| 94 | ✗ | if ((d = modelObject.maximumHotWaterFlowRate())) { | |
| 95 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::MaximumHotWaterFlowRate, d.get()); | |
| 96 | ✗ | } else if (modelObject.isMaximumHotWaterFlowRateAutosized()) { | |
| 97 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::MaximumHotWaterFlowRate, "Autosize"); | |
| 98 | } | ||
| 99 | |||
| 100 | // Minimum Hot Water Flow Rate | ||
| 101 | ✗ | if ((d = modelObject.minimumHotWaterFlowRate())) { | |
| 102 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::MinimumHotWaterFlowRate, d.get()); | |
| 103 | } | ||
| 104 | |||
| 105 | // Heating Convergence Tolerance | ||
| 106 | ✗ | if ((d = modelObject.heatingConvergenceTolerance())) { | |
| 107 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::HeatingConvergenceTolerance, d.get()); | |
| 108 | } | ||
| 109 | |||
| 110 | // Cooling Coil Object Type | ||
| 111 | // Cooling Coil Name | ||
| 112 | ✗ | boost::optional<IdfObject> _coolingCoil; | |
| 113 | ✗ | if (auto coolingCoil = modelObject.coolingCoil()) { | |
| 114 | ✗ | if ((_coolingCoil = translateAndMapModelObject(coolingCoil.get()))) { | |
| 115 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::CoolingCoilObjectType, _coolingCoil->iddObject().name()); | |
| 116 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::CoolingCoilName, _coolingCoil->name().get()); | |
| 117 | } | ||
| 118 | ✗ | } | |
| 119 | |||
| 120 | // Maximum Cold Water Flow Rate | ||
| 121 | ✗ | if ((d = modelObject.maximumColdWaterFlowRate())) { | |
| 122 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::MaximumColdWaterFlowRate, d.get()); | |
| 123 | ✗ | } else if (modelObject.isMaximumColdWaterFlowRateAutosized()) { | |
| 124 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::MaximumColdWaterFlowRate, "Autosize"); | |
| 125 | } | ||
| 126 | |||
| 127 | // Minimum Cold Water Flow Rate | ||
| 128 | ✗ | if ((d = modelObject.minimumColdWaterFlowRate())) { | |
| 129 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::MinimumColdWaterFlowRate, d.get()); | |
| 130 | } | ||
| 131 | |||
| 132 | // Cooling Convergence Tolerance | ||
| 133 | ✗ | if ((d = modelObject.coolingConvergenceTolerance())) { | |
| 134 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::CoolingConvergenceTolerance, d.get()); | |
| 135 | } | ||
| 136 | |||
| 137 | // Zone Mixer Name | ||
| 138 | ✗ | IdfObject _mixer(IddObjectType::AirLoopHVAC_ZoneMixer); | |
| 139 | ✗ | _mixer.setName(modelObject.name().get() + " Mixer"); | |
| 140 | ✗ | m_idfObjects.push_back(_mixer); | |
| 141 | ✗ | _mixer.clearExtensibleGroups(); | |
| 142 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_FourPipeInductionFields::ZoneMixerName, _mixer.name().get()); | |
| 143 | |||
| 144 | ✗ | std::string baseName = modelObject.name().get(); | |
| 145 | |||
| 146 | ✗ | std::string heatingCoilInlet; | |
| 147 | ✗ | std::string heatingCoilOutlet; | |
| 148 | ✗ | std::string coolingCoilInlet; | |
| 149 | ✗ | std::string coolingCoilOutlet; | |
| 150 | ✗ | std::string mixerAirSystemInlet; | |
| 151 | ✗ | std::string mixerInducedInlet; | |
| 152 | ✗ | std::string mixerOutlet; | |
| 153 | |||
| 154 | ✗ | if (auto inducedAirInletNode = modelObject.inducedAirInletNode()) { | |
| 155 | ✗ | heatingCoilInlet = inducedAirInletNode->name().get(); | |
| 156 | ✗ | } | |
| 157 | ✗ | heatingCoilOutlet = baseName + " Heating Coil Outlet"; | |
| 158 | |||
| 159 | ✗ | if (_coolingCoil) { | |
| 160 | ✗ | coolingCoilInlet = heatingCoilOutlet; | |
| 161 | ✗ | coolingCoilOutlet = baseName + " Cooling Coil Outlet"; | |
| 162 | |||
| 163 | ✗ | mixerInducedInlet = coolingCoilOutlet; | |
| 164 | } else { | ||
| 165 | ✗ | mixerInducedInlet = heatingCoilOutlet; | |
| 166 | } | ||
| 167 | |||
| 168 | ✗ | if (auto node = modelObject.inletModelObject()) { | |
| 169 | ✗ | mixerAirSystemInlet = node->name().get(); | |
| 170 | ✗ | } | |
| 171 | ✗ | if (auto node = modelObject.outletModelObject()) { | |
| 172 | ✗ | mixerOutlet = node->name().get(); | |
| 173 | ✗ | } | |
| 174 | |||
| 175 | ✗ | if (_heatingCoil && (_heatingCoil->iddObject().type() == IddObjectType::Coil_Heating_Water)) { | |
| 176 | ✗ | _heatingCoil->setString(Coil_Heating_WaterFields::AirInletNodeName, heatingCoilInlet); | |
| 177 | ✗ | _heatingCoil->setString(Coil_Heating_WaterFields::AirOutletNodeName, heatingCoilOutlet); | |
| 178 | } | ||
| 179 | |||
| 180 | ✗ | if (_coolingCoil && (_coolingCoil->iddObject().type() == IddObjectType::Coil_Cooling_Water)) { | |
| 181 | ✗ | _coolingCoil->setString(Coil_Cooling_WaterFields::AirInletNodeName, coolingCoilInlet); | |
| 182 | ✗ | _coolingCoil->setString(Coil_Cooling_WaterFields::AirOutletNodeName, coolingCoilOutlet); | |
| 183 | } | ||
| 184 | |||
| 185 | ✗ | _mixer.setString(AirLoopHVAC_ZoneMixerFields::OutletNodeName, mixerOutlet); | |
| 186 | ✗ | IdfExtensibleGroup eg = _mixer.pushExtensibleGroup(); | |
| 187 | ✗ | eg.setString(AirLoopHVAC_ZoneMixerExtensibleFields::InletNodeName, mixerAirSystemInlet); | |
| 188 | ✗ | eg = _mixer.pushExtensibleGroup(); | |
| 189 | ✗ | eg.setString(AirLoopHVAC_ZoneMixerExtensibleFields::InletNodeName, mixerInducedInlet); | |
| 190 | |||
| 191 | ✗ | if (auto node = modelObject.outletModelObject()) { | |
| 192 | ✗ | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirDistributionUnitOutletNodeName, node->name().get()); | |
| 193 | ✗ | } | |
| 194 | ✗ | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirTerminalObjectType, idfObject.iddObject().name()); | |
| 195 | ✗ | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirTerminalName, idfObject.name().get()); | |
| 196 | |||
| 197 | ✗ | return _airDistributionUnit; | |
| 198 | ✗ | } | |
| 199 | |||
| 200 | } // namespace energyplus | ||
| 201 | |||
| 202 | } // namespace openstudio | ||
| 203 |