GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 70.2% 40 / 0 / 57
Functions: 100.0% 1 / 0 / 1
Branches: 37.8% 59 / 0 / 156

src/energyplus/ForwardTranslator/ForwardTranslateFanZoneExhaust.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/FanZoneExhaust.hpp"
8 #include "../../model/FanZoneExhaust_Impl.hpp"
9 #include "../../model/Node.hpp"
10 #include "../../model/Node_Impl.hpp"
11 #include "../../model/Model.hpp"
12 #include "../../model/Model_Impl.hpp"
13 #include "../../model/Schedule.hpp"
14 #include "../../model/Schedule_Impl.hpp"
15 #include <utilities/idd/IddFactory.hxx>
16 #include <utilities/idd/Fan_ZoneExhaust_FieldEnums.hxx>
17 #include "../../utilities/idd/IddEnums.hpp"
18 #include <utilities/idd/IddEnums.hxx>
19
20 using namespace openstudio::model;
21
22 //using namespace std;
23
24 namespace openstudio {
25
26 namespace energyplus {
27
28 2 boost::optional<IdfObject> ForwardTranslator::translateFanZoneExhaust(FanZoneExhaust& modelObject) {
29 //setup boost optionals to use to store get method returns
30 2 boost::optional<std::string> s;
31 2 boost::optional<double> value;
32
33 // Make sure the modelObject gets ut into the map, and the new idfObject gets put into the final file.
34 // Also sets the idfObjects name
35
36
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 IdfObject idfObject = createRegisterAndNameIdfObject(IddObjectType::Fan_ZoneExhaust, modelObject);
37
38 // Model Name (A2)
39 //std::string baseName = modelObject.name().get();
40
41 // A3, Field Availability Schedule Name
42
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<Schedule> availabilitySchedule = modelObject.availabilitySchedule();
43
44
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (availabilitySchedule) {
45 ✗ boost::optional<IdfObject> _availabilitySchedule = translateAndMapModelObject(availabilitySchedule.get());
46
47 ✗ if (_availabilitySchedule && _availabilitySchedule->name()) {
48 ✗ idfObject.setString(Fan_ZoneExhaustFields::AvailabilityScheduleName, _availabilitySchedule->name().get());
49 }
50 ✗ }
51
52 // N1, Field Fan Efficiency
53
54
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 value = modelObject.fanEfficiency();
55
56
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (value) {
57
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 idfObject.setDouble(Fan_ZoneExhaustFields::FanTotalEfficiency, *value);
58 }
59
60 // N2, Field Pressure Rise
61
62
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 value = modelObject.pressureRise();
63
64
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (value) {
65
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 idfObject.setDouble(Fan_ZoneExhaustFields::PressureRise, *value);
66 }
67
68 // N3, Field Maximum Flow Rate
69
70
1/1
✓ Branch 1 taken 2 times.
2 value = modelObject.maximumFlowRate();
71
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (value) {
72 ✗ idfObject.setDouble(Fan_ZoneExhaustFields::MaximumFlowRate, value.get());
73 }
74
75 // A4, Field Air Inlet Node Name
76
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<Node> inletNode = modelObject.inletNode();
77
78
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (inletNode) {
79
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<Node> _inletNode = modelObject.inletNode();
80
81
6/12
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 2 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
6 if (_inletNode && _inletNode->name()) {
82
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(Fan_ZoneExhaustFields::AirInletNodeName, _inletNode->name().get());
83 }
84 2 }
85
86 // A5, Field Air Outlet Node Name
87
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<Node> outletNode = modelObject.outletNode();
88
89
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (outletNode) {
90
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<Node> _outletNode = modelObject.outletNode();
91
92
6/12
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 2 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
6 if (_outletNode && _outletNode->name()) {
93
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(Fan_ZoneExhaustFields::AirOutletNodeName, _outletNode->name().get());
94 }
95 2 }
96
97 // A6 , Field End-Use Subcategory
98
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 s = modelObject.endUseSubcategory();
99
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (s) {
100
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 idfObject.setString(Fan_ZoneExhaustFields::EndUseSubcategory, *s);
101 }
102
103 // A7, Field Flow Fraction Schedule Name
104
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<Schedule> flowFractionSchedule = modelObject.flowFractionSchedule();
105
106
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (flowFractionSchedule) {
107 ✗ boost::optional<IdfObject> _flowFractionSchedule = translateAndMapModelObject(flowFractionSchedule.get());
108
109 ✗ if (_flowFractionSchedule && _flowFractionSchedule->name()) {
110 ✗ idfObject.setString(Fan_ZoneExhaustFields::FlowFractionScheduleName, _flowFractionSchedule->name().get());
111 }
112 ✗ }
113
114 // A8 , Field System Availability Manager Coupling Mode
115
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 s = modelObject.systemAvailabilityManagerCouplingMode();
116
117
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (s) {
118
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 idfObject.setString(Fan_ZoneExhaustFields::SystemAvailabilityManagerCouplingMode, *s);
119 }
120
121 // A9, Field Minimum Zone Temperature Limit Schedule Name
122
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<Schedule> minimumZoneTemperatureLimitSchedule = modelObject.minimumZoneTemperatureLimitSchedule();
123
124
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (minimumZoneTemperatureLimitSchedule) {
125 ✗ boost::optional<IdfObject> _minimumZoneTemperatureLimitSchedule = translateAndMapModelObject(minimumZoneTemperatureLimitSchedule.get());
126
127 ✗ if (_minimumZoneTemperatureLimitSchedule && _minimumZoneTemperatureLimitSchedule->name()) {
128 ✗ idfObject.setString(Fan_ZoneExhaustFields::MinimumZoneTemperatureLimitScheduleName, _minimumZoneTemperatureLimitSchedule->name().get());
129 }
130 ✗ }
131
132 // A10, Field Balanced Exhaust Fraction Schedule Name
133
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<Schedule> balancedExhaustFractionSchedule = modelObject.balancedExhaustFractionSchedule();
134
135
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (balancedExhaustFractionSchedule) {
136 ✗ boost::optional<IdfObject> _balancedExhaustFractionSchedule = translateAndMapModelObject(balancedExhaustFractionSchedule.get());
137
138 ✗ if (_balancedExhaustFractionSchedule && _balancedExhaustFractionSchedule->name()) {
139 ✗ idfObject.setString(Fan_ZoneExhaustFields::BalancedExhaustFractionScheduleName, _balancedExhaustFractionSchedule->name().get());
140 }
141 ✗ }
142
143
1/1
✓ Branch 1 taken 2 times.
4 return idfObject;
144 2 }
145
146 } // namespace energyplus
147
148 } // namespace openstudio
149