GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 55.7% 78 / 0 / 140
Functions: 61.7% 29 / 0 / 47
Branches: 42.5% 54 / 0 / 127

src/model/ConstructionAirBoundary.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 "ConstructionAirBoundary.hpp"
7 #include "ConstructionAirBoundary_Impl.hpp"
8
9 #include "Schedule.hpp"
10 #include "Schedule_Impl.hpp"
11 #include "ScheduleTypeLimits.hpp"
12 #include "ScheduleTypeRegistry.hpp"
13
14 #include <utilities/idd/IddFactory.hxx>
15 #include <utilities/idd/IddEnums.hxx>
16 #include <utilities/idd/OS_Construction_AirBoundary_FieldEnums.hxx>
17
18 #include "../utilities/core/Assert.hpp"
19
20 #include "../utilities/core/DeprecatedHelpers.hpp"
21
22 namespace openstudio {
23 namespace model {
24
25 namespace detail {
26
27 281 ConstructionAirBoundary_Impl::ConstructionAirBoundary_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
28 281 : ConstructionBase_Impl(idfObject, model, keepHandle) {
29
4/6
✓ Branch 1 taken 281 times.
✓ Branch 4 taken 281 times.
✓ Branch 7 taken 281 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 281 times.
✗ Branch 13 not taken.
281 OS_ASSERT(idfObject.iddObject().type() == ConstructionAirBoundary::iddObjectType());
30 281 }
31
32 47 ConstructionAirBoundary_Impl::ConstructionAirBoundary_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model,
33 47 bool keepHandle)
34 47 : ConstructionBase_Impl(other, model, keepHandle) {
35
4/6
✓ Branch 1 taken 47 times.
✓ Branch 4 taken 47 times.
✓ Branch 7 taken 47 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 47 times.
✗ Branch 13 not taken.
47 OS_ASSERT(other.iddObject().type() == ConstructionAirBoundary::iddObjectType());
36 47 }
37
38 121 ConstructionAirBoundary_Impl::ConstructionAirBoundary_Impl(const ConstructionAirBoundary_Impl& other, Model_Impl* model, bool keepHandle)
39 121 : ConstructionBase_Impl(other, model, keepHandle) {}
40
41 1 const std::vector<std::string>& ConstructionAirBoundary_Impl::outputVariableNames() const {
42
2/4
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
1 static const std::vector<std::string> result;
43 1 if (result.empty()) {
44 }
45 1 return result;
46 }
47
48 1 IddObjectType ConstructionAirBoundary_Impl::iddObjectType() const {
49 1 return ConstructionAirBoundary::iddObjectType();
50 }
51
52 ✗ std::vector<ScheduleTypeKey> ConstructionAirBoundary_Impl::getScheduleTypeKeys(const Schedule& schedule) const {
53 // TODO: Check schedule display names.
54 ✗ std::vector<ScheduleTypeKey> result;
55 ✗ UnsignedVector fieldIndices = getSourceIndices(schedule.handle());
56 ✗ UnsignedVector::const_iterator b(fieldIndices.begin());
57 ✗ UnsignedVector::const_iterator e(fieldIndices.end());
58 ✗ if (std::find(b, e, OS_Construction_AirBoundaryFields::SimpleMixingScheduleName) != e) {
59 ✗ result.push_back(ScheduleTypeKey("ConstructionAirBoundary", "Simple Mixing"));
60 }
61 ✗ return result;
62 ✗ }
63
64 152 bool ConstructionAirBoundary_Impl::isOpaque() const {
65 152 return false;
66 }
67
68 12 bool ConstructionAirBoundary_Impl::isFenestration() const {
69 12 return false;
70 }
71
72 1 bool ConstructionAirBoundary_Impl::isSolarDiffusing() const {
73 1 return false;
74 }
75
76 1 bool ConstructionAirBoundary_Impl::isModelPartition() const {
77 1 return true;
78 }
79
80 5 int ConstructionAirBoundary_Impl::renderingColorIndex() const {
81 5 return OS_Construction_AirBoundaryFields::SurfaceRenderingName;
82 }
83
84 91 std::string ConstructionAirBoundary_Impl::airExchangeMethod() const {
85
1/1
✓ Branch 1 taken 91 times.
91 boost::optional<std::string> value = getString(OS_Construction_AirBoundaryFields::AirExchangeMethod, true);
86
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 91 times.
✗ Branch 4 not taken.
91 OS_ASSERT(value);
87
2/2
✓ Branch 1 taken 91 times.
✓ Branch 4 taken 91 times.
182 return value.get();
88 91 }
89
90 ✗ bool ConstructionAirBoundary_Impl::isAirExchangeMethodDefaulted() const {
91 ✗ return isEmpty(OS_Construction_AirBoundaryFields::AirExchangeMethod);
92 }
93
94 91 double ConstructionAirBoundary_Impl::simpleMixingAirChangesPerHour() const {
95
1/1
✓ Branch 1 taken 91 times.
91 boost::optional<double> value = getDouble(OS_Construction_AirBoundaryFields::SimpleMixingAirChangesperHour, true);
96
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 91 times.
✗ Branch 4 not taken.
91 OS_ASSERT(value);
97
1/1
✓ Branch 1 taken 91 times.
182 return value.get();
98 }
99
100 ✗ bool ConstructionAirBoundary_Impl::isSimpleMixingAirChangesPerHourDefaulted() const {
101 ✗ return isEmpty(OS_Construction_AirBoundaryFields::SimpleMixingAirChangesperHour);
102 }
103
104 92 boost::optional<Schedule> ConstructionAirBoundary_Impl::simpleMixingSchedule() const {
105
2/2
✓ Branch 1 taken 92 times.
✓ Branch 4 taken 92 times.
92 return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_Construction_AirBoundaryFields::SimpleMixingScheduleName);
106 }
107
108 7 bool ConstructionAirBoundary_Impl::setAirExchangeMethod(const std::string& airExchangeMethod) {
109 7 bool result = setString(OS_Construction_AirBoundaryFields::AirExchangeMethod, airExchangeMethod);
110 7 return result;
111 }
112
113 ✗ void ConstructionAirBoundary_Impl::resetAirExchangeMethod() {
114 ✗ bool result = setString(OS_Construction_AirBoundaryFields::AirExchangeMethod, "");
115 ✗ OS_ASSERT(result);
116 ✗ }
117
118 240 bool ConstructionAirBoundary_Impl::setSimpleMixingAirChangesPerHour(double simpleMixingAirChangesPerHour) {
119 240 bool result = setDouble(OS_Construction_AirBoundaryFields::SimpleMixingAirChangesperHour, simpleMixingAirChangesPerHour);
120 240 return result;
121 }
122
123 ✗ void ConstructionAirBoundary_Impl::resetSimpleMixingAirChangesPerHour() {
124 ✗ bool result = setString(OS_Construction_AirBoundaryFields::SimpleMixingAirChangesperHour, "");
125 ✗ OS_ASSERT(result);
126 ✗ }
127
128 1 bool ConstructionAirBoundary_Impl::setSimpleMixingSchedule(Schedule& schedule) {
129
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
4 bool result = setSchedule(OS_Construction_AirBoundaryFields::SimpleMixingScheduleName, "ConstructionAirBoundary", "Simple Mixing", schedule);
130 1 return result;
131 }
132
133 ✗ void ConstructionAirBoundary_Impl::resetSimpleMixingSchedule() {
134 ✗ bool result = setString(OS_Construction_AirBoundaryFields::SimpleMixingScheduleName, "");
135 ✗ OS_ASSERT(result);
136 ✗ }
137
138 } // namespace detail
139
140 233 ConstructionAirBoundary::ConstructionAirBoundary(const Model& model) : ConstructionBase(ConstructionAirBoundary::iddObjectType(), model) {
141
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 233 times.
✗ Branch 5 not taken.
233 OS_ASSERT(getImpl<detail::ConstructionAirBoundary_Impl>());
142
143
1/1
✓ Branch 1 taken 233 times.
233 setSimpleMixingAirChangesPerHour(0.0);
144 233 }
145
146 8344 IddObjectType ConstructionAirBoundary::iddObjectType() {
147
1/1
✓ Branch 1 taken 8344 times.
8344 return {IddObjectType::OS_Construction_AirBoundary};
148 }
149
150 ✗ std::vector<std::string> ConstructionAirBoundary::solarAndDaylightingMethodValues() {
151 ✗ std::vector<std::string> result;
152 ✗ DEPRECATED_AT_MSG(3, 2, 0, "All air boundaries will be modeled using the former 'GroupedZones' option.");
153 ✗ return result;
154 ✗ }
155
156 ✗ std::vector<std::string> ConstructionAirBoundary::radiantExchangeMethodValues() {
157 ✗ std::vector<std::string> result;
158 ✗ DEPRECATED_AT_MSG(3, 2, 0, "All air boundaries will be modeled using the former 'GroupedZones' option.");
159 ✗ return result;
160 ✗ }
161
162 ✗ std::vector<std::string> ConstructionAirBoundary::airExchangeMethodValues() {
163 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Construction_AirBoundaryFields::AirExchangeMethod);
164 }
165
166 2 std::string ConstructionAirBoundary::solarAndDaylightingMethod() const {
167
5/5
✓ 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.
10 DEPRECATED_AT_MSG(3, 2, 0, "All air boundaries will be modeled using the former 'GroupedZones' option.");
168
1/1
✓ Branch 1 taken 2 times.
4 return "GroupedZones";
169 }
170
171 ✗ bool ConstructionAirBoundary::isSolarAndDaylightingMethodDefaulted() const {
172 ✗ DEPRECATED_AT_MSG(3, 2, 0, "All air boundaries will be modeled using the former 'GroupedZones' option.");
173 ✗ return true;
174 }
175
176 2 std::string ConstructionAirBoundary::radiantExchangeMethod() const {
177
5/5
✓ 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.
10 DEPRECATED_AT_MSG(3, 2, 0, "All air boundaries will be modeled using the former 'GroupedZones' option.");
178
1/1
✓ Branch 1 taken 2 times.
4 return "GroupedZones";
179 }
180
181 ✗ bool ConstructionAirBoundary::isRadiantExchangeMethodDefaulted() const {
182 ✗ DEPRECATED_AT_MSG(3, 2, 0, "All air boundaries will be modeled using the former 'GroupedZones' option.");
183 ✗ return true;
184 }
185
186 91 std::string ConstructionAirBoundary::airExchangeMethod() const {
187
1/1
✓ Branch 3 taken 91 times.
91 return getImpl<detail::ConstructionAirBoundary_Impl>()->airExchangeMethod();
188 }
189
190 ✗ bool ConstructionAirBoundary::isAirExchangeMethodDefaulted() const {
191 ✗ return getImpl<detail::ConstructionAirBoundary_Impl>()->isAirExchangeMethodDefaulted();
192 }
193
194 91 double ConstructionAirBoundary::simpleMixingAirChangesPerHour() const {
195
1/1
✓ Branch 3 taken 91 times.
91 return getImpl<detail::ConstructionAirBoundary_Impl>()->simpleMixingAirChangesPerHour();
196 }
197
198 ✗ bool ConstructionAirBoundary::isSimpleMixingAirChangesPerHourDefaulted() const {
199 ✗ return getImpl<detail::ConstructionAirBoundary_Impl>()->isSimpleMixingAirChangesPerHourDefaulted();
200 }
201
202 92 boost::optional<Schedule> ConstructionAirBoundary::simpleMixingSchedule() const {
203
1/1
✓ Branch 3 taken 92 times.
92 return getImpl<detail::ConstructionAirBoundary_Impl>()->simpleMixingSchedule();
204 }
205
206 1 bool ConstructionAirBoundary::setSolarAndDaylightingMethod(const std::string& /*solarAndDaylightingMethod*/) {
207
5/5
✓ 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.
4 DEPRECATED_AT_MSG(3, 2, 0, "All air boundaries will be modeled using the former 'GroupedZones' option.");
208 1 return false;
209 }
210
211 ✗ void ConstructionAirBoundary::resetSolarAndDaylightingMethod() {
212 ✗ DEPRECATED_AT_MSG(3, 2, 0, "All air boundaries will be modeled using the former 'GroupedZones' option.");
213 ✗ }
214
215 1 bool ConstructionAirBoundary::setRadiantExchangeMethod(const std::string& /*radiantExchangeMethod*/) {
216
5/5
✓ 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.
4 DEPRECATED_AT_MSG(3, 2, 0, "All air boundaries will be modeled using the former 'GroupedZones' option.");
217 1 return false;
218 }
219
220 ✗ void ConstructionAirBoundary::resetRadiantExchangeMethod() {
221 ✗ DEPRECATED_AT_MSG(3, 2, 0, "All air boundaries will be modeled using the former 'GroupedZones' option.");
222 ✗ }
223
224 7 bool ConstructionAirBoundary::setAirExchangeMethod(const std::string& airExchangeMethod) {
225
1/1
✓ Branch 3 taken 7 times.
7 return getImpl<detail::ConstructionAirBoundary_Impl>()->setAirExchangeMethod(airExchangeMethod);
226 }
227
228 ✗ void ConstructionAirBoundary::resetAirExchangeMethod() {
229 ✗ getImpl<detail::ConstructionAirBoundary_Impl>()->resetAirExchangeMethod();
230 ✗ }
231
232 240 bool ConstructionAirBoundary::setSimpleMixingAirChangesPerHour(double simpleMixingAirChangesPerHour) {
233
1/1
✓ Branch 3 taken 240 times.
240 return getImpl<detail::ConstructionAirBoundary_Impl>()->setSimpleMixingAirChangesPerHour(simpleMixingAirChangesPerHour);
234 }
235
236 ✗ void ConstructionAirBoundary::resetSimpleMixingAirChangesPerHour() {
237 ✗ getImpl<detail::ConstructionAirBoundary_Impl>()->resetSimpleMixingAirChangesPerHour();
238 ✗ }
239
240 1 bool ConstructionAirBoundary::setSimpleMixingSchedule(Schedule& schedule) {
241
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ConstructionAirBoundary_Impl>()->setSimpleMixingSchedule(schedule);
242 }
243
244 ✗ void ConstructionAirBoundary::resetSimpleMixingSchedule() {
245 ✗ getImpl<detail::ConstructionAirBoundary_Impl>()->resetSimpleMixingSchedule();
246 ✗ }
247
248 /// @cond
249
1/1
✓ Branch 2 taken 964 times.
964 ConstructionAirBoundary::ConstructionAirBoundary(std::shared_ptr<detail::ConstructionAirBoundary_Impl> impl) : ConstructionBase(impl) {}
250 /// @endcond
251
252 } // namespace model
253 } // namespace openstudio
254