Bachelor Degree Project

Multilateration in Direct Short Range Communications Networks - utilising Basic Safety Messages and Received Signal Strength ranging

Author: Andrew Galbraith Supervisor: Francis Palma Semester: Spring 2020 Subject: Computer Science Abstract Traditional satellite positioning systems have limited resolution and have proved in- accurate in areas such as urban canyons where signals are subject to bounce phe- nomena or indeed may be entirely unavailable. An alternative method of positioning is that of tri/multilateration, which uses known positions and distances from beacon points to locate a receiver. In this project, a software was developed which used DSRC Basic Safety Messages (containing locational information) in combination with Received Signal Strength metrics (translated to distance information) to carry out such positioning in static environments. Initial studies confirmed that a signal received on the Craton 2 hardware was sub- ject to considerable signal strength spread approximating a Gaussian distribution. A software was developed to simulate BSMs, including a measure of perturbation, over TCP. Three different traffic scenarios were constructed. Furthermore, multilateration software was developed to receive the BSMs and calculate position using three sep- arate algorithms. The performance of these algorithms in the three different traffic scenarios was then evaluated. Lastly, the multilateration software was further de- veloped to allow for the capture and processing of real BSMs sent on the 5.9 GHz band. The multilateration software was capable of determining the location of the re- ceiver to varying degrees of accuracy, depending on the geometrical distribution of surrounding vehicles and the algorithm used to multilaterate. The 3D Linear method performed well in situations where beacons were well spaced in three dimensions. Other implemented multilateration algorithms, i.e., a 2D Linear Least Squares method and a 3D Gauss Newton method, performed better in typical traffic scenarios where vehicles tend to be coplanar. The software developed provides a useful starting point for further development of static, but also dynamic, multilateration algorithms. Keywords: DSRC, trilateration, multilateration, RSS, V2X Preface

I’m grateful to Cybercom Jönköping for the original concept, equipment loan and sup- port throughout the writing of this project. Particular thanks to Anna Blid and Bernard Mörtsell for taking the time to explain underlying concepts and for providing technical documentation (and general wisdom). Contents

List of Figures1

List of Tables1

1 Introduction3 1.1 Background...... 3 1.1.1 DSRC and LTE-V2X...... 3 1.1.2 Basic Safety Message (BSM)...... 4 1.1.3 Multilateration...... 4 1.1.4 Hardware used...... 5 1.2 Related work...... 5 1.3 Problem formulation...... 6 1.4 Motivation...... 6 1.5 Objectives...... 6 1.6 Scope/Limitation...... 7 1.7 Target group...... 7 1.8 Outline...... 7

2 Method8 2.1 Overview...... 8 2.1.1 Languages and Libraries Used...... 8 2.1.2 Build Environment and Initial Development...... 8 2.1.3 Data Collection...... 9 2.2 Reliability and Validity...... 9 2.3 Ethical considerations...... 9

3 Implementation 10 3.1 Propagation Models...... 10 3.1.1 Free Space Propagation Model...... 10 3.1.2 Empirical Free Space Model...... 11 3.1.3 Two-ray Interference Model...... 11 3.1.4 Model Comparison...... 11 3.2 Coordinate Systems...... 12 3.3 Multilateration Calculations...... 13 3.3.1 Closed Form Multilateration with Linear Least Squares...... 13 3.3.2 Gauss-Newton Multilateration...... 14 3.3.3 Dilution of Precision...... 14 3.4 Dataset Implementation...... 16 3.5 Implementation of Beacon Simulator - BSM-beacon-sim...... 16 3.6 Implementation of Multilaterator - BSM-multilaterator...... 17 3.6.1 Usage...... 18 3.6.2 Dependencies and attributions...... 19 3.6.3 Notes concerning Program Structure...... 19 3.6.4 Known Bugs...... 20 3.7 Generated Datasets...... 21 3.7.1 New Mexico...... 21 3.7.2 Chapultepec...... 21 3.7.3 E4...... 21 4 Results 24 4.1 Received Signal Strength Spread, Indoor Environment...... 24 4.2 Received Signal Strength, Indoor Environment...... 24 4.3 Multilaterator Simulated Performance...... 25 4.3.1 New Mexico Dataset...... 25 4.3.2 Chapultepec Dataset...... 25 4.3.3 E4 Dataset...... 25 4.3.4 Mean Error of Multilateration Algorithms...... 25 4.3.5 Average Calculation Times of Multilateration Algorithms.... 26

5 Analysis 28 5.1 Received Signal Strength Spread, Indoor Environment...... 28 5.2 Received Signal Strength, Indoor Environment...... 28 5.3 Multilaterator Simulated Performance...... 28 5.4 Average Calculation Times of Multilateration Algorithms...... 28

6 Discussion 29 6.1 RSS to Distance...... 29 6.2 Multilateration...... 29 6.3 Methodology Shortcomings...... 30

7 Conclusion 31 7.1 Future work...... 31

References 32

A Appendix 1A

B Appendix 2A List of Figures

1.1 The WAVE Stack...... 4 1.2 Progression of trilateration...... 5 3.3 Path Loss Model Comparison (Ptx = 33dBm, γ =2.5,  =5)...... 12 3.4 Earth Centered, Earth Fixed Coordinate System...... 13 3.5 East North Up (ENU) Coordinate System...... 13 3.6 Geometric Dilution of Precision (GDOP)...... 15 3.7 Overview of trilateration system...... 17 3.8 Multilaterator NCurses GUI...... 19 3.9 Chapultepec Dataset (distances in m)...... 22 3.10 E4 Dataset (distances in m)...... 22 4.11 Typical signal spread for recorded signal strength (Ptx = 4dBm, d = 30m, n=397, indoor environment)...... 24 4.12 Reported average RSS (n=566) between two Craton 2 EVKs in an indoor environment (Ptx = 4dBm, α = 2,  = 5, h = 0.5,n = 566, indoor environment)... 24 4.13 Performance of Multilateration Algorithms for New Mexico Dataset.... 25 4.14 Performance of Multilateration Algorithms for Chapultepec Dataset (LLS 3D Algorithm Excluded)...... 26 4.15 Performance of Multilateration Algorithms for E4 Dataset (LLS 3D Al- gorithm Excluded)...... 26

List of Tables

3.1 Path Loss Exponents for Various Environments [1]...... 11 3.2 Dilution of Precision for New Mexico Dataset...... 21 3.3 Dilution of Precision for Chapultepec Dataset...... 21 3.4 Dilution of Precision for E4 Dataset...... 23 4.5 Mean Error of Multilateration Algorithms/m (n=20)...... 26 4.6 Mean Calculation Time of Multilateration Algorithms in seconds (n=20). Number of beacons shown in parentheses...... 27 1.7 BSM Contents...... A Acronyms

BSM Basic Safety Message.

DSRC Dedicated Short Range Communications.

ECEF Earth-Centered Earth-Fixed coordinate system.

ENU East North Up coordinate system.

EVK Evaluation Kit.

GNSS Global Satellite System.

GSL GNU Scientific Library.

ITS Intelligent Transport System.

NED North East Down coordinate system.

RSS Received Signal Strength.

TDOA Time Difference of Arrival.

TOA .

V2X Vehicle To Everything.

WAVE Wireless Access in Vehicular Environments.

2 1 Introduction

1.1 Background The advent of intelligent transport systems (Intelligent Transport System (ITS)s) brings with it the challenge of communication between vehicles and other relevant entities, e.g., infrastructure or surrounding vehicles and pedestrians. Such communication has the po- tential to not only maximise road safety but also to improve factors such as traffic flow and vehicular energy consumption. Standards such as Vehicle To Everything (V2X) (Ve- hicle to Everything) have been developed to facilitate this information exchange. Central to V2X and other such standards is a vehicle’s ability to determine its position accurately. Traditional Global Navigation Satellite System (Global Navigation Satellite System (GNSS)) positioning systems have limited resolution and additionally have proved inac- curate in areas such as urban canyons where the necessary GNSS signals may be subject to bounce phenomena or indeed may be entirely unavailable [2]. Various solutions have therefore been suggested to augment GNSS information; several of these concern pro- cessing signal data broadcast from surrounding vehicles or infrastructural elements. For example, both Time of Arrival (Time of Arrival (TOA)) and Time Difference of Arrival Time Difference of Arrival (TDOA)) methods use the travel time of radio signals to de- termine distance from the transmitter to the receiver. Alternatively, and of relevance in this project, received signal strength (Received Signal Strength (RSS)) can also provide ranging data [3]. This technique uses a signal propagation model to calculate the distance travelled by radio waves based on the difference between transmitted and received signal strength.

1.1.1 DSRC and LTE-V2X In the emerging field of V2X communications, there are two predominant technologies [4].

• Direct Short Range Communications (Dedicated Short Range Communica- tions (DSRC)), also known as IEEE 802.11p or ITS-G5, is an extension of 802.11a (Wi-Fi) and was first standardized by IEEE in 2009. DSRC allows only direct com- munication between transport system elements.

• LTE-V2X was standardised by 3GPP in 2016 and encompasses two interfaces, i.e., a wide area network LTE that connects vehicles and devices to mobile networks, and a direct communications interface that connects vehicles directly to vehicles and infrastructure.

Both technologies operate in the 5.9GHz band when communicating directly. Hence- forth, DSRC will be the focus of this study. IEEE defines a radio communications system intended to provide interoperable services in an ITS called Wireless Access in Vehicular Environments Wireless Access in Vehicular Environments (WAVE)). WAVE standardizes the network stack used in DSRC, as shown in Figure 1.1. As in the OSI network model, messages are constructed in the application layer and passed downwards through the WAVE network stack, ultimately reaching the phys- ical layer whereupon the message is broadcast. A received message subsequently rises through the layers of the receiver network stack to then be consumed by the receiving application layer.

3 Figure 1.1: The WAVE Stack

1.1.2 Basic Safety Message (BSM) At the top of the WAVE stack, a set of message formats are defined by the SAE J2735 Message Set Dictionary standard. One such message is the Basic Safety Message (Basic Safety Message (BSM)), which conveys critical vehicle state information[4]. BSMs have a nominal transmission rate of 10 Hz and contain information pertaining to core data elements such as vehicle size, position, speed, heading, acceleration and brake system status. The structure of the BSM is well defined in SAE Standard J2735, Dedicated Short Range Communications (DSRC) Message Set Dictionary. The BSM consists of two parts, of which only the first part is compulsory. The second part consists of a large set of op- tional elements. AppendixA provides an overview of the obligatory first part of any BSM, from which it can be seen that every transmitted BSM contains the longitude, latitude and altitude of the transmitting unit. Signal strength data is, however, not transmitted in the BSM. The transmission of BSMs represents a core aspect of this work. Upon receiving a BSM, the receiver can evaluate the signal strength of the received transmission and thus calculate the distance to the sender. This then provides a measure of relative position from the sender to the receiver. Given that the BSM itself contains absolute positional data of the sender in the form of GNSS data, it should be possible to derive absolute positional information concerning the receiver.

1.1.3 Multilateration Multilateration is a method of determining the position of a point using range information from a number of surrounding points of known position. As shown in part B of Figure 1.2, given two points of known location A and B (termed beacons), the location of point P can be derived if the ranges of A and B from P are known. In this case, two locations P1 and P2 are possible. Given three beacons A, B and C, only one position is possible for point P . This methodology is equally valid in three dimensions, although in this case, multilateration can be visualised as the meeting point of a number of spheres. Multilateration with correct ranging information yields an exact position. However, in practice, the process increases in complexity due to the fact that errors tend to be present in all distance measurements and possibly in the locational data provided by beacons. In effect, this means that the circles in Figure 1.2 might never meet at any point. As such,

4 a mathematical model such as Linear Least Squares in often used to find the best fitting position from the data supplied.

Figure 1.2: Progression of trilateration

1.1.4 Hardware used The hardware used in this project to capture real-world BSMs consists of a number of Craton 2 Evaluation Kits (Evaluation Kit (EVK)s), i.e., evaluation and development plat- forms for DSRC technologies. Craton 2 EVKs are embedded systems with the necessary hardware to allow for DSRC software and application development, including CAN bus functionality, a GNSS receiver and radio hardware to transceive on the 5.9 GHz band prescribed by DSRC. In terms of architecture, Craton 2 EVKs have ARM processors, run a Linux operating system and make use of proprietary software stacks to provide the required WAVE functionality.

1.2 Related work The majority of RSS techniques for calculating distance derive from free space propa- gation, a model describing the energy loss of a radio signal through a medium. This model will be described in greater depth in upcoming chapters; however, the validity of the model in the complex environment of V2X infrastructure is central to several of the works cited here. Alam et al. [3] provide an overview of positioning through the use of signals broadcast in V2X communication, including techniques to utilise RSS, TOA, TDOA and Doppler Shift. Each method has its constraints, strengths and weaknesses. As regards RSS rang- ing, the authors conclude that the method in its basic form is easy to implement since it requires no specialist equipment and low algorithmic complexity. However, it is also highly sensitive to errors in the estimation of the path loss coefficient. This value, which reflects the ability of a medium to propagate radio waves (again, this coefficient, and its use in the free space propagation model, are central to this work and are further described in Chapter 3); such errors in turn lead to sizeable errors in distance measurements. Resul- tantly, in a vehicular network dynamic and accurate estimation of the path loss coefficient is necessary to maximise precision and make for usable positioning data [3]. Al-Stouhi and Miucic [5] investigated the use of signal strength data to perform abso- lute localization of vehicles from DSRC messages. This was the first large scale trial of its sort, with over 200 vehicles transmitting DSRC messages, of which 30 logged received data. The primary focus of this research was the question of how to treat the received data to achieve maximum locational precision. The authors point out a number of problems

5 inherent to the RSS method of positioning. Firstly, citing Alam et al. [3], the authors state that the range variance for any given path loss model increases exponentially with estimated range. Furthermore, Miucic has earlier experimentally shown that antennas themselves are prone to directional variance in RSS [6]. Given these theoretical sources of inaccuracy, and indeed through analysis of experimental data, the authors conclude that the free space propagation model, with no further algorithmic interpretation, is only accurate for distances of less than a few car lengths [2]. It, therefore, represents only a basic scenario for signal propagation. Subsequently, Al-Stouhi and Miucic [5] suggest various algorithmic implementations to increase locational precision, including the use of weighted least squares and Kalman filters. They conclude that range solely from RSS data has a high error rate, whereas adding weights to least squares minimization can improve localization. Ultimately, the best results were obtained from both Kalman filters and weighted least squares; a suitable level of accuracy was obtained at this point to allow for lane-level localization in the absence of GNSS information.

1.3 Problem formulation This project aims to:

• investigate current practices and theories as regards the utilisation of received signal strength (RSS) data to derive relative locational information.

• develop software to multilaterate an estimated position for a receiver based on RSS and the positional information contained in BSMs.

• assess the accuracy of obtained positional data and subsequently evaluate its suit- ability in a V2X context.

1.4 Motivation Precision as regards the localisation of vehicular transport is central to any autonomous concept. Even in non-autonomous contexts, increased precision can only bear positive results, for example fewer fatalities and reduced congestion. Collateral economic ben- efits include lower health care expenditure at a state and individual level, and increased customer confidence in vehicle manufacturers leading to an increase in sales volume.

1.5 Objectives O1 Background to RSS positioning and multilateration; RSS theory, co- ordinate systems and treatment of multiple sources of data, each with a margin of error O2 Obtain raw RSS data from Autotalks Craton 2 EVK unit. O3 Implement software solution to determine static relative positional data using raw RSS data O4 Implement software solution to multilaterate static absolute position using n>=3 beacons, based on each unit’s GNSS position.

6 1.6 Scope/Limitation In terms of scope, the following points apply:

• project scope is defined partly by available hardware; in this case, Autotalks Craton 2 EVK units act as transmitter and receiver, and their underlying Linux operating system, in addition to a software stack, provides a means of obtaining RSS data.

• locational data will be based on static hardware units to eliminate latency concerns with signal data from dynamic units and to remove the need for specialist equip- ment, e.g., a dedicated sensor-equipped test track.

1.7 Target group This project is of relevance to any party with an interest in autonomous vehicles or in- telligent transportation infrastructure, where the ability to accurately position vehicles, especially in situations where GNSS data is lacking, is of growing importance. Although the results obtained in this project will derive from a specific hardware implementation and software stack, it is hoped that these results can be generalised.

1.8 Outline The report adopts the standard structure for a research paper.

• Initially, the method used is discussed and documented.

• The implementation section details physical considerations relevant to the project, such as free space propagation of radio waves and coordinate systems. Software architecture and code solutions used in the project are also discussed here.

• Initial results will concern static linear distance measurements and their respective errors. Subsequently, distance estimations will be expanded into positional estima- tions using multilateration.

• Analysis will be performed on achieved results through error inspection.

• Discussion of analysed results will take place, focusing on distance estimations, distance errors and the possibility of using RSS techniques in V2X environments.

• Conclusion: the findings of this report will be summarised and suggestions for future work will be given.

7 2 Method

2.1 Overview The goal of this project is to develop software to multilaterate through the use of loca- tional and signal strength information available in broadcast BSMs. The project follows a design science methodology and accordingly the development of the artefact to be imple- mented i.e., multilateration software, is very much an explorative process. In this process a number of solutions to the problem in hand will be evaluated. The software is regarded as innovative in the sense that it is not yet commonplace in the V2X context. In terms of time, logistics and equipment required, it would be beyond the project scope to test the software to any meaningful degree on actual vehicles. Basic trilateration, for example, would require three vehicles broadcasting their position and one vehicle to receive, while more accurate modelling of urban traffic environments would require additional vehicles. Such logistical problems can be mitigated to some degree by the use of Evaluation Kits (in this case Craton EVKs), i.e., development modules which contain V2X hardware and software identical to that used in vehicles. Although these are certainly more portable and less expensive, the EVKs available in this project still require a suitable power source, e.g., mains electricity or a battery of similar amperage to that of a car battery. As such, even using EVKs it is still somewhat impractical to develop and test primarily on these units. Accordingly, the development process will feature only basic testing on actual V2X hardware kit units. Essentially, two branches of the software will be developed; the first will run on x86-64 Linux devices (henceforth termed x86-64 version) and accept simu- lated BSMs over TCP. This will then be adapted to run on the EVK’s embedded environ- ment (henceforth termed EVK version), dealing with real BSMs.

2.1.1 Languages and Libraries Used Modelling of beacon and receiver positions, distances and simulated RSS will be carried out in MatLab/Octave, resulting in one CSV dataset per traffic scenario. Software consuming generated CSV files simulating the periodic transmissions of BSMs (referred to as BSM-beacon-sim) will be written in Python, using NumPy to per- turb signal strength data. The multilateration software product (referred to as BSM-multilaterator) will be writ- ten in C using Visual Studio as an IDE. As stated, there are two branches of this artefact. The x86-64 version will be compiled and debugged in Ubuntu Windows Subsystem for Linux(WSL) using gcc and gdb, respectively. The EVK version is compiled in a separate build environment detailed below. Much of the C code will be compilable on any oper- ating system, although socket handling, threading and certain terminal related commands are specific to Posix systems. The EVK version will make use of proprietary software stacks to interface with radio hardware on the EVK units. GNU Scientific Library(GNU Scientific Library (GSL)) will be required to handle matrix operations in both versions. Similarly, the NCurses library is required to provide a GUI.

2.1.2 Build Environment and Initial Development A suitable build environment will be required to compile the binaries capable of running on Craton EVKs. Specifically, the Craton runs Linux on a 32 bit ARM Cortex A7 proces-

8 sor. The build environment, identical to that used by Cybercom Jönköping, stems from the Yocto project, an open-source initiative providing toolchains and a Linux reference distribution (Poky) for embedded projects.

2.1.3 Data Collection In addition to the multilateration software, basic testing of RSS strength and signal spread will be performed with the aim of choosing and validating algorithm choice in the multi- lateration software. To carry out these tests, BSM sender and receiver software must be built. The EVKs will be statically located at known distances from each other and the receiver will log received BSMs along with signal strength data. This data will then be exported and analysed to examine signal strength spread and the fit of various path loss models.

2.2 Reliability and Validity In terms of reliability, the experimental data in this project is specific to a certain hardware set, although it is hoped that general conclusions concerning the viability of positioning via RSS in a V2X environment can be developed. In accordance with Alam, Balaei and Dempster [3], it should be noted that correct interpretation of signal strength data is highly reliant upon a correct estimation of the path loss coefficient. This coefficient varies depending upon a myriad of environmental factors, such as surrounding walls and buildings and other radio signals present. Thus those hoping to reproduce experimental data exactly will find it challenging. However, this problem will be mitigated to some degree by the use of statistical measures, e.g., averaging signal strength over a time period. Validity in this work depends upon the accurate measurement of signal strength data. Inaccuracies here may lead to inaccurate conclusions and so it is of interest to document from where signal strength readings are obtained. For example, a manufacturer may advertise a certain power level for a transmitter when, in fact, the true power level is considerably less. Similarly, received signal levels will be taken from packet data, and again here it is of some interest to understand the origins of the level information.

2.3 Ethical considerations There are few ethical aspects to consider, given that this work follows a design science methodology. However, it should be noted that this work has been carried out in conjunc- tion with a commercial company, and therefore, full details of software stacks used will not be given.

9 3 Implementation

This section aims to describe various theories which contribute to the task of localising vehicles through RSS data; furthermore, an overview of the implementation of beacon simulation and multilateration software is provided.

3.1 Propagation Models The nature of radio wave propagation differs depending upon a myriad of variables, in- cluding obstacles, line-of-sight and atmospheric conditions [7]. The basic mechanisms of propagation are reflection, diffraction and scattering, and a number of models have been conceived which attempt to describe wave propagation in different scenarios based on these propagation mechanisms. In general, these models result in a value for the path loss, i.e., the ratio between the transmitted power and the received power of the wave. A number of these models are described here.

3.1.1 Free Space Propagation Model The Free Space Propogation Model (FSPM) may be regarded as the simplest propagation model in that all obstacles that may affect the field are disregarded [7]. This assumption is generally permissible over longer distances where the impact of obstacles is negligible. Assuming an isotropic antenna (one in which energy flows with equal strength in all directions), the transmitted power Pt will be distributed over the surface of a sphere: P S = t (1) r 4πd2

2 where Sr is power density (W/m ) and d is the distance between transmitter and receiver. Accordingly, the received power depends on the effective area of the receiving antenna that is able to collect the transmitted energy. This is defined as a quantity Ae, i.e., the effective aperture. Therefore: A P P = e t (2) r 4πd2 Thus this basic model demonstrates that the received power decays with the square of the distance between the antennae, regardless of frequency. The free space path loss is 2 defined as L = Pt and from equation2, taking A = λ : Pr e 4π 4πd L = ( )2 (3) freespace λ

! 4πdf 2 4πdf  L [dB] = 10 log = 20 log freespace 10 c 10 c 4π  (4) = 20 log (d) + 20 log (f) + 20 log 10 10 10 c

= 20 log10(d) + 20 log10(f) − 147.55

10 3.1.2 Empirical Free Space Model The free space model assumes perfect conditions and a line-of-sight path between the transmitter and receiver. This model rarely describes situations found in practice, and as such, an empirical adaptation has been refined to account for propagation behavior accurately [8]. The introduction of a path loss exponent α accounts for non-ideal channel conditions. dα L [dB] = 10log (16π2 ) (5) emp−freespace 10 λα The value of α is situation dependent as shown in Table 3.1.

Environment Path Loss Exponent α Free Space 2 Urban area cellular radio 2.7 to 3.5 Shadowed urban cellular radio 3 to 5 In building line-of-sight 1.6 to 1.8 Obstructed in building 4 to 6 Obstructed in factories 2 to 3 Table 3.1: Path Loss Exponents for Various Environments [1]

3.1.3 Two-ray Interference Model The more realistic treatment of radio propagation [1] takes into account constructive and destructive interference of a transmission with its refracted self. In the two-ray interfer- ence model, the interference between the line-of-sight transmission and its ground reflec- tion is modelled. This is based on the phase difference ϕ of the interfering rays. The two-ray interference model loss can be modelled as

d −1 L [dB] = 20log (4π |1 + Γeiϕ| ) (6) tri 10 λ where: d − d ϕ = 2π los ref (7) λ √ sinθ −  − cos2θ Γ = i √ r i (8) 2 sinθi + r − cos θi

3.1.4 Model Comparison The three propagation models described here are graphed in Figure 3.3 over a distance of 1 km and with an initial signal strength of 33 dBm (this value is the nominal maximum broadcast signal strength as defined by regulatory bodies). As can be seen, the models vary substantially over this range.

11 Figure 3.3: Path Loss Model Comparison (Ptx = 33dBm, γ =2.5,  =5)

3.2 Coordinate Systems Pertinent to this work is the matter of the coordinate systems used to define location. The approaches used in this project are listed below:

• Geodetic coordinate system - locations are described by latitude (φ), longitude (λ), and height (h). Although the coordinate system itself is well-established, the geometric model used to describe the Earth varies. Perhaps most widely used is the World Geodetic System 1984 (WGS 84), which models the Earth as an ellipsoid. Other ellipsoidal models exist (e.g., the OSGB36 model which provides higher ac- curacy over the British Isles). In terms of calculations, it is often more convenient and faster to model the Earth as a sphere.

• Earth-Centered, Earth-Fixed (Earth-Centered Earth-Fixed coordinate system (ECEF)) - this system is cartesian in nature. Again, the origin lies at the Earth’s center; the z-axis then passes through true north. The x-axis intersects the sphere at 0deg latitude. These systems, and the relation between them, are shown below in Figure 3.4.

• East North Up (East North Up coordinate system (ENU)) and North East Down (North East Down coordinate system (NED)) -Both ENU and NED are forms of tangent plane coordinate systems based on the local vertical direction and the Earth’s axis of rotation. The axes are location-dependent and cartesian. The three coordinates used in the system represent position along the north axis, posi- tion along the local east axis, and vertical position. ENU and NED are right-handed variants of each other, differing in the direction of the vertical axis. ENU and NED coordinate systems are often deemed more intuitive than both ECEF and Geodetic systems. Figure 3.5 demonstrates the ENU coordinate system.

12 Figure 3.4: Earth Centered, Earth Fixed Coordinate System

Figure 3.5: East North Up (ENU) Coordinate System

3.3 Multilateration Calculations This section describes the process of positioning by multilateration. A number of methods exist; those used in this project are a closed-form method using a Linear Least Squares approach, and the Gauss Newton , using Non-linear Least Squares.

3.3.1 Closed Form Multilateration with Linear Least Squares Examples below use two dimensions for the sake of brevity, but can be easily extended into three dimensions. Assuming a cartesian coordinate system, a beacon transmitter with position (x1, y1), a receiver at unknown point (xu, yu), and line-of-sight distance r between transmitter and receiver, it can be shown by Pythagoras theorem that:

2 2 2 (x1 − xu) + (y1 − yu) = r1 (9) Extending this to a situation consisting of three transmitters with known positions and exact ranges to the receiver yields a determined set of equations which are solvable by methods such as Gaussian Elimination. As such, the exact position of the receiver can be calculated. However, this scenario differs from real-life situations in that distance measurements are, in fact, only estimates and contain an unknown error. Besides, multiple transmit- ters will likely deliver position and distance information. Mathematically this yields the overdetermined equation system shown in Equation 10:

13    2 2 2 2 2 2  xn − x1 yn − y1 (r − r ) − (x − x ) − (y − y ) x  1 n 1 n 1 n 2  . .  u =  .   . .  y  .  u 2 2 2 2 2 2 xn − xn−1 yn − yn−1 (rn−1 − rn) − (xn−1 − xn) − (yn−1 − yn) (10) Equation 10 has then been expressed in a format similar to Ax=b which can then be solved using the Linear Least Squares (LLS) method. The multilateration software uses the Gnu Scientific Library for this calculation and so the solving process is not docu- mented here.

3.3.2 Gauss-Newton Multilateration

Again, assuming a 3D cartesian coordinate system with beacon positions (xi, yi, zi), re- ceiver at unknown point (xu, yu, zu), and line-of-sight distance ri:

2 2 2 2 (x1 − xu) + (y1 − yu) + (z1 − zu) = r1 (11) Rearranging equation 11:

p 2 2 2 r1 − (x1 − xu) + (y1 − yu) + (z1 − zu) = 0 (12) Equation 12 is then in a format suitable for solving with the Gauss Newton method as shown in equation 13.

(s+1) (s) T −1 T  (s) β = β − Jr Jr Jr r β (13) where:

 p 2 2 2 r1 − (x1 − xu) + (y1 − yu) + (z1 − zu) p 2 2 2 r2 − (x2 − xu) + (y2 − yu) + (z2 − zu)  r =  p 2 2 2 (14) r3 − (x3 − xu) + (y3 − yu) + (z3 − zu)   .  .

and Jr is the Jacobian matrix of r:

 (x1−xu) (y1−yu) (z1−zu)  r1 r1 r1  (x2−xu) (y2−yu) (z2−zu)   r2 r2 r2  Jr =  (x3−xu) (y3−yu) (z3−zu)  (15)  r r r   3 .3 3  .

3.3.3 Dilution of Precision The accuracy of multilateration in the case of interpreted range measurements is not solely a function of range accuracy, but also of beacon geometry in relation to the receiver. One of the primary uses of multilateration is in GNSS systems themselves, where research has shown that the geometry of available satellites contributes to the overall accuracy of the final position estimation. As shown in Figure 3.6, satellites which are closer together lead to a greater positional uncertainty [9]. Poor beacon geometry in pseudo-range satellite systems has been termed geometric dilution of precision (GDOP).

14 Figure 3.6: Geometric Dilution of Precision (GDOP)

This project is not concerned with satellite geometry and its implications for GNSS ac- curacy, although ultimately, this has a role to play given that errors in a vehicle’s broadcast position propagate throughout the resulting V2X multilateration calculations. Instead, the topic of dilution of precision is discussed here for the following reasons:

1. It is desirable that multilateration software should be able to estimate the the poten- tial errors in its positioning. GDOP values based on calculated position give such an estimate. As such, GDOP should be implemented as a software feature.

2. Again as a software feature, in situations with multiple beacons, it may be desirable to choose a smaller subset of beacons with optimal geometry. GDOP is a potential heuristic in the selection process.

3. It is possible that the "spread" of beacons around the receiver has implications for the accuracy of the multilateration algorithms implemented in this project. The true GDOP values (based on actual receiver coordinates as opposed to the calculated receiver coordinates in points 1 and 2 above) of generated datasets are therefore shown. Note that this is not the main project focus and the correlation between dilution of precision and algorithmic performance requires further investigation.

The calculation of GDOP is shown in Equations 16 and 17. Many of the matrix entries in Equation 16 are identical to those used in the Gauss-Newton iterative method. Further examination shows that these entries are direction cosines, detailing the angles between the beacons and the receiver. Note that the fourth column is distinct from the Gauss Newton matrix. This column is used in satellite multilateration in relation to an additional parameter, i.e., the time error used in the calculation of distance. As such, it has no relevance in non-TDOA systems but is included here and in software calculations in order to maintain a similar GDOP scale to that of GNSS.   (x1−xu) (y1−yu) (z1−zu) −1 r1 r1 r1  (x2−xu) (y2−yu) (z2−zu) −1  r2 r2 r2  A =  (x3−xu) (y3−yu) (z3−zu)  (16)  r r r −1  3 .3 3  .

15 Q = (AAT )−1  2  σx σxy σxz σxt 2 σxy σy σyz σyt =  2  σxz σyz σz σzt 2 σxt σyt σzt σt q 2 2 2 2 GDOP = σx + σy + σz + σt (17)

GDOP is inversely related to the variance of the angles between beacon and receiver. High GDOP numbers correlate to high dilution of precision and so smaller numbers are desirable in the case of positioning systems. GDOP consists of horizontal and vertical components which themselves describe the spread of beacons in the horizontal plane and vertical plane; these are termed HDOP (Horizontal Dilution of Precision) and VDOP (Vertical Dilution of Precision) and are calculated as shown in equation 18: q 2 2 HDOP = σx + σy

p 2 VDOP = σz (18) q 2 2 2 PDOP = σx + σy + σz where PDOP is the total dilution of precision due to position.

3.4 Dataset Implementation Datasets, stored as CSV files, were generated in Octave. AppendixB demonstrates the code used to produce the New Mexico set, described in a later section. Dataset generation generally involved converting lat,lon,alt coordinates to a cartesian system and then cal- culating positions, distances and signal strengths. Finally, positions were converted back to LLA coordinates and beacons and receiver information was output to a CSV file. A typical resulting CSV file is shown in Listing1. The first line in the CSV file details the expected format of the following lines. type,id,time,lat,lon,alt,rss RECEIVER,100,50,58.03288549579754,14.4913419217687,200, BSM,1,1,58.03309603982272,14.49151756511901,200,-43.04431570095784 BSM,2,1,58.03295087538793,14.49139646351654,200,-32.88629763727572 BSM,3,1,58.03324977252567,14.491958668946,200,-49.59785648404674 BSM,4,1,58.03338387817997,14.4917576938369,200,-50.52871792432113 BSM,5,1,58.03312232315001,14.491844071702,200,-46.83998662283356 Listing 1: CSV example

3.5 Implementation of Beacon Simulator - BSM-beacon-sim The beacon simulator is a simple Python script that reads beacon and receiver information from an existing CSV file and transmits this information as text over TCP to a chosen recipient. As is apparent from the header row in the CSV file in Listing1 it is possible to spec- ify the periodicity of emissions for each beacon in seconds. Transmitted RSS values are calculated using Free Space Path Loss equations in Octave, based on actual distance from

16 beacon to the receiver. In an attempt to simulate the Gaussian nature of the RSS sig- nal strength, the value of the transmitted RSS is perturbed in a Gaussian fashion with a standard deviation of 1. BSM-beacon-sim begins by consuming the CSV file and constructing a beacon object for each row in the file. A socket is opened to the target and shared with the beacon objects which run on separate threads. Each beacon instance then sends its position and signal strength to the target and then sleeps until it is time to send again.

3.6 Implementation of Multilaterator - BSM-multilaterator

Figure 3.7: Overview of trilateration system

As shown in Figure 3.7 the software in question essentially performs two modular calculations. In the first step, BSM transmissions are received and distances calculated in the second multilateration are carried out. More specifically, program flow is as follows:

1. Collect beacon positional and distance information

2. Convert all coordinates to a Cartesian system. NED is used in this case rather than ECEF; this leads to smaller, more comprehensible coordinates.

3. Equation systems are built. For LLS, a closed-form equation system is built, with the consequence that one extra beacon point is required, i.e., a minimum of four. Gauss Newton requires only three beacons.

4. The equation system is solved. LLS makes use of the GNU scientific library in this implementation. GN does not require that library. Note that the GN solver must be fed a starting guess.

5. The results are translated back to Lat, Lon, Alt.

An attempt is also made to calculate the suitability of the geometry of the beacons by calculating GDOP values. GDOP checks if the geometry of the beacons in relation to the receiver helps to cancel out the probability of errors - low GDOP is best. In its current implementation, this software calculates position in three modes:

1. LLS in 2D from 3D NED values - this method assumes all beacons and receivers to be coplanar in a NED plane.

2. LLS in 3D from true 3D NED values.

3. GN in 3D from true 3D NED values.

17 Only methods 1 and 3 are recommended in situations where beacons and receiver are in close to coplanar geometry. Method 2 produces hugely incorrect z values in cases where the beacons are coplanar.

3.6.1 Usage Upon start, Multilaterator listens on port 8888 for a TCP connection detailing locations of beacons (i.e., simulate cars or infrastructure elements) and optionally the true location of the receiver. Location is calculated at set intervals defined by the multilateration time interval. Multilaterator is started as normal for a console-based program: $./multilaterator It also accepts a number of options as detailed below: Usage: [-f time] [-h] [-l 0/1] [-m 0/1] [-p 0/1] [-t time] [-v]

-m: Turn multilateration off[0]/on[1]. If multilateration is off, beacon aquisition takes place with no lateration calculations [ default = 1]. -t: Multilateration time interval in milliseconds. This dictates the interval between multilateration calculations [default = 3000]. -l: Multilateration mode. Linear Least Squares solving [0], Gauss Newton[1] [default = 0]. -d: Multilateration dimensions - 2 or 3 [default = 2]. -p: Pruning off[0], on[1]. Prune beacons after forget time has elapsed since last transmission [default = 0]. -f: Forget time in milliseconds - beacons which have not transmitted within this time period are forgotten [default = 10000].

-v: Output version information and exit. -h: Print help and exit. Certain settings can also be changed from within the program: F1: Toggle dimensions(2/3). F2: Switch lateration mode between Linear Least Squares and Gauss Newton. F3: Switch between view modes concerning beacon coordinates i.e. LLA, ECEF, NED. Figure 3.8 shows the NCurses GUI used in the program. This GUI shows the follow- ing information: • Calculated Position: the current calculated position of the receiver in LLA, ECEF and NED coordinates. The NED plane is described by the next item. • NED Plane Origin: this is the origin of the NED plane. This is set by the first received beacon and is defined by two coordinate sets, i.e., LLA and ECEF. • Settings + Metrics: this window shows relevant current settings such as lateration mode and metrics such as average calculation time. • Beacons: A listing of beacons used for multilateration calculations. Beacon id, calculated distance and coordinates are listed. • DOP and Error: GDOP and its variants are displayed here, as are location error. This error is calculated in the simulated beacon scenario from the true locational value of the receiver broadcast by the bsm-beacon-sim software.

18 Figure 3.8: Multilaterator NCurses GUI

• Log Window: Relevant information is logged here, including TCP connections.

• Instruction Window: Certain user settings are adjustable from within the program itself. There are listed here. The software also features a textual display for use in situations where the NCurses GUI may not function correctly, e.g., over an SSH or serial connection.

3.6.2 Dependencies and attributions. • GNU scientific library (GSL) is used for various matrix calculations and solving LLS.

• NCurses is used for the GUI.

• cJSON by Dave Gamble is included for the parsing of JSON.

3.6.3 Notes concerning Program Structure Multilaterator has a multithreaded architecture. This architecture was deemed necessary partly due to the various timing complexities of the program subsections. BSMs are nominally transmitted every 0.1 seconds, whereas multilateration calculations may take longer than this time delta, especially in situations with a large number of beacons. In a non-threaded program, the multilateration module would block the BSM module, thus losing valuable positional information. The threads and their respective responsibilities are as shown below:

• BSM Server: The BSM server thread listens for incoming BSMs and maintains a linked list con- taining data pertaining to broadcasting beacons. A linked list allows for the prospect of removing beacons which have not broadcast for a set period of time or are prone to errors, for example. In fact, the pruning thread has this job.

19 Upon receiving a BSM the thread either updates positional data for an existing BSM or adds a new beacon to the list. Positional information in the BSMs, transmitted in lat/lng/alt format, are translated to ECEF format and averaged using Welfords algorithm. At this point, the coordinates of the beacons in a NED coordinate system are also calculated. The origin and orientation of the NED coordinate system is at present obtained from the coordinates of the first broadcasting beacon (see future work). Received signal strength, which has been shown to be Gaussian in nature, is also averaged. Welfords algorithm can also be used to quickly determine the variance of the RSS signal data, which is of interest should weighted matrices be used in the multilateration process (see future work).

• Multilaterator: This thread performs the calculations to determine the receiver position. Multilat- eration calculations may take longer than the period of time between successive BSM receptions, especially with a large number of beacons. During this time, it is feasible that the linked list containing BSM data will have been changed. The mul- tilaterator thread avoids concurrency issues by creating an array copy of the linked list, and works from this array. Multilateration is at present carried out in one of two ways, i.e., Linear Least Squares or Gauss-Newton.The outcome of the multilateration process is then used to determine the receiver’s ECEF coordinates and subsequently coordinates in Lat/L- ng/Alt. If true coordinates have been transmitted to the multilaterator program, x,y,z, and total error can then calculated. This is useful for development purposes. This thread also calculates the GDOP of the beacon system.

• Position Server: The position server exists for debugging and visualisation purposes (and even for RPC purposes further down the line). It provides certain state information such as beacon position, calculated receiver position and true receiver position encoded as JSON.

• Pruning Thread: The thread has the job of removing beacons that have not transmitted in a set period of time. Optional.

• (EVK Receiver Thread): This thread is only built in the EVK version of BSM-multilaterator and listens for "real" BSMs using the EVKs inbuilt hardware.

3.6.4 Known Bugs • Threading: concurrency problems will inevitably arise and better use of mutexes is needed.

• The multilateration thread should use a snapshot array of the beacons for its cal- culations. This array should be copied from a linked list. This mechanism is not

20 working at present and the linked list and array are both updated from the BSM receiver thread - so pruning will not have an effect on the calculations.

3.7 Generated Datasets Three datasets were generated and saved as CSV files, with the aim of representing a range of traffic environments to test the multilateration software. These are named after their GPS locations.

3.7.1 New Mexico 8 beacons formed in a Body Centered Cubic shape around the receiver. This reflects an ideal configuration of beacons, minimising GDOP. Figures for GDOP and other dilution of precision metrics are shown in Table 3.2.

GDOP 1.24 HDOP 1.01 VDOP 0.63 Table 3.2: Dilution of Precision for New Mexico Dataset

Note that such a formation is seldom seen in a vehicular environment.

3.7.2 Chapultepec This dataset consists of 6 beacons and represents a vehicle travelling west and approach- ing a roundabout. There are other vehicles behind and at approximately 3 and 9 ’o’clock, with distances less than 100m. Although the vehicles can be considered to be coplanar in the xy plane, there are small differences in the z axis (circa +-1m). The dataset can be seen in Figure 3.9 with coordinates translated to local NED axes and the receiver located at the origin. Figures for GDOP and other dilution of precision metrics are shown in Table 3.3. Note the usable HDOP value indicating some beacon spread in the horizontal plane, but high VDOP and GDOP values.

GDOP 83.56 HDOP 2.82 VDOP 83.50 Table 3.3: Dilution of Precision for Chapultepec Dataset

3.7.3 E4 The 5 beacons in this dataset approximate cars travelling on a two way motorway. All beacons are located to the northeast of the receiver. Receiver and beacons are completely coplanar, sitting on the xy plane. Again, this dataset is visualised in Figure 3.10 with coordinates translated to local NED axes and the receiver located at the origin. Figures for GDOP and other dilution of precision metrics are shown in Table 3.4. Note the high HDOP, VDOP and GDOP values, indicating poor beacon spread.

21 Figure 3.9: Chapultepec Dataset (distances in m)

Figure 3.10: E4 Dataset (distances in m)

22 GDOP 8206.63 HDOP 72.19 VDOP 8206.01 Table 3.4: Dilution of Precision for E4 Dataset

23 4 Results

4.1 Received Signal Strength Spread, Indoor Environment Figure 4.11 illustrates a typical spread of signal strength in the RSS sections of received BSMs transmitted between two line-of-sight Craton 2 units 30 meters from each other in an indoor environment.

Figure 4.11: Typical signal spread for recorded signal strength (Ptx = 4dBm, d = 30m, n=397, indoor environment)

4.2 Received Signal Strength, Indoor Environment Figure 4.12 shows the correlation of collected signal strength data in an indoor environ- ment with the three path loss models previously mentioned in the implementation section. Each data point is the mean of n = 566 received BSMs.

Figure 4.12: Reported average RSS (n=566) between two Craton 2 EVKs in an indoor environment (Ptx = 4dBm, α = 2,  = 5, h = 0.5,n = 566, indoor environment)

24 4.3 Multilaterator Simulated Performance The following subsections detail the total error of the multilateration algorithms as used in three datasets and their progression up to 20 multilateration calculations. The total error is calculated as the difference between the calculated position and the actual position of the receiver in three dimensions.

4.3.1 New Mexico Dataset Figure 4.13 shows the total error based on the New Mexico dataset, which consisted of 8 beacons arranged in a body-centered cubic formation around the receiver. The cube itself had side length 60m.

Figure 4.13: Performance of Multilateration Algorithms for New Mexico Dataset.

4.3.2 Chapultepec Dataset Figure 4.14 shows the total error in multilateration calculations based on the Chapultepec dataset, which depicted a typical traffic situation of a vehicle approaching a roundabout with a total of 6 beacons. Note that the LLS 3D algorithm is excluded from the graph, given that its total error rendered it unusable in this dataset.

4.3.3 E4 Dataset Figure 4.15 shows the total error in multilateration calculations based on the E4 dataset, which depicted a typical traffic situation of a vehicle in motorway traffic with a total of 5 beacons. Note that the LLS 3D algorithm is excluded from the graph, given that its total error rendered it unusable in this dataset.

4.3.4 Mean Error of Multilateration Algorithms Table 4.5 shows the mean error (n=20) in multilateration calculations in all datasets.

25 Figure 4.14: Performance of Multilateration Algorithms for Chapultepec Dataset (LLS 3D Algorithm Excluded).

Figure 4.15: Performance of Multilateration Algorithms for E4 Dataset (LLS 3D Algo- rithm Excluded).

Dataset LLS 2D LLS 3D GN 3D Chapultepec 12.59 789.81 6.13 New Mexico 14.77 0.31 1.33 E4 5.45 >10000 5.19 Table 4.5: Mean Error of Multilateration Algorithms/m (n=20)

4.3.5 Average Calculation Times of Multilateration Algorithms Table 4.6 shows the mean calculation time (n=20) for the various multilateration algo- rithms in all datasets.

26 Dataset LLS 2D LLS 3D GN 3D Chapultepec(8) 0.000074 0.000072 0.001694 New Mexico(6) 0.000063 0.000066 0.000584 E4(5) 0.000068 0.000069 0.001093 Table 4.6: Mean Calculation Time of Multilateration Algorithms in seconds (n=20). Number of beacons shown in parentheses.

27 5 Analysis

5.1 Received Signal Strength Spread, Indoor Environment Figure 4.11 confirms that the received signal strength reported by a receiver unit is not interpreted as a single discrete value (received signal strength is reported as an integer in the BSM metadata added by the proprietary software stack used on the Craton 2 units, hence the discrete values of dBm along the x-axis). Instead, there is a considerable spread of around +-3dBm. Figure 4.11 also confirms that the spread can be approximated to a Gaussian distribution.

5.2 Received Signal Strength, Indoor Environment Figure 4.12demonstrates the difficulty in predicting wave propagation and mining accu- rate distance information from RSS data. The empirical data obtained from testing in an indoor environment roughly follows the path loss predicted by the three path loss models, but shows an unexpected increase in signal strength at the 15 and 25-meter data points. This can likely be attributed to the geometry of the building in which data was collected, with a lower roof coming into play around the 15-meter mark. In this particular context, the free space model, with a path coefficient of 2, would seem to be the closet theoretical match to collected data.

5.3 Multilaterator Simulated Performance The three datasets were designed to provide a range of possible scenarios in which to test the multilateration algorithms. Of these, the New Mexico dataset provided the best geometrical arrangement of beacons in relation to the receiver (i.e., the lowest GDOP value). In this scenario, the LLS 3D algorithm performed excellently, with the lowest total error out of all dataset/algorithm combinations. Unfortunately, the LLS 3D algorithm performed poorly in the other datasets, to the extent that it was unusable. Note that the beacons in Chapultepec and E4 datasets are essentially coplanar. The LLS 2D algorithm performed poorly in the New Mexico dataset, but compar- atively well in the others - especially after a number of calculations, at which point receiver-beacon distance accuracy had been improved due to averaging (total error < 10m in Chapultepec, <6m in E4). Its poor performance in New Mexico is easily explained; the algorithm assumes that all beacons and receivers lie in the NED plane and reduces the problem to two dimensions, expanding it to three dimensions after solving. As such, 3D datasets which diverge notably from this approximation produce sizeable errors. Lastly, the GN 3D algorithm performed consistently well in all datasets, with a total error < 6m in all datasets.

5.4 Average Calculation Times of Multilateration Algorithms Calculation times are obviously hardware-dependent and vary between hardware imple- mentations accordingly. The figures presented in Table 4.6 allow for a basic comprehen- sion and comparison of multilateration calculation times. It may be seen that the time taken for all algorithms is well under the 0.1s periodicity of BSM broadcasts. Table 4.6 also illustrates that the GN algorithm has a much greater mean calculation time (>10 in the E4 case).

28 6 Discussion

Two problems must be solved in order to locate a vehicle by the received signal strength; the first is an accurate translation of signal strength to distance, and the second is that of multilateration itself. The software implemented in this project provides a starting point for work in both of these fields based on theory, empirical measurements and algorithmic simulation. It conducts static multilateration only, albeit with an eye towards the more practical (and commercial) dynamic multilaterion.

6.1 RSS to Distance The limited empirical measurements conducted in this project demonstrated that the re- ceived signal strength between two line of sight evaluation kits is gaussian in nature and that it has a somewhat sizeable spread (+-3dBm for units placed 30m apart). This vali- dates the design decision of using the Welford algorithm to continuously update the mean and variance of a beacon’s signal strength, as well as the basic simulation of gaussian sig- nal strength in the BSM-beacon-sim simulation script. However, it does not bode well for software seeking to perform dynamic multilateration calculations, since such systems are less capable of averaging signal strength. It should also be noted that due to the logarithms used in distance calculations, the signal spread has increasingly significant implications for accuracy as signal strength decreases from the source. To make matters worse, the BSM metadata available through the software stack implemented on the Craton 2 unit reports RSS as integers. Again due to logarithms, this lack of resolution leads to greater errors with distance because of a lack of numerical accuracy. Converting RSS to distance calculations is then a troublesome issue at best. In a real- world environment it has been shown that transmitted signals are subject to a host of bounce phenomena, be it between roads and buildings, geographical points of interest or other vehicles [3], [10]. The limited comparisons carried out between empirical measure- ments and three RSS-distance theories showed that all theories matched the data to some degree, but none to what might be deemed a satisfactory degree. The BSM-multilaterator software implements the empirical free-space path model, with path loss exponent α = 2 for all beacons. This is not assumed to be the most accurate model and it is acknowledged that it is insufficient to deal with real-life scenarios. Practically speaking, implementa- tion of alternative methods to derive ranging information is trivial and requires only the addition of a new function in the source code. The workings of such a function are con- siderably more demanding; for example a more intelligent model of RSS interpretation could take into account all available information concerning surrounding vehicles and so forth.

6.2 Multilateration Again, the subproblem of multilateration is far from straightforward. The mathematics behind trilateration, i.e., a three-dimensional system of three beacons and a receiver, is an extension of Pythagoras and simple solving of a system of simultaneous equations. Complexity is increased partly by errors in the ranging (RSS to Distance) and position information (inaccurate GPS coordinates from beacons) and partly by the presence of more beacons than are required for calculations. Such additional complexity drives design decisions at an algorithmic and software design level. Is it better, for instance, to carry out trilateration with a limited number

29 of beacons that are perceived to be most "reliable" (in which case criteria for reliabil- ity must be established)? Or is it preferable to process data from all available beacons? BSM-multilaterator adopts the latter approach, but this is a clear area for future work. At the very least, beacons with higher signal strength (which are therefore closer) should be given a higher status in calculations, especially considering the degradation of reso- lution with distance detailed in the previous paragraph. Another such criterium would be signal variance. Higher signal variance implicitly suggests greater distance but can also be caused by dynamic changes in the signal propagation environment (another car moving between the beacon and receiver for instance). In either case, the beacon data should be deprioritised. As in the case of the RSS to distance calculations, good use can be made of Welford’s algorithm for calculating variance, and this is already implemented in BSM-multilaterator, although not presently used to prioritise beacons. A number of algorithms for multilateration are implemented in the software; of these, the 3D Linear Least Squares algorithm proved to be unsuitable for use in situations where the beacons and receiver are essentially coplanar, i.e., a majority of traffic situations. 2D Linear Least Squares carried out 2D multilaterion with the assumption that all beacons and receivers lay in the same NED plane. This assumption has obvious weaknesses in certain geographical situations or, indeed when BSMs are transmitted from higher infras- tructural elements such as traffic lights, signs etc. The implementation of Gauss Newton in BSM-multilaterator provided the best results from the simulated datasets and made no geometrical assumptions. Gauss Newton is iterative and therefore requires two parameters. One is the maximum number of iterations to be carried out, the other is the minimum error between successive calculations, which dictates when the algorithm will stop and assume that a correct (or rather "good enough") answer has been found. BSM-multilaterator uses certain values for these but also records the step sizes between results. If no answer is found that corresponds to the minimum error, the algorithm returns the result based on the lowest successive error found during the iterations. Even here, a multitude of different approaches and parameters are possible, and the software has been designed to allow easy implementation of alternative algorithms.

6.3 Methodology Shortcomings There are two major weaknesses in the theory and implementation detailed. Firstly, the generation of CSV files describing beacon and receiver position uses the same al- gorithm (although in reverse) to convert cartesian distance to simulated RSS as BSM- multilaterator uses to convert RSS to distance. This is an unfortunate but necessary step in the simulation given available resources; an alternative would be actual RSS and po- sitional data which was not available. As such, although the results demonstrate that multilateration is possible and that the algorithms are functional, they do not reflect the effects of real-world ranging inaccuracies. Secondly, the calculations throughout assume a broadcast strength of +33dBm from all beacons. It is unclear at the time of writing if a true value for this figure is included in transmitted BSMs. The assumption made here is somewhat valid since it is the maximum broadcast strength allowed by law, but deviation from this value is an obvious source of inaccuracy.

30 7 Conclusion

This project aimed to examine the feasibility of using both RSS and GNSS informa- tion from basic safety messages sent by surrounding vehicles to relatively (with respect to other vehicles or infrastructure elements) and absolutely (in a geodetic sense) posi- tion a vehicle by means of multilateration. A use case for such positioning might be when GNSS information is unavailable to a vehicle, e.g., in tunnel environments or urban canyons where satellite transmissions cannot be received. The project focused on static multilateration, i.e, with stationary transmitters and receivers, although the findings have certain implications for dynamic systems. With respect to objective O1, a number of current practices and theories regarding co- ordinate systems, signal strength interpretation and multilateration implementation were investigated. Furthermore, raw RSS data was obtained and processed from the Autotalks Craton 2 EVK units in accordance with objective O2. The software developed in the course of the project, BSM-multilaterator, implements Linux based multilateration from simulated sources. Additionally, in the case of the Cra- ton 2 EVKs, real-world BSMs can be processed. The performance of a number of mul- tilateration algorithms was assessed using simulated BSMs. As such, objectives O3 and O4 as stated in section 1.5 were achieved. Going forward, BSM-multilaterator provides a solid starting point for further devel- opment of this technology.

7.1 Future work This project presents only one approach to static multilateration; there are of course many others. The software developed should be tested further by means of more simulated traffic situations but also real-world BSMs. Refinements to the method presented here include:

• the use of weighting matrices in existing multilateration calculations to give more weight to certain beacons based on criteria, e.g., proximity or signal variance.

• algorithmic methods to identify and disregard outliers, i.e., identifying highly inac- curate beacon signals.

• in general, a more intelligent approach to beacon selection, perhaps making use of GDOP or an equivalent geometric metric.

• performance improvements of existing algorithms, e.g., general calculation time but also improvements to specific algorithms. For example, the GN algorithm used in this project must handle cases where the iteration does not converge. Alternatives to that method may lead to increased positional accuracy.

• additional methods for solving the multilateration equations can also be imple- mented using BSM-multilaterator as a host.

Lastly, and perhaps of greatest commercial significance and utility in real-world traffic situations, future work should also focus on dynamic multilaterion.

31 References

[1] T. Rappaport, Wireless Communications: Principles and Practice, 2nd Edition, 12 2001, vol. 2.

[2] Cohda Wireless. V2X-Locate White Paper. (last accessed on 19 September 2019). [Online]. Available: https://cohdawireless.com/wp-content/ uploads/2018/08/Whitepaper_V2X-Locate.pdf

[3] N. Alam, A. Balaei, and A. G. Dempster, “Range and range-rate measurements using dsrc: facts and challenges,” GNSS Symposium 2009, 2009.

[4] (2017, Dec. 5) An Assessment of LTE-V2X (PC5) and 802.11p Direct Communications Technologies For Improved Road Safety in the EU. (last accessed on 16 September 2019). [Online]. Available: https://5gaa.org/wp-content/uploads/ 2017/12/5GAA-Road-safety-FINAL2017-12-05.pdf

[5] S. Al-Stouhi and R. Miucic, “Absolute localization via dsrc signal strength,” in 2016 IEEE 84th Vehicular Technology Conference (VTC-Fall), 2016, pp. 1–5.

[6] R. Miucic and S. Bai, “Performance of aftermarket (dsrc) antennas inside a pas- senger vehicle,” in SAE International Journal of Passenger Cars - Electronic and Electrical Systems, vol. 4, no. 1, 2011, pp. 150–155.

[7] M.Ahlin, J. Zander, and B.Slimane, Principles of Wireless Communications. Stu- dentlitterarur AB, 2018.

[8] S. J. C. Sommer and F. Dressler, “On the Applicability of Two-Ray Path Loss Mod- els for Vehicular Network Simulation,” in 2012 IEEE Vehicular Networking Confer- ence (VNC), 2012, pp. 64–69.

[9] N.-D. R.Yarlagadda, I.Ali and J.Hershey, “GPS GDOP Metric,” in IEE Proc,-Radar, Sonar Navigation, vol. 147, no. 5, October 2000, pp. 259–264.

[10] R. Miucic and S. Bai, “Intervehicle range estimation from periodic broadcasts,” in IEEE Transactions on Vehicular Technology, vol. 66, no. 12, 2017, p. 10637–10646.

32 A Appendix 1

Type Description Bytes

DSRCmsgID Data elements used in each message to define the 1 Message type MsgCount Increase count for consecutive messages. 1 TemporaryID Represents a 4-byte temporary device identifier. 4 Dsecond Represents two bytes of time information. 2 Latitude Represents the geographic latitude of an object. 4 Longitude Represents the geographic longitude of an object 4 Elevation Represents an altitude measured by the WGS84 2 coordinate system. PositionAccuracy Quality parameters used to model positioning ac- 4 curacy for each given axis. TransmissionAndSpeed Represents the speed of the vehicle. 2 Heading The current direction value is expressed in units of 2 0.0125 degrees. SteeringWheelAngle Represents the current steering angle of the steer- 1 ing wheel AccelerationSet4Way It consists of three orthogonal directions of accel- 7 eration and yaw rate. BrakeSystemStatus Various control states related to braking of the ve- 2 hicle. VehicleSize Represents the length and width of the vehicle. 3 Table 1.7: BSM Contents

B Appendix 2

%Generate "Perfect GDOP" configuration of beacons in a %body centered cubic layout.

%Center point is: %Lat 34,0066346, Lon ?105,2423416 Alt 1666,853191 New Mexico Desert clear -all receiver_lat =34.0066346; receiver_lng =-105.2423416; receiver_alt =1666.853191; filename = "NewMexicoBCC.csv"

%Length of BCC cube side in m cube_side = 60 n=8;

%Initialize beacon matrix and output_csv_matrix beacon_set_ECEF = zeros(n,3);

A beacon_set_LLA = zeros(n,3);

%Convert Lat Lon Alt to ECEF [xr,yr,zr]=lla2ecef(rad(receiver_lat),rad(receiver_lng),receiver_alt); receiver_ECEF = [xr,yr,zr];

%Cube corner points beacon_set_ECEF(1,:) = [xr+cube_side/2,yr+cube_side/2,zr+cube_side/2]; beacon_set_ECEF(2,:) = [xr+cube_side/2,yr-cube_side/2,zr+cube_side/2]; beacon_set_ECEF(3,:) = [xr-cube_side/2,yr+cube_side/2,zr+cube_side/2]; beacon_set_ECEF(4,:) = [xr-cube_side/2,yr-cube_side/2,zr+cube_side/2];

beacon_set_ECEF(5,:) = [xr+cube_side/2,yr+cube_side/2,zr-cube_side/2]; beacon_set_ECEF(6,:) = [xr+cube_side/2,yr-cube_side/2,zr-cube_side/2]; beacon_set_ECEF(7,:) = [xr-cube_side/2,yr+cube_side/2,zr-cube_side/2]; beacon_set_ECEF(8,:) = [xr-cube_side/2,yr-cube_side/2,zr-cube_side/2];

%Work out true beacon distances from receiver ranges = zeros(n,1); for j = 1:n ranges(j,1) = sqrt(sum((receiver_ECEF(1,:)-beacon_set_ECEF(j,:)).^2) ); end

%Convert distances to RSS and add to beacon_set!Assume transmit power 33 dBm for j = 1:n ranges_rss(j,1) = emp_freespace(33,ranges(j,1),0.05081228,2); end

%Convert all beacon ECEFs to LLAs for j = 1:n [lat,lng,alt] = ecef2geo(beacon_set_ECEF(j,:),1); beacon_set_LLA(j,:) = [lat,lng,alt]; end

%Prepare final cell array output_csv_matrix = cell(n+2,7) output_csv_matrix(1, :) = {"type","id","time","lat","lon","alt","rss "};

%add receiver output_csv_matrix(2, :) = {"RECEIVER",100,1,receiver_lat,receiver_lng ,receiver_alt,0};

%add beacons output_csv_matrix(3:n+2,1) = {"BSM"}; output_csv_matrix(3:n+2,3) = {1}; output_csv_matrix(3:n+2,4:6) = num2cell(beacon_set_LLA); output_csv_matrix(3:n+2,7) = num2cell(ranges_rss); output_csv_matrix(3:n+2,2) = num2cell([1:1:n]); fid = fopen (filename,’w’); fmt1 = ’%s,%s,%s,%s,%s,%s,%s\n’; fprintf (fid,fmt1,output_csv_matrix{1, :}); fmt2 = ’%s,%.0f,%.0f,%.10f,%.10f,%.10f,%.10f\n’; for i=2:n+2 fprintf (fid,fmt2, output_csv_matrix{i, :})

B end fflush (fid) fclose (fid) Listing 2: Dataset Generation example

C