GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 81.3% 204 / 0 / 251
Functions: 82.6% 38 / 0 / 46
Branches: 64.7% 240 / 0 / 371

src/model/HeatPumpAirToWaterHeatingSpeedData.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 "HeatPumpAirToWaterHeatingSpeedData.hpp"
7 #include "HeatPumpAirToWaterHeatingSpeedData_Impl.hpp"
8
9 #include "HeatPumpAirToWaterHeating.hpp"
10 #include "HeatPumpAirToWaterHeating_Impl.hpp"
11
12 #include "Model.hpp"
13 #include "Model_Impl.hpp"
14 #include "Curve.hpp"
15 #include "Curve_Impl.hpp"
16 #include "CurveBiquadratic.hpp"
17 #include "CurveQuadratic.hpp"
18
19 #include "../utilities/core/Assert.hpp"
20
21 #include <utilities/idd/IddEnums.hxx>
22 #include <utilities/idd/OS_HeatPump_AirToWater_Heating_SpeedData_FieldEnums.hxx>
23
24 #include <fmt/format.h>
25
26 namespace openstudio {
27 namespace model {
28
29 namespace detail {
30
31 53 HeatPumpAirToWaterHeatingSpeedData_Impl::HeatPumpAirToWaterHeatingSpeedData_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
32 53 : ResourceObject_Impl(idfObject, model, keepHandle) {
33
4/6
✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
✓ Branch 7 taken 53 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 53 times.
✗ Branch 13 not taken.
53 OS_ASSERT(idfObject.iddObject().type() == HeatPumpAirToWaterHeatingSpeedData::iddObjectType());
34 53 }
35
36 ✗ HeatPumpAirToWaterHeatingSpeedData_Impl::HeatPumpAirToWaterHeatingSpeedData_Impl(const openstudio::detail::WorkspaceObject_Impl& other,
37 ✗ Model_Impl* model, bool keepHandle)
38 ✗ : ResourceObject_Impl(other, model, keepHandle) {
39 ✗ OS_ASSERT(other.iddObject().type() == HeatPumpAirToWaterHeatingSpeedData::iddObjectType());
40 ✗ }
41
42 38 HeatPumpAirToWaterHeatingSpeedData_Impl::HeatPumpAirToWaterHeatingSpeedData_Impl(const HeatPumpAirToWaterHeatingSpeedData_Impl& other,
43 38 Model_Impl* model, bool keepHandle)
44 38 : ResourceObject_Impl(other, model, keepHandle) {}
45
46 ✗ const std::vector<std::string>& HeatPumpAirToWaterHeatingSpeedData_Impl::outputVariableNames() const {
47 ✗ static std::vector<std::string> result;
48 ✗ if (result.empty()) {
49 }
50 ✗ return result;
51 }
52
53 ✗ IddObjectType HeatPumpAirToWaterHeatingSpeedData_Impl::iddObjectType() const {
54 ✗ return HeatPumpAirToWaterHeatingSpeedData::iddObjectType();
55 }
56
57 14 std::vector<ModelObject> HeatPumpAirToWaterHeatingSpeedData_Impl::children() const {
58 14 std::vector<ModelObject> children;
59
2/3
✓ Branch 1 taken 14 times.
✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
28 if (auto c_ = optionalNormalizedHeatingCapacityFunctionofTemperatureCurve()) {
60
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 children.push_back(*c_);
61 14 }
62
2/3
✓ Branch 1 taken 14 times.
✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
28 if (auto c_ = optionalHeatingEnergyInputRatioFunctionofTemperatureCurve()) {
63
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 children.push_back(*c_);
64 14 }
65
2/3
✓ Branch 1 taken 14 times.
✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
28 if (auto c_ = optionalHeatingEnergyInputRatioFunctionofPLRCurve()) {
66
2/2
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
14 children.push_back(*c_);
67 14 }
68
69 14 return children;
70 ✗ }
71
72 7 ModelObject HeatPumpAirToWaterHeatingSpeedData_Impl::clone(Model model) const {
73 // Don't clone the curves (listed as children)
74
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 return ModelObject_Impl::clone(model); // NOLINT(bugprone-parent-virtual-call)
75 }
76
77 22 boost::optional<double> HeatPumpAirToWaterHeatingSpeedData_Impl::ratedHeatingCapacity() const {
78 22 return getDouble(OS_HeatPump_AirToWater_Heating_SpeedDataFields::RatedHeatingCapacity, true);
79 }
80
81 22 bool HeatPumpAirToWaterHeatingSpeedData_Impl::isRatedHeatingCapacityAutosized() const {
82 22 bool result = false;
83
1/1
✓ Branch 1 taken 22 times.
22 boost::optional<std::string> value = getString(OS_HeatPump_AirToWater_Heating_SpeedDataFields::RatedHeatingCapacity, true);
84
1/2
✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
22 if (value) {
85
3/3
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
44 result = openstudio::istringEqual(value.get(), "autosize");
86 }
87 22 return result;
88 22 }
89
90 ✗ boost::optional<double> HeatPumpAirToWaterHeatingSpeedData_Impl::autosizedRatedHeatingCapacity() {
91 ✗ boost::optional<double> result;
92 ✗ auto awhp_hcs = heatPumpAirToWaterHeatings();
93 ✗ if (awhp_hcs.empty()) {
94 ✗ return result;
95 }
96 ✗ size_t n_found = 0;
97 ✗ for (const auto& awhp_hc : awhp_hcs) {
98 // Check needed because could be the booster speed
99 ✗ if (awhp_hc.speeds().empty()) {
100 ✗ continue;
101 }
102 // It has to be the last speed
103 ✗ if (awhp_hc.speeds().back().handle() != this->handle()) {
104 ✗ continue;
105 }
106 ✗ if (n_found == 0) {
107 // Setting the first one only
108 ✗ result = awhp_hc.autosizedRatedHeatingCapacity();
109 }
110 ✗ ++n_found;
111 }
112 ✗ if (n_found > 1) {
113 ✗ LOG(Warn, briefDescription() << " is used as the highest speed in multiple HeatPumpAirToWaterHeating objects, "
114 "returning the autosized value from the first one only.");
115 }
116
117 ✗ return result;
118 ✗ }
119
120 24 double HeatPumpAirToWaterHeatingSpeedData_Impl::ratedCOPforHeating() const {
121
1/1
✓ Branch 1 taken 24 times.
24 boost::optional<double> value = getDouble(OS_HeatPump_AirToWater_Heating_SpeedDataFields::RatedCOPforHeating, true);
122
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 4 not taken.
24 OS_ASSERT(value);
123
1/1
✓ Branch 1 taken 24 times.
48 return value.get();
124 }
125
126 41 Curve HeatPumpAirToWaterHeatingSpeedData_Impl::normalizedHeatingCapacityFunctionofTemperatureCurve() const {
127
1/1
✓ Branch 1 taken 41 times.
41 boost::optional<Curve> value = optionalNormalizedHeatingCapacityFunctionofTemperatureCurve();
128
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 41 times.
41 if (!value) {
129 ✗ LOG_AND_THROW(briefDescription() << " does not have an Normalized Heating Capacity Functionof Temperature Curve attached.");
130 }
131
2/2
✓ Branch 1 taken 41 times.
✓ Branch 4 taken 41 times.
82 return value.get();
132 41 }
133
134 41 Curve HeatPumpAirToWaterHeatingSpeedData_Impl::heatingEnergyInputRatioFunctionofTemperatureCurve() const {
135
1/1
✓ Branch 1 taken 41 times.
41 boost::optional<Curve> value = optionalHeatingEnergyInputRatioFunctionofTemperatureCurve();
136
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 41 times.
41 if (!value) {
137 ✗ LOG_AND_THROW(briefDescription() << " does not have an Heating Energy Input Ratio Functionof Temperature Curve attached.");
138 }
139
2/2
✓ Branch 1 taken 41 times.
✓ Branch 4 taken 41 times.
82 return value.get();
140 41 }
141
142 41 Curve HeatPumpAirToWaterHeatingSpeedData_Impl::heatingEnergyInputRatioFunctionofPLRCurve() const {
143
1/1
✓ Branch 1 taken 41 times.
41 boost::optional<Curve> value = optionalHeatingEnergyInputRatioFunctionofPLRCurve();
144
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 41 times.
41 if (!value) {
145 ✗ LOG_AND_THROW(briefDescription() << " does not have an Heating Energy Input Ratio Functionof PLRCurve attached.");
146 }
147
2/2
✓ Branch 1 taken 41 times.
✓ Branch 4 taken 41 times.
82 return value.get();
148 41 }
149
150 18 bool HeatPumpAirToWaterHeatingSpeedData_Impl::setRatedHeatingCapacity(double ratedHeatingCapacity) {
151 18 const bool result = setDouble(OS_HeatPump_AirToWater_Heating_SpeedDataFields::RatedHeatingCapacity, ratedHeatingCapacity);
152 18 return result;
153 }
154
155 56 void HeatPumpAirToWaterHeatingSpeedData_Impl::autosizeRatedHeatingCapacity() {
156
2/2
✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
112 const bool result = setString(OS_HeatPump_AirToWater_Heating_SpeedDataFields::RatedHeatingCapacity, "autosize");
157
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
56 OS_ASSERT(result);
158 56 }
159
160 74 bool HeatPumpAirToWaterHeatingSpeedData_Impl::setRatedCOPforHeating(double ratedCOPforHeating) {
161 74 const bool result = setDouble(OS_HeatPump_AirToWater_Heating_SpeedDataFields::RatedCOPforHeating, ratedCOPforHeating);
162 74 return result;
163 }
164
165 60 bool HeatPumpAirToWaterHeatingSpeedData_Impl::setNormalizedHeatingCapacityFunctionofTemperatureCurve(const Curve& bivariateFunctions) {
166
1/1
✓ Branch 1 taken 60 times.
60 const bool result = setPointer(OS_HeatPump_AirToWater_Heating_SpeedDataFields::NormalizedHeatingCapacityFunctionofTemperatureCurveName,
167
1/1
✓ Branch 1 taken 60 times.
60 bivariateFunctions.handle());
168 60 return result;
169 }
170
171 59 bool HeatPumpAirToWaterHeatingSpeedData_Impl::setHeatingEnergyInputRatioFunctionofTemperatureCurve(const Curve& bivariateFunctions) {
172
1/1
✓ Branch 1 taken 59 times.
59 const bool result = setPointer(OS_HeatPump_AirToWater_Heating_SpeedDataFields::HeatingEnergyInputRatioFunctionofTemperatureCurveName,
173
1/1
✓ Branch 1 taken 59 times.
59 bivariateFunctions.handle());
174 59 return result;
175 }
176
177 57 bool HeatPumpAirToWaterHeatingSpeedData_Impl::setHeatingEnergyInputRatioFunctionofPLRCurve(const Curve& univariateFunctions) {
178 const bool result =
179
2/2
✓ Branch 1 taken 57 times.
✓ Branch 4 taken 57 times.
57 setPointer(OS_HeatPump_AirToWater_Heating_SpeedDataFields::HeatingEnergyInputRatioFunctionofPLRCurveName, univariateFunctions.handle());
180 57 return result;
181 }
182
183 ✗ void HeatPumpAirToWaterHeatingSpeedData_Impl::autosize() {
184 ✗ autosizeRatedHeatingCapacity();
185 ✗ }
186
187 ✗ void HeatPumpAirToWaterHeatingSpeedData_Impl::applySizingValues() {
188 ✗ if (boost::optional<double> val_ = autosizedRatedHeatingCapacity()) {
189 ✗ setRatedHeatingCapacity(*val_);
190 }
191 ✗ }
192
193 55 boost::optional<Curve> HeatPumpAirToWaterHeatingSpeedData_Impl::optionalNormalizedHeatingCapacityFunctionofTemperatureCurve() const {
194
1/1
✓ Branch 1 taken 55 times.
110 return getObject<ModelObject>().getModelObjectTarget<Curve>(
195
1/1
✓ Branch 1 taken 55 times.
110 OS_HeatPump_AirToWater_Heating_SpeedDataFields::NormalizedHeatingCapacityFunctionofTemperatureCurveName);
196 }
197
198 55 boost::optional<Curve> HeatPumpAirToWaterHeatingSpeedData_Impl::optionalHeatingEnergyInputRatioFunctionofTemperatureCurve() const {
199
1/1
✓ Branch 1 taken 55 times.
110 return getObject<ModelObject>().getModelObjectTarget<Curve>(
200
1/1
✓ Branch 1 taken 55 times.
110 OS_HeatPump_AirToWater_Heating_SpeedDataFields::HeatingEnergyInputRatioFunctionofTemperatureCurveName);
201 }
202
203 55 boost::optional<Curve> HeatPumpAirToWaterHeatingSpeedData_Impl::optionalHeatingEnergyInputRatioFunctionofPLRCurve() const {
204
1/1
✓ Branch 1 taken 55 times.
110 return getObject<ModelObject>().getModelObjectTarget<Curve>(
205
1/1
✓ Branch 1 taken 55 times.
110 OS_HeatPump_AirToWater_Heating_SpeedDataFields::HeatingEnergyInputRatioFunctionofPLRCurveName);
206 }
207
208 11 std::vector<HeatPumpAirToWaterHeating> HeatPumpAirToWaterHeatingSpeedData_Impl::heatPumpAirToWaterHeatings() const {
209 11 std::vector<HeatPumpAirToWaterHeating> result;
210
211
1/1
✓ Branch 1 taken 11 times.
11 const auto handle = this->handle();
212
213
4/4
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 12 taken 21 times.
✓ Branch 13 taken 11 times.
32 for (const auto& awhp : model().getConcreteModelObjects<HeatPumpAirToWaterHeating>()) {
214
5/19
✓ Branch 1 taken 21 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 21 times.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 21 times.
✓ Branch 23 taken 21 times.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 21 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
42 if (awhp.boosterModeOnSpeed() && awhp.boosterModeOnSpeed()->handle() == handle) {
215 ✗ result.push_back(awhp);
216 } else {
217
1/1
✓ Branch 1 taken 21 times.
21 const auto speeds = awhp.speeds();
218
1/1
✓ Branch 3 taken 21 times.
21 if (std::find_if(speeds.cbegin(), speeds.cend(),
219
2/2
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
18 [handle](const HeatPumpAirToWaterHeatingSpeedData& speed) { return speed.handle() == handle; })
220
2/2
✓ Branch 2 taken 11 times.
✓ Branch 3 taken 10 times.
42 != speeds.end()) {
221
1/1
✓ Branch 1 taken 11 times.
11 result.push_back(awhp);
222 }
223 21 }
224 11 }
225 22 return result;
226 ✗ }
227
228 } // namespace detail
229
230 47 HeatPumpAirToWaterHeatingSpeedData::HeatPumpAirToWaterHeatingSpeedData(const Model& model)
231 47 : ResourceObject(HeatPumpAirToWaterHeatingSpeedData::iddObjectType(), model) {
232
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 47 times.
✗ Branch 5 not taken.
47 OS_ASSERT(getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>());
233
234
1/1
✓ Branch 1 taken 47 times.
47 autosizeRatedHeatingCapacity();
235
1/1
✓ Branch 1 taken 47 times.
47 setRatedCOPforHeating(3.0);
236
237 47 bool ok = true;
238 {
239
1/1
✓ Branch 1 taken 47 times.
47 CurveBiquadratic capFT(model);
240
2/2
✓ Branch 1 taken 47 times.
✓ Branch 5 taken 47 times.
94 capFT.setName(fmt::format("{} CapCurveFuncTempHT", this->nameString()));
241
1/1
✓ Branch 1 taken 47 times.
47 capFT.setCoefficient1Constant(0.885);
242
1/1
✓ Branch 1 taken 47 times.
47 capFT.setCoefficient2x(-0.00040);
243
1/1
✓ Branch 1 taken 47 times.
47 capFT.setCoefficient3xPOW2(0.00019);
244
1/1
✓ Branch 1 taken 47 times.
47 capFT.setCoefficient4y(0.0202);
245
1/1
✓ Branch 1 taken 47 times.
47 capFT.setCoefficient5yPOW2(-0.0096);
246
1/1
✓ Branch 1 taken 47 times.
47 capFT.setCoefficient6xTIMESY(0.000580);
247
1/1
✓ Branch 1 taken 47 times.
47 capFT.setMinimumValueofx(30.0);
248
1/1
✓ Branch 1 taken 47 times.
47 capFT.setMaximumValueofx(50.0);
249
1/1
✓ Branch 1 taken 47 times.
47 capFT.setMinimumValueofy(-7.0);
250
1/1
✓ Branch 1 taken 47 times.
47 capFT.setMaximumValueofy(20.0);
251
1/1
✓ Branch 1 taken 47 times.
47 capFT.setMinimumCurveOutput(0.5);
252
1/1
✓ Branch 1 taken 47 times.
47 capFT.setMaximumCurveOutput(1.3);
253
2/2
✓ Branch 1 taken 47 times.
✓ Branch 4 taken 47 times.
94 capFT.setInputUnitTypeforX("Temperature");
254
2/2
✓ Branch 1 taken 47 times.
✓ Branch 4 taken 47 times.
94 capFT.setInputUnitTypeforY("Temperature");
255
2/2
✓ Branch 1 taken 47 times.
✓ Branch 4 taken 47 times.
47 capFT.setOutputUnitType("Dimensionless");
256
257
1/1
✓ Branch 1 taken 47 times.
47 ok = setNormalizedHeatingCapacityFunctionofTemperatureCurve(capFT);
258
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
✗ Branch 3 not taken.
47 OS_ASSERT(ok);
259 47 }
260
261 {
262
1/1
✓ Branch 1 taken 47 times.
47 CurveBiquadratic eirFT(model);
263
2/2
✓ Branch 1 taken 47 times.
✓ Branch 5 taken 47 times.
94 eirFT.setName(fmt::format("{} EIRCurveFuncTempHT", this->nameString()));
264
1/1
✓ Branch 1 taken 47 times.
47 eirFT.setCoefficient1Constant(1.055);
265
1/1
✓ Branch 1 taken 47 times.
47 eirFT.setCoefficient2x(0.00035);
266
1/1
✓ Branch 1 taken 47 times.
47 eirFT.setCoefficient3xPOW2(-0.00027);
267
1/1
✓ Branch 1 taken 47 times.
47 eirFT.setCoefficient4y(-0.0108);
268
1/1
✓ Branch 1 taken 47 times.
47 eirFT.setCoefficient5yPOW2(0.0145);
269
1/1
✓ Branch 1 taken 47 times.
47 eirFT.setCoefficient6xTIMESY(-0.000230);
270
1/1
✓ Branch 1 taken 47 times.
47 eirFT.setMinimumValueofx(30.0);
271
1/1
✓ Branch 1 taken 47 times.
47 eirFT.setMaximumValueofx(50.0);
272
1/1
✓ Branch 1 taken 47 times.
47 eirFT.setMinimumValueofy(-7.0);
273
1/1
✓ Branch 1 taken 47 times.
47 eirFT.setMaximumValueofy(20.0);
274
1/1
✓ Branch 1 taken 47 times.
47 eirFT.setMinimumCurveOutput(0.7);
275
1/1
✓ Branch 1 taken 47 times.
47 eirFT.setMaximumCurveOutput(1.5);
276
2/2
✓ Branch 1 taken 47 times.
✓ Branch 4 taken 47 times.
94 eirFT.setInputUnitTypeforX("Temperature");
277
2/2
✓ Branch 1 taken 47 times.
✓ Branch 4 taken 47 times.
94 eirFT.setInputUnitTypeforY("Temperature");
278
2/2
✓ Branch 1 taken 47 times.
✓ Branch 4 taken 47 times.
47 eirFT.setOutputUnitType("Dimensionless");
279
280
1/1
✓ Branch 1 taken 47 times.
47 ok = setHeatingEnergyInputRatioFunctionofTemperatureCurve(eirFT);
281
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
✗ Branch 3 not taken.
47 OS_ASSERT(ok);
282 47 }
283
284 {
285
1/1
✓ Branch 1 taken 47 times.
47 CurveQuadratic eirfPLR(model);
286
2/2
✓ Branch 1 taken 47 times.
✓ Branch 5 taken 47 times.
94 eirfPLR.setName(fmt::format("{} EIRCurveFuncPLR", this->nameString()));
287
1/1
✓ Branch 1 taken 47 times.
47 eirfPLR.setCoefficient1Constant(1.0);
288
1/1
✓ Branch 1 taken 47 times.
47 eirfPLR.setCoefficient2x(0.0);
289
1/1
✓ Branch 1 taken 47 times.
47 eirfPLR.setCoefficient3xPOW2(0.0);
290
1/1
✓ Branch 1 taken 47 times.
47 eirfPLR.setMinimumValueofx(0.0);
291
1/1
✓ Branch 1 taken 47 times.
47 eirfPLR.setMaximumValueofx(1.0);
292
1/1
✓ Branch 1 taken 47 times.
47 eirfPLR.setMinimumCurveOutput(0.0);
293
1/1
✓ Branch 1 taken 47 times.
47 eirfPLR.setMaximumCurveOutput(1.0);
294
2/2
✓ Branch 1 taken 47 times.
✓ Branch 4 taken 47 times.
94 eirfPLR.setInputUnitTypeforX("Dimensionless");
295
2/2
✓ Branch 1 taken 47 times.
✓ Branch 4 taken 47 times.
47 eirfPLR.setOutputUnitType("Dimensionless");
296
1/1
✓ Branch 1 taken 47 times.
47 ok = setHeatingEnergyInputRatioFunctionofPLRCurve(eirfPLR);
297
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
✗ Branch 3 not taken.
47 OS_ASSERT(ok);
298 47 }
299 47 }
300
301 6 HeatPumpAirToWaterHeatingSpeedData::HeatPumpAirToWaterHeatingSpeedData(const Model& model,
302 const Curve& normalizedHeatingCapacityFunctionofTemperatureCurve,
303 const Curve& heatingEnergyInputRatioFunctionofTemperatureCurve,
304 6 const Curve& heatingEnergyInputRatioFunctionofPLRCurve)
305 6 : ResourceObject(HeatPumpAirToWaterHeatingSpeedData::iddObjectType(), model) {
306
307 6 auto impl = getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>();
308
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
6 OS_ASSERT(impl);
309
310
1/1
✓ Branch 1 taken 6 times.
6 autosizeRatedHeatingCapacity();
311
1/1
✓ Branch 1 taken 6 times.
6 setRatedCOPforHeating(3.0);
312
313
1/1
✓ Branch 1 taken 6 times.
6 bool ok = setNormalizedHeatingCapacityFunctionofTemperatureCurve(normalizedHeatingCapacityFunctionofTemperatureCurve);
314
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 5 times.
6 if (!ok) {
315 // We don't call remove() (which would do ResourceObject::remove()) because that would try to remove the curves too if they aren't being used,
316 // so we call ModelObject::remove() directly
317
1/1
✓ Branch 2 taken 1 time.
1 impl->detail::ModelObject_Impl::remove();
318
25/25
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 27 taken 1 time.
✓ Branch 30 taken 1 time.
✓ Branch 33 taken 1 time.
✓ Branch 39 taken 1 time.
✓ Branch 42 taken 1 time.
✓ Branch 45 taken 1 time.
✓ Branch 48 taken 1 time.
✓ Branch 51 taken 1 time.
✓ Branch 54 taken 1 time.
✓ Branch 57 taken 1 time.
✓ Branch 60 taken 1 time.
✓ Branch 63 taken 1 time.
✓ Branch 66 taken 1 time.
✓ Branch 69 taken 1 time.
✓ Branch 72 taken 1 time.
✓ Branch 78 taken 1 time.
✓ Branch 81 taken 1 time.
1 LOG_AND_THROW("Unable to set " << briefDescription() << "'s Capacity Curve to "
319 << normalizedHeatingCapacityFunctionofTemperatureCurve.briefDescription() << ".");
320 }
321
1/1
✓ Branch 1 taken 5 times.
5 ok = setHeatingEnergyInputRatioFunctionofTemperatureCurve(heatingEnergyInputRatioFunctionofTemperatureCurve);
322
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3 times.
5 if (!ok) {
323
1/1
✓ Branch 2 taken 2 times.
2 impl->detail::ModelObject_Impl::remove();
324
25/25
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 19 taken 2 times.
✓ Branch 22 taken 2 times.
✓ Branch 27 taken 2 times.
✓ Branch 30 taken 2 times.
✓ Branch 33 taken 2 times.
✓ Branch 39 taken 2 times.
✓ Branch 42 taken 2 times.
✓ Branch 45 taken 2 times.
✓ Branch 48 taken 2 times.
✓ Branch 51 taken 2 times.
✓ Branch 54 taken 2 times.
✓ Branch 57 taken 2 times.
✓ Branch 60 taken 2 times.
✓ Branch 63 taken 2 times.
✓ Branch 66 taken 2 times.
✓ Branch 69 taken 2 times.
✓ Branch 72 taken 2 times.
✓ Branch 78 taken 2 times.
✓ Branch 81 taken 2 times.
2 LOG_AND_THROW("Unable to set " << briefDescription() << "'s EIRfT Curve to "
325 << heatingEnergyInputRatioFunctionofTemperatureCurve.briefDescription() << ".");
326 }
327
1/1
✓ Branch 1 taken 3 times.
3 ok = setHeatingEnergyInputRatioFunctionofPLRCurve(heatingEnergyInputRatioFunctionofPLRCurve);
328
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
3 if (!ok) {
329
1/1
✓ Branch 2 taken 1 time.
1 impl->detail::ModelObject_Impl::remove();
330
25/25
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 27 taken 1 time.
✓ Branch 30 taken 1 time.
✓ Branch 33 taken 1 time.
✓ Branch 39 taken 1 time.
✓ Branch 42 taken 1 time.
✓ Branch 45 taken 1 time.
✓ Branch 48 taken 1 time.
✓ Branch 51 taken 1 time.
✓ Branch 54 taken 1 time.
✓ Branch 57 taken 1 time.
✓ Branch 60 taken 1 time.
✓ Branch 63 taken 1 time.
✓ Branch 66 taken 1 time.
✓ Branch 69 taken 1 time.
✓ Branch 72 taken 1 time.
✓ Branch 78 taken 1 time.
✓ Branch 81 taken 1 time.
1 LOG_AND_THROW("Unable to set " << briefDescription() << "'s EIRfPLR Curve to " << heatingEnergyInputRatioFunctionofPLRCurve.briefDescription()
331 << ".");
332 }
333 10 }
334
335 7727 IddObjectType HeatPumpAirToWaterHeatingSpeedData::iddObjectType() {
336
1/1
✓ Branch 1 taken 7727 times.
7727 return {IddObjectType::OS_HeatPump_AirToWater_Heating_SpeedData};
337 }
338
339 22 boost::optional<double> HeatPumpAirToWaterHeatingSpeedData::ratedHeatingCapacity() const {
340
1/1
✓ Branch 3 taken 22 times.
22 return getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->ratedHeatingCapacity();
341 }
342
343 22 bool HeatPumpAirToWaterHeatingSpeedData::isRatedHeatingCapacityAutosized() const {
344
1/1
✓ Branch 3 taken 22 times.
22 return getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->isRatedHeatingCapacityAutosized();
345 }
346
347 ✗ boost::optional<double> HeatPumpAirToWaterHeatingSpeedData::autosizedRatedHeatingCapacity() {
348 ✗ return getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->autosizedRatedHeatingCapacity();
349 }
350
351 24 double HeatPumpAirToWaterHeatingSpeedData::ratedCOPforHeating() const {
352
1/1
✓ Branch 3 taken 24 times.
24 return getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->ratedCOPforHeating();
353 }
354
355 41 Curve HeatPumpAirToWaterHeatingSpeedData::normalizedHeatingCapacityFunctionofTemperatureCurve() const {
356
1/1
✓ Branch 3 taken 41 times.
41 return getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->normalizedHeatingCapacityFunctionofTemperatureCurve();
357 }
358
359 41 Curve HeatPumpAirToWaterHeatingSpeedData::heatingEnergyInputRatioFunctionofTemperatureCurve() const {
360
1/1
✓ Branch 3 taken 41 times.
41 return getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->heatingEnergyInputRatioFunctionofTemperatureCurve();
361 }
362
363 41 Curve HeatPumpAirToWaterHeatingSpeedData::heatingEnergyInputRatioFunctionofPLRCurve() const {
364
1/1
✓ Branch 3 taken 41 times.
41 return getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->heatingEnergyInputRatioFunctionofPLRCurve();
365 }
366
367 18 bool HeatPumpAirToWaterHeatingSpeedData::setRatedHeatingCapacity(double ratedHeatingCapacity) {
368
1/1
✓ Branch 3 taken 18 times.
18 return getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->setRatedHeatingCapacity(ratedHeatingCapacity);
369 }
370
371 56 void HeatPumpAirToWaterHeatingSpeedData::autosizeRatedHeatingCapacity() {
372
1/1
✓ Branch 3 taken 56 times.
56 getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->autosizeRatedHeatingCapacity();
373 56 }
374
375 74 bool HeatPumpAirToWaterHeatingSpeedData::setRatedCOPforHeating(double ratedCOPforHeating) {
376
1/1
✓ Branch 3 taken 74 times.
74 return getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->setRatedCOPforHeating(ratedCOPforHeating);
377 }
378
379 60 bool HeatPumpAirToWaterHeatingSpeedData::setNormalizedHeatingCapacityFunctionofTemperatureCurve(const Curve& bivariateFunctions) {
380
1/1
✓ Branch 3 taken 60 times.
60 return getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->setNormalizedHeatingCapacityFunctionofTemperatureCurve(bivariateFunctions);
381 }
382
383 59 bool HeatPumpAirToWaterHeatingSpeedData::setHeatingEnergyInputRatioFunctionofTemperatureCurve(const Curve& bivariateFunctions) {
384
1/1
✓ Branch 3 taken 59 times.
59 return getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->setHeatingEnergyInputRatioFunctionofTemperatureCurve(bivariateFunctions);
385 }
386
387 57 bool HeatPumpAirToWaterHeatingSpeedData::setHeatingEnergyInputRatioFunctionofPLRCurve(const Curve& univariateFunctions) {
388
1/1
✓ Branch 3 taken 57 times.
57 return getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->setHeatingEnergyInputRatioFunctionofPLRCurve(univariateFunctions);
389 }
390
391 /// @cond
392 593 HeatPumpAirToWaterHeatingSpeedData::HeatPumpAirToWaterHeatingSpeedData(std::shared_ptr<detail::HeatPumpAirToWaterHeatingSpeedData_Impl> impl)
393
1/1
✓ Branch 3 taken 593 times.
593 : ResourceObject(std::move(impl)) {}
394 /// @endcond
395
396 ✗ void HeatPumpAirToWaterHeatingSpeedData::autosize() {
397 ✗ getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->autosizeRatedHeatingCapacity();
398 ✗ }
399
400 // TODO: needed?
401 // void HeatPumpAirToWaterHeatingSpeedData::applySizingValues() {
402 // getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->applySizingValues();
403 // }
404
405 11 std::vector<HeatPumpAirToWaterHeating> HeatPumpAirToWaterHeatingSpeedData::heatPumpAirToWaterHeatings() const {
406
1/1
✓ Branch 3 taken 11 times.
11 return getImpl<detail::HeatPumpAirToWaterHeatingSpeedData_Impl>()->heatPumpAirToWaterHeatings();
407 }
408
409 } // namespace model
410 } // namespace openstudio
411