**3. Model of generating hourly solar radiation**

#### **3.1 Choosing a model to create hourly solar radiation chains**

There are many studies in the world on establishing mathematical models to generate daily and hourly radiation data series [2, 4, 5]. Basically, these studies are based on the approach of Aguiar [19] and Graham [20].

With the assumption that the sky clarity index kt depends only on the cloudiness coefficient of the KT day, Graham et al. [20] analyzed kt into two components: an average (or trend) component and a random component.

*Distillation Processes - From Solar and Membrane Distillation to Reactive Distillation…*

$$\mathbf{k}\_{\mathbf{t}} = \mathbf{k}\_{\mathbf{tm}} + \mathbf{a} \tag{4}$$

The formula for calculating the trend component or the regular component:

$$\begin{array}{c|c|c} \text{140} & & & & \\ \text{120} & & & & \\ \text{100} & & & & \\ \text{120} & & & & \\ \text{120} & & & & \\ \text{120} & & & & \\ \text{120} & & & & \\ \text{120} & & & & \\ \text{120} & & & & \\ \text{120} & & & & \\ \text{120} & & & & \\ \text{120} & & & & \\ \text{120} & & & & \\ \text{120} & & & & \\ \end{array} \\ \begin{array}{c|c|c} \hline{\text{\text{\textquotedbl{}}}} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \text{120} & & & \\ \end{array}$$

$$\mathbf{k}\_{\rm tm} = \lambda + \rho \,\,\exp\,. (-\kappa \mathbf{m}) \tag{5}$$

**Figure 4.** *Probability density function of KT for Ho Chi Minh City.*

**Figure 5.** *Probability density function of KT for Da Nang.*


#### **Table 3.**

*Statistic parameters of KT series of Ho Chi Minh City.*

*Generating Artificial Weather Data Sequences for Solar Distillation Numerical Simulations DOI: http://dx.doi.org/10.5772/intechopen.100930*


**Table 4.**

*Statistic parameters of KT series of Da Nang.*

where m is the air mass, the value calculated at the time of the middle of the hour. The parameters λ, ρ and κ are the identity function of KT:

$$
\lambda(\mathbf{K\_T}) = \mathbf{K\_T}\mathbf{-1.167K^3}\_T(\mathbf{1} - \mathbf{K\_T}) \tag{6}
$$

$$
\rho(\mathbf{K\_{T}}) = \mathbf{0.979}(\mathbf{1}\mathbf{-K\_{T}}) \tag{7}
$$

$$\mathbf{x}(\mathbf{K\_{T}}) = \mathbf{1.141(1-K\_{T})/K\_{T}} \tag{8}$$

The standard deviation σα of the variable α is expressed as:

$$
\sigma\_a(K\_t) = \mathbf{0.16} \sin\left(\pi K\_t / \mathbf{0.90}\right) \tag{9}
$$

Then use the Gaussian normalization technique to transform this variable α into a Gaussian variable β with the relation between α and β as follows:

$$a = -\frac{1}{1.158} \ln \left\{ \frac{1}{0.5 \left[ 1 + \text{erf} \left( \frac{\beta}{\sqrt{2}} \right) \right]} - 1 \right\} \tag{10}$$

Then apply ARMA models to the data series β and determine that β follows the model as AR(1):

$$
\beta\_t = \phi \beta\_{t-1} + \mathfrak{g}\_t \tag{11}
$$

where:

βt-1 is the value of the variable at t-1.

Φ is the automatic regression coefficient.

ϑ<sup>t</sup> is a random number from a normal distribution with zero mean and a standard deviation ffiffiffiffiffiffiffiffiffiffiffi <sup>1</sup> � <sup>ϕ</sup> <sup>p</sup>

As in the case of using date values, the coefficient Φ varies slightly by locality but the value 0.54 can be chosen as the value to use in the model for all localities.

Aguiar's method [23] to generate kT is similar to Graham's method but has some differences as follows:

• First, the standard deviation σα depends not only on KT but also on the altitude angle of the sun hs:

$$\sigma\_a(K\_T, h\_s) = A \times \exp\left\{B \times \left[1 - \sin\left(h\_s\right)\right]\right\} \tag{12}$$

with:

$$A = 0.14 \times \exp\left[-20.0(K\_T - 0.32)^2\right] \tag{13}$$

$$B = \mathbf{3.0} (K\_T - \mathbf{0.45})^2 + \mathbf{16.0} K\_T^5 \tag{14}$$

• Second, the coefficient Φ depends on KT according to the following expression:

$$\Phi = 0.38 + 0.06 \cos \,\, (7.4 \text{K}\_{\text{T}} \text{-2.5}) \tag{15}$$

• Third, the calculated kt values are limited by the clear sky clearness index kcs.

$$k\_{\rm cs}(t) = \mathbf{0.88} \times \cos\left[\pi(t - 12.5)/30\right] \tag{16}$$

With t is the hour considered.

Aguiar's model has been successfully applied to generate hourly solar irradiance in Spain and Slovenia [4, 5], while Graham's approach to generate hourly solar irradiance sequences at different locations has been successfully applied for locations in the United States in particular and many parts of the world in general [24]. On the other hand, Aguiar and Graham's models were used in generating and comparing hourly solar irradiance for 6 locations in Australia and the results showed that Graham's model produces a global solar irradiance sequence which better fit for all six sites [21]. Therefore, Graham's model was chosen to generate hourly solar radiation in this study.

However, Graham's model also has some disadvantages as follows:


To solve the complicated and time consuming problem of the Graham model, the β values given in Eq. (10) are transformed to a non-standard distribution h by using Norminv function in MATLAB. The random components of the kt value are then calculated by:

$$\mathbf{a} = \mathbf{h} \times \boldsymbol{\sigma}\_{\mathbf{a}} \left( \mathbf{K}\_{\Gamma} \right) \tag{17}$$

with σα (KT) is the standard deviation computed by using Eq. (9).

This suggested model are not only much simpler than Graham's method, but also produces more accurate results. **Table 5** demonstrates the hourly solar irradiance sequence error generated by Graham's model and this study's modified model compared with the measured solar irradiance sequence for Ho Chi Minh City over 20 times run a program written in MATLAB.

#### **3.2 Modified Graham model to create a series of hourly clearness indices**

**Figure 6** shows the process of creating a series of hourly clearness index series. This procedure is modified from the Graham model, as analyzed above. In this Figure:

ϕ is the investigated location's latitude

Lst and Lloc are respectively the longitude of the standard meridians and the considered location.

j is the month of the year.

i is the day of a month

ω<sup>s</sup> is the angle of sunset for the calculated day

KT [i][j] is the daily clearness index of the ith day in the jth month


*Generating Artificial Weather Data Sequences for Solar Distillation Numerical Simulations DOI: http://dx.doi.org/10.5772/intechopen.100930*

#### **Table 5.**

*Errors of the generated versus measured hourly solar radiation values in Ho Chi Minh City.*

ω is the calculated hour angle.

ktm is the "long-term" average value of kt

σkt is the standard deviation of kt toward the values of the "long-term" average value

ε<sup>t</sup> is a Gaussian distribution's random number

hr. is the investigated hour.

<sup>χ</sup> is a Gaussian distribution's random variable with "0″ mean and "1″ variance. θ<sup>1</sup> is the parameter of the AR1 model.

Fnormal is a function to convert a Gaussian variable into a non-normally distributed variable

MATLAB is used to write generation program for hourly kt series.

#### **3.3 Validate generated hourly clearness index strings**

The daily generated transparency index values were used as input to the hourly kt series generation program. The calculated kt values are then compared with ktmea values, where ktmea is the measured hourly clearness index values given by:

$$k\_{tmat.} = \frac{I}{I\_0} \tag{18}$$

*Distillation Processes - From Solar and Membrane Distillation to Reactive Distillation…*

**Figure 6.** *Flow chart for generating hourly kt series from daily optical clearness index series KT.*

*Generating Artificial Weather Data Sequences for Solar Distillation Numerical Simulations DOI: http://dx.doi.org/10.5772/intechopen.100930*

where I is the horizontal total solar irradiance measured from ω<sup>1</sup> to ω<sup>2</sup> in Ho Chi Minh City and Da Nang; I0 is the solar radiation outside the atmosphere from hour angle ω<sup>1</sup> to ω2, given by [1]:

$$\begin{array}{l} \mathbf{I}\_{0} = \frac{\mathbf{1}\mathbf{2}}{\pi} \begin{array}{l} \mathbf{G}\_{\text{SC}} \times \mathbf{3600} \end{array} \left\{ \left[ \mathbf{1} + \mathbf{0}, \mathbf{033}, \cos \left( \frac{\mathbf{360n}}{\mathbf{365}} \right) \right] \right. \\\ \times \left[ \cos \phi \cos \delta (\sin \alpha\_{2} - \sin \alpha\_{1}) + \frac{\pi}{\mathbf{180}} (\alpha\_{2} - \alpha\_{1}) \sin \phi \sin \delta \right] \right\} \end{array} \tag{19}$$

The cumulative distribution function (CDF) graphs of kt over the hours for Ho Chi Minh City and Da Nang are shown in **Figures 7** and **8** respectively while the probability density function (PDF) of kt over the hour for these cities are shown in **Figures 9** and **10**. Additionally, several statistical parameters, including mean, median, minimum, maximum, standard deviation, mean absolute error (MAE) and mean square error (RMSE) of the measured and generated kt series in Ho Chi Minh City and Da Nang are also shown in **Tables 6** and **7**, respectively.

**Figure 7.** *Cumulative distribution function (CDF) of hourly kt for Ho Chi Minh City.*

**Figure 8.** *Cumulative distribution function (CDF) of hourly kt for Da Nang.*

**Figure 9.** *Probability density function (PDF) of hourly kt for Ho Chi Minh City.*

#### **Figure 10.** *Probability density function (PDF) of hourly kt for Da Nang.*


#### **Table 6.**

*Statistical parameters of the kt series of Ho Chi Minh City.*

As presented in **Figures 7**–**10** and **Tables 6** and **7**, the hourly kt series for the two investigated cities have been successfully generated by the suggested model with very high accuracy. The mean and median error percentages of generated sequences were 1.5% and 2.4% for Ho Chi Minh City and 1.3% and 0.3% for Da Nang,

*Generating Artificial Weather Data Sequences for Solar Distillation Numerical Simulations DOI: http://dx.doi.org/10.5772/intechopen.100930*


**Table 7.**

*Statistical parameters of the kt series of Da Nang.*

respectively. Since stochastic models have been approved to have universal characteristics, as mentioned above, the model in this study is expected to be applicable to any location in the world.

#### **4. Model to generate hourly ambient temperature sequences**

The procedure to generate hourly ambient temperature sequences from monthly mean ambient temperature, *T*a, and monthly mean daily clearness index, *K*t, was described by Knight et al. [25]. The model to generate artificial hourly ambient temperature sequences for Australia was developed by Nguyen and Pryor [21].

First, to generate the deterministic component of the hourly ambient temperatures series, the concept of the average normalized diurnal temperature variation, developed by Erbs et al. [26], is applied. Hourly measured ambient temperature data from two locations (Ho Chi Minh city and Da Nang) are used to calculate the hourly monthly-average ambient temperature, *T*a,h, at each hour of the day for each month. These curves are standardized by subtracting the monthly-average daily temperature, *T*a, from each of the hourly values and then dividing by the amplitude of the curve (defined as the difference between the maximum and minimum hourly average temperatures over the day), A. Subsequently twelve cosine curves are derived for each location.

The average of these 24 (ie., 12 curves \* 2 locations) standardized curves are calculated. Interestingly, the equation originally derived by Erbs and his colleagues is found to fit the average standardized curve in this study. The equation is expressed:

$$\frac{\overline{T}\_{a,h} - \overline{T}\_a}{A} = 0.4632 \cos \left( \text{t} \,\text{s} - \text{3.805} \right) + 0.0984 \cos \left( \text{2} \,\text{t} \,\text{s} - \text{0.360} \right)$$

$$+ 0.0168 \cos \left( \text{3} \,\text{t} \,\text{s} - \text{0.822} \right) + 0.0138 \cos \left( \text{4} \,\text{t} \,\text{s} - \text{3.513} \right) \tag{20}$$

t\* is given by: t\*= <sup>2</sup>*π*ð Þ *<sup>t</sup>*�<sup>1</sup> <sup>24</sup> where temperature is in hours with 1 and 24 corresponding to 1 am and midnight, respectively.

The relation between the amplitude A and the monthly mean clearness index, *K*t, is calculated as [26]:

$$\mathbf{A} = \mathbf{20.231} \,\mathrm{K\_t} \mathbf{-3.103} \tag{21}$$

After the trend components are removed from the ambient temperature values, the variable component of the data is converted into a normal distribution and then tested with many ARMA models. The AR2 model is finally selected:

$$
\chi\_t = \Phi\_1 \chi\_{t-1} + \Phi\_2 \chi\_{t-2} + \varepsilon\_t \tag{22}
$$

here, *χt*�<sup>1</sup> and *χt*�<sup>2</sup> are the values of the weather data variables at t-1 and t-2, respectively, and Φ<sup>1</sup> and Φ<sup>2</sup> are calculated from the available ambient temperature data and are found to be 0.9072 and � 0.1430, respectively. *ε<sup>t</sup>* is a random number from a normal distribution with zero mean and a standard deviation

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi 1 � Φ1*r*<sup>1</sup> � Φ2*r*<sup>2</sup> <sup>p</sup> *:* r1 and r2 are the corresponding autocorrelation coefficients. The generated χ is transformed to an hourly temperature by equating the

cumulative function of χ, Fnormal, and hourly ambient temperature, Ftemp. Fnormal is given by:

$$F\_{normal} = \frac{1}{\sqrt{2\pi}} \int\_{-\infty}^{\infty} \exp\left(-\frac{1}{2}t^2\right) dt = \frac{1}{2}\mathbf{1} + \text{erf}\left(\frac{\chi}{\sqrt{2}}\right) \tag{23}$$

whereas Ftemp is calculated as follows:

$$F\_{temp} = \frac{1}{1 + \exp\left(-3.396h\right)}\tag{24}$$

with:

$$h = \left(T - \overline{T}\_{a,h}\right) \left(\sigma\_m \sqrt{N\_m/24}\right) \tag{25}$$

in which Nm is the number of hours in the months and σ<sup>m</sup> is the standard deviation of the monthly-average daily temperature *Ta* given by:

$$
\sigma\_m = 1.45 + 0.029T\_a + 0.0664\sigma\_{yr} \tag{26}
$$

σyr is the standard deviation of the yearly average ambient temperature. Solving these equations, hourly ambient tempaerature is given by:

$$T = \overline{T\_a} - \frac{\sigma\_m \sqrt{\frac{N\_m}{24}}}{3.369} \times \ln\left\{\frac{1}{0.5\left[1 + \text{erf}\left(\frac{\chi}{\sqrt{2}}\right)\right]} - 1\right\} \tag{27}$$

**Figure 11** shows the schematic diagram of the procedure to generate hourly ambient temperature sequences.

In this figure:

Lst and Lloc are the standard meridian for the local time zone and the longitude of the location considered, respectively.

Ta [j] and K[j] are the monthly mean ambient temperature and monthly mean daily radiation of jth month, respectively.

Ta,yr is the year average ambient temperature, calculated from the 12 monthly values.

*σ<sup>m</sup>* [j] is the monthly standard deviation of the jth month, obtained from the yearly average value and the monthly average temperature for that month.

A[j] is the amplitude of the diurnal variation (peak to peak) of ambient temperature, and is a function of monthly average daily clearness index.

Ta,h [avhr] is the hourly monthly-average ambient temperature; the subscript "avhr" indicates the calculated monthly-average hour (avhr = 1 to 24).

*ε<sup>t</sup>* is a random number from a Gaussian distribution.

hr is the hour considered.

Nmax is the number of hours in the respective month

χ is the normally distributed stochastic variable with a mean of 0 & a variable of 1.

*Generating Artificial Weather Data Sequences for Solar Distillation Numerical Simulations DOI: http://dx.doi.org/10.5772/intechopen.100930*

**Figure 12.**

*Cumulative distribution function (CDF) of hourly ambient temperature for Ho Chi Minh City.*

Φ<sup>1</sup> and Φ<sup>2</sup> are the first and second parameters of the AR2 model.

Fnormal is the cumulative distribution of a normally distributed variable.

**Figure 12** shows the cumulative distribution of hourly ambient temperature sequences for Ho Chi Minh City. The figure compares the results using measured data and arificial data generated from the equations described in this section. As shown, the model presented here produced accurate hourly ambient temperature in comparision with measured data.

#### **5. Validating generated versus measured weather data by running a solar distillation simulation program**

The main objective of this study is to build a model to generate weather data, including daily and hourly solar radiation sequences and ambient temperature series; then these weather data chains must be used to run simulation programs. Therefore, the generated weather data is used as input for SOLSTILL – a simulation program for solar distillation systems [27]. This simulation program was designed to enable to simulate both passive solar stills and active solar distillation systems. **Figure 13** presents the heat and mass diagrams in a passive solar still whereas **Figures 14** and **15** respectively shows the schematic diagram and heat and mass transfer process in a forced circulation solar still.

The inputs for SOLSTILL can be in form of hourly weather data if the measured hourly solar radiation and ambient temperature are available. If not, the weather data generation function in SOLSTILL can be called to generate weather sequences with input as monthly average daily solar radation and ambient temperature values of 12 months [27]. Both modes of weather data in SOLSTILL (i.e., input hourly weather data and generation mode) are used in this study. For Mode 1, hourly measured weather values, achieved from National Center for Hydro-Meteorogical Forecasting [28], are input the program. For Mode 2, the weather data generation function in SOLSTILL does its job. The outputs of SOLSTILL consist of hourly amounts of distillate water, hourly temperatures of the cover, basin water and the basin, etc. In this study, only hourly amounts of distillate water are considered.

*Generating Artificial Weather Data Sequences for Solar Distillation Numerical Simulations DOI: http://dx.doi.org/10.5772/intechopen.100930*

*The heat and mass transfer processes in a conventional solar still.*

**Figure 14.** *Schematic diagram of a forced circulation solar still with enhanced water recovery.*

#### *Distillation Processes - From Solar and Membrane Distillation to Reactive Distillation…*

**Figure 15.** *The heat and mass transfer process in a forced circulation solar still.*

Then, daily and monthly average daily amounts of distillate water are achieved. **Figures 16** and **17** show the monthly average daily distilled water of a conventional solar still for Ho Chi Minh City and Da Nang whereas **Figures 18** and **19** show those of a forced circulation solar still with enhanced water recovery, respectively.

As shown in **Figures 16**–**19**, the errors of the predicted monthly average daily distillate productivity of both a conventional passive solar still and a forced circulation solar still with measured and generated weather series as input data are very

**Figure 16.** *Monthly average daily distillate productivity of a conventional solar still in Ho Chi Minh City.*

*Generating Artificial Weather Data Sequences for Solar Distillation Numerical Simulations DOI: http://dx.doi.org/10.5772/intechopen.100930*

**Figure 17.**

*Monthly average daily distillate productivity of a conventional solar still in Da Nang.*

#### **Figure 18.**

*Monthly average daily distillate productivity of a forced circulation solar still in Ho Chi Minh City.*

small. The largest error is 9.3%, occurred in April in Ho Chi Minh City for a conventional solar still. The errors of predicted yearly average daily distillate productivities are less than 5%. Therefore, it can be expected that the weather data generated from the proposed models can be used to run any simulation programs for solar distillation systems.

#### **6. Conclusion**

In this study, to generate daily clearness index sequences for Ho Chi Minh City and Da Nang, two cities presenting for two climate types in tropical region, Aguiar's model was chosen. Then a modified model of Graham was proposed to generate hourly clearness index sequences from generate daily clearness index series for these

two locations. After that, a model to generate hourly ambient temperature sequences from monthly average daily ambient temperatures was presented. Having been proved by some statistic configurations and the predicted distillate productivities of solar still simulations, the models in this study are accurate in predicting daily and hourly irradiances and ambient temperature sequences. Especially, the model proposed in this study to generate the hourly solar radiation values is much simpler compared with Graham model. Therefore, both solar radiation and ambient temperature generating models in this work are believed to be used to calculate daily and hourly weather data for any numerical simulation programs of solar distillation systems with very limited input parameters, including the latitude, monthly average daily clearness index and ambient temperature values of the investigated locations.
