GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 95.6% 370 / 0 / 387
Functions: 97.5% 119 / 0 / 122
Branches: 72.4% 213 / 0 / 294

src/model/DaylightingControl.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 "DaylightingControl.hpp"
7 #include "DaylightingControl_Impl.hpp"
8 #include "ThermalZone.hpp"
9 #include "ThermalZone_Impl.hpp"
10
11 #include <utilities/idd/IddFactory.hxx>
12
13 #include <utilities/idd/OS_Daylighting_Control_FieldEnums.hxx>
14 #include <utilities/idd/IddEnums.hxx>
15
16 #include "../utilities/geometry/Transformation.hpp"
17 #include "../utilities/geometry/EulerAngles.hpp"
18 #include "../utilities/geometry/Vector3d.hpp"
19 #include "../utilities/geometry/Point3d.hpp"
20 #include "../utilities/geometry/Geometry.hpp"
21 #include "../utilities/core/Assert.hpp"
22
23 namespace openstudio {
24 namespace model {
25
26 namespace detail {
27
28 267 DaylightingControl_Impl::DaylightingControl_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
29 267 : SpaceItem_Impl(idfObject, model, keepHandle) {
30
4/6
✓ Branch 1 taken 267 times.
✓ Branch 4 taken 267 times.
✓ Branch 7 taken 267 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 267 times.
✗ Branch 13 not taken.
267 OS_ASSERT(idfObject.iddObject().type() == DaylightingControl::iddObjectType());
31 267 }
32
33 25 DaylightingControl_Impl::DaylightingControl_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
34 25 : SpaceItem_Impl(other, model, keepHandle) {
35
4/6
✓ Branch 1 taken 25 times.
✓ Branch 4 taken 25 times.
✓ Branch 7 taken 25 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 25 times.
✗ Branch 13 not taken.
25 OS_ASSERT(other.iddObject().type() == DaylightingControl::iddObjectType());
36 25 }
37
38 98 DaylightingControl_Impl::DaylightingControl_Impl(const DaylightingControl_Impl& other, Model_Impl* model, bool keepHandle)
39 98 : SpaceItem_Impl(other, model, keepHandle) {}
40
41 1 const std::vector<std::string>& DaylightingControl_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 return result;
44 }
45
46 1 IddObjectType DaylightingControl_Impl::iddObjectType() const {
47 1 return DaylightingControl::iddObjectType();
48 }
49
50 483 double DaylightingControl_Impl::positionXCoordinate() const {
51
1/1
✓ Branch 1 taken 483 times.
483 boost::optional<double> value = getDouble(OS_Daylighting_ControlFields::PositionXCoordinate, true);
52
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 483 times.
✗ Branch 4 not taken.
483 OS_ASSERT(value);
53
1/1
✓ Branch 1 taken 483 times.
966 return value.get();
54 }
55
56 483 double DaylightingControl_Impl::positionYCoordinate() const {
57
1/1
✓ Branch 1 taken 483 times.
483 boost::optional<double> value = getDouble(OS_Daylighting_ControlFields::PositionYCoordinate, true);
58
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 483 times.
✗ Branch 4 not taken.
483 OS_ASSERT(value);
59
1/1
✓ Branch 1 taken 483 times.
966 return value.get();
60 }
61
62 494 double DaylightingControl_Impl::positionZCoordinate() const {
63
1/1
✓ Branch 1 taken 494 times.
494 boost::optional<double> value = getDouble(OS_Daylighting_ControlFields::PositionZCoordinate, true);
64
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 494 times.
✗ Branch 4 not taken.
494 OS_ASSERT(value);
65
1/1
✓ Branch 1 taken 494 times.
988 return value.get();
66 }
67
68 135 double DaylightingControl_Impl::psiRotationAroundXAxis() const {
69
1/1
✓ Branch 1 taken 135 times.
135 boost::optional<double> value = getDouble(OS_Daylighting_ControlFields::PsiRotationAroundXAxis, true);
70
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 135 times.
✗ Branch 4 not taken.
135 OS_ASSERT(value);
71
1/1
✓ Branch 1 taken 135 times.
270 return value.get();
72 }
73
74 3 bool DaylightingControl_Impl::isPsiRotationAroundXAxisDefaulted() const {
75 3 return isEmpty(OS_Daylighting_ControlFields::PsiRotationAroundXAxis);
76 }
77
78 139 double DaylightingControl_Impl::thetaRotationAroundYAxis() const {
79
1/1
✓ Branch 1 taken 139 times.
139 boost::optional<double> value = getDouble(OS_Daylighting_ControlFields::ThetaRotationAroundYAxis, true);
80
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 139 times.
✗ Branch 4 not taken.
139 OS_ASSERT(value);
81
1/1
✓ Branch 1 taken 139 times.
278 return value.get();
82 }
83
84 3 bool DaylightingControl_Impl::isThetaRotationAroundYAxisDefaulted() const {
85 3 return isEmpty(OS_Daylighting_ControlFields::ThetaRotationAroundYAxis);
86 }
87
88 140 double DaylightingControl_Impl::phiRotationAroundZAxis() const {
89
1/1
✓ Branch 1 taken 140 times.
140 boost::optional<double> value = getDouble(OS_Daylighting_ControlFields::PhiRotationAroundZAxis, true);
90
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 140 times.
✗ Branch 4 not taken.
140 OS_ASSERT(value);
91
1/1
✓ Branch 1 taken 140 times.
280 return value.get();
92 }
93
94 3 bool DaylightingControl_Impl::isPhiRotationAroundZAxisDefaulted() const {
95 3 return isEmpty(OS_Daylighting_ControlFields::PhiRotationAroundZAxis);
96 }
97
98 92 double DaylightingControl_Impl::illuminanceSetpoint() const {
99
1/1
✓ Branch 1 taken 92 times.
92 boost::optional<double> value = getDouble(OS_Daylighting_ControlFields::IlluminanceSetpoint, true);
100
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 92 times.
✗ Branch 4 not taken.
92 OS_ASSERT(value);
101
1/1
✓ Branch 1 taken 92 times.
184 return value.get();
102 }
103
104 5 bool DaylightingControl_Impl::isIlluminanceSetpointDefaulted() const {
105 5 return isEmpty(OS_Daylighting_ControlFields::IlluminanceSetpoint);
106 }
107
108 139 std::string DaylightingControl_Impl::lightingControlType() const {
109
1/1
✓ Branch 1 taken 139 times.
139 boost::optional<std::string> value = getString(OS_Daylighting_ControlFields::LightingControlType, true);
110
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 139 times.
✗ Branch 4 not taken.
139 OS_ASSERT(value);
111
2/2
✓ Branch 1 taken 139 times.
✓ Branch 4 taken 139 times.
278 return value.get();
112 139 }
113
114 3 bool DaylightingControl_Impl::isLightingControlTypeDefaulted() const {
115 3 return isEmpty(OS_Daylighting_ControlFields::LightingControlType);
116 }
117
118 67 double DaylightingControl_Impl::minimumInputPowerFractionforContinuousDimmingControl() const {
119
1/1
✓ Branch 1 taken 67 times.
67 boost::optional<double> value = getDouble(OS_Daylighting_ControlFields::MinimumInputPowerFractionforContinuousDimmingControl, true);
120
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 67 times.
✗ Branch 4 not taken.
67 OS_ASSERT(value);
121
1/1
✓ Branch 1 taken 67 times.
134 return value.get();
122 }
123
124 3 bool DaylightingControl_Impl::isMinimumInputPowerFractionforContinuousDimmingControlDefaulted() const {
125 3 return isEmpty(OS_Daylighting_ControlFields::MinimumInputPowerFractionforContinuousDimmingControl);
126 }
127
128 67 double DaylightingControl_Impl::minimumLightOutputFractionforContinuousDimmingControl() const {
129
1/1
✓ Branch 1 taken 67 times.
67 boost::optional<double> value = getDouble(OS_Daylighting_ControlFields::MinimumLightOutputFractionforContinuousDimmingControl, true);
130
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 67 times.
✗ Branch 4 not taken.
67 OS_ASSERT(value);
131
1/1
✓ Branch 1 taken 67 times.
134 return value.get();
132 }
133
134 3 bool DaylightingControl_Impl::isMinimumLightOutputFractionforContinuousDimmingControlDefaulted() const {
135 3 return isEmpty(OS_Daylighting_ControlFields::MinimumLightOutputFractionforContinuousDimmingControl);
136 }
137
138 66 int DaylightingControl_Impl::numberofSteppedControlSteps() const {
139
1/1
✓ Branch 1 taken 66 times.
66 boost::optional<int> value = getInt(OS_Daylighting_ControlFields::NumberofSteppedControlSteps, true);
140
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 66 times.
✗ Branch 4 not taken.
66 OS_ASSERT(value);
141
1/1
✓ Branch 1 taken 66 times.
132 return value.get();
142 }
143
144 3 bool DaylightingControl_Impl::isNumberofSteppedControlStepsDefaulted() const {
145 3 return isEmpty(OS_Daylighting_ControlFields::NumberofSteppedControlSteps);
146 }
147
148 67 double DaylightingControl_Impl::probabilityLightingwillbeResetWhenNeededinManualSteppedControl() const {
149
1/1
✓ Branch 1 taken 67 times.
67 boost::optional<double> value = getDouble(OS_Daylighting_ControlFields::ProbabilityLightingwillbeResetWhenNeededinManualSteppedControl, true);
150
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 67 times.
✗ Branch 4 not taken.
67 OS_ASSERT(value);
151
1/1
✓ Branch 1 taken 67 times.
134 return value.get();
152 }
153
154 3 bool DaylightingControl_Impl::isProbabilityLightingwillbeResetWhenNeededinManualSteppedControlDefaulted() const {
155 3 return isEmpty(OS_Daylighting_ControlFields::ProbabilityLightingwillbeResetWhenNeededinManualSteppedControl);
156 }
157
158 4 int DaylightingControl_Impl::numberofDaylightingViews() const {
159
1/1
✓ Branch 1 taken 4 times.
4 boost::optional<int> value = getInt(OS_Daylighting_ControlFields::NumberofDaylightingViews, true);
160
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
4 OS_ASSERT(value);
161
1/1
✓ Branch 1 taken 4 times.
8 return value.get();
162 }
163
164 2 bool DaylightingControl_Impl::isNumberofDaylightingViewsDefaulted() const {
165 2 return isEmpty(OS_Daylighting_ControlFields::NumberofDaylightingViews);
166 }
167
168 68 boost::optional<double> DaylightingControl_Impl::maximumAllowableDiscomfortGlareIndex() const {
169 68 return getDouble(OS_Daylighting_ControlFields::MaximumAllowableDiscomfortGlareIndex, true);
170 }
171
172 285 bool DaylightingControl_Impl::setPositionXCoordinate(double positionXCoordinate) {
173 285 bool result = setDouble(OS_Daylighting_ControlFields::PositionXCoordinate, positionXCoordinate);
174
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 285 times.
285 OS_ASSERT(result);
175 285 return result;
176 }
177
178 285 bool DaylightingControl_Impl::setPositionYCoordinate(double positionYCoordinate) {
179 285 bool result = setDouble(OS_Daylighting_ControlFields::PositionYCoordinate, positionYCoordinate);
180
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 285 times.
285 OS_ASSERT(result);
181 285 return result;
182 }
183
184 285 bool DaylightingControl_Impl::setPositionZCoordinate(double positionZCoordinate) {
185 285 bool result = setDouble(OS_Daylighting_ControlFields::PositionZCoordinate, positionZCoordinate);
186
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 285 times.
285 OS_ASSERT(result);
187 285 return result;
188 }
189
190 61 bool DaylightingControl_Impl::setPsiRotationAroundXAxis(double psiRotationAroundXAxis) {
191 61 bool result = setDouble(OS_Daylighting_ControlFields::PsiRotationAroundXAxis, psiRotationAroundXAxis);
192
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
61 OS_ASSERT(result);
193 61 return result;
194 }
195
196 1 void DaylightingControl_Impl::resetPsiRotationAroundXAxis() {
197
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Daylighting_ControlFields::PsiRotationAroundXAxis, "");
198
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
199 1 }
200
201 62 bool DaylightingControl_Impl::setThetaRotationAroundYAxis(double thetaRotationAroundYAxis) {
202 62 bool result = setDouble(OS_Daylighting_ControlFields::ThetaRotationAroundYAxis, thetaRotationAroundYAxis);
203
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 62 times.
62 OS_ASSERT(result);
204 62 return result;
205 }
206
207 1 void DaylightingControl_Impl::resetThetaRotationAroundYAxis() {
208
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Daylighting_ControlFields::ThetaRotationAroundYAxis, "");
209
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
210 1 }
211
212 79 bool DaylightingControl_Impl::setPhiRotationAroundZAxis(double phiRotationAroundZAxis) {
213 79 bool result = setDouble(OS_Daylighting_ControlFields::PhiRotationAroundZAxis, phiRotationAroundZAxis);
214
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 79 times.
79 OS_ASSERT(result);
215 79 return result;
216 }
217
218 1 void DaylightingControl_Impl::resetPhiRotationAroundZAxis() {
219
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Daylighting_ControlFields::PhiRotationAroundZAxis, "");
220
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
221 1 }
222
223 64 bool DaylightingControl_Impl::setIlluminanceSetpoint(double illuminanceSetpoint) {
224 64 bool result = setDouble(OS_Daylighting_ControlFields::IlluminanceSetpoint, illuminanceSetpoint);
225 64 return result;
226 }
227
228 1 void DaylightingControl_Impl::resetIlluminanceSetpoint() {
229
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Daylighting_ControlFields::IlluminanceSetpoint, "");
230
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
231 1 }
232
233 36 bool DaylightingControl_Impl::setLightingControlType(const std::string& lightingControlType) {
234 36 bool result = setString(OS_Daylighting_ControlFields::LightingControlType, lightingControlType);
235 36 return result;
236 }
237
238 1 void DaylightingControl_Impl::resetLightingControlType() {
239
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Daylighting_ControlFields::LightingControlType, "");
240
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
241 1 }
242
243 bool
244 34 DaylightingControl_Impl::setMinimumInputPowerFractionforContinuousDimmingControl(double minimumInputPowerFractionforContinuousDimmingControl) {
245 34 bool result = setDouble(OS_Daylighting_ControlFields::MinimumInputPowerFractionforContinuousDimmingControl,
246 minimumInputPowerFractionforContinuousDimmingControl);
247 34 return result;
248 }
249
250 1 void DaylightingControl_Impl::resetMinimumInputPowerFractionforContinuousDimmingControl() {
251
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Daylighting_ControlFields::MinimumInputPowerFractionforContinuousDimmingControl, "");
252
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
253 1 }
254
255 34 bool DaylightingControl_Impl::setMinimumLightOutputFractionforContinuousDimmingControl(
256 double minimumLightOutputFractionforContinuousDimmingControl) {
257 34 bool result = setDouble(OS_Daylighting_ControlFields::MinimumLightOutputFractionforContinuousDimmingControl,
258 minimumLightOutputFractionforContinuousDimmingControl);
259 34 return result;
260 }
261
262 1 void DaylightingControl_Impl::resetMinimumLightOutputFractionforContinuousDimmingControl() {
263
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Daylighting_ControlFields::MinimumLightOutputFractionforContinuousDimmingControl, "");
264
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
265 1 }
266
267 13 bool DaylightingControl_Impl::setNumberofSteppedControlSteps(int numberofSteppedControlSteps) {
268 13 bool result = setInt(OS_Daylighting_ControlFields::NumberofSteppedControlSteps, numberofSteppedControlSteps);
269
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
13 OS_ASSERT(result);
270 13 return result;
271 }
272
273 1 void DaylightingControl_Impl::resetNumberofSteppedControlSteps() {
274
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Daylighting_ControlFields::NumberofSteppedControlSteps, "");
275
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
276 1 }
277
278 18 bool DaylightingControl_Impl::setProbabilityLightingwillbeResetWhenNeededinManualSteppedControl(
279 double probabilityLightingwillbeResetWhenNeededinManualSteppedControl) {
280 18 bool result = setDouble(OS_Daylighting_ControlFields::ProbabilityLightingwillbeResetWhenNeededinManualSteppedControl,
281 probabilityLightingwillbeResetWhenNeededinManualSteppedControl);
282 18 return result;
283 }
284
285 1 void DaylightingControl_Impl::resetProbabilityLightingwillbeResetWhenNeededinManualSteppedControl() {
286
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Daylighting_ControlFields::ProbabilityLightingwillbeResetWhenNeededinManualSteppedControl, "");
287
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
288 1 }
289
290 4 bool DaylightingControl_Impl::setNumberofDaylightingViews(int numberofDaylightingViews) {
291 4 bool result = setInt(OS_Daylighting_ControlFields::NumberofDaylightingViews, numberofDaylightingViews);
292 4 return result;
293 }
294
295 1 void DaylightingControl_Impl::resetNumberofDaylightingViews() {
296
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Daylighting_ControlFields::NumberofDaylightingViews, "");
297
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
298 1 }
299
300 18 bool DaylightingControl_Impl::setMaximumAllowableDiscomfortGlareIndex(boost::optional<double> maximumAllowableDiscomfortGlareIndex) {
301 18 bool result = false;
302
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 if (maximumAllowableDiscomfortGlareIndex) {
303 18 result = setDouble(OS_Daylighting_ControlFields::MaximumAllowableDiscomfortGlareIndex, maximumAllowableDiscomfortGlareIndex.get());
304 } else {
305 ✗ result = setString(OS_Daylighting_ControlFields::MaximumAllowableDiscomfortGlareIndex, "");
306 }
307 18 return result;
308 }
309
310 ✗ void DaylightingControl_Impl::resetMaximumAllowableDiscomfortGlareIndex() {
311 ✗ bool result = setString(OS_Daylighting_ControlFields::MaximumAllowableDiscomfortGlareIndex, "");
312 ✗ OS_ASSERT(result);
313 ✗ }
314
315 345 Point3d DaylightingControl_Impl::position() const {
316 345 Point3d result(this->positionXCoordinate(), this->positionYCoordinate(), this->positionZCoordinate());
317 345 return result;
318 }
319
320 182 bool DaylightingControl_Impl::setPosition(const Point3d& position) {
321 182 this->setPositionXCoordinate(position.x());
322 182 this->setPositionYCoordinate(position.y());
323 182 this->setPositionZCoordinate(position.z());
324 182 return true;
325 }
326
327 63 openstudio::Transformation DaylightingControl_Impl::transformation() const {
328
4/4
✓ Branch 1 taken 63 times.
✓ Branch 4 taken 63 times.
✓ Branch 7 taken 63 times.
✓ Branch 10 taken 63 times.
63 Vector3d origin(this->positionXCoordinate(), this->positionYCoordinate(), this->positionZCoordinate());
329
330 EulerAngles angles(degToRad(this->psiRotationAroundXAxis()), degToRad(this->thetaRotationAroundYAxis()),
331
7/7
✓ Branch 1 taken 63 times.
✓ Branch 4 taken 63 times.
✓ Branch 7 taken 63 times.
✓ Branch 10 taken 63 times.
✓ Branch 13 taken 63 times.
✓ Branch 16 taken 63 times.
✓ Branch 19 taken 63 times.
63 degToRad(this->phiRotationAroundZAxis()));
332
333
3/3
✓ Branch 1 taken 63 times.
✓ Branch 4 taken 63 times.
✓ Branch 7 taken 63 times.
63 Transformation result = Transformation::translation(origin) * Transformation::rotation(angles);
334
335 126 return result;
336 63 }
337
338 53 bool DaylightingControl_Impl::setTransformation(const openstudio::Transformation& transformation) {
339
1/1
✓ Branch 1 taken 53 times.
53 Vector3d translation = transformation.translation();
340
2/2
✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
53 this->setPositionXCoordinate(translation.x());
341
2/2
✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
53 this->setPositionYCoordinate(translation.y());
342
2/2
✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
53 this->setPositionZCoordinate(translation.z());
343
344
1/1
✓ Branch 1 taken 53 times.
53 EulerAngles eulerAngles = transformation.eulerAngles();
345
3/3
✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
✓ Branch 7 taken 53 times.
53 setPsiRotationAroundXAxis(radToDeg(eulerAngles.psi()));
346
3/3
✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
✓ Branch 7 taken 53 times.
53 setThetaRotationAroundYAxis(radToDeg(eulerAngles.theta()));
347
3/3
✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
✓ Branch 7 taken 53 times.
53 setPhiRotationAroundZAxis(radToDeg(eulerAngles.phi()));
348
349 53 return true;
350 53 }
351
352 7 bool DaylightingControl_Impl::isPrimaryDaylightingControl() const {
353 7 bool result = false;
354
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 std::vector<WorkspaceObject> workspaceObjects = this->getSources(IddObjectType::OS_ThermalZone);
355
2/2
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 2 times.
7 if (!workspaceObjects.empty()) {
356
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
5 OS_ASSERT(workspaceObjects.size() == 1);
357
2/2
✓ Branch 2 taken 5 times.
✓ Branch 5 taken 5 times.
5 boost::optional<DaylightingControl> control = workspaceObjects[0].cast<ThermalZone>().primaryDaylightingControl();
358
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 if (control) {
359
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
5 result = (this->handle() == control->handle());
360 }
361 5 }
362 7 return result;
363 7 }
364
365 2 bool DaylightingControl_Impl::isSecondaryDaylightingControl() const {
366 2 bool result = false;
367
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 std::vector<WorkspaceObject> workspaceObjects = this->getSources(IddObjectType::OS_ThermalZone);
368
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
2 if (!workspaceObjects.empty()) {
369 ✗ OS_ASSERT(workspaceObjects.size() == 1);
370 ✗ boost::optional<DaylightingControl> control = workspaceObjects[0].cast<ThermalZone>().secondaryDaylightingControl();
371 ✗ if (control) {
372 ✗ result = (this->handle() == control->handle());
373 }
374 ✗ }
375 2 return result;
376 2 }
377
378 5 bool DaylightingControl_Impl::aimAt(const Point3d& target) {
379
1/1
✓ Branch 1 taken 5 times.
5 Point3d position = this->position();
380
1/1
✓ Branch 1 taken 5 times.
5 Vector3d vector = target - position;
381
382
2/3
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
5 if (!vector.normalize()) {
383 ✗ return false;
384 }
385
386
1/1
✓ Branch 1 taken 5 times.
5 Vector3d yAxis(0, 1, 0);
387
1/1
✓ Branch 1 taken 5 times.
5 Vector3d rotationAxis = yAxis.cross(vector);
388
389
2/3
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
5 if (!rotationAxis.normalize()) {
390 ✗ return false;
391 }
392
393
1/1
✓ Branch 1 taken 5 times.
5 double angle = getAngle(yAxis, vector);
394
1/1
✓ Branch 1 taken 5 times.
5 Transformation transformation = Transformation::rotation(rotationAxis, angle);
395
1/1
✓ Branch 1 taken 5 times.
5 EulerAngles eulerAngles = transformation.eulerAngles();
396
397
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 this->setPsiRotationAroundXAxis(radToDeg(eulerAngles.psi()));
398
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 this->setThetaRotationAroundYAxis(radToDeg(eulerAngles.theta()));
399
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 this->setPhiRotationAroundZAxis(radToDeg(eulerAngles.phi()));
400
401 5 return true;
402 5 }
403
404 347 int DaylightingControl_Impl::spaceIndex() const {
405 347 return OS_Daylighting_ControlFields::SpaceName;
406 }
407
408 } // namespace detail
409
410 241 DaylightingControl::DaylightingControl(const Model& model) : SpaceItem(DaylightingControl::iddObjectType(), model) {
411
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 241 times.
✗ Branch 5 not taken.
241 OS_ASSERT(getImpl<detail::DaylightingControl_Impl>());
412 241 }
413
414 51292 IddObjectType DaylightingControl::iddObjectType() {
415
1/1
✓ Branch 1 taken 51292 times.
51292 IddObjectType result(IddObjectType::OS_Daylighting_Control);
416 51292 return result;
417 }
418
419 ✗ std::vector<std::string> DaylightingControl::validLightingControlTypeValues() {
420 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Daylighting_ControlFields::LightingControlType);
421 }
422
423 75 double DaylightingControl::positionXCoordinate() const {
424
1/1
✓ Branch 3 taken 75 times.
75 return getImpl<detail::DaylightingControl_Impl>()->positionXCoordinate();
425 }
426
427 75 double DaylightingControl::positionYCoordinate() const {
428
1/1
✓ Branch 3 taken 75 times.
75 return getImpl<detail::DaylightingControl_Impl>()->positionYCoordinate();
429 }
430
431 86 double DaylightingControl::positionZCoordinate() const {
432
1/1
✓ Branch 3 taken 86 times.
86 return getImpl<detail::DaylightingControl_Impl>()->positionZCoordinate();
433 }
434
435 72 double DaylightingControl::psiRotationAroundXAxis() const {
436
1/1
✓ Branch 3 taken 72 times.
72 return getImpl<detail::DaylightingControl_Impl>()->psiRotationAroundXAxis();
437 }
438
439 3 bool DaylightingControl::isPsiRotationAroundXAxisDefaulted() const {
440
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::DaylightingControl_Impl>()->isPsiRotationAroundXAxisDefaulted();
441 }
442
443 76 double DaylightingControl::thetaRotationAroundYAxis() const {
444
1/1
✓ Branch 3 taken 76 times.
76 return getImpl<detail::DaylightingControl_Impl>()->thetaRotationAroundYAxis();
445 }
446
447 3 bool DaylightingControl::isThetaRotationAroundYAxisDefaulted() const {
448
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::DaylightingControl_Impl>()->isThetaRotationAroundYAxisDefaulted();
449 }
450
451 77 double DaylightingControl::phiRotationAroundZAxis() const {
452
1/1
✓ Branch 3 taken 77 times.
77 return getImpl<detail::DaylightingControl_Impl>()->phiRotationAroundZAxis();
453 }
454
455 3 bool DaylightingControl::isPhiRotationAroundZAxisDefaulted() const {
456
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::DaylightingControl_Impl>()->isPhiRotationAroundZAxisDefaulted();
457 }
458
459 92 double DaylightingControl::illuminanceSetpoint() const {
460
1/1
✓ Branch 3 taken 92 times.
92 return getImpl<detail::DaylightingControl_Impl>()->illuminanceSetpoint();
461 }
462
463 5 bool DaylightingControl::isIlluminanceSetpointDefaulted() const {
464
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::DaylightingControl_Impl>()->isIlluminanceSetpointDefaulted();
465 }
466
467 139 std::string DaylightingControl::lightingControlType() const {
468
1/1
✓ Branch 3 taken 139 times.
139 return getImpl<detail::DaylightingControl_Impl>()->lightingControlType();
469 }
470
471 3 bool DaylightingControl::isLightingControlTypeDefaulted() const {
472
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::DaylightingControl_Impl>()->isLightingControlTypeDefaulted();
473 }
474
475 67 double DaylightingControl::minimumInputPowerFractionforContinuousDimmingControl() const {
476
1/1
✓ Branch 3 taken 67 times.
67 return getImpl<detail::DaylightingControl_Impl>()->minimumInputPowerFractionforContinuousDimmingControl();
477 }
478
479 3 bool DaylightingControl::isMinimumInputPowerFractionforContinuousDimmingControlDefaulted() const {
480
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::DaylightingControl_Impl>()->isMinimumInputPowerFractionforContinuousDimmingControlDefaulted();
481 }
482
483 67 double DaylightingControl::minimumLightOutputFractionforContinuousDimmingControl() const {
484
1/1
✓ Branch 3 taken 67 times.
67 return getImpl<detail::DaylightingControl_Impl>()->minimumLightOutputFractionforContinuousDimmingControl();
485 }
486
487 3 bool DaylightingControl::isMinimumLightOutputFractionforContinuousDimmingControlDefaulted() const {
488
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::DaylightingControl_Impl>()->isMinimumLightOutputFractionforContinuousDimmingControlDefaulted();
489 }
490
491 66 int DaylightingControl::numberofSteppedControlSteps() const {
492
1/1
✓ Branch 3 taken 66 times.
66 return getImpl<detail::DaylightingControl_Impl>()->numberofSteppedControlSteps();
493 }
494
495 3 bool DaylightingControl::isNumberofSteppedControlStepsDefaulted() const {
496
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::DaylightingControl_Impl>()->isNumberofSteppedControlStepsDefaulted();
497 }
498
499 67 double DaylightingControl::probabilityLightingwillbeResetWhenNeededinManualSteppedControl() const {
500
1/1
✓ Branch 3 taken 67 times.
67 return getImpl<detail::DaylightingControl_Impl>()->probabilityLightingwillbeResetWhenNeededinManualSteppedControl();
501 }
502
503 3 bool DaylightingControl::isProbabilityLightingwillbeResetWhenNeededinManualSteppedControlDefaulted() const {
504
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::DaylightingControl_Impl>()->isProbabilityLightingwillbeResetWhenNeededinManualSteppedControlDefaulted();
505 }
506
507 4 int DaylightingControl::numberofDaylightingViews() const {
508
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::DaylightingControl_Impl>()->numberofDaylightingViews();
509 }
510
511 2 bool DaylightingControl::isNumberofDaylightingViewsDefaulted() const {
512
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::DaylightingControl_Impl>()->isNumberofDaylightingViewsDefaulted();
513 }
514
515 68 boost::optional<double> DaylightingControl::maximumAllowableDiscomfortGlareIndex() const {
516
1/1
✓ Branch 3 taken 68 times.
68 return getImpl<detail::DaylightingControl_Impl>()->maximumAllowableDiscomfortGlareIndex();
517 }
518
519 50 bool DaylightingControl::setPositionXCoordinate(double positionXCoordinate) {
520
1/1
✓ Branch 3 taken 50 times.
50 return getImpl<detail::DaylightingControl_Impl>()->setPositionXCoordinate(positionXCoordinate);
521 }
522
523 50 bool DaylightingControl::setPositionYCoordinate(double positionYCoordinate) {
524
1/1
✓ Branch 3 taken 50 times.
50 return getImpl<detail::DaylightingControl_Impl>()->setPositionYCoordinate(positionYCoordinate);
525 }
526
527 50 bool DaylightingControl::setPositionZCoordinate(double positionZCoordinate) {
528
1/1
✓ Branch 3 taken 50 times.
50 return getImpl<detail::DaylightingControl_Impl>()->setPositionZCoordinate(positionZCoordinate);
529 }
530
531 3 bool DaylightingControl::setPsiRotationAroundXAxis(double psiRotationAroundXAxis) {
532
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::DaylightingControl_Impl>()->setPsiRotationAroundXAxis(psiRotationAroundXAxis);
533 }
534
535 1 void DaylightingControl::resetPsiRotationAroundXAxis() {
536
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::DaylightingControl_Impl>()->resetPsiRotationAroundXAxis();
537 1 }
538
539 4 bool DaylightingControl::setThetaRotationAroundYAxis(double thetaRotationAroundYAxis) {
540
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::DaylightingControl_Impl>()->setThetaRotationAroundYAxis(thetaRotationAroundYAxis);
541 }
542
543 1 void DaylightingControl::resetThetaRotationAroundYAxis() {
544
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::DaylightingControl_Impl>()->resetThetaRotationAroundYAxis();
545 1 }
546
547 21 bool DaylightingControl::setPhiRotationAroundZAxis(double phiRotationAroundZAxis) {
548
1/1
✓ Branch 3 taken 21 times.
21 return getImpl<detail::DaylightingControl_Impl>()->setPhiRotationAroundZAxis(phiRotationAroundZAxis);
549 }
550
551 1 void DaylightingControl::resetPhiRotationAroundZAxis() {
552
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::DaylightingControl_Impl>()->resetPhiRotationAroundZAxis();
553 1 }
554
555 64 bool DaylightingControl::setIlluminanceSetpoint(double illuminanceSetpoint) {
556
1/1
✓ Branch 3 taken 64 times.
64 return getImpl<detail::DaylightingControl_Impl>()->setIlluminanceSetpoint(illuminanceSetpoint);
557 }
558
559 1 void DaylightingControl::resetIlluminanceSetpoint() {
560
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::DaylightingControl_Impl>()->resetIlluminanceSetpoint();
561 1 }
562
563 36 bool DaylightingControl::setLightingControlType(const std::string& lightingControlType) {
564
1/1
✓ Branch 3 taken 36 times.
36 return getImpl<detail::DaylightingControl_Impl>()->setLightingControlType(lightingControlType);
565 }
566
567 1 void DaylightingControl::resetLightingControlType() {
568
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::DaylightingControl_Impl>()->resetLightingControlType();
569 1 }
570
571 34 bool DaylightingControl::setMinimumInputPowerFractionforContinuousDimmingControl(double minimumInputPowerFractionforContinuousDimmingControl) {
572
1/1
✓ Branch 3 taken 34 times.
68 return getImpl<detail::DaylightingControl_Impl>()->setMinimumInputPowerFractionforContinuousDimmingControl(
573 68 minimumInputPowerFractionforContinuousDimmingControl);
574 }
575
576 1 void DaylightingControl::resetMinimumInputPowerFractionforContinuousDimmingControl() {
577
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::DaylightingControl_Impl>()->resetMinimumInputPowerFractionforContinuousDimmingControl();
578 1 }
579
580 34 bool DaylightingControl::setMinimumLightOutputFractionforContinuousDimmingControl(double minimumLightOutputFractionforContinuousDimmingControl) {
581
1/1
✓ Branch 3 taken 34 times.
68 return getImpl<detail::DaylightingControl_Impl>()->setMinimumLightOutputFractionforContinuousDimmingControl(
582 68 minimumLightOutputFractionforContinuousDimmingControl);
583 }
584
585 1 void DaylightingControl::resetMinimumLightOutputFractionforContinuousDimmingControl() {
586
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::DaylightingControl_Impl>()->resetMinimumLightOutputFractionforContinuousDimmingControl();
587 1 }
588
589 13 bool DaylightingControl::setNumberofSteppedControlSteps(int numberofSteppedControlSteps) {
590
1/1
✓ Branch 3 taken 13 times.
13 return getImpl<detail::DaylightingControl_Impl>()->setNumberofSteppedControlSteps(numberofSteppedControlSteps);
591 }
592
593 1 void DaylightingControl::resetNumberofSteppedControlSteps() {
594
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::DaylightingControl_Impl>()->resetNumberofSteppedControlSteps();
595 1 }
596
597 18 bool DaylightingControl::setProbabilityLightingwillbeResetWhenNeededinManualSteppedControl(
598 double probabilityLightingwillbeResetWhenNeededinManualSteppedControl) {
599
1/1
✓ Branch 3 taken 18 times.
36 return getImpl<detail::DaylightingControl_Impl>()->setProbabilityLightingwillbeResetWhenNeededinManualSteppedControl(
600 36 probabilityLightingwillbeResetWhenNeededinManualSteppedControl);
601 }
602
603 1 void DaylightingControl::resetProbabilityLightingwillbeResetWhenNeededinManualSteppedControl() {
604
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::DaylightingControl_Impl>()->resetProbabilityLightingwillbeResetWhenNeededinManualSteppedControl();
605 1 }
606
607 4 bool DaylightingControl::setNumberofDaylightingViews(int numberofDaylightingViews) {
608
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::DaylightingControl_Impl>()->setNumberofDaylightingViews(numberofDaylightingViews);
609 }
610
611 1 void DaylightingControl::resetNumberofDaylightingViews() {
612
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::DaylightingControl_Impl>()->resetNumberofDaylightingViews();
613 1 }
614
615 18 bool DaylightingControl::setMaximumAllowableDiscomfortGlareIndex(double maximumAllowableDiscomfortGlareIndex) {
616
2/2
✓ Branch 3 taken 18 times.
✓ Branch 6 taken 18 times.
18 return getImpl<detail::DaylightingControl_Impl>()->setMaximumAllowableDiscomfortGlareIndex(maximumAllowableDiscomfortGlareIndex);
617 }
618
619 ✗ void DaylightingControl::resetMaximumAllowableDiscomfortGlareIndex() {
620 ✗ getImpl<detail::DaylightingControl_Impl>()->resetMaximumAllowableDiscomfortGlareIndex();
621 ✗ }
622
623 340 Point3d DaylightingControl::position() const {
624
1/1
✓ Branch 3 taken 340 times.
340 return getImpl<detail::DaylightingControl_Impl>()->position();
625 }
626
627 182 bool DaylightingControl::setPosition(const Point3d& position) {
628
1/1
✓ Branch 3 taken 182 times.
182 return getImpl<detail::DaylightingControl_Impl>()->setPosition(position);
629 }
630
631 63 openstudio::Transformation DaylightingControl::transformation() const {
632
1/1
✓ Branch 3 taken 63 times.
63 return getImpl<detail::DaylightingControl_Impl>()->transformation();
633 }
634
635 53 bool DaylightingControl::setTransformation(const openstudio::Transformation& transformation) {
636
1/1
✓ Branch 3 taken 53 times.
53 return getImpl<detail::DaylightingControl_Impl>()->setTransformation(transformation);
637 }
638
639 7 bool DaylightingControl::isPrimaryDaylightingControl() const {
640
1/1
✓ Branch 3 taken 7 times.
7 return getImpl<detail::DaylightingControl_Impl>()->isPrimaryDaylightingControl();
641 }
642
643 2 bool DaylightingControl::isSecondaryDaylightingControl() const {
644
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::DaylightingControl_Impl>()->isSecondaryDaylightingControl();
645 }
646
647 5 bool DaylightingControl::aimAt(const Point3d& target) {
648
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::DaylightingControl_Impl>()->aimAt(target);
649 }
650
651 /// @cond
652
1/1
✓ Branch 3 taken 1063 times.
1063 DaylightingControl::DaylightingControl(std::shared_ptr<detail::DaylightingControl_Impl> impl) : SpaceItem(std::move(impl)) {}
653 /// @endcond
654
655 } // namespace model
656 } // namespace openstudio
657