GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 96.4% 54 / 0 / 56
Functions: 100.0% 1 / 0 / 1
Branches: 83.0% 88 / 0 / 106

src/energyplus/ForwardTranslator/ForwardTranslateFanVariableVolume.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/FanVariableVolume.hpp"
9 #include "../../model/FanVariableVolume_Impl.hpp"
10 #include "../../model/AirLoopHVAC.hpp"
11 #include "../../model/AirLoopHVAC_Impl.hpp"
12 #include "../../model/Schedule.hpp"
13 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
14 #include "../../utilities/idf/Workspace.hpp"
15 #include "../../utilities/idf/WorkspaceObjectOrder.hpp"
16 #include "../../utilities/core/Logger.hpp"
17 #include <utilities/idd/Fan_VariableVolume_FieldEnums.hxx>
18 #include <utilities/idd/IddEnums.hxx>
19
20 using namespace openstudio::model;
21
22 namespace openstudio {
23
24 namespace energyplus {
25
26 7 boost::optional<IdfObject> ForwardTranslator::translateFanVariableVolume(FanVariableVolume& modelObject) {
27 7 OptionalString s;
28 7 OptionalDouble d;
29 7 OptionalModelObject temp;
30
31 // Create a new IddObjectType::Fan_VariableVolume
32
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 IdfObject idfObject(IddObjectType::Fan_VariableVolume);
33
34
1/1
✓ Branch 1 taken 7 times.
7 m_idfObjects.push_back(idfObject);
35
36 // Field: Name ////////////////////////////////////////////////////////////
37
1/1
✓ Branch 1 taken 7 times.
7 s = modelObject.name();
38
1/2
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
7 if (s) {
39
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setName(*s);
40 }
41
42 // AvailabilityScheduleName
43
44
3/3
✓ Branch 1 taken 7 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 1 time.
14 if (boost::optional<model::AirLoopHVAC> airLoopHVAC = modelObject.airLoopHVAC()) {
45
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 Schedule sched = airLoopHVAC->availabilitySchedule();
46
1/1
✓ Branch 1 taken 6 times.
6 boost::optional<IdfObject> schedIdf = translateAndMapModelObject(sched);
47
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (schedIdf) {
48
4/4
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
6 idfObject.setString(Fan_VariableVolumeFields::AvailabilityScheduleName, schedIdf->name().get());
49 }
50 6 } else {
51
1/1
✓ Branch 1 taken 1 time.
1 Schedule sched = modelObject.availabilitySchedule();
52
1/1
✓ Branch 1 taken 1 time.
1 translateAndMapModelObject(sched);
53
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(Fan_VariableVolumeFields::AvailabilityScheduleName, sched.name().get());
54 8 }
55
56 // Fan Total Efficiency ///////////////////////////////////////////////////
57
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(openstudio::Fan_VariableVolumeFields::FanTotalEfficiency, modelObject.fanEfficiency());
58
59 // Pressure Rise //////////////////////////////////////////////////////////
60
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(openstudio::Fan_VariableVolumeFields::PressureRise, modelObject.pressureRise());
61
62 // Maximum Flow Rate //////////////////////////////////////////////////////
63
2/3
✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
7 if (modelObject.isMaximumFlowRateAutosized()) {
64
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
14 idfObject.setString(openstudio::Fan_VariableVolumeFields::MaximumFlowRate, "AutoSize");
65 ✗ } else if ((d = modelObject.maximumFlowRate())) {
66 ✗ idfObject.setDouble(openstudio::Fan_VariableVolumeFields::MaximumFlowRate, d.get());
67 }
68
69 // FanPowerMinimumFlowRateInputMethod
70
3/4
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 8 taken 7 times.
✗ Branch 9 not taken.
14 if ((s = modelObject.fanPowerMinimumFlowRateInputMethod())) {
71
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setString(Fan_VariableVolumeFields::FanPowerMinimumFlowRateInputMethod, s.get());
72 }
73
74 // FanPowerMinimumFlowFraction
75
3/4
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✗ Branch 8 not taken.
14 if ((d = modelObject.fanPowerMinimumFlowFraction())) {
76
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(Fan_VariableVolumeFields::FanPowerMinimumFlowFraction, d.get());
77 }
78
79 // FanPowerMinimumAirFlowRate
80
81
2/3
✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
14 if ((d = modelObject.fanPowerMinimumAirFlowRate())) {
82
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(Fan_VariableVolumeFields::FanPowerMinimumAirFlowRate, d.get());
83 }
84
85 // Motor Efficiency ///////////////////////////////////////////////////////
86
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(openstudio::Fan_VariableVolumeFields::MotorEfficiency, modelObject.motorEfficiency());
87
88 // Motor In Airstream Fraction ////////////////////////////////////////////
89
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(openstudio::Fan_VariableVolumeFields::MotorInAirstreamFraction, modelObject.motorInAirstreamFraction());
90
91 // FanPowerCoefficient1
92
93
2/3
✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
14 if ((d = modelObject.fanPowerCoefficient1())) {
94
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(Fan_VariableVolumeFields::FanPowerCoefficient1, d.get());
95 }
96
97 // FanPowerCoefficient2
98
99
2/3
✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
14 if ((d = modelObject.fanPowerCoefficient2())) {
100
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(Fan_VariableVolumeFields::FanPowerCoefficient2, d.get());
101 }
102
103 // FanPowerCoefficient3
104
105
2/3
✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
14 if ((d = modelObject.fanPowerCoefficient3())) {
106
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(Fan_VariableVolumeFields::FanPowerCoefficient3, d.get());
107 }
108
109 // FanPowerCoefficient4
110
111
2/3
✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
14 if ((d = modelObject.fanPowerCoefficient4())) {
112
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(Fan_VariableVolumeFields::FanPowerCoefficient4, d.get());
113 }
114
115 // FanPowerCoefficient5
116
117
2/3
✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
14 if ((d = modelObject.fanPowerCoefficient5())) {
118
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(Fan_VariableVolumeFields::FanPowerCoefficient5, d.get());
119 }
120
121 // Air Inlet Node Name ////////////////////////////////////////////////////
122
1/1
✓ Branch 1 taken 7 times.
7 temp = modelObject.inletModelObject();
123
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1 time.
7 if (temp) {
124
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 s = temp->name();
125
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (s) {
126
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 idfObject.setString(openstudio::Fan_VariableVolumeFields::AirInletNodeName, *s);
127 }
128 }
129
130 // Air Outlet Node Name ///////////////////////////////////////////////////
131
1/1
✓ Branch 1 taken 7 times.
7 temp = modelObject.outletModelObject();
132
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1 time.
7 if (temp) {
133
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 s = temp->name();
134
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (s) {
135
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 idfObject.setString(openstudio::Fan_VariableVolumeFields::AirOutletNodeName, *s);
136 }
137 }
138
139 // End Use Subcategory
140
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setString(Fan_VariableVolumeFields::EndUseSubcategory, modelObject.endUseSubcategory());
141
142
1/1
✓ Branch 1 taken 7 times.
14 return idfObject;
143 7 }
144
145 } // namespace energyplus
146
147 } // namespace openstudio
148