src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACZoneSplitter.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/AirLoopHVACZoneSplitter.hpp" | ||
| 9 | #include "../../model/AirLoopHVACZoneSplitter_Impl.hpp" | ||
| 10 | #include "../../model/AirLoopHVACZoneMixer.hpp" | ||
| 11 | #include "../../model/AirLoopHVACZoneMixer_Impl.hpp" | ||
| 12 | #include "../../model/AirTerminalSingleDuctConstantVolumeNoReheat.hpp" | ||
| 13 | #include "../../model/AirTerminalSingleDuctConstantVolumeNoReheat_Impl.hpp" | ||
| 14 | #include <utilities/idd/AirLoopHVAC_ZoneSplitter_FieldEnums.hxx> | ||
| 15 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 16 | #include <utilities/idd/IddEnums.hxx> | ||
| 17 | #include <utilities/idd/IddFactory.hxx> | ||
| 18 | |||
| 19 | using namespace openstudio::model; | ||
| 20 | |||
| 21 | namespace openstudio { | ||
| 22 | |||
| 23 | namespace energyplus { | ||
| 24 | |||
| 25 | 205 | boost::optional<IdfObject> ForwardTranslator::translateAirLoopHVACZoneSplitter(AirLoopHVACZoneSplitter& modelObject) { | |
| 26 | 205 | OptionalModelObject temp; | |
| 27 | 205 | OptionalString optS; | |
| 28 | 205 | std::string s; | |
| 29 | |||
| 30 |
2/2✓ Branch 1 taken 205 times.
✓ Branch 4 taken 205 times.
|
205 | IdfObject idfObject(openstudio::IddObjectType::AirLoopHVAC_ZoneSplitter); |
| 31 | |||
| 32 |
1/1✓ Branch 1 taken 205 times.
|
205 | m_idfObjects.push_back(idfObject); |
| 33 | |||
| 34 | /////////////////////////////////////////////////////////////////////////// | ||
| 35 | // Field: Name //////////////////////////////////////////////////////////// | ||
| 36 |
3/3✓ Branch 1 taken 205 times.
✓ Branch 4 taken 205 times.
✓ Branch 7 taken 205 times.
|
205 | s = modelObject.name().get(); |
| 37 |
1/1✓ Branch 1 taken 205 times.
|
205 | idfObject.setName(s); |
| 38 | |||
| 39 | /////////////////////////////////////////////////////////////////////////// | ||
| 40 | // Field: Inlet Node Name ///////////////////////////////////////////////// | ||
| 41 |
1/1✓ Branch 1 taken 205 times.
|
205 | temp = modelObject.inletModelObject(); |
| 42 |
1/2✓ Branch 0 taken 205 times.
✗ Branch 1 not taken.
|
205 | if (temp) { |
| 43 |
2/2✓ Branch 1 taken 205 times.
✓ Branch 4 taken 205 times.
|
205 | optS = temp->name(); |
| 44 |
1/2✓ Branch 0 taken 205 times.
✗ Branch 1 not taken.
|
205 | if (optS) { |
| 45 |
2/2✓ Branch 1 taken 205 times.
✓ Branch 4 taken 205 times.
|
205 | idfObject.setString(openstudio::AirLoopHVAC_ZoneSplitterFields::InletNodeName, *optS); |
| 46 | } | ||
| 47 | } | ||
| 48 | /////////////////////////////////////////////////////////////////////////// | ||
| 49 | // Field: Outlet 1-N Node Name ////////////////////////////////////////////// | ||
| 50 |
1/1✓ Branch 1 taken 205 times.
|
205 | std::vector<ModelObject> outletModelObjects = modelObject.outletModelObjects(); |
| 51 | 205 | int i = 2; | |
| 52 |
2/2✓ Branch 4 taken 220 times.
✓ Branch 5 taken 205 times.
|
425 | for (const auto& outletModelObject : outletModelObjects) { |
| 53 | 220 | if (OptionalAirTerminalSingleDuctConstantVolumeNoReheat airTerminal = | |
| 54 |
2/3✓ Branch 1 taken 220 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 220 times.
|
440 | outletModelObject.optionalCast<AirTerminalSingleDuctConstantVolumeNoReheat>()) { |
| 55 | ✗ | temp = airTerminal->outletModelObject(); | |
| 56 | ✗ | if (temp) { | |
| 57 | ✗ | optS = temp->name().get(); | |
| 58 | ✗ | if (optS) { | |
| 59 | ✗ | idfObject.setString(i, *optS); | |
| 60 | } | ||
| 61 | } | ||
| 62 | } else { | ||
| 63 |
3/3✓ Branch 1 taken 220 times.
✓ Branch 4 taken 220 times.
✓ Branch 7 taken 220 times.
|
220 | s = outletModelObject.name().get(); |
| 64 |
1/1✓ Branch 1 taken 220 times.
|
220 | idfObject.setString(i, s); |
| 65 | 220 | } | |
| 66 | 220 | i++; | |
| 67 | } | ||
| 68 | |||
| 69 |
1/1✓ Branch 1 taken 205 times.
|
410 | return boost::optional<IdfObject>(idfObject); |
| 70 | 205 | } | |
| 71 | |||
| 72 | } // namespace energyplus | ||
| 73 | |||
| 74 | } // namespace openstudio | ||
| 75 |