GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 81.8% 377 / 0 / 461
Functions: 83.6% 92 / 0 / 110
Branches: 63.7% 438 / 0 / 688

src/model/ShadingControl.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 "ShadingControl.hpp"
7 #include "ShadingControl_Impl.hpp"
8 #include "Construction.hpp"
9 #include "Construction_Impl.hpp"
10 #include "ShadingMaterial.hpp"
11 #include "ShadingMaterial_Impl.hpp"
12 #include "Blind.hpp"
13 #include "Blind_Impl.hpp"
14 #include "DaylightRedirectionDevice.hpp"
15 #include "DaylightRedirectionDevice_Impl.hpp"
16 #include "Screen.hpp"
17 #include "Screen_Impl.hpp"
18 #include "Shade.hpp"
19 #include "Shade_Impl.hpp"
20 #include "Schedule.hpp"
21 #include "Schedule_Impl.hpp"
22 #include "SubSurface.hpp"
23 #include "SubSurface_Impl.hpp"
24 #include "Model.hpp"
25 #include "Model_Impl.hpp"
26 #include "ModelExtensibleGroup.hpp"
27
28 #include "../utilities/core/Assert.hpp"
29 #include "../utilities/core/Compare.hpp"
30 #include "../utilities/idf/WorkspaceExtensibleGroup.hpp"
31
32 #include <utilities/idd/IddFactory.hxx>
33
34 #include <utilities/idd/OS_ShadingControl_FieldEnums.hxx>
35 #include <utilities/idd/IddEnums.hxx>
36
37 #include <algorithm>
38 #include <array>
39 #include <string_view>
40
41 namespace openstudio {
42 namespace model {
43
44 namespace detail {
45
46 23 ShadingControl_Impl::ShadingControl_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
47 23 : ResourceObject_Impl(idfObject, model, keepHandle) {
48
4/6
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
✓ Branch 7 taken 23 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 23 times.
✗ Branch 13 not taken.
23 OS_ASSERT(idfObject.iddObject().type() == ShadingControl::iddObjectType());
49 23 }
50
51 3 ShadingControl_Impl::ShadingControl_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
52 3 : ResourceObject_Impl(other, model, keepHandle) {
53
4/6
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 3 times.
✗ Branch 13 not taken.
3 OS_ASSERT(other.iddObject().type() == ShadingControl::iddObjectType());
54 3 }
55
56 11 ShadingControl_Impl::ShadingControl_Impl(const ShadingControl_Impl& other, Model_Impl* model, bool keepHandle)
57 11 : ResourceObject_Impl(other, model, keepHandle) {}
58
59 ✗ const std::vector<std::string>& ShadingControl_Impl::outputVariableNames() const {
60 ✗ static const std::vector<std::string> result;
61 ✗ return result;
62 }
63
64 27 bool ShadingControl_Impl::isControlTypeValueNeedingSetpoint1(const std::string& controlType) {
65 static constexpr std::array data{
66 //"AlwaysOn",
67 //"AlwaysOff",
68 //"OnIfScheduleAllows",
69 "OnIfHighSolarOnWindow", "OnIfHighHorizontalSolar", "OnIfHighOutdoorAirTemperature", "OnIfHighZoneAirTemperature", "OnIfHighZoneCooling",
70 //"OnIfHighGlare",
71 //"MeetDaylightIlluminanceSetpoint",
72 "OnNightIfLowOutdoorTempAndOffDay", "OnNightIfLowInsideTempAndOffDay", "OnNightIfHeatingAndOffDay",
73 "OnNightIfLowOutdoorTempAndOnDayIfCooling", "OnNightIfHeatingAndOnDayIfCooling", "OffNightAndOnDayIfCoolingAndHighSolarOnWindow",
74 "OnNightAndOnDayIfCoolingAndHighSolarOnWindow", "OnIfHighOutdoorAirTempAndHighSolarOnWindow", "OnIfHighOutdoorAirTempAndHighHorizontalSolar",
75 "OnIfHighZoneAirTempAndHighSolarOnWindow", "OnIfHighZoneAirTempAndHighHorizontalSolar"};
76
2/2
✓ Branch 1 taken 322 times.
✓ Branch 4 taken 322 times.
993 return std::find_if(data.begin(), data.end(), [&controlType](auto c) { return openstudio::istringEqual(controlType, c); }) != data.end();
77 }
78
79 25 bool ShadingControl_Impl::isControlTypeValueNeedingSetpoint2(const std::string& controlType) {
80 static constexpr std::array data{"OnIfHighOutdoorAirTempAndHighSolarOnWindow", "OnIfHighOutdoorAirTempAndHighHorizontalSolar",
81 "OnIfHighZoneAirTempAndHighSolarOnWindow", "OnIfHighZoneAirTempAndHighHorizontalSolar"};
82
2/2
✓ Branch 1 taken 88 times.
✓ Branch 4 taken 88 times.
289 return std::find_if(data.begin(), data.end(), [&controlType](auto c) { return openstudio::istringEqual(controlType, c); }) != data.end();
83 }
84
85 23 bool ShadingControl_Impl::isControlTypeValueAllowingSchedule(const std::string& controlType) {
86 static constexpr std::array data{//"AlwaysOn",
87 //"AlwaysOff",
88 "OnIfScheduleAllows", "OnIfHighSolarOnWindow", "OnIfHighHorizontalSolar", "OnIfHighOutdoorAirTemperature",
89 "OnIfHighZoneAirTemperature", "OnIfHighZoneCooling",
90 //"OnIfHighGlare",
91 //"MeetDaylightIlluminanceSetpoint",
92 "OnNightIfLowOutdoorTempAndOffDay", "OnNightIfLowInsideTempAndOffDay", "OnNightIfHeatingAndOffDay",
93 "OnNightIfLowOutdoorTempAndOnDayIfCooling", "OnNightIfHeatingAndOnDayIfCooling",
94 "OffNightAndOnDayIfCoolingAndHighSolarOnWindow", "OnNightAndOnDayIfCoolingAndHighSolarOnWindow",
95 "OnIfHighOutdoorAirTempAndHighSolarOnWindow", "OnIfHighOutdoorAirTempAndHighHorizontalSolar",
96 "OnIfHighZoneAirTempAndHighSolarOnWindow", "OnIfHighZoneAirTempAndHighHorizontalSolar"};
97
2/2
✓ Branch 1 taken 327 times.
✓ Branch 4 taken 327 times.
1004 return std::find_if(data.begin(), data.end(), [&controlType](auto c) { return openstudio::istringEqual(controlType, c); }) != data.end();
98 }
99
100 4 bool ShadingControl_Impl::isControlTypeValueRequiringSchedule(const std::string& controlType) {
101
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
8 return openstudio::istringEqual("OnIfScheduleAllows", controlType);
102 }
103
104 11 bool ShadingControl_Impl::isTypeValueAllowingSlatAngleControl(const std::string& type) {
105 static constexpr std::array data{
106 //"InteriorShade",
107 //"ExteriorShade",
108 //"ExteriorScreen",
109 "InteriorBlind", "ExteriorBlind",
110 //"BetweenGlassShade",
111 "BetweenGlassBlind",
112 //"SwitchableGlazing",
113 //"InteriorDaylightRedirectionDevice"
114 };
115
2/2
✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
59 return std::find_if(data.begin(), data.end(), [&type](auto c) { return openstudio::istringEqual(type, c); }) != data.end();
116 }
117
118 ✗ IddObjectType ShadingControl_Impl::iddObjectType() const {
119 ✗ return ShadingControl::iddObjectType();
120 }
121
122 3 ModelObject ShadingControl_Impl::clone(Model model) const {
123
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 auto scClone = ResourceObject_Impl::clone(model).cast<ShadingControl>();
124
125
4/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 2 times.
3 if (model != this->model()) {
126
1/1
✓ Branch 1 taken 1 time.
1 scClone.removeAllSubSurfaces();
127 }
128
129 6 return std::move(scClone);
130 3 }
131
132 20 std::string ShadingControl_Impl::shadingType() const {
133
1/1
✓ Branch 1 taken 20 times.
20 boost::optional<std::string> result = getString(OS_ShadingControlFields::ShadingType, true);
134
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
✗ Branch 4 not taken.
20 OS_ASSERT(result);
135
2/2
✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
40 return result.get();
136 20 }
137
138 11 boost::optional<Construction> ShadingControl_Impl::construction() const {
139
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 return getObject<ShadingControl>().getModelObjectTarget<Construction>(OS_ShadingControlFields::ConstructionwithShadingName);
140 }
141
142 22 boost::optional<ShadingMaterial> ShadingControl_Impl::shadingMaterial() const {
143
2/2
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
22 return getObject<ShadingControl>().getModelObjectTarget<ShadingMaterial>(OS_ShadingControlFields::ShadingDeviceMaterialName);
144 }
145
146 67 std::string ShadingControl_Impl::shadingControlType() const {
147
1/1
✓ Branch 1 taken 67 times.
67 boost::optional<std::string> result = getString(OS_ShadingControlFields::ShadingControlType, true);
148
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 67 times.
✗ Branch 4 not taken.
67 OS_ASSERT(result);
149
2/2
✓ Branch 1 taken 67 times.
✓ Branch 4 taken 67 times.
134 return result.get();
150 67 }
151
152 ✗ bool ShadingControl_Impl::isShadingControlTypeDefaulted() const {
153 ✗ return isEmpty(OS_ShadingControlFields::ShadingControlType);
154 }
155
156 13 boost::optional<Schedule> ShadingControl_Impl::schedule() const {
157
2/2
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
13 return getObject<ShadingControl>().getModelObjectTarget<Schedule>(OS_ShadingControlFields::ScheduleName);
158 }
159
160 16 boost::optional<double> ShadingControl_Impl::setpoint() const {
161
1/1
✓ Branch 1 taken 16 times.
16 boost::optional<double> result = getDouble(OS_ShadingControlFields::Setpoint);
162
2/2
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 10 times.
16 if (!result) {
163
1/1
✓ Branch 1 taken 6 times.
6 std::string shadingControlType = this->shadingControlType();
164
4/4
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 5 times.
✓ Branch 8 taken 1 time.
12 if (istringEqual("OnIfHighSolarOnWindow", shadingControlType)) {
165
1/1
✓ Branch 1 taken 5 times.
5 result = 27; // w/m^2
166 }
167 6 }
168 16 return result;
169 }
170
171 ✗ bool ShadingControl_Impl::isSetpointDefaulted() const {
172 ✗ return isEmpty(OS_ShadingControlFields::Setpoint);
173 }
174
175 6 bool ShadingControl_Impl::glareControlIsActive() const {
176
1/1
✓ Branch 1 taken 6 times.
6 boost::optional<std::string> value = getString(OS_ShadingControlFields::GlareControlIsActive, true);
177
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
6 OS_ASSERT(value);
178
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
12 return openstudio::istringEqual(value.get(), "Yes");
179 6 }
180
181 8 std::string ShadingControl_Impl::typeofSlatAngleControlforBlinds() const {
182
1/1
✓ Branch 1 taken 8 times.
8 boost::optional<std::string> result = getString(OS_ShadingControlFields::TypeofSlatAngleControlforBlinds, true);
183
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 4 not taken.
8 OS_ASSERT(result);
184
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
16 return result.get();
185 8 }
186
187 6 bool ShadingControl_Impl::isTypeofSlatAngleControlforBlindsDefaulted() const {
188 6 return isEmpty(OS_ShadingControlFields::TypeofSlatAngleControlforBlinds);
189 }
190
191 6 boost::optional<Schedule> ShadingControl_Impl::slatAngleSchedule() const {
192
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 return getObject<ShadingControl>().getModelObjectTarget<Schedule>(OS_ShadingControlFields::SlatAngleScheduleName);
193 }
194
195 11 boost::optional<double> ShadingControl_Impl::setpoint2() const {
196
1/1
✓ Branch 1 taken 11 times.
11 boost::optional<double> result = getDouble(OS_ShadingControlFields::Setpoint2);
197
2/2
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 8 times.
11 if (!result) {
198
1/1
✓ Branch 1 taken 3 times.
3 std::string shadingControlType = this->shadingControlType();
199
3/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 3 times.
6 if (istringEqual("OnIfHighSolarOnWindow", shadingControlType)) {
200 ✗ result = 27; // w/m^2
201 }
202 3 }
203 11 return result;
204 }
205
206 7 std::string ShadingControl_Impl::multipleSurfaceControlType() const {
207
1/1
✓ Branch 1 taken 7 times.
7 boost::optional<std::string> result = getString(OS_ShadingControlFields::MultipleSurfaceControlType, true);
208
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 4 not taken.
7 OS_ASSERT(result);
209
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
14 return result.get();
210 7 }
211
212 21 bool ShadingControl_Impl::setShadingType(const std::string& shadingType) {
213 21 return setString(OS_ShadingControlFields::ShadingType, shadingType);
214 }
215
216 10 bool ShadingControl_Impl::setShadingControlType(const std::string& shadingControlType) {
217 10 const bool result = setString(OS_ShadingControlFields::ShadingControlType, shadingControlType);
218
1/2
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
10 if (result) {
219
2/2
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 5 times.
10 if (!ShadingControl_Impl::isControlTypeValueNeedingSetpoint1(shadingControlType)) {
220 // Not calling resetSetpoint to avoid double check on whether it's required
221
9/9
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 16 taken 5 times.
✓ Branch 20 taken 5 times.
✓ Branch 23 taken 5 times.
✓ Branch 26 taken 5 times.
5 LOG(Info, briefDescription() << " Shading Control Type was changed to '" << shadingControlType
222 << " which does not require a Setpoint, resetting it.");
223
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 const bool test = setString(OS_ShadingControlFields::Setpoint, "");
224
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 OS_ASSERT(test);
225 }
226
2/2
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 4 times.
10 if (!ShadingControl_Impl::isControlTypeValueNeedingSetpoint2(shadingControlType)) {
227 // Not calling resetSetpoint2 to avoid double check on whether it's required
228
9/9
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 13 taken 6 times.
✓ Branch 16 taken 6 times.
✓ Branch 20 taken 6 times.
✓ Branch 23 taken 6 times.
✓ Branch 26 taken 6 times.
6 LOG(Info, briefDescription() << " Shading Control Type was changed to '" << shadingControlType
229 << " which does not require a Setpoint2, resetting it.");
230
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
12 const bool test = setString(OS_ShadingControlFields::Setpoint2, "");
231
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 OS_ASSERT(test);
232 }
233
2/2
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 5 times.
10 if (!ShadingControl_Impl::isControlTypeValueAllowingSchedule(shadingControlType)) {
234
9/9
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 16 taken 5 times.
✓ Branch 20 taken 5 times.
✓ Branch 23 taken 5 times.
✓ Branch 26 taken 5 times.
5 LOG(Info, briefDescription() << " Shading Control Type was changed to '" << shadingControlType
235 << " which does not allow a Schedule, resetting it.");
236
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 bool test = setString(OS_ShadingControlFields::ScheduleName, "");
237
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 OS_ASSERT(test);
238
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 test = setString(OS_ShadingControlFields::ShadingControlIsScheduled, "No");
239
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 OS_ASSERT(test);
240 }
241 }
242 10 return result;
243 }
244
245 ✗ void ShadingControl_Impl::resetShadingControlType() {
246 ✗ std::string oldControlType = this->shadingControlType();
247 ✗ bool test = setString(OS_ShadingControlFields::ShadingControlType, "");
248 ✗ OS_ASSERT(test);
249 ✗ if (!openstudio::istringEqual("OnIfHighSolarOnWindow", oldControlType)) {
250 ✗ resetSetpoint();
251 }
252 ✗ }
253
254 6 bool ShadingControl_Impl::setSchedule(const Schedule& schedule) {
255 6 bool result = false;
256
1/1
✓ Branch 1 taken 6 times.
6 std::string shadingControlType = this->shadingControlType();
257
3/3
✓ Branch 1 taken 6 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 1 time.
6 if (ShadingControl_Impl::isControlTypeValueAllowingSchedule(shadingControlType)) {
258
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 result = setPointer(OS_ShadingControlFields::ScheduleName, schedule.handle());
259
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 if (result) {
260
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 bool test = setString(OS_ShadingControlFields::ShadingControlIsScheduled, "Yes");
261
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
5 OS_ASSERT(test);
262 }
263 } else {
264
9/9
✓ 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 20 taken 1 time.
✓ Branch 23 taken 1 time.
✓ Branch 26 taken 1 time.
1 LOG(Warn, briefDescription() << " has a Shading Control Type '" << shadingControlType << "' which does not allow a Schedule");
265 }
266 6 return result;
267 6 }
268
269 1 void ShadingControl_Impl::resetSchedule() {
270
1/1
✓ Branch 1 taken 1 time.
1 std::string shadingControlType = this->shadingControlType();
271
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
1 if (ShadingControl_Impl::isControlTypeValueRequiringSchedule(shadingControlType)) {
272 ✗ LOG(Warn, briefDescription() << " has a Shading Control Type '" << shadingControlType << "' which does require a Schedule, not resetting it");
273 } else {
274
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool test = setString(OS_ShadingControlFields::ScheduleName, "");
275
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
1 OS_ASSERT(test);
276
277
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 test = setString(OS_ShadingControlFields::ShadingControlIsScheduled, "No");
278
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
1 OS_ASSERT(test);
279 }
280 1 }
281
282 6 bool ShadingControl_Impl::setSetpoint(double setpoint) {
283 6 bool result = false;
284
1/1
✓ Branch 1 taken 6 times.
6 std::string shadingControlType = this->shadingControlType();
285
3/3
✓ Branch 1 taken 6 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 1 time.
6 if (ShadingControl_Impl::isControlTypeValueNeedingSetpoint1(shadingControlType)) {
286
1/1
✓ Branch 1 taken 5 times.
5 result = setDouble(OS_ShadingControlFields::Setpoint, setpoint);
287 } else {
288
9/9
✓ 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 20 taken 1 time.
✓ Branch 23 taken 1 time.
✓ Branch 26 taken 1 time.
1 LOG(Warn, briefDescription() << " has a Shading Control Type '" << shadingControlType << "' which does not require a Setpoint");
289 }
290 6 return result;
291 6 }
292
293 1 void ShadingControl_Impl::resetSetpoint() {
294
1/1
✓ Branch 1 taken 1 time.
1 std::string shadingControlType = this->shadingControlType();
295 3 if (ShadingControl_Impl::isControlTypeValueNeedingSetpoint1(shadingControlType)
296
8/17
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 time.
✓ Branch 9 taken 1 time.
✓ Branch 11 taken 1 time.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 time.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 time.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 time.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
3 && !openstudio::istringEqual("OnIfHighSolarOnWindow", shadingControlType)) {
297
9/9
✓ 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 20 taken 1 time.
✓ Branch 23 taken 1 time.
✓ Branch 26 taken 1 time.
1 LOG(Warn, briefDescription() << " has a Shading Control Type '" << shadingControlType << "' which does require a Setpoint, not resetting it");
298 } else {
299 ✗ bool test = setString(OS_ShadingControlFields::Setpoint, "");
300 ✗ OS_ASSERT(test);
301 }
302 1 }
303
304 4 bool ShadingControl_Impl::setGlareControlIsActive(bool glareControlIsActive) {
305 4 bool result = false;
306
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
4 if (glareControlIsActive) {
307
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
6 result = setString(OS_ShadingControlFields::GlareControlIsActive, "Yes");
308 } else {
309
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
6 result = setString(OS_ShadingControlFields::GlareControlIsActive, "No");
310 }
311
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 OS_ASSERT(result);
312 4 return result;
313 }
314
315 1 void ShadingControl_Impl::resetGlareControlIsActive() {
316
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_ShadingControlFields::GlareControlIsActive, "");
317
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
318 1 }
319
320 4 bool ShadingControl_Impl::setTypeofSlatAngleControlforBlinds(const std::string& typeofSlatAngleControlforBlinds) {
321 4 bool result = false;
322
1/1
✓ Branch 1 taken 4 times.
4 std::string shadingType = this->shadingType();
323
3/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
4 if (ShadingControl_Impl::isTypeValueAllowingSlatAngleControl(shadingType)) {
324
1/1
✓ Branch 1 taken 2 times.
2 result = setString(OS_ShadingControlFields::TypeofSlatAngleControlforBlinds, typeofSlatAngleControlforBlinds);
325 }
326 4 return result;
327 4 }
328
329 1 void ShadingControl_Impl::resetTypeofSlatAngleControlforBlinds() {
330
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_ShadingControlFields::TypeofSlatAngleControlforBlinds, "");
331
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
332 1 }
333
334 1 bool ShadingControl_Impl::setSlatAngleSchedule(const Schedule& slatAngleSchedule) {
335 1 bool result = false;
336
1/1
✓ Branch 1 taken 1 time.
1 std::string shadingType = this->shadingType();
337
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
1 if (ShadingControl_Impl::isTypeValueAllowingSlatAngleControl(shadingType)) {
338
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 result = setPointer(OS_ShadingControlFields::SlatAngleScheduleName, slatAngleSchedule.handle());
339
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (result) {
340
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool test = setString(OS_ShadingControlFields::TypeofSlatAngleControlforBlinds, "ScheduledSlatAngle");
341
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
1 OS_ASSERT(test);
342 }
343 } else {
344 ✗ LOG(Warn, briefDescription() << " has a Shading Type '" << shadingType << "' which does not allow a Slat Angle Schedule");
345 }
346 1 return result;
347 1 }
348
349 1 void ShadingControl_Impl::resetSlatAngleSchedule() {
350 1 bool result = false;
351
352
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 result = setString(OS_ShadingControlFields::SlatAngleScheduleName, "");
353
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
354
355
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 result = setString(OS_ShadingControlFields::TypeofSlatAngleControlforBlinds, "");
356
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
357 1 }
358
359 5 bool ShadingControl_Impl::setSetpoint2(double setpoint2) {
360 5 bool result = false;
361
1/1
✓ Branch 1 taken 5 times.
5 std::string shadingControlType = this->shadingControlType();
362
3/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 1 time.
5 if (ShadingControl_Impl::isControlTypeValueNeedingSetpoint2(shadingControlType)) {
363
1/1
✓ Branch 1 taken 4 times.
4 result = setDouble(OS_ShadingControlFields::Setpoint2, setpoint2);
364 } else {
365
9/9
✓ 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 20 taken 1 time.
✓ Branch 23 taken 1 time.
✓ Branch 26 taken 1 time.
1 LOG(Warn, briefDescription() << " has a Shading Control Type '" << shadingControlType << "' which does not require a Setpoint2");
366 }
367 5 return result;
368 5 }
369
370 ✗ void ShadingControl_Impl::resetSetpoint2() {
371 ✗ std::string shadingControlType = this->shadingControlType();
372 ✗ if (ShadingControl_Impl::isControlTypeValueNeedingSetpoint2(shadingControlType)) {
373 ✗ LOG(Warn,
374 briefDescription() << " has a Shading Control Type '" << shadingControlType << "' which does require a Setpoint2, not resetting it");
375 } else {
376 ✗ bool test = setString(OS_ShadingControlFields::Setpoint2, "");
377 ✗ OS_ASSERT(test);
378 }
379 ✗ }
380
381 24 bool ShadingControl_Impl::setMultipleSurfaceControlType(const std::string& multipleSurfaceControlType) {
382 24 return setString(OS_ShadingControlFields::MultipleSurfaceControlType, multipleSurfaceControlType);
383 }
384
385 30 unsigned int ShadingControl_Impl::numberofSubSurfaces() const {
386 30 return numExtensibleGroups();
387 }
388
389 45 std::vector<SubSurface> ShadingControl_Impl::subSurfaces() const {
390 45 std::vector<SubSurface> result;
391
1/1
✓ Branch 1 taken 45 times.
45 auto groups = extensibleGroups();
392
2/2
✓ Branch 5 taken 56 times.
✓ Branch 6 taken 45 times.
101 for (const auto& group : groups) {
393
2/2
✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
56 boost::optional<WorkspaceObject> wo = group.cast<WorkspaceExtensibleGroup>().getTarget(OS_ShadingControlExtensibleFields::SubSurfaceName);
394
1/2
✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
56 if (wo) {
395
3/4
✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
✓ Branch 6 taken 56 times.
✗ Branch 7 not taken.
112 if (auto subsurface = wo->optionalCast<SubSurface>()) {
396
2/2
✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
56 result.push_back(subsurface.get());
397 56 }
398 }
399 56 }
400 90 return result;
401 45 }
402
403 49 boost::optional<unsigned> ShadingControl_Impl::subSurfaceIndex(const SubSurface& subSurface) const {
404
405 49 boost::optional<unsigned> result;
406
407
2/2
✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
49 auto egs = castVector<WorkspaceExtensibleGroup>(extensibleGroups());
408
2/2
✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
49 auto h = openstudio::toString(subSurface.handle());
409
1/1
✓ Branch 3 taken 49 times.
49 auto it = std::find_if(egs.begin(), egs.end(), [&](const WorkspaceExtensibleGroup& eg) {
410
2/2
✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
26 return (eg.getField(OS_ShadingControlExtensibleFields::SubSurfaceName).get() == h);
411 });
412
413 // If found, we compute the index by using std::distance between the start of vector and the iterator returned by std::find_if
414
2/2
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 33 times.
49 if (it != egs.end()) {
415
1/1
✓ Branch 2 taken 16 times.
32 result = std::distance(egs.begin(), it) + 1;
416 }
417
418 49 return result;
419 49 }
420
421 34 bool ShadingControl_Impl::addSubSurface(const SubSurface& subSurface) {
422 // Check if subSurface already exists
423
1/1
✓ Branch 1 taken 34 times.
34 boost::optional<unsigned> _existingIndex = subSurfaceIndex(subSurface);
424
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 32 times.
34 if (_existingIndex) {
425
8/8
✓ 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 17 taken 2 times.
✓ Branch 20 taken 2 times.
✓ Branch 23 taken 2 times.
2 LOG(Warn, "For " << briefDescription() << ", SubSurface already exists.");
426 2 return true;
427 }
428
429 bool result;
430
431
3/3
✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
✓ Branch 7 taken 32 times.
32 auto eg = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>();
432
2/2
✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
32 bool subsurface = eg.setPointer(OS_ShadingControlExtensibleFields::SubSurfaceName, subSurface.handle());
433
1/2
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
32 if (subsurface) {
434 32 result = true;
435 } else {
436 // Something went wrong
437 // So erase the new extensible group
438 ✗ getObject<ModelObject>().eraseExtensibleGroup(eg.groupIndex());
439 ✗ result = false;
440 }
441 32 return result;
442 32 }
443
444 ✗ bool ShadingControl_Impl::setSubSurfaceIndex(const SubSurface& subSurface, unsigned index) {
445 ✗ boost::optional<unsigned> idx = subSurfaceIndex(subSurface);
446 ✗ if (!idx) {
447 ✗ LOG(Warn,
448 "For " << briefDescription() << " cannot set the index of SubSurface " << subSurface.nameString() << " since it is not part of it.");
449 ✗ return false;
450 }
451
452 // TODO: we could just set via string instead of doing a ton of typechecking below...
453 ✗ std::vector<SubSurface> subSurfaceVector = subSurfaces();
454
455 ✗ if (index > subSurfaceVector.size()) {
456 ✗ LOG(Warn, "Requested a subSurface index of " << index << " to be assigned to " << subSurface.nameString() << ", but " << briefDescription()
457 << " only has " << subSurfaceVector.size() << " SubSurfaces, resetting to that.");
458 ✗ index = subSurfaceVector.size();
459 ✗ } else if (index < 1) {
460 ✗ LOG(Warn, "Requested a subSurface index of " << index << " < 1 to be assigned to " << subSurface.briefDescription() << ", resetting to 1");
461 ✗ index = 1;
462 }
463
464 ✗ subSurfaceVector.erase(subSurfaceVector.begin() + idx.get() - 1); // subSurfaceIndex is 1-indexed, and vector is 0-indexed
465
466 ✗ subSurfaceVector.insert(subSurfaceVector.begin() + (index - 1), subSurface);
467
468 ✗ return setSubSurfaces(subSurfaceVector);
469 ✗ }
470
471 ✗ bool ShadingControl_Impl::addSubSurface(const SubSurface& subSurface, unsigned index) {
472 ✗ bool ok = addSubSurface(subSurface);
473 ✗ if (!ok) {
474 ✗ return false;
475 }
476 ✗ ok = setSubSurfaceIndex(subSurface, index);
477 ✗ return ok;
478 }
479
480 10 bool ShadingControl_Impl::removeSubSurface(const SubSurface& subSurface) {
481
1/1
✓ Branch 1 taken 10 times.
10 boost::optional<unsigned> idx = subSurfaceIndex(subSurface);
482
2/2
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 9 times.
10 if (!idx) {
483
11/11
✓ 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.
1 LOG(Warn, "For " << briefDescription() << " cannot remove SubSurface " << subSurface.nameString() << " since it is not part of it.");
484 1 return false;
485 }
486
487
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 return removeSubSurface(idx.get());
488 }
489
490 9 bool ShadingControl_Impl::removeSubSurface(unsigned index) {
491 9 bool result = false;
492
3/6
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 9 times.
✗ Branch 6 not taken.
9 if ((index > 0) && (index <= numberofSubSurfaces())) {
493
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 getObject<ModelObject>().eraseExtensibleGroup(index - 1);
494 9 result = true;
495 }
496 9 return result;
497 }
498
499 7 bool ShadingControl_Impl::addSubSurfaces(const std::vector<SubSurface>& subSurfaces) {
500 7 bool ok = true;
501
2/2
✓ Branch 4 taken 14 times.
✓ Branch 5 taken 7 times.
21 for (const SubSurface& subSurface : subSurfaces) {
502
1/1
✓ Branch 1 taken 14 times.
14 ok &= addSubSurface(subSurface);
503 }
504 7 return ok;
505 }
506
507 7 void ShadingControl_Impl::removeAllSubSurfaces() {
508
1/1
✓ Branch 1 taken 7 times.
7 clearExtensibleGroups();
509 7 }
510
511 3 bool ShadingControl_Impl::setSubSurfaces(const std::vector<SubSurface>& subSurfaces) {
512 3 removeAllSubSurfaces();
513 3 return addSubSurfaces(subSurfaces);
514 }
515
516 } // namespace detail
517
518
3/3
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
7 ShadingControl::ShadingControl(const Construction& construction) : ResourceObject(ShadingControl::iddObjectType(), construction.model()) {
519
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
✗ Branch 5 not taken.
7 OS_ASSERT(getImpl<detail::ShadingControl_Impl>());
520
521
1/1
✓ Branch 1 taken 7 times.
7 std::vector<Material> layers = construction.layers();
522
523 7 std::string type;
524
525 // check layers from inside out
526 7 int i = layers.size() - 1;
527
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 3 times.
15 for (; i >= 0; --i) {
528
2/3
✓ Branch 2 taken 12 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 12 times.
24 if (layers[i].optionalCast<Shade>()) {
529 ✗ type = "Shade";
530 ✗ LOG(Warn, "ShadingMaterial detected in shaded construction, prefer to use the ShadingControl constructor from ShadingMaterial.");
531 ✗ break;
532
3/3
✓ Branch 2 taken 12 times.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 11 times.
24 } else if (layers[i].optionalCast<Blind>()) {
533
1/1
✓ Branch 1 taken 1 time.
1 type = "Blind";
534
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.
1 LOG(Warn, "ShadingMaterial detected in shaded construction, prefer to use the ShadingControl constructor from ShadingMaterial.");
535 1 break;
536
2/3
✓ Branch 2 taken 11 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 11 times.
22 } else if (layers[i].optionalCast<Screen>()) {
537 ✗ type = "Screen";
538 ✗ setShadingControlType("AlwaysOn");
539 ✗ LOG(Warn, "ShadingMaterial detected in shaded construction, prefer to use the ShadingControl constructor from ShadingMaterial.");
540 ✗ break;
541
3/3
✓ Branch 2 taken 11 times.
✓ Branch 5 taken 3 times.
✓ Branch 6 taken 8 times.
22 } else if (layers[i].optionalCast<DaylightRedirectionDevice>()) {
542
1/1
✓ Branch 1 taken 3 times.
3 type = "DaylightRedirectionDevice";
543
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 setShadingControlType("AlwaysOn");
544
5/5
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
3 LOG(Warn, "ShadingMaterial detected in shaded construction, prefer to use the ShadingControl constructor from ShadingMaterial.");
545 3 break;
546 }
547 }
548
549 7 std::string position;
550
2/2
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 4 times.
7 if (i == int(layers.size()) - 1) {
551
1/1
✓ Branch 1 taken 3 times.
3 position = "Interior";
552
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 3 times.
4 } else if (i == 0) {
553
1/1
✓ Branch 1 taken 1 time.
1 position = "Exterior";
554 } else {
555
1/1
✓ Branch 1 taken 3 times.
3 position = "BetweenGlass";
556 }
557
558
2/2
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 4 times.
7 if (type.empty()) {
559
1/1
✓ Branch 1 taken 3 times.
3 type = "SwitchableGlazing";
560
1/1
✓ Branch 1 taken 3 times.
3 position = "";
561 }
562
563
3/8
✓ Branch 1 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 7 times.
7 if (type == "Screen" && position != "Exterior") {
564 ✗ this->remove();
565 ✗ LOG_AND_THROW(position << type << " is not an allowable configuration for ShadingControl");
566 }
567
568
8/8
✓ Branch 1 taken 7 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 3 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 1 time.
✓ Branch 10 taken 2 times.
✓ Branch 11 taken 5 times.
7 if (type == "DaylightRedirectionDevice" && position != "Interior") {
569
1/1
✓ Branch 1 taken 2 times.
2 this->remove();
570
17/17
✓ 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 25 taken 2 times.
✓ Branch 28 taken 2 times.
✓ Branch 31 taken 2 times.
✓ Branch 34 taken 2 times.
✓ Branch 37 taken 2 times.
✓ Branch 40 taken 2 times.
✓ Branch 43 taken 2 times.
✓ Branch 46 taken 2 times.
✓ Branch 50 taken 2 times.
✓ Branch 53 taken 2 times.
2 LOG_AND_THROW(position << type << " is not an allowable configuration for ShadingControl");
571 }
572
573
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 bool test = this->setShadingType(position + type);
574
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
5 OS_ASSERT(test);
575
576
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 test = setMultipleSurfaceControlType("Sequential"); // E+ IDD Default
577
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
5 OS_ASSERT(test);
578
579
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 test = this->setPointer(OS_ShadingControlFields::ConstructionwithShadingName, construction.handle());
580
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
5 OS_ASSERT(test);
581 13 }
582
583
3/3
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 13 times.
13 ShadingControl::ShadingControl(const ShadingMaterial& shadingMaterial) : ResourceObject(ShadingControl::iddObjectType(), shadingMaterial.model()) {
584
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 13 times.
✗ Branch 5 not taken.
13 OS_ASSERT(getImpl<detail::ShadingControl_Impl>());
585
586 13 std::string type;
587
2/3
✓ Branch 1 taken 13 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 13 times.
26 if (shadingMaterial.optionalCast<Shade>()) {
588 ✗ type = "InteriorShade";
589
3/3
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 12 times.
✓ Branch 5 taken 1 time.
26 } else if (shadingMaterial.optionalCast<Blind>()) {
590
1/1
✓ Branch 1 taken 12 times.
12 type = "InteriorBlind";
591
2/3
✓ Branch 1 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 time.
2 } else if (shadingMaterial.optionalCast<Screen>()) {
592 ✗ type = "ExteriorScreen";
593 ✗ setShadingControlType("AlwaysOn");
594
2/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
2 } else if (shadingMaterial.optionalCast<DaylightRedirectionDevice>()) {
595
1/1
✓ Branch 1 taken 1 time.
1 type = "InteriorDaylightRedirectionDevice";
596
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 setShadingControlType("AlwaysOn");
597 }
598
599
1/1
✓ Branch 1 taken 13 times.
13 bool test = this->setShadingType(type);
600
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
✗ Branch 3 not taken.
13 OS_ASSERT(test);
601
602
2/2
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
13 test = setMultipleSurfaceControlType("Sequential"); // E+ IDD Default
603
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
✗ Branch 3 not taken.
13 OS_ASSERT(test);
604
605
2/2
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
13 test = this->setPointer(OS_ShadingControlFields::ShadingDeviceMaterialName, shadingMaterial.handle());
606
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
✗ Branch 3 not taken.
13 OS_ASSERT(test);
607 13 }
608
609 8684 IddObjectType ShadingControl::iddObjectType() {
610
1/1
✓ Branch 1 taken 8684 times.
8684 return {IddObjectType::OS_ShadingControl};
611 }
612
613 ✗ std::vector<std::string> ShadingControl::shadingTypeValues() {
614 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ShadingControlFields::ShadingType);
615 }
616
617 ✗ std::vector<std::string> ShadingControl::shadingControlTypeValues() {
618 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ShadingControlFields::ShadingControlType);
619 }
620
621 ✗ std::vector<std::string> ShadingControl::typeofSlatAngleControlforBlindsValues() {
622 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ShadingControlFields::TypeofSlatAngleControlforBlinds);
623 }
624
625 ✗ std::vector<std::string> ShadingControl::multipleSurfaceControlTypeValues() {
626 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ShadingControlFields::MultipleSurfaceControlType);
627 }
628
629 10 bool ShadingControl::isControlTypeValueNeedingSetpoint1() {
630
2/2
✓ Branch 3 taken 10 times.
✓ Branch 6 taken 10 times.
10 return getImpl<detail::ShadingControl_Impl>()->isControlTypeValueNeedingSetpoint1(this->shadingControlType());
631 }
632
633 10 bool ShadingControl::isControlTypeValueNeedingSetpoint2() {
634
2/2
✓ Branch 3 taken 10 times.
✓ Branch 6 taken 10 times.
10 return getImpl<detail::ShadingControl_Impl>()->isControlTypeValueNeedingSetpoint2(this->shadingControlType());
635 }
636
637 7 bool ShadingControl::isControlTypeValueAllowingSchedule() {
638
2/2
✓ Branch 3 taken 7 times.
✓ Branch 6 taken 7 times.
7 return getImpl<detail::ShadingControl_Impl>()->isControlTypeValueAllowingSchedule(this->shadingControlType());
639 }
640
641 3 bool ShadingControl::isControlTypeValueRequiringSchedule() {
642
2/2
✓ Branch 3 taken 3 times.
✓ Branch 6 taken 3 times.
3 return getImpl<detail::ShadingControl_Impl>()->isControlTypeValueRequiringSchedule(this->shadingControlType());
643 }
644
645 6 bool ShadingControl::isTypeValueAllowingSlatAngleControl() {
646
2/2
✓ Branch 3 taken 6 times.
✓ Branch 6 taken 6 times.
6 return getImpl<detail::ShadingControl_Impl>()->isTypeValueAllowingSlatAngleControl(this->shadingType());
647 }
648
649 15 std::string ShadingControl::shadingType() const {
650
1/1
✓ Branch 3 taken 15 times.
15 return getImpl<detail::ShadingControl_Impl>()->shadingType();
651 }
652
653 11 boost::optional<Construction> ShadingControl::construction() const {
654
1/1
✓ Branch 3 taken 11 times.
11 return getImpl<detail::ShadingControl_Impl>()->construction();
655 }
656
657 22 boost::optional<ShadingMaterial> ShadingControl::shadingMaterial() const {
658
1/1
✓ Branch 3 taken 22 times.
22 return getImpl<detail::ShadingControl_Impl>()->shadingMaterial();
659 }
660
661 39 std::string ShadingControl::shadingControlType() const {
662
1/1
✓ Branch 3 taken 39 times.
39 return getImpl<detail::ShadingControl_Impl>()->shadingControlType();
663 }
664
665 ✗ bool ShadingControl::isShadingControlTypeDefaulted() const {
666 ✗ return getImpl<detail::ShadingControl_Impl>()->isShadingControlTypeDefaulted();
667 }
668
669 13 boost::optional<Schedule> ShadingControl::schedule() const {
670
1/1
✓ Branch 3 taken 13 times.
13 return getImpl<detail::ShadingControl_Impl>()->schedule();
671 }
672
673 16 boost::optional<double> ShadingControl::setpoint() const {
674
1/1
✓ Branch 3 taken 16 times.
16 return getImpl<detail::ShadingControl_Impl>()->setpoint();
675 }
676
677 ✗ bool ShadingControl::isSetpointDefaulted() const {
678 ✗ return getImpl<detail::ShadingControl_Impl>()->isSetpointDefaulted();
679 }
680
681 6 bool ShadingControl::glareControlIsActive() const {
682
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::ShadingControl_Impl>()->glareControlIsActive();
683 }
684
685 8 std::string ShadingControl::typeofSlatAngleControlforBlinds() const {
686
1/1
✓ Branch 3 taken 8 times.
8 return getImpl<detail::ShadingControl_Impl>()->typeofSlatAngleControlforBlinds();
687 }
688
689 6 bool ShadingControl::isTypeofSlatAngleControlforBlindsDefaulted() const {
690
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::ShadingControl_Impl>()->isTypeofSlatAngleControlforBlindsDefaulted();
691 }
692
693 6 boost::optional<Schedule> ShadingControl::slatAngleSchedule() const {
694
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::ShadingControl_Impl>()->slatAngleSchedule();
695 }
696
697 11 boost::optional<double> ShadingControl::setpoint2() const {
698
1/1
✓ Branch 3 taken 11 times.
11 return getImpl<detail::ShadingControl_Impl>()->setpoint2();
699 }
700
701 7 std::string ShadingControl::multipleSurfaceControlType() const {
702
1/1
✓ Branch 3 taken 7 times.
7 return getImpl<detail::ShadingControl_Impl>()->multipleSurfaceControlType();
703 }
704
705 21 bool ShadingControl::setShadingType(const std::string& shadingType) {
706
1/1
✓ Branch 3 taken 21 times.
21 return getImpl<detail::ShadingControl_Impl>()->setShadingType(shadingType);
707 }
708
709 10 bool ShadingControl::setShadingControlType(const std::string& shadingControlType) {
710
1/1
✓ Branch 3 taken 10 times.
10 return getImpl<detail::ShadingControl_Impl>()->setShadingControlType(shadingControlType);
711 }
712
713 ✗ void ShadingControl::resetShadingControlType() {
714 ✗ return getImpl<detail::ShadingControl_Impl>()->resetShadingControlType();
715 }
716
717 6 bool ShadingControl::setSchedule(const Schedule& schedule) {
718
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::ShadingControl_Impl>()->setSchedule(schedule);
719 }
720
721 1 void ShadingControl::resetSchedule() {
722
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::ShadingControl_Impl>()->resetSchedule();
723 1 }
724
725 6 bool ShadingControl::setSetpoint(double setpoint) {
726
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::ShadingControl_Impl>()->setSetpoint(setpoint);
727 }
728
729 1 void ShadingControl::resetSetpoint() {
730
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::ShadingControl_Impl>()->resetSetpoint();
731 1 }
732
733 4 bool ShadingControl::setGlareControlIsActive(bool glareControlIsActive) {
734
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::ShadingControl_Impl>()->setGlareControlIsActive(glareControlIsActive);
735 }
736
737 1 void ShadingControl::resetGlareControlIsActive() {
738
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::ShadingControl_Impl>()->resetGlareControlIsActive();
739 1 }
740
741 4 bool ShadingControl::setTypeofSlatAngleControlforBlinds(const std::string& typeofSlatAngleControlforBlinds) {
742
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::ShadingControl_Impl>()->setTypeofSlatAngleControlforBlinds(typeofSlatAngleControlforBlinds);
743 }
744
745 1 void ShadingControl::resetTypeofSlatAngleControlforBlinds() {
746
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::ShadingControl_Impl>()->resetTypeofSlatAngleControlforBlinds();
747 1 }
748
749 1 bool ShadingControl::setSlatAngleSchedule(const Schedule& slatAngleSchedule) {
750
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ShadingControl_Impl>()->setSlatAngleSchedule(slatAngleSchedule);
751 }
752
753 1 void ShadingControl::resetSlatAngleSchedule() {
754
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::ShadingControl_Impl>()->resetSlatAngleSchedule();
755 1 }
756
757 5 bool ShadingControl::setSetpoint2(double setpoint2) {
758
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::ShadingControl_Impl>()->setSetpoint2(setpoint2);
759 }
760
761 24 bool ShadingControl::setMultipleSurfaceControlType(const std::string& multipleSurfaceControlType) {
762
1/1
✓ Branch 3 taken 24 times.
24 return getImpl<detail::ShadingControl_Impl>()->setMultipleSurfaceControlType(multipleSurfaceControlType);
763 }
764
765 // Extensible Fields
766
767 45 std::vector<SubSurface> ShadingControl::subSurfaces() const {
768
1/1
✓ Branch 3 taken 45 times.
45 return getImpl<detail::ShadingControl_Impl>()->subSurfaces();
769 }
770
771 21 unsigned int ShadingControl::numberofSubSurfaces() const {
772
1/1
✓ Branch 3 taken 21 times.
21 return getImpl<detail::ShadingControl_Impl>()->numberofSubSurfaces();
773 }
774
775 5 boost::optional<unsigned> ShadingControl::subSurfaceIndex(const SubSurface& subSurface) const {
776
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::ShadingControl_Impl>()->subSurfaceIndex(subSurface);
777 }
778
779 20 bool ShadingControl::addSubSurface(const SubSurface& subSurface) {
780
1/1
✓ Branch 3 taken 20 times.
20 return getImpl<detail::ShadingControl_Impl>()->addSubSurface(subSurface);
781 }
782
783 ✗ bool ShadingControl::addSubSurface(const SubSurface& subSurface, unsigned index) {
784 ✗ return getImpl<detail::ShadingControl_Impl>()->addSubSurface(subSurface, index);
785 }
786
787 ✗ bool ShadingControl::setSubSurfaceIndex(const SubSurface& subSurface, unsigned index) {
788 ✗ return getImpl<detail::ShadingControl_Impl>()->setSubSurfaceIndex(subSurface, index);
789 }
790
791 ✗ bool ShadingControl::removeSubSurface(unsigned index) {
792 ✗ return getImpl<detail::ShadingControl_Impl>()->removeSubSurface(index);
793 }
794
795 10 bool ShadingControl::removeSubSurface(const SubSurface& subSurface) {
796
1/1
✓ Branch 3 taken 10 times.
10 return getImpl<detail::ShadingControl_Impl>()->removeSubSurface(subSurface);
797 }
798
799 4 bool ShadingControl::addSubSurfaces(const std::vector<SubSurface>& subSurfaces) {
800
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::ShadingControl_Impl>()->addSubSurfaces(subSurfaces);
801 }
802
803 3 bool ShadingControl::setSubSurfaces(const std::vector<SubSurface>& subSurfaces) {
804
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ShadingControl_Impl>()->setSubSurfaces(subSurfaces);
805 }
806
807 4 void ShadingControl::removeAllSubSurfaces() {
808
1/1
✓ Branch 3 taken 4 times.
4 getImpl<detail::ShadingControl_Impl>()->removeAllSubSurfaces();
809 4 }
810
811 /// @cond
812
1/1
✓ Branch 3 taken 134 times.
134 ShadingControl::ShadingControl(std::shared_ptr<detail::ShadingControl_Impl> impl) : ResourceObject(std::move(impl)) {}
813 /// @endcond
814
815 } // namespace model
816 } // namespace openstudio
817