Introduction

Building design is currently going through a period of considerable changes. With the growing concern over climate change, the depletion of fossil fuel stocks and the increasing attention of the relationship between the indoor environment and occupant health, building design and construction techniques attempt to reduce energy consumption and ensure comfortable indoor environments for occupants (^{BRAGANÇA; MATEUS; KOUKKARI, 2010}; ^{OMER, 2011}; ^{AKADIRI; CHINYIO; OLOMOLAIYE, 2012}). In order to support design decisions for energy efficient buildings, computer simulations have been widely used (^{HENSEN; LAMBERTS, 2011}; ^{KIRIMTAT et al., 2016}).

Building energy models have been used since the late 1960s and are primarily used for sizing heating, ventilating and air conditioning equipment. After the oil crisis in the 1970s, greater attention was devoted to passive and innovative design strategies, which required developing a new generation of building energy simulation (BES) tools (^{JUDKOFF, 1988}). In addition, these tools are currently being promoted around the world by green building certifications, such as LEED (Leadership in Energy and Environmental Design) and BREEAM (Building Research Establishment Environmental Assessment Method) because the verification of the minimum levels of thermal comfort, daylight and energy performance of buildings can be evaluated effectively through computer simulations. Thus, the success of energy-efficient design, labelling, rating and retrofit efforts depends largely on the accuracy of the analysis performed for each task (^{POLLY; KRUIS; ROBERTS, 2011}). As a result, the development, evaluation and standardisation of models and software must be continually reviewed and improved to model more complex and detailed systems.

Direct solar radiation that reaches internal surfaces is one of the factors responsible for thermal gains in a building. As a consequence, a precise simulation of the conditions of direct solar incidence is essential for a good prediction of whole-building energy and thermal performance. Its evaluation requires calculating the sunlit area (A_{sunlit}) that depends on the Sun´s position (provided by azimuth and altitude angles) and obstruction surface geometry (^{ENERGYPLUS, 2016}).

Concerning the distribution of direct solar radiation transmitted through windows, a simplified model is used in most BES tools, which assumes that all solar energy that reaches a floor is evenly distributed over it (^{HENSEN; LAMBERTS, 2011}). For example, one of the methods used by EnergyPlus considers that all solar beam incidence is absorbed according to the solar absorptance of the floor and the portion reflected by the floor is uniformly distributed on all interior surfaces (added to the transmitted diffuse radiation). A simplified method is also used in TRNSYS, known as absorptance-weighted area distribution. From the direct solar radiation entering the window, the user must define the percentage that reaches each internal surface. In fact, as in EnergyPlus, the surface material properties and surface area are the building factors that affect the absorptance-weighted area ratios.

Although a uniform distribution of the solar heat flux on the surfaces may be sufficient for one dimensional calculation models (commonly used in most BES tools), some researchers have shown that the simplification or negligence of the sun patch distribution makes a considerable difference to the simulation results, especially for heating requirements of glazed rooms (^{WALL, 1997}; ^{TITTELEIN, 2008}). A precise sun patch location can refine the calculation of superficial and air temperatures, as well as mapping the mean radiant temperatures for comfort index predictions (^{RODLER, 2014}). Moreover, the improvement of sunlit pattern calculation as a boundary condition is fundamental for the three-dimensional (3D) heat transfer models (^{RODLER et al., 2013}). ^{Rodler, Virgone and Roux (2016)} highlighted the contribution of a 3D thermal model to the sun patch location to evaluate highly insulated and low energy consumption buildings, which are highly sensitive to internal gains.

Taking into account the aforementioned facts, and also because computational resources have been significantly increased over the last decades, some authors have already improved techniques to predict sun patches on building interior surfaces to allow more accurate solar gain calculations. ^{Bouia, Roux and Teodosiu (2002)} presented a method that uses Delaunay triangulation to create a mesh on the surface and, a visibility algorithm to verify if the centre of each triangle can "see" the Sun. Delaunay triangulation can model the sun patch evolution of a room with any kind of geometry, however the refinement of the results varies according to the fineness degree of the mesh, which may lead to high computational costs. ^{Boukhris, Gharbi and Ghrab-Morcos (2014)} proposed a method to be integrated into the ZAER building simulation tool. Firstly, a mesh is created by dividing the interior wall into facets which are then broken down into elementary rectangles. From the barycentre of each rectangle, a ray is directed towards the Sun. The rectangle is considered as sunlit when the ray intercepts the window surface; otherwise it is shaded. The sun patch area on each wall is then calculated by the sum of the irradiated rectangular surfaces. As drawbacks, the model is able to evaluate only rooms of a parallelepiped shape due to the mesh formed by rectangles and, the accuracy of the results depends on the mesh refinement. ^{Kontoleon (2015)} proposed a projection method of the vertices of external windows on the internal surfaces, following the sun rays. The vertices of the glazing are labelled as 1, 2, 3 and 4 and the interior walls as F, L, B and R for floor, left, back and right wall, respectively. Thus, a projected point is defined with a vertex number and a letter called "footprint", which specifies the surface on which it is located. Depending on the particular sequence of footprints, some supplementary points might be required for forming the sunlit area(s). This method can find the exact contour of the sun patch, however it may be time consuming depending on the number of glazing vertices.

Regarding the most used simulation tools, such as ESP-r, TRNSYS and EnergyPlus, the efforts that have been made to improve the simplified techniques of predicting sun patches on building interior surfaces are also remarkable. In ESP-r, a grid is placed on the internal surfaces of the zone and, for each time step, sun rays are projected into the room and the percentage of sunlit points is determined. Although the calculation accuracy is grid dependent, ESP-r can deal with rooms of arbitrary complexity, including all internal surfaces (^{HAND, 2015}). In TRNSYS and EnergyPlus, projection and clipping operations are used for sun patch calculations. Along the sun rays, the sunlit parts of the external windows are projected towards the internal surfaces of the zone and the boundaries of the sunlit parts of the internal surfaces are determined by a clipping algorithm, for example, boundary evaluation and Sutherland-Hodgman algorithms. Although this technique yields exact results (free of approximations), the zone surfaces must be totally enclosed in a space and the zone should be strictly convex (^{HILLER; BECKMAN, 2000}; ^{HILLER, 1996}; ^{ENERGYPLUS, 2016}). Besides, the exactness of the clipping algorithms cannot be guaranteed in practice. In fact, accuracy may be lost due to the geometry of the polygons to be processed. For instance, clipping algorithms may fail due to polygons with colinear edges, degeneracy of vertices, near-straight angles and numerical precision errors. Moreover, the technique may demand a high computational time (sometimes prohibitive), when dealing with geometries with a large number of polygons (^{JONES; GREENBERG; PRATT, 2012}; ^{ROCHA et al., 2017}).

Differently from those methods, pixel counting (PxC), that has already been recognised as a powerful technique for external solar shading calculations due to its efficiency to simulate complex architectural models with low computational costs (^{YEZIORO; SHAVIV, 1994}, ^{JONES; GREENBERG; PRATT, 2012}; ^{ROCHA et al., 2017}) can also be easily extended to be used on interior surfaces. Thus, the technique has been implemented in Domus^{4}, which is a user-friendly software for whole-building hygrothermal and energy simulation, developed by the Thermal Systems Laboratory at the Pontifical Catholic University of Parana - PUCPR (^{MENDES; OLIVEIRA; HENRIQUE, 2003}). The details of the PxC are presented in the next section. The PxC implementation for calculating the external solar shading was already experimentally validated using small-scale mock-ups and its capability in simulating different building shading solutions was discussed in a complex case study, which includes shading from surrounding buildings and shading from vegetation (^{ROCHA et al., 2017}).

In this context, the purpose of this research is to present an application and a comparative validation of the pixel counting technique implemented in Domus software to calculate the sun patch distribution on building interior surfaces, which is fundamental for improving the quality and accuracy of whole-building energy and hygrothermal analysis.

Pixel counting technique

Background

Introduced by ^{Yezioro and Shaviv (1994)}, the pixel counting technique (PxC) can calculate, for each time step of the simulation, the sunlit area on the building envelope through image processing. Instead of performing operations on the polygons associated to the building geometry and obstructions, the technique explores some rendering functionalities available in the graphics cards of computers to determine the sunlit fraction only analysing the pixels (more precisely their colours) associated to two images conveniently constructed. To begin with, the technique renders two images using an orthogonal projection from the vantage point of the Sun, *i.e.*, the eye of the observer is the position of the Sun. The first contains only the building surface under analysis, which is drawn using a specific colour and the second comprises the whole scene, *i.e.*, all building surfaces and possible obstructions, such as shading devices, trees or neighbouring buildings. As a key aspect, the surface under analysis in the second image must be drawn using a different colour from the rest of the building´s surfaces and obstructions. Using the first image, the total number of pixels that represents the whole surface area (*A _{total}*) can be determined; and, using the second image, the number of pixels that are in the sunlit area (

*A*) can be determined. Thus,

_{sunlit}*A*/

_{sunlit}*A*represents the surface sunlit fraction.

_{total}Almost two decades later, ^{Jones, Grenberg and Pratt (2012)} proposed three main modifications to improve the pixel counting approach proposed by ^{Yezioro and Shaviv (1994)}. First, the orthogonal projection is enlarged so that the surface under analysis fills almost the entire display window when rendered. This enlargement can maximise the number of pixels available for counting and, consequently, reduce the effect of pixelation (Figure 1). The second and third modifications are related to how the sunlit fraction is computed. Differently from Yezioro and Shaviv´s approach, which reads the colours of pixels in the frame buffer (twice), this version utilises the values of the z-buffer (also known as the depth buffer) to calculate the number of pixels. Basically, the whole scene except the surface under analysis is drawn and the functionality *occlusion query*, API available in the graphic library, is activated in order to detect the pixels that will be occluded when new geometries are drawn. Thus, the surface under analysis is finally drawn and the occlusion query is finished, providing the number of updated pixels (*N*), *i.e*., the number of pixels lying in the visible area of the surface. To calculate the sunlit area, the area of one pixel (*A _{p}*) is computed by using the data associated to the resolution of the window. Finally, the sunlit area can be given by

*A*multiplied by

_{p}*N*. As a consequence of these improvements, the pixel counting approach was greatly improved, mainly by the hardware accelerated capabilities that were used.

Although the technique is not exact due to the effect of pixelation, the graphics cards available nowadays can work with resolutions where the error arising from pixelation is negligible. ^{Rocha et al. (2017)} evaluated different aspects of PxC algorithms implemented in Domus, including screen resolutions (128x128, 256x256, 512x512, 1024x768), using a complex shading case study. For resolutions greater than 256x256, the results are very similar; the absolute difference is at maximum 0.0046, which may be considered negligible. Besides, the technique had no difficulty in dealing with concave or rounded surfaces and was also capable of dealing with complex double curvature or hollowed surfaces.

Pixel counting in building modelling software

Using the pixel counting approach from ^{Yezioro and Shaviv (1994)}, a SketchUp plug-in was developed, called *SHADING* Tools Plugin, for shading analysis of any given geometry modelled in SketchUp. The calculations of sunlit fraction can be performed for each 15-minute for any period of the year. Unfortunately, the results are not directly connected to any BES software, which would use the sunlit pattern results to predict the building thermal behaviour.

Domus also uses pixel counting for calculating the sunlit fraction and direct solar energy on exterior and interior surfaces, which affect the whole-building energy and thermal performance. The user can choose one of two PxC approaches presented in the previous section, known in Domus as one-phase and two-phases (Figure 2). The two-phase method is based on the technique presented by ^{Yezioro and Shaviv (1994)}; the one-phase approach is based on the procedure proposed by ^{Jones, Greenberg and Pratt (2012)}. Both approaches were implemented in Domus using functionalities available in OpenGL graphic library. The results from PxC (sunlit area) are used to predict different parameters, such as the direct radiation on surfaces and solar heat gain within zones of the building. Additionally, the results of direct solar energy can be coupled to the prediction of photovoltaic and solar collector systems´ performance.

Materials and method

Simulations using PxC implemented in Domus

Two case studies were investigated in order to explore the capabilities of the pixel counting technique implemented in Domus software to calculate the sun patch distribution on interior surfaces. The first case (case 1) is a single zone, with interior dimensions of 3.00 x 2.90 x 2.80 m, and a window of 1.40 x 1.40 m located on the western facade (Figure 3a). The second case (case 2) is a single zone with the same dimensions, but the window has dimensions of 2.70 x 1.40 m with a hollowed shading element called *cobogó* (Figure 3b). Those elements - inspired by moucharaby, a traditional feature from Arabic architecture - were created in 1929 by three people who worked in the building construction sector. They consist of wood grills or lattices installed on the building balconies and windows. The name *cobogó* derives from the three creators' surnames: Amadeu Oliveira COimbra, Ernest August BOeckmann and Antonio de GÓis. Besides the aesthetic function, it provides different sustainable architecture strategies, such as daylight, natural ventilation and exterior views.

The simulations were performed considering the city of Curitiba (25.52S latitude and 49.17W longitude) and the sunlit area was calculated on the interior surfaces (floor, South-oriented, North-oriented and East-oriented surfaces) for two specific days in order to have a representative study for the whole year: 21^{st} June and 21^{st} December. Table 1 summarises the set of simulations performed for both cases.

Case study | Two: Simple (case1) and complex (case 2) models |
---|---|

Simulated Surfaces |
Floor, South-oriented, North-oriented and East-oriented surfaces |

Location |
Curitiba, Brazil (25.52S latitude and 49.17W longitude) |

Run Period |
21^{st} June and 21^{st} December |

The simulations were also performed by using *SHADING* Tools Plugin v1.0 plug -in to compare the sunlit area results obtained from using Domus. Although it calculates the sunlit area on surfaces by using the pixel counting technique, the results are not integrated into a building energy simulation tool. Thus, sunlit fraction results of the sun patch from Domus and Shading II SketchUp plug-in were compared and their differences were analysed. Moreover, sun patch positions determined by Domus were compared with images produced by using shadow functionalities of SketchUp.

Impact of sun patch on the surface temperatures

The impact of the sun patch on the thermal performance was evaluated using a third building model, which has the same characteristics as an experimental EDF (*Électricité de France*) test-cell, called BESTLab (Building Envelope and Solar Technologies Laboratory), used for research and technology studies related to the building envelope and building solar technology. The laboratory is located in the Fontainebleau forest, 75 km South-East Paris (48.38 N, 2.84 E; altitude: 100 m), composed by 12 test cells. For the experimental test, a test cell was used oriented to the West, with interior dimensions of 2.97 x 2.89 x 2.82 m. The walls are highly insulated (U < 0.1 W/(m^{2}.K)) and the window is composed by double glazing, consisting of a 16 mm air gap framed by two 4 mm panes. Considering that Domus is a one-dimensional heat transfer software, the walls and floor were divided into two directions (vertical and horizontal), producing a mesh with quadrangular cells, as shown in Figure 4. The surface temperature was simulated for each cell, providing a distribution over the surfaces and to overlap with the sun patch position. The values of surface temperature for each cell and the boundary of the sun patch position on the floor for three specific time instants (15:00, 16:00 and 17:00) of 21^{st} June were calculated.

Results and discussion

Simulations using PxC implemented in Domus

In this section, sunlit fraction results from Domus and *SHADING* Tools Plugin simulations are compared for two case studies - simple and complex cases, and presented, respectively, in Figures 5 and 6.

In general, for Case 1 - simple, the results from Domus and *SHADING* Tools Plugin, in Figure 5, are similar. The highest difference of the results occurs in the South-oriented surface at 16:15 on 21^{st} June. The sunlit fraction from Domus is 33.3% and, from *SHADING* Tools Plugin, it is 39.3%. A certain inconstancy of the results from *SHADING* Tools Plugin can be observed, in particular, at the moment when there is a peak of solar incidence on the surface.

For Case 2 - complex case, the results are coherent between them, however the results from *SHADING* Tools Plugin maintain a certain inconstancy (Figure 6). Although Shading and Domus use the same technique to calculate the sunlit surface area, other factors may lead to this difference between the programs, such as the calculation of the Sun´s position (azimuth and altitude angles) or the way the pixel counting technique was implemented.

Besides, Case 2 demonstrates the capability of the pixel counting technique for simulating complex geometries, such as hollowed elements. Most of the solar shading calculation algorithms implemented in building energy simulation tools are limited to a few simple shading devices. In fact, they are not able to deal with polygons with holes or curved geometries. On the other hand, the simulation tests indicate the opportunity to simulate complex architectural models as the most important advantage of the pixel counting technique, which is free of geometrical limitations.

Relating the sun patch position, Figures 7 and 8 show that the results from Domus and shadow functionalities of SketchUp have a good agreement visually speaking. The white region represents the sun patch provided by SketchUp and the orange outline is from Domus. For both cases, the results of sun patches are almost totally overlapping, which indicates the coherence in terms of location of the results from the pixel counting technique implemented in Domus.

It is worth noting that the sun patch on surfaces varies widely throughout the year, which is represented in this paper by two days with extreme values of direct solar incidences. This demonstrates that a simplified model for the direct solar radiation in building enclosures - mainly when it is assumed that the solar beam homogeneously strikes the floor area - may neglect important variations of solar gains.

Impact of sun patch on the surface temperatures

The impact of the incoming radiation through the window (sun patch) on the surface temperatures was evaluated by the simulation in Domus. As already mentioned, considering that Domus is a one-dimensional heat transfer software, the walls and floor were divided into two directions (vertical and horizontal), producing a mesh with quadrangular cells. Both the sun patch position and surface temperature for each cell were calculated and the results overlapped

The values of surface temperatures for each cell and the boundary of the sun patch position on the floor for three specific time instants (15:00, 16:00 and 17:00) from 21st June are shown in Figure 9. The sun patch positions are marked in orange. We can observe the variation of the surface temperatures as a function of the heat gain caused by the direct solar incidence on the cells, i.e., the impact of the incoming radiation through the window on the surface temperatures can be observed. For example, this variation achieves about 4 °C at 16:00; the temperatures reach around 20 °C on the sunlit cells and around 16 °C on the shaded cells. A displacement is noticed between the region with the highest surface temperatures and the sun patch on the floor. This is common since the effects of direct solar incidence (solar gain) are not instantaneous due to the thermal inertia effects to be considered.

Conclusion

The direct solar radiation that reaches internal surfaces is one of the factors responsible for thermal gains in a building. A precise simulation of the conditions of direct solar incidence in terms of area and the geometric position is essential for determining the boundary conditions for three-dimensional thermal simulations. Generally, in the current BES software, the direct solar radiation that hits the windows is totally projected on the floor of the zone or a distribution coefficient for internal surfaces is applied. However, techniques such as pixel counting, implemented for calculating the direct solar distribution within buildings in the Domus software, have improved the accuracy and speed of calculations of incident solar radiation, especially for buildings with complex geometries. In this context, this paper presented an application and a comparative validation of a pixel counting technique within Domus software to calculate the sun patch distribution on building interior surfaces. Therefore, two case studies were investigated and the sunlit fraction and position results of the sun patch from Domus were compared with ones from the *SHADING* Tools Plugin, which also uses the pixel counting technique to calculate the internal solar distribution.

The software comparative work has shown that, for both case studies, Domus and *SHADING* Tools Plugin present similar values of sunlit fraction, although the results from the *SHADING* Tools Plugin were relatively unstable. Regarding the sun patch location, the results are almost totally overlapping, which indicates the coherence of the results from the pixel counting technique implemented in Domus. It is worth mentioning that the second model has a complex shading element on the facade called *cobogó*. In general, the shadow algorithms, such as polygon clipping, cannot deal with hollowed polygons and curved geometries. Thus, this case study indicates the possibility of simulating complex architectural models as the most important advantage of the pixel counting technique, which has no geometrical limitations. Indeed, it can deal with hollowed and non-planar polygons and curved geometries without a significant increase in processing time.

Although *SHADING* Tools Plugin uses the pixel counting technique, the results are not integrated into building energy simulation software. Thus, Domus is the first simulation tool that has adopted the pixel counting technique to calculate the sunlit external and internal areas. Besides, not having limitations regarding building geometry, the pixel counting technique has an advantage with respect to computational cost. In general, it requires a lower run time compared to other shadow algorithms. The only limitation is the requirement of a hardware accelerated graphics card that cannot be considered as a drawback since they are popular nowadays in personal computers.

Finally, the last case study demonstrates the importance of a precise evaluation of the sun patch on the assessment of building thermal behaviour. Considering that the position of the sun patch moves in time, we note the same movement of the patch of the surface temperature on the floor. Besides, we have observed that the surface temperatures can be very heterogeneous in function of the sun patch position on the surface. A difference of about 4 °C was found between the shaded and sunlit regions, which may have a significant impact on the simulation accuracy and the local comfort derived by radiant temperature asymmetry, for example. It should be mentioned that pixel counting can predict energy consumption and thermal comfort more accurately. Further research will be conducted to experimentally validate and verify the performance by comparing different tools for common cases available in the literature such as BESTEST.