src/energyplus/ForwardTranslator/ForwardTranslateAirTerminalSingleDuctVAVHeatAndCoolReheat.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/AirTerminalSingleDuctVAVHeatAndCoolReheat.hpp" | ||
| 9 | #include "../../model/AirTerminalSingleDuctVAVHeatAndCoolReheat_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 "../../model/WaterToAirComponent.hpp" | ||
| 16 | #include "../../model/WaterToAirComponent_Impl.hpp" | ||
| 17 | #include <utilities/idd/AirTerminal_SingleDuct_VAV_HeatAndCool_Reheat_FieldEnums.hxx> | ||
| 18 | #include <utilities/idd/ZoneHVAC_AirDistributionUnit_FieldEnums.hxx> | ||
| 19 | #include <utilities/idd/Coil_Heating_Fuel_FieldEnums.hxx> | ||
| 20 | #include <utilities/idd/Coil_Heating_Electric_FieldEnums.hxx> | ||
| 21 | #include <utilities/idd/Coil_Heating_Water_FieldEnums.hxx> | ||
| 22 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 23 | #include <utilities/idd/IddEnums.hxx> | ||
| 24 | #include <utilities/idd/IddFactory.hxx> | ||
| 25 | |||
| 26 | using namespace openstudio::model; | ||
| 27 | |||
| 28 | namespace openstudio { | ||
| 29 | |||
| 30 | namespace energyplus { | ||
| 31 | |||
| 32 | boost::optional<IdfObject> | ||
| 33 | 1 | ForwardTranslator::translateAirTerminalSingleDuctVAVHeatAndCoolReheat(AirTerminalSingleDuctVAVHeatAndCoolReheat& modelObject) { | |
| 34 | 1 | OptionalModelObject temp; | |
| 35 | 1 | OptionalString optS; | |
| 36 | 1 | boost::optional<std::string> s; | |
| 37 | 1 | boost::optional<double> value; | |
| 38 | |||
| 39 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | std::string baseName = modelObject.name().get(); |
| 40 | |||
| 41 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject _airDistributionUnit(openstudio::IddObjectType::ZoneHVAC_AirDistributionUnit); |
| 42 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | _airDistributionUnit.setName("ADU " + baseName); //ADU: Air Distribution Unit |
| 43 | |||
| 44 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject idfObject(openstudio::IddObjectType::AirTerminal_SingleDuct_VAV_HeatAndCool_Reheat); |
| 45 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setName(baseName); |
| 46 | |||
| 47 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_idfObjects.push_back(_airDistributionUnit); |
| 48 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_idfObjects.push_back(idfObject); |
| 49 | |||
| 50 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto coil = modelObject.reheatCoil(); |
| 51 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto _coil = translateAndMapModelObject(coil); |
| 52 | |||
| 53 | 1 | boost::optional<std::string> inletNodeName; | |
| 54 | 1 | boost::optional<std::string> outletNodeName; | |
| 55 | |||
| 56 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<ModelObject> inletModelObject = modelObject.inletModelObject()) { |
| 57 |
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<Node> inletNode = inletModelObject->optionalCast<Node>()) { |
| 58 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | inletNodeName = inletNode->name().get(); |
| 59 | 1 | } | |
| 60 | 1 | } | |
| 61 | |||
| 62 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<ModelObject> outletModelObject = modelObject.outletModelObject()) { |
| 63 |
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<Node> outletNode = outletModelObject->optionalCast<Node>()) { |
| 64 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | outletNodeName = outletNode->name().get(); |
| 65 | 1 | } | |
| 66 | 1 | } | |
| 67 | |||
| 68 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::string damperOutletNodeName = baseName + " Damper Outlet Node"; |
| 69 | |||
| 70 |
3/6✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
|
2 | if (outletNodeName && inletNodeName) { |
| 71 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_coil) { |
| 72 |
5/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✗ Branch 15 not taken.
|
1 | if (_coil->iddObject().type() == IddObjectType::Coil_Heating_Fuel) { |
| 73 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | _coil->setString(Coil_Heating_FuelFields::AirInletNodeName, damperOutletNodeName); |
| 74 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | _coil->setString(Coil_Heating_FuelFields::AirOutletNodeName, outletNodeName.get()); |
| 75 | ✗ | } else if (_coil->iddObject().type() == IddObjectType::Coil_Heating_Electric) { | |
| 76 | ✗ | _coil->setString(Coil_Heating_ElectricFields::AirInletNodeName, damperOutletNodeName); | |
| 77 | ✗ | _coil->setString(Coil_Heating_ElectricFields::AirOutletNodeName, outletNodeName.get()); | |
| 78 | ✗ | } else if (_coil->iddObject().type() == IddObjectType::Coil_Heating_Water) { | |
| 79 | ✗ | _coil->setString(Coil_Heating_WaterFields::AirInletNodeName, damperOutletNodeName); | |
| 80 | ✗ | _coil->setString(Coil_Heating_WaterFields::AirOutletNodeName, outletNodeName.get()); | |
| 81 | } | ||
| 82 | } | ||
| 83 | |||
| 84 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::AirOutletNodeName, outletNodeName.get()); |
| 85 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::AirInletNodeName, inletNodeName.get()); |
| 86 | } | ||
| 87 | |||
| 88 | // AvailabilityScheduleName | ||
| 89 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto schedule = modelObject.availabilitySchedule()) { |
| 90 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (auto _schedule = translateAndMapModelObject(schedule.get())) { |
| 91 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::AvailabilityScheduleName, _schedule->name().get()); |
| 92 | 1 | } | |
| 93 | 1 | } | |
| 94 | |||
| 95 | // DamperAirOutletNodeName | ||
| 96 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::DamperAirOutletNodeName, damperOutletNodeName); |
| 97 | |||
| 98 | // AirInletNodeName | ||
| 99 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto node = modelObject.inletModelObject()) { |
| 100 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::AirInletNodeName, node->name().get()); |
| 101 | 1 | } | |
| 102 | |||
| 103 | // MaximumAirFlowRate | ||
| 104 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
1 | if (modelObject.isMaximumAirFlowRateAutosized()) { |
| 105 | ✗ | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumAirFlowRate, "AutoSize"); | |
| 106 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if ((value = modelObject.maximumAirFlowRate())) { |
| 107 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumAirFlowRate, value.get()); |
| 108 | } | ||
| 109 | |||
| 110 | // ZoneMinimumAirFlowFraction | ||
| 111 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
|
2 | if ((value = modelObject.zoneMinimumAirFlowFraction())) { |
| 112 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::ZoneMinimumAirFlowFraction, value.get()); |
| 113 | } | ||
| 114 | |||
| 115 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_coil) { |
| 116 | // ReheatCoilObjectType | ||
| 117 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::ReheatCoilObjectType, _coil->iddObject().name()); |
| 118 | |||
| 119 | // ReheatCoilName | ||
| 120 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::ReheatCoilName, _coil->name().get()); |
| 121 | } | ||
| 122 | |||
| 123 | // MaximumHotWaterorSteamFlowRate | ||
| 124 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
1 | if (modelObject.isMaximumHotWaterorSteamFlowRateAutosized()) { |
| 125 | ✗ | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumHotWaterorSteamFlowRate, "AutoSize"); | |
| 126 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if ((value = modelObject.maximumHotWaterorSteamFlowRate())) { |
| 127 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumHotWaterorSteamFlowRate, value.get()); |
| 128 | } | ||
| 129 | |||
| 130 | // MinimumHotWaterorSteamFlowRate | ||
| 131 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
|
2 | if ((value = modelObject.minimumHotWaterorSteamFlowRate())) { |
| 132 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MinimumHotWaterorSteamFlowRate, value.get()); |
| 133 | } | ||
| 134 | |||
| 135 | // AirOutletNodeName | ||
| 136 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto node = modelObject.outletModelObject()) { |
| 137 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::AirOutletNodeName, node->name().get()); |
| 138 | 1 | } | |
| 139 | |||
| 140 | // ConvergenceTolerance | ||
| 141 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
|
2 | if ((value = modelObject.convergenceTolerance())) { |
| 142 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::ConvergenceTolerance, value.get()); |
| 143 | } | ||
| 144 | |||
| 145 | // MaximumReheatAirTemperature | ||
| 146 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
|
2 | if ((value = modelObject.maximumReheatAirTemperature())) { |
| 147 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MaximumReheatAirTemperature, value.get()); |
| 148 | } | ||
| 149 | |||
| 150 | // MinimumAirFlowTurndownScheduleName | ||
| 151 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<Schedule> minAirFlowTurndownSchedule = modelObject.minimumAirFlowTurndownSchedule()) { |
| 152 |
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> _minAirFlowTurndownSchedule = translateAndMapModelObject(minAirFlowTurndownSchedule.get())) { |
| 153 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_ReheatFields::MinimumAirFlowTurndownScheduleName, |
| 154 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | _minAirFlowTurndownSchedule->nameString()); |
| 155 | 1 | } | |
| 156 | 1 | } | |
| 157 | |||
| 158 | // Populate fields for AirDistributionUnit | ||
| 159 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<ModelObject> outletNode = modelObject.outletModelObject()) { |
| 160 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirDistributionUnitOutletNodeName, outletNode->name().get()); |
| 161 | 1 | } | |
| 162 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirTerminalObjectType, idfObject.iddObject().name()); |
| 163 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirTerminalName, idfObject.name().get()); |
| 164 | |||
| 165 |
1/1✓ Branch 1 taken 1 time.
|
2 | return _airDistributionUnit; |
| 166 | 1 | } | |
| 167 | |||
| 168 | } // namespace energyplus | ||
| 169 | |||
| 170 | } // namespace openstudio | ||
| 171 |