GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 67.9% 127 / 0 / 187
Functions: 69.6% 39 / 0 / 56
Branches: 46.5% 67 / 0 / 144

src/model/SolarCollectorPerformanceFlatPlate.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 "SolarCollectorPerformanceFlatPlate.hpp"
7 #include "SolarCollectorPerformanceFlatPlate_Impl.hpp"
8
9 #include "SolarCollectorFlatPlateWater.hpp"
10 #include "SolarCollectorFlatPlateWater_Impl.hpp"
11
12 #include <utilities/idd/IddFactory.hxx>
13 #include <utilities/idd/OS_SolarCollectorPerformance_FlatPlate_FieldEnums.hxx>
14
15 #include "../utilities/units/Unit.hpp"
16
17 #include "../utilities/core/Assert.hpp"
18
19 namespace openstudio {
20 namespace model {
21
22 namespace detail {
23
24 6 SolarCollectorPerformanceFlatPlate_Impl::SolarCollectorPerformanceFlatPlate_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
25 6 : ModelObject_Impl(idfObject, model, keepHandle) {
26
4/6
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 6 times.
✗ Branch 13 not taken.
6 OS_ASSERT(idfObject.iddObject().type() == SolarCollectorPerformanceFlatPlate::iddObjectType());
27 6 }
28
29 ✗ SolarCollectorPerformanceFlatPlate_Impl::SolarCollectorPerformanceFlatPlate_Impl(const openstudio::detail::WorkspaceObject_Impl& other,
30 ✗ Model_Impl* model, bool keepHandle)
31 ✗ : ModelObject_Impl(other, model, keepHandle) {
32 ✗ OS_ASSERT(other.iddObject().type() == SolarCollectorPerformanceFlatPlate::iddObjectType());
33 ✗ }
34
35 5 SolarCollectorPerformanceFlatPlate_Impl::SolarCollectorPerformanceFlatPlate_Impl(const SolarCollectorPerformanceFlatPlate_Impl& other,
36 5 Model_Impl* model, bool keepHandle)
37 5 : ModelObject_Impl(other, model, keepHandle) {}
38
39 ✗ const std::vector<std::string>& SolarCollectorPerformanceFlatPlate_Impl::outputVariableNames() const {
40 ✗ static const std::vector<std::string> result;
41 ✗ return result;
42 }
43
44 ✗ IddObjectType SolarCollectorPerformanceFlatPlate_Impl::iddObjectType() const {
45 ✗ return SolarCollectorPerformanceFlatPlate::iddObjectType();
46 }
47
48 2 double SolarCollectorPerformanceFlatPlate_Impl::grossArea() const {
49
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<double> value = getDouble(OS_SolarCollectorPerformance_FlatPlateFields::GrossArea, true);
50
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(value);
51
1/1
✓ Branch 1 taken 2 times.
4 return value.get();
52 }
53
54 2 std::string SolarCollectorPerformanceFlatPlate_Impl::testFluid() const {
55
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<std::string> value = getString(OS_SolarCollectorPerformance_FlatPlateFields::TestFluid, true);
56
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(value);
57
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
4 return value.get();
58 2 }
59
60 ✗ bool SolarCollectorPerformanceFlatPlate_Impl::isTestFluidDefaulted() const {
61 ✗ return isEmpty(OS_SolarCollectorPerformance_FlatPlateFields::TestFluid);
62 }
63
64 2 double SolarCollectorPerformanceFlatPlate_Impl::testFlowRate() const {
65
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<double> value = getDouble(OS_SolarCollectorPerformance_FlatPlateFields::TestFlowRate, true);
66
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(value);
67
1/1
✓ Branch 1 taken 2 times.
4 return value.get();
68 }
69
70 2 std::string SolarCollectorPerformanceFlatPlate_Impl::testCorrelationType() const {
71
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<std::string> value = getString(OS_SolarCollectorPerformance_FlatPlateFields::TestCorrelationType, true);
72
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(value);
73
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
4 return value.get();
74 2 }
75
76 2 double SolarCollectorPerformanceFlatPlate_Impl::coefficient1ofEfficiencyEquation() const {
77
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<double> value = getDouble(OS_SolarCollectorPerformance_FlatPlateFields::Coefficient1ofEfficiencyEquation, true);
78
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(value);
79
1/1
✓ Branch 1 taken 2 times.
4 return value.get();
80 }
81
82 2 double SolarCollectorPerformanceFlatPlate_Impl::coefficient2ofEfficiencyEquation() const {
83
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<double> value = getDouble(OS_SolarCollectorPerformance_FlatPlateFields::Coefficient2ofEfficiencyEquation, true);
84
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(value);
85
1/1
✓ Branch 1 taken 2 times.
4 return value.get();
86 }
87
88 1 boost::optional<double> SolarCollectorPerformanceFlatPlate_Impl::coefficient3ofEfficiencyEquation() const {
89 1 return getDouble(OS_SolarCollectorPerformance_FlatPlateFields::Coefficient3ofEfficiencyEquation, true);
90 }
91
92 1 boost::optional<double> SolarCollectorPerformanceFlatPlate_Impl::coefficient2ofIncidentAngleModifier() const {
93 1 return getDouble(OS_SolarCollectorPerformance_FlatPlateFields::Coefficient2ofIncidentAngleModifier, true);
94 }
95
96 1 boost::optional<double> SolarCollectorPerformanceFlatPlate_Impl::coefficient3ofIncidentAngleModifier() const {
97 1 return getDouble(OS_SolarCollectorPerformance_FlatPlateFields::Coefficient3ofIncidentAngleModifier, true);
98 }
99
100 6 bool SolarCollectorPerformanceFlatPlate_Impl::setGrossArea(double grossArea) {
101 6 bool result = setDouble(OS_SolarCollectorPerformance_FlatPlateFields::GrossArea, grossArea);
102 6 return result;
103 }
104
105 6 bool SolarCollectorPerformanceFlatPlate_Impl::setTestFluid(const std::string& testFluid) {
106 6 bool result = setString(OS_SolarCollectorPerformance_FlatPlateFields::TestFluid, testFluid);
107 6 return result;
108 }
109
110 ✗ void SolarCollectorPerformanceFlatPlate_Impl::resetTestFluid() {
111 ✗ bool result = setString(OS_SolarCollectorPerformance_FlatPlateFields::TestFluid, "");
112 ✗ OS_ASSERT(result);
113 ✗ }
114
115 6 bool SolarCollectorPerformanceFlatPlate_Impl::setTestFlowRate(double testFlowRate) {
116 6 bool result = setDouble(OS_SolarCollectorPerformance_FlatPlateFields::TestFlowRate, testFlowRate);
117 6 return result;
118 }
119
120 6 bool SolarCollectorPerformanceFlatPlate_Impl::setTestCorrelationType(const std::string& testCorrelationType) {
121 6 bool result = setString(OS_SolarCollectorPerformance_FlatPlateFields::TestCorrelationType, testCorrelationType);
122 6 return result;
123 }
124
125 6 bool SolarCollectorPerformanceFlatPlate_Impl::setCoefficient1ofEfficiencyEquation(double coefficient1ofEfficiencyEquation) {
126 6 bool result = setDouble(OS_SolarCollectorPerformance_FlatPlateFields::Coefficient1ofEfficiencyEquation, coefficient1ofEfficiencyEquation);
127
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 OS_ASSERT(result);
128 6 return result;
129 }
130
131 12 bool SolarCollectorPerformanceFlatPlate_Impl::setCoefficient2ofEfficiencyEquation(double coefficient2ofEfficiencyEquation) {
132 12 bool result = setDouble(OS_SolarCollectorPerformance_FlatPlateFields::Coefficient2ofEfficiencyEquation, coefficient2ofEfficiencyEquation);
133
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
12 OS_ASSERT(result);
134 12 return result;
135 }
136
137 ✗ bool SolarCollectorPerformanceFlatPlate_Impl::setCoefficient3ofEfficiencyEquation(boost::optional<double> coefficient3ofEfficiencyEquation) {
138 ✗ bool result(false);
139 ✗ if (coefficient3ofEfficiencyEquation) {
140 ✗ result = setDouble(OS_SolarCollectorPerformance_FlatPlateFields::Coefficient3ofEfficiencyEquation, coefficient3ofEfficiencyEquation.get());
141 } else {
142 ✗ resetCoefficient3ofEfficiencyEquation();
143 ✗ result = true;
144 }
145 ✗ OS_ASSERT(result);
146 ✗ return result;
147 }
148
149 ✗ void SolarCollectorPerformanceFlatPlate_Impl::resetCoefficient3ofEfficiencyEquation() {
150 ✗ bool result = setString(OS_SolarCollectorPerformance_FlatPlateFields::Coefficient3ofEfficiencyEquation, "");
151 ✗ OS_ASSERT(result);
152 ✗ }
153
154 bool
155 6 SolarCollectorPerformanceFlatPlate_Impl::setCoefficient2ofIncidentAngleModifier(boost::optional<double> coefficient2ofIncidentAngleModifier) {
156 6 bool result(false);
157
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (coefficient2ofIncidentAngleModifier) {
158 result =
159 6 setDouble(OS_SolarCollectorPerformance_FlatPlateFields::Coefficient2ofIncidentAngleModifier, coefficient2ofIncidentAngleModifier.get());
160 } else {
161 ✗ resetCoefficient2ofIncidentAngleModifier();
162 ✗ result = true;
163 }
164
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 OS_ASSERT(result);
165 6 return result;
166 }
167
168 ✗ void SolarCollectorPerformanceFlatPlate_Impl::resetCoefficient2ofIncidentAngleModifier() {
169 ✗ bool result = setString(OS_SolarCollectorPerformance_FlatPlateFields::Coefficient2ofIncidentAngleModifier, "");
170 ✗ OS_ASSERT(result);
171 ✗ }
172
173 bool
174 6 SolarCollectorPerformanceFlatPlate_Impl::setCoefficient3ofIncidentAngleModifier(boost::optional<double> coefficient3ofIncidentAngleModifier) {
175 6 bool result(false);
176
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (coefficient3ofIncidentAngleModifier) {
177 result =
178 6 setDouble(OS_SolarCollectorPerformance_FlatPlateFields::Coefficient3ofIncidentAngleModifier, coefficient3ofIncidentAngleModifier.get());
179 } else {
180 ✗ resetCoefficient3ofIncidentAngleModifier();
181 ✗ result = true;
182 }
183
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 OS_ASSERT(result);
184 6 return result;
185 }
186
187 ✗ void SolarCollectorPerformanceFlatPlate_Impl::resetCoefficient3ofIncidentAngleModifier() {
188 ✗ bool result = setString(OS_SolarCollectorPerformance_FlatPlateFields::Coefficient3ofIncidentAngleModifier, "");
189 ✗ OS_ASSERT(result);
190 ✗ }
191
192 } // namespace detail
193
194 6 SolarCollectorPerformanceFlatPlate::SolarCollectorPerformanceFlatPlate(const Model& model)
195 6 : ModelObject(SolarCollectorPerformanceFlatPlate::iddObjectType(), model) {
196
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✗ Branch 5 not taken.
6 OS_ASSERT(getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>());
197
198 // Defaults from "Alternate Energy Technologies AE - 32" in SolarCollectors.imf in E+ data sets.
199 6 bool ok = true;
200 ;
201
1/1
✓ Branch 1 taken 6 times.
6 ok = setGrossArea(2.9646);
202
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 3 not taken.
6 OS_ASSERT(ok);
203
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 ok = setTestFluid("Water");
204
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 3 not taken.
6 OS_ASSERT(ok);
205
1/1
✓ Branch 1 taken 6 times.
6 ok = setTestFlowRate(0.0000388);
206
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 3 not taken.
6 OS_ASSERT(ok);
207
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 ok = setTestCorrelationType("Inlet");
208
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 3 not taken.
6 OS_ASSERT(ok);
209
1/1
✓ Branch 1 taken 6 times.
6 setCoefficient1ofEfficiencyEquation(0.691);
210
1/1
✓ Branch 1 taken 6 times.
6 setCoefficient2ofEfficiencyEquation(-3.396);
211
1/1
✓ Branch 1 taken 6 times.
6 setCoefficient2ofEfficiencyEquation(-0.00193);
212
1/1
✓ Branch 1 taken 6 times.
6 setCoefficient2ofIncidentAngleModifier(-0.1939);
213
1/1
✓ Branch 1 taken 6 times.
6 setCoefficient3ofIncidentAngleModifier(-0.0055);
214 6 }
215
216 7613 IddObjectType SolarCollectorPerformanceFlatPlate::iddObjectType() {
217
1/1
✓ Branch 1 taken 7613 times.
7613 return {IddObjectType::OS_SolarCollectorPerformance_FlatPlate};
218 }
219
220 ✗ std::vector<std::string> SolarCollectorPerformanceFlatPlate::testFluidValues() {
221 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_SolarCollectorPerformance_FlatPlateFields::TestFluid);
222 }
223
224 ✗ std::vector<std::string> SolarCollectorPerformanceFlatPlate::testCorrelationTypeValues() {
225 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_SolarCollectorPerformance_FlatPlateFields::TestCorrelationType);
226 }
227
228 2 double SolarCollectorPerformanceFlatPlate::grossArea() const {
229
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->grossArea();
230 }
231
232 2 std::string SolarCollectorPerformanceFlatPlate::testFluid() const {
233
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->testFluid();
234 }
235
236 ✗ bool SolarCollectorPerformanceFlatPlate::isTestFluidDefaulted() const {
237 ✗ return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->isTestFluidDefaulted();
238 }
239
240 2 double SolarCollectorPerformanceFlatPlate::testFlowRate() const {
241
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->testFlowRate();
242 }
243
244 2 std::string SolarCollectorPerformanceFlatPlate::testCorrelationType() const {
245
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->testCorrelationType();
246 }
247
248 2 double SolarCollectorPerformanceFlatPlate::coefficient1ofEfficiencyEquation() const {
249
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->coefficient1ofEfficiencyEquation();
250 }
251
252 2 double SolarCollectorPerformanceFlatPlate::coefficient2ofEfficiencyEquation() const {
253
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->coefficient2ofEfficiencyEquation();
254 }
255
256 1 boost::optional<double> SolarCollectorPerformanceFlatPlate::coefficient3ofEfficiencyEquation() const {
257
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->coefficient3ofEfficiencyEquation();
258 }
259
260 1 boost::optional<double> SolarCollectorPerformanceFlatPlate::coefficient2ofIncidentAngleModifier() const {
261
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->coefficient2ofIncidentAngleModifier();
262 }
263
264 1 boost::optional<double> SolarCollectorPerformanceFlatPlate::coefficient3ofIncidentAngleModifier() const {
265
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->coefficient3ofIncidentAngleModifier();
266 }
267
268 6 bool SolarCollectorPerformanceFlatPlate::setGrossArea(double grossArea) {
269
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->setGrossArea(grossArea);
270 }
271
272 6 bool SolarCollectorPerformanceFlatPlate::setTestFluid(const std::string& testFluid) {
273
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->setTestFluid(testFluid);
274 }
275
276 ✗ void SolarCollectorPerformanceFlatPlate::resetTestFluid() {
277 ✗ getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->resetTestFluid();
278 ✗ }
279
280 6 bool SolarCollectorPerformanceFlatPlate::setTestFlowRate(double testFlowRate) {
281
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->setTestFlowRate(testFlowRate);
282 }
283
284 6 bool SolarCollectorPerformanceFlatPlate::setTestCorrelationType(const std::string& testCorrelationType) {
285
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->setTestCorrelationType(testCorrelationType);
286 }
287
288 6 bool SolarCollectorPerformanceFlatPlate::setCoefficient1ofEfficiencyEquation(double coefficient1ofEfficiencyEquation) {
289
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->setCoefficient1ofEfficiencyEquation(coefficient1ofEfficiencyEquation);
290 }
291
292 12 bool SolarCollectorPerformanceFlatPlate::setCoefficient2ofEfficiencyEquation(double coefficient2ofEfficiencyEquation) {
293
1/1
✓ Branch 3 taken 12 times.
12 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->setCoefficient2ofEfficiencyEquation(coefficient2ofEfficiencyEquation);
294 }
295
296 ✗ bool SolarCollectorPerformanceFlatPlate::setCoefficient3ofEfficiencyEquation(double coefficient3ofEfficiencyEquation) {
297 ✗ return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->setCoefficient3ofEfficiencyEquation(coefficient3ofEfficiencyEquation);
298 }
299
300 ✗ void SolarCollectorPerformanceFlatPlate::resetCoefficient3ofEfficiencyEquation() {
301 ✗ getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->resetCoefficient3ofEfficiencyEquation();
302 ✗ }
303
304 6 bool SolarCollectorPerformanceFlatPlate::setCoefficient2ofIncidentAngleModifier(double coefficient2ofIncidentAngleModifier) {
305
2/2
✓ Branch 3 taken 6 times.
✓ Branch 6 taken 6 times.
6 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->setCoefficient2ofIncidentAngleModifier(coefficient2ofIncidentAngleModifier);
306 }
307
308 ✗ void SolarCollectorPerformanceFlatPlate::resetCoefficient2ofIncidentAngleModifier() {
309 ✗ getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->resetCoefficient2ofIncidentAngleModifier();
310 ✗ }
311
312 6 bool SolarCollectorPerformanceFlatPlate::setCoefficient3ofIncidentAngleModifier(double coefficient3ofIncidentAngleModifier) {
313
2/2
✓ Branch 3 taken 6 times.
✓ Branch 6 taken 6 times.
6 return getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->setCoefficient3ofIncidentAngleModifier(coefficient3ofIncidentAngleModifier);
314 }
315
316 ✗ void SolarCollectorPerformanceFlatPlate::resetCoefficient3ofIncidentAngleModifier() {
317 ✗ getImpl<detail::SolarCollectorPerformanceFlatPlate_Impl>()->resetCoefficient3ofIncidentAngleModifier();
318 ✗ }
319
320 /// @cond
321 14 SolarCollectorPerformanceFlatPlate::SolarCollectorPerformanceFlatPlate(std::shared_ptr<detail::SolarCollectorPerformanceFlatPlate_Impl> impl)
322
1/1
✓ Branch 3 taken 14 times.
14 : ModelObject(std::move(impl)) {}
323 /// @endcond
324
325 } // namespace model
326 } // namespace openstudio
327