src/energyplus/ForwardTranslator/ForwardTranslateAirTerminalDualDuctVAVOutdoorAir.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/AirTerminalDualDuctVAVOutdoorAir.hpp" | ||
| 9 | #include "../../model/AirTerminalDualDuctVAVOutdoorAir_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/ThermalZone.hpp" | ||
| 16 | #include "../../model/ThermalZone_Impl.hpp" | ||
| 17 | #include "../../model/Space.hpp" | ||
| 18 | #include "../../model/Space_Impl.hpp" | ||
| 19 | #include "../../model/DesignSpecificationOutdoorAir.hpp" | ||
| 20 | #include "../../model/DesignSpecificationOutdoorAir_Impl.hpp" | ||
| 21 | #include <utilities/idd/AirTerminal_DualDuct_VAV_OutdoorAir_FieldEnums.hxx> | ||
| 22 | #include <utilities/idd/ZoneHVAC_AirDistributionUnit_FieldEnums.hxx> | ||
| 23 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 24 | #include <utilities/idd/IddEnums.hxx> | ||
| 25 | #include <utilities/idd/IddFactory.hxx> | ||
| 26 | |||
| 27 | using namespace openstudio::model; | ||
| 28 | |||
| 29 | namespace openstudio { | ||
| 30 | |||
| 31 | namespace energyplus { | ||
| 32 | |||
| 33 | 2 | boost::optional<IdfObject> ForwardTranslator::translateAirTerminalDualDuctVAVOutdoorAir(AirTerminalDualDuctVAVOutdoorAir& modelObject) { | |
| 34 | |||
| 35 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | std::string baseName = modelObject.name().get(); |
| 36 | |||
| 37 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject _airDistributionUnit(openstudio::IddObjectType::ZoneHVAC_AirDistributionUnit); |
| 38 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | _airDistributionUnit.setName("ADU " + baseName); //ADU: Air Distribution Unit |
| 39 | |||
| 40 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject idfObject(openstudio::IddObjectType::AirTerminal_DualDuct_VAV_OutdoorAir); |
| 41 |
1/1✓ Branch 1 taken 2 times.
|
2 | idfObject.setName(baseName); |
| 42 | |||
| 43 |
1/1✓ Branch 1 taken 2 times.
|
2 | m_idfObjects.push_back(_airDistributionUnit); |
| 44 |
1/1✓ Branch 1 taken 2 times.
|
2 | m_idfObjects.push_back(idfObject); |
| 45 | |||
| 46 | { | ||
| 47 |
1/1✓ Branch 1 taken 2 times.
|
2 | Schedule schedule = modelObject.availabilitySchedule(); |
| 48 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto idf = translateAndMapModelObject(schedule)) { |
| 49 |
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_VAV_OutdoorAirFields::AvailabilityScheduleName, idf->name().get()); |
| 50 | 2 | } | |
| 51 | 2 | } | |
| 52 | |||
| 53 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto mo = modelObject.outletModelObject()) { |
| 54 |
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_VAV_OutdoorAirFields::AirOutletNodeName, mo->name().get()); |
| 55 | 2 | } | |
| 56 | |||
| 57 | // outdoorAirInletNode = 0 | ||
| 58 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto mo = modelObject.inletModelObject(0)) { |
| 59 |
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_VAV_OutdoorAirFields::OutdoorAirInletNodeName, mo->name().get()); |
| 60 | 2 | } | |
| 61 | |||
| 62 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (auto mo = modelObject.inletModelObject(1)) { |
| 63 |
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_VAV_OutdoorAirFields::RecirculatedAirInletNodeName, mo->name().get()); |
| 64 | 2 | } | |
| 65 | |||
| 66 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | if (modelObject.isMaximumTerminalAirFlowRateAutosized()) { |
| 67 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | idfObject.setString(AirTerminal_DualDuct_VAV_OutdoorAirFields::MaximumTerminalAirFlowRate, "Autosize"); |
| 68 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if (auto value = modelObject.maximumTerminalAirFlowRate()) { |
| 69 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(AirTerminal_DualDuct_VAV_OutdoorAirFields::MaximumTerminalAirFlowRate, value.get()); |
| 70 | } | ||
| 71 | |||
| 72 | { | ||
| 73 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto value = modelObject.perPersonVentilationRateMode(); |
| 74 |
1/1✓ Branch 1 taken 2 times.
|
2 | idfObject.setString(AirTerminal_DualDuct_VAV_OutdoorAirFields::PerPersonVentilationRateMode, value); |
| 75 | 2 | } | |
| 76 | |||
| 77 | // ControlForOutdoorAir: if yes, get the zone's space's DSOA | ||
| 78 | { | ||
| 79 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | if (modelObject.controlForOutdoorAir()) { |
| 80 | 1 | bool dsoa_found = false; | |
| 81 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto airLoopHVAC = modelObject.airLoopHVAC()) { |
| 82 |
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()); |
| 83 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (!zones.empty()) { |
| 84 |
1/1✓ Branch 2 taken 1 time.
|
1 | auto zone = zones.front(); |
| 85 |
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>())) { |
| 86 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(AirTerminal_DualDuct_VAV_OutdoorAirFields::DesignSpecificationOutdoorAirObjectName, dsoaOrList_->nameString()); |
| 87 | 1 | dsoa_found = true; | |
| 88 | 1 | } | |
| 89 | 1 | } | |
| 90 | 2 | } | |
| 91 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (!dsoa_found) { |
| 92 | ✗ | LOG(Error, "Cannot set the Required 'Design Specification Outdoor Air' (DSOA) object for " | |
| 93 | << modelObject.briefDescription() | ||
| 94 | << ". You should set controlForOutdoorAir to 'true' and ensure the zone's Space/SpaceType has a DSOA attached."); | ||
| 95 | } | ||
| 96 | } | ||
| 97 | } | ||
| 98 | |||
| 99 | // Populate fields for AirDistributionUnit | ||
| 100 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<ModelObject> outletNode = modelObject.outletModelObject()) { |
| 101 |
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()); |
| 102 | 2 | } | |
| 103 |
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()); |
| 104 |
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()); |
| 105 | |||
| 106 |
1/1✓ Branch 1 taken 2 times.
|
4 | return _airDistributionUnit; |
| 107 | 2 | } | |
| 108 | |||
| 109 | } // namespace energyplus | ||
| 110 | |||
| 111 | } // namespace openstudio | ||
| 112 |