GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 84.9% 45 / 0 / 53
Functions: 100.0% 1 / 0 / 1
Branches: 68.0% 68 / 0 / 100

src/energyplus/ForwardTranslator/ForwardTranslateHeatPumpWaterToWaterEquationFitCooling.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/HeatPumpWaterToWaterEquationFitCooling.hpp"
13 #include "../../model/HeatPumpWaterToWaterEquationFitCooling_Impl.hpp"
14 #include "../../model/HeatPumpWaterToWaterEquationFitHeating.hpp"
15 #include "../../model/HeatPumpWaterToWaterEquationFitHeating_Impl.hpp"
16 #include "../../model/CurveQuadLinear.hpp"
17
18 #include "../../utilities/core/Logger.hpp"
19 #include "../../utilities/core/Assert.hpp"
20 #include <utilities/idd/HeatPump_WaterToWater_EquationFit_Cooling_FieldEnums.hxx>
21 #include "../../utilities/idd/IddEnums.hpp"
22 #include <utilities/idd/IddEnums.hxx>
23 #include <utilities/idd/IddFactory.hxx>
24
25 using namespace openstudio::model;
26
27 using namespace std;
28
29 namespace openstudio {
30
31 namespace energyplus {
32
33 1 boost::optional<IdfObject> ForwardTranslator::translateHeatPumpWaterToWaterEquationFitCooling(HeatPumpWaterToWaterEquationFitCooling& modelObject) {
34 // createRegisterAndNameIdfObject will add it to m_map, m_idfObjects, and name it
35 // 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)
36
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::HeatPump_WaterToWater_EquationFit_Cooling, modelObject);
37
38 1 boost::optional<double> optvalue;
39
40
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto value = modelObject.supplyOutletModelObject()) {
41
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_WaterToWater_EquationFit_CoolingFields::LoadSideOutletNodeName, value->name().get());
42 1 }
43
44
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto value = modelObject.supplyInletModelObject()) {
45
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_WaterToWater_EquationFit_CoolingFields::LoadSideInletNodeName, value->name().get());
46 1 }
47
48
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto value = modelObject.demandOutletModelObject()) {
49
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_WaterToWater_EquationFit_CoolingFields::SourceSideOutletNodeName, value->name().get());
50 1 }
51
52
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto value = modelObject.demandInletModelObject()) {
53
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_WaterToWater_EquationFit_CoolingFields::SourceSideInletNodeName, value->name().get());
54 1 }
55
56
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
1 if (modelObject.isReferenceLoadSideFlowRateAutosized()) {
57
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 idfObject.setString(HeatPump_WaterToWater_EquationFit_CoolingFields::ReferenceLoadSideFlowRate, "Autosize");
58 ✗ } else if ((optvalue = modelObject.referenceLoadSideFlowRate())) {
59 ✗ idfObject.setDouble(HeatPump_WaterToWater_EquationFit_CoolingFields::ReferenceLoadSideFlowRate, optvalue.get());
60 }
61
62
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
1 if (modelObject.isReferenceSourceSideFlowRateAutosized()) {
63
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 idfObject.setString(HeatPump_WaterToWater_EquationFit_CoolingFields::ReferenceSourceSideFlowRate, "Autosize");
64 ✗ } else if ((optvalue = modelObject.referenceSourceSideFlowRate())) {
65 ✗ idfObject.setDouble(HeatPump_WaterToWater_EquationFit_CoolingFields::ReferenceSourceSideFlowRate, optvalue.get());
66 }
67
68
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
1 if (modelObject.isRatedCoolingCapacityAutosized()) {
69
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 idfObject.setString(HeatPump_WaterToWater_EquationFit_CoolingFields::ReferenceCoolingCapacity, "Autosize");
70 ✗ } else if ((optvalue = modelObject.ratedCoolingCapacity())) {
71 ✗ idfObject.setDouble(HeatPump_WaterToWater_EquationFit_CoolingFields::ReferenceCoolingCapacity, optvalue.get());
72 }
73
74
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
1 if (modelObject.isRatedCoolingPowerConsumptionAutosized()) {
75
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 idfObject.setString(HeatPump_WaterToWater_EquationFit_CoolingFields::ReferenceCoolingPowerConsumption, "Autosize");
76 ✗ } else if ((optvalue = modelObject.ratedCoolingPowerConsumption())) {
77 ✗ idfObject.setDouble(HeatPump_WaterToWater_EquationFit_CoolingFields::ReferenceCoolingPowerConsumption, optvalue.get());
78 }
79
80 // Cooling Capacity Curve Name
81 {
82
1/1
✓ Branch 1 taken 1 time.
1 auto curve = modelObject.coolingCapacityCurve();
83
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto _curve = translateAndMapModelObject(curve)) {
84
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(HeatPump_WaterToWater_EquationFit_CoolingFields::CoolingCapacityCurveName, _curve->nameString());
85 1 }
86 1 }
87
88 // Cooling Compressor Power Curve Name
89 {
90
1/1
✓ Branch 1 taken 1 time.
1 auto curve = modelObject.coolingCompressorPowerCurve();
91
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto _curve = translateAndMapModelObject(curve)) {
92
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(HeatPump_WaterToWater_EquationFit_CoolingFields::CoolingCompressorPowerCurveName, _curve->nameString());
93 1 }
94 1 }
95
96 {
97
1/1
✓ Branch 1 taken 1 time.
1 auto value = modelObject.referenceCoefficientofPerformance();
98
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(HeatPump_WaterToWater_EquationFit_CoolingFields::ReferenceCoefficientofPerformance, value);
99 }
100
101 {
102
1/1
✓ Branch 1 taken 1 time.
1 auto value = modelObject.sizingFactor();
103
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(HeatPump_WaterToWater_EquationFit_CoolingFields::SizingFactor, value);
104 }
105
106
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<HeatPumpWaterToWaterEquationFitHeating> companion = modelObject.companionHeatingHeatPump();
107
108
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (companion) {
109
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<IdfObject> _companion = translateAndMapModelObject(companion.get());
110
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (_companion) {
111
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_WaterToWater_EquationFit_CoolingFields::CompanionHeatingHeatPumpName, _companion->name().get());
112 }
113 1 }
114
115
1/1
✓ Branch 1 taken 1 time.
2 return idfObject;
116 1 }
117
118 } // namespace energyplus
119
120 } // namespace openstudio
121