src/energyplus/ForwardTranslator/ForwardTranslateAirTerminalSingleDuctConstantVolumeCooledBeam.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/AirTerminalSingleDuctConstantVolumeCooledBeam.hpp" | ||
| 9 | #include "../../model/AirTerminalSingleDuctConstantVolumeCooledBeam_Impl.hpp" | ||
| 10 | #include "../../model/CoilCoolingCooledBeam.hpp" | ||
| 11 | #include "../../model/CoilCoolingCooledBeam_Impl.hpp" | ||
| 12 | #include "../../model/HVACComponent.hpp" | ||
| 13 | #include "../../model/HVACComponent_Impl.hpp" | ||
| 14 | #include "../../model/StraightComponent.hpp" | ||
| 15 | #include "../../model/StraightComponent_Impl.hpp" | ||
| 16 | #include "../../model/AirLoopHVACZoneSplitter.hpp" | ||
| 17 | #include "../../model/AirLoopHVACZoneSplitter_Impl.hpp" | ||
| 18 | #include "../../model/AirLoopHVACZoneMixer.hpp" | ||
| 19 | #include "../../model/AirLoopHVACZoneMixer_Impl.hpp" | ||
| 20 | #include "../../model/Schedule.hpp" | ||
| 21 | #include "../../model/Schedule_Impl.hpp" | ||
| 22 | #include "../../model/Node.hpp" | ||
| 23 | #include "../../model/Node_Impl.hpp" | ||
| 24 | #include <utilities/idd/AirTerminal_SingleDuct_ConstantVolume_CooledBeam_FieldEnums.hxx> | ||
| 25 | #include <utilities/idd/ZoneHVAC_AirDistributionUnit_FieldEnums.hxx> | ||
| 26 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 27 | #include <utilities/idd/IddEnums.hxx> | ||
| 28 | #include <utilities/idd/IddFactory.hxx> | ||
| 29 | |||
| 30 | using namespace openstudio::model; | ||
| 31 | |||
| 32 | namespace openstudio { | ||
| 33 | |||
| 34 | namespace energyplus { | ||
| 35 | |||
| 36 | boost::optional<IdfObject> | ||
| 37 | ✗ | ForwardTranslator::translateAirTerminalSingleDuctConstantVolumeCooledBeam(AirTerminalSingleDuctConstantVolumeCooledBeam& modelObject) { | |
| 38 | |||
| 39 | //Name | ||
| 40 | ✗ | IdfObject idfObject(openstudio::IddObjectType::AirTerminal_SingleDuct_ConstantVolume_CooledBeam); | |
| 41 | ✗ | m_idfObjects.push_back(idfObject); | |
| 42 | |||
| 43 | ✗ | std::string baseName = modelObject.name().get(); | |
| 44 | ✗ | idfObject.setName(baseName); | |
| 45 | |||
| 46 | //register the air distribution unit in the map rather than the chilled beam air terminal itself. | ||
| 47 | //this is necessary because the air distribution unit encapsulating the chilled beam air terminal | ||
| 48 | //goes on both the brachlist and the zone HVAC equipment list | ||
| 49 | //since the branches are translated first, when the chilled beam's coil is encountered in the branchlist, the air distribution unit | ||
| 50 | //that encapsulates the chilled beam is returned and put onto the branch list. | ||
| 51 | //When the chilled beam air terminal is encountered again on the zone HVAC equipment list, | ||
| 52 | //the map must return the air distribution unit to ensure that the air distribution unit is on the translated | ||
| 53 | //equipment list. | ||
| 54 | |||
| 55 | ✗ | IdfObject _airDistributionUnit(IddObjectType::ZoneHVAC_AirDistributionUnit); | |
| 56 | ✗ | _airDistributionUnit.setName("ADU " + baseName); //ADU: Air Distribution Unit | |
| 57 | ✗ | m_idfObjects.push_back(_airDistributionUnit); | |
| 58 | |||
| 59 | ✗ | boost::optional<std::string> s; | |
| 60 | ✗ | boost::optional<double> value; | |
| 61 | ✗ | boost::optional<int> number; | |
| 62 | ✗ | boost::optional<ModelObject> temp; | |
| 63 | |||
| 64 | // Forward Translate Cooling Coil | ||
| 65 | //get the cooling coil as a HVAC component, cast it to optional cool coil, if cast is successful, | ||
| 66 | //get the object of class CoilCoolingCooledBeam | ||
| 67 | ✗ | HVACComponent coilCool = modelObject.coilCoolingCooledBeam(); | |
| 68 | ✗ | boost::optional<CoilCoolingCooledBeam> optionalCoilCoolingCooledBeam = coilCool.optionalCast<CoilCoolingCooledBeam>(); | |
| 69 | |||
| 70 | // Field A2 Availability Schedule Name | ||
| 71 | ✗ | if (boost::optional<Schedule> schedule = modelObject.availabilitySchedule()) { | |
| 72 | ✗ | if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule.get())) { | |
| 73 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::AvailabilityScheduleName, _schedule->name().get()); | |
| 74 | ✗ | } | |
| 75 | ✗ | } | |
| 76 | |||
| 77 | // Field A3 Cooled Beam Type | ||
| 78 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::CooledBeamType, modelObject.cooledBeamType()); | |
| 79 | |||
| 80 | // Field A4 Supply Air Inlet Node Name | ||
| 81 | ✗ | temp = modelObject.inletModelObject(); | |
| 82 | ✗ | if (temp) { | |
| 83 | ✗ | if ((s = temp->name())) { | |
| 84 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::SupplyAirInletNodeName, s.get()); | |
| 85 | } | ||
| 86 | } | ||
| 87 | |||
| 88 | // Field A5 Supply Air Outlet Node Name | ||
| 89 | ✗ | temp = modelObject.outletModelObject(); | |
| 90 | ✗ | if (temp) { | |
| 91 | ✗ | if ((s = temp->name())) { | |
| 92 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::SupplyAirOutletNodeName, s.get()); | |
| 93 | } | ||
| 94 | } | ||
| 95 | |||
| 96 | ✗ | if (optionalCoilCoolingCooledBeam) { | |
| 97 | |||
| 98 | ✗ | CoilCoolingCooledBeam coilCoolingCooledBeam = *optionalCoilCoolingCooledBeam; | |
| 99 | |||
| 100 | // Field A6 Chilled Water Inlet Node Name | ||
| 101 | ✗ | temp = coilCoolingCooledBeam.inletModelObject(); | |
| 102 | ✗ | if (temp) { | |
| 103 | ✗ | if ((s = temp->name())) { | |
| 104 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ChilledWaterInletNodeName, s.get()); | |
| 105 | } | ||
| 106 | } | ||
| 107 | |||
| 108 | // Field A7 Chilled Water Outlet Node Name | ||
| 109 | ✗ | temp = coilCoolingCooledBeam.outletModelObject(); | |
| 110 | ✗ | if (temp) { | |
| 111 | ✗ | if ((s = temp->name())) { | |
| 112 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ChilledWaterOutletNodeName, s.get()); | |
| 113 | } | ||
| 114 | } | ||
| 115 | |||
| 116 | // Field N1 Supply Air Volumetric Flow Rate | ||
| 117 | ✗ | if (modelObject.isSupplyAirVolumetricFlowRateDefaulted()) { | |
| 118 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::SupplyAirVolumetricFlowRate, "autosize"); | |
| 119 | ✗ | } else if ((value = modelObject.supplyAirVolumetricFlowRate())) { | |
| 120 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::SupplyAirVolumetricFlowRate, value.get()); | |
| 121 | } | ||
| 122 | |||
| 123 | // Field N2 Maximum Total Chilled Water Volumetric Flow Rate | ||
| 124 | ✗ | if (modelObject.isMaximumTotalChilledWaterVolumetricFlowRateDefaulted()) { | |
| 125 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::MaximumTotalChilledWaterVolumetricFlowRate, "autosize"); | |
| 126 | ✗ | } else if ((value = modelObject.maximumTotalChilledWaterVolumetricFlowRate())) { | |
| 127 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::MaximumTotalChilledWaterVolumetricFlowRate, value.get()); | |
| 128 | } | ||
| 129 | |||
| 130 | // Field N3 Number of Beams | ||
| 131 | ✗ | if (modelObject.isNumberofBeamsDefaulted()) { | |
| 132 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::NumberofBeams, "autosize"); | |
| 133 | ✗ | } else if ((number = modelObject.numberofBeams())) { | |
| 134 | ✗ | idfObject.setInt(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::NumberofBeams, number.get()); | |
| 135 | } | ||
| 136 | |||
| 137 | // Field N4 Beam Length | ||
| 138 | ✗ | if (modelObject.isBeamLengthDefaulted()) { | |
| 139 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::BeamLength, "autosize"); | |
| 140 | ✗ | } else if ((value = modelObject.beamLength())) { | |
| 141 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::BeamLength, value.get()); | |
| 142 | } | ||
| 143 | |||
| 144 | // Field N5 Design Inlet Water Temperature | ||
| 145 | ✗ | if (modelObject.isDesignInletWaterTemperatureDefaulted()) { | |
| 146 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::DesignInletWaterTemperature, 15.0); | |
| 147 | ✗ | } else if ((value = modelObject.designInletWaterTemperature())) { | |
| 148 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::DesignInletWaterTemperature, value.get()); | |
| 149 | } | ||
| 150 | |||
| 151 | // Field N6 Design Outlet Water Temperature | ||
| 152 | ✗ | if (modelObject.isDesignOutletWaterTemperatureDefaulted()) { | |
| 153 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::DesignOutletWaterTemperature, 17.0); | |
| 154 | ✗ | } else if ((value = modelObject.designOutletWaterTemperature())) { | |
| 155 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::DesignOutletWaterTemperature, value.get()); | |
| 156 | } | ||
| 157 | |||
| 158 | // Field N7 Coil Surface Area per Coil Length | ||
| 159 | ✗ | if (coilCoolingCooledBeam.isCoilSurfaceAreaperCoilLengthDefaulted()) { | |
| 160 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::CoilSurfaceAreaperCoilLength, 5.422); | |
| 161 | ✗ | } else if ((value = coilCoolingCooledBeam.coilSurfaceAreaperCoilLength())) { | |
| 162 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::CoilSurfaceAreaperCoilLength, value.get()); | |
| 163 | } | ||
| 164 | |||
| 165 | // Field N8 Model Parameter a | ||
| 166 | ✗ | if (coilCoolingCooledBeam.isModelParameteraDefaulted()) { | |
| 167 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ModelParametera, 15.3); | |
| 168 | ✗ | } else if ((value = coilCoolingCooledBeam.modelParametera())) { | |
| 169 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ModelParametera, value.get()); | |
| 170 | } | ||
| 171 | |||
| 172 | // Field N9 Model Parameter n1 | ||
| 173 | ✗ | if (coilCoolingCooledBeam.isModelParametern1Defaulted()) { | |
| 174 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ModelParametern1, 0); | |
| 175 | ✗ | } else if ((value = coilCoolingCooledBeam.modelParametern1())) { | |
| 176 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ModelParametern1, value.get()); | |
| 177 | } | ||
| 178 | |||
| 179 | // Field N10 Model Parameter n2 | ||
| 180 | ✗ | if (coilCoolingCooledBeam.isModelParametern2Defaulted()) { | |
| 181 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ModelParametern2, 0.84); | |
| 182 | ✗ | } else if ((value = coilCoolingCooledBeam.modelParametern2())) { | |
| 183 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ModelParametern2, value.get()); | |
| 184 | } | ||
| 185 | |||
| 186 | // Field N11 Model Parameter n3 | ||
| 187 | ✗ | if (coilCoolingCooledBeam.isModelParametern3Defaulted()) { | |
| 188 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ModelParametern3, 0.12); | |
| 189 | ✗ | } else if ((value = coilCoolingCooledBeam.modelParametern3())) { | |
| 190 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ModelParametern3, value.get()); | |
| 191 | } | ||
| 192 | |||
| 193 | // Field N12 Model Parameter a0 | ||
| 194 | ✗ | if (coilCoolingCooledBeam.isModelParametera0Defaulted()) { | |
| 195 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ModelParametera0, 0.171); | |
| 196 | ✗ | } else if ((value = coilCoolingCooledBeam.modelParametera0())) { | |
| 197 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ModelParametera0, value.get()); | |
| 198 | } | ||
| 199 | |||
| 200 | // Field N13 Model Parameter K1 | ||
| 201 | ✗ | if (coilCoolingCooledBeam.isModelParameterK1Defaulted()) { | |
| 202 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ModelParameterK1, 0.0057); | |
| 203 | ✗ | } else if ((value = coilCoolingCooledBeam.modelParameterK1())) { | |
| 204 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ModelParameterK1, value.get()); | |
| 205 | } | ||
| 206 | |||
| 207 | // Field N14 Model Parameter n | ||
| 208 | ✗ | if (coilCoolingCooledBeam.isModelParameternDefaulted()) { | |
| 209 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ModelParametern, 0.4); | |
| 210 | ✗ | } else if ((value = coilCoolingCooledBeam.modelParametern())) { | |
| 211 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::ModelParametern, value.get()); | |
| 212 | } | ||
| 213 | |||
| 214 | // Field N16 Leaving Pipe Inside Diameter | ||
| 215 | ✗ | if (coilCoolingCooledBeam.isLeavingPipeInsideDiameterDefaulted()) { | |
| 216 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::LeavingPipeInsideDiameter, 0.0145); | |
| 217 | ✗ | } else if ((value = coilCoolingCooledBeam.leavingPipeInsideDiameter())) { | |
| 218 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::LeavingPipeInsideDiameter, value.get()); | |
| 219 | } | ||
| 220 | ✗ | } else { | |
| 221 | ✗ | LOG(Error, modelObject.briefDescription() << ": Could not translate cooling coil"); | |
| 222 | ✗ | return boost::none; | |
| 223 | } | ||
| 224 | |||
| 225 | // Field N15 Coefficient of Induction Kin | ||
| 226 | ✗ | if (modelObject.isCoefficientofInductionKinDefaulted()) { | |
| 227 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::CoefficientofInductionKin, "autocalculate"); | |
| 228 | } | ||
| 229 | |||
| 230 | ✗ | if ((value = modelObject.coefficientofInductionKin())) { | |
| 231 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_CooledBeamFields::CoefficientofInductionKin, value.get()); | |
| 232 | } | ||
| 233 | |||
| 234 | // Populate fields for AirDistributionUnit | ||
| 235 | ✗ | if (boost::optional<ModelObject> outletNode = modelObject.outletModelObject()) { | |
| 236 | ✗ | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirDistributionUnitOutletNodeName, outletNode->name().get()); | |
| 237 | ✗ | } | |
| 238 | ✗ | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirTerminalObjectType, idfObject.iddObject().name()); | |
| 239 | ✗ | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirTerminalName, idfObject.name().get()); | |
| 240 | |||
| 241 | ✗ | return _airDistributionUnit; | |
| 242 | ✗ | } | |
| 243 | |||
| 244 | } // namespace energyplus | ||
| 245 | |||
| 246 | } // namespace openstudio | ||
| 247 |