GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 96.5% 82 / 0 / 85
Functions: 100.0% 1 / 0 / 1
Branches: 83.5% 111 / 0 / 133

src/energyplus/ForwardTranslator/ForwardTranslateHeatPumpAirToWaterFuelFiredCooling.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
9 #include "../../model/HeatPumpAirToWaterFuelFiredCooling.hpp"
10 #include "../../model/Node.hpp"
11 #include "../../model/Node_Impl.hpp"
12 #include "../../model/HeatPumpAirToWaterFuelFiredHeating.hpp"
13 #include "../../model/HeatPumpAirToWaterFuelFiredHeating_Impl.hpp"
14 #include "../../model/CurveBiquadratic.hpp"
15 #include "../../model/CurveQuadratic.hpp"
16
17 #include <utilities/idd/HeatPump_AirToWater_FuelFired_Cooling_FieldEnums.hxx>
18 #include <utilities/idd/IddEnums.hxx>
19
20 using namespace openstudio::model;
21
22 namespace openstudio {
23
24 namespace energyplus {
25
26 1 boost::optional<IdfObject> ForwardTranslator::translateHeatPumpAirToWaterFuelFiredCooling(model::HeatPumpAirToWaterFuelFiredCooling& modelObject) {
27
28 // Instantiate an IdfObject of the class to store the values
29
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::HeatPump_AirToWater_FuelFired_Cooling, modelObject);
30
31 // Water Inlet Node Name: Required Node
32
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto node_ = modelObject.inletModelObject()) {
33
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::WaterInletNodeName, node_->nameString());
34 1 }
35
36 // Water Outlet Node Name: Required Node
37
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto node_ = modelObject.outletModelObject()) {
38
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::WaterOutletNodeName, node_->nameString());
39 1 }
40
41 // Air Source Node Name
42
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 const std::string oaNodeName = modelObject.nameString() + " OA Node";
43
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::AirSourceNodeName, oaNodeName);
44
45
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject _oaNode(openstudio::IddObjectType::OutdoorAir_Node);
46
1/1
✓ Branch 1 taken 1 time.
1 _oaNode.setString(0, oaNodeName);
47
1/1
✓ Branch 1 taken 1 time.
1 m_idfObjects.push_back(_oaNode);
48
49 // Companion Cooling Heat Pump Name: Optional Object
50
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<HeatPumpAirToWaterFuelFiredHeating> companionHeatingHeatPump_ = modelObject.companionHeatingHeatPump()) {
51
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> wo_ = translateAndMapModelObject(companionHeatingHeatPump_.get())) {
52
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::CompanionHeatingHeatPumpName, wo_->nameString());
53 1 }
54 1 }
55
56 // Fuel Type: Optional String
57
1/1
✓ Branch 1 taken 1 time.
1 const std::string fuelType = modelObject.fuelType();
58
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::FuelType, fuelType);
59
60 // End-Use Subcategory: Optional String
61
1/1
✓ Branch 1 taken 1 time.
1 const std::string endUseSubcategory = modelObject.endUseSubcategory();
62
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::EndUseSubcategory, endUseSubcategory);
63
64 // Nominal Cooling Capacity
65
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
1 if (modelObject.isNominalCoolingCapacityAutosized()) {
66 ✗ idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::NominalCoolingCapacity, "Autosize");
67 } else {
68
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setDouble(HeatPump_AirToWater_FuelFired_CoolingFields::NominalCoolingCapacity, modelObject.nominalCoolingCapacity().get());
69 }
70
71 // Nominal COP: Optional Double
72
1/1
✓ Branch 1 taken 1 time.
1 const double nominalCOP = modelObject.nominalCOP();
73
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(HeatPump_AirToWater_FuelFired_CoolingFields::NominalCOP, nominalCOP);
74
75 // Design Flow Rate
76
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
1 if (modelObject.isDesignFlowRateAutosized()) {
77 ✗ idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::DesignFlowRate, "Autosize");
78 } else {
79
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setDouble(HeatPump_AirToWater_FuelFired_CoolingFields::DesignFlowRate, modelObject.designFlowRate().get());
80 }
81
82 // Design Supply Temperature: Optional Double
83
1/1
✓ Branch 1 taken 1 time.
1 const double designSupplyTemperature = modelObject.designSupplyTemperature();
84
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(HeatPump_AirToWater_FuelFired_CoolingFields::DesignSupplyTemperature, designSupplyTemperature);
85
86
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
1 if (modelObject.isDesignTemperatureLiftAutosized()) {
87 ✗ idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::DesignTemperatureLift, "Autosize");
88 } else {
89
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setDouble(HeatPump_AirToWater_FuelFired_CoolingFields::DesignTemperatureLift, modelObject.designTemperatureLift().get());
90 }
91
92 // Sizing Factor: Optional Double
93
1/1
✓ Branch 1 taken 1 time.
1 const double sizingFactor = modelObject.sizingFactor();
94
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(HeatPump_AirToWater_FuelFired_CoolingFields::SizingFactor, sizingFactor);
95
96 // Flow Mode: Optional String
97
1/1
✓ Branch 1 taken 1 time.
1 const std::string flowMode = modelObject.flowMode();
98
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::FlowMode, flowMode);
99
100 // Outdoor Air Temperature Curve Input Variable: Optional String
101
1/1
✓ Branch 1 taken 1 time.
1 const std::string outdoorAirTemperatureCurveInputVariable = modelObject.outdoorAirTemperatureCurveInputVariable();
102
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::OutdoorAirTemperatureCurveInputVariable,
103 outdoorAirTemperatureCurveInputVariable);
104
105 // Water Temperature Curve Input Variable: Optional String
106
1/1
✓ Branch 1 taken 1 time.
1 const std::string waterTemperatureCurveInputVariable = modelObject.waterTemperatureCurveInputVariable();
107
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::WaterTemperatureCurveInputVariable, waterTemperatureCurveInputVariable);
108
109 // Normalized Capacity Function of Temperature Curve Name: Required Object
110
1/1
✓ Branch 1 taken 1 time.
1 Curve normalizedCapacityFunctionofTemperatureCurve = modelObject.normalizedCapacityFunctionofTemperatureCurve();
111
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<IdfObject> wo_ = translateAndMapModelObject(normalizedCapacityFunctionofTemperatureCurve)) {
112
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::NormalizedCapacityFunctionofTemperatureCurveName, wo_->nameString());
113 1 }
114
115 // Fuel Energy Input Ratio Function of Temperature Curve Name: Required Object
116
1/1
✓ Branch 1 taken 1 time.
1 Curve fuelEnergyInputRatioFunctionofTemperatureCurve = modelObject.fuelEnergyInputRatioFunctionofTemperatureCurve();
117
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<IdfObject> wo_ = translateAndMapModelObject(fuelEnergyInputRatioFunctionofTemperatureCurve)) {
118
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::FuelEnergyInputRatioFunctionofTemperatureCurveName, wo_->nameString());
119 1 }
120
121 // Fuel Energy Input Ratio Function of PLR Curve Name: Required Object
122
1/1
✓ Branch 1 taken 1 time.
1 Curve fuelEnergyInputRatioFunctionofPLRCurve = modelObject.fuelEnergyInputRatioFunctionofPLRCurve();
123
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<IdfObject> wo_ = translateAndMapModelObject(fuelEnergyInputRatioFunctionofPLRCurve)) {
124
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::FuelEnergyInputRatioFunctionofPLRCurveName, wo_->nameString());
125 1 }
126
127 // Minimum Part Load Ratio: Optional Double
128
1/1
✓ Branch 1 taken 1 time.
1 const double minimumPartLoadRatio = modelObject.minimumPartLoadRatio();
129
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(HeatPump_AirToWater_FuelFired_CoolingFields::MinimumPartLoadRatio, minimumPartLoadRatio);
130
131 // Maximum Part Load Ratio: Optional Double
132
1/1
✓ Branch 1 taken 1 time.
1 const double maximumPartLoadRatio = modelObject.maximumPartLoadRatio();
133
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(HeatPump_AirToWater_FuelFired_CoolingFields::MaximumPartLoadRatio, maximumPartLoadRatio);
134
135 // Cycling Ratio Factor Curve Name: Optional Object
136
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<Curve> cyclingRatioFactorCurve_ = modelObject.cyclingRatioFactorCurve()) {
137
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> wo_ = translateAndMapModelObject(cyclingRatioFactorCurve_.get())) {
138
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::CyclingRatioFactorCurveName, wo_->nameString());
139 1 }
140 1 }
141
142 // Nominal Auxiliary Electric Power: Optional Double
143
1/1
✓ Branch 1 taken 1 time.
1 const double nominalAuxiliaryElectricPower = modelObject.nominalAuxiliaryElectricPower();
144
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(HeatPump_AirToWater_FuelFired_CoolingFields::NominalAuxiliaryElectricPower, nominalAuxiliaryElectricPower);
145
146 // Auxiliary Electric Energy Input Ratio Function of Temperature Curve Name: Optional Object
147 1 if (boost::optional<Curve> auxiliaryElectricEnergyInputRatioFunctionofTemperatureCurve_ =
148
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 modelObject.auxiliaryElectricEnergyInputRatioFunctionofTemperatureCurve()) {
149
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> wo_ = translateAndMapModelObject(auxiliaryElectricEnergyInputRatioFunctionofTemperatureCurve_.get())) {
150
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::AuxiliaryElectricEnergyInputRatioFunctionofTemperatureCurveName,
151
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 wo_->nameString());
152 1 }
153 1 }
154
155 // Auxiliary Electric Energy Input Ratio Function of PLR Curve Name: Optional Object
156 1 if (boost::optional<Curve> auxiliaryElectricEnergyInputRatioFunctionofPLRCurve_ =
157
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 modelObject.auxiliaryElectricEnergyInputRatioFunctionofPLRCurve()) {
158
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> wo_ = translateAndMapModelObject(auxiliaryElectricEnergyInputRatioFunctionofPLRCurve_.get())) {
159
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(HeatPump_AirToWater_FuelFired_CoolingFields::AuxiliaryElectricEnergyInputRatioFunctionofPLRCurveName, wo_->nameString());
160 1 }
161 1 }
162
163 // Standby Electric Power: Optional Double
164
1/1
✓ Branch 1 taken 1 time.
1 const double standbyElectricPower = modelObject.standbyElectricPower();
165
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(HeatPump_AirToWater_FuelFired_CoolingFields::StandbyElectricPower, standbyElectricPower);
166
167 // Minimum Unloading Ratio: Optional Double
168
1/1
✓ Branch 1 taken 1 time.
1 const double minimumUnloadingRatio = modelObject.minimumUnloadingRatio();
169
1/1
✓ Branch 1 taken 1 time.
1 idfObject.setDouble(HeatPump_AirToWater_FuelFired_CoolingFields::MinimumUnloadingRatio, minimumUnloadingRatio);
170
171
1/1
✓ Branch 1 taken 1 time.
2 return idfObject;
172 1 } // End of translate function
173
174 } // end namespace energyplus
175 } // end namespace openstudio
176