src/energyplus/ForwardTranslator/ForwardTranslateAirTerminalDualDuctConstantVolume.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/AirTerminalDualDuctConstantVolume.hpp" | ||
| 9 | #include "../../model/AirTerminalDualDuctConstantVolume_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_DualDuct_ConstantVolume_FieldEnums.hxx> | ||
| 16 | #include <utilities/idd/ZoneHVAC_AirDistributionUnit_FieldEnums.hxx> | ||
| 17 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 18 | #include <utilities/idd/IddEnums.hxx> | ||
| 19 | #include <utilities/idd/IddFactory.hxx> | ||
| 20 | |||
| 21 | using namespace openstudio::model; | ||
| 22 | |||
| 23 | namespace openstudio { | ||
| 24 | |||
| 25 | namespace energyplus { | ||
| 26 | |||
| 27 | 2 | boost::optional<IdfObject> ForwardTranslator::translateAirTerminalDualDuctConstantVolume(AirTerminalDualDuctConstantVolume& modelObject) { | |
| 28 | |||
| 29 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | std::string baseName = modelObject.name().get(); |
| 30 | |||
| 31 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject _airDistributionUnit(openstudio::IddObjectType::ZoneHVAC_AirDistributionUnit); |
| 32 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | _airDistributionUnit.setName("ADU " + baseName); //ADU: Air Distribution Unit |
| 33 | |||
| 34 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject idfObject(openstudio::IddObjectType::AirTerminal_DualDuct_ConstantVolume); |
| 35 |
1/1✓ Branch 1 taken 2 times.
|
2 | idfObject.setName(baseName); |
| 36 | |||
| 37 |
1/1✓ Branch 1 taken 2 times.
|
2 | m_idfObjects.push_back(_airDistributionUnit); |
| 38 |
1/1✓ Branch 1 taken 2 times.
|
2 | m_idfObjects.push_back(idfObject); |
| 39 | |||
| 40 | { | ||
| 41 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto schedule = modelObject.availabilitySchedule(); |
| 42 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto idf = translateAndMapModelObject(schedule)) { |
| 43 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | idfObject.setString(AirTerminal_DualDuct_ConstantVolumeFields::AvailabilityScheduleName, idf->name().get()); |
| 44 | 2 | } | |
| 45 | 2 | } | |
| 46 | |||
| 47 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto mo = modelObject.outletModelObject()) { |
| 48 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | idfObject.setString(AirTerminal_DualDuct_ConstantVolumeFields::AirOutletNodeName, mo->name().get()); |
| 49 | 2 | } | |
| 50 | |||
| 51 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto mo = modelObject.inletModelObject(0)) { |
| 52 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | idfObject.setString(AirTerminal_DualDuct_ConstantVolumeFields::HotAirInletNodeName, mo->name().get()); |
| 53 | 2 | } | |
| 54 | |||
| 55 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto mo = modelObject.inletModelObject(1)) { |
| 56 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | idfObject.setString(AirTerminal_DualDuct_ConstantVolumeFields::ColdAirInletNodeName, mo->name().get()); |
| 57 | 2 | } | |
| 58 | |||
| 59 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | if (modelObject.isMaximumAirFlowRateAutosized()) { |
| 60 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | idfObject.setString(AirTerminal_DualDuct_ConstantVolumeFields::MaximumAirFlowRate, "Autosize"); |
| 61 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if (auto value = modelObject.maximumAirFlowRate()) { |
| 62 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(AirTerminal_DualDuct_ConstantVolumeFields::MaximumAirFlowRate, value.get()); |
| 63 | } | ||
| 64 | |||
| 65 | // Populate fields for AirDistributionUnit | ||
| 66 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<ModelObject> outletNode = modelObject.outletModelObject()) { |
| 67 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirDistributionUnitOutletNodeName, outletNode->name().get()); |
| 68 | 2 | } | |
| 69 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirTerminalObjectType, idfObject.iddObject().name()); |
| 70 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | _airDistributionUnit.setString(ZoneHVAC_AirDistributionUnitFields::AirTerminalName, idfObject.name().get()); |
| 71 | |||
| 72 |
1/1✓ Branch 1 taken 2 times.
|
4 | return _airDistributionUnit; |
| 73 | 2 | } | |
| 74 | |||
| 75 | } // namespace energyplus | ||
| 76 | |||
| 77 | } // namespace openstudio | ||
| 78 |