GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 85.0% 51 / 0 / 60
Functions: 100.0% 1 / 0 / 1
Branches: 68.0% 70 / 0 / 103

src/energyplus/ForwardTranslator/ForwardTranslateEvaporativeCoolerDirectResearchSpecial.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/EvaporativeCoolerDirectResearchSpecial.hpp"
9 #include "../../model/EvaporativeCoolerDirectResearchSpecial_Impl.hpp"
10 #include "../../model/Node.hpp"
11 #include "../../model/Node_Impl.hpp"
12 #include "../../model/Curve.hpp"
13 #include "../../model/Curve_Impl.hpp"
14 #include "../../model/Schedule.hpp"
15 #include "../../utilities/idf/Workspace.hpp"
16 #include "../../utilities/core/Logger.hpp"
17 #include <utilities/idd/EvaporativeCooler_Direct_ResearchSpecial_FieldEnums.hxx>
18 #include <utilities/idd/IddEnums.hxx>
19
20 using namespace openstudio::model;
21
22 namespace openstudio {
23
24 namespace energyplus {
25
26 33 boost::optional<IdfObject> ForwardTranslator::translateEvaporativeCoolerDirectResearchSpecial(EvaporativeCoolerDirectResearchSpecial& modelObject) {
27 33 OptionalString s;
28 33 OptionalDouble optD;
29 33 OptionalModelObject temp;
30 double value;
31
32
2/2
✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
33 IdfObject idfObject(IddObjectType::EvaporativeCooler_Direct_ResearchSpecial);
33
34
1/1
✓ Branch 1 taken 33 times.
33 m_idfObjects.push_back(idfObject);
35
36 // Name
37
1/1
✓ Branch 1 taken 33 times.
33 s = modelObject.name();
38
1/2
✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
33 if (s) {
39
2/2
✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
33 idfObject.setName(*s);
40 }
41
42 // AvailabilityScheduleName
43
1/1
✓ Branch 1 taken 33 times.
33 Schedule sched = modelObject.availableSchedule();
44
1/1
✓ Branch 1 taken 33 times.
33 translateAndMapModelObject(sched);
45
3/3
✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
✓ Branch 7 taken 33 times.
33 idfObject.setString(EvaporativeCooler_Direct_ResearchSpecialFields::AvailabilityScheduleName, sched.name().get());
46
47 // CoolerEffectiveness
48
1/1
✓ Branch 1 taken 33 times.
33 value = modelObject.coolerDesignEffectiveness();
49
1/1
✓ Branch 1 taken 33 times.
33 idfObject.setDouble(EvaporativeCooler_Direct_ResearchSpecialFields::CoolerDesignEffectiveness, value);
50
51 // RecirculatingWaterPumpPowerConsumption
52
2/3
✓ Branch 1 taken 33 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 33 times.
33 if (modelObject.isRecirculatingWaterPumpPowerConsumptionAutosized()) {
53 ✗ idfObject.setString(EvaporativeCooler_Direct_ResearchSpecialFields::RecirculatingWaterPumpDesignPower, "autosize");
54
2/3
✓ Branch 1 taken 33 times.
✓ Branch 3 taken 33 times.
✗ Branch 4 not taken.
66 } else if ((optD = modelObject.recirculatingWaterPumpPowerConsumption())) {
55
2/2
✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
33 idfObject.setDouble(EvaporativeCooler_Direct_ResearchSpecialFields::RecirculatingWaterPumpDesignPower, optD.get());
56 }
57
58 // Primary Air Design Flow Rate
59
2/3
✓ Branch 1 taken 33 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 33 times.
33 if (modelObject.isPrimaryAirDesignFlowRateAutosized()) {
60 ✗ idfObject.setString(EvaporativeCooler_Direct_ResearchSpecialFields::PrimaryAirDesignFlowRate, "Autosize");
61
3/3
✓ Branch 1 taken 33 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 32 times.
66 } else if ((optD = modelObject.primaryAirDesignFlowRate())) {
62
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(EvaporativeCooler_Direct_ResearchSpecialFields::PrimaryAirDesignFlowRate, optD.get());
63 }
64
65 // AirInletNodeName
66
1/1
✓ Branch 1 taken 33 times.
33 temp = modelObject.inletModelObject();
67
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 7 times.
33 if (temp) {
68
2/2
✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
26 s = temp->name();
69
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
26 if (s) {
70
2/2
✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
26 idfObject.setString(EvaporativeCooler_Direct_ResearchSpecialFields::AirInletNodeName, *s);
71 }
72 }
73
74 // AirOutletNodeName
75
1/1
✓ Branch 1 taken 33 times.
33 temp = modelObject.outletModelObject();
76
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 7 times.
33 if (temp) {
77
2/2
✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
26 s = temp->name();
78
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
26 if (s) {
79
2/2
✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
26 idfObject.setString(EvaporativeCooler_Direct_ResearchSpecialFields::AirOutletNodeName, *s);
80 }
81 }
82
83 // SensorNodeName
84
2/2
✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
33 temp = modelObject.sensorNode();
85
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 7 times.
33 if (temp) {
86
2/2
✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
26 s = temp->name();
87
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
26 if (s) {
88
2/2
✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
26 idfObject.setString(EvaporativeCooler_Direct_ResearchSpecialFields::SensorNodeName, *s);
89 }
90 }
91
92 // DriftLossFraction
93
1/1
✓ Branch 1 taken 33 times.
33 value = modelObject.driftLossFraction();
94
1/1
✓ Branch 1 taken 33 times.
33 idfObject.setDouble(EvaporativeCooler_Direct_ResearchSpecialFields::DriftLossFraction, value);
95
96 // BlowdownConcentrationRatio
97
1/1
✓ Branch 1 taken 33 times.
33 value = modelObject.blowdownConcentrationRatio();
98
1/2
✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
33 if (value < 2) {
99
1/1
✓ Branch 1 taken 33 times.
33 idfObject.setDouble(EvaporativeCooler_Direct_ResearchSpecialFields::BlowdownConcentrationRatio, 2.0);
100 } else {
101 ✗ idfObject.setDouble(EvaporativeCooler_Direct_ResearchSpecialFields::BlowdownConcentrationRatio, value);
102 }
103
104 // EffectivenessFlowRatioModifierCurveName
105
2/3
✓ Branch 1 taken 33 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 33 times.
66 if (auto curve = modelObject.effectivenessFlowRatioModifierCurve()) {
106 ✗ auto _curve = translateAndMapModelObject(curve.get());
107 ✗ OS_ASSERT(_curve);
108 ✗ idfObject.setString(EvaporativeCooler_Direct_ResearchSpecialFields::EffectivenessFlowRatioModifierCurveName, _curve->name().get());
109 33 }
110
111 // WaterPumpPowerSizingFactor
112
1/1
✓ Branch 1 taken 33 times.
33 value = modelObject.waterPumpPowerSizingFactor();
113
1/1
✓ Branch 1 taken 33 times.
33 idfObject.setDouble(EvaporativeCooler_Direct_ResearchSpecialFields::WaterPumpPowerSizingFactor, value);
114
115 // WaterPumpPowerModifierCurveName
116
2/3
✓ Branch 1 taken 33 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 33 times.
66 if (auto curve = modelObject.waterPumpPowerModifierCurve()) {
117 ✗ auto _curve = translateAndMapModelObject(curve.get());
118 ✗ OS_ASSERT(_curve);
119 ✗ idfObject.setString(EvaporativeCooler_Direct_ResearchSpecialFields::WaterPumpPowerModifierCurveName, _curve->name().get());
120 33 }
121
122 // Evaporative Operation Minimum Drybulb Temperature (Double)
123
2/2
✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
33 idfObject.setDouble(EvaporativeCooler_Direct_ResearchSpecialFields::EvaporativeOperationMinimumDrybulbTemperature,
124 modelObject.evaporativeOperationMinimumDrybulbTemperature());
125
126 // Evaporative Operation Maximum Limit Wetbulb Temperature (Double)
127
2/2
✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
33 idfObject.setDouble(EvaporativeCooler_Direct_ResearchSpecialFields::EvaporativeOperationMaximumLimitWetbulbTemperature,
128 modelObject.evaporativeOperationMaximumLimitWetbulbTemperature());
129
130 // Evaporative Operation Maximum Limit Drybulb Temperature (Double)
131
2/2
✓ Branch 1 taken 33 times.
✓ Branch 4 taken 33 times.
33 idfObject.setDouble(EvaporativeCooler_Direct_ResearchSpecialFields::EvaporativeOperationMaximumLimitDrybulbTemperature,
132 modelObject.evaporativeOperationMaximumLimitDrybulbTemperature());
133
134
1/1
✓ Branch 1 taken 33 times.
66 return boost::optional<IdfObject>(idfObject);
135 33 }
136
137 } // namespace energyplus
138
139 } // namespace openstudio
140