GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 58 / 0 / 58
Functions: 100.0% 1 / 0 / 1
Branches: 92.0% 103 / 0 / 112

src/energyplus/ForwardTranslator/ForwardTranslateAirLoopHVACDedicatedOutdoorAirSystem.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
8 #include "../../model/Model.hpp"
9 #include "../../model/AirLoopHVACDedicatedOutdoorAirSystem.hpp"
10 #include "../../model/AirLoopHVACDedicatedOutdoorAirSystem_Impl.hpp"
11 #include "../../model/AirLoopHVACOutdoorAirSystem.hpp"
12 #include "../../model/Schedule.hpp"
13 #include "../../model/AirLoopHVAC.hpp"
14 #include "../../model/Node.hpp"
15 #include "../../model/Node_Impl.hpp"
16 #include "../../model/AirLoopHVACZoneMixer.hpp"
17 #include "../../model/AirLoopHVACZoneSplitter.hpp"
18 #include "../../model/HeatExchangerAirToAirSensibleAndLatent.hpp"
19 #include "../../model/HeatExchangerAirToAirSensibleAndLatent_Impl.hpp"
20
21 #include <utilities/idd/AirLoopHVAC_DedicatedOutdoorAirSystem_FieldEnums.hxx>
22 #include <utilities/idd/AirLoopHVAC_Mixer_FieldEnums.hxx>
23 #include <utilities/idd/AirLoopHVAC_Splitter_FieldEnums.hxx>
24 #include <utilities/idd/IddEnums.hxx>
25 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
26
27 using namespace openstudio::model;
28
29 namespace openstudio {
30
31 namespace energyplus {
32
33 boost::optional<IdfObject>
34 5 ForwardTranslator::translateAirLoopHVACDedicatedOutdoorAirSystem(model::AirLoopHVACDedicatedOutdoorAirSystem& modelObject) {
35 5 boost::optional<double> value;
36
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 IdfObject idfObject(IddObjectType::AirLoopHVAC_DedicatedOutdoorAirSystem);
37
38
1/1
✓ Branch 1 taken 5 times.
5 m_idfObjects.push_back(idfObject);
39
40 // Name
41
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 std::string name = modelObject.name().get();
42
1/1
✓ Branch 1 taken 5 times.
5 idfObject.setString(openstudio::AirLoopHVAC_DedicatedOutdoorAirSystemFields::Name, name);
43
44 // Availability Schedule Name
45
1/1
✓ Branch 1 taken 5 times.
5 Schedule schedule = modelObject.availabilitySchedule();
46
2/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
10 if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule)) {
47
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
5 idfObject.setString(AirLoopHVAC_DedicatedOutdoorAirSystemFields::AvailabilityScheduleName, _schedule->name().get());
48 5 }
49
50 // AirLoopHVAC:OutdoorAirSystem Name
51
1/1
✓ Branch 1 taken 5 times.
5 AirLoopHVACOutdoorAirSystem oaSystem = modelObject.airLoopHVACOutdoorAirSystem();
52
2/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
10 if (boost::optional<IdfObject> _oaSystem = translateAndMapModelObject(oaSystem)) {
53
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
5 idfObject.setString(AirLoopHVAC_DedicatedOutdoorAirSystemFields::AirLoopHVAC_OutdoorAirSystemName, _oaSystem->name().get());
54 5 }
55
56 // AirLoopHVAC:Mixer Name
57
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 std::string mixerName(modelObject.nameString() + " Mixer");
58
1/1
✓ Branch 1 taken 5 times.
5 idfObject.setString(AirLoopHVAC_DedicatedOutdoorAirSystemFields::AirLoopHVAC_MixerName, mixerName);
59
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 IdfObject idfMixer(openstudio::IddObjectType::AirLoopHVAC_Mixer);
60
1/1
✓ Branch 1 taken 5 times.
5 idfMixer.setString(AirLoopHVAC_MixerFields::Name, mixerName);
61
62 5 boost::optional<std::string> outletNodeName;
63
64
5/5
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 15 taken 13 times.
✓ Branch 16 taken 5 times.
23 for (const auto& oaComponent : oaSystem.oaComponents()) {
65
3/3
✓ Branch 1 taken 13 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 12 times.
26 if (boost::optional<HeatExchangerAirToAirSensibleAndLatent> hx = oaComponent.optionalCast<HeatExchangerAirToAirSensibleAndLatent>()) {
66
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<ModelObject> secondaryAirInletModelObject = hx->secondaryAirInletModelObject()) {
67
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 outletNodeName = secondaryAirInletModelObject->name();
68 1 }
69 13 }
70 5 }
71
72
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 1 time.
5 if (!outletNodeName) {
73
4/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
4 outletNodeName = idfMixer.name().get() + " Outlet";
74 }
75
76
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 idfMixer.setString(AirLoopHVAC_MixerFields::OutletNodeName, outletNodeName.get());
77
78 // AirLoopHVAC:Splitter Name
79
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 std::string splitterName(modelObject.nameString() + " Splitter");
80
1/1
✓ Branch 1 taken 5 times.
5 idfObject.setString(AirLoopHVAC_DedicatedOutdoorAirSystemFields::AirLoopHVAC_SplitterName, splitterName);
81
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 IdfObject idfSplitter(openstudio::IddObjectType::AirLoopHVAC_Splitter);
82
1/1
✓ Branch 1 taken 5 times.
5 idfSplitter.setString(AirLoopHVAC_SplitterFields::Name, splitterName);
83
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
5 idfSplitter.setString(AirLoopHVAC_SplitterFields::InletNodeName, oaSystem.outdoorAirModelObject().get().nameString());
84
85 // Preheat Design Temperature
86
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
10 if ((value = modelObject.preheatDesignTemperature())) {
87
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 idfObject.setDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PreheatDesignTemperature, value.get());
88 }
89
90 // Preheat Design Humidity Ratio
91
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
10 if ((value = modelObject.preheatDesignHumidityRatio())) {
92
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 idfObject.setDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PreheatDesignHumidityRatio, value.get());
93 }
94
95 // Precool Design Temperature
96
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
10 if ((value = modelObject.precoolDesignTemperature())) {
97
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 idfObject.setDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PrecoolDesignTemperature, value.get());
98 }
99
100 // Precool Design Humidity Ratio
101
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
10 if ((value = modelObject.precoolDesignHumidityRatio())) {
102
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 idfObject.setDouble(AirLoopHVAC_DedicatedOutdoorAirSystemFields::PrecoolDesignHumidityRatio, value.get());
103 }
104
105 // Number of AirLoopHVAC
106
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 idfObject.setInt(AirLoopHVAC_DedicatedOutdoorAirSystemFields::NumberofAirLoopHVAC, modelObject.numberofAirLoops());
107
108 // AirLoopHVAC x Name
109 5 boost::optional<AirLoopHVACOutdoorAirSystem> oas;
110
3/3
✓ Branch 1 taken 5 times.
✓ Branch 8 taken 3 times.
✓ Branch 9 taken 5 times.
8 for (const auto& airLoop : modelObject.airLoops()) {
111
1/1
✓ Branch 1 taken 3 times.
3 auto eg = idfObject.pushExtensibleGroup();
112
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 eg.setString(AirLoopHVAC_DedicatedOutdoorAirSystemExtensibleFields::AirLoopHVACName, airLoop.nameString());
113
114
1/1
✓ Branch 1 taken 3 times.
3 oas = airLoop.airLoopHVACOutdoorAirSystem();
115
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
3 OS_ASSERT(oas);
116
117 // AirLoopHVAC:Mixer Name
118
1/1
✓ Branch 1 taken 3 times.
3 auto egMixer = idfMixer.pushExtensibleGroup();
119
5/5
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
3 egMixer.setString(AirLoopHVAC_MixerExtensibleFields::InletNodeName, oas->outboardReliefNode().get().nameString());
120
121 // AirLoopHVAC:Splitter Name
122
1/1
✓ Branch 1 taken 3 times.
3 auto egSplitter = idfSplitter.pushExtensibleGroup();
123
5/5
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
3 egSplitter.setString(AirLoopHVAC_SplitterExtensibleFields::OutletNodeName, oas->outboardOANode().get().nameString());
124 8 }
125
126
1/1
✓ Branch 1 taken 5 times.
5 m_idfObjects.push_back(idfMixer);
127
1/1
✓ Branch 1 taken 5 times.
5 m_idfObjects.push_back(idfSplitter);
128
129
1/1
✓ Branch 1 taken 5 times.
10 return boost::optional<IdfObject>(idfObject);
130 5 }
131
132 } // namespace energyplus
133
134 } // namespace openstudio
135