# A Proposal of a Troposphere Model in a GNSS Simulator for VANET Applications
## 5 Tropospheric Model Solution
### Model Implementation  
In Figure 3, a block scheme that summarizes implemented functionalities is shown. Figure 3: Tropospheric Block Diagram. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & & \multicolumn{2}{c}{**Average**} & & & \\
**Latitude (°)** & \(P_{0}\) **(mbar)** & \(T_{0}\) (°K)** & \(e_{0}\) **(mbar)** & \(\beta_{0}\) (°K/m)** & \(\Lambda_{0}\) \\ \hline
15 & 1013.25 & 299.65 & 26.31 & 6.30 \(\times\) 10\({}^{-3}\) & 2.77 \\
30 & 1017.25 & 294.15 & 21.79 & 6.05 \(\times\) 10\({}^{-3}\) & 3.15 \\
45 & 1015.75 & 283.15 & 11.66 & 5.58 \(\times\) 10\({}^{-3}\) & 2.57 \\
60 & 1011.75 & 272.15 & 6.78 & 5.39 \(\times\) 10\({}^{-3}\) & 1.81 \\
75 & 1013.00 & 263.65 & 4.11. & 4.53 \(\times\) 10\({}^{-3}\) & 1.55 \\ \hline \hline \multicolumn{6}{c}{**Seasonal variation**} & & & \\
**Latitude (°)** & \(\Delta\)**P **(mbar)** & \(\Delta\)**T (°K)** & \(\Delta\)**\(e\) **(mbar)** & \(\Delta\)**\(\beta_{0}\) (°K/m)** & \(\Delta\)**\(\Lambda_{0}\)** \\ \hline
15 & 0.00 & 0.00 & 0.00 & 0.00 \(\times\) 10\({}^{-3}\) & 0.00 \\
30 & \(-\)3.75 & 7.00 & 8.85 & 0.25 \(\times\) 10\({}^{-3}\) & 0.33 \\
45 & \(-\)2.25 & 11.00 & 7.24 & 0.32 \(\times\) 10\({}^{-3}\) & 0.46 \\
60 & \(-\)1.75 & 15.00 & 5.36 & 0.81 \(\times\) 10\({}^{-3}\) & 0.74 \\
75 & \(-\)0.50 & 14.50 & 3.39 & 0.62 \(\times\) 10\({}^{-3}\) & 0.30 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Average environmental values. In order to develop the model in the considered simulator, three functions have been created in \(C\) programming language able to calculate the signal delay, and then to add it in the pseudorange calculated for each satellite. The main method has been called _troposphericDelay_, see Algorithm 1, it takes as input the \(g\) variable of type _gpstime_t_, which is a struct that represents the GPS time in the week-seconds format; an array of three elements called _llh_ which contains the latitude, longitude and altitude of the GPS receiver, and finally an array of two elements called _azel_, which indicates azimuth and elevation of the satellite with respect to the receiver, see the pseudocode of Algorithm 1. ```
Input : gpstime_t (output of gpsTimeToDays function, llh (latitude,longitude,altitude), azel (azimuth and elevation of satellite) Output : T(E)
1 Tz0 dry;
2 Tz0 wet;
3 calculate_Tz0 dry;
4 calculate_Tz0 wet;
5 T(E) = (Tzdry + Tzwet) * Me;
6 return T(E);
```  
**Algorithm 1**troposphericDelay: Calculate the delay of the signal in meters due to the troposphere (T(E) ). The other two functions are:  
* _gpsTimeToDays_: it has the aim of simply converting the GPS time from the week-seconds format, to the day of the year ranging from 1 to 365, the pseudocode of this method can be seen in Algorithm 2. * _parametroTropos_: it has the aim of taking the listed values and, on the basis of the involved parameter such as latitude, satellite elevation and day of the year, it calculates the correct value, which will then be used in the main method, see Algorithm 3. ```
Input : gpstime_t g Output : days from January
1 weeknumber;
2 seconds;
3 days = weeknumber * 7;
4 convert_g_in_daysFromJanuary(weeknumber,seconds,days);
5 return daysFromJanuary;
```  
**Algorithm 2**gpsTimeToDays: Converts from gpstime_t to the number of days from January. ```
Input : Average Environmental Value (AEV): (P, T, e, b, l) which represent the coefficients relating to the environmental parameters tabulated in the Collins tropospheric model, based on the \"latitude\" (\(\phi\)) of the receiver and the \"day of the year\" (D) Output : \(\xi(\phi,D)\)
1\(\xi_{0}(\phi,D)\);
2\(\Delta_{\xi}^{c}(\phi)\); \(D_{min}\);
3 calculate_\(\xi(AEV)\);
4 return\(\xi(\phi,D)\);
```  
**Algorithm 3**parameterTropos: Calculate the parameter \(\xi\) as function of \(\phi\) and \(D\). ```
Input : gpstime_t (output : days from January
1 weeknumber;
2 seconds;
3 days = weeknumber * 7;
4 convert_g_in_daysFromJanuary(weeknumber,seconds,days);
5 return daysFromJanuary;
```  
**Algorithm 4**parameterTropos: Calculate the parameter \(\xi\) as function of \(\phi\) and \(D\).