GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 92.6% 337 / 0 / 364
Functions: 100.0% 5 / 0 / 5
Branches: 60.3% 450 / 0 / 746

src/energyplus/ReverseTranslator/ReverseTranslateHeatPumpAirToWater.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/HeatPumpAirToWater.hpp"
9 #include "../../model/HeatPumpAirToWaterCooling.hpp"
10 #include "../../model/HeatPumpAirToWaterCooling_Impl.hpp"
11 #include "../../model/HeatPumpAirToWaterCoolingSpeedData.hpp"
12 #include "../../model/HeatPumpAirToWaterHeating.hpp"
13 #include "../../model/HeatPumpAirToWaterHeating_Impl.hpp"
14 #include "../../model/HeatPumpAirToWaterHeatingSpeedData.hpp"
15
16 #include "../../model/Schedule.hpp"
17 #include "../../model/Schedule_Impl.hpp"
18
19 #include "../../model/Curve.hpp"
20 #include "../../model/Curve_Impl.hpp"
21
22 #include <utilities/idd/HeatPump_AirToWater_FieldEnums.hxx>
23 #include <utilities/idd/IddEnums.hxx>
24
25 using namespace openstudio::model;
26
27 namespace openstudio {
28
29 namespace energyplus {
30
31 1 boost::optional<model::ModelObject> ReverseTranslator::translateHeatPumpAirToWaterCooling(const WorkspaceObject& workspaceObject) {
32 // Number of Speeds for Cooling: Optional Integer
33
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 int numberofSpeedsforCooling = workspaceObject.getInt(HeatPump_AirToWaterFields::NumberofSpeedsforCooling).value_or(0);
34
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (numberofSpeedsforCooling == 0) {
35 ✗ return boost::none;
36 }
37
38
1/1
✓ Branch 1 taken 1 time.
1 HeatPumpAirToWaterCooling awhp_cc(m_model);
39
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 awhp_cc.setName(workspaceObject.nameString() + " Cooling");
40
41 // Availability Schedule Name Cooling: Optional Object
42
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<WorkspaceObject> wo_ = workspaceObject.getTarget(HeatPump_AirToWaterFields::AvailabilityScheduleNameCooling)) {
43
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
44
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<Schedule> availabilityScheduleCooling_ = mo_->optionalCast<Schedule>()) {
45
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_cc.setAvailabilitySchedule(availabilityScheduleCooling_.get());
46 } else {
47 ✗ LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Availability Schedule Name Cooling'");
48 1 }
49 1 }
50 1 }
51
52 // Rated Inlet Air Temperature in Cooling Mode: Optional Double
53 1 if (boost::optional<double> ratedInletAirTemperature_ =
54
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::RatedInletAirTemperatureinCoolingMode)) {
55
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_cc.setRatedInletAirTemperature(ratedInletAirTemperature_.get());
56 }
57
58 // Rated Air Flow Rate in Cooling Mode: Optional Double
59
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<double> ratedAirFlowRate_ = workspaceObject.getDouble(HeatPump_AirToWaterFields::RatedAirFlowRateinCoolingMode)) {
60
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_cc.setRatedAirFlowRate(ratedAirFlowRate_.get());
61 }
62
63 // Rated Leaving Water Temperature in Cooling Mode: Optional Double
64 1 if (boost::optional<double> ratedLeavingWaterTemperature_ =
65
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::RatedLeavingWaterTemperatureinCoolingMode)) {
66
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_cc.setRatedLeavingWaterTemperature(ratedLeavingWaterTemperature_.get());
67 }
68
69 // Rated Water Flow Rate in Cooling Mode: Optional Double
70
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<double> ratedWaterFlowRate_ = workspaceObject.getDouble(HeatPump_AirToWaterFields::RatedWaterFlowRateinCoolingMode)) {
71
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_cc.setRatedWaterFlowRate(ratedWaterFlowRate_.get());
72 }
73
74 // Minimum Outdoor Air Temperature in Cooling Mode: Optional Double
75 1 if (boost::optional<double> minimumOutdoorAirTemperature_ =
76
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::MinimumOutdoorAirTemperatureinCoolingMode)) {
77
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_cc.setMinimumOutdoorAirTemperature(minimumOutdoorAirTemperature_.get());
78 }
79
80 // Maximum Outdoor Air Temperature in Cooling Mode: Optional Double
81 1 if (boost::optional<double> maximumOutdoorAirTemperature_ =
82
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::MaximumOutdoorAirTemperatureinCoolingMode)) {
83
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_cc.setMaximumOutdoorAirTemperature(maximumOutdoorAirTemperature_.get());
84 }
85
86 // Minimum Leaving Water Temperature Curve Name in Cooling Mode: Optional Object
87 1 if (boost::optional<WorkspaceObject> wo_ =
88
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getTarget(HeatPump_AirToWaterFields::MinimumLeavingWaterTemperatureCurveNameinCoolingMode)) {
89
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
90
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<Curve> minimumLeavingWaterTemperatureCurveinCoolingMode_ = mo_->optionalCast<Curve>()) {
91
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_cc.setMinimumLeavingWaterTemperatureCurve(minimumLeavingWaterTemperatureCurveinCoolingMode_.get());
92 } else {
93 ✗ LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Minimum Leaving Water Temperature Curve Name in Cooling Mode'");
94 1 }
95 1 }
96 1 }
97 // Maximum Leaving Water Temperature Curve Name in Cooling Mode: Optional Object
98 1 if (boost::optional<WorkspaceObject> wo_ =
99
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getTarget(HeatPump_AirToWaterFields::MaximumLeavingWaterTemperatureCurveNameinCoolingMode)) {
100
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
101
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<Curve> maximumLeavingWaterTemperatureCurveinCoolingMode_ = mo_->optionalCast<Curve>()) {
102
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_cc.setMaximumLeavingWaterTemperatureCurve(maximumLeavingWaterTemperatureCurveinCoolingMode_.get());
103 } else {
104 ✗ LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Maximum Leaving Water Temperature Curve Name in Cooling Mode'");
105 1 }
106 1 }
107 1 }
108
109 // Sizing Factor for Cooling: Optional Double
110
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<double> sizingFactor_ = workspaceObject.getDouble(HeatPump_AirToWaterFields::SizingFactorforCooling)) {
111
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_cc.setSizingFactor(sizingFactor_.get());
112 }
113
114 1 unsigned startIndex = HeatPump_AirToWaterFields::RatedCoolingCapacityatSpeed1;
115 1 const unsigned number_fields =
116 1 static_cast<unsigned>(HeatPump_AirToWaterFields::CoolingEnergyInputRatioFunctionofPLRCurveNameatSpeed1) - startIndex + 1;
117
118 25 auto getFieldIndex = [&startIndex](HeatPump_AirToWaterFields::domain field) -> unsigned {
119 25 return startIndex + (static_cast<unsigned>(field) - static_cast<unsigned>(HeatPump_AirToWaterFields::RatedCoolingCapacityatSpeed1));
120 1 };
121
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 time.
6 for (int i = 1; i <= numberofSpeedsforCooling; ++i) {
122
123
1/1
✓ Branch 1 taken 5 times.
5 HeatPumpAirToWaterCoolingSpeedData speed(m_model);
124
4/4
✓ Branch 2 taken 5 times.
✓ Branch 5 taken 5 times.
✓ Branch 8 taken 5 times.
✓ Branch 11 taken 5 times.
5 speed.setName(awhp_cc.nameString() + " Speed " + std::to_string(i));
125 // Rated Cooling Capacity at Speed
126 5 if (boost::optional<double> ratedCoolingCapacityatSpeed_ =
127
3/3
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 1 time.
10 workspaceObject.getDouble(getFieldIndex(HeatPump_AirToWaterFields::RatedCoolingCapacityatSpeed1))) {
128
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 speed.setRatedCoolingCapacity(ratedCoolingCapacityatSpeed_.get());
129 }
130
131 // Rated COP for Cooling at Speed
132 5 if (boost::optional<double> ratedCOPforCoolingatSpeed_ =
133
2/3
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
10 workspaceObject.getDouble(getFieldIndex(HeatPump_AirToWaterFields::RatedCOPforCoolingatSpeed1))) {
134
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 speed.setRatedCOPforCooling(ratedCOPforCoolingatSpeed_.get());
135 }
136
137 // Normalized Cooling Capacity Function of Temperature Curve Name at Speed
138 5 if (boost::optional<WorkspaceObject> wo_ =
139
2/3
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
10 workspaceObject.getTarget(getFieldIndex(HeatPump_AirToWaterFields::NormalizedCoolingCapacityFunctionofTemperatureCurveNameatSpeed1))) {
140
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (boost::optional<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
141
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (boost::optional<Curve> normalizedCoolingCapacityFunctionofTemperatureCurveatSpeed_ = mo_->optionalCast<Curve>()) {
142
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 speed.normalizedCoolingCapacityFunctionofTemperatureCurve().remove();
143
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 speed.setNormalizedCoolingCapacityFunctionofTemperatureCurve(normalizedCoolingCapacityFunctionofTemperatureCurveatSpeed_.get());
144 } else {
145 ✗ LOG(Warn, workspaceObject.briefDescription()
146 << " has a wrong type for 'Normalized Cooling Capacity Function of Temperature Curve Name at Speed " << i);
147 5 }
148 5 }
149 5 }
150
151 // Cooling Energy Input Ratio Function of Temperature Curve Name at Speed
152 5 if (boost::optional<WorkspaceObject> wo_ =
153
2/3
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
10 workspaceObject.getTarget(getFieldIndex(HeatPump_AirToWaterFields::CoolingEnergyInputRatioFunctionofTemperatureCurveNameatSpeed1))) {
154
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (boost::optional<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
155
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (boost::optional<Curve> coolingEnergyInputRatioFunctionofTemperatureCurveatSpeed_ = mo_->optionalCast<Curve>()) {
156
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 speed.coolingEnergyInputRatioFunctionofTemperatureCurve().remove();
157
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 speed.setCoolingEnergyInputRatioFunctionofTemperatureCurve(coolingEnergyInputRatioFunctionofTemperatureCurveatSpeed_.get());
158 } else {
159 ✗ LOG(Warn, workspaceObject.briefDescription()
160 << " has a wrong type for 'Cooling Energy Input Ratio Function of Temperature Curve Name at Speed " << i);
161 5 }
162 5 }
163 5 }
164
165 // Cooling Energy Input Ratio Function of PLR Curve Name at Speed
166 5 if (boost::optional<WorkspaceObject> wo_ =
167
2/3
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
10 workspaceObject.getTarget(getFieldIndex(HeatPump_AirToWaterFields::CoolingEnergyInputRatioFunctionofPLRCurveNameatSpeed1))) {
168
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (boost::optional<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
169
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (boost::optional<Curve> coolingEnergyInputRatioFunctionofPLRCurveatSpeed_ = mo_->optionalCast<Curve>()) {
170
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 speed.coolingEnergyInputRatioFunctionofPLRCurve().remove();
171
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 speed.setCoolingEnergyInputRatioFunctionofPLRCurve(coolingEnergyInputRatioFunctionofPLRCurveatSpeed_.get());
172 } else {
173 ✗ LOG(Warn, workspaceObject.briefDescription()
174 << " has a wrong type for 'Cooling Energy Input Ratio Function of PLR Curve Name at Speed " << i)
175 5 }
176 5 }
177 5 }
178
179
2/3
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
5 if (!awhp_cc.addSpeed(speed)) {
180 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot add speed data " << i << " to HeatPumpAirToWaterCooling");
181 }
182
183 5 startIndex += number_fields;
184 5 }
185
186 // Booster Mode On Cooling: Optional Boolean
187
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 const std::string boosterModeOnCooling = workspaceObject.getString(HeatPump_AirToWaterFields::BoosterModeOnCooling, true).get();
188
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
2 if (istringEqual("Yes", boosterModeOnCooling)) {
189
1/1
✓ Branch 1 taken 1 time.
1 HeatPumpAirToWaterCoolingSpeedData speed(m_model);
190
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 speed.setName(awhp_cc.nameString() + " Booster Mode On Speed");
191
192 // Rated Cooling Capacity in Booster Mode: Optional Double
193 1 if (boost::optional<double> ratedCoolingCapacityinBoosterMode_ =
194
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::RatedCoolingCapacityinBoosterMode)) {
195
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.setRatedCoolingCapacity(ratedCoolingCapacityinBoosterMode_.get());
196 }
197
198 // Rated Cooling COP in Booster Mode: Optional Double
199 1 if (boost::optional<double> ratedCoolingCOPinBoosterMode_ =
200
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::RatedCoolingCOPinBoosterMode)) {
201
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.setRatedCOPforCooling(ratedCoolingCOPinBoosterMode_.get());
202 }
203
204 // Normalized Cooling Capacity Function of Temperature Curve Name in Booster Mode: Optional Object
205 1 if (boost::optional<WorkspaceObject> wo_ =
206
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getTarget(HeatPump_AirToWaterFields::NormalizedCoolingCapacityFunctionofTemperatureCurveNameinBoosterMode)) {
207
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
208
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<Curve> normalizedCoolingCapacityFunctionofTemperatureCurveinBoosterMode_ = mo_->optionalCast<Curve>()) {
209
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.normalizedCoolingCapacityFunctionofTemperatureCurve().remove();
210
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.setNormalizedCoolingCapacityFunctionofTemperatureCurve(normalizedCoolingCapacityFunctionofTemperatureCurveinBoosterMode_.get());
211 } else {
212 ✗ LOG(Warn, workspaceObject.briefDescription()
213 << " has a wrong type for 'Normalized Cooling Capacity Function of Temperature Curve Name in Booster Mode'");
214 1 }
215 1 }
216 1 }
217 // Cooling Energy Input Ratio Function of Temperature Curve Name in Booster Mode: Optional Object
218 1 if (boost::optional<WorkspaceObject> wo_ =
219
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getTarget(HeatPump_AirToWaterFields::CoolingEnergyInputRatioFunctionofTemperatureCurveNameinBoosterMode)) {
220
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
221
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<Curve> coolingEnergyInputRatioFunctionofTemperatureCurveinBoosterMode_ = mo_->optionalCast<Curve>()) {
222
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.coolingEnergyInputRatioFunctionofTemperatureCurve().remove();
223
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.setCoolingEnergyInputRatioFunctionofTemperatureCurve(coolingEnergyInputRatioFunctionofTemperatureCurveinBoosterMode_.get());
224 } else {
225 ✗ LOG(Warn, workspaceObject.briefDescription()
226 << " has a wrong type for 'Cooling Energy Input Ratio Function of Temperature Curve Name in Booster Mode'");
227 1 }
228 1 }
229 1 }
230 // Cooling Energy Input Ratio Function of PLR Curve Name in Booster Mode: Optional Object
231 1 if (boost::optional<WorkspaceObject> wo_ =
232
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getTarget(HeatPump_AirToWaterFields::CoolingEnergyInputRatioFunctionofPLRCurveNameinBoosterMode)) {
233
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
234
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<Curve> coolingEnergyInputRatioFunctionofPLRCurveinBoosterMode_ = mo_->optionalCast<Curve>()) {
235
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.coolingEnergyInputRatioFunctionofPLRCurve().remove();
236
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.setCoolingEnergyInputRatioFunctionofPLRCurve(coolingEnergyInputRatioFunctionofPLRCurveinBoosterMode_.get());
237 } else {
238 ✗ LOG(Warn, workspaceObject.briefDescription()
239 << " has a wrong type for 'Cooling Energy Input Ratio Function of PLR Curve Name in Booster Mode'");
240 1 }
241 1 }
242 1 }
243
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
1 if (!awhp_cc.setBoosterModeOnSpeed(speed)) {
244 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot set booster mode on speed to HeatPumpAirToWaterCooling");
245 }
246 1 }
247
248
1/1
✓ Branch 1 taken 1 time.
1 return awhp_cc;
249 1 }
250
251 1 boost::optional<model::ModelObject> ReverseTranslator::translateHeatPumpAirToWaterHeating(const WorkspaceObject& workspaceObject) {
252 // Number of Speeds for Heating: Optional Integer
253
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 int numberofSpeedsforHeating = workspaceObject.getInt(HeatPump_AirToWaterFields::NumberofSpeedsforHeating).value_or(0);
254
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (numberofSpeedsforHeating == 0) {
255 ✗ return boost::none;
256 }
257
258
1/1
✓ Branch 1 taken 1 time.
1 HeatPumpAirToWaterHeating awhp_hc(m_model);
259
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 awhp_hc.setName(workspaceObject.nameString() + " Heating");
260
261 // Availability Schedule Name Heating: Optional Object
262
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<WorkspaceObject> wo_ = workspaceObject.getTarget(HeatPump_AirToWaterFields::AvailabilityScheduleNameHeating)) {
263
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
264
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<Schedule> availabilityScheduleHeating_ = mo_->optionalCast<Schedule>()) {
265
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_hc.setAvailabilitySchedule(availabilityScheduleHeating_.get());
266 } else {
267 ✗ LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Availability Schedule Name Heating'");
268 1 }
269 1 }
270 1 }
271
272 // Rated Inlet Air Temperature in Heating Mode: Optional Double
273 1 if (boost::optional<double> ratedInletAirTemperature_ =
274
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::RatedInletAirTemperatureinHeatingMode)) {
275
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_hc.setRatedInletAirTemperature(ratedInletAirTemperature_.get());
276 }
277
278 // Rated Air Flow Rate in Heating Mode: Optional Double
279
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<double> ratedAirFlowRate_ = workspaceObject.getDouble(HeatPump_AirToWaterFields::RatedAirFlowRateinHeatingMode)) {
280
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_hc.setRatedAirFlowRate(ratedAirFlowRate_.get());
281 }
282
283 // Rated Leaving Water Temperature in Heating Mode: Optional Double
284 1 if (boost::optional<double> ratedLeavingWaterTemperature_ =
285
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::RatedLeavingWaterTemperatureinHeatingMode)) {
286
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_hc.setRatedLeavingWaterTemperature(ratedLeavingWaterTemperature_.get());
287 }
288
289 // Rated Water Flow Rate in Heating Mode: Optional Double
290
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<double> ratedWaterFlowRate_ = workspaceObject.getDouble(HeatPump_AirToWaterFields::RatedWaterFlowRateinHeatingMode)) {
291
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_hc.setRatedWaterFlowRate(ratedWaterFlowRate_.get());
292 }
293
294 // Minimum Outdoor Air Temperature in Heating Mode: Optional Double
295 1 if (boost::optional<double> minimumOutdoorAirTemperature_ =
296
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::MinimumOutdoorAirTemperatureinHeatingMode)) {
297
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_hc.setMinimumOutdoorAirTemperature(minimumOutdoorAirTemperature_.get());
298 }
299
300 // Maximum Outdoor Air Temperature in Heating Mode: Optional Double
301 1 if (boost::optional<double> maximumOutdoorAirTemperature_ =
302
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::MaximumOutdoorAirTemperatureinHeatingMode)) {
303
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_hc.setMaximumOutdoorAirTemperature(maximumOutdoorAirTemperature_.get());
304 }
305
306 // Minimum Leaving Water Temperature Curve Name in Heating Mode: Optional Object
307 1 if (boost::optional<WorkspaceObject> wo_ =
308
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getTarget(HeatPump_AirToWaterFields::MinimumLeavingWaterTemperatureCurveNameinHeatingMode)) {
309
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
310
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<Curve> minimumLeavingWaterTemperatureCurveinHeatingMode_ = mo_->optionalCast<Curve>()) {
311
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_hc.setMinimumLeavingWaterTemperatureCurve(minimumLeavingWaterTemperatureCurveinHeatingMode_.get());
312 } else {
313 ✗ LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Minimum Leaving Water Temperature Curve Name in Heating Mode'");
314 1 }
315 1 }
316 1 }
317 // Maximum Leaving Water Temperature Curve Name in Heating Mode: Optional Object
318 1 if (boost::optional<WorkspaceObject> wo_ =
319
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getTarget(HeatPump_AirToWaterFields::MaximumLeavingWaterTemperatureCurveNameinHeatingMode)) {
320
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
321
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<Curve> maximumLeavingWaterTemperatureCurveinHeatingMode_ = mo_->optionalCast<Curve>()) {
322
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_hc.setMaximumLeavingWaterTemperatureCurve(maximumLeavingWaterTemperatureCurveinHeatingMode_.get());
323 } else {
324 ✗ LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Maximum Leaving Water Temperature Curve Name in Heating Mode'");
325 1 }
326 1 }
327 1 }
328
329 // Sizing Factor for Heating: Optional Double
330
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<double> sizingFactor_ = workspaceObject.getDouble(HeatPump_AirToWaterFields::SizingFactorforHeating)) {
331
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 awhp_hc.setSizingFactor(sizingFactor_.get());
332 }
333
334 1 unsigned startIndex = HeatPump_AirToWaterFields::RatedHeatingCapacityatSpeed1;
335 1 const unsigned number_fields =
336 1 static_cast<unsigned>(HeatPump_AirToWaterFields::HeatingEnergyInputRatioFunctionofPLRCurveNameatSpeed1) - startIndex + 1;
337
338 25 auto getFieldIndex = [&startIndex](HeatPump_AirToWaterFields::domain field) -> unsigned {
339 25 return startIndex + (static_cast<unsigned>(field) - static_cast<unsigned>(HeatPump_AirToWaterFields::RatedHeatingCapacityatSpeed1));
340 1 };
341
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 time.
6 for (int i = 1; i <= numberofSpeedsforHeating; ++i) {
342
343
1/1
✓ Branch 1 taken 5 times.
5 HeatPumpAirToWaterHeatingSpeedData speed(m_model);
344
4/4
✓ Branch 2 taken 5 times.
✓ Branch 5 taken 5 times.
✓ Branch 8 taken 5 times.
✓ Branch 11 taken 5 times.
5 speed.setName(awhp_hc.nameString() + " Speed " + std::to_string(i));
345 // Rated Heating Capacity at Speed
346 5 if (boost::optional<double> ratedHeatingCapacityatSpeed_ =
347
3/3
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 1 time.
10 workspaceObject.getDouble(getFieldIndex(HeatPump_AirToWaterFields::RatedHeatingCapacityatSpeed1))) {
348
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 speed.setRatedHeatingCapacity(ratedHeatingCapacityatSpeed_.get());
349 }
350
351 // Rated COP for Heating at Speed
352 5 if (boost::optional<double> ratedCOPforHeatingatSpeed_ =
353
2/3
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
10 workspaceObject.getDouble(getFieldIndex(HeatPump_AirToWaterFields::RatedCOPforHeatingatSpeed1))) {
354
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 speed.setRatedCOPforHeating(ratedCOPforHeatingatSpeed_.get());
355 }
356
357 // Normalized Heating Capacity Function of Temperature Curve Name at Speed
358 5 if (boost::optional<WorkspaceObject> wo_ =
359
2/3
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
10 workspaceObject.getTarget(getFieldIndex(HeatPump_AirToWaterFields::NormalizedHeatingCapacityFunctionofTemperatureCurveNameatSpeed1))) {
360
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (boost::optional<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
361
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (boost::optional<Curve> normalizedHeatingCapacityFunctionofTemperatureCurveatSpeed_ = mo_->optionalCast<Curve>()) {
362
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 speed.normalizedHeatingCapacityFunctionofTemperatureCurve().remove();
363
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 speed.setNormalizedHeatingCapacityFunctionofTemperatureCurve(normalizedHeatingCapacityFunctionofTemperatureCurveatSpeed_.get());
364 } else {
365 ✗ LOG(Warn, workspaceObject.briefDescription()
366 << " has a wrong type for 'Normalized Heating Capacity Function of Temperature Curve Name at Speed " << i);
367 5 }
368 5 }
369 5 }
370
371 // Heating Energy Input Ratio Function of Temperature Curve Name at Speed
372 5 if (boost::optional<WorkspaceObject> wo_ =
373
2/3
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
10 workspaceObject.getTarget(getFieldIndex(HeatPump_AirToWaterFields::HeatingEnergyInputRatioFunctionofTemperatureCurveNameatSpeed1))) {
374
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (boost::optional<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
375
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (boost::optional<Curve> heatingEnergyInputRatioFunctionofTemperatureCurveatSpeed_ = mo_->optionalCast<Curve>()) {
376
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 speed.heatingEnergyInputRatioFunctionofTemperatureCurve().remove();
377
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 speed.setHeatingEnergyInputRatioFunctionofTemperatureCurve(heatingEnergyInputRatioFunctionofTemperatureCurveatSpeed_.get());
378 } else {
379 ✗ LOG(Warn, workspaceObject.briefDescription()
380 << " has a wrong type for 'Heating Energy Input Ratio Function of Temperature Curve Name at Speed " << i);
381 5 }
382 5 }
383 5 }
384
385 // Heating Energy Input Ratio Function of PLR Curve Name at Speed
386 5 if (boost::optional<WorkspaceObject> wo_ =
387
2/3
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
10 workspaceObject.getTarget(getFieldIndex(HeatPump_AirToWaterFields::HeatingEnergyInputRatioFunctionofPLRCurveNameatSpeed1))) {
388
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (boost::optional<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
389
3/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 if (boost::optional<Curve> heatingEnergyInputRatioFunctionofPLRCurveatSpeed_ = mo_->optionalCast<Curve>()) {
390
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 speed.heatingEnergyInputRatioFunctionofPLRCurve().remove();
391
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 speed.setHeatingEnergyInputRatioFunctionofPLRCurve(heatingEnergyInputRatioFunctionofPLRCurveatSpeed_.get());
392 } else {
393 ✗ LOG(Warn, workspaceObject.briefDescription()
394 << " has a wrong type for 'Heating Energy Input Ratio Function of PLR Curve Name at Speed " << i)
395 5 }
396 5 }
397 5 }
398
399
2/3
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
5 if (!awhp_hc.addSpeed(speed)) {
400 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot add speed data " << i << " to HeatPumpAirToWaterHeating");
401 }
402
403 5 startIndex += number_fields;
404 5 }
405
406 // Booster Mode On Heating: Optional Boolean
407
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 const std::string boosterModeOnHeating = workspaceObject.getString(HeatPump_AirToWaterFields::BoosterModeOnHeating, true).get();
408
3/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
2 if (istringEqual("Yes", boosterModeOnHeating)) {
409
1/1
✓ Branch 1 taken 1 time.
1 HeatPumpAirToWaterHeatingSpeedData speed(m_model);
410
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 speed.setName(awhp_hc.nameString() + " Booster Mode On Speed");
411
412 // Rated Heating Capacity in Booster Mode: Optional Double
413 1 if (boost::optional<double> ratedHeatingCapacityinBoosterMode_ =
414
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::RatedHeatingCapacityinBoosterMode)) {
415
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.setRatedHeatingCapacity(ratedHeatingCapacityinBoosterMode_.get());
416 }
417
418 // Rated Heating COP in Booster Mode: Optional Double
419 1 if (boost::optional<double> ratedHeatingCOPinBoosterMode_ =
420
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::RatedHeatingCOPinBoosterMode)) {
421
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.setRatedCOPforHeating(ratedHeatingCOPinBoosterMode_.get());
422 }
423
424 // Normalized Heating Capacity Function of Temperature Curve Name in Booster Mode: Optional Object
425 1 if (boost::optional<WorkspaceObject> wo_ =
426
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getTarget(HeatPump_AirToWaterFields::NormalizedHeatingCapacityFunctionofTemperatureCurveNameinBoosterMode)) {
427
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
428
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<Curve> normalizedHeatingCapacityFunctionofTemperatureCurveinBoosterMode_ = mo_->optionalCast<Curve>()) {
429
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.normalizedHeatingCapacityFunctionofTemperatureCurve().remove();
430
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.setNormalizedHeatingCapacityFunctionofTemperatureCurve(normalizedHeatingCapacityFunctionofTemperatureCurveinBoosterMode_.get());
431 } else {
432 ✗ LOG(Warn, workspaceObject.briefDescription()
433 << " has a wrong type for 'Normalized Heating Capacity Function of Temperature Curve Name in Booster Mode'");
434 1 }
435 1 }
436 1 }
437 // Heating Energy Input Ratio Function of Temperature Curve Name in Booster Mode: Optional Object
438 1 if (boost::optional<WorkspaceObject> wo_ =
439
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getTarget(HeatPump_AirToWaterFields::HeatingEnergyInputRatioFunctionofTemperatureCurveNameinBoosterMode)) {
440
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
441
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<Curve> heatingEnergyInputRatioFunctionofTemperatureCurveinBoosterMode_ = mo_->optionalCast<Curve>()) {
442
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.heatingEnergyInputRatioFunctionofTemperatureCurve().remove();
443
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.setHeatingEnergyInputRatioFunctionofTemperatureCurve(heatingEnergyInputRatioFunctionofTemperatureCurveinBoosterMode_.get());
444 } else {
445 ✗ LOG(Warn, workspaceObject.briefDescription()
446 << " has a wrong type for 'Heating Energy Input Ratio Function of Temperature Curve Name in Booster Mode'");
447 1 }
448 1 }
449 1 }
450 // Heating Energy Input Ratio Function of PLR Curve Name in Booster Mode: Optional Object
451 1 if (boost::optional<WorkspaceObject> wo_ =
452
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getTarget(HeatPump_AirToWaterFields::HeatingEnergyInputRatioFunctionofPLRCurveNameinBoosterMode)) {
453
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
454
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<Curve> heatingEnergyInputRatioFunctionofPLRCurveinBoosterMode_ = mo_->optionalCast<Curve>()) {
455
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.heatingEnergyInputRatioFunctionofPLRCurve().remove();
456
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 speed.setHeatingEnergyInputRatioFunctionofPLRCurve(heatingEnergyInputRatioFunctionofPLRCurveinBoosterMode_.get());
457 } else {
458 ✗ LOG(Warn, workspaceObject.briefDescription()
459 << " has a wrong type for 'Heating Energy Input Ratio Function of PLR Curve Name in Booster Mode'");
460 1 }
461 1 }
462 1 }
463
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
1 if (!awhp_hc.setBoosterModeOnSpeed(speed)) {
464 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot set booster mode on speed to HeatPumpAirToWaterHeating");
465 }
466 1 }
467
468
1/1
✓ Branch 1 taken 1 time.
1 return awhp_hc;
469 1 }
470
471 1 boost::optional<ModelObject> ReverseTranslator::translateHeatPumpAirToWater(const WorkspaceObject& workspaceObject) {
472
473
1/1
✓ Branch 1 taken 1 time.
1 openstudio::model::HeatPumpAirToWater modelObject(m_model);
474
475 // Name
476
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<std::string> name_ = workspaceObject.name()) {
477
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setName(name_.get());
478 1 }
479
480 // Operating Mode Control Method: Optional String
481
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<std::string> operatingModeControlMethod_ = workspaceObject.getString(HeatPump_AirToWaterFields::OperatingModeControlMethod)) {
482
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setOperatingModeControlMethod(operatingModeControlMethod_.get());
483 1 }
484
485 // Operating Mode Control Option for Multiple Unit: Optional String
486 1 if (boost::optional<std::string> operatingModeControlOptionforMultipleUnit_ =
487
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getString(HeatPump_AirToWaterFields::OperatingModeControlOptionforMultipleUnit)) {
488
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setOperatingModeControlOptionforMultipleUnit(operatingModeControlOptionforMultipleUnit_.get());
489 1 }
490
491 // Operating Mode Control Schedule Name: Optional Object
492
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<WorkspaceObject> wo_ = workspaceObject.getTarget(HeatPump_AirToWaterFields::OperatingModeControlScheduleName)) {
493
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
494
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<Schedule> operatingModeControlSchedule_ = mo_->optionalCast<Schedule>()) {
495
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setOperatingModeControlSchedule(operatingModeControlSchedule_.get());
496 } else {
497 ✗ LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Operating Mode Control Schedule Name'");
498 1 }
499 1 }
500 1 }
501
502 // Minimum Part Load Ratio: Optional Double
503
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<double> minimumPartLoadRatio_ = workspaceObject.getDouble(HeatPump_AirToWaterFields::MinimumPartLoadRatio)) {
504
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setMinimumPartLoadRatio(minimumPartLoadRatio_.get());
505 }
506
507 // Air Inlet Node Name: Required Node
508
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto airInletNodeName_ = workspaceObject.getString(HeatPump_AirToWaterFields::AirInletNodeName)) {
509
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setAirInletNodeName(airInletNodeName_.get());
510 1 }
511
512 // Air Outlet Node Name: Required Node
513
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto airOutletNodeName_ = workspaceObject.getString(HeatPump_AirToWaterFields::AirOutletNodeName)) {
514
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setAirOutletNodeName(airOutletNodeName_.get());
515 1 }
516 // Hot Water Inlet Node Name: Optional Node
517
518 // Hot Water Outlet Node Name: Optional Node
519
520 // Chilled Water Inlet Node Name: Optional Node
521
522 // Chilled Water Outlet Node Name: Optional Node
523
524 // Maximum Outdoor Dry Bulb Temperature For Defrost Operation: Optional Double
525 1 if (boost::optional<double> maximumOutdoorDryBulbTemperatureForDefrostOperation_ =
526
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::MaximumOutdoorDryBulbTemperatureForDefrostOperation)) {
527
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setMaximumOutdoorDryBulbTemperatureForDefrostOperation(maximumOutdoorDryBulbTemperatureForDefrostOperation_.get());
528 }
529
530 // Heat Pump Defrost Control: Optional String
531
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<std::string> heatPumpDefrostControl_ = workspaceObject.getString(HeatPump_AirToWaterFields::HeatPumpDefrostControl)) {
532
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setHeatPumpDefrostControl(heatPumpDefrostControl_.get());
533 1 }
534
535 // Heat Pump Defrost Time Period Fraction: Optional Double
536 1 if (boost::optional<double> heatPumpDefrostTimePeriodFraction_ =
537
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::HeatPumpDefrostTimePeriodFraction)) {
538
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setHeatPumpDefrostTimePeriodFraction(heatPumpDefrostTimePeriodFraction_.get());
539 }
540
541 // Resistive Defrost Heater Capacity: Optional Double
542 1 if (boost::optional<double> resistiveDefrostHeaterCapacity_ =
543
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::ResistiveDefrostHeaterCapacity)) {
544
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setResistiveDefrostHeaterCapacity(resistiveDefrostHeaterCapacity_.get());
545 }
546
547 // Defrost Energy Input Ratio Function of Temperature Curve Name: Optional Object
548 1 if (boost::optional<WorkspaceObject> wo_ =
549
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getTarget(HeatPump_AirToWaterFields::DefrostEnergyInputRatioFunctionofTemperatureCurveName)) {
550
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
551
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<Curve> defrostEnergyInputRatioFunctionofTemperatureCurve_ = mo_->optionalCast<Curve>()) {
552
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setDefrostEnergyInputRatioFunctionofTemperatureCurve(defrostEnergyInputRatioFunctionofTemperatureCurve_.get());
553 } else {
554 ✗ LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Defrost Energy Input Ratio Function of Temperature Curve Name'");
555 1 }
556 1 }
557 1 }
558 // Heat Pump Multiplier: Optional Integer
559
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<int> heatPumpMultiplier_ = workspaceObject.getInt(HeatPump_AirToWaterFields::HeatPumpMultiplier)) {
560
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setHeatPumpMultiplier(heatPumpMultiplier_.get());
561 }
562
563 // Control Type: Optional String
564
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<std::string> controlType_ = workspaceObject.getString(HeatPump_AirToWaterFields::ControlType)) {
565
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setControlType(controlType_.get());
566 1 }
567
568 // Crankcase Heater Capacity: Optional Double
569
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<double> crankcaseHeaterCapacity_ = workspaceObject.getDouble(HeatPump_AirToWaterFields::CrankcaseHeaterCapacity)) {
570
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setCrankcaseHeaterCapacity(crankcaseHeaterCapacity_.get());
571 }
572
573 // Crankcase Heater Capacity Function of Temperature Curve Name: Optional Object
574 1 if (boost::optional<WorkspaceObject> wo_ =
575
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getTarget(HeatPump_AirToWaterFields::CrankcaseHeaterCapacityFunctionofTemperatureCurveName)) {
576
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<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) {
577
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<Curve> crankcaseHeaterCapacityFunctionofTemperatureCurve_ = mo_->optionalCast<Curve>()) {
578
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setCrankcaseHeaterCapacityFunctionofTemperatureCurve(crankcaseHeaterCapacityFunctionofTemperatureCurve_.get());
579 } else {
580 ✗ LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Crankcase Heater Capacity Function of Temperature Curve Name'");
581 1 }
582 1 }
583 1 }
584 // Maximum Ambient Temperature for Crankcase Heater Operation: Optional Double
585 1 if (boost::optional<double> maximumAmbientTemperatureforCrankcaseHeaterOperation_ =
586
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 workspaceObject.getDouble(HeatPump_AirToWaterFields::MaximumAmbientTemperatureforCrankcaseHeaterOperation)) {
587
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 modelObject.setMaximumAmbientTemperatureforCrankcaseHeaterOperation(maximumAmbientTemperatureforCrankcaseHeaterOperation_.get());
588 }
589
590
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto awhp_hc_ = translateHeatPumpAirToWaterHeating(workspaceObject)) {
591
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 modelObject.setHeatingOperationMode(awhp_hc_->cast<HeatPumpAirToWaterHeating>());
592 1 }
593
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto awhp_cc_ = translateHeatPumpAirToWaterCooling(workspaceObject)) {
594
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 modelObject.setCoolingOperationMode(awhp_cc_->cast<HeatPumpAirToWaterCooling>());
595 1 }
596
597
1/1
✓ Branch 1 taken 1 time.
2 return modelObject;
598 1 } // End of translate function
599
600 } // end namespace energyplus
601 } // end namespace openstudio
602