src/energyplus/ForwardTranslator/ForwardTranslateAirTerminalSingleDuctConstantVolumeReheat.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/AirTerminalSingleDuctConstantVolumeReheat.hpp" | ||
| 9 | #include "../../model/AirTerminalSingleDuctConstantVolumeReheat_Impl.hpp" | ||
| 10 | #include "../../model/HVACComponent.hpp" | ||
| 11 | #include "../../model/Schedule.hpp" | ||
| 12 | #include "../../model/Schedule_Impl.hpp" | ||
| 13 | #include "../../model/Node.hpp" | ||
| 14 | #include "../../model/Node_Impl.hpp" | ||
| 15 | #include <utilities/idd/AirTerminal_SingleDuct_ConstantVolume_Reheat_FieldEnums.hxx> | ||
| 16 | #include <utilities/idd/ZoneHVAC_AirDistributionUnit_FieldEnums.hxx> | ||
| 17 | #include <utilities/idd/Coil_Heating_Fuel_FieldEnums.hxx> | ||
| 18 | #include <utilities/idd/Coil_Heating_Electric_FieldEnums.hxx> | ||
| 19 | #include <utilities/idd/Coil_Heating_Water_FieldEnums.hxx> | ||
| 20 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 21 | #include <utilities/idd/IddEnums.hxx> | ||
| 22 | #include <utilities/idd/IddFactory.hxx> | ||
| 23 | |||
| 24 | using namespace openstudio::model; | ||
| 25 | |||
| 26 | namespace openstudio { | ||
| 27 | |||
| 28 | namespace energyplus { | ||
| 29 | |||
| 30 | boost::optional<IdfObject> | ||
| 31 | ✗ | ForwardTranslator::translateAirTerminalSingleDuctConstantVolumeReheat(AirTerminalSingleDuctConstantVolumeReheat& modelObject) { | |
| 32 | ✗ | OptionalModelObject temp; | |
| 33 | ✗ | OptionalString optS; | |
| 34 | ✗ | boost::optional<std::string> s; | |
| 35 | |||
| 36 | ✗ | std::string baseName = modelObject.name().get(); | |
| 37 | |||
| 38 | ✗ | IdfObject _airDistributionUnit(openstudio::IddObjectType::ZoneHVAC_AirDistributionUnit); | |
| 39 | ✗ | _airDistributionUnit.setName("ADU " + baseName); //ADU: Air Distribution Unit | |
| 40 | |||
| 41 | ✗ | IdfObject idfObject(openstudio::IddObjectType::AirTerminal_SingleDuct_ConstantVolume_Reheat); | |
| 42 | |||
| 43 | ✗ | idfObject.setName(baseName); | |
| 44 | |||
| 45 | ✗ | HVACComponent coil = modelObject.reheatCoil(); | |
| 46 | |||
| 47 | ✗ | m_idfObjects.push_back(_airDistributionUnit); | |
| 48 | |||
| 49 | ✗ | m_idfObjects.push_back(idfObject); | |
| 50 | |||
| 51 | ✗ | boost::optional<IdfObject> _reheatCoil = translateAndMapModelObject(coil); | |
| 52 | |||
| 53 | ✗ | if (_reheatCoil && _reheatCoil->name()) { | |
| 54 | ✗ | boost::optional<std::string> inletNodeName; | |
| 55 | ✗ | boost::optional<std::string> outletNodeName; | |
| 56 | |||
| 57 | ✗ | if (boost::optional<ModelObject> inletModelObject = modelObject.inletModelObject()) { | |
| 58 | ✗ | if (boost::optional<Node> inletNode = inletModelObject->optionalCast<Node>()) { | |
| 59 | ✗ | inletNodeName = inletNode->name().get(); | |
| 60 | ✗ | } | |
| 61 | ✗ | } | |
| 62 | |||
| 63 | ✗ | if (boost::optional<ModelObject> outletModelObject = modelObject.outletModelObject()) { | |
| 64 | ✗ | if (boost::optional<Node> outletNode = outletModelObject->optionalCast<Node>()) { | |
| 65 | ✗ | outletNodeName = outletNode->name().get(); | |
| 66 | ✗ | } | |
| 67 | ✗ | } | |
| 68 | |||
| 69 | // Reheat Coil Name | ||
| 70 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::ReheatCoilName, _reheatCoil->name().get()); | |
| 71 | |||
| 72 | // Reheat Coil Type | ||
| 73 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::ReheatCoilObjectType, _reheatCoil->iddObject().name()); | |
| 74 | |||
| 75 | ✗ | if (outletNodeName && inletNodeName) { | |
| 76 | ✗ | if (_reheatCoil->iddObject().type() == IddObjectType::Coil_Heating_Fuel) { | |
| 77 | ✗ | _reheatCoil->setString(Coil_Heating_FuelFields::AirInletNodeName, inletNodeName.get()); | |
| 78 | ✗ | _reheatCoil->setString(Coil_Heating_FuelFields::AirOutletNodeName, outletNodeName.get()); | |
| 79 | ✗ | } else if (_reheatCoil->iddObject().type() == IddObjectType::Coil_Heating_Electric) { | |
| 80 | ✗ | _reheatCoil->setString(Coil_Heating_ElectricFields::AirInletNodeName, inletNodeName.get()); | |
| 81 | ✗ | _reheatCoil->setString(Coil_Heating_ElectricFields::AirOutletNodeName, outletNodeName.get()); | |
| 82 | ✗ | } else if (_reheatCoil->iddObject().type() == IddObjectType::Coil_Heating_Water) { | |
| 83 | ✗ | _reheatCoil->setString(Coil_Heating_WaterFields::AirInletNodeName, inletNodeName.get()); | |
| 84 | ✗ | _reheatCoil->setString(Coil_Heating_WaterFields::AirOutletNodeName, outletNodeName.get()); | |
| 85 | } | ||
| 86 | |||
| 87 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::AirOutletNodeName, outletNodeName.get()); | |
| 88 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::AirInletNodeName, inletNodeName.get()); | |
| 89 | } | ||
| 90 | ✗ | } else { | |
| 91 | ✗ | LOG(Error, modelObject.briefDescription() << ": Could not translate heating coil"); | |
| 92 | |||
| 93 | ✗ | return boost::none; | |
| 94 | } | ||
| 95 | |||
| 96 | // AvailabilityScheduleName | ||
| 97 | ✗ | Schedule availabilitySchedule = modelObject.availabilitySchedule(); | |
| 98 | |||
| 99 | ✗ | boost::optional<IdfObject> _availabilitySchedule = translateAndMapModelObject(availabilitySchedule); | |
| 100 | |||
| 101 | ✗ | if (_availabilitySchedule && _availabilitySchedule->name()) { | |
| 102 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::AvailabilityScheduleName, _availabilitySchedule->name().get()); | |
| 103 | } | ||
| 104 | |||
| 105 | // MaximumAirFlowRate | ||
| 106 | ✗ | boost::optional<double> value = modelObject.maximumAirFlowRate(); | |
| 107 | ✗ | if (value) { | |
| 108 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MaximumAirFlowRate, value.get()); | |
| 109 | ✗ | } else if (modelObject.isMaximumAirFlowRateAutosized()) { | |
| 110 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MaximumAirFlowRate, "Autosize"); | |
| 111 | } | ||
| 112 | |||
| 113 | // MaximumHotWaterOrSteamFlowRate | ||
| 114 | ✗ | value = modelObject.maximumHotWaterorSteamFlowRate(); | |
| 115 | |||
| 116 | ✗ | if (value) { | |
| 117 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MaximumHotWaterorSteamFlowRate, value.get()); | |
| 118 | ✗ | } else if (modelObject.isMaximumHotWaterorSteamFlowRateAutosized()) { | |
| 119 | ✗ | idfObject.setString(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MaximumHotWaterorSteamFlowRate, "Autosize"); | |
| 120 | } | ||
| 121 | |||
| 122 | // MinimumHotWaterOrSteamFlowRate | ||
| 123 | ✗ | value = modelObject.minimumHotWaterorSteamFlowRate(); | |
| 124 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MinimumHotWaterorSteamFlowRate, value.get()); | |
| 125 | |||
| 126 | // ConvergenceTolerance | ||
| 127 | ✗ | value = modelObject.convergenceTolerance(); | |
| 128 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::ConvergenceTolerance, value.get()); | |
| 129 | |||
| 130 | // MaximumReheatAirTemperature | ||
| 131 | ✗ | value = modelObject.maximumReheatAirTemperature(); | |
| 132 | ✗ | idfObject.setDouble(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MaximumReheatAirTemperature, value.get()); | |
| 133 | |||
| 134 | // Populate fields for AirDistributionUnit | ||
| 135 | ✗ | if (boost::optional<ModelObject> outletNode = modelObject.outletModelObject()) { | |
| 136 | ✗ | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirDistributionUnitOutletNodeName, outletNode->name().get()); | |
| 137 | ✗ | } | |
| 138 | ✗ | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirTerminalObjectType, idfObject.iddObject().name()); | |
| 139 | ✗ | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirTerminalName, idfObject.name().get()); | |
| 140 | |||
| 141 | ✗ | return _airDistributionUnit; | |
| 142 | ✗ | } | |
| 143 | |||
| 144 | } // namespace energyplus | ||
| 145 | |||
| 146 | } // namespace openstudio | ||
| 147 |