# Calculation of View Factors for Building Simulations with an Open-Source Raytracing Tool
## 5 Impact of Calculation Parameters on Accuracy, Repeatability of Results, and Runtime  
As is true for any probabilistic process that relies on random sampling, increasing the number of samples will yield results that converge. This is demonstrated through Figure 17 where five successive calculations with two values of ambient divisions are shown. The finite and differential surface for the calculation is the same as that for the example discussed in Section 3.1 and Figure 11. The analytical value of the view factor calculated for this calculation is 0.13853. For all other parameters being the same, the results shown in Figure 17a,b compare the impact of ambient divisions, and by extension limit-weight, on the results.  
It is evident that for a higher value of ambient divisions (-ad), and correspondingly lower value of limit weight (-lw), the error is consistently lower across successive calculations. Figure 18 provides a broader perspective on the impact of sampling on the results by comparing the error values for the four examples presented in Sections 3.1-3.4. The examples are referred to as \"Parallel\", \"Perpendicular\", \"Sphere\" and \"EnergyBalance\" respectively in the plot.  
Figure 16: A comparison of the geometric setup and corresponding command-line arguments for view factor calculations without obstruction (**a**) and with obstruction (**b**). In (**b**), the additional sphere constitutes the obstruction.  
Figure 17: The impact of sampling parameters on accuracy and repeatability of results in five successive calculations. (**a**) Denotes low parameters with values of 100 and 0.01 for -ad and -lw respectively, and (**b**) denotes high parameters.  
For the values of ambient divisions considered, each calculation was run ten times to calculate an average value of view factor. The rationale for running the calculation multiple times and then averaging results was to minimize the impact of stochastic sampling on the interpretation of results. The average error was calculated as per Equation (7) by considering the result nearest to four decimal places. The error in the case of \"EnergyBalance\" is 0% for every iteration in that scenario as the random rays originating from the differential surface element were intercepted by the enclosing box irrespective of the magnitude of ambient divisions.  
Figure 19 shows the impact of ambient divisions on the average calculation runtime. All the calculations were run on a dedicated Intel i5-8400 2.80 GHz computer with six cores and 16 GB of RAM. While the exact runtimes are specific to the machine, the trends shown provide a general indication that the calculation runtime increases with an increase in ambient divisions. The non-linear trend in the plot after 100,000 ambient divisions is attributable to the processing limit of the computer being reached.  
Figure 19: Variation in average calculation runtime according to ambient divisions.  
Figure 18: The variation in average error as per ambient divisions for the calculations considered in Section 3.1 (Parallel), Section 3.2 (Percpendicular), Section 3.3 (Sphere) and Section 3.4 (EnergyBalance).  
The plots in Figures 18 and 19 convey that there is a trade-off between the calculation runtime and accuracy. The accuracy of the calculation can be improved by increasing sampling through ambient divisions. As indicated by the error values for 10,000 divisions and above in Figure 17, beyond a certain extent, the improvements in accuracy might not be discernible.