GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 87.9% 102 / 0 / 116
Functions: 100.0% 1 / 0 / 1
Branches: 77.0% 167 / 0 / 217

src/energyplus/ForwardTranslator/ForwardTranslateHeatPumpPlantLoopEIRCooling.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/HeatPumpPlantLoopEIRCooling.hpp"
13 #include "../../model/HeatPumpPlantLoopEIRCooling_Impl.hpp"
14 #include "../../model/HeatPumpPlantLoopEIRHeating.hpp"
15 #include "../../model/HeatPumpPlantLoopEIRHeating_Impl.hpp"
16 #include "../../model/CurveBiquadratic.hpp"
17 #include "../../model/CurveQuadratic.hpp"
18
19 #include "../../utilities/core/Logger.hpp"
20 #include "../../utilities/core/Assert.hpp"
21 #include <utilities/idd/HeatPump_PlantLoop_EIR_Cooling_FieldEnums.hxx>
22 #include "../../utilities/idd/IddEnums.hpp"
23 #include <utilities/idd/IddEnums.hxx>
24 #include <utilities/idd/IddFactory.hxx>
25
26 using namespace openstudio::model;
27
28 using namespace std;
29
30 namespace openstudio {
31
32 namespace energyplus {
33
34 3 boost::optional<IdfObject> ForwardTranslator::translateHeatPumpPlantLoopEIRCooling(HeatPumpPlantLoopEIRCooling& modelObject) {
35 // createRegisterAndNameIdfObject will add it to m_map, m_idfObjects, and name it
36 // The fact that it is added to m_map will avoid a recursion issue when it has a companion heating coil (both FT methods call each other)
37
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::HeatPump_PlantLoop_EIR_Cooling, modelObject);
38
39 3 boost::optional<double> optvalue;
40
41
2/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
6 if (auto value = modelObject.supplyOutletModelObject()) {
42
4/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
3 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::LoadSideOutletNodeName, value->name().get());
43 3 }
44
45
2/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
6 if (auto value = modelObject.supplyInletModelObject()) {
46
4/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
3 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::LoadSideInletNodeName, value->name().get());
47 3 }
48
49 // CondenserType
50 // The "smart" logic is handled in model itself
51 // (eg: if you connect the HP to a secondaryPlantLoop, it switches automatically to "WaterSource")
52
1/1
✓ Branch 1 taken 3 times.
3 std::string condenserType = modelObject.condenserType();
53
1/1
✓ Branch 1 taken 3 times.
3 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::CondenserType, condenserType);
54
55
4/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 1 time.
6 if (openstudio::istringEqual(condenserType, "WaterSource")) {
56
57
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (auto value = modelObject.demandOutletModelObject()) {
58
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(HeatPump_PlantLoop_EIR_CoolingFields::SourceSideOutletNodeName, value->name().get());
59 2 }
60
61
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (auto value = modelObject.demandInletModelObject()) {
62
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(HeatPump_PlantLoop_EIR_CoolingFields::SourceSideInletNodeName, value->name().get());
63 2 }
64
65 } else {
66 // AirSource
67 {
68 // Name the source side outlet node
69
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 auto name = modelObject.nameString() + " Outlet Node For Source Side";
70
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::SourceSideOutletNodeName, name);
71 1 }
72
73 {
74 // Create an OutdoorAir:NodeList for the source side inlet conditions to be set directly from weather file
75
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject oaNodeListIdf(openstudio::IddObjectType::OutdoorAir_NodeList);
76
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 auto name = modelObject.nameString() + " Inlet Node For Source Side";
77
1/1
✓ Branch 1 taken 1 time.
1 oaNodeListIdf.setString(0, name);
78
1/1
✓ Branch 1 taken 1 time.
1 m_idfObjects.push_back(oaNodeListIdf);
79
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::SourceSideInletNodeName, name);
80 1 }
81 }
82
83
1/1
✓ Branch 1 taken 3 times.
3 boost::optional<HeatPumpPlantLoopEIRHeating> companion = modelObject.companionHeatingHeatPump();
84
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (companion) {
85
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 boost::optional<IdfObject> _companion = translateAndMapModelObject(companion.get());
86
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (_companion) {
87
4/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
3 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::CompanionHeatPumpName, _companion->name().get());
88 }
89 3 }
90
91
3/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 2 times.
3 if (modelObject.isLoadSideReferenceFlowRateAutosized()) {
92
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::LoadSideReferenceFlowRate, "Autosize");
93
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 } else if ((optvalue = modelObject.loadSideReferenceFlowRate())) {
94
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 idfObject.setDouble(HeatPump_PlantLoop_EIR_CoolingFields::LoadSideReferenceFlowRate, optvalue.get());
95 }
96
97
3/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 2 times.
3 if (modelObject.isSourceSideReferenceFlowRateAutosized()) {
98
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::SourceSideReferenceFlowRate, "Autosize");
99
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 } else if ((optvalue = modelObject.sourceSideReferenceFlowRate())) {
100
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 idfObject.setDouble(HeatPump_PlantLoop_EIR_CoolingFields::SourceSideReferenceFlowRate, optvalue.get());
101 }
102
103
2/3
✓ Branch 1 taken 3 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
6 if (modelObject.heatRecoveryLoop()) {
104 ✗ if (modelObject.isHeatRecoveryReferenceFlowRateAutosized()) {
105 ✗ idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::HeatRecoveryReferenceFlowRate, "Autosize");
106 ✗ } else if ((optvalue = modelObject.heatRecoveryReferenceFlowRate())) {
107 ✗ idfObject.setDouble(HeatPump_PlantLoop_EIR_CoolingFields::HeatRecoveryReferenceFlowRate, optvalue.get());
108 }
109
110 ✗ if (boost::optional<ModelObject> mo = modelObject.tertiaryInletModelObject()) {
111 ✗ if (boost::optional<Node> node = mo->optionalCast<Node>()) {
112 ✗ idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::HeatRecoveryInletNodeName, node->name().get());
113 ✗ }
114 ✗ }
115
116 ✗ if (boost::optional<ModelObject> mo = modelObject.tertiaryOutletModelObject()) {
117 ✗ if (boost::optional<Node> node = mo->optionalCast<Node>()) {
118 ✗ idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::HeatRecoveryOutletNodeName, node->name().get());
119 ✗ }
120 ✗ }
121 }
122
123
3/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 2 times.
3 if (modelObject.isReferenceCapacityAutosized()) {
124
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::ReferenceCapacity, "Autosize");
125
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 } else if ((optvalue = modelObject.referenceCapacity())) {
126
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 idfObject.setDouble(HeatPump_PlantLoop_EIR_CoolingFields::ReferenceCapacity, optvalue.get());
127 }
128
129 {
130
1/1
✓ Branch 1 taken 3 times.
3 auto value = modelObject.referenceCoefficientofPerformance();
131
1/1
✓ Branch 1 taken 3 times.
3 idfObject.setDouble(HeatPump_PlantLoop_EIR_CoolingFields::ReferenceCoefficientofPerformance, value);
132 }
133
134 {
135
1/1
✓ Branch 1 taken 3 times.
3 auto value = modelObject.sizingFactor();
136
1/1
✓ Branch 1 taken 3 times.
3 idfObject.setDouble(HeatPump_PlantLoop_EIR_CoolingFields::SizingFactor, value);
137 }
138
139 {
140
1/1
✓ Branch 1 taken 3 times.
3 auto curve = modelObject.capacityModifierFunctionofTemperatureCurve();
141
2/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
6 if (auto _curve = translateAndMapModelObject(curve)) {
142
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::CapacityModifierFunctionofTemperatureCurveName, _curve->nameString());
143 3 }
144 3 }
145
146 {
147
1/1
✓ Branch 1 taken 3 times.
3 auto curve = modelObject.electricInputtoOutputRatioModifierFunctionofTemperatureCurve();
148
2/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
6 if (auto _curve = translateAndMapModelObject(curve)) {
149
1/1
✓ Branch 1 taken 3 times.
3 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::ElectricInputtoOutputRatioModifierFunctionofTemperatureCurveName,
150
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
6 _curve->nameString());
151 3 }
152 3 }
153
154 {
155
1/1
✓ Branch 1 taken 3 times.
3 auto curve = modelObject.electricInputtoOutputRatioModifierFunctionofPartLoadRatioCurve();
156
2/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
6 if (auto _curve = translateAndMapModelObject(curve)) {
157
1/1
✓ Branch 1 taken 3 times.
3 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::ElectricInputtoOutputRatioModifierFunctionofPartLoadRatioCurveName,
158
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
6 _curve->nameString());
159 3 }
160 3 }
161
162
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::ControlType, modelObject.controlType());
163
164
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::FlowMode, modelObject.flowMode());
165
166
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 idfObject.setDouble(HeatPump_PlantLoop_EIR_CoolingFields::MinimumPartLoadRatio, modelObject.minimumPartLoadRatio());
167
168
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 idfObject.setDouble(HeatPump_PlantLoop_EIR_CoolingFields::MinimumSourceInletTemperature, modelObject.minimumSourceInletTemperature());
169
170
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 idfObject.setDouble(HeatPump_PlantLoop_EIR_CoolingFields::MaximumSourceInletTemperature, modelObject.maximumSourceInletTemperature());
171
172
3/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 2 times.
6 if (boost::optional<model::Curve> curve = modelObject.minimumSupplyWaterTemperatureCurve()) {
173
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (boost::optional<IdfObject> _curve = translateAndMapModelObject(curve.get())) {
174
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::MinimumSupplyWaterTemperatureCurveName, _curve->name().get());
175 1 }
176 3 }
177
178
3/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 2 times.
6 if (boost::optional<model::Curve> curve = modelObject.maximumSupplyWaterTemperatureCurve()) {
179
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (boost::optional<IdfObject> _curve = translateAndMapModelObject(curve.get())) {
180
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::MaximumSupplyWaterTemperatureCurveName, _curve->name().get());
181 1 }
182 3 }
183
184
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 idfObject.setDouble(HeatPump_PlantLoop_EIR_CoolingFields::MaximumHeatRecoveryOutletTemperature,
185 modelObject.maximumHeatRecoveryOutletTemperature());
186
187
3/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 2 times.
6 if (boost::optional<model::Curve> curve = modelObject.heatRecoveryCapacityModifierFunctionofTemperatureCurve()) {
188
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (boost::optional<IdfObject> _curve = translateAndMapModelObject(curve.get())) {
189
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::HeatRecoveryCapacityModifierFunctionofTemperatureCurveName, _curve->name().get());
190 1 }
191 3 }
192
193
3/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 2 times.
6 if (boost::optional<model::Curve> curve = modelObject.heatRecoveryElectricInputtoOutputRatioModifierFunctionofTemperatureCurve()) {
194
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (boost::optional<IdfObject> _curve = translateAndMapModelObject(curve.get())) {
195 1 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::HeatRecoveryElectricInputtoOutputRatioModifierFunctionofTemperatureCurveName,
196
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 _curve->name().get());
197 1 }
198 3 }
199
200
3/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 2 times.
6 if (boost::optional<model::Curve> curve = modelObject.thermosiphonCapacityFractionCurve()) {
201
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
2 if (boost::optional<IdfObject> _curve = translateAndMapModelObject(curve.get())) {
202
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 idfObject.setString(HeatPump_PlantLoop_EIR_CoolingFields::ThermosiphonCapacityFractionCurveName, _curve->name().get());
203 1 }
204 3 }
205
206
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 idfObject.setDouble(HeatPump_PlantLoop_EIR_CoolingFields::ThermosiphonMinimumTemperatureDifference,
207 modelObject.thermosiphonMinimumTemperatureDifference());
208
209
1/1
✓ Branch 1 taken 3 times.
6 return idfObject;
210 3 }
211
212 } // namespace energyplus
213
214 } // namespace openstudio
215