src/energyplus/ForwardTranslator/ForwardTranslateAirTerminalSingleDuctVAVHeatAndCoolNoReheat.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/AirTerminalSingleDuctVAVHeatAndCoolNoReheat.hpp" | ||
| 10 | #include "../../model/AirTerminalSingleDuctVAVHeatAndCoolNoReheat_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 <utilities/idd/AirTerminal_SingleDuct_VAV_HeatAndCool_NoReheat_FieldEnums.hxx> | ||
| 17 | #include <utilities/idd/ZoneHVAC_AirDistributionUnit_FieldEnums.hxx> | ||
| 18 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 19 | #include <utilities/idd/IddEnums.hxx> | ||
| 20 | #include <utilities/idd/IddFactory.hxx> | ||
| 21 | |||
| 22 | using namespace openstudio::model; | ||
| 23 | |||
| 24 | namespace openstudio { | ||
| 25 | |||
| 26 | namespace energyplus { | ||
| 27 | |||
| 28 | boost::optional<IdfObject> | ||
| 29 | 1 | ForwardTranslator::translateAirTerminalSingleDuctVAVHeatAndCoolNoReheat(AirTerminalSingleDuctVAVHeatAndCoolNoReheat& modelObject) { | |
| 30 | 1 | OptionalModelObject temp; | |
| 31 | 1 | OptionalString optS; | |
| 32 | 1 | boost::optional<std::string> s; | |
| 33 | 1 | boost::optional<double> value; | |
| 34 | |||
| 35 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | std::string baseName = modelObject.name().get(); |
| 36 | |||
| 37 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject _airDistributionUnit(openstudio::IddObjectType::ZoneHVAC_AirDistributionUnit); |
| 38 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | _airDistributionUnit.setName("ADU " + baseName); //ADU: Air Distribution Unit |
| 39 | |||
| 40 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject idfObject(openstudio::IddObjectType::AirTerminal_SingleDuct_VAV_HeatAndCool_NoReheat); |
| 41 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setName(baseName); |
| 42 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_idfObjects.push_back(_airDistributionUnit); |
| 43 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_idfObjects.push_back(idfObject); |
| 44 | |||
| 45 | 1 | boost::optional<std::string> inletNodeName; | |
| 46 | 1 | boost::optional<std::string> outletNodeName; | |
| 47 | |||
| 48 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<ModelObject> inletModelObject = modelObject.inletModelObject()) { |
| 49 |
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>()) { |
| 50 |
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(); |
| 51 | 1 | } | |
| 52 | 1 | } | |
| 53 | |||
| 54 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<ModelObject> outletModelObject = modelObject.outletModelObject()) { |
| 55 |
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>()) { |
| 56 |
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(); |
| 57 | 1 | } | |
| 58 | 1 | } | |
| 59 | |||
| 60 |
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) { |
| 61 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_NoReheatFields::AirOutletNodeName, outletNodeName.get()); |
| 62 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_NoReheatFields::AirInletNodeName, inletNodeName.get()); |
| 63 | } | ||
| 64 | |||
| 65 | // AvailabilityScheduleName | ||
| 66 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto schedule = modelObject.availabilitySchedule()) { |
| 67 |
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())) { |
| 68 |
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_NoReheatFields::AvailabilityScheduleName, _schedule->name().get()); |
| 69 | 1 | } | |
| 70 | 1 | } | |
| 71 | |||
| 72 | // MaximumAirFlowRate | ||
| 73 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
1 | if (modelObject.isMaximumAirFlowRateAutosized()) { |
| 74 | ✗ | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_NoReheatFields::MaximumAirFlowRate, "AutoSize"); | |
| 75 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if ((value = modelObject.maximumAirFlowRate())) { |
| 76 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(AirTerminal_SingleDuct_VAV_HeatAndCool_NoReheatFields::MaximumAirFlowRate, value.get()); |
| 77 | } | ||
| 78 | |||
| 79 | // ZoneMinimumAirFlowFraction | ||
| 80 |
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())) { |
| 81 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(AirTerminal_SingleDuct_VAV_HeatAndCool_NoReheatFields::ZoneMinimumAirFlowFraction, value.get()); |
| 82 | } | ||
| 83 | |||
| 84 | // MinimumAirFlowTurndownScheduleName | ||
| 85 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<Schedule> minAirFlowTurndownSchedule = modelObject.minimumAirFlowTurndownSchedule()) { |
| 86 |
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())) { |
| 87 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setString(AirTerminal_SingleDuct_VAV_HeatAndCool_NoReheatFields::MinimumAirFlowTurndownScheduleName, |
| 88 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | _minAirFlowTurndownSchedule->nameString()); |
| 89 | 1 | } | |
| 90 | 1 | } | |
| 91 | |||
| 92 | // Populate fields for AirDistributionUnit | ||
| 93 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<ModelObject> outletNode = modelObject.outletModelObject()) { |
| 94 |
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()); |
| 95 | 1 | } | |
| 96 |
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()); |
| 97 |
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()); |
| 98 | |||
| 99 |
1/1✓ Branch 1 taken 1 time.
|
2 | return _airDistributionUnit; |
| 100 | 1 | } | |
| 101 | |||
| 102 | } // namespace energyplus | ||
| 103 | |||
| 104 | } // namespace openstudio | ||
| 105 |