**1. Introduction**

Buildings consume a grea<sup>t</sup> deal of energy to maintain comfortable conditions within their enclosures. The design of heating and cooling systems for buildings require a detailed assessment of the temperature of the constituting envelope. Thus, the temperature of the walls, roofs, floors, and glazing surfaces are required. Buildings within urban areas inevitably have radiative exchanges with other buildings, sky, and ground. Radiation heat transfer has many applications within the building services sector. Some of the building engineering applications of radiative exchange between surfaces are:


**Figure 1.** Ground and vertical walls or windows.

**Figure 2.** A light-pipe illuminating floor or desk spaces.

In all the above applications' computation of the radiation view factor is required. There have been significant research studies related to energy transfer in building applications such as quantification of available façade areas for installation of building integrated solar PV [1], determination of solar heat gain for daylighting studies [2], theoretical modelling of the view factor to determine the diffused components of solar irradiance [3], and predictive simulation tool to determine the radiance value of a façade in the street canyon [4].

In this article, we have considered the radiative energy exchange of solar photovoltaic collectors such as bifacial solar photovoltaics (PV), which is gaining popularity both for the field level and rooftop building applications [5]. It is a promising technology that increases the production of electricity per square meter of the PV module using light absorption from the albedo [6]. Bifacial solar cells simultaneously collect photons from incident and albedo radiation reaching both the front side and the back side of a solar module whereas traditional monofacial solar cells only collect photons reaching the front side of the device. Cuevas et al. [7] showed that an increase of 50% in electric power generation can be obtained by simultaneously collecting direct and albedo radiation from the rooftop and surroundings around a module. Consequently, it was established that bifacial solar cells can increase the power density of PV modules compared to mono-facial cells while reducing area-related costs for PV systems [8]. Currently, there are two main challenges this technology is facing, which are

(1) a lack of an adequate simulation tool that can help understand how the rear side of the PV interact with the reflected sunlight and (2) how to make the technology bankable. The success of the technology will depend on how well the bifacial PV is understood to the research community. Therefore, it would be easier to make the technology commercially profitable. Hence, the need for developing a simulation tool to understand the energy yield of bifacial solar PV is inevitable. There are different simulation approaches to determine the ground reflected radiation that is incident upon tilted bifacial solar photovoltaics (PV) such as the view factor model, the ray tracing model, and empirical modelling [9]. There has been ongoing research by various scientific communities. For instance, National Renewable Energy Laboratory (NREL) in collaboration with Sandia National Laboratories have developed and compared the view factor model and the ray tracing model to evaluate the back-surface irradiance [10]. However, computation time remain an issue, which is still a modelling challenge that requires further investigation. Conceptually, the back-surface irradiance is composed of direct irradiance, structure reflected irradiance, sky diffused irradiance, and ground reflected irradiance. In this article, we have followed the view factor modelling-based approach to evaluate the radiative energy transfer between the ground (reflecting surface) and the bifacial solar PV (collecting surface).

The present research team had developed a computer code for view factor analysis using a finite-element grid, which can handle an irregular horizon [11]. The software was developed based on a numerical solution of the view factor integral within the Microsoft Excel-Visual Basic for Applications (VBA) environment considering mono-facial solar PV collectors as an example. However, in this work, an improved, simplified brute force algorithm is adopted to determine the view factor for uniform surfaces by utilizing the finite element method (FEM). FEM is one of the most powerful tools for analyzing energy exchange between surfaces. It can be applied for view factor (VF) evaluation. This method is very robust and, yet, it may require excessive computer time. For finite element analysis, the object-oriented computing environment is already proven to be efficient in various areas such as Structural Engineering [12], Chemical Engineering, and Mathematics. In this article, we have implemented the view factor (VF) code in VBA and the Python environment and have compared the computation speed of the simulations in both platforms.

Python is chosen because it has already been accepted by the research community for its ease of use and an open access user-friendly platform. Availability of the open source library has made it eligible for numerous scientific applications such as power systems [13], energy analysis [14] mathematics, and fluid dynamics [15]. VBA has also been deployed as a user-friendly tool in various applications such as in heat transfer, in solar PV applications [16,17], and in the field of agriculture. For example, a milk-producing dairy model was implemented in VBA to control the operation of the dairy farm, which has a significant benefit to the farmers and researchers in the field. However, it takes seven days to run the simulation [18]. Therefore, despite its effectiveness as a design tool, computation time has always been an issue for VBA [19] whereas Python, which is a high-level, benchmark programming language, can outperform VBA in terms of computation speed.

In this paper, we have compared the potentials of the simulation platform to develop the code further for bifacial solar PV collectors. Two simulation platforms are used to quantify the amount of ground reflected radiation received by the solar collectors. We focused on the modelling of computationally intensive view factor analysis between reflecting (ground) and collecting (bifacial solar PV) surface and determined the duration of simulation response time. The paper is organized as follows. The concept of view factor modelling is briefly discussed in Section 2. Section 3 provides the overview of the simulation model. The computation performance of two simulation platforms, Python and Microsoft Excel-Visual Basic for Applications (VBA), is demonstrated in Section 4. We have presented an application related to generation of solar PV electricity and its enhancement by using reflective films placed near the horizon of PV modules. The object is to obtain a numerical procedure for the radiative exchange between the foreground and PV modules. The technique can be applied to a bifacial solar PV cell, which is an emerging technology. The novelty of this work is that we have provided quantitative data that demonstrates faster convergence and accuracy offered by the Python software environment in the context of modelling bifacial solar PV's energy yield where computation time is a significant modelling challenge. Lastly, the paper ends with concluding remarks in Section 5.

#### **2. View Factor Modelling Concept**

In our work, we simulated the mathematical model of the radiation view factor as a discrete model in the computing platform by applying finite element method. To understand the concept of view factor modelling, let us consider two rectangular surfaces *A*1 and *A*2 with surface dimensions *a* × *b* and *c* × *b* and Φ is the tilt angle between the surfaces (Figure 3a) and β = π − Φ. In radiative heat transfer, the view factor can be defined as the proportion of irradiance, which leaves the emitting surface *A*2 and strikes the receiving/collector surfaces *A*1 denoted by *FA*<sup>2</sup>−*A*1. From the mathematical equation of the view factor [11], we may write:

$$F\_{A\_2 - A\_1} = \frac{1}{bc} \int\_{x\_1}^{c} \int\_{y\_1}^{b} \int\_{x\_2}^{a} \int\_{y\_2}^{b} \frac{x\_1 x\_2 \sin^2 \beta}{\pi \left[ x\_1^2 + x\_2^2 + 2x\_1 x\_2 \cos \beta + \left( y\_1 - y\_2 \right)^2 \right]^2} \, dy\_2 dx\_2 dy\_1 dx\_1. \tag{1}$$

**Figure 3.** Radiation view factor analysis: (**a**) Two rectangles with one common edge and (**b**) the reflecting and receiving surface with uniform grids [11].

In the present work, Equation (1) has been used to compute the view factor for different geometries of the receiving (solar collectors) and reflecting (ground) surface, which share a common edge. Both the emitting and receiving surfaces are considered as uniform grids where all the cells within the surface are of the same dimensions and aspect ratios (Figure 3b). The tilt angle between the two surfaces varied from 30◦–150◦. The height of the receiving and emitting surface is denoted by 'a' and 'c', respectively, and the common edge length is denoted by 'b'.

One of the approaches to examine the solution of the discrete model is to observe the convergence of the computed solution toward the analytical solution (if it exists) of the mathematical model. This approach is known as verification. For our paper, the analytical solution provided by Feingold [20] is considered as the benchmark solution for the purpose of verification. However, any physical model when interpreted by a discrete model, the solution error, or computation error is an important phenomenon that needs to be properly understood. For a uniform grid, the difference between the analytical solution and the computed solution represents the error. In this case, we have set up the finite element procedure to solve the problem repeatedly with uniform meshes designed to determine the view factor and the error.

There are different adaptive finite element techniques available to estimate the error such as local refinement or *h*-refinement, relocating or *r*-refinement, and locally varying the polynomial degree known as *p*-refinement. For the purpose of verification of our model, an *h*-adaptive refinement technique is applied where the *h* denotes the element size or resolution of the grid, which we used to control the error. Decreasing *h* leads to reduction of the error. As *h* approaches zero, the numerical

solution converges toward its analytical value. The error can be derived from Equation (2) where error (*Er*) is a function of element size *hi*. *VFex* represents the analytical value of the view factor and *VFhi* is the simulated value of the view factor at element size *hi*. *C* is an unknown constant with the leading term *hi* β and exponent β is the rate of convergence [21].

$$\lim\_{h\_{i=1,2,3,4.}} Er(h\_i) = VF\_{ex} - VF\_{h\_i} \approx \mathbb{C}h\_i^{\beta} \text{ for } \beta > 0 \tag{2}$$

If the condition *h*1 *h*2 = *h*2 *h*3 holds, Equation (2) can be further derived as:

$$\frac{VF\_{cx} - VF\_{h1}}{VF\_{cx} - VF\_{h2}} = \frac{h\_1^\beta}{h\_2^\beta} \text{ and } \frac{VF\_{cx} - VF\_{h2}}{VF\_{cx} - VF\_{h3}} = \frac{h\_2^\beta}{h\_3^\beta} \tag{3}$$

The element size determines the number of iterations the simulation must run. The parameters considered for view factor models are presented in Table 1 below.

**Table 1.** View factor modeling parameters.


#### **3. Overview of the Simulation Model**

The numerical view factor model has been executed both in Python and VBA environments. The simulation utilizes one of the most e fficient Python libraries for numerically intensive computing named Numba, which can be loaded by a program as the CPython interpreter. The code is written based on Numba just-in-time (JIT) compiler, which creates a specialized loop in the machine code. The just-in-time or @ JIT is a decorator that is utilized as a function. When this function is called, the decorator analyzes the argumen<sup>t</sup> and creates a specialized version of the function [22]. This code is run on the 'nopython' mode, which compiles the code without accessing the Python C-API (application program interface). Python version 3.7 with Spyder integrated development environment (IDE) is used for the simulation. On the other hand, VBA adopts the run time library of the Visual Basic, which is compiled in a Microsoft packet code and the MS-Excel works as a host application that saves the code in a separate file such as .xlsx or .xlsm. A machine hosted by Excel run the intermediate code and the data is saved in a text file in XML format, which is readable by the user [23]. The simulations were run on Intel ®Core ™ i7-7500U CPU @ 2.7 GHz-2.9 GHz Laptop.

Python and VBA both used a Microsoft Excel worksheet as an input and output file. The user can enter the input parameters, run the simulation, and calculate the simulation response time as well as observe the output, which is saved in an Excel file. Di fferent simulation parameters can be set such as the length and height of the surfaces. For example, referred to Figure 3b, the angle between two surfaces sharing one common edge can be selected and varied for the same element size, *hi*. The simulations were run at di fferent resolutions of the element size defined as the iteration step in the program, which is varied as: *h*1 = 0.01 m, *h*2 = 0.008 m, *h3* = 0.004 m, and *h4* = 0.002 m. This iteration step defines the number of iterations the simulation needs to run, which can be calculated from Equation (4).

$$Iteration\ size = \frac{c}{h\_i} \times \frac{b}{h\_i} \times \frac{a}{h\_i} \times \frac{b}{h\_i} \tag{4}$$

*Energies* **2019**, *12*, 3826

Thus, iteration ranges of the simulations vary from 4.00 × 10<sup>8</sup> to 2.50 × 1011. In this study, a brute force problem-solving approach is applied within a mathematical equation of the view factor (given by Equation (1) in Section 3), which aims to check all the possible interactions between the surfaces using four nested loops bounded by the surface dimensions [24]. The program flow chart is presented in Figure 4.

**Figure 4.** Flow chart of the simulation model.

#### **4. Results and Discussion**

The view factor simulation outputs are examined from different approaches, as explained below.


#### *4.1. View Factor at Di*ff*erent Computation Angles Between Two Surfaces*

This section attempts to verify the proposed view factor model at different tilt angles between the surfaces. The simulated results show a minor deviation from the existing analytical solutions. It has been observed that view factors are considerably influenced by the angle between the surfaces, as illustrated in Figure 5. Keeping the dimensions and iteration size constant, as the angle between two surface increases, a significant decrease in the view factor from a 0.51 maximum value (for this study) to the minimum value of 0.015 is observed. Parameters for this analysis are presented in Table 2 below.

**Figure 5.** View factor at different angles between surfaces for *a* = 2 m, *b* = 1 m, and *c* = 1 m, and *hi*= 0.01 m.

**Table 2.** View factor simulation parameters for element size *hi* = 0.01 m and number of iterations = 4.0 × 108.


Table 2 illustrates that, for element size *hi* = 0.01 m, the percentage error varies from a minimum 1.4% to a maximum 3.1% depending on the value of angle Φ. The iteration size for this simulation is set to 4.0 × 108. The next section presents, how this error can be further reduced by decreasing the element size *hi*, which, in turn, increases the number of iterations.

#### *4.2. Accuracy Versus the Number of Iterations*

The accuracy of the view factor output significantly increased with the number of iterations the simulation runs, which can be seen in Figure 6. Both Python and VBA achieved the same level of accuracy. For surface dimensions: *a* = 2 m, *b* = 1 m, *c* = 2 m, and Φ = 120◦, the computation accuracy is 97% with 4.0 × 10<sup>8</sup> iterations. The numerical results approached the analytical solution at a maximum accuracy of 99.4% for 2.5 × 10<sup>11</sup> iterations. To gain this, the iteration size is to be increased by a factor of 625. The simulation parameters for this study are outlined in Table 3 below.

**Figure 6.** Accuracy versus the number of iterations for *a* = 2 m, *b* = 1 m and *c* = 2 m and Φ = 120◦.


**Table 3.** View factor simulation parameters at various element sizes.

#### *4.3. Convergence to an Analytical Solution*

The convergence performance of the view factor simulation to the analytical solutions are studied by comparing the output between the highest: *a* = 2 m, *b* = 1 m, *c* = 2 m, Φ = 120◦ and the lowest: *a* = 0.4 m, *b* = 1 m and *c* = 0.4 m, Φ = 120◦ surface dimensions. For the same number of iterations, maximum accuracy achieved for Figure 7a was up to 99.4% whereas, for Figure 7b, the accuracy was 98.79%. Comparing both simulation responses, it can be inferred that, to reach the same level of convergence, the element size needs to be further reduced for surface dimensions: *a* = 0.4 m, *b* = 1 m, and *c* = 0.4 m; Φ = 120◦. In addition, the convergence type of the model is found to be linear with the β value of approximately 1. The rate of convergence is derived from Equation (3) considering the element size of 0.004 m and 0.002 m. Table 4 summarizes the results.

(**b**) 

**Figure 7.** (**a**). Convergence to an analytical solution for *a* = 2 m, *b* = 1 m, *c* = 2 m, and Φ = 120◦. (**b**). Convergence to an analytical solution for *a* = 0.4 m, *b* = 1 m, *c* = 0.4 m, and Φ = 120◦.



#### *4.4. Computation Time versus Number of Iterations*

The preceding sections have shown, although both Python and VBA gained the same accuracy with an increasing number of iterations, VBA simulation took more time than Python to reach the same level of accuracy. Figure 8 presents the computation time in seconds for both programs. We see

that Python took 3.52 s to run 4.0 × 10<sup>8</sup> iterations whereas VBA required 454 s. For all other iterations, Python outperformed VBA in terms of computation speed, and it was about 129–180 times faster than VBA. Simulation parameters for these computations can be found in Table 5.

**Figure 8.** Computation time versus the number of iterations for *a* = 2 m, *b* = 1 m, and *c* = 1 m and Φ = 120◦.



#### *4.5. Computation Time for Di*ff*erent Surface Dimensions*

The view factor simulation response time increased with the increasing length and height of surface dimensions. Table 6 summarizes results of computation time variations among different surface dimensions. The results show, in VBA, the lowest computation time is 24 s for the surface dimensions: a = 0.4 m, b = 1 m, and c = 0.4 m. This computation time increased by a factor of 19 for the maximum dimension considered in the simulation: a = 2 m, b = 1 m, and c = 2 m. Nevertheless, Python appears to be 71–129 times faster than VBA at a varying surface length and height.

**Table 6.** Computation time at different surface lengths and heights for Φ = 120◦ and *hi* = 0.01 m.


A finite element computation of the view factor is a time critical application. The present view factor model offers a quantitative computational advantage, i.e., grid surface non-uniformity can be handled quite easily. Other advantages offered by this work are: (a) the view factor code is much faster for geometries encountered in most solar energy and building energy exchange applications, and (b) the view factor approach allows for much shorter computation time, particularly if handled in the Python environment. Note that implementation of other alternative method for instance, ray tracing as a modelling tool is more complex compared to the view factor concept.

The computing performance not only depends on the type of computer used but also on the simulation algorithm and its implementation platform, i.e., programming language. Though short response time is one of the benchmark criteria of the performance e fficiency, there are additional performance matrixes, which can be achieved with fast computation speed. These include high throughput, minimum utilization of resources [25], higher reliability [26], low power consumption, scalability, and opportunity of performance tuning. For our study, one downside of VBA was that it took about five consecutive days to run 250 billion iterations, which can have substantial damage on computer health. Moreover, utilization of computer resources has been very high, which required lots of power consumption. In addition to this, the scope of performance tuning in VBA is also limited, which reduces the scalability of the number of iterations the simulation can run. In all these aspects, Python can outperform VBA, which make it a suitable option for present day scientific and numeric computing. The existing work demonstrates the benefits of using Python for view factor analysis for solar PV applications, which is an improvement over our previous work where we used VBA for such an analysis.
