GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 79.5% 833 / 0 / 1048
Functions: 81.7% 147 / 0 / 180
Branches: 63.7% 1030 / 0 / 1617

src/model/SubSurface.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 "SubSurface.hpp"
7 #include "SubSurface_Impl.hpp"
8 #include "ComfortViewFactorAngles.hpp"
9 #include "ComfortViewFactorAngles_Impl.hpp"
10 #include "Model.hpp"
11 #include "Model_Impl.hpp"
12 #include "Surface.hpp"
13 #include "Surface_Impl.hpp"
14 #include "Space.hpp"
15 #include "Space_Impl.hpp"
16 #include "ShadingSurface.hpp"
17 #include "ShadingSurface_Impl.hpp"
18 #include "ShadingSurfaceGroup.hpp"
19 #include "ShadingSurfaceGroup_Impl.hpp"
20 #include "ShadingControl.hpp"
21 #include "ShadingControl_Impl.hpp"
22 #include "ConstructionBase.hpp"
23 #include "ConstructionBase_Impl.hpp"
24 #include "Construction.hpp"
25 #include "Construction_Impl.hpp"
26 #include "DaylightingDeviceShelf.hpp"
27 #include "DaylightingDeviceShelf_Impl.hpp"
28 #include "DaylightingDeviceTubular.hpp"
29 #include "DaylightingDeviceTubular_Impl.hpp"
30 #include "DaylightingDeviceLightWell.hpp"
31 #include "DaylightingDeviceLightWell_Impl.hpp"
32 #include "WindowPropertyFrameAndDivider.hpp"
33 #include "WindowPropertyFrameAndDivider_Impl.hpp"
34 #include "SurfacePropertyOtherSideCoefficients.hpp"
35 #include "SurfacePropertyOtherSideCoefficients_Impl.hpp"
36 #include "SurfacePropertyOtherSideConditionsModel.hpp"
37 #include "SurfacePropertyOtherSideConditionsModel_Impl.hpp"
38 #include "SurfacePropertyConvectionCoefficients.hpp"
39 #include "SurfacePropertyConvectionCoefficients_Impl.hpp"
40 #include "SurfacePropertyLocalEnvironment.hpp"
41 #include "SurfacePropertyLocalEnvironment_Impl.hpp"
42 #include "SurfacePropertyIncidentSolarMultiplier.hpp"
43 #include "SurfacePropertyIncidentSolarMultiplier_Impl.hpp"
44 #include "AirflowNetworkSurface.hpp"
45 #include "AirflowNetworkSurface_Impl.hpp"
46 #include "AirflowNetworkDetailedOpening.hpp"
47 #include "AirflowNetworkDetailedOpening_Impl.hpp"
48 #include "AirflowNetworkCrack.hpp"
49 #include "AirflowNetworkCrack_Impl.hpp"
50 #include "AirflowNetworkSimpleOpening.hpp"
51 #include "AirflowNetworkSimpleOpening_Impl.hpp"
52 #include "AirflowNetworkEffectiveLeakageArea.hpp"
53 #include "AirflowNetworkEffectiveLeakageArea_Impl.hpp"
54 #include "AirflowNetworkHorizontalOpening.hpp"
55 #include "AirflowNetworkHorizontalOpening_Impl.hpp"
56 #include "AirflowNetworkSpecifiedFlowRate.hpp"
57 #include "AirflowNetworkSpecifiedFlowRate_Impl.hpp"
58
59 #include <utilities/idd/IddFactory.hxx>
60
61 #include <utilities/idd/OS_SubSurface_FieldEnums.hxx>
62 #include <utilities/idd/IddEnums.hxx>
63
64 #include "../utilities/sql/SqlFile.hpp"
65
66 #include "../utilities/geometry/Geometry.hpp"
67 #include "../utilities/geometry/Transformation.hpp"
68 #include "../utilities/geometry/Intersection.hpp"
69 #include "../utilities/geometry/BoundingBox.hpp"
70 #include "../utilities/core/Assert.hpp"
71 #include "../utilities/core/DeprecatedHelpers.hpp"
72
73 using boost::to_upper_copy;
74
75 namespace openstudio {
76 namespace model {
77
78 namespace detail {
79
80 6949 SubSurface_Impl::SubSurface_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
81 6949 : PlanarSurface_Impl(idfObject, model, keepHandle) {
82
4/6
✓ Branch 1 taken 6949 times.
✓ Branch 4 taken 6949 times.
✓ Branch 7 taken 6949 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 6949 times.
✗ Branch 13 not taken.
6949 OS_ASSERT(idfObject.iddObject().type() == SubSurface::iddObjectType());
83 6949 }
84
85 3100 SubSurface_Impl::SubSurface_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
86 3100 : PlanarSurface_Impl(other, model, keepHandle) {
87
4/6
✓ Branch 1 taken 3100 times.
✓ Branch 4 taken 3100 times.
✓ Branch 7 taken 3100 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 3100 times.
✗ Branch 13 not taken.
3100 OS_ASSERT(other.iddObject().type() == SubSurface::iddObjectType());
88 3100 }
89
90 1153 SubSurface_Impl::SubSurface_Impl(const SubSurface_Impl& other, Model_Impl* model, bool keepHandle)
91 1153 : PlanarSurface_Impl(other, model, keepHandle) {}
92
93 160 boost::optional<ParentObject> SubSurface_Impl::parent() const {
94
2/2
✓ Branch 1 taken 160 times.
✓ Branch 4 taken 160 times.
160 return boost::optional<ParentObject>(this->surface());
95 }
96
97 157 bool SubSurface_Impl::setParent(ParentObject& newParent) {
98 157 bool result = false;
99
2/3
✓ Branch 1 taken 157 times.
✓ Branch 4 taken 157 times.
✗ Branch 5 not taken.
314 if (newParent.optionalCast<Surface>()) {
100
2/2
✓ Branch 1 taken 157 times.
✓ Branch 4 taken 157 times.
157 result = this->setSurface(newParent.cast<Surface>());
101 }
102 157 return result;
103 }
104
105 2208 std::vector<ModelObject> SubSurface_Impl::children() const {
106 2208 std::vector<ModelObject> result;
107
1/1
✓ Branch 1 taken 2208 times.
2208 boost::optional<DaylightingDeviceShelf> daylightingDeviceShelf = this->daylightingDeviceShelf();
108
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2206 times.
2208 if (daylightingDeviceShelf) {
109
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 result.push_back(*daylightingDeviceShelf);
110 }
111
1/1
✓ Branch 1 taken 2208 times.
2208 boost::optional<DaylightingDeviceTubular> daylightingDeviceTubular = this->daylightingDeviceTubular();
112
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2206 times.
2208 if (daylightingDeviceTubular) {
113
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 result.push_back(*daylightingDeviceTubular);
114 }
115
1/1
✓ Branch 1 taken 2208 times.
2208 boost::optional<DaylightingDeviceLightWell> daylightingDeviceLightWell = this->daylightingDeviceLightWell();
116
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2207 times.
2208 if (daylightingDeviceLightWell) {
117
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 result.push_back(*daylightingDeviceLightWell);
118 }
119 std::vector<AirflowNetworkSurface> myAFNItems =
120
3/3
✓ Branch 1 taken 2208 times.
✓ Branch 4 taken 2208 times.
✓ Branch 7 taken 2208 times.
2208 getObject<ModelObject>().getModelObjectSources<AirflowNetworkSurface>(AirflowNetworkSurface::iddObjectType());
121
1/1
✓ Branch 5 taken 2208 times.
2208 result.insert(result.end(), myAFNItems.begin(), myAFNItems.end());
122
123 4416 return result;
124 2208 }
125
126 498 std::vector<IdfObject> SubSurface_Impl::remove() {
127
1/1
✓ Branch 1 taken 498 times.
498 boost::optional<SubSurface> adjacentSubSurface = this->adjacentSubSurface();
128
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 498 times.
498 if (adjacentSubSurface) {
129 ✗ this->resetAdjacentSubSurface();
130 }
131
132
1/1
✓ Branch 1 taken 498 times.
498 SubSurface subSurface = getObject<SubSurface>();
133
3/3
✓ Branch 1 taken 498 times.
✓ Branch 8 taken 1 time.
✓ Branch 9 taken 498 times.
499 for (ComfortViewFactorAngles& comfortViewFactorAngles : subSurface.getModelObjectSources<ComfortViewFactorAngles>()) {
134
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (boost::optional<unsigned> index = comfortViewFactorAngles.angleFactorIndex(subSurface)) {
135
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 comfortViewFactorAngles.removeAngleFactor(index.get());
136 }
137 498 }
138
139 // Remove it from the extensible groups in ShadingControl(s)
140
3/3
✓ Branch 1 taken 498 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 498 times.
499 for (auto& sc : shadingControls()) {
141
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 sc.removeSubSurface(this->getObject<SubSurface>());
142 498 }
143
144
1/1
✓ Branch 1 taken 498 times.
996 return ParentObject_Impl::remove();
145 498 }
146
147 158 ModelObject SubSurface_Impl::clone(Model model) const {
148
3/3
✓ Branch 1 taken 158 times.
✓ Branch 4 taken 158 times.
✓ Branch 7 taken 158 times.
158 auto clone = ParentObject_Impl::clone(model).cast<SubSurface>();
149
150
1/1
✓ Branch 1 taken 158 times.
158 auto coefficients = surfacePropertyConvectionCoefficients();
151
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 157 times.
158 if (coefficients) {
152
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 auto coefficientsClone = coefficients->clone(model).cast<SurfacePropertyConvectionCoefficients>();
153
1/1
✓ Branch 1 taken 1 time.
1 coefficientsClone.setSurface(clone);
154 1 }
155
156
1/1
✓ Branch 1 taken 158 times.
158 auto controls = shadingControls();
157
2/2
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 158 times.
159 for (const auto& sc : controls) {
158
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 auto shadingConrolClone = sc.clone(model).cast<ShadingControl>();
159
1/1
✓ Branch 1 taken 1 time.
1 clone.addShadingControl(shadingConrolClone);
160 1 }
161
162 316 return std::move(clone);
163 158 }
164
165 2 const std::vector<std::string>& SubSurface_Impl::outputVariableNames() const {
166 static const std::vector<std::string> result{
167 // Face temperatures and convection
168 "Surface Inside Face Temperature",
169 "Surface Inside Face Interior Movable Insulation Temperature",
170 "Surface Outside Face Temperature",
171 "Surface Inside Face Adjacent Air Temperature",
172 "Surface Inside Face Convection Heat Transfer Coefficient",
173 "Surface Inside Face Convection Heat Gain Rate",
174 "Surface Inside Face Convection Heat Gain Rate per Area",
175 "Surface Inside Face Convection Heat Gain Energy",
176 "Surface Outside Face Convection Heat Transfer Coefficient",
177 "Surface Outside Face Convection Heat Gain Rate",
178 "Surface Outside Face Convection Heat Gain Rate per Area",
179 "Surface Outside Face Convection Heat Gain Energy",
180 // Thermal (longwave) radiation exchange
181 "Surface Inside Face Net Surface Thermal Radiation Heat Gain Rate",
182 "Surface Inside Face Net Surface Thermal Radiation Heat Gain Rate per Area",
183 "Surface Inside Face Net Surface Thermal Radiation Heat Gain Energy",
184 "Surface Outside Face Net Thermal Radiation Heat Gain Rate",
185 "Surface Outside Face Net Thermal Radiation Heat Gain Rate per Area",
186 "Surface Outside Face Net Thermal Radiation Heat Gain Energy",
187 "Surface Outside Face Thermal Radiation to Air Heat Transfer Coefficient",
188 "Surface Outside Face Thermal Radiation to Air Heat Transfer Rate",
189 "Surface Outside Face Thermal Radiation to Sky Heat Transfer Coefficient",
190 "Surface Outside Face Thermal Radiation to Ground Heat Transfer Coefficient",
191 "Surface Outside Face Thermal Radiation to Surrounding Surfaces Heat Transfer Coefficient",
192 "Surface Outside Face Surrounding Surfaces Average Temperature",
193 "Surface Outside Face Heat Emission to Air Rate",
194 // Solar and internal-gains radiation absorbed/transmitted at this surface
195 "Surface Inside Face Solar Radiation Heat Gain Rate",
196 "Surface Inside Face Solar Radiation Heat Gain Rate per Area",
197 "Surface Inside Face Solar Radiation Heat Gain Energy",
198 "Surface Inside Face Beam Solar Radiation Heat Gain Rate",
199 "Surface Inside Face Absorbed Shortwave Radiation Rate",
200 "Surface Inside Face Lights Radiation Heat Gain Rate",
201 "Surface Inside Face Lights Radiation Heat Gain Rate per Area",
202 "Surface Inside Face Lights Radiation Heat Gain Energy",
203 "Surface Inside Face Internal Gains Radiation Heat Gain Rate",
204 "Surface Inside Face Internal Gains Radiation Heat Gain Rate per Area",
205 "Surface Inside Face Internal Gains Radiation Heat Gain Energy",
206 "Surface Inside Face System Radiation Heat Gain Rate",
207 "Surface Inside Face System Radiation Heat Gain Rate per Area",
208 "Surface Inside Face System Radiation Heat Gain Energy",
209 "Surface Inside Face Exterior Windows Incident Beam Solar Radiation Rate",
210 "Surface Inside Face Exterior Windows Incident Beam Solar Radiation Rate per Area",
211 "Surface Inside Face Exterior Windows Incident Beam Solar Radiation Energy",
212 "Surface Inside Face Interior Windows Incident Beam Solar Radiation Rate",
213 "Surface Inside Face Interior Windows Incident Beam Solar Radiation Rate per Area",
214 "Surface Inside Face Interior Windows Incident Beam Solar Radiation Energy",
215 "Surface Inside Face Initial Transmitted Diffuse Absorbed Solar Radiation Rate",
216 "Surface Inside Face Initial Transmitted Diffuse Transmitted Out Window Solar Radiation Rate",
217 "Surface Outside Face Solar Radiation Heat Gain Rate",
218 "Surface Outside Face Solar Radiation Heat Gain Rate per Area",
219 "Surface Outside Face Solar Radiation Heat Gain Energy",
220 "Surface Outside Face Incident Solar Radiation Rate per Area",
221 "Surface Outside Face Incident Beam Solar Radiation Rate per Area",
222 "Surface Outside Face Incident Sky Diffuse Solar Radiation Rate per Area",
223 "Surface Outside Face Incident Ground Diffuse Solar Radiation Rate per Area",
224 "Surface Outside Face Incident Sky Diffuse Ground Reflected Solar Radiation Rate per Area",
225 "Surface Outside Face Incident Sky Diffuse Surface Reflected Solar Radiation Rate per Area",
226 "Surface Outside Face Incident Beam To Beam Surface Reflected Solar Radiation Rate per Area",
227 "Surface Outside Face Incident Beam To Diffuse Surface Reflected Solar Radiation Rate per Area",
228 "Surface Outside Face Incident Beam To Diffuse Ground Reflected Solar Radiation Rate per Area",
229 "Surface Outside Face Beam Solar Incident Angle Cosine Value",
230 "Surface Anisotropic Sky Multiplier",
231 "Surface Outside Face Sunlit Area",
232 "Surface Outside Face Sunlit Fraction",
233 // Conduction and heat storage (applicable to opaque doors)
234 "Surface Inside Face Conduction Heat Transfer Rate",
235 "Surface Inside Face Conduction Heat Gain Rate",
236 "Surface Inside Face Conduction Heat Loss Rate",
237 "Surface Inside Face Conduction Heat Transfer Rate per Area",
238 "Surface Inside Face Conduction Heat Transfer Energy",
239 "Surface Outside Face Conduction Heat Transfer Rate",
240 "Surface Outside Face Conduction Heat Gain Rate",
241 "Surface Outside Face Conduction Heat Loss Rate",
242 "Surface Outside Face Conduction Heat Transfer Rate per Area",
243 "Surface Outside Face Conduction Heat Transfer Energy",
244 "Surface Average Face Conduction Heat Transfer Rate",
245 "Surface Average Face Conduction Heat Gain Rate",
246 "Surface Average Face Conduction Heat Loss Rate",
247 "Surface Average Face Conduction Heat Transfer Rate per Area",
248 "Surface Average Face Conduction Heat Transfer Energy",
249 "Surface Heat Storage Rate",
250 "Surface Heat Storage Gain Rate",
251 "Surface Heat Storage Loss Rate",
252 "Surface Heat Storage Rate per Area",
253 "Surface Heat Storage Energy",
254 "Surface Thermal Absorptance",
255 "Surface Solar Absorptance",
256 // Exterior environment conditions
257 "Surface Outside Face Outdoor Air Drybulb Temperature",
258 "Surface Outside Face Outdoor Air Wetbulb Temperature",
259 "Surface Outside Face Outdoor Air Wind Speed",
260 "Surface Outside Face Outdoor Air Wind Direction",
261 // Window-specific: heat transfer, transmitted/absorbed solar, glazing, frame, divider, blind, screen, shading device
262 "Surface Window Heat Gain Rate",
263 "Surface Window Heat Gain Energy",
264 "Surface Window Heat Loss Rate",
265 "Surface Window Heat Loss Energy",
266 "Surface Window Net Heat Transfer Rate",
267 "Surface Window Net Heat Transfer Energy",
268 "Surface Window Transmitted Solar Radiation Rate",
269 "Surface Window Transmitted Solar Radiation Energy",
270 "Surface Window Transmitted Beam Solar Radiation Rate",
271 "Surface Window Transmitted Beam Solar Radiation Energy",
272 "Surface Window Transmitted Beam To Beam Solar Radiation Rate",
273 "Surface Window Transmitted Beam To Beam Solar Radiation Energy",
274 "Surface Window Transmitted Beam To Diffuse Solar Radiation Rate",
275 "Surface Window Transmitted Beam To Diffuse Solar Radiation Energy",
276 "Surface Window Transmitted Diffuse Solar Radiation Rate",
277 "Surface Window Transmitted Diffuse Solar Radiation Energy",
278 "Surface Window Total Glazing Layers Absorbed Solar Radiation Rate",
279 "Surface Window Total Glazing Layers Absorbed Solar Radiation Energy",
280 "Surface Window Total Glazing Layers Absorbed Shortwave Radiation Rate",
281 "Surface Window Total Absorbed Shortwave Radiation Rate Layer 1",
282 "Surface Window System Solar Transmittance",
283 "Surface Window System Solar Absorptance",
284 "Surface Window System Solar Reflectance",
285 "Surface Window Glazing Beam to Beam Solar Transmittance",
286 "Surface Window Glazing Beam to Diffuse Solar Transmittance",
287 "Surface Window Glazing Diffuse to Diffuse Solar Transmittance",
288 "Surface Window Front Face Temperature Layer 1",
289 "Surface Window Back Face Temperature Layer 1",
290 "Surface Window Gap Convective Heat Transfer Rate",
291 "Surface Window Gap Convective Heat Transfer Energy",
292 "Surface Window Model Solver Iteration Count",
293 "Surface Window BSDF Beam Direction Number",
294 "Surface Window BSDF Beam Theta Angle",
295 "Surface Window BSDF Beam Phi Angle",
296 "Surface Window Solar Horizontal Profile Angle",
297 "Surface Window Solar Vertical Profile Angle",
298 "Surface Window Outside Reveal Reflected Beam Solar Radiation Rate",
299 "Surface Window Outside Reveal Reflected Beam Solar Radiation Energy",
300 "Surface Window Inside Reveal Reflected Beam Solar Radiation Rate",
301 "Surface Window Inside Reveal Reflected Beam Solar Radiation Energy",
302 "Surface Window Inside Reveal Absorbed Beam Solar Radiation Rate",
303 "Surface Window Inside Face Glazing Condensation Status",
304 "Surface Window Inside Face Frame Condensation Status",
305 "Surface Window Inside Face Divider Condensation Status",
306 "Surface Shading Device Is On Time Fraction",
307 "Surface Window Shading Device Absorbed Solar Radiation Rate",
308 "Surface Window Shading Device Absorbed Solar Radiation Energy",
309 "Surface Storm Window On Off Status",
310 "Surface Window Blind Slat Angle",
311 "Surface Window Blind Beam to Beam Solar Transmittance",
312 "Surface Window Blind Beam to Diffuse Solar Transmittance",
313 "Surface Window Blind Diffuse to Diffuse Solar Transmittance",
314 "Surface Window Blind and Glazing System Beam Solar Transmittance",
315 "Surface Window Blind and Glazing System Diffuse Solar Transmittance",
316 "Surface Window Screen Beam to Beam Solar Transmittance",
317 "Surface Window Screen Beam to Diffuse Solar Transmittance",
318 "Surface Window Screen Diffuse to Diffuse Solar Transmittance",
319 "Surface Window Screen and Glazing System Beam Solar Transmittance",
320 "Surface Window Screen and Glazing System Diffuse Solar Transmittance",
321 "Surface Window Frame Heat Gain Rate",
322 "Surface Window Frame Heat Loss Rate",
323 "Surface Window Frame Inside Temperature",
324 "Surface Window Frame Outside Temperature",
325 "Surface Window Divider Heat Gain Rate",
326 "Surface Window Divider Heat Loss Rate",
327 "Surface Window Divider Inside Temperature",
328 "Surface Window Divider Outside Temperature",
329 // Daylighting
330 "Daylighting Window Reference Point 1 View Luminance",
331 "Daylighting Window Reference Point 1 Illuminance",
332 "Daylighting Window Reference Point 2 View Luminance",
333 "Daylighting Window Reference Point 2 Illuminance",
334
335 // Advanced Variables available only if Output:Diagnostics 'DisplayAdvancedReportVariables' is on
336 "Surface Construction Index",
337 "Surface Window Inside Face Frame and Divider Zone Heat Gain Rate",
338 "Surface Window Inside Face Glazing Zone Convection Heat Gain Rate",
339 "Surface Window Inside Face Glazing Net Infrared Heat Transfer Rate",
340 "Surface Window Inside Face Shade Zone Convection Heat Gain Rate",
341 "Surface Window Inside Face Shade Net Infrared Heat Transfer Rate",
342 "Surface Window Inside Face Gap between Shade and Glazing Zone Convection Heat Gain Rate",
343 "Surface Window Inside Face Other Convection Heat Gain Rate",
344 "Surface Window Shortwave from Zone Back Out Window Heat Transfer Rate",
345
6/11
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 time.
✓ Branch 10 taken 169 times.
✓ Branch 11 taken 1 time.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
173 };
346 2 return result;
347 3 }
348
349 36 IddObjectType SubSurface_Impl::iddObjectType() const {
350 36 return SubSurface::iddObjectType();
351 }
352
353 5038 boost::optional<ConstructionBase> SubSurface_Impl::construction() const {
354 // DLM: there is duplicate code in ForwardTranslator::resolveMatchedSubSurfaceConstructionConflicts
355 // if you update this code you must update that code
356
357 // DLM: I am not sure we should be doing this here at all, maybe this method should just
358 // return the same thing constructionWithSearchDistance does?
359
360
1/1
✓ Branch 1 taken 5038 times.
5038 boost::optional<std::pair<ConstructionBase, int>> constructionWithSearchDistance = this->constructionWithSearchDistance();
361
362
1/1
✓ Branch 1 taken 5038 times.
5038 model::OptionalSubSurface adjacentSubSurface = this->adjacentSubSurface();
363
2/2
✓ Branch 1 taken 4750 times.
✓ Branch 2 taken 288 times.
5038 if (!adjacentSubSurface) {
364
2/2
✓ Branch 0 taken 4171 times.
✓ Branch 1 taken 579 times.
4750 if (constructionWithSearchDistance) {
365
2/2
✓ Branch 1 taken 4171 times.
✓ Branch 4 taken 4171 times.
4171 return constructionWithSearchDistance->first;
366 }
367 579 return boost::none;
368 }
369
370 boost::optional<std::pair<model::ConstructionBase, int>> adjacentConstructionWithSearchDistance =
371
2/2
✓ Branch 1 taken 288 times.
✓ Branch 4 taken 288 times.
288 adjacentSubSurface->constructionWithSearchDistance();
372
373
6/6
✓ Branch 0 taken 180 times.
✓ Branch 1 taken 108 times.
✓ Branch 3 taken 90 times.
✓ Branch 4 taken 90 times.
✓ Branch 5 taken 90 times.
✓ Branch 6 taken 198 times.
288 if (constructionWithSearchDistance && !adjacentConstructionWithSearchDistance) {
374 // return this construction
375
2/2
✓ Branch 1 taken 90 times.
✓ Branch 4 taken 90 times.
90 return constructionWithSearchDistance->first;
376 }
377
378
6/6
✓ Branch 1 taken 108 times.
✓ Branch 2 taken 90 times.
✓ Branch 3 taken 38 times.
✓ Branch 4 taken 70 times.
✓ Branch 5 taken 38 times.
✓ Branch 6 taken 160 times.
306 if (!constructionWithSearchDistance && adjacentConstructionWithSearchDistance) {
379 // return adjacent construction
380
2/2
✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
38 return adjacentConstructionWithSearchDistance->first;
381 }
382
383
5/6
✓ Branch 1 taken 70 times.
✓ Branch 2 taken 90 times.
✓ Branch 4 taken 70 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 70 times.
✓ Branch 7 taken 90 times.
160 if (!constructionWithSearchDistance && !adjacentConstructionWithSearchDistance) {
384 // no constructions, nothing to be done
385 70 return boost::none;
386 }
387
388 // both surfaces return a construction
389
390
6/7
✓ Branch 1 taken 90 times.
✓ Branch 4 taken 90 times.
✓ Branch 7 taken 90 times.
✓ Branch 10 taken 90 times.
✓ Branch 13 taken 90 times.
✓ Branch 15 taken 90 times.
✗ Branch 16 not taken.
90 if (constructionWithSearchDistance->first.handle() == adjacentConstructionWithSearchDistance->first.handle()) {
391 // both surfaces have same construction
392
2/2
✓ Branch 1 taken 90 times.
✓ Branch 4 taken 90 times.
90 return constructionWithSearchDistance->first;
393 }
394
395 // both surfaces return a construction and they are not the same
396
397 ✗ if (constructionWithSearchDistance->second < adjacentConstructionWithSearchDistance->second) {
398 // lower search distance to construction
399 ✗ return constructionWithSearchDistance->first;
400 }
401
402 ✗ if (constructionWithSearchDistance->second > adjacentConstructionWithSearchDistance->second) {
403 // lower search distance to adjacent construction
404 ✗ return adjacentConstructionWithSearchDistance->first;
405 }
406
407 // both surfaces return a construction, they are not the same, and both have same search distance
408
409 ✗ if (constructionWithSearchDistance->first.optionalCast<model::LayeredConstruction>()
410 ✗ && adjacentConstructionWithSearchDistance->first.optionalCast<model::LayeredConstruction>()) {
411 ✗ if (constructionWithSearchDistance->first.cast<model::LayeredConstruction>().reverseEqualLayers(
412 ✗ adjacentConstructionWithSearchDistance->first.cast<model::LayeredConstruction>())) {
413 // these constructions are reverse equal
414 ✗ return constructionWithSearchDistance->first;
415 }
416 }
417
418 // give up for now, we can add more later
419 // DLM: should we return empty or this construction?
420 ✗ return constructionWithSearchDistance->first;
421 5038 }
422
423 5422 boost::optional<std::pair<ConstructionBase, int>> SubSurface_Impl::constructionWithSearchDistance() const {
424 5422 boost::optional<std::pair<ConstructionBase, int>> result;
425
426 boost::optional<ConstructionBase> construction =
427
2/2
✓ Branch 1 taken 5422 times.
✓ Branch 4 taken 5422 times.
5422 getObject<ModelObject>().getModelObjectTarget<ConstructionBase>(OS_SubSurfaceFields::ConstructionName);
428
2/2
✓ Branch 0 taken 3085 times.
✓ Branch 1 taken 2337 times.
5422 if (construction) {
429
3/3
✓ Branch 1 taken 3085 times.
✓ Branch 4 taken 3085 times.
✓ Branch 7 taken 3085 times.
3085 return std::make_pair(*construction, 0);
430 }
431
432
1/1
✓ Branch 1 taken 2337 times.
2337 boost::optional<Surface> surface = this->surface();
433
2/2
✓ Branch 0 taken 2328 times.
✓ Branch 1 taken 9 times.
2337 if (surface) {
434
2/2
✓ Branch 1 taken 2328 times.
✓ Branch 4 taken 2328 times.
2328 boost::optional<Space> space = surface->space();
435
2/2
✓ Branch 0 taken 2089 times.
✓ Branch 1 taken 239 times.
2328 if (space) {
436
3/3
✓ Branch 1 taken 2089 times.
✓ Branch 4 taken 2089 times.
✓ Branch 7 taken 2089 times.
2089 result = space->getDefaultConstructionWithSearchDistance(this->getObject<SubSurface>());
437 }
438 2328 }
439
440 2337 return result;
441 5422 }
442
443 848 bool SubSurface_Impl::isConstructionDefaulted() const {
444 848 return isEmpty(OS_SubSurfaceFields::ConstructionName);
445 }
446
447 4907 bool SubSurface_Impl::setVertices(const std::vector<Point3d>& vertices) {
448 4907 bool result = PlanarSurface_Impl::setVertices(vertices);
449
450
2/2
✓ Branch 1 taken 3847 times.
✓ Branch 2 taken 1060 times.
4907 if (isEmpty(OS_SubSurfaceFields::SubSurfaceType)) {
451
2/2
✓ Branch 0 taken 3844 times.
✓ Branch 1 taken 3 times.
3847 if (result) {
452 3844 this->assignDefaultSubSurfaceType();
453 } else {
454
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(Error, "Cannot compute default SubSurface properties.");
455 }
456 }
457
458 4907 return result;
459 }
460
461 791 bool SubSurface_Impl::setConstruction(const ConstructionBase& construction) {
462
2/2
✓ Branch 1 taken 791 times.
✓ Branch 4 taken 791 times.
791 bool result = setPointer(OS_SubSurfaceFields::ConstructionName, construction.handle());
463 791 return result;
464 }
465
466 109 void SubSurface_Impl::resetConstruction() {
467
2/2
✓ Branch 1 taken 109 times.
✓ Branch 4 taken 109 times.
218 bool result = setString(OS_SubSurfaceFields::ConstructionName, "");
468
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 109 times.
109 OS_ASSERT(result);
469 109 }
470
471 4951 boost::optional<PlanarSurfaceGroup> SubSurface_Impl::planarSurfaceGroup() const {
472
2/2
✓ Branch 1 taken 4951 times.
✓ Branch 4 taken 4951 times.
4951 return boost::optional<PlanarSurfaceGroup>(this->space());
473 }
474
475 8401 boost::optional<Space> SubSurface_Impl::space() const {
476 8401 boost::optional<Space> result;
477
1/1
✓ Branch 1 taken 8401 times.
8401 boost::optional<Surface> surface = this->surface();
478
2/2
✓ Branch 0 taken 8377 times.
✓ Branch 1 taken 24 times.
8401 if (surface) {
479
2/2
✓ Branch 1 taken 8377 times.
✓ Branch 4 taken 8377 times.
8377 result = surface->space();
480 }
481 16802 return result;
482 8401 }
483
484 2 boost::optional<double> SubSurface_Impl::uFactor() const {
485
1/1
✓ Branch 1 taken 2 times.
2 OptionalConstructionBase oConstruction = construction();
486
1/1
✓ Branch 1 taken 2 times.
2 OptionalSurface oSurface = surface();
487 2 OptionalDouble result;
488
489
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (oConstruction) {
490 // from input
491 2 OptionalDouble inputResult;
492
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (oSurface) {
493
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 inputResult = oConstruction->uFactor(oSurface->filmResistance());
494 }
495
496 // from output
497
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 OptionalSqlFile sqlFile = model().sqlFile();
498
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 OptionalString constructionName = oConstruction->name();
499 2 OptionalDouble outputResult;
500
1/1
✓ Branch 1 taken 2 times.
2 OptionalString subSurfaceName = name();
501
502 // opaque exterior
503
6/10
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
4 if (sqlFile && constructionName && oConstruction->isOpaque()) {
504 ✗ std::string query = R"(SELECT Value from TabularDataWithStrings
505 WHERE ReportName = 'EnvelopeSummary'
506 AND ReportForString = 'Entire Facility'
507 AND TableName = 'Opaque Exterior'
508 AND ColumnName = 'U-Factor with Film'
509 AND Units='W/m2-K'
510 AND RowName = ?;)";
511 ✗ outputResult = sqlFile->execAndReturnFirstDouble(query, to_upper_copy(*subSurfaceName));
512 ✗ }
513
514 // fenestration
515
6/10
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✓ Branch 8 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
4 if (sqlFile && constructionName && oConstruction->isFenestration()) {
516
1/1
✓ Branch 1 taken 2 times.
2 std::string query = R"(SELECT Value from TabularDataWithStrings
517 WHERE ReportName = 'EnvelopeSummary'
518 AND ReportForString = 'Entire Facility'
519 AND TableName = 'Exterior Fenestration'
520 AND ColumnName = 'Glass U-Factor'
521 AND Units='W/m2-K'
522 AND RowName = ?;)";
523
4/4
✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✓ Branch 8 taken 2 times.
✓ Branch 11 taken 2 times.
2 outputResult = sqlFile->execAndReturnFirstDouble(query, to_upper_copy(*subSurfaceName));
524 2 }
525
526
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (inputResult) {
527 ✗ result = inputResult;
528 ✗ if (outputResult) {
529 ✗ compareInputAndOutput(*oConstruction, "uFactor", *inputResult, *outputResult, 1.0E-3);
530 }
531 } else {
532 2 result = outputResult;
533 }
534 2 }
535
536 2 return result;
537 2 }
538
539 2 boost::optional<double> SubSurface_Impl::thermalConductance() const {
540
1/1
✓ Branch 1 taken 2 times.
2 OptionalConstructionBase oConstruction = construction();
541
1/1
✓ Branch 1 taken 2 times.
2 OptionalSurface oSurface = surface();
542 2 OptionalDouble result;
543
544
3/6
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
4 if (oConstruction && oSurface) {
545 // from input
546
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 OptionalDouble inputResult = oConstruction->thermalConductance(oSurface->filmResistance());
547
548 // from output
549
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 OptionalSqlFile sqlFile = model().sqlFile();
550
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 OptionalString constructionName = oConstruction->name();
551 2 OptionalDouble outputResult;
552
1/1
✓ Branch 1 taken 2 times.
2 OptionalString subSurfaceName = name();
553
554 // opaque exterior
555
6/10
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
4 if (sqlFile && constructionName && oConstruction->isOpaque()) {
556 ✗ std::string query = R"(SELECT Value from TabularDataWithStrings
557 WHERE ReportName = 'EnvelopeSummary'
558 AND ReportForString = 'Entire Facility'
559 AND TableName = 'Opaque Exterior'
560 AND ColumnName = 'U-Factor no Film'
561 AND Units='W/m2-K'
562 AND RowName = ?;)";
563 ✗ outputResult = sqlFile->execAndReturnFirstDouble(query, to_upper_copy(*subSurfaceName));
564 ✗ }
565
566 // fenestration
567
6/10
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✓ Branch 8 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
4 if (sqlFile && constructionName && oConstruction->isFenestration()) {
568
569 // get u-factor, then subtract film coefficients
570
1/1
✓ Branch 1 taken 2 times.
2 std::string query = R"(SELECT Value from TabularDataWithStrings
571 WHERE ReportName = 'EnvelopeSummary'
572 AND ReportForString = 'Entire Facility'
573 AND TableName = 'Exterior Fenestration'
574 AND ColumnName = 'Glass U-Factor'
575 AND Units='W/m2-K'
576 AND RowName = ?;)";
577
4/4
✓ Branch 1 taken 2 times.
✓ Branch 5 taken 2 times.
✓ Branch 8 taken 2 times.
✓ Branch 11 taken 2 times.
2 outputResult = sqlFile->execAndReturnFirstDouble(query, to_upper_copy(*subSurfaceName));
578
579
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (outputResult) {
580
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 outputResult = 1.0 / (1.0 / (*outputResult) - oSurface->filmResistance());
581 }
582 2 }
583
584
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (inputResult) {
585 ✗ result = inputResult;
586 ✗ if (outputResult) {
587 ✗ compareInputAndOutput(*oConstruction, "thermal conductance", *inputResult, *outputResult, 1.0E-5);
588 }
589 } else {
590 2 result = outputResult;
591 }
592 2 }
593
594 2 return result;
595 2 }
596
597 ✗ bool SubSurface_Impl::setUFactor(double value) {
598 ✗ OptionalConstructionBase oConstruction = this->construction();
599 ✗ OptionalSurface oSurface = this->surface();
600 ✗ if (oConstruction && oSurface) {
601 ✗ return oConstruction->setUFactor(value, oSurface->filmResistance());
602 }
603 ✗ return false;
604 ✗ }
605
606 ✗ bool SubSurface_Impl::setThermalConductance(double value) {
607 ✗ OptionalConstructionBase oConstruction = this->construction();
608 ✗ OptionalSurface oSurface = this->surface();
609 ✗ if (oConstruction && oSurface) {
610 ✗ return oConstruction->setConductance(value, oSurface->filmResistance());
611 }
612 ✗ return false;
613 ✗ }
614
615 725 bool SubSurface_Impl::subtractFromGrossArea() const {
616 725 return true;
617 }
618
619 68174 std::string SubSurface_Impl::subSurfaceType() const {
620
1/1
✓ Branch 1 taken 68174 times.
68174 boost::optional<std::string> value = getString(OS_SubSurfaceFields::SubSurfaceType, true, true);
621
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 68174 times.
✗ Branch 4 not taken.
68174 OS_ASSERT(value);
622
2/2
✓ Branch 1 taken 68174 times.
✓ Branch 4 taken 68174 times.
136348 return value.get();
623 68174 }
624
625 3952 bool SubSurface_Impl::isSubSurfaceTypeDefaulted() const {
626 3952 return isEmpty(OS_SubSurfaceFields::SubSurfaceType);
627 }
628
629 ✗ std::vector<std::string> SubSurface_Impl::subSurfaceTypeValues() const {
630 ✗ return SubSurface::validSubSurfaceTypeValues();
631 }
632
633 408 boost::optional<double> SubSurface_Impl::viewFactortoGround() const {
634 408 return getDouble(OS_SubSurfaceFields::ViewFactortoGround, true);
635 }
636
637 ✗ bool SubSurface_Impl::isViewFactortoGroundDefaulted() const {
638 ✗ return isEmpty(OS_SubSurfaceFields::ViewFactortoGround);
639 }
640
641 1 bool SubSurface_Impl::isViewFactortoGroundAutocalculated() const {
642 1 bool result = false;
643
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<std::string> value = getString(OS_SubSurfaceFields::ViewFactortoGround, true);
644
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (value) {
645
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 result = openstudio::istringEqual(value.get(), "Autocalculate");
646 }
647 1 return result;
648 1 }
649
650 10202 bool SubSurface_Impl::allowShadingControl() const {
651 10202 bool result = false;
652
653
1/1
✓ Branch 1 taken 10202 times.
10202 std::string subSurfaceType = this->subSurfaceType();
654
19/33
✓ Branch 1 taken 10202 times.
✓ Branch 4 taken 2345 times.
✓ Branch 7 taken 2345 times.
✓ Branch 9 taken 2071 times.
✓ Branch 10 taken 274 times.
✓ Branch 12 taken 2071 times.
✓ Branch 15 taken 2071 times.
✓ Branch 17 taken 867 times.
✓ Branch 18 taken 1204 times.
✓ Branch 20 taken 2071 times.
✓ Branch 21 taken 8131 times.
✓ Branch 22 taken 2345 times.
✓ Branch 23 taken 7857 times.
✓ Branch 25 taken 2345 times.
✓ Branch 26 taken 7857 times.
✓ Branch 27 taken 10202 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 10202 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 9365 times.
✓ Branch 33 taken 837 times.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
39438 if (istringEqual("FixedWindow", subSurfaceType) || istringEqual("OperableWindow", subSurfaceType) || istringEqual("Skylight", subSurfaceType)
655
13/17
✓ Branch 1 taken 10202 times.
✓ Branch 3 taken 2345 times.
✓ Branch 4 taken 7857 times.
✓ Branch 6 taken 867 times.
✓ Branch 9 taken 867 times.
✓ Branch 11 taken 30 times.
✓ Branch 12 taken 837 times.
✓ Branch 13 taken 867 times.
✓ Branch 14 taken 9335 times.
✓ Branch 16 taken 867 times.
✓ Branch 17 taken 9335 times.
✓ Branch 18 taken 2071 times.
✓ Branch 19 taken 8131 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
23616 || istringEqual("GlassDoor", subSurfaceType)) {
656 9365 result = true;
657 }
658
659 10202 return result;
660 10202 }
661
662 1931 std::vector<ShadingControl> SubSurface_Impl::shadingControls() const {
663
1/1
✓ Branch 1 taken 1931 times.
1931 auto thisSubSurface = getObject<SubSurface>();
664
665 1931 std::vector<ShadingControl> shadingControls;
666
667
4/4
✓ Branch 1 taken 1931 times.
✓ Branch 4 taken 1931 times.
✓ Branch 12 taken 33 times.
✓ Branch 13 taken 1931 times.
1964 for (const auto& object : getObject<ModelObject>().getModelObjectSources<ShadingControl>()) {
668
1/1
✓ Branch 1 taken 33 times.
33 auto modelObject = object.cast<ModelObject>();
669
1/1
✓ Branch 1 taken 33 times.
33 auto shadingControl = modelObject.cast<ShadingControl>();
670
3/3
✓ Branch 1 taken 33 times.
✓ Branch 8 taken 37 times.
✓ Branch 9 taken 33 times.
70 for (const SubSurface& subSurface : shadingControl.subSurfaces()) {
671
5/5
✓ Branch 1 taken 37 times.
✓ Branch 4 taken 37 times.
✓ Branch 7 taken 37 times.
✓ Branch 9 taken 33 times.
✓ Branch 10 taken 4 times.
37 if (subSurface.handle() == thisSubSurface.handle()) {
672
1/1
✓ Branch 1 taken 33 times.
33 shadingControls.push_back(shadingControl);
673 }
674 33 }
675 1964 }
676
677 3862 return shadingControls;
678 1931 }
679
680 851 unsigned int SubSurface_Impl::numberofShadingControls() const {
681
1/1
✓ Branch 1 taken 851 times.
851 return shadingControls().size();
682 }
683
684 10241 bool SubSurface_Impl::allowWindowPropertyFrameAndDivider() const {
685 10241 bool result = false;
686
687
1/1
✓ Branch 1 taken 10241 times.
10241 std::string subSurfaceType = this->subSurfaceType();
688
19/33
✓ Branch 1 taken 10241 times.
✓ Branch 4 taken 2358 times.
✓ Branch 7 taken 2358 times.
✓ Branch 9 taken 2084 times.
✓ Branch 10 taken 274 times.
✓ Branch 12 taken 2084 times.
✓ Branch 15 taken 2084 times.
✓ Branch 17 taken 879 times.
✓ Branch 18 taken 1205 times.
✓ Branch 20 taken 2084 times.
✓ Branch 21 taken 8157 times.
✓ Branch 22 taken 2358 times.
✓ Branch 23 taken 7883 times.
✓ Branch 25 taken 2358 times.
✓ Branch 26 taken 7883 times.
✓ Branch 27 taken 10241 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 10241 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 9399 times.
✓ Branch 33 taken 842 times.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
39607 if (istringEqual("FixedWindow", subSurfaceType) || istringEqual("OperableWindow", subSurfaceType) || istringEqual("Skylight", subSurfaceType)
689
13/17
✓ Branch 1 taken 10241 times.
✓ Branch 3 taken 2358 times.
✓ Branch 4 taken 7883 times.
✓ Branch 6 taken 879 times.
✓ Branch 9 taken 879 times.
✓ Branch 11 taken 37 times.
✓ Branch 12 taken 842 times.
✓ Branch 13 taken 879 times.
✓ Branch 14 taken 9362 times.
✓ Branch 16 taken 879 times.
✓ Branch 17 taken 9362 times.
✓ Branch 18 taken 2084 times.
✓ Branch 19 taken 8157 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
23719 || istringEqual("GlassDoor", subSurfaceType)) {
690 9399 result = true;
691 }
692
693 10241 return result;
694 10241 }
695
696 2053 boost::optional<WindowPropertyFrameAndDivider> SubSurface_Impl::windowPropertyFrameAndDivider() const {
697
2/2
✓ Branch 1 taken 2053 times.
✓ Branch 4 taken 2053 times.
2053 return getObject<SubSurface>().getModelObjectTarget<WindowPropertyFrameAndDivider>(OS_SubSurfaceFields::FrameandDividerName);
698 }
699
700 1991 double SubSurface_Impl::multiplier() const {
701
1/1
✓ Branch 1 taken 1991 times.
1991 boost::optional<double> value = getDouble(OS_SubSurfaceFields::Multiplier, true);
702
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1991 times.
✗ Branch 4 not taken.
1991 OS_ASSERT(value);
703
1/1
✓ Branch 1 taken 1991 times.
3982 return value.get();
704 }
705
706 408 bool SubSurface_Impl::isMultiplierDefaulted() const {
707 408 return isEmpty(OS_SubSurfaceFields::Multiplier);
708 }
709
710 ✗ boost::optional<double> SubSurface_Impl::numberofVertices() const {
711 ✗ return getDouble(OS_SubSurfaceFields::NumberofVertices, true);
712 }
713
714 ✗ bool SubSurface_Impl::isNumberofVerticesDefaulted() const {
715 ✗ return isEmpty(OS_SubSurfaceFields::NumberofVertices);
716 }
717
718 1 bool SubSurface_Impl::isNumberofVerticesAutocalculated() const {
719 1 bool result = false;
720
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<std::string> value = getString(OS_SubSurfaceFields::NumberofVertices, true);
721
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (value) {
722
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 result = openstudio::istringEqual(value.get(), "Autocalculate");
723 }
724 1 return result;
725 1 }
726
727 10190 bool SubSurface_Impl::setSubSurfaceType(const std::string& subSurfaceType) {
728 10190 bool result = setString(OS_SubSurfaceFields::SubSurfaceType, subSurfaceType);
729
1/2
✓ Branch 0 taken 10190 times.
✗ Branch 1 not taken.
10190 if (result) {
730
731
4/6
✓ Branch 1 taken 837 times.
✓ Branch 2 taken 9353 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 837 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 10190 times.
10190 if (!allowShadingControl() && (numberofShadingControls() > 0)) {
732 ✗ LOG(Warn, briefDescription() << " new subSurfaceType='" << subSurfaceType
733 << "' is incompatible with Shading Controls. Removing this SubSurface from the Shading Controls.");
734 ✗ this->removeAllShadingControls();
735 }
736
737
8/12
✓ Branch 1 taken 10190 times.
✓ Branch 3 taken 837 times.
✓ Branch 4 taken 9353 times.
✓ Branch 6 taken 837 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 837 times.
✓ Branch 11 taken 837 times.
✓ Branch 12 taken 9353 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 10190 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
11027 if (!allowWindowPropertyFrameAndDivider() && windowPropertyFrameAndDivider()) {
738 ✗ LOG(Warn, briefDescription() << " new subSurfaceType=" << subSurfaceType
739 << "' is incompatible with the Window Property Frame and Divider. Resetting the Frame and Divider object.");
740 ✗ this->resetWindowPropertyFrameAndDivider();
741 }
742
743
2/2
✓ Branch 1 taken 2039 times.
✓ Branch 2 taken 8151 times.
10190 if (!allowDaylightingDeviceShelf()) {
744
3/3
✓ Branch 1 taken 2039 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2037 times.
4078 if (boost::optional<DaylightingDeviceShelf> shelf = this->daylightingDeviceShelf()) {
745
9/9
✓ 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 20 taken 2 times.
✓ Branch 23 taken 2 times.
✓ Branch 26 taken 2 times.
2 LOG(Warn, briefDescription() << " new subSurfaceType='" << subSurfaceType
746 << "' is incompatible with Daylighting Device Shelf. Removing the Shelf object.");
747
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 shelf->remove();
748 2039 }
749 }
750
751
2/2
✓ Branch 1 taken 10184 times.
✓ Branch 2 taken 6 times.
10190 if (!allowDaylightingDeviceTubularDome()) {
752
3/3
✓ Branch 1 taken 10184 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 10182 times.
20368 if (boost::optional<DaylightingDeviceTubular> tubular = this->daylightingDeviceTubular()) {
753
6/7
✓ 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 17 not taken.
2 if (tubular->subSurfaceDome().handle() == this->handle()) {
754
7/7
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 14 taken 2 times.
✓ Branch 17 taken 2 times.
✓ Branch 20 taken 2 times.
2 LOG(Warn,
755 briefDescription() << " cannot be used as a dome subsurface on a Daylighting Device Tubular object. Removing the Tubular object.");
756
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 tubular->remove();
757 }
758 10184 }
759 }
760
761
2/2
✓ Branch 1 taken 10184 times.
✓ Branch 2 taken 6 times.
10190 if (!allowDaylightingDeviceTubularDiffuser()) {
762
2/3
✓ Branch 1 taken 10184 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 10184 times.
20368 if (boost::optional<DaylightingDeviceTubular> tubular = this->daylightingDeviceTubular()) {
763 ✗ if (tubular->subSurfaceDiffuser().handle() == this->handle()) {
764 ✗ LOG(Warn, briefDescription()
765 << " cannot be used as a diffuser subsurface on a Daylighting Device Tubular object. Removing the Tubular object.");
766 ✗ tubular->remove();
767 }
768 10184 }
769 }
770
771
2/2
✓ Branch 1 taken 2039 times.
✓ Branch 2 taken 8151 times.
10190 if (!allowDaylightingDeviceLightWell()) {
772
3/3
✓ Branch 1 taken 2039 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 2036 times.
4078 if (boost::optional<DaylightingDeviceLightWell> lightwell = this->daylightingDeviceLightWell()) {
773
7/7
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 14 taken 3 times.
✓ Branch 17 taken 3 times.
✓ Branch 20 taken 3 times.
3 LOG(Warn, briefDescription() << " cannot be used as a subsurface on a Daylighting Device Light Well object. Removing the Well object.");
774
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 lightwell->remove();
775 2039 }
776 }
777
778
3/3
✓ Branch 1 taken 10190 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 10188 times.
20380 if (boost::optional<SubSurface> adjacentSubSurface = this->adjacentSubSurface()) {
779
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 adjacentSubSurface->setString(OS_SubSurfaceFields::SubSurfaceType, subSurfaceType);
780
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 adjacentSubSurface->removeAllShadingControls();
781 10190 }
782 }
783 10190 return result;
784 }
785
786 3844 void SubSurface_Impl::resetSubSurfaceType() {
787
2/2
✓ Branch 1 taken 3844 times.
✓ Branch 4 taken 3844 times.
7688 bool result = setString(OS_SubSurfaceFields::SubSurfaceType, "");
788
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3844 times.
3844 OS_ASSERT(result);
789 3844 }
790
791 ✗ bool SubSurface_Impl::setViewFactortoGround(boost::optional<double> viewFactortoGround) {
792 ✗ bool result = false;
793 ✗ if (viewFactortoGround) {
794 ✗ result = setDouble(OS_SubSurfaceFields::ViewFactortoGround, viewFactortoGround.get());
795 } else {
796 ✗ result = setString(OS_SubSurfaceFields::ViewFactortoGround, "");
797 }
798 ✗ return result;
799 }
800
801 1 bool SubSurface_Impl::setViewFactortoGround(double viewFactortoGround) {
802 1 bool result = setDouble(OS_SubSurfaceFields::ViewFactortoGround, viewFactortoGround);
803 1 return result;
804 }
805
806 ✗ void SubSurface_Impl::resetViewFactortoGround() {
807 ✗ bool result = setString(OS_SubSurfaceFields::ViewFactortoGround, "");
808 ✗ OS_ASSERT(result);
809 ✗ }
810
811 1 void SubSurface_Impl::autocalculateViewFactortoGround() {
812
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_SubSurfaceFields::ViewFactortoGround, "Autocalculate");
813
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
814 1 }
815
816 12 bool SubSurface_Impl::addShadingControl(ShadingControl& shadingControl) {
817 12 bool result = false;
818
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
12 if (allowShadingControl()) {
819
1/1
✓ Branch 1 taken 12 times.
12 auto thisSubSurface = getObject<SubSurface>();
820
1/1
✓ Branch 1 taken 12 times.
12 result = shadingControl.addSubSurface(thisSubSurface);
821 12 }
822 12 return result;
823 }
824
825 2 bool SubSurface_Impl::addShadingControls(std::vector<ShadingControl>& shadingControls) {
826 2 bool ok = true;
827
1/1
✓ Branch 1 taken 2 times.
2 auto thisSubSurface = getObject<SubSurface>();
828
2/2
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 2 times.
6 for (ShadingControl& shadingControl : shadingControls) {
829
1/1
✓ Branch 1 taken 4 times.
4 ok &= shadingControl.addSubSurface(thisSubSurface);
830 }
831 2 return ok;
832 2 }
833
834 3 void SubSurface_Impl::removeShadingControl(ShadingControl& shadingControl) {
835
1/1
✓ Branch 1 taken 3 times.
3 auto thisSubSurface = getObject<SubSurface>();
836
1/1
✓ Branch 1 taken 3 times.
3 shadingControl.removeSubSurface(thisSubSurface);
837 3 }
838
839 408 void SubSurface_Impl::removeAllShadingControls() {
840
1/1
✓ Branch 1 taken 408 times.
408 auto thisSubSurface = getObject<SubSurface>();
841
3/3
✓ Branch 1 taken 408 times.
✓ Branch 8 taken 5 times.
✓ Branch 9 taken 408 times.
413 for (ShadingControl& shadingControl : shadingControls()) {
842
1/1
✓ Branch 1 taken 5 times.
5 shadingControl.removeSubSurface(thisSubSurface);
843 408 }
844 408 }
845
846 41 bool SubSurface_Impl::setWindowPropertyFrameAndDivider(const WindowPropertyFrameAndDivider& windowPropertyFrameAndDivider) {
847 41 bool result = false;
848
2/2
✓ Branch 1 taken 39 times.
✓ Branch 2 taken 2 times.
41 if (allowWindowPropertyFrameAndDivider()) {
849
2/2
✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
39 result = setPointer(OS_SubSurfaceFields::FrameandDividerName, windowPropertyFrameAndDivider.handle());
850 }
851 41 return result;
852 }
853
854 1 void SubSurface_Impl::resetWindowPropertyFrameAndDivider() {
855
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_SubSurfaceFields::FrameandDividerName, "");
856
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
857 1 }
858
859 94 bool SubSurface_Impl::setMultiplier(double multiplier) {
860 94 bool result = setDouble(OS_SubSurfaceFields::Multiplier, multiplier);
861
862
2/2
✓ Branch 0 taken 93 times.
✓ Branch 1 taken 1 time.
94 if (result) {
863
1/1
✓ Branch 1 taken 93 times.
93 boost::optional<SubSurface> adjacentSubSurface = this->adjacentSubSurface();
864
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 92 times.
93 if (adjacentSubSurface) {
865
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 result = adjacentSubSurface->setDouble(OS_SubSurfaceFields::Multiplier, multiplier);
866
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
1 OS_ASSERT(result);
867 }
868 93 }
869
870 94 return result;
871 }
872
873 2 void SubSurface_Impl::resetMultiplier() {
874
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
4 bool result = setString(OS_SubSurfaceFields::Multiplier, "");
875
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
2 OS_ASSERT(result);
876
877
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<SubSurface> adjacentSubSurface = this->adjacentSubSurface();
878
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
2 if (adjacentSubSurface) {
879
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
2 result = adjacentSubSurface->setString(OS_SubSurfaceFields::Multiplier, "");
880
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
1 OS_ASSERT(result);
881 }
882 2 }
883
884 ✗ bool SubSurface_Impl::setNumberofVertices(boost::optional<double> numberofVertices) {
885 ✗ bool result = false;
886 ✗ if (numberofVertices) {
887 ✗ result = setDouble(OS_SubSurfaceFields::NumberofVertices, numberofVertices.get());
888 } else {
889 ✗ result = setString(OS_SubSurfaceFields::NumberofVertices, "");
890 }
891 ✗ return result;
892 }
893
894 ✗ bool SubSurface_Impl::setNumberofVertices(double numberofVertices) {
895 ✗ bool result = setDouble(OS_SubSurfaceFields::NumberofVertices, numberofVertices);
896 ✗ return result;
897 }
898
899 ✗ void SubSurface_Impl::resetNumberofVertices() {
900 ✗ bool result = setString(OS_SubSurfaceFields::NumberofVertices, "");
901 ✗ OS_ASSERT(result);
902 ✗ }
903
904 1 void SubSurface_Impl::autocalculateNumberofVertices() {
905
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_SubSurfaceFields::NumberofVertices, "Autocalculate");
906
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(result);
907 1 }
908
909 23899 boost::optional<Surface> SubSurface_Impl::surface() const {
910
2/2
✓ Branch 1 taken 23899 times.
✓ Branch 4 taken 23899 times.
23899 return getObject<SubSurface>().getModelObjectTarget<Surface>(OS_SubSurfaceFields::SurfaceName);
911 }
912
913 3963 bool SubSurface_Impl::setSurface(const Surface& surface) {
914 3963 bool emptySurface = isEmpty(OS_SubSurfaceFields::SurfaceName);
915
2/2
✓ Branch 1 taken 3963 times.
✓ Branch 4 taken 3963 times.
3963 bool result = setPointer(OS_SubSurfaceFields::SurfaceName, surface.handle());
916
7/8
✓ Branch 0 taken 3963 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3952 times.
✓ Branch 3 taken 11 times.
✓ Branch 5 taken 3691 times.
✓ Branch 6 taken 261 times.
✓ Branch 7 taken 3691 times.
✓ Branch 8 taken 272 times.
3963 if (result && emptySurface && isSubSurfaceTypeDefaulted()) {
917 3691 assignDefaultSubSurfaceType();
918 }
919 3963 return result;
920 }
921
922 20392 boost::optional<SubSurface> SubSurface_Impl::adjacentSubSurface() const {
923
2/2
✓ Branch 1 taken 20392 times.
✓ Branch 4 taken 20392 times.
20392 return getObject<SubSurface>().getModelObjectTarget<SubSurface>(OS_SubSurfaceFields::OutsideBoundaryConditionObject);
924 }
925
926 209 bool SubSurface_Impl::setAdjacentSubSurface(SubSurface& subSurface) {
927 // matching sub surface with self is ok for stories with multipliers
928 209 bool isSameSubSurface = false;
929
5/5
✓ Branch 1 taken 209 times.
✓ Branch 4 taken 209 times.
✓ Branch 7 taken 209 times.
✓ Branch 9 taken 1 time.
✓ Branch 10 taken 208 times.
209 if (subSurface.handle() == this->handle()) {
930 1 isSameSubSurface = true;
931 }
932
933
4/4
✓ Branch 1 taken 209 times.
✓ Branch 4 taken 209 times.
✓ Branch 6 taken 1 time.
✓ Branch 7 taken 208 times.
209 if (this->multiplier() != subSurface.multiplier()) {
934 1 return false;
935 }
936
937 208 bool result = false;
938
939
1/1
✓ Branch 1 taken 208 times.
208 boost::optional<Surface> thisSurface = this->surface();
940
1/1
✓ Branch 1 taken 208 times.
208 boost::optional<Surface> otherSurface = subSurface.surface();
941
5/6
✓ Branch 0 taken 200 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 200 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 200 times.
✓ Branch 5 taken 8 times.
408 if (thisSurface && otherSurface) {
942
943 // if base surfaces are matched
944
2/2
✓ Branch 1 taken 200 times.
✓ Branch 4 taken 200 times.
200 boost::optional<Surface> adjacentSurface = thisSurface->adjacentSurface();
945
8/11
✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 200 times.
✓ Branch 6 taken 200 times.
✓ Branch 9 taken 200 times.
✓ Branch 12 taken 200 times.
✓ Branch 15 taken 200 times.
✓ Branch 17 taken 200 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 200 times.
✗ Branch 20 not taken.
200 if (adjacentSurface && (adjacentSurface->handle() == otherSurface->handle())) {
946
947 // check for unequal subsurfacetypes
948
1/1
✓ Branch 1 taken 200 times.
200 std::string thisSubSurfaceType = this->subSurfaceType();
949
1/1
✓ Branch 1 taken 200 times.
200 std::string adjacentSubSurfaceType = subSurface.subSurfaceType();
950
2/2
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 195 times.
200 if (thisSubSurfaceType != adjacentSubSurfaceType) {
951 // sub surfaces don't match, we could return false here if we wanted to
952 // however, David's preference is that we attempt to resolve this
953
1/1
✓ Branch 1 taken 5 times.
5 std::string thisDefaultSubSurfaceType = this->defaultSubSurfaceType();
954
955 // if subSurfaceType is set to something other than defaultSubSurfaceType assume the user wanted it that way
956 // resolve conflicts giving preference to this subSurfaceType
957
2/2
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
5 if (thisSubSurfaceType != thisDefaultSubSurfaceType) {
958 // set other sub surface to this subSurfaceType
959
1/1
✓ Branch 1 taken 3 times.
3 subSurface.setSubSurfaceType(thisSubSurfaceType);
960 } else {
961 // must be the other surface that doesn't match its defaultSubSurfaceType
962 // set this sub surface to other subSurfaceType
963
1/1
✓ Branch 1 taken 2 times.
2 this->setSubSurfaceType(adjacentSubSurfaceType);
964 }
965 5 }
966
967 // reset any sub surfaces pointing to this
968
1/1
✓ Branch 1 taken 200 times.
200 this->resetAdjacentSubSurface();
969
970 // if other subsurface is already matched to another sub surface, could be this one
971
2/2
✓ Branch 0 taken 199 times.
✓ Branch 1 taken 1 time.
200 if (!isSameSubSurface) {
972
1/1
✓ Branch 1 taken 199 times.
199 subSurface.resetAdjacentSubSurface();
973 }
974
975
2/2
✓ Branch 1 taken 200 times.
✓ Branch 4 taken 200 times.
200 result = setPointer(OS_SubSurfaceFields::OutsideBoundaryConditionObject, subSurface.handle());
976
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
✗ Branch 3 not taken.
200 OS_ASSERT(result);
977
1/1
✓ Branch 1 taken 200 times.
200 this->removeAllShadingControls();
978
979
2/2
✓ Branch 0 taken 199 times.
✓ Branch 1 taken 1 time.
200 if (!isSameSubSurface) {
980
2/2
✓ Branch 1 taken 199 times.
✓ Branch 4 taken 199 times.
199 result = subSurface.setPointer(OS_SubSurfaceFields::OutsideBoundaryConditionObject, this->handle());
981
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 199 times.
✗ Branch 3 not taken.
199 OS_ASSERT(result);
982
1/1
✓ Branch 1 taken 199 times.
199 subSurface.removeAllShadingControls();
983 }
984 200 }
985 200 }
986
987 208 return result;
988 208 }
989
990 681 void SubSurface_Impl::resetAdjacentSubSurface() {
991
2/2
✓ Branch 1 taken 681 times.
✓ Branch 4 taken 681 times.
1362 bool test = setString(OS_SubSurfaceFields::OutsideBoundaryConditionObject, "");
992
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 681 times.
681 OS_ASSERT(test);
993
994
4/4
✓ Branch 1 taken 681 times.
✓ Branch 4 taken 681 times.
✓ Branch 11 taken 48 times.
✓ Branch 12 taken 681 times.
729 for (WorkspaceObject& wo : this->getSources(IddObjectType::OS_SubSurface)) {
995
2/2
✓ Branch 1 taken 48 times.
✓ Branch 4 taken 48 times.
96 test = wo.setString(OS_SubSurfaceFields::OutsideBoundaryConditionObject, "");
996
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
✗ Branch 3 not taken.
48 OS_ASSERT(test);
997 681 }
998 681 }
999
1000 571 boost::optional<SurfacePropertyConvectionCoefficients> SubSurface_Impl::surfacePropertyConvectionCoefficients() const {
1001
2/2
✓ Branch 1 taken 571 times.
✓ Branch 4 taken 571 times.
571 std::vector<SurfacePropertyConvectionCoefficients> spccs(model().getConcreteModelObjects<SurfacePropertyConvectionCoefficients>());
1002
1/1
✓ Branch 1 taken 571 times.
571 auto thisHandle = this->handle();
1003 8 auto isNotPointingToMe = [&thisHandle](const auto& spcc) {
1004
1/1
✓ Branch 1 taken 8 times.
8 OptionalSubSurface surface = spcc.surfaceAsSubSurface();
1005
7/7
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 3 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 12 taken 2 times.
✓ Branch 13 taken 3 times.
16 return !surface || !(surface->handle() == thisHandle);
1006 8 };
1007
1008
2/2
✓ Branch 5 taken 571 times.
✓ Branch 9 taken 571 times.
571 spccs.erase(std::remove_if(spccs.begin(), spccs.end(), isNotPointingToMe), spccs.end());
1009
1010
2/2
✓ Branch 1 taken 568 times.
✓ Branch 2 taken 3 times.
571 if (spccs.empty()) {
1011 568 return boost::none;
1012
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 } else if (spccs.size() == 1) {
1013
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 return spccs.at(0);
1014 } else {
1015 ✗ LOG(Error, "More than one SurfacePropertyConvectionCoefficients points to this SubSurface");
1016 ✗ return boost::none;
1017 }
1018 571 }
1019
1020 414 boost::optional<SurfacePropertyLocalEnvironment> SubSurface_Impl::surfacePropertyLocalEnvironment() const {
1021
1022 414 std::vector<SurfacePropertyLocalEnvironment> result;
1023
4/4
✓ Branch 1 taken 414 times.
✓ Branch 4 taken 414 times.
✓ Branch 12 taken 9 times.
✓ Branch 13 taken 414 times.
423 for (auto& localEnv : model().getConcreteModelObjects<SurfacePropertyLocalEnvironment>()) {
1024
3/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 5 times.
18 if (auto subSurface_ = localEnv.exteriorSurfaceAsSubSurface()) {
1025
5/6
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
✓ Branch 12 taken 4 times.
✗ Branch 13 not taken.
4 if (subSurface_->handle() == handle()) {
1026
1/1
✓ Branch 1 taken 4 times.
4 result.push_back(localEnv);
1027 }
1028 9 }
1029 414 }
1030
2/2
✓ Branch 1 taken 410 times.
✓ Branch 2 taken 4 times.
414 if (result.empty()) {
1031 410 return boost::none;
1032
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 } else if (result.size() == 1) {
1033
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 return result.at(0);
1034 } else {
1035 ✗ LOG(Error, "More than one SurfacePropertyLocalEnvironment points to this SubSurface");
1036 ✗ return boost::none;
1037 }
1038 414 }
1039
1040 410 boost::optional<SurfacePropertyIncidentSolarMultiplier> SubSurface_Impl::surfacePropertyIncidentSolarMultiplier() const {
1041
2/2
✓ Branch 1 taken 410 times.
✓ Branch 4 taken 410 times.
410 std::vector<SurfacePropertyIncidentSolarMultiplier> allspism(model().getConcreteModelObjects<SurfacePropertyIncidentSolarMultiplier>());
1042 410 std::vector<SurfacePropertyIncidentSolarMultiplier> spism;
1043
2/2
✓ Branch 5 taken 3 times.
✓ Branch 6 taken 410 times.
413 for (auto& spcc : allspism) {
1044
5/6
✓ 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.
✗ Branch 14 not taken.
3 if (spcc.subSurface().handle() == handle()) {
1045
1/1
✓ Branch 1 taken 3 times.
3 spism.push_back(spcc);
1046 }
1047 }
1048
2/2
✓ Branch 1 taken 407 times.
✓ Branch 2 taken 3 times.
410 if (spism.empty()) {
1049 407 return boost::none;
1050
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 } else if (spism.size() == 1) {
1051
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 return spism.at(0);
1052 } else {
1053 ✗ LOG(Error, "More than one SurfacePropertyIncidentSolarMultiplier points to this SubSurface");
1054 ✗ return boost::none;
1055 }
1056 410 }
1057
1058 411 boost::optional<SurfacePropertyOtherSideCoefficients> SubSurface_Impl::surfacePropertyOtherSideCoefficients() const {
1059
2/2
✓ Branch 1 taken 411 times.
✓ Branch 4 taken 411 times.
411 return getObject<SubSurface>().getModelObjectTarget<SurfacePropertyOtherSideCoefficients>(OS_SubSurfaceFields::OutsideBoundaryConditionObject);
1060 }
1061
1062 1 bool SubSurface_Impl::setSurfacePropertyOtherSideCoefficients(const SurfacePropertyOtherSideCoefficients& otherSideCoefficients) {
1063
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<SubSurface> adjacentSubSurface = this->adjacentSubSurface();
1064
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (adjacentSubSurface) {
1065
1/1
✓ Branch 1 taken 1 time.
1 resetAdjacentSubSurface();
1066 }
1067
1068 // this is basically testing if otherSideCoefficients is in same model as this
1069
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 bool test = this->setPointer(OS_SubSurfaceFields::OutsideBoundaryConditionObject, otherSideCoefficients.handle());
1070
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (!test) {
1071 ✗ if (adjacentSubSurface) {
1072 ✗ setAdjacentSubSurface(*adjacentSubSurface);
1073 }
1074 }
1075 1 return test;
1076 1 }
1077
1078 34 void SubSurface_Impl::resetSurfacePropertyOtherSideCoefficients() {
1079
2/2
✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
68 bool test = setString(OS_SubSurfaceFields::OutsideBoundaryConditionObject, "");
1080
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 34 times.
34 OS_ASSERT(test);
1081 34 }
1082
1083 411 boost::optional<SurfacePropertyOtherSideConditionsModel> SubSurface_Impl::surfacePropertyOtherSideConditionsModel() const {
1084
1/1
✓ Branch 1 taken 411 times.
822 return getObject<SubSurface>().getModelObjectTarget<SurfacePropertyOtherSideConditionsModel>(
1085
1/1
✓ Branch 1 taken 411 times.
822 OS_SubSurfaceFields::OutsideBoundaryConditionObject);
1086 }
1087
1088 1 bool SubSurface_Impl::setSurfacePropertyOtherSideConditionsModel(const SurfacePropertyOtherSideConditionsModel& otherSideModel) {
1089
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<SubSurface> adjacentSubSurface = this->adjacentSubSurface();
1090
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (adjacentSubSurface) {
1091
1/1
✓ Branch 1 taken 1 time.
1 resetAdjacentSubSurface();
1092 }
1093
1094 // this is basically testing if otherSideModel is in same model as this
1095
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 bool test = this->setPointer(OS_SubSurfaceFields::OutsideBoundaryConditionObject, otherSideModel.handle());
1096
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (!test) {
1097 ✗ if (adjacentSubSurface) {
1098 ✗ setAdjacentSubSurface(*adjacentSubSurface);
1099 }
1100 }
1101 1 return test;
1102 1 }
1103
1104 34 void SubSurface_Impl::resetSurfacePropertyOtherSideConditionsModel() {
1105
2/2
✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
68 bool test = setString(OS_SubSurfaceFields::OutsideBoundaryConditionObject, "");
1106
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 34 times.
34 OS_ASSERT(test);
1107 34 }
1108
1109 7552 std::string SubSurface_Impl::defaultSubSurfaceType() const {
1110 7552 std::string result;
1111
1112
1/1
✓ Branch 1 taken 7552 times.
7552 boost::optional<Surface> surface = this->surface();
1113
2/2
✓ Branch 1 taken 3846 times.
✓ Branch 2 taken 3706 times.
7552 if (!surface) {
1114
2/2
✓ Branch 1 taken 3846 times.
✓ Branch 4 taken 3846 times.
3846 double degTilt = radToDeg(this->tilt());
1115
2/2
✓ Branch 0 taken 595 times.
✓ Branch 1 taken 3251 times.
3846 if (degTilt < 60) {
1116
1/1
✓ Branch 1 taken 595 times.
595 result = "Skylight";
1117
2/2
✓ Branch 0 taken 3247 times.
✓ Branch 1 taken 4 times.
3251 } else if (degTilt < 179) {
1118
1/1
✓ Branch 1 taken 3247 times.
3247 result = "FixedWindow";
1119 } else {
1120
1/1
✓ Branch 1 taken 4 times.
4 result = "Skylight";
1121 }
1122 } else {
1123
2/2
✓ Branch 1 taken 3706 times.
✓ Branch 4 taken 3706 times.
3706 std::string surfaceType = surface->surfaceType();
1124
16/26
✓ Branch 1 taken 3706 times.
✓ Branch 4 taken 3706 times.
✓ Branch 6 taken 3115 times.
✓ Branch 7 taken 591 times.
✓ Branch 9 taken 3115 times.
✓ Branch 12 taken 3115 times.
✓ Branch 14 taken 2 times.
✓ Branch 15 taken 3113 times.
✓ Branch 16 taken 3115 times.
✓ Branch 17 taken 591 times.
✓ Branch 19 taken 3115 times.
✓ Branch 20 taken 591 times.
✓ Branch 21 taken 3706 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 3706 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 593 times.
✓ Branch 27 taken 3113 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
17348 if (istringEqual("RoofCeiling", surfaceType) || istringEqual("Floor", surfaceType)) {
1125
1/1
✓ Branch 1 taken 593 times.
593 result = "Skylight";
1126 } else {
1127 3113 double surfaceMinZ = std::numeric_limits<double>::max();
1128
4/4
✓ Branch 1 taken 3113 times.
✓ Branch 4 taken 3113 times.
✓ Branch 10 taken 12538 times.
✓ Branch 11 taken 3113 times.
15651 for (const Point3d& point : surface->vertices()) {
1129
1/1
✓ Branch 1 taken 12538 times.
12538 surfaceMinZ = std::min(surfaceMinZ, point.z());
1130 3113 }
1131
1132 3113 double thisMinZ = std::numeric_limits<double>::max();
1133
3/3
✓ Branch 1 taken 3113 times.
✓ Branch 7 taken 12476 times.
✓ Branch 8 taken 3113 times.
15589 for (const Point3d& point : this->vertices()) {
1134
1/1
✓ Branch 1 taken 12476 times.
12476 thisMinZ = std::min(thisMinZ, point.z());
1135 3113 }
1136
1137
2/2
✓ Branch 0 taken 492 times.
✓ Branch 1 taken 2621 times.
3113 if (thisMinZ <= surfaceMinZ) {
1138 492 bool isGlassDoor = false;
1139
1140 // DLM: this surface could have been initialized to FixedWindow and get its construction
1141 // from the default construction set, this was the source of #1924
1142
1/1
✓ Branch 1 taken 492 times.
492 boost::optional<ConstructionBase> construction = this->construction();
1143
10/11
✓ Branch 1 taken 492 times.
✓ Branch 3 taken 11 times.
✓ Branch 4 taken 481 times.
✓ Branch 5 taken 11 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 11 times.
✓ Branch 11 taken 11 times.
✓ Branch 13 taken 6 times.
✓ Branch 14 taken 5 times.
✓ Branch 15 taken 6 times.
✓ Branch 16 taken 486 times.
503 if (!this->isConstructionDefaulted() && construction && construction->isFenestration()) {
1144 6 isGlassDoor = true;
1145 }
1146
1147
1/1
✓ Branch 1 taken 492 times.
492 boost::optional<std::string> value = getString(OS_SubSurfaceFields::SubSurfaceType);
1148
10/17
✓ Branch 1 taken 492 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 492 times.
✓ Branch 7 taken 492 times.
✓ Branch 10 taken 492 times.
✓ Branch 12 taken 1 time.
✓ Branch 13 taken 491 times.
✓ Branch 14 taken 492 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 492 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 time.
✓ Branch 20 taken 491 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1968 if (value && istringEqual("GlassDoor", *value)) {
1149 1 isGlassDoor = true;
1150 }
1151
1152
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 485 times.
492 if (isGlassDoor) {
1153
1/1
✓ Branch 1 taken 7 times.
7 result = "GlassDoor";
1154 } else {
1155
1/1
✓ Branch 1 taken 485 times.
485 result = "Door";
1156 }
1157 492 } else {
1158
1/1
✓ Branch 1 taken 2621 times.
2621 result = "FixedWindow";
1159 }
1160 }
1161 3706 }
1162
1163 15104 return result;
1164 7552 }
1165
1166 7547 void SubSurface_Impl::assignDefaultSubSurfaceType() {
1167
1/1
✓ Branch 1 taken 7547 times.
7547 std::string defaultSubSurfaceType = this->defaultSubSurfaceType();
1168
1/1
✓ Branch 1 taken 7547 times.
7547 bool test = setSubSurfaceType(defaultSubSurfaceType);
1169
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 7547 times.
✗ Branch 3 not taken.
7547 OS_ASSERT(test);
1170 7547 }
1171
1172 9 std::string SubSurface_Impl::outsideBoundaryCondition() const {
1173 9 std::string result;
1174
1/1
✓ Branch 1 taken 9 times.
9 OptionalSurface oSurface = surface();
1175
1/2
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
9 if (oSurface) {
1176
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
9 result = oSurface->outsideBoundaryCondition();
1177 }
1178 18 return result;
1179 9 }
1180
1181 ✗ boost::optional<ShadingSurface> SubSurface_Impl::addOverhang(double depth, double offset) {
1182 ✗ std::string subSurfaceType = this->subSurfaceType();
1183 ✗ if (!(istringEqual("FixedWindow", subSurfaceType) || istringEqual("OperableWindow", subSurfaceType)
1184 ✗ || istringEqual("GlassDoor", subSurfaceType))) {
1185 ✗ return boost::none;
1186 }
1187
1188 ✗ Model model = this->model();
1189 ✗ boost::optional<Space> space = this->space();
1190 ✗ boost::optional<ShadingSurface> shadingSurface;
1191 ✗ if (space) {
1192
1193 ✗ Point3dVector vertices = this->vertices();
1194 ✗ Transformation transformation = Transformation::alignFace(vertices);
1195 ✗ Point3dVector faceVertices = transformation.inverse() * vertices;
1196
1197 // new coordinate system has z' in direction of outward normal, y' is up
1198 ✗ double xmin = std::numeric_limits<double>::max();
1199 ✗ double xmax = std::numeric_limits<double>::min();
1200 ✗ double ymin = std::numeric_limits<double>::max();
1201 ✗ double ymax = std::numeric_limits<double>::min();
1202 ✗ for (const Point3d& faceVertex : faceVertices) {
1203 ✗ xmin = std::min(xmin, faceVertex.x());
1204 ✗ xmax = std::max(xmax, faceVertex.x());
1205 ✗ ymin = std::min(ymin, faceVertex.y());
1206 ✗ ymax = std::max(ymax, faceVertex.y());
1207 }
1208 ✗ if ((xmin > xmax) || (ymin > ymax)) {
1209 ✗ return boost::none;
1210 }
1211
1212 Point3dVector overhangVertices{
1213 {xmax + offset, ymax + offset, 0},
1214 {xmin - offset, ymax + offset, 0},
1215 {xmin - offset, ymax + offset, depth},
1216 {xmax + offset, ymax + offset, depth},
1217 ✗ };
1218
1219 ✗ ShadingSurfaceGroup shadingSurfaceGroup(model);
1220 ✗ shadingSurfaceGroup.setName(this->name().get() + " Shading Surfaces");
1221 ✗ shadingSurfaceGroup.setSpace(*space);
1222
1223 ✗ shadingSurface = ShadingSurface(transformation * overhangVertices, model);
1224 ✗ shadingSurface->setShadingSurfaceGroup(shadingSurfaceGroup);
1225
1226 ✗ shadingSurfaceGroup.setShadedSubSurface(getObject<SubSurface>());
1227 ✗ }
1228
1229 ✗ return shadingSurface;
1230 ✗ }
1231
1232 168 boost::optional<ShadingSurface> SubSurface_Impl::addOverhangByProjectionFactor(double projectionFactor, double offsetFraction) {
1233
1/1
✓ Branch 1 taken 168 times.
168 std::string subSurfaceType = this->subSurfaceType();
1234
7/24
✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 168 times.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✓ Branch 18 taken 168 times.
✓ Branch 19 taken 168 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 168 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 168 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
672 if (!(istringEqual("FixedWindow", subSurfaceType) || istringEqual("OperableWindow", subSurfaceType)
1235
3/14
✗ Branch 1 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 168 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 168 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 168 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
168 || istringEqual("GlassDoor", subSurfaceType))) {
1236 ✗ return boost::none;
1237 }
1238
1239
1/1
✓ Branch 1 taken 168 times.
168 Model model = this->model();
1240
1/1
✓ Branch 1 taken 168 times.
168 boost::optional<Space> space = this->space();
1241 168 boost::optional<ShadingSurface> shadingSurface;
1242
1/2
✓ Branch 0 taken 168 times.
✗ Branch 1 not taken.
168 if (space) {
1243
1244
1/1
✓ Branch 1 taken 168 times.
168 Point3dVector vertices = this->vertices();
1245
1/1
✓ Branch 1 taken 168 times.
168 Transformation transformation = Transformation::alignFace(vertices);
1246
2/2
✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
168 Point3dVector faceVertices = transformation.inverse() * vertices;
1247
1248 // new coordinate system has z' in direction of outward normal, y' is up
1249 168 double xmin = std::numeric_limits<double>::max();
1250 168 double xmax = std::numeric_limits<double>::min();
1251 168 double ymin = std::numeric_limits<double>::max();
1252 168 double ymax = std::numeric_limits<double>::min();
1253
2/2
✓ Branch 4 taken 672 times.
✓ Branch 5 taken 168 times.
840 for (const Point3d& faceVertex : faceVertices) {
1254
1/1
✓ Branch 1 taken 672 times.
672 xmin = std::min(xmin, faceVertex.x());
1255
1/1
✓ Branch 1 taken 672 times.
672 xmax = std::max(xmax, faceVertex.x());
1256
1/1
✓ Branch 1 taken 672 times.
672 ymin = std::min(ymin, faceVertex.y());
1257
1/1
✓ Branch 1 taken 672 times.
672 ymax = std::max(ymax, faceVertex.y());
1258 }
1259
2/4
✓ Branch 0 taken 168 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 168 times.
168 if ((xmin > xmax) || (ymin > ymax)) {
1260 ✗ return boost::none;
1261 }
1262
1263 168 double offset = offsetFraction * (ymax - ymin);
1264 168 double depth = projectionFactor * (offset + (ymax - ymin));
1265
1266 Point3dVector overhangVertices{
1267 {xmax + offset, ymax + offset, 0},
1268 {xmin - offset, ymax + offset, 0},
1269 {xmin - offset, ymax + offset, depth},
1270 {xmax + offset, ymax + offset, depth},
1271
3/5
✓ Branch 1 taken 168 times.
✓ Branch 3 taken 672 times.
✓ Branch 4 taken 168 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1008 };
1272
1273
1/1
✓ Branch 1 taken 168 times.
168 ShadingSurfaceGroup shadingSurfaceGroup(model);
1274
4/4
✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
✓ Branch 10 taken 168 times.
168 shadingSurfaceGroup.setName(this->name().get() + " Shading Surfaces");
1275
2/2
✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
168 shadingSurfaceGroup.setSpace(*space);
1276
1277
3/3
✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
✓ Branch 7 taken 168 times.
168 shadingSurface = ShadingSurface(transformation * overhangVertices, model);
1278
2/2
✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
168 shadingSurface->setShadingSurfaceGroup(shadingSurfaceGroup);
1279
1280
2/2
✓ Branch 1 taken 168 times.
✓ Branch 4 taken 168 times.
168 shadingSurfaceGroup.setShadedSubSurface(getObject<SubSurface>());
1281 168 }
1282
1283 168 return shadingSurface;
1284 336 }
1285
1286 266 std::vector<ShadingSurfaceGroup> SubSurface_Impl::shadingSurfaceGroups() const {
1287
3/3
✓ Branch 1 taken 266 times.
✓ Branch 4 taken 266 times.
✓ Branch 7 taken 266 times.
266 return getObject<ModelObject>().getModelObjectSources<ShadingSurfaceGroup>(ShadingSurfaceGroup::iddObjectType());
1288 }
1289
1290 10200 bool SubSurface_Impl::allowDaylightingDeviceShelf() const {
1291 10200 bool result = false;
1292
1293
1/1
✓ Branch 1 taken 10200 times.
10200 std::string subSurfaceType = this->subSurfaceType();
1294
11/21
✓ Branch 1 taken 10200 times.
✓ Branch 4 taken 2346 times.
✓ Branch 7 taken 2346 times.
✓ Branch 9 taken 2072 times.
✓ Branch 10 taken 274 times.
✓ Branch 12 taken 2346 times.
✓ Branch 13 taken 7854 times.
✓ Branch 14 taken 10200 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 10200 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 8158 times.
✓ Branch 20 taken 2042 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
35292 if (istringEqual(subSurfaceType, "FixedWindow") || istringEqual(subSurfaceType, "OperableWindow")
1295
13/17
✓ Branch 1 taken 10200 times.
✓ Branch 3 taken 2346 times.
✓ Branch 4 taken 7854 times.
✓ Branch 6 taken 2072 times.
✓ Branch 9 taken 2072 times.
✓ Branch 11 taken 30 times.
✓ Branch 12 taken 2042 times.
✓ Branch 13 taken 2072 times.
✓ Branch 14 taken 8128 times.
✓ Branch 16 taken 2072 times.
✓ Branch 17 taken 8128 times.
✓ Branch 18 taken 2346 times.
✓ Branch 19 taken 7854 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
24818 || istringEqual(subSurfaceType, "GlassDoor")) {
1296 8158 result = true;
1297 }
1298
1299 10200 return result;
1300 10200 }
1301
1302 4402 boost::optional<DaylightingDeviceShelf> SubSurface_Impl::daylightingDeviceShelf() const {
1303 4402 boost::optional<DaylightingDeviceShelf> result;
1304
1305 std::vector<DaylightingDeviceShelf> shelves =
1306
3/3
✓ Branch 1 taken 4402 times.
✓ Branch 4 taken 4402 times.
✓ Branch 7 taken 4402 times.
4402 getObject<ModelObject>().getModelObjectSources<DaylightingDeviceShelf>(DaylightingDeviceShelf::iddObjectType());
1307
2/2
✓ Branch 1 taken 26 times.
✓ Branch 2 taken 4376 times.
4402 if (shelves.size() == 1) {
1308
1/1
✓ Branch 2 taken 26 times.
26 result = shelves[0];
1309
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4376 times.
4376 } else if (shelves.size() > 1) {
1310 ✗ result = shelves[0];
1311 }
1312 8804 return result;
1313 4402 }
1314
1315 11 boost::optional<DaylightingDeviceShelf> SubSurface_Impl::addDaylightingDeviceShelf() const {
1316 11 boost::optional<DaylightingDeviceShelf> result = this->daylightingDeviceShelf();
1317
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 3 times.
11 if (result) {
1318 8 return result;
1319 }
1320
1321
3/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 2 times.
3 if (allowDaylightingDeviceShelf()) {
1322 try {
1323
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 result = DaylightingDeviceShelf(getObject<SubSurface>());
1324 ✗ } catch (const std::exception&) {
1325 ✗ }
1326 }
1327
1328 3 return result;
1329 ✗ }
1330
1331 10200 bool SubSurface_Impl::allowDaylightingDeviceTubularDome() const {
1332 10200 bool result = false;
1333
1334
1/1
✓ Branch 1 taken 10200 times.
10200 std::string subSurfaceType = this->subSurfaceType();
1335
4/4
✓ Branch 1 taken 10200 times.
✓ Branch 4 taken 10200 times.
✓ Branch 7 taken 14 times.
✓ Branch 8 taken 10186 times.
20400 if (istringEqual(subSurfaceType, "TubularDaylightDome")) {
1336 14 result = true;
1337 }
1338
1339 10200 return result;
1340 10200 }
1341
1342 10198 bool SubSurface_Impl::allowDaylightingDeviceTubularDiffuser() const {
1343 10198 bool result = false;
1344
1345
1/1
✓ Branch 1 taken 10198 times.
10198 std::string subSurfaceType = this->subSurfaceType();
1346
4/4
✓ Branch 1 taken 10198 times.
✓ Branch 4 taken 10198 times.
✓ Branch 7 taken 14 times.
✓ Branch 8 taken 10184 times.
20396 if (istringEqual(subSurfaceType, "TubularDaylightDiffuser")) {
1347 14 result = true;
1348 }
1349
1350 10198 return result;
1351 10198 }
1352
1353 22606 boost::optional<DaylightingDeviceTubular> SubSurface_Impl::daylightingDeviceTubular() const {
1354 22606 boost::optional<DaylightingDeviceTubular> result;
1355
1356 std::vector<DaylightingDeviceTubular> tubulars =
1357
3/3
✓ Branch 1 taken 22606 times.
✓ Branch 4 taken 22606 times.
✓ Branch 7 taken 22606 times.
22606 getObject<ModelObject>().getModelObjectSources<DaylightingDeviceTubular>(DaylightingDeviceTubular::iddObjectType());
1358
2/2
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 22594 times.
22606 if (tubulars.size() == 1) {
1359
1/1
✓ Branch 2 taken 12 times.
12 result = tubulars[0];
1360
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 22594 times.
22594 } else if (tubulars.size() > 1) {
1361 ✗ result = tubulars[0];
1362 }
1363 45212 return result;
1364 22606 }
1365
1366 10204 bool SubSurface_Impl::allowDaylightingDeviceLightWell() const {
1367 10204 bool result = false;
1368
1369
1/1
✓ Branch 1 taken 10204 times.
10204 std::string subSurfaceType = this->subSurfaceType();
1370
11/21
✓ Branch 1 taken 10204 times.
✓ Branch 4 taken 2348 times.
✓ Branch 7 taken 2348 times.
✓ Branch 9 taken 2074 times.
✓ Branch 10 taken 274 times.
✓ Branch 12 taken 2348 times.
✓ Branch 13 taken 7856 times.
✓ Branch 14 taken 10204 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 10204 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 8160 times.
✓ Branch 20 taken 2044 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
35308 if (istringEqual(subSurfaceType, "FixedWindow") || istringEqual(subSurfaceType, "OperableWindow")
1371
13/17
✓ Branch 1 taken 10204 times.
✓ Branch 3 taken 2348 times.
✓ Branch 4 taken 7856 times.
✓ Branch 6 taken 2074 times.
✓ Branch 9 taken 2074 times.
✓ Branch 11 taken 30 times.
✓ Branch 12 taken 2044 times.
✓ Branch 13 taken 2074 times.
✓ Branch 14 taken 8130 times.
✓ Branch 16 taken 2074 times.
✓ Branch 17 taken 8130 times.
✓ Branch 18 taken 2348 times.
✓ Branch 19 taken 7856 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
24830 || istringEqual(subSurfaceType, "GlassDoor")) {
1372 8160 result = true;
1373 }
1374
1375 10204 return result;
1376 10204 }
1377
1378 4279 boost::optional<DaylightingDeviceLightWell> SubSurface_Impl::daylightingDeviceLightWell() const {
1379 4279 boost::optional<DaylightingDeviceLightWell> result;
1380
1381 std::vector<DaylightingDeviceLightWell> lightwells =
1382
3/3
✓ Branch 1 taken 4279 times.
✓ Branch 4 taken 4279 times.
✓ Branch 7 taken 4279 times.
4279 getObject<ModelObject>().getModelObjectSources<DaylightingDeviceLightWell>(DaylightingDeviceLightWell::iddObjectType());
1383
2/2
✓ Branch 1 taken 20 times.
✓ Branch 2 taken 4259 times.
4279 if (lightwells.size() == 1) {
1384
1/1
✓ Branch 2 taken 20 times.
20 result = lightwells[0];
1385
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4259 times.
4259 } else if (lightwells.size() > 1) {
1386 ✗ result = lightwells[0];
1387 }
1388 8558 return result;
1389 4279 }
1390
1391 12 boost::optional<DaylightingDeviceLightWell> SubSurface_Impl::addDaylightingDeviceLightWell() const {
1392 12 boost::optional<DaylightingDeviceLightWell> result = this->daylightingDeviceLightWell();
1393
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
12 if (result) {
1394 8 return result;
1395 }
1396
1397
3/3
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 3 times.
4 if (allowDaylightingDeviceLightWell()) {
1398 try {
1399
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 result = DaylightingDeviceLightWell(getObject<SubSurface>());
1400 ✗ } catch (const std::exception&) {
1401 ✗ }
1402 }
1403
1404 4 return result;
1405 ✗ }
1406
1407 ✗ boost::optional<ModelObject> SubSurface_Impl::surfaceAsModelObject() const {
1408 ✗ OptionalModelObject result;
1409 ✗ OptionalSurface intermediate = surface();
1410 ✗ if (intermediate) {
1411 ✗ result = *intermediate;
1412 }
1413 ✗ return result;
1414 ✗ }
1415
1416 ✗ boost::optional<ModelObject> SubSurface_Impl::adjacentSubSurfaceAsModelObject() const {
1417 ✗ OptionalModelObject result;
1418 ✗ OptionalSubSurface intermediate = adjacentSubSurface();
1419 ✗ if (intermediate) {
1420 ✗ result = *intermediate;
1421 }
1422 ✗ return result;
1423 ✗ }
1424
1425 ✗ bool SubSurface_Impl::setSurfaceAsModelObject(const boost::optional<ModelObject>& modelObject) {
1426 ✗ if (modelObject) {
1427 ✗ OptionalSurface intermediate = modelObject->optionalCast<Surface>();
1428 ✗ if (intermediate) {
1429 ✗ return setSurface(*intermediate);
1430 }
1431 ✗ }
1432 ✗ return false;
1433 }
1434
1435 ✗ bool SubSurface_Impl::setAdjacentSubSurfaceAsModelObject(const boost::optional<ModelObject>& modelObject) {
1436 ✗ if (modelObject) {
1437 ✗ OptionalSubSurface intermediate = modelObject->optionalCast<SubSurface>();
1438 ✗ if (intermediate) {
1439 ✗ return setAdjacentSubSurface(*intermediate);
1440 } else {
1441 ✗ return false;
1442 }
1443 ✗ } else {
1444 ✗ resetAdjacentSubSurface();
1445 }
1446 ✗ return true;
1447 }
1448
1449 1 AirflowNetworkSurface SubSurface_Impl::getAirflowNetworkSurface(const AirflowNetworkComponent& surfaceAirflowLeakage) {
1450
1/1
✓ Branch 1 taken 1 time.
1 boost::optional<AirflowNetworkSurface> result = airflowNetworkSurface();
1451
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (result) {
1452 ✗ boost::optional<AirflowNetworkComponent> leakageComponent = result->leakageComponent();
1453 ✗ if (leakageComponent) {
1454 ✗ if (leakageComponent->handle() == surfaceAirflowLeakage.handle()) {
1455 ✗ return result.get();
1456 } else {
1457 ✗ result->remove();
1458 }
1459 } else {
1460 ✗ result->remove();
1461 }
1462 ✗ }
1463
1464
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 return AirflowNetworkSurface(this->model(), surfaceAirflowLeakage.handle(), this->handle());
1465 1 }
1466
1467 7 boost::optional<AirflowNetworkSurface> SubSurface_Impl::airflowNetworkSurface() const {
1468 std::vector<AirflowNetworkSurface> myAFNSurfs =
1469
3/3
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
7 getObject<ModelObject>().getModelObjectSources<AirflowNetworkSurface>(AirflowNetworkSurface::iddObjectType());
1470
1/1
✓ Branch 1 taken 7 times.
7 boost::optional<SubSurface> other = adjacentSubSurface();
1471
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 4 times.
7 if (other) {
1472 std::vector<AirflowNetworkSurface> adjAFNSurfs =
1473
2/2
✓ Branch 1 taken 3 times.
✓ Branch 6 taken 3 times.
6 other.get().getImpl<detail::SubSurface_Impl>()->getObject<ModelObject>().getModelObjectSources<AirflowNetworkSurface>(
1474
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 AirflowNetworkSurface::iddObjectType());
1475
1/1
✓ Branch 5 taken 3 times.
3 myAFNSurfs.insert(myAFNSurfs.end(), adjAFNSurfs.begin(), adjAFNSurfs.end());
1476 3 }
1477 7 auto count = myAFNSurfs.size();
1478
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 4 times.
7 if (count == 1) {
1479
1/1
✓ Branch 2 taken 3 times.
3 return myAFNSurfs[0];
1480
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 } else if (count > 1) {
1481 ✗ LOG(Warn, briefDescription() << " has more than one AirflowNetwork Surface attached, returning first.");
1482 ✗ return myAFNSurfs[0];
1483 }
1484 4 return boost::none;
1485 7 }
1486
1487 2 boost::optional<double> SubSurface_Impl::assemblyUFactor() const {
1488
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
4 return getExteriorFenestrationValue("Assembly U-Factor");
1489 }
1490
1491 2 boost::optional<double> SubSurface_Impl::assemblySHGC() const {
1492
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
4 return getExteriorFenestrationValue("Assembly SHGC");
1493 }
1494
1495 2 boost::optional<double> SubSurface_Impl::assemblyVisibleTransmittance() const {
1496
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
4 return getExteriorFenestrationValue("Assembly Visible Transmittance");
1497 }
1498
1499 /** Gets the fenestration value from the sql file **/
1500 6 boost::optional<double> SubSurface_Impl::getExteriorFenestrationValue(std::string columnName) const {
1501 6 boost::optional<double> result;
1502
1503 // Get the object name
1504
2/3
✓ Branch 1 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6 times.
6 if (!name()) {
1505 ✗ LOG(Warn, "This object does not have a name, cannot retrieve the fenestration value '" + columnName + "'.");
1506 ✗ return result;
1507 }
1508
1509 // Get the object name and transform to the way it is recorded
1510 // in the sql file
1511
3/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
6 std::string rowName = name().get();
1512
1/1
✓ Branch 2 taken 6 times.
6 boost::to_upper(rowName);
1513
1514 // Check that the model has a sql file
1515
3/4
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6 times.
6 if (!model().sqlFile()) {
1516 ✗ LOG(Warn, "This model has no sql file, cannot retrieve the fenestration value '" + columnName + "'.");
1517 ✗ return result;
1518 }
1519
1520
1/1
✓ Branch 1 taken 6 times.
6 std::string s = R"(SELECT Value FROM TabularDataWithStrings
1521 WHERE ReportName='EnvelopeSummary'
1522 AND ReportForString='Entire Facility'
1523 AND TableName='Exterior Fenestration'
1524 AND RowName=?
1525 AND ColumnName=?)";
1526
1527
4/4
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
6 result = model().sqlFile().get().execAndReturnFirstDouble(s, rowName, columnName);
1528
1529 6 return result;
1530 6 }
1531
1532 } // namespace detail
1533
1534 3847 SubSurface::SubSurface(const std::vector<Point3d>& vertices, const Model& model) : PlanarSurface(SubSurface::iddObjectType(), vertices, model) {
1535
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 3844 times.
✗ Branch 5 not taken.
3844 OS_ASSERT(getImpl<detail::SubSurface_Impl>());
1536
1/1
✓ Branch 1 taken 3844 times.
3844 resetSubSurfaceType();
1537 3844 }
1538
1539 22645 IddObjectType SubSurface::iddObjectType() {
1540
1/1
✓ Branch 1 taken 22645 times.
22645 IddObjectType result(IddObjectType::OS_SubSurface);
1541 22645 return result;
1542 }
1543
1544 ✗ std::vector<std::string> SubSurface::validSubSurfaceTypeValues() {
1545 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_SubSurfaceFields::SubSurfaceType);
1546 }
1547
1548 6561 std::string SubSurface::subSurfaceType() const {
1549
1/1
✓ Branch 3 taken 6561 times.
6561 return getImpl<detail::SubSurface_Impl>()->subSurfaceType();
1550 }
1551
1552 ✗ bool SubSurface::isSubSurfaceTypeDefaulted() const {
1553 ✗ return getImpl<detail::SubSurface_Impl>()->isSubSurfaceTypeDefaulted();
1554 }
1555
1556 408 boost::optional<double> SubSurface::viewFactortoGround() const {
1557
1/1
✓ Branch 3 taken 408 times.
408 return getImpl<detail::SubSurface_Impl>()->viewFactortoGround();
1558 }
1559
1560 ✗ bool SubSurface::isViewFactortoGroundDefaulted() const {
1561 ✗ return getImpl<detail::SubSurface_Impl>()->isViewFactortoGroundDefaulted();
1562 }
1563
1564 1 bool SubSurface::isViewFactortoGroundAutocalculated() const {
1565
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::SubSurface_Impl>()->isViewFactortoGroundAutocalculated();
1566 }
1567
1568 ✗ bool SubSurface::allowShadingControl() const {
1569 ✗ return getImpl<detail::SubSurface_Impl>()->allowShadingControl();
1570 }
1571
1572 16 std::vector<ShadingControl> SubSurface::shadingControls() const {
1573
1/1
✓ Branch 3 taken 16 times.
16 return getImpl<detail::SubSurface_Impl>()->shadingControls();
1574 }
1575
1576 14 unsigned int SubSurface::numberofShadingControls() const {
1577
1/1
✓ Branch 3 taken 14 times.
14 return getImpl<detail::SubSurface_Impl>()->numberofShadingControls();
1578 }
1579
1580 10 bool SubSurface::allowWindowPropertyFrameAndDivider() const {
1581
1/1
✓ Branch 3 taken 10 times.
10 return getImpl<detail::SubSurface_Impl>()->allowWindowPropertyFrameAndDivider();
1582 }
1583
1584 1216 boost::optional<WindowPropertyFrameAndDivider> SubSurface::windowPropertyFrameAndDivider() const {
1585
1/1
✓ Branch 3 taken 1216 times.
1216 return getImpl<detail::SubSurface_Impl>()->windowPropertyFrameAndDivider();
1586 }
1587
1588 1782 double SubSurface::multiplier() const {
1589
1/1
✓ Branch 3 taken 1782 times.
1782 return getImpl<detail::SubSurface_Impl>()->multiplier();
1590 }
1591
1592 408 bool SubSurface::isMultiplierDefaulted() const {
1593
1/1
✓ Branch 3 taken 408 times.
408 return getImpl<detail::SubSurface_Impl>()->isMultiplierDefaulted();
1594 }
1595
1596 ✗ boost::optional<double> SubSurface::numberofVertices() const {
1597 ✗ return getImpl<detail::SubSurface_Impl>()->numberofVertices();
1598 }
1599
1600 ✗ bool SubSurface::isNumberofVerticesDefaulted() const {
1601 ✗ return getImpl<detail::SubSurface_Impl>()->isNumberofVerticesDefaulted();
1602 }
1603
1604 1 bool SubSurface::isNumberofVerticesAutocalculated() const {
1605
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::SubSurface_Impl>()->isNumberofVerticesAutocalculated();
1606 }
1607
1608 2641 bool SubSurface::setSubSurfaceType(const std::string& subSurfaceType) {
1609
1/1
✓ Branch 3 taken 2641 times.
2641 return getImpl<detail::SubSurface_Impl>()->setSubSurfaceType(subSurfaceType);
1610 }
1611
1612 3844 void SubSurface::resetSubSurfaceType() {
1613
1/1
✓ Branch 3 taken 3844 times.
3844 getImpl<detail::SubSurface_Impl>()->resetSubSurfaceType();
1614 3844 }
1615
1616 ✗ bool SubSurface::setViewFactortoGround(boost::optional<double> viewFactortoGround) {
1617 ✗ return getImpl<detail::SubSurface_Impl>()->setViewFactortoGround(viewFactortoGround);
1618 }
1619
1620 1 bool SubSurface::setViewFactortoGround(double viewFactortoGround) {
1621
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::SubSurface_Impl>()->setViewFactortoGround(viewFactortoGround);
1622 }
1623
1624 ✗ void SubSurface::resetViewFactortoGround() {
1625 ✗ getImpl<detail::SubSurface_Impl>()->resetViewFactortoGround();
1626 ✗ }
1627
1628 1 void SubSurface::autocalculateViewFactortoGround() {
1629
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::SubSurface_Impl>()->autocalculateViewFactortoGround();
1630 1 }
1631
1632 94 bool SubSurface::setMultiplier(double multiplier) {
1633
1/1
✓ Branch 3 taken 94 times.
94 return getImpl<detail::SubSurface_Impl>()->setMultiplier(multiplier);
1634 }
1635
1636 2 void SubSurface::resetMultiplier() {
1637
1/1
✓ Branch 3 taken 2 times.
2 getImpl<detail::SubSurface_Impl>()->resetMultiplier();
1638 2 }
1639
1640 ✗ bool SubSurface::setNumberofVertices(boost::optional<double> numberofVertices) {
1641 ✗ return getImpl<detail::SubSurface_Impl>()->setNumberofVertices(numberofVertices);
1642 }
1643
1644 ✗ bool SubSurface::setNumberofVertices(double numberofVertices) {
1645 ✗ return getImpl<detail::SubSurface_Impl>()->setNumberofVertices(numberofVertices);
1646 }
1647
1648 ✗ void SubSurface::resetNumberofVertices() {
1649 ✗ getImpl<detail::SubSurface_Impl>()->resetNumberofVertices();
1650 ✗ }
1651
1652 1 void SubSurface::autocalculateNumberofVertices() {
1653
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::SubSurface_Impl>()->autocalculateNumberofVertices();
1654 1 }
1655
1656 12 bool SubSurface::addShadingControl(ShadingControl& shadingControl) {
1657
1/1
✓ Branch 3 taken 12 times.
12 return getImpl<detail::SubSurface_Impl>()->addShadingControl(shadingControl);
1658 }
1659
1660 2 bool SubSurface::addShadingControls(std::vector<ShadingControl>& shadingControls) {
1661
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::SubSurface_Impl>()->addShadingControls(shadingControls);
1662 }
1663
1664 3 void SubSurface::removeShadingControl(ShadingControl& shadingControl) {
1665
1/1
✓ Branch 3 taken 3 times.
3 getImpl<detail::SubSurface_Impl>()->removeShadingControl(shadingControl);
1666 3 }
1667
1668 208 void SubSurface::removeAllShadingControls() {
1669
1/1
✓ Branch 3 taken 208 times.
208 getImpl<detail::SubSurface_Impl>()->removeAllShadingControls();
1670 208 }
1671
1672 41 bool SubSurface::setWindowPropertyFrameAndDivider(const WindowPropertyFrameAndDivider& windowPropertyFrameAndDivider) {
1673
1/1
✓ Branch 3 taken 41 times.
41 return getImpl<detail::SubSurface_Impl>()->setWindowPropertyFrameAndDivider(windowPropertyFrameAndDivider);
1674 }
1675
1676 1 void SubSurface::resetWindowPropertyFrameAndDivider() {
1677
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::SubSurface_Impl>()->resetWindowPropertyFrameAndDivider();
1678 1 }
1679
1680 5228 boost::optional<Surface> SubSurface::surface() const {
1681
1/1
✓ Branch 3 taken 5228 times.
5228 return getImpl<detail::SubSurface_Impl>()->surface();
1682 }
1683
1684 3806 bool SubSurface::setSurface(const Surface& surface) {
1685
1/1
✓ Branch 3 taken 3806 times.
3806 return getImpl<detail::SubSurface_Impl>()->setSurface(surface);
1686 }
1687
1688 4562 boost::optional<SubSurface> SubSurface::adjacentSubSurface() const {
1689
1/1
✓ Branch 3 taken 4562 times.
4562 return getImpl<detail::SubSurface_Impl>()->adjacentSubSurface();
1690 }
1691
1692 209 bool SubSurface::setAdjacentSubSurface(SubSurface& subSurface) {
1693
1/1
✓ Branch 3 taken 209 times.
209 return getImpl<detail::SubSurface_Impl>()->setAdjacentSubSurface(subSurface);
1694 }
1695
1696 479 void SubSurface::resetAdjacentSubSurface() {
1697
1/1
✓ Branch 3 taken 479 times.
479 getImpl<detail::SubSurface_Impl>()->resetAdjacentSubSurface();
1698 479 }
1699
1700 413 boost::optional<SurfacePropertyConvectionCoefficients> SubSurface::surfacePropertyConvectionCoefficients() const {
1701
1/1
✓ Branch 3 taken 413 times.
413 return getImpl<detail::SubSurface_Impl>()->surfacePropertyConvectionCoefficients();
1702 }
1703
1704 414 boost::optional<SurfacePropertyLocalEnvironment> SubSurface::surfacePropertyLocalEnvironment() const {
1705
1/1
✓ Branch 3 taken 414 times.
414 return getImpl<detail::SubSurface_Impl>()->surfacePropertyLocalEnvironment();
1706 }
1707
1708 410 boost::optional<SurfacePropertyIncidentSolarMultiplier> SubSurface::surfacePropertyIncidentSolarMultiplier() const {
1709
1/1
✓ Branch 3 taken 410 times.
410 return getImpl<detail::SubSurface_Impl>()->surfacePropertyIncidentSolarMultiplier();
1710 }
1711
1712 411 boost::optional<SurfacePropertyOtherSideCoefficients> SubSurface::surfacePropertyOtherSideCoefficients() const {
1713
1/1
✓ Branch 3 taken 411 times.
411 return getImpl<detail::SubSurface_Impl>()->surfacePropertyOtherSideCoefficients();
1714 }
1715
1716 1 bool SubSurface::setSurfacePropertyOtherSideCoefficients(const SurfacePropertyOtherSideCoefficients& otherSideCoefficients) {
1717
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::SubSurface_Impl>()->setSurfacePropertyOtherSideCoefficients(otherSideCoefficients);
1718 }
1719
1720 34 void SubSurface::resetSurfacePropertyOtherSideCoefficients() {
1721
1/1
✓ Branch 3 taken 34 times.
34 return getImpl<detail::SubSurface_Impl>()->resetSurfacePropertyOtherSideCoefficients();
1722 }
1723
1724 411 boost::optional<SurfacePropertyOtherSideConditionsModel> SubSurface::surfacePropertyOtherSideConditionsModel() const {
1725
1/1
✓ Branch 3 taken 411 times.
411 return getImpl<detail::SubSurface_Impl>()->surfacePropertyOtherSideConditionsModel();
1726 }
1727
1728 1 bool SubSurface::setSurfacePropertyOtherSideConditionsModel(const SurfacePropertyOtherSideConditionsModel& otherSideModel) {
1729
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::SubSurface_Impl>()->setSurfacePropertyOtherSideConditionsModel(otherSideModel);
1730 }
1731
1732 34 void SubSurface::resetSurfacePropertyOtherSideConditionsModel() {
1733
1/1
✓ Branch 3 taken 34 times.
34 return getImpl<detail::SubSurface_Impl>()->resetSurfacePropertyOtherSideConditionsModel();
1734 }
1735
1736 12 void SubSurface::assignDefaultSubSurfaceType() {
1737
1/1
✓ Branch 3 taken 12 times.
12 getImpl<detail::SubSurface_Impl>()->assignDefaultSubSurfaceType();
1738 12 }
1739
1740 9 std::string SubSurface::outsideBoundaryCondition() const {
1741
1/1
✓ Branch 3 taken 9 times.
9 return getImpl<detail::SubSurface_Impl>()->outsideBoundaryCondition();
1742 }
1743
1744 ✗ boost::optional<ShadingSurface> SubSurface::addOverhang(double depth, double offset) {
1745 ✗ return getImpl<detail::SubSurface_Impl>()->addOverhang(depth, offset);
1746 }
1747
1748 168 boost::optional<ShadingSurface> SubSurface::addOverhangByProjectionFactor(double projectionFactor, double offsetFraction) {
1749
1/1
✓ Branch 3 taken 168 times.
168 return getImpl<detail::SubSurface_Impl>()->addOverhangByProjectionFactor(projectionFactor, offsetFraction);
1750 }
1751
1752 266 std::vector<ShadingSurfaceGroup> SubSurface::shadingSurfaceGroups() const {
1753
1/1
✓ Branch 3 taken 266 times.
266 return getImpl<detail::SubSurface_Impl>()->shadingSurfaceGroups();
1754 }
1755
1756 7 bool SubSurface::allowDaylightingDeviceShelf() const {
1757
1/1
✓ Branch 3 taken 7 times.
7 return getImpl<detail::SubSurface_Impl>()->allowDaylightingDeviceShelf();
1758 }
1759
1760 144 boost::optional<DaylightingDeviceShelf> SubSurface::daylightingDeviceShelf() const {
1761
1/1
✓ Branch 3 taken 144 times.
144 return getImpl<detail::SubSurface_Impl>()->daylightingDeviceShelf();
1762 }
1763
1764 11 boost::optional<DaylightingDeviceShelf> SubSurface::addDaylightingDeviceShelf() const {
1765
1/1
✓ Branch 3 taken 11 times.
11 return getImpl<detail::SubSurface_Impl>()->addDaylightingDeviceShelf();
1766 }
1767
1768 10 bool SubSurface::allowDaylightingDeviceTubularDome() const {
1769
1/1
✓ Branch 3 taken 10 times.
10 return getImpl<detail::SubSurface_Impl>()->allowDaylightingDeviceTubularDome();
1770 }
1771
1772 8 bool SubSurface::allowDaylightingDeviceTubularDiffuser() const {
1773
1/1
✓ Branch 3 taken 8 times.
8 return getImpl<detail::SubSurface_Impl>()->allowDaylightingDeviceTubularDiffuser();
1774 }
1775
1776 30 boost::optional<DaylightingDeviceTubular> SubSurface::daylightingDeviceTubular() const {
1777
1/1
✓ Branch 3 taken 30 times.
30 return getImpl<detail::SubSurface_Impl>()->daylightingDeviceTubular();
1778 }
1779
1780 10 bool SubSurface::allowDaylightingDeviceLightWell() const {
1781
1/1
✓ Branch 3 taken 10 times.
10 return getImpl<detail::SubSurface_Impl>()->allowDaylightingDeviceLightWell();
1782 }
1783
1784 20 boost::optional<DaylightingDeviceLightWell> SubSurface::daylightingDeviceLightWell() const {
1785
1/1
✓ Branch 3 taken 20 times.
20 return getImpl<detail::SubSurface_Impl>()->daylightingDeviceLightWell();
1786 }
1787
1788 12 boost::optional<DaylightingDeviceLightWell> SubSurface::addDaylightingDeviceLightWell() const {
1789
1/1
✓ Branch 3 taken 12 times.
12 return getImpl<detail::SubSurface_Impl>()->addDaylightingDeviceLightWell();
1790 }
1791
1792 /// @cond
1793
1/1
✓ Branch 3 taken 89043 times.
89043 SubSurface::SubSurface(std::shared_ptr<detail::SubSurface_Impl> impl) : PlanarSurface(std::move(impl)) {}
1794
1795 // DEPRECATED
1796 11 boost::optional<ShadingControl> SubSurface::shadingControl() const {
1797
5/5
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✓ Branch 10 taken 11 times.
✓ Branch 13 taken 11 times.
44 DEPRECATED_AT_MSG(3, 1, 0, "Use shadingControls() instead.");
1798 11 boost::optional<ShadingControl> result;
1799
1/1
✓ Branch 1 taken 11 times.
11 auto scs = shadingControls();
1800
2/2
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 2 times.
11 if (!scs.empty()) {
1801
2/2
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 8 times.
9 if (scs.size() > 1) {
1802
7/7
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 14 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 20 taken 1 time.
1 LOG(Warn, briefDescription() << " has more than one ShadingControl and you're using a deprecated method. Use shadingControls() instead");
1803 }
1804
1/1
✓ Branch 2 taken 9 times.
9 result = scs[0];
1805 }
1806 22 return result;
1807 11 }
1808
1809 // DEPRECATED
1810 5 bool SubSurface::setShadingControl(const ShadingControl& shadingControl) {
1811
5/5
✓ 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.
20 DEPRECATED_AT_MSG(3, 1, 0, "Use addShadingControl or addShadingControls instead.");
1812
1/1
✓ Branch 1 taken 5 times.
5 removeAllShadingControls();
1813
1/1
✓ Branch 1 taken 5 times.
10 return addShadingControl(const_cast<ShadingControl&>(shadingControl));
1814 }
1815
1816 // DEPRECATED
1817 1 void SubSurface::resetShadingControl() {
1818
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, 1, 0, "Use removeAllShadingControls instead.");
1819
1/1
✓ Branch 1 taken 1 time.
1 removeAllShadingControls();
1820 1 }
1821
1822 768 std::vector<Point3d> SubSurface::roughOpeningVertices() const {
1823
3/3
✓ Branch 1 taken 768 times.
✓ Branch 3 taken 15 times.
✓ Branch 4 taken 753 times.
1536 if (auto frameAndDivider = windowPropertyFrameAndDivider()) {
1824
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 double fw = frameAndDivider->frameWidth();
1825 // Get a transform to change the points to x/y
1826
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 Transformation faceTransform = Transformation::alignFace(this->vertices());
1827
3/3
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
✓ Branch 7 taken 15 times.
15 std::vector<Point3d> faceVertices = faceTransform.inverse() * this->vertices();
1828 // Offset the points by the framewidth
1829
1/1
✓ Branch 1 taken 15 times.
15 boost::optional<std::vector<Point3d>> offset = openstudio::buffer(faceVertices, fw, 0.01);
1830
1/2
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
15 if (!offset) {
1831 // If offset failed it is because the points are in the wrong order
1832 // If it fails again then something went awry with boost::buffer
1833
1/1
✓ Branch 1 taken 15 times.
15 faceVertices = openstudio::reverse(faceVertices);
1834
1/1
✓ Branch 1 taken 15 times.
15 offset = openstudio::buffer(faceVertices, fw, 0.01);
1835
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
15 if (!offset) {
1836 ✗ return this->vertices();
1837 }
1838 }
1839
1840
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 std::vector<Point3d> roughOpeningVertices = faceTransform * offset.get();
1841 15 return roughOpeningVertices;
1842 783 }
1843
1844 753 return this->vertices();
1845 }
1846
1847 726 double SubSurface::roughOpeningArea() const {
1848
3/4
✓ Branch 1 taken 726 times.
✓ Branch 4 taken 726 times.
✓ Branch 8 taken 726 times.
✗ Branch 9 not taken.
1452 if (boost::optional<double> area = openstudio::getArea(roughOpeningVertices())) {
1849
1/1
✓ Branch 1 taken 726 times.
726 return area.get();
1850 }
1851
1852 ✗ return grossArea();
1853 }
1854
1855 1 double SubSurface::frameArea() const {
1856 1 double roughOpeningArea = this->roughOpeningArea();
1857 1 return roughOpeningArea - grossArea();
1858 }
1859
1860 1 double SubSurface::dividerArea() const {
1861 1 double divArea = 0;
1862
2/3
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
2 if (auto frameAndDivider = windowPropertyFrameAndDivider()) {
1863
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 double dividerWidth = frameAndDivider->dividerWidth();
1864
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (dividerWidth == 0) {
1865 ✗ return divArea;
1866 }
1867
1868
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 Transformation faceTransform = Transformation::alignFace(this->vertices());
1869
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 std::vector<Point3d> faceVertices = faceTransform.inverse() * this->vertices();
1870 1 BoundingBox bb;
1871
1/1
✓ Branch 1 taken 1 time.
1 bb.addPoints(faceVertices);
1872
1873
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 double numHorizDividers = frameAndDivider->numberOfHorizontalDividers();
1874
6/10
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
✓ Branch 9 taken 1 time.
✓ Branch 12 taken 1 time.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 time.
✗ Branch 15 not taken.
1 if (numHorizDividers != 0 && bb.maxX().has_value() && bb.minX().has_value()) {
1875
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 divArea += numHorizDividers * dividerWidth * (*bb.maxX() - *bb.minX());
1876 }
1877
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 double numVertDividers = frameAndDivider->numberOfVerticalDividers();
1878
6/10
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
✓ Branch 9 taken 1 time.
✓ Branch 12 taken 1 time.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 time.
✗ Branch 15 not taken.
1 if (numVertDividers != 0 && bb.maxY().has_value() && bb.minY().has_value()) {
1879
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 divArea += numVertDividers * dividerWidth * (*bb.maxY() - *bb.minY());
1880 }
1881 2 }
1882 1 return divArea;
1883 }
1884
1885 /// @endcond
1886
1887 8 std::vector<SubSurface> applySkylightPattern(const std::vector<std::vector<Point3d>>& pattern, const std::vector<Space>& spaces,
1888 const boost::optional<ConstructionBase>& construction) {
1889 8 double inset = 0.0254;
1890
1891 8 std::vector<SubSurface> result;
1892
1893
2/2
✓ Branch 5 taken 8 times.
✓ Branch 6 taken 8 times.
16 for (const Space& space : spaces) {
1894
1895
2/3
✓ Branch 1 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
8 if (space.isPlenum()) {
1896 ✗ LOG_FREE(Warn, "OpenStudio.applySkylightPattern", "Cannot apply skylights to plenum space");
1897 ✗ continue;
1898 ✗ }
1899
1900
1/1
✓ Branch 1 taken 8 times.
8 Transformation transformation = space.buildingTransformation();
1901
1/1
✓ Branch 1 taken 8 times.
8 Transformation inverseTransformation = transformation.inverse();
1902
1903 8 std::vector<std::vector<Point3d>> spacePattern;
1904
1/1
✓ Branch 2 taken 8 times.
8 spacePattern.reserve(pattern.size());
1905
2/2
✓ Branch 4 taken 272 times.
✓ Branch 5 taken 8 times.
280 for (const std::vector<Point3d>& face : pattern) {
1906
2/2
✓ Branch 1 taken 272 times.
✓ Branch 4 taken 272 times.
272 spacePattern.push_back(inverseTransformation * face);
1907 }
1908
1909
3/3
✓ Branch 1 taken 8 times.
✓ Branch 8 taken 40 times.
✓ Branch 9 taken 8 times.
48 for (Surface& surface : space.surfaces()) {
1910
15/36
✓ Branch 1 taken 40 times.
✓ Branch 4 taken 40 times.
✓ Branch 7 taken 40 times.
✓ Branch 9 taken 40 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 40 times.
✓ Branch 15 taken 40 times.
✓ Branch 18 taken 40 times.
✓ Branch 20 taken 40 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 40 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 40 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 40 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 40 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 40 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 40 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 40 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
200 if (istringEqual("RoofCeiling", surface.surfaceType()) && istringEqual("Outdoors", surface.outsideBoundaryCondition())) {
1911
1912
1/1
✓ Branch 1 taken 40 times.
40 Plane surfacePlane = surface.plane();
1913
1914 40 std::vector<std::vector<Point3d>> surfacePattern;
1915
1/1
✓ Branch 2 taken 40 times.
40 spacePattern.reserve(pattern.size());
1916
2/2
✓ Branch 4 taken 1360 times.
✓ Branch 5 taken 40 times.
1400 for (const std::vector<Point3d>& spaceFace : spacePattern) {
1917
2/2
✓ Branch 1 taken 1360 times.
✓ Branch 4 taken 1360 times.
1360 surfacePattern.push_back(surfacePlane.project(spaceFace));
1918 }
1919
1920
1/1
✓ Branch 1 taken 40 times.
40 std::vector<SubSurface> newSkylights = surface.createSubSurfaces(surfacePattern, inset, construction);
1921
1/1
✓ Branch 5 taken 40 times.
40 result.insert(result.end(), newSkylights.begin(), newSkylights.end());
1922 40 }
1923 8 }
1924 8 }
1925
1926 8 return result;
1927 ✗ }
1928
1929 ✗ AirflowNetworkSurface SubSurface::getAirflowNetworkSurface(const AirflowNetworkDetailedOpening& surfaceAirflowLeakage) {
1930 ✗ return getImpl<detail::SubSurface_Impl>()->getAirflowNetworkSurface(surfaceAirflowLeakage);
1931 }
1932
1933 ✗ AirflowNetworkSurface SubSurface::getAirflowNetworkSurface(const AirflowNetworkSimpleOpening& surfaceAirflowLeakage) {
1934 ✗ return getImpl<detail::SubSurface_Impl>()->getAirflowNetworkSurface(surfaceAirflowLeakage);
1935 }
1936
1937 1 AirflowNetworkSurface SubSurface::getAirflowNetworkSurface(const AirflowNetworkCrack& surfaceAirflowLeakage) {
1938
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::SubSurface_Impl>()->getAirflowNetworkSurface(surfaceAirflowLeakage);
1939 }
1940
1941 ✗ AirflowNetworkSurface SubSurface::getAirflowNetworkSurface(const AirflowNetworkEffectiveLeakageArea& surfaceAirflowLeakage) {
1942 ✗ return getImpl<detail::SubSurface_Impl>()->getAirflowNetworkSurface(surfaceAirflowLeakage);
1943 }
1944
1945 ✗ AirflowNetworkSurface SubSurface::getAirflowNetworkSurface(const AirflowNetworkHorizontalOpening& surfaceAirflowLeakage) {
1946 ✗ return getImpl<detail::SubSurface_Impl>()->getAirflowNetworkSurface(surfaceAirflowLeakage);
1947 }
1948
1949 ✗ AirflowNetworkSurface SubSurface::getAirflowNetworkSurface(const AirflowNetworkSpecifiedFlowRate& surfaceAirflowLeakage) {
1950 ✗ return getImpl<detail::SubSurface_Impl>()->getAirflowNetworkSurface(surfaceAirflowLeakage);
1951 }
1952
1953 6 boost::optional<AirflowNetworkSurface> SubSurface::airflowNetworkSurface() const {
1954
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::SubSurface_Impl>()->airflowNetworkSurface();
1955 }
1956
1957 2 boost::optional<double> SubSurface::assemblyUFactor() const {
1958
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::SubSurface_Impl>()->assemblyUFactor();
1959 }
1960
1961 2 boost::optional<double> SubSurface::assemblySHGC() const {
1962
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::SubSurface_Impl>()->assemblySHGC();
1963 }
1964
1965 2 boost::optional<double> SubSurface::assemblyVisibleTransmittance() const {
1966
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::SubSurface_Impl>()->assemblyVisibleTransmittance();
1967 }
1968
1969 } // namespace model
1970 } // namespace openstudio
1971