src/energyplus/ForwardTranslator/ForwardTranslateAirTerminalSingleDuctVAVNoReheat.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 | // copy from AirTerminalSingleDuctVAVReheat | ||
| 7 | #include "../ForwardTranslator.hpp" | ||
| 8 | #include "../../model/Model.hpp" | ||
| 9 | #include "../../model/AirTerminalSingleDuctVAVNoReheat.hpp" | ||
| 10 | #include "../../model/AirTerminalSingleDuctVAVNoReheat_Impl.hpp" | ||
| 11 | #include "../../model/HVACComponent.hpp" | ||
| 12 | #include "../../model/Schedule.hpp" | ||
| 13 | #include "../../model/Schedule_Impl.hpp" | ||
| 14 | #include "../../model/Node.hpp" | ||
| 15 | #include "../../model/Node_Impl.hpp" | ||
| 16 | #include "../../model/ThermalZone.hpp" | ||
| 17 | #include "../../model/ThermalZone_Impl.hpp" | ||
| 18 | #include "../../model/Space.hpp" | ||
| 19 | #include "../../model/Space_Impl.hpp" | ||
| 20 | #include "../../model/DesignSpecificationOutdoorAir.hpp" | ||
| 21 | #include "../../model/DesignSpecificationOutdoorAir_Impl.hpp" | ||
| 22 | #include <utilities/idd/AirTerminal_SingleDuct_VAV_NoReheat_FieldEnums.hxx> | ||
| 23 | #include <utilities/idd/ZoneHVAC_AirDistributionUnit_FieldEnums.hxx> | ||
| 24 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 25 | #include <utilities/idd/IddEnums.hxx> | ||
| 26 | #include <utilities/idd/IddFactory.hxx> | ||
| 27 | |||
| 28 | using namespace openstudio::model; | ||
| 29 | |||
| 30 | namespace openstudio { | ||
| 31 | |||
| 32 | namespace energyplus { | ||
| 33 | |||
| 34 | 1 | boost::optional<IdfObject> ForwardTranslator::translateAirTerminalSingleDuctVAVNoReheat(AirTerminalSingleDuctVAVNoReheat& modelObject) { | |
| 35 | 1 | OptionalModelObject temp; | |
| 36 | 1 | OptionalString optS; | |
| 37 | 1 | boost::optional<std::string> s; | |
| 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_NoReheat); |
| 45 | |||
| 46 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setName(baseName); |
| 47 | |||
| 48 | //HVACComponent coil = modelObject.NoReheatCoil(); | ||
| 49 | |||
| 50 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_idfObjects.push_back(_airDistributionUnit); |
| 51 | |||
| 52 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_idfObjects.push_back(idfObject); |
| 53 | |||
| 54 | //boost::optional<IdfObject> _ReheatCoil = translateAndMapModelObject(coil); | ||
| 55 | |||
| 56 | // if( _NoReheatCoil && _NoReheatCoil->name() ) | ||
| 57 | //{ | ||
| 58 | // std::string damperOutletNodeName = modelObject.name().get() + " Damper Outlet"; | ||
| 59 | |||
| 60 | 1 | boost::optional<std::string> inletNodeName; | |
| 61 | 1 | boost::optional<std::string> outletNodeName; | |
| 62 | |||
| 63 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<ModelObject> inletModelObject = modelObject.inletModelObject()) { |
| 64 |
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>()) { |
| 65 |
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(); |
| 66 | 1 | } | |
| 67 | 1 | } | |
| 68 | |||
| 69 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<ModelObject> outletModelObject = modelObject.outletModelObject()) { |
| 70 |
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>()) { |
| 71 |
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(); |
| 72 | 1 | } | |
| 73 | 1 | } | |
| 74 | |||
| 75 | // Reheat Coil Name | ||
| 76 | // idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::ReheatCoilName,_reheatCoil->name().get()); | ||
| 77 | |||
| 78 | // Reheat Coil Type | ||
| 79 | //idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::ReheatCoilObjectType,_reheatCoil->iddObject().name()); | ||
| 80 | |||
| 81 | //idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::DamperAirOutletNodeName,damperOutletNodeName); | ||
| 82 | |||
| 83 |
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) { |
| 84 | // if( _reheatCoil->iddObject().type() == IddObjectType::Coil_Heating_Gas ) | ||
| 85 | // { | ||
| 86 | // _reheatCoil->setString(Coil_Heating_GasFields::AirInletNodeName,damperOutletNodeName); | ||
| 87 | // _reheatCoil->setString(Coil_Heating_GasFields::AirOutletNodeName,outletNodeName.get()); | ||
| 88 | // } | ||
| 89 | // else if( _reheatCoil->iddObject().type() == IddObjectType::Coil_Heating_Electric ) | ||
| 90 | // { | ||
| 91 | // _reheatCoil->setString(Coil_Heating_ElectricFields::AirInletNodeName,damperOutletNodeName); | ||
| 92 | // _reheatCoil->setString(Coil_Heating_ElectricFields::AirOutletNodeName,outletNodeName.get()); | ||
| 93 | // } | ||
| 94 | // else if( _reheatCoil->iddObject().type() == IddObjectType::Coil_Heating_Water ) | ||
| 95 | // { | ||
| 96 | // _reheatCoil->setString(Coil_Heating_WaterFields::AirInletNodeName,damperOutletNodeName); | ||
| 97 | // _reheatCoil->setString(Coil_Heating_WaterFields::AirOutletNodeName,outletNodeName.get()); | ||
| 98 | // } | ||
| 99 | // | ||
| 100 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::AirOutletNodeName, outletNodeName.get()); |
| 101 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::AirInletNodeName, inletNodeName.get()); |
| 102 | } | ||
| 103 | //} | ||
| 104 | //else | ||
| 105 | //{ | ||
| 106 | //LOG(Error,modelObject.briefDescription() << ": Could not translate heating coil"); | ||
| 107 | |||
| 108 | //return boost::none; | ||
| 109 | // } | ||
| 110 | |||
| 111 | // AvailabilityScheduleName | ||
| 112 |
1/1✓ Branch 1 taken 1 time.
|
1 | Schedule availabilitySchedule = modelObject.availabilitySchedule(); |
| 113 | |||
| 114 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<IdfObject> _availabilitySchedule = translateAndMapModelObject(availabilitySchedule); |
| 115 | |||
| 116 |
6/12✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 time.
✗ Branch 13 not taken.
✓ Branch 15 taken 1 time.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
3 | if (_availabilitySchedule && _availabilitySchedule->name()) { |
| 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_NoReheatFields::AvailabilityScheduleName, _availabilitySchedule->name().get()); |
| 118 | } | ||
| 119 | |||
| 120 | // MaximumAirFlowRate | ||
| 121 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> value = modelObject.maximumAirFlowRate(); |
| 122 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (value) { |
| 123 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(AirTerminal_SingleDuct_VAV_NoReheatFields::MaximumAirFlowRate, value.get()); |
| 124 | ✗ | } else if (modelObject.isMaximumAirFlowRateAutosized()) { | |
| 125 | ✗ | idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::MaximumAirFlowRate, "Autosize"); | |
| 126 | } | ||
| 127 | |||
| 128 | // ZoneMinimumAirFlowInputMethod | ||
| 129 |
1/1✓ Branch 1 taken 1 time.
|
1 | s = modelObject.zoneMinimumAirFlowInputMethod(); |
| 130 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (s) { |
| 131 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::ZoneMinimumAirFlowInputMethod, s.get()); |
| 132 | } | ||
| 133 | |||
| 134 | // ConstantMinimumAirFlowFraction: autosizable | ||
| 135 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
1 | if (modelObject.isConstantMinimumAirFlowFractionAutosized()) { |
| 136 | ✗ | idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::ConstantMinimumAirFlowFraction, "Autosize"); | |
| 137 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if ((value = modelObject.constantMinimumAirFlowFraction())) { |
| 138 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(AirTerminal_SingleDuct_VAV_NoReheatFields::ConstantMinimumAirFlowFraction, value.get()); |
| 139 | } | ||
| 140 | |||
| 141 | // FixedMinimumAirFlowRate: autosizable | ||
| 142 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
1 | if (modelObject.isFixedMinimumAirFlowRateAutosized()) { |
| 143 | ✗ | idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::FixedMinimumAirFlowRate, "Autosize"); | |
| 144 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if ((value = modelObject.fixedMinimumAirFlowRate())) { |
| 145 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(AirTerminal_SingleDuct_VAV_NoReheatFields::FixedMinimumAirFlowRate, value.get()); |
| 146 | } | ||
| 147 | |||
| 148 | // MinimumAirFlowFractionScheduleName | ||
| 149 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<Schedule> minAirFlowFractionSchedule = modelObject.minimumAirFlowFractionSchedule(); |
| 150 | |||
| 151 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (minAirFlowFractionSchedule) { |
| 152 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | boost::optional<IdfObject> _minAirFlowFractionSchedule = translateAndMapModelObject(minAirFlowFractionSchedule.get()); |
| 153 | |||
| 154 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (_minAirFlowFractionSchedule) { |
| 155 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::MinimumAirFlowFractionScheduleName, _minAirFlowFractionSchedule->nameString()); |
| 156 | } | ||
| 157 | 1 | } | |
| 158 | |||
| 159 | // ControlForOutdoorAir | ||
| 160 | { | ||
| 161 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (modelObject.controlForOutdoorAir()) { |
| 162 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto airLoopHVAC = modelObject.airLoopHVAC()) { |
| 163 |
5/5✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
|
1 | auto zones = airLoopHVAC->demandComponents(modelObject, airLoopHVAC->demandOutletNode(), model::ThermalZone::iddObjectType()); |
| 164 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (!zones.empty()) { |
| 165 |
1/1✓ Branch 2 taken 1 time.
|
1 | auto zone = zones.front(); |
| 166 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 8 taken 1 time.
✗ Branch 9 not taken.
|
2 | if (auto dsoaOrList_ = getOrCreateThermalZoneDSOA(zone.cast<ThermalZone>())) { |
| 167 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::DesignSpecificationOutdoorAirObjectName, dsoaOrList_->nameString()); |
| 168 | 1 | } | |
| 169 | 1 | } | |
| 170 | 2 | } | |
| 171 | } | ||
| 172 | } | ||
| 173 | |||
| 174 | // MinimumAirFlowTurndownScheduleName | ||
| 175 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<Schedule> minAirFlowTurndownSchedule = modelObject.minimumAirFlowTurndownSchedule()) { |
| 176 |
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())) { |
| 177 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::MinimumAirFlowTurndownScheduleName, _minAirFlowTurndownSchedule->nameString()); |
| 178 | 1 | } | |
| 179 | 1 | } | |
| 180 | |||
| 181 | // MaximumHotWaterOrSteamFlowRate | ||
| 182 | // value = modelObject.maximumHotWaterOrSteamFlowRate(); | ||
| 183 | // | ||
| 184 | // if( value ) | ||
| 185 | // { | ||
| 186 | // idfObject.setDouble(AirTerminal_SingleDuct_VAV_NoReheatFields::MaximumHotWaterorSteamFlowRate,value.get()); | ||
| 187 | //} | ||
| 188 | // else if( modelObject.isMaximumHotWaterOrSteamFlowRateAutosized() ) | ||
| 189 | // { | ||
| 190 | // idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::MaximumHotWaterorSteamFlowRate,"Autosize"); | ||
| 191 | // } | ||
| 192 | |||
| 193 | // MinimumHotWaterOrSteamFlowRate | ||
| 194 | // value = modelObject.minimumHotWaterOrSteamFlowRate(); | ||
| 195 | // idfObject.setDouble(AirTerminal_SingleDuct_VAV_NoReheatFields::MinimumHotWaterorSteamFlowRate,value.get()); | ||
| 196 | |||
| 197 | // ConvergenceTolerance | ||
| 198 | //value = modelObject.convergenceTolerance(); | ||
| 199 | //idfObject.setDouble(AirTerminal_SingleDuct_VAV_NoReheatFields::ConvergenceTolerance,value.get()); | ||
| 200 | |||
| 201 | // DamperHeatingAction | ||
| 202 | // s = modelObject.damperHeatingAction(); | ||
| 203 | // idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::DamperHeatingAction,s.get()); | ||
| 204 | |||
| 205 | // MaximumFlowPerZoneFloorAreaDuringReheat | ||
| 206 | //value = modelObject.maximumFlowPerZoneFloorAreaDuringReheat(); | ||
| 207 | |||
| 208 | // if( value ) | ||
| 209 | // { | ||
| 210 | // idfObject.setDouble(AirTerminal_SingleDuct_VAV_NoReheatFields::MaximumFlowperZoneFloorAreaDuringReheat,value.get()); | ||
| 211 | // } | ||
| 212 | // else if ( modelObject.isMaximumFlowPerZoneFloorAreaDuringReheatAutosized() ) | ||
| 213 | // { | ||
| 214 | // idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::MaximumFlowperZoneFloorAreaDuringReheat,"Autocalculate"); | ||
| 215 | // } | ||
| 216 | |||
| 217 | // MaximumFlowFractionDuringReheat | ||
| 218 | // value = modelObject.maximumFlowPerZoneFloorAreaDuringReheat(); | ||
| 219 | |||
| 220 | //if( value ) | ||
| 221 | //{ | ||
| 222 | // idfObject.setDouble(AirTerminal_SingleDuct_VAV_NoReheatFields::MaximumFlowFractionDuringReheat,value.get()); | ||
| 223 | // } | ||
| 224 | // else if( modelObject.isMaximumFlowFractionDuringReheatAutosized() ) | ||
| 225 | // { | ||
| 226 | // idfObject.setString(AirTerminal_SingleDuct_VAV_NoReheatFields::MaximumFlowFractionDuringReheat,"Autocalculate"); | ||
| 227 | // } | ||
| 228 | |||
| 229 | // MaximumReheatAirTemperature | ||
| 230 | // value = modelObject.maximumReheatAirTemperature(); | ||
| 231 | // idfObject.setDouble(AirTerminal_SingleDuct_VAV_NoReheatFields::MaximumReheatAirTemperature,value.get()); | ||
| 232 | |||
| 233 | // Populate fields for AirDistributionUnit | ||
| 234 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<ModelObject> outletNode = modelObject.outletModelObject()) { |
| 235 |
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()); |
| 236 | 1 | } | |
| 237 |
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()); |
| 238 |
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()); |
| 239 | |||
| 240 |
1/1✓ Branch 1 taken 1 time.
|
2 | return _airDistributionUnit; |
| 241 | 1 | } | |
| 242 | |||
| 243 | } // namespace energyplus | ||
| 244 | |||
| 245 | } // namespace openstudio | ||
| 246 |