GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 88.6% 93 / 0 / 105
Functions: 100.0% 1 / 0 / 1
Branches: 60.2% 115 / 0 / 191

src/energyplus/ReverseTranslator/ReverseTranslateCoilCoolingDXCurveFitSpeed.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 "../ReverseTranslator.hpp"
7
8 #include "../../model/CoilCoolingDXCurveFitSpeed.hpp"
9 #include "../../model/CoilCoolingDXCurveFitSpeed_Impl.hpp"
10
11 #include "../../model/Curve.hpp"
12 #include "../../model/Curve_Impl.hpp"
13
14 #include <utilities/idd/Coil_Cooling_DX_CurveFit_Speed_FieldEnums.hxx>
15 #include "../../utilities/idd/IddEnums.hpp"
16 #include <utilities/idd/IddEnums.hxx>
17
18 #include "../../utilities/core/Assert.hpp"
19
20 using namespace openstudio::model;
21
22 namespace openstudio {
23
24 namespace energyplus {
25
26 2 OptionalModelObject ReverseTranslator::translateCoilCoolingDXCurveFitSpeed(const WorkspaceObject& workspaceObject) {
27
4/5
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
2 if (workspaceObject.iddObject().type() != IddObjectType::Coil_Cooling_DX_CurveFit_Speed) {
28 ✗ LOG(Error, "WorkspaceObject is not IddObjectType: CoilCoolingDXCurveFitSpeed");
29 ✗ return boost::none;
30 }
31
32 2 OptionalString s;
33 2 OptionalDouble d;
34 2 OptionalWorkspaceObject target;
35
36
1/1
✓ Branch 1 taken 2 times.
2 openstudio::model::CoilCoolingDXCurveFitSpeed speed(m_model);
37
38 4 if ((target =
39
2/3
✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
4 workspaceObject.getTarget(openstudio::Coil_Cooling_DX_CurveFit_SpeedFields::TotalCoolingCapacityModifierFunctionofTemperatureCurveName))) {
40
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
41
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (modelObject) {
42
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
4 if (auto optCurve = modelObject->optionalCast<Curve>()) {
43
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setTotalCoolingCapacityModifierFunctionofTemperatureCurve(optCurve.get());
44 2 }
45 }
46 2 }
47
48
2/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
4 if ((target = workspaceObject.getTarget(
49 2 openstudio::Coil_Cooling_DX_CurveFit_SpeedFields::TotalCoolingCapacityModifierFunctionofAirFlowFractionCurveName))) {
50
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
51
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (modelObject) {
52
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
4 if (auto optCurve = modelObject->optionalCast<Curve>()) {
53
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setTotalCoolingCapacityModifierFunctionofAirFlowFractionCurve(optCurve.get());
54 2 }
55 }
56 2 }
57
58 4 if ((target =
59
2/3
✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
4 workspaceObject.getTarget(openstudio::Coil_Cooling_DX_CurveFit_SpeedFields::EnergyInputRatioModifierFunctionofTemperatureCurveName))) {
60
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
61
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (modelObject) {
62
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
4 if (auto optCurve = modelObject->optionalCast<Curve>()) {
63
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setEnergyInputRatioModifierFunctionofTemperatureCurve(optCurve.get());
64 2 }
65 }
66 2 }
67
68 4 if ((target =
69
2/3
✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
4 workspaceObject.getTarget(openstudio::Coil_Cooling_DX_CurveFit_SpeedFields::EnergyInputRatioModifierFunctionofAirFlowFractionCurveName))) {
70
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
71
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (modelObject) {
72
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
4 if (auto optCurve = modelObject->optionalCast<Curve>()) {
73
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setEnergyInputRatioModifierFunctionofAirFlowFractionCurve(optCurve.get());
74 2 }
75 }
76 2 }
77
78
2/3
✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
4 if ((target = workspaceObject.getTarget(openstudio::Coil_Cooling_DX_CurveFit_SpeedFields::PartLoadFractionCorrelationCurveName))) {
79
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
80
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (modelObject) {
81
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
4 if (auto optCurve = modelObject->optionalCast<Curve>()) {
82
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setPartLoadFractionCorrelationCurve(optCurve.get());
83 2 }
84 }
85 2 }
86
87
2/3
✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
4 if ((target = workspaceObject.getTarget(openstudio::Coil_Cooling_DX_CurveFit_SpeedFields::WasteHeatModifierFunctionofTemperatureCurveName))) {
88
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
89
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (modelObject) {
90
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
4 if (auto optCurve = modelObject->optionalCast<Curve>()) {
91
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setWasteHeatModifierFunctionofTemperatureCurve(optCurve.get());
92 2 }
93 }
94 2 }
95
96
1/1
✓ Branch 1 taken 2 times.
2 s = workspaceObject.name();
97
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (s) {
98
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setName(*s);
99 }
100
101
1/1
✓ Branch 1 taken 2 times.
2 d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_SpeedFields::GrossTotalCoolingCapacityFraction);
102
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (d) {
103
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setGrossTotalCoolingCapacityFraction(*d);
104 }
105
106
1/1
✓ Branch 1 taken 2 times.
2 d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_SpeedFields::EvaporatorAirFlowRateFraction);
107
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (d) {
108
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setEvaporatorAirFlowRateFraction(*d);
109 }
110
111
1/1
✓ Branch 1 taken 2 times.
2 d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_SpeedFields::CondenserAirFlowRateFraction);
112
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (d) {
113
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setCondenserAirFlowRateFraction(*d);
114 }
115
116
1/1
✓ Branch 1 taken 2 times.
2 d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_SpeedFields::GrossSensibleHeatRatio);
117
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (d) {
118 ✗ speed.setGrossSensibleHeatRatio(*d);
119 } else {
120
1/1
✓ Branch 1 taken 2 times.
2 speed.autosizeGrossSensibleHeatRatio();
121 }
122
123
1/1
✓ Branch 1 taken 2 times.
2 d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_SpeedFields::GrossCoolingCOP);
124
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (d) {
125
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setGrossCoolingCOP(*d);
126 }
127
128
1/1
✓ Branch 1 taken 2 times.
2 d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_SpeedFields::ActiveFractionofCoilFaceArea);
129
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (d) {
130
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setActiveFractionofCoilFaceArea(*d);
131 }
132
133
1/1
✓ Branch 1 taken 2 times.
2 d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_SpeedFields::RatedEvaporatorFanPowerPerVolumeFlowRate2017);
134
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (d) {
135
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setRatedEvaporatorFanPowerPerVolumeFlowRate2017(*d);
136 }
137
138
1/1
✓ Branch 1 taken 2 times.
2 d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_SpeedFields::RatedEvaporatorFanPowerPerVolumeFlowRate2023);
139
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (d) {
140 ✗ speed.setRatedEvaporatorFanPowerPerVolumeFlowRate2023(*d);
141 }
142
143
1/1
✓ Branch 1 taken 2 times.
2 d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_SpeedFields::EvaporativeCondenserPumpPowerFraction);
144
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (d) {
145
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setEvaporativeCondenserPumpPowerFraction(*d);
146 }
147
148
1/1
✓ Branch 1 taken 2 times.
2 d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_SpeedFields::EvaporativeCondenserEffectiveness);
149
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (d) {
150
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setEvaporativeCondenserEffectiveness(*d);
151 }
152
153
1/1
✓ Branch 1 taken 2 times.
2 d = workspaceObject.getDouble(Coil_Cooling_DX_CurveFit_SpeedFields::RatedWasteHeatFractionofPowerInput);
154
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (d) {
155
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 speed.setRatedWasteHeatFractionofPowerInput(*d);
156 }
157
158 4 if ((target =
159
2/3
✓ Branch 1 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
4 workspaceObject.getTarget(openstudio::Coil_Cooling_DX_CurveFit_SpeedFields::SensibleHeatRatioModifierFunctionofTemperatureCurveName))) {
160 ✗ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
161 ✗ if (modelObject && modelObject->optionalCast<Curve>()) {
162 ✗ speed.setSensibleHeatRatioModifierFunctionofTemperatureCurve(modelObject->cast<Curve>());
163 }
164 ✗ }
165
166 4 if ((target =
167
2/3
✓ Branch 1 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
4 workspaceObject.getTarget(openstudio::Coil_Cooling_DX_CurveFit_SpeedFields::SensibleHeatRatioModifierFunctionofFlowFractionCurveName))) {
168 ✗ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
169 ✗ if (modelObject && modelObject->optionalCast<Curve>()) {
170 ✗ speed.setSensibleHeatRatioModifierFunctionofFlowFractionCurve(modelObject->cast<Curve>());
171 }
172 ✗ }
173
174
1/1
✓ Branch 1 taken 2 times.
2 return speed;
175 2 } // End of translate function
176
177 } // end namespace energyplus
178 } // end namespace openstudio
179