\addchap{Appendix} \numberwithin{equation}{subsection} \numberwithin{table}{subsection} \section{Installation and configuration guide} In order to evaluate the localization system, it is required to install OpenBSC and to modify the proper source files and compile the system. The aim of this section is to describe that process in such detail that the presented material is sufficient to reproduce equivalent or similar results. The guide was successfully tested out on the following operating systems: Ubuntu 10.04 LTS 64 bit and Ubuntu 12.04 LTS 64 bit. A self-bootable test USB system is supplied with the thesis and it can be evaluated without executing the given steps. There is a marking difference between text given in light and dark grey background color, the first ought to be typed in into the terminal window or it may be an output produced by an application, whereas the later emphasizes a file modification case. \subsection{Installation of OpenBSC} In order to compile OpenBSC it is required to install the following precompiled packages\footnote{If more details are required for the installation process a guide can be found at \citep{openbscInstall}.}: \begin{itemize}\addtolength{\itemsep}{-0.8\baselineskip} \item libdbi0 \item libdbi0-dev \item libdbd-sqlite3 \item libortp-dev \item build-essential \item libtool \item autoconf \item automake \item git-core \item pkg-config \end{itemize} Before installing the required packages and libraries, to keep the installation process clean and free of modifying other files, the author will create a new directory. \begin{lstlisting}[backgroundcolor=\color{light-gray}] mkdir gsm_localization cd gsm_localization \end{lstlisting} By executing the following instructions the required libraries will be installed. \begin{lstlisting}[backgroundcolor=\color{light-gray}] sudo apt-get install libdbi0-dev libdbd-sqlite3 build-essential sudo apt-get install libtool autoconf automake git-core sudo apt-get install pkg-config libortp-dev \end{lstlisting} After the packages were installed, \textit{libosmocore} library must be downloaded, compiled and installed. By executing the following instructions: \begin{lstlisting}[backgroundcolor=\color{light-gray}][numbers = none] git clone git://git.osmocom.org/libosmocore.git cd libosmocore autoreconf -fi ./configure make sudo make install sudo ldconfig cd .. \end{lstlisting} In the next step \textit{libosmo-abis} will be installed. \begin{lstlisting}[backgroundcolor=\color{light-gray}][numbers = none] git clone git://git.osmocom.org/libosmo-abis.git cd libosmo-abis autoreconf -fi ./configure make sudo make install sudo ldconfig cd .. \end{lstlisting} After the previous steps have finished successfully, the author will proceed with downloading, compiling and installing OpenBSC. \begin{lstlisting}[backgroundcolor=\color{light-gray}][numbers = none] git clone git://git.osmocom.org/openbsc.git cd openbsc/openbsc autoreconf -i sudo export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure make \end{lstlisting} At this point, OpenBSC should be successfully compiled. \newpage \subsection{Configuring nanoBTS for OpenBSC} To enable the nanoBTS and OpenBSC to be fully operational, the last configuration steps have to be made. It is necessary to inform the nanoBTS of the IP address of the server that is running OpenBSC since it must connect to OpenBSC. We need to find a free ARFCN channel where our system is expected to operate\footnote{A licence has to be obtained from the Federal Network Agency (German: \textit{Bundesnetzagentur}), otherwise it is ilegal and may be considered as a criminal act.}. To find the ID and the IP address of the nanoBTS it is required to start \textit{ipaccess-find}\footnote{The nanoBTS ought to be blinking in orange color before starting \textit{ipaccess-find}.}. \begin{lstlisting}[backgroundcolor=\color{light-gray}][numbers = none] cd ~/gsm_localization/openbsc/openbsc/src/ipaccess ./ipaccess-find \end{lstlisting} \textit{ipaccess-find} will produce an output similar to the one given: \begin{lstlisting}[backgroundcolor=\color{light-gray}][numbers = none] Trying to find ip.access BTS by broadcast UDP... MAC_Address='00:02:95:00:61:70' IP_Address='132.230.4.63' Unit_ID='1801/0/0' Location_1='' Location_2='BTS_NBT131G' Equipment_Version='165g029_73' Software_Version='168a352_v142b30d0' Unit_Name='nbts-00-02-95-00-61-70' Serial_Number='00110533' \end{lstlisting} In the next step, the nanoBTS is informed of the OpenBSC IP address by typing the following commands (the first IP address belongs to the server running OpenBSC and the second to the nanoBTS): \begin{lstlisting}[backgroundcolor=\color{light-gray}][numbers = none] cd ~/gsm_localization/openbsc/openbsc/src/ipaccess ./ipaccess-config -o 132.230.4.65 132.230.4.63 -r \end{lstlisting} It is required to create the directory where the configuration file will be located and to modify the configuration file. \begin{lstlisting}[backgroundcolor=\color{light-gray}][numbers = none] sudo mkdir /usr/local/lcr cd ~/gsm_localization/openbsc/openbsc/doc/ cd examples/osmo-nitb/nanobts sudo cp openbsc.cfg /usr/local/lcr sudo vim /usr/local/lcr/openbsc.cfg \end{lstlisting} A free ARFCN channel can be found using a spectrum analyzer and by setting the frequency range to the GSM frequency band. One has to slide through the frequencies shown on the X-axis, and by looking at the Y-axis with appropriate frequency resolution\footnote{The frequency resolution must be set to $f_{CB}=200 \,\mathrm{kHz}$ or higher values for faster movement in the frequency spectrum.}, where the received power is represented\footnote{ Dependent of the manufacturer and settings of the spectrum analyzer, it can show signal amplitude, magnitude and power.}. By patiently observing the Y-axis it can be easily seen on the X-axis which channels are taken by other GSM service providers and which are free. The chosen channel ought to be peak free. Once a free frequency channel has been found, it is necessary to instruct the nanoBTS to operate in that frequency range. The line, numbered 58, has to be modified with the correct free ARFCN channel,in this case 877. \begin{lstlisting} arfcn 877 \end{lstlisting} The ARFCN channel value can be calculated using the given formula in \eqref{eq:arfcn}, where $f_{start}$ is the starting frequency of the uplink bandwitdh for DCS1800, $f_{CB}$ is the channel bandwidth and \textit{Offset} is the offset\footnote{ A table with frequency channels can be found at the following URL: \url{https://gsm.ks.uni-freiburg.de/arfcn.php}}. \begin{equation} \label{eq:arfcn} \centering \begin{array}{l} \displaystyle f_{up}(\mathrm{ARFCN}) = f_{start}+f_{CB}\cdot(\mathrm{ARFCN}-\mathrm{Offset}) \\ \displaystyle \\ \displaystyle where \left\{ \begin{array}{rcl} f_{start} & = & 1710.2 \,\mathrm{MHz} \\ f_{CB} & = & 200 \,\mathrm{kHz} \\ \mathrm{Offset} & = & 512 \end{array}\right. \end{array} \end{equation} %Multiple aligned equation %\begin{equation} %\label{eq:15} %\centering %where \left\{ \begin{array}{rcl} % f_{start} & = & 1710.2 \,\mathrm{MHz} \\ % f_{CB} & = & 200 \,\mathrm{KHz} \\ % \mathrm{Offset} & = & 512 %\end{array}\right. %\end{equation} On line numbered 53, the last configuration file modification has to be made for the final configuration of the OpenBSC software. The Unit ID from the output above has to be set\footnote{Indentation has to match the one of the configuration file.}. \begin{lstlisting} ip.access unit_id 1801 0 \end{lstlisting} At this point the nanoBTS and OpenBSC configuration is done. \newpage \subsection{Installation and configuration of GNSS assistance software} To install the RRLP software that generates GNSS assistance data several libraries are required to be installed, \textit{cURL}\footnote{It may happen that the given download URLs are wrong and in the meantime have changed, but one can easily find the latest versions on \url{http://curl.haxx.se/} and \url{http://www.hyperrealm.com/libconfig/}}, \textit{libconfig} and \textit{SQLite}. \textit{cURL} was used for the purpose of safely downloading GNSS data from the Navigation Center of the US Coast Guard and Trimble server. \textit{libconfig} library is used for reading in the configuration file, this way compiling of the software whenever one changes the settings was avoided. The \textit{SQLite} library was employed to access the database used by OpenBSC to store the respondence data from the mobile stations. \begin{lstlisting}[backgroundcolor=\color{light-gray}][numbers = none] cd ~/gsm_localization sudo apt-get install libsqlite3-dev wget http://curl.haxx.se/download/curl-7.25.0.tar.gz wget http://www.hyperrealm.com/libconfig/libconfig-1.4.8.tar.gz tar -xvzf curl-7.25.0.tar.gz tar -xvzf libconfig-1.4.8.tar.gz cd curl-7.25.0 make sudo make install cd .. cd libconfig-1.4.8/ ./configure make sudo make install \end{lstlisting} Once the libraries have been successfully installed, the user may proceed with the configuration and compiling the GNSS assistance software, which is the key software produced in this thesis. The configuration file can be found in the same directory as the RRLP modules under the name: ``gnssrrlp.cfg''. The sample configuration file is already preconfigured for the location of ``Angewandte Mathematik und Rechenzentrum'' building. Latitude and longitude of the BTS are expressed in decimal degrees and are bounded by \textpm90\textdegree and \textpm180\textdegree respectively. Positive latitudes are north of the equator, whereas negative are south of the equator. It is alike for longitude coordinates, positive longitudes are east of Prime Meridian and negative are west of the Prime Meridian. If the position in decimal degrees of the BTS is unknown, it is straightforward to derive them using the formula given in \eqref{eq:dd}, where $D$ are degrees, $M$ are minutes and $S$ are seconds\footnote{An online converter of the Federal Communication Commission can be used as well to convert from degrees, minutes and seconds to decimal degrees and vice versa \url{http://transition.fcc.gov/mb/audio/bickel/DDDMMSS-decimal.html}}. \begin{equation} \label{eq:dd} \centering DD = D + \frac{M}{60} + \frac{S}{3600} \end{equation} The altitude may be left as it is, set to 0, since it is not used in the current measurement technique\footnote{If the value is set to zero, it is important to set it to 0.0 because \textit{libconfig} would otherwise convert it to an integer however it is a floating point number.}. \todo{Describe other parameters as well.} \begin{lstlisting} // An example configuration file for the GNSS RRLP software. name = "Configuration for GNSS and RRLP"; // Change the settings if required: settings = { config = ( { ephemeris_url = "ftp://ftp.trimble.com/pub/eph/CurRnxN.nav"; almanac_url = "http://www.navcen.uscg.gov/ ?pageName=currentAlmanac&format=yuma"; latitude_of_BTS = 48.003601; longitude_of_BTS = 7.848056; altitude_of_BTS = 0.0; uncertainty_of_lat_long = 7; uncertainty_of_alt = 7; confidence_level = 0; ephemeris_repair = false; use_reference_time = false; extra_seconds_to_add = 7; timezone_of_BTS = 1; time_to_refresh_ephem = 1; time_to_refresh_alm = 1 ; } ); }; \end{lstlisting} \todo{CHECK IF THIS IS CORRECT} \label{accuracyUncertainty} The uncertainty of the latitude and longitude correctness can be described using equation \eqref{eq:unclatlong} \citep{3gppequations}. The uncertainty of $r$ is expressed in meters, it defines how accurate is the specified location of the BTS. In the configuration file, $K$ is set to 7, which corresponds to $r$ = 9.4872 m. Instead of using the integer parameter $K$ as the known variable, the equation \eqref{eq:unclatlong} can be rewritten as in \eqref{eq:unclatlongnew}, where we can get the integer value $K$ for a previously selected $r$. \begin{equation} \label{eq:unclatlong} \centering \begin{array}{l} \displaystyle r=C((1+x)^{K}-1) \\ \displaystyle \\ \displaystyle where \left\{ \begin{array}{rcl} C & = & 10 \\ x & = & 0.1 \\ K & \in & [0,127] \cap \mathbb{N}_{0} \end{array}\right. \end{array} \end{equation} \begin{equation} \label{eq:unclatlongnew} \centering \begin{array}{l} \displaystyle K=\bigg\lceil\frac{ln(\frac{r}{C}+1)}{ln(1+x)}\bigg\rceil \\ \displaystyle \\ \displaystyle where \left\{ \begin{array}{rcl} C & = & 10 \\ x & = & 0.1 \\ r & \in & [0,1800]\, \mathrm{km} \end{array}\right. \end{array} \end{equation} A set of uncertainties $r$ is given in table \ref{tab:unclatlong} for various integer values of $K$. \begin{table}[h] \centering \begin{tabular}{|c|c|} \hline Value of $K$ & Value of uncertainty $r$\\ \hline 0 & 0 m\\ \hline 1 & 1 m \\ \hline 2 & 2.1 m\\ \hline 3 & 3.3 m\\ \hline - & - \\ \hline 20 & 57.3 m\\ \hline - & -\\ \hline 60 & 3.0348 km\\ \hline - & -\\ \hline 100 & 137.8 km\\ \hline - & -\\ \hline \end{tabular} \caption{Example uncertainties (latitude and longitude) for various integer values of $K$} \label{tab:unclatlong} \end{table} Altitude uncertainty can be described using the same Binomial expansion method, as given in \eqref{eq:uncalt}, however with altered constant values \citep{3gppequations}. The altitude uncertainty ranges between 0 m and 990.5 m ($h\in[0,990.5]\, \mathrm{m}$). Although the same constant name $K$ is used, it describes the altitude uncertainty, \eqref{eq:uncaltnew}. \begin{equation} \label{eq:uncalt} \centering \begin{array}{l} \displaystyle h=C((1+x)^{K}-1) \\ \displaystyle \\ \displaystyle where \left\{ \begin{array}{rcl} C & = & 45 \\ x & = & 0.025 \\ K & \in & [0,127] \wedge \|K\| \end{array}\right. \end{array} \end{equation} \begin{equation} \label{eq:uncaltnew} \centering \begin{array}{l} \displaystyle K=\bigg\lceil\frac{ln(\frac{h}{C}+1)}{ln(1+x)}\bigg\rceil \\ \displaystyle \\ \displaystyle where \left\{ \begin{array}{rcl} C & = & 45 \\ x & = & 0.025 \\ h & \in & [0,990.5]\, \mathrm{m} \end{array}\right. \end{array} \end{equation} A set of uncertainties $h$ is given in table \ref{tab:uncalt} for various integer values of $K$. \begin{table}[h] \centering \begin{tabular}{|c|c|} \hline Value of $K$ & Value of uncertainty $h$\\ \hline 0 & 0 m\\ \hline 1 & 1.13 m \\ \hline 2 & 2.28 m\\ \hline 3 & 3.46 m\\ \hline - & - \\ \hline 20 & 28.74 m\\ \hline - & -\\ \hline 60 & 152.99 m\\ \hline - & -\\ \hline 100 & 486.62 m\\ \hline - & -\\ \hline \end{tabular} \caption{Example uncertainties (altitude) for various integer values of $K$} \label{tab:uncalt} \end{table} Confidence level is the next parameter in the configuration file that needs to be set. It can take any integer value between 0 and 127. The confidence level defines the percentage of the confidence that the target entity, the GSM user one wants to locate, is within the geometric shape defined earlier. A value of 0 and between 100 and 127, may be interpreted as ``no information'' \citep{3gppequations}. The reason why the values are not limited to 100 is because of the nature of binary numbers and that $2^6$ bits is not sufficient to represent the number 100, but rather requires one bit more. Confidence level is followed by the ephemeris repair option. Ephemeris repair is a variable of the boolean type, it can take two different values \textit{true} or \textit{false}. Ephemeris data may contain errors or miss some satellite information \citep{NASA-Ephem-Errors} \citep{Stanford-Ephem-Errors} and the ephemeris repair function, if set to true, will take data of the previous measurement report. This introduces an error as well. To increase the speed of measurement report, reference time can be used to provide extra information for the A-GPS in the MS of target entity. This field is of boolean type, if set to true, reference time is included in the sent packets. Since the sent packets are not transmitted in real time but put on a stack and then sent to the MS, a time delay exists. A solution to this problem is to add extra seconds to the reference time being sent. In order to assess the amount of extra seconds to add, the GSM operator is required experimentally to verify his/her findings. \todo{see how much the reference time can deviate from current time}. The reference time being sent to the MS is Coordinated Universal Time (UTC). The GPS device receives UTC time from the satellites and adjusts the computer time. To set the correct time, time zone offset of the BTS ought to be set correctly. Finally, the refresh time of downloading new almanac and ephemeris data has to be set. The variable uses the hour unit, how often the data are being downloaded. If the data are used from a local GNSS station, refresh time of the ephemeris data should be set to every 30 minutes or 0.5 hours. The almanac data are valid for up to 180 days \citep{GPS-Guide} but are updated usually every day\footnote{Almanac update times can be found here: \url{http://www.navcen.uscg.gov/?pageName=currentNanus&format=txt}} \citep{GPS-Pentagon}. \newpage \section{Sourcecode} Example: \lstset{% caption=,% label=lst:example,% } \begin{lstlisting} #include int main(void) { printf("Hallo Welt!\n"); return 0; } \end{lstlisting} \section{GPS Constants and equations} \label{sec:gpsConsAndEq} \begin{alignat}{4} & A & = & \; (\sqrt{A})^2 \nonumber \\ & n_{0} & = &\; \sqrt{\frac{\mu}{A^3}} \nonumber \\ & t_{k} & = &\; t-t_{oe} \nonumber \\ & n & = &\; n_{0} + \Delta n \nonumber \\ & M_{k} & = &\; M_{0} + nt_{k} \nonumber \\ & M_{k} & = &\; E_{k} - e\sin E_{k} \nonumber \\ & v_{k} & = & \tan ^{-1} \left( \frac{\sin v_{k}}{\cos v_{k}} \right) = \tan ^{-1} \left( \frac{\frac{\sqrt{1-e^2} \sin E_{k}}{1-e \cos E_{k}}}{\frac{\cos E_{k}-e}{1-e\cos E_{k}}} \right) \nonumber \\ & v_{k} & = & \tan ^{-1} \left( \frac{\sin v_{k}}{\cos v_{k}} \right) = \tan ^{-1} \left( \frac{\sqrt{1-e^2} \sin E_{k}/(1-e \cos E_{k})}{(\cos E_{k}-e)/(1-e\cos E_{k})} \right) = \tan ^{-1} \left( \frac{\sqrt{1-e^2} \sin E_{k}}{\cos E_{k} - e} \right) \nonumber \\ & E_{k} & = & \cos ^{-1} \left( \frac{e+\cos v_{k}}{1+e \cos v_{k}} \right) \nonumber \\ & \Phi_{k} & = &\; v_{k} + \omega \nonumber \\ & \delta u_{k} & = &\; c_{us} \sin{2\Phi_{k}} + C_{us} \cos{2\Phi_{k}} \\ & \delta r_{k} & = &\; c_{rc} \cos{2\Phi_{k}} + C_{rs} \sin{2\Phi_{k}} \nonumber \\ & \delta i_{k} & = &\; c_{ic} \cos{2\Phi_{k}} + C_{is} \sin{2\Phi_{k}} \nonumber \\ & u_{k} & = &\; \Phi_{k} + \delta u_{k} \nonumber \\ & r_{k} & = &\; A(1-e\cos{E_{k}})+\delta r_{k} \nonumber \\ & i_{k} & = &\; i_{0} + \delta i_{k} + (IDOT)t_{k} \nonumber \\ & x_{k}^{'} & = &\; r_{k} \cos{u_{k}} \nonumber \\ & y_{k}^{'} & = &\; r_{k} \sin{u_{k}} \nonumber \\ & \Omega_{k} & = &\; \Omega_{0} + (\Omega - \Omega_{e})t_{k} - \Omega_{e}t_{oe} \nonumber \\ & x & = &\; x_{k}^{'} \cos{\Omega_{k}}-y_{k}^{'}\cos{i_{k}}\sin{\Omega_{k}} \nonumber \\ & y & = &\; x_{k}^{'} \sin{\Omega_{k}}-y_{k}^{'}\cos{i_{k}}\cos{\Omega_{k}} \nonumber \\ & z & = &\; y_{k}^{'} \sin{i_{k}} \nonumber \end{alignat} \begin{equation} \label{eq:paramconst1} \begin{split} \mu_{e} = 3.986004418\cdot 10^{14} \frac{m^3}{s^2} \end{split} \quad\Longleftarrow\quad \begin{split} \mbox{Geocentric gravitational constant} \end{split} \end{equation} \begin{equation} \label{eq:paramconst2} \begin{split} c= 2.99792458\cdot 10^{8} \frac{m}{s} \end{split} \quad\Longleftarrow\quad \begin{split} \mbox{speed of light} \end{split} \end{equation}