GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 92.1% 70 / 0 / 76
Functions: 100.0% 1 / 0 / 1
Branches: 80.3% 110 / 0 / 137

src/energyplus/ForwardTranslator/ForwardTranslateCoilCoolingWaterToAirHeatPumpEquationFit.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/Schedule.hpp"
9 #include "../../model/Schedule_Impl.hpp"
10 #include "../../model/Node.hpp"
11 #include "../../model/Node_Impl.hpp"
12 #include "../../model/CoilCoolingWaterToAirHeatPumpEquationFit.hpp"
13 #include "../../model/CoilCoolingWaterToAirHeatPumpEquationFit_Impl.hpp"
14 #include "../../model/Curve.hpp"
15
16 #include "../../utilities/core/Logger.hpp"
17 #include "../../utilities/core/Assert.hpp"
18
19 #include <utilities/idd/Coil_Cooling_WaterToAirHeatPump_EquationFit_FieldEnums.hxx>
20 #include "../../utilities/idd/IddEnums.hpp"
21 #include <utilities/idd/IddEnums.hxx>
22 #include <utilities/idd/IddFactory.hxx>
23
24 using namespace openstudio::model;
25
26 //using namespace std;
27
28 namespace openstudio {
29
30 namespace energyplus {
31
32 boost::optional<IdfObject>
33 9 ForwardTranslator::translateCoilCoolingWaterToAirHeatPumpEquationFit(CoilCoolingWaterToAirHeatPumpEquationFit& modelObject) {
34 //setup boost optionals to use to store get method returns
35 9 boost::optional<std::string> s;
36 9 boost::optional<double> value;
37 9 boost::optional<Node> node;
38
39 // Make sure the modelObject gets ut into the map, and the new idfObject gets put into the final file.
40 // Also sets the idfObjects name
41
42
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 IdfObject idfObject = createRegisterAndNameIdfObject(IddObjectType::Coil_Cooling_WaterToAirHeatPump_EquationFit, modelObject);
43
44 // Object Name
45 //std::string baseName = idfObject.name().get();
46
47 // AvailabilityScheduleName
48 {
49
1/1
✓ Branch 1 taken 9 times.
9 auto schedule = modelObject.availabilitySchedule();
50
2/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
18 if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule)) {
51
4/4
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
✓ Branch 10 taken 9 times.
9 idfObject.setString(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::AvailabilityScheduleName, _schedule->name().get());
52 9 }
53 9 }
54
55 // Water Inlet Node Name
56
3/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 5 times.
18 if (boost::optional<ModelObject> mo = modelObject.waterInletModelObject()) {
57
3/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
8 if (boost::optional<Node> node = mo->optionalCast<Node>()) {
58
4/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
4 idfObject.setString(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::WaterInletNodeName, node->name().get());
59 4 }
60 9 }
61
62 // Water Outlet Node Name
63
3/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 5 times.
18 if (boost::optional<ModelObject> mo = modelObject.waterOutletModelObject()) {
64
3/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
8 if (boost::optional<Node> node = mo->optionalCast<Node>()) {
65
4/4
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
4 idfObject.setString(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::WaterOutletNodeName, node->name().get());
66 4 }
67 9 }
68
69 // Air Inlet Node Name
70
2/3
✓ Branch 1 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
18 if (boost::optional<ModelObject> mo = modelObject.airInletModelObject()) {
71 ✗ if (boost::optional<Node> node = mo->optionalCast<Node>()) {
72 ✗ idfObject.setString(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::AirInletNodeName, node->name().get());
73 ✗ }
74 9 }
75
76 // Air Outlet Node Name
77
2/3
✓ Branch 1 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
18 if (boost::optional<ModelObject> mo = modelObject.airOutletModelObject()) {
78 ✗ if (boost::optional<Node> node = mo->optionalCast<Node>()) {
79 ✗ idfObject.setString(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::AirOutletNodeName, node->name().get());
80 ✗ }
81 9 }
82
83 // Rated Air Flow Rate
84
3/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 5 times.
18 if ((value = modelObject.ratedAirFlowRate())) {
85
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 idfObject.setDouble(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::RatedAirFlowRate, *value);
86 } else {
87
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 idfObject.setString(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::RatedAirFlowRate, "Autosize");
88 }
89
90 // Rated Water Flow Rate
91
3/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 5 times.
18 if ((value = modelObject.ratedWaterFlowRate())) {
92
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 idfObject.setDouble(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::RatedWaterFlowRate, *value);
93 } else {
94
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 idfObject.setString(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::RatedWaterFlowRate, "Autosize");
95 }
96
97 // Rated Total Cooling Capacity
98
3/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 5 times.
18 if ((value = modelObject.ratedTotalCoolingCapacity())) {
99
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 idfObject.setDouble(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::GrossRatedTotalCoolingCapacity, *value);
100 } else {
101
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 idfObject.setString(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::GrossRatedTotalCoolingCapacity, "Autosize");
102 }
103
104 // Rated Sensible Cooling Capacity
105
3/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 8 times.
18 if ((value = modelObject.ratedSensibleCoolingCapacity())) {
106
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::GrossRatedSensibleCoolingCapacity, *value);
107 } else {
108
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
16 idfObject.setString(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::GrossRatedSensibleCoolingCapacity, "Autosize");
109 }
110
111 // Rated Cooling Coefficient of Performance
112
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setDouble(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::GrossRatedCoolingCOP, modelObject.ratedCoolingCoefficientofPerformance());
113
114 // Rated Entering Water Temperature
115
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setDouble(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::RatedEnteringWaterTemperature,
116 modelObject.ratedEnteringWaterTemperature());
117
118 // Rated Entering Air Dry-Bulb Temperature
119
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setDouble(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::RatedEnteringAirDryBulbTemperature,
120 modelObject.ratedEnteringAirDryBulbTemperature());
121
122 // Rated Entering Air Wet-Bulb Temperature
123
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setDouble(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::RatedEnteringAirWetBulbTemperature,
124 modelObject.ratedEnteringAirWetBulbTemperature());
125
126 // Total Cooling Capacity Curve Name
127 {
128
1/1
✓ Branch 1 taken 9 times.
9 auto curve = modelObject.totalCoolingCapacityCurve();
129
2/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
18 if (auto _curve = translateAndMapModelObject(curve)) {
130
3/3
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
9 idfObject.setString(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::TotalCoolingCapacityCurveName, _curve->nameString());
131 9 }
132 9 }
133
134 // Sensible Cooling Capacity Curve Name
135 {
136
1/1
✓ Branch 1 taken 9 times.
9 auto curve = modelObject.sensibleCoolingCapacityCurve();
137
2/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
18 if (auto _curve = translateAndMapModelObject(curve)) {
138
3/3
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
9 idfObject.setString(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::SensibleCoolingCapacityCurveName, _curve->nameString());
139 9 }
140 9 }
141
142 // Cooling Power Consumption Curve Name
143 {
144
1/1
✓ Branch 1 taken 9 times.
9 auto curve = modelObject.coolingPowerConsumptionCurve();
145
2/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
18 if (auto _curve = translateAndMapModelObject(curve)) {
146
3/3
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
9 idfObject.setString(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::CoolingPowerConsumptionCurveName, _curve->nameString());
147 9 }
148 9 }
149
150 // Part Load Fraction Correlation Curve Name
151 {
152
1/1
✓ Branch 1 taken 9 times.
9 auto curve = modelObject.partLoadFractionCorrelationCurve();
153
2/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
18 if (auto _curve = translateAndMapModelObject(curve)) {
154
3/3
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
9 idfObject.setString(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::PartLoadFractionCorrelationCurveName, _curve->nameString());
155 9 }
156 9 }
157
158 // Nominal Time for Condensate Removal to Begin
159
3/4
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
✗ Branch 8 not taken.
18 if ((value = modelObject.nominalTimeforCondensateRemovaltoBegin())) {
160
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setDouble(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::NominalTimeforCondensateRemovaltoBegin, *value);
161 }
162
163 // Ratio of Initial Moisture Evaporation Rate and Steady State Latent
164
3/4
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
✗ Branch 8 not taken.
18 if ((value = modelObject.ratioofInitialMoistureEvaporationRateandSteadyStateLatentCapacity())) {
165 9 idfObject.setDouble(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::RatioofInitialMoistureEvaporationRateandSteadyStateLatentCapacity,
166
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 *value);
167 }
168
169 // Maximum Cycling Rate
170
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setDouble(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::MaximumCyclingRate, modelObject.maximumCyclingRate());
171
172 // Latent Capacity Time Constnat
173
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setDouble(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::LatentCapacityTimeConstant, modelObject.latentCapacityTimeConstant());
174
175 // Fan Delay Time
176
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 idfObject.setDouble(Coil_Cooling_WaterToAirHeatPump_EquationFitFields::FanDelayTime, modelObject.fanDelayTime());
177
178
1/1
✓ Branch 1 taken 9 times.
18 return idfObject;
179 9 }
180
181 } // namespace energyplus
182
183 } // namespace openstudio
184