• No results found

Developing a Back-up System for GPS Failure in Public Transport

N/A
N/A
Protected

Academic year: 2021

Share "Developing a Back-up System for GPS Failure in Public Transport"

Copied!
15
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

Developing a Back-up System for

GPS Failure in Public Transport

Jordi Langen

University of Amsterdam Student number 6131646

jordi.langen@student.uva.nl

ABSTRACT

The civilian Global Positioning System (GPS) is being used as the primary source for position and timing information by a countless number of applications. GVB, the company running Amsterdam’s public transport, uses GPS receivers as a location provider for their trams and buses. The GPS signals that reach the Earth’s surface are very weak, making the system vulnerable to unintentional as well as deliberate interference. It is possible to jam GPS signals, creating the situation where a GPS receiver cannot determine its location. For the public transport payment system, keeping track of the current location of a bus or tram is essential in order for the system to charge the right fares. To combat this, the trams and buses shouldn’t rely solely on GPS. In this paper, three methods that can serve as a back-up location provider will be presented and compared. In addition to this, a demo will be made in order to demonstrate these methods and provide a clearer view on how these back-up systems could work in real-life.

1. INTRODUCTION

The usage of the civilian Global Positioning System (GPS) is widespread and it has many important applications. For example buses, taxis and delivery vehicles are some of the vehicles that use GPS signals for navigation. GPS also provides timing signals which are used by various industries, for instance in electrical power grids, financial networks and communication systems. GPS was originally designed for the U.S. military and it later became available for non-military use. Each GPS satellite broadcasts two signals, a civilian unencrypted signal and a military encrypted signal. The signal broadcasted by the satellites is very weak, a single GPS satellite needs to reach more than one third of the earth’s surface from its geostationary orbit at 20,000 kilometres high, whilst using less energy (25.6 Watt) [1] than the headlight of a car. The typical received signal power from a GPS satellite is -127.5 dBm, which equals 1.78*10-16 Watts [2]. This fundamental weakness makes the signals vulnerable to both unintentional and deliberate interference.

An easy way to deliberately disturb a GPS receiver is to jam it, creating a false GPS signal that overpowers the real GPS signal [3]. Depending on the antenna and power supply, GPS jammers can interfere with GPS signals up to a few kilometres in range. Jamming can be relatively innocent, for example truck drivers that don’t want their boss to know their exact location all the time. On the other hand, in a less innocent situation, police and ambulance navigation can be disturbed. Jammers may also be used by criminals that don’t want to be traced by the police, for example they may be trying to block tracking devices like an ankle monitor. Another vulnerable user of GPS is the stock

market which uses the GPS time signal. If the GPS signal is disturbed time stamps on transactions can become unreliable. Although the possession of devices that can jam GPS signals is illegal, it is relatively easy to obtain one. Simple models that can be powered by a 12-volt output in a car can be bought for under $50 online and render GPS systems inoperable for kilometres around. There is also the option of buying or importing separate parts and building your own jammer. Parts can easily be obtained and jammer building schematics can be found online [4]. To jam civilian GPS signals a jammer needs to broadcast at the L1 band at 1575.42 MHz.

Figure 1. A GPS jamming device.

Jamming is not the most serious of security risks, when it occurs the GPS receiver will be aware that it is not receiving the signals needed to determine its position and time.

The other vulnerability of GPS is spoofing. This is a technique that creates false civilian GPS signals that passes as a real GPS signal, sending an incorrect time and/or location to mislead a GPS receiver [5]. This can be a high risk. High-value cargo is tracked with GPS, as are many rental cars, so confusing the tracking signal could contribute to a successful heist. Last year, a radio navigation research team from the University of Texas set up an experiment and were able to spoof a private yacht on the Mediterranean Sea using a custom-made GPS spoofing device [6]. Spoofing can be performed and keep unnoticed by user of the spoofed GPS device. Research has been conducted to come up with countermeasures which can alert the user of a GPS receiver in case of suspicious activity [7].

2. PROBLEM STATEMENT

The public transport (openbaar vervoer, OV, in Dutch) in and around Amsterdam is mainly run by the company GVB, who operates the bus, tram and metro networks.

To make use of the public transport an OV-chipcard is required, a contactless smart card system through which the client pays for the journey. At the start of a journey, one needs to check-in with the card and at the destination one needs to check-out with it. The locations of these check-in and check-out will determine the price

(2)

for the trip. For the metro there are ticket barriers with card readers at every stop, which means those card readers can be pre-programmed with its location. The buses and trams have card readers inside the vehicle, which means it is crucial to keep track of the actual position of the vehicle. This is done via a built-in GPS receiver. The location information needs to be passed on to the OV-chipcard system in the vehicle so it can calculate the right fare for passengers when they check-out. This location information can also be send to the headquarters so they can monitor any delays. Another use is for adjusting dynamic information signs at stops, to inform waiting passengers how long it takes for the bus to arrive.

Before leaving at the starting point of a route, the driver needs to set up the on-board computer system on the vehicle. The on-board computer can then select the relevant information from its database. This information from the database contains, among other things, the stop names, order of the stops, distance between stops and the average time it takes between stops. After take-off the only continuous input the on-board computer needs is the location, so it can determine the current stop or which stop it is approaching. The OV-chipcard system is linked to the on-board computer and therefore knows which stop it is at when passengers check-in or out. The distance between two stops is pre-measured and stored in the on-board computer database, meaning that the travelled distance can be calculated instantly. The price of a trip is based on the distance that is travelled.

Every night when a bus or tram is parked at its depot their on-board computer gets updated. This means that all the stops in the database will be up-to-date the next day when the vehicle rides a route. With planned diversions, the distance between two stops can be changed in the database to charge for the actual driven distance. For unscheduled detours there is no extra charge because the on-board computer will just read the normal distance between the check-in and check-out stop from its database.

The OV-chipcard payment system works as follows. When someone checks-in 4 euro gets drawn of the card temporarily. The cost of a trip is calculated at the check-out and 4 euro minus the fare is set back on the card. Any trip costs a boarding fee of 0.87 euro plus a price per travelled kilometre, which differs slightly per public transport company. For GVB this price is 0.148 euro per kilometre for the year 2014 [8]. An exception to this is if someone changes to another bus or tram within 35 minutes after the check-out, then a passenger won’t have to pay the boarding fee of 0.87 euro again but just the travelled kilometres. If a vehicle can’t determine its location due to a non-functioning GPS receiver, it cannot determine the check-in or check-out location (or both) for passengers during that period. If this occurs passengers only have to pay the boarding fee of 0.87 euro because the travelled kilometres can’t be calculated. This is a vulnerable part in the OV-chipcard system in the trams and buses of the GVB.

As stated before, the trams and buses use GPS as their basic location provider and this GPS signal is vulnerable to interference. A person could travel with a GPS jammer in their pocket or rucksack and disturb the GPS receiver so the bus or tram is unable to determine its location. Using a jammer on public transport does not only affect the person itself when checking-in and out. It will affect all the persons that travel with the vehicle

during the period that the vehicle lost its location, i.e. during the period the jammer is active. This means all those passengers only are charged 0.87 euro off their OV-chipcard instead of the fare for the actual distance they covered.

A small-scale test has been conducted to be able to judge this problem and to test the vulnerability of the GPS signal while traveling with the bus or tram. The GPS jammer used for this was powered by 4 AA batteries and had a jamming radius of around 500 meters. An overview of three of those trips is provided in Table 1. The check-out times have been blurred.

The first trip (bottom row) was by tram, checking-in at the stop ‘Kruislaan’ in Amsterdam. The GPS jammer was already active while waiting at the stop for the tram to arrive. As can be seen, the tram had already lost its GPS signal before the check-in. Setting ‘Unknown Check In’ as the departure stop. The actual check-out location was the stop ‘Wijttenbachstraat’, but since the GPS signal was still jammed the tram couldn’t determine its location so the output was ‘Unknown Check Out’.

The second trip (middle row) was the same journey as the first one, but without the jammer turned on. As stated in the overview it did cost 0.26 euro, this is the amount for the travelled kilometres. Because this trip was within 35 minutes of the previous check-out, the boarding fee of 0.87 euro was not charged again. This means if the jammer was used for this trip, it would have cost 0.00 euro.

The third trip (top row) was by bus, with the jammer turned on while waiting for the bus to arrive. The begin stop was ‘Radioweg’ in Amsterdam. The jammer already had some effect on the GPS receiver before entering the bus because the check-in overview shows ‘Archimedesweg’, which is one stop before ‘Radioweg’. It took a couple of stops for the jammer to have full effect, for the GPS receiver to have lost its ability to determine the current location. It was then visible that the card readers showed that the amount charged was 0.87 euro when other people checked-out.

3. RESEARCH QUESTION

For the OV-chipcard system to work properly and charge the right fares, all the needed variables are stored in the bus’ or tram’s database. There is one exception, keeping track of the location of the vehicle. The GVB uses GPS receivers as the location provider for their buses and trams. As described earlier in this paper, GPS signals can be jammed, which is mainly an economic risk for the GVB.

This gave lead to the research question of how public transport can be tracked without using GPS, how can the OV-chipcard system work without using GPS as the location provider. How to find a solution for GPS-failure in public transport. This will be done by developing alternate methods that can serve as a back-up location provider. Three of those methods will be presented and compared. Along with this a demo will be made to be able to demonstrate these methods and give a better view on which methods are a good alternative, or back-up, location provider for the public transport.

(3)

4. RESEARCH METHODS

To be able to develop methods that can serve as a location provider for public transport, a vehicle’s database is needed to interact with. The on-board computer database of a tram or bus has various contents. It contains a list of all the routes, which stops belong to a route, the order of stops, the distance between stops and the GPS coordinates of stops.

For the database, a part of the route of tram 9 in Amsterdam has been taken. Starting at ‘Diemen Sniep’ until six stops further at ‘Hugo de Vrieslaan’. The codes and distances in the database are fictitious. In the following sections three methods will be described.

4.1 Transponder Method

This method consists of equipping stops with an transponder, so when a vehicle nears a stop it will pick up a signal from the transponder. Receiving a code which the stop can be identified by. Giving the vehicle’s on-board computer system a location input so it can adjust its current stop and also set the next stop. In pseudocode it would look like this:

When a transponder code is received

If the transponder code matches the ‘code’ from a certain row in the database

Set current_stop to the value of ‘stop’ from that row

Set distance_driven to the value of ‘d_cumulative’ from that row

Set next_stop to the value of ‘stop’ one row below the current_stop’s row

Using the transponder method the accuracy of determining the location will be high. If a transponder code is received the vehicle must be next to that stop.

A negative feature is that real-time tracking is not possible. Just the current stop or the last stop passed by can be determined. If we would look at the cost of implementing this method, it is clear that it would be high. Installing transponders at all the stops across Amsterdam would be an expensive operation.

4.2 Distance Method

The distance between stops is known. A bus or tram can measure its driven distance itself, this can be a method to keep track of the location. In addition, at each stop after the doors opened and closed the distance driven can be reset. This can be done to calibrate the driven distance, otherwise after several stops the distance driven could be influenced by unplanned detours and cause faults. In the case of planned diversions it would not be a

problem because then the distances in the databases are updated

as mentioned before in the problem statement section. This method in pseudocode would be as following:

Set the value of n to 1

Set the value of distance_driven to 0

If distance_driven equals the value of ‘distance’ from the row where ‘number’ is n

Set the current_stop to the value of ‘stop’ from that row

Set next_stop to the value of ‘stop’ in the row where ‘number’ equals n+1 Pause until the doors opened and closed

Set distance driven to 0 n equals n+1

Else distance_driven equals distance_driven+1

The distance method could be implemented by updating the software of the on-board computer system, making it a relatively cheap option.

Real-time tracking of the vehicle is possible using the distance system. The last stop and the distance covered since that stop is known, with that information the position of the vehicle can be determined fairly accurate.

4.3 Manual Method

This method consists of a touchscreen button in the dashboard of a vehicle. When the button is pressed the on-board computer system will switch to the next stop. This means the driver has to keep track of the stops himself. In pseudocode:

Set the value of n to 1

Set current_stop to the value of ‘stop’ from the row where ‘number’ is n

If the button is pressed n equals n+1

set current_stop to the value of ‘stop’ from the row where ‘number’ is n

set distance_driven to the value of ‘d_cumulative’ from that row

Set next_stop to the value of ‘stop’ from the row where ‘number’ is n+1

The manual method could be implemented via a software update for the vehicle’s on-board computer system, an update that adds a new button in the dashboard. With the manual method, the

(4)

accuracy of positioning fully depends on the driver, as he is the person that determines at which stop the vehicle is. If the manual method is used, there is no possibility for real-time tracking.

5. RESULTS

In the previous section three location providing methods have been described and written in pseudocode along with the database it uses. In order to be able to better view and compare those methods a demo has been made. This demo can simulate a tram journey with the possibility of using the three back-up systems as the location input method, along with a default mode where GPS is used as the location provider.

Figure 2. A screenshot of the public transport simulator. The dashboard contains all the valuable information for the driver of the vehicle. Some items on the dashboard vary per used method. The map shows the route with the stops marked as diamond shapes. The vehicle is denoted by the pinpoint, marked green when traveling between stops and marked red while at a stop.

System Input marks the input that is needed for the on-board computer to be able to determine the current stop, like the distance driven or a transponder code. System Output is the output that can be send to the OV-chipcard system. In the simulator the system output consists of two items, a fictitious vehicle ID and the last stop the vehicle passed by.

When the simulator is opened, the default setting is that GPS is enabled. Showing a green button with ‘GPS Enabled’ and in the dashboard the GPS status shows ‘normal’. If GPS is enabled and the simulation is started, the distance travelled will be real-time and the position on the map is adjusted every second. At every stop the system input window will show the coordinates of the vehicle that matches the stop’s coordinates. When GPS is disabled in the simulator, the option to choose from one of the three other methods becomes possible. If transponder is chosen then during the simulation the distance travelled and the position on the map will only change when the vehicle is waiting at a stop. At a stop the system input will show the transponder code received that matches the stop’s code in the database.

If the distance method is selected as the location providing system then the distance travelled is real-time and the position on the map is adjusted every second. At every stop the system input shows ‘doors open’ and then ‘doors closed’ which can be used to set the distance travelled to zero after that occurred.

When the manual method is selected, a button with ‘next stop reached’ will appear on the dashboard. Nothings happens until the button is pressed. Pressing the button will show the vehicle at the next stop on the map and also display the distance travelled that corresponds with that stop.

A working version of the simulator can be found online [9]. The source code of the demo can be found in the appendix.

6. DISCUSSION

The transponder and distance method are both automatic processes driven by the on-board computer, the manual method is human controlled. This has two sides, the automatic methods are safer because the driver can fully focus on driving the vehicle. On the other side, only with the manual method the driver is in control over at which stop it is. If something goes wrong, for example the system picks the wrong stop as the current location, then the driver can’t override the system when just the transponder or distance method is used. The manual button method should always be installed, so that the driver is able to override the system if something goes wrong.

7. CONCLUSIONS AND FUTURE WORK

GPS as a location provider can be a good system, when it works. But there needs to be a back-up system for when GPS fails. After testing the developed methods using the demo, all of the three methods appeared to be a feasible solution. Every method has its pros and cons. The manual method is the easiest to implement but gives no possibility for automatic tracking in return. The distance method is relatively easy to implement and can give a real-time location input. The transponder system is the most fail safe system but it takes a big effort to implement and brings high, one-time costs. A combination of the manual and distance method could be a good option for the GVB. This combination, when compared to using just the transponder method, will be easier to implement and bring less costs.

Future work could consist of conducting research in collaboration with one or multiple public transport companies.

8. ACKNOWLEDGMENTS

I would like to thank Jeroen van der Ham and Frank Nack for their help and advice.

9. REFERENCES

[1] GPS Satellite Power Output. Retrieved July 25, 2014, from http://www.gpsinformation.net/main/gpspower.htm [2] dBm – Wikipedia. Retrieved July 25, 2014, from

https://en.wikipedia.org/wiki/DBm

[3] Hu, H., & Wei, N. (2009, December). A study of GPS jamming and anti-jamming. In Power Electronics and Intelligent Transportation System (PEITS), 2009 2nd International Conference on (Vol. 1, pp. 388-391). IEEE. [4] Humphreys, T. E., Ledvina, B. M., Psiaki, M. L., O’Hanlon,

B. W., & Kintner Jr, P. M. (2008, September). Assessing the spoofing threat: Development of a portable GPS civilian spoofer. In Proceedings of the ION GNSS international technical meeting of the satellite division (Vol. 55, p. 56). [5] GPS (L1) Jammer. Retrieved July 25, 2014, from

http://zugzwanged.org/dat/gbppr/gps/simple_gps_jam.png [6] UT Austin Researchers Spoof Superyacht at Sea. Retrieved

July 25, 2014, from

http://www.engr.utexas.edu/features/superyacht-gps-spoofing [7] Warner, J. S., & Johnston, R. G. (2003). GPS spoofing

(5)

[8] GVB Fares. Retrieved July 25, 2014, from

http://en.gvb.nl/service_en_verkoop/reisproducten/Pages/Tar ieven.aspx

[9] Public Transport Simulator. Retrieved July 25, 2014, from http://fs1.ac-nw.de/jordi/simulator.html

(6)

APPENDIX

Source code of the public transport simulator, the simulator.html file: <!DOCTYPE html>

<html lang="en">

<head>

<meta charset="utf-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1">

<style> .system-io { font-family: Courier; } </style>

<title>Public Transport Simulator</title>

<!-- Bootstrap -->

<link href="css/bootstrap.min.css" rel="stylesheet">

</head>

<body>

<div class="container">

<h1>Public Transport Simulator</h1>

<div class="row">

<button type="button" class="btn btn-success" id="startSimulate">Start Simulation</button>

<button type="button" class="btn btn-warning" id="pauseSimulate">Pause Simulation</button>

<button type="button" class="btn btn-danger" id="resetSimulate">Reset Simulation</button>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;

<button type="button" class="btn btn-success" id="gpsEnabled">GPS Enabled</button>

<button type="button" class="btn btn-danger" id="gpsDisabled">GPS Disabled</button> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;

<button type="button" class="btn disabled alternativeMethodButtons"

id="modeTransponder">Transponder</button>

<button type="button" class="btn disabled alternativeMethodButtons"

id="modeDistance">Distance</button>

<button type="button" class="btn disabled alternativeMethodButtons"

id="modeManual">Manual</button>

</div>

<hr />

<div class="row">

<div class="col-md-3">

<h3>Dashboard</h3> <!-- Dashboard items overview -->

(7)

<div>Distance Travelled: <b id="dashDistanceTravelled"></b>

kilometre</div>

<div class="ioElement methodTransponderElements">Transpondercode received: <b id="dashTransponderCode"></b></div>

<div class="ioElement methodTransponderElements">Time Elapsed: <b

id="dashTimer"></b></div>

<div class="ioElement methodDistanceElements methodTransponderElements methodGPSElements">Doors: <span class="label" id="dashDoorStatus"></span></div>

<div><h4>Current Stop: <b id="dashCurrentStop"></b></h4></div>

<div>Next Stop: <b id="dashNextStop"></b></div>

<div id="manualControls">

<button type="button" id="manualNextStop" class="btn btn-primary btn-large">Next Stop Reached</button>

</div>

</div>

<div class="col-md-6">

<h3>Map</h3>

<div id="mapImage">

</div>

</div>

<div class="col-md-3">

<h3>System Input / Output</h3>

<div class="system-io">

{"input": {

<br />&nbsp;&nbsp;&nbsp;<span class="ioElement methodTransponderElements">"transponder": "<span

id="ioTransponderCode"></span>"</span>

<span class="ioElement methodManualElements">"currentStop": "<span

class="ioCurrentStop"></span>"</span>

<span class="ioElement methodDistanceElements">"distance": "<span

id="ioDistance"></span>"</span>

<span class="ioElement methodGPSElements">"lat": "<span

id="ioLat"></span>"<br />&nbsp;&nbsp;&nbsp;&nbsp;"lng": "<span

id="ioLng"></span>"</span>

<span class="ioElement methodDistanceElements methodTransponderElements methodGPSElements"><br />&nbsp;&nbsp;&nbsp;&nbsp;"doors": "<span

id="ioDoors"></span>"</span> <br />}}<br /><br /><br /><br /><br /> {"output": { <br />&nbsp;&nbsp;&nbsp;"vehicleId": "TR020B9" <br />&nbsp;&nbsp;&nbsp;"currentStop": "<span class="ioCurrentStop"></span>" <br />}} </div> </div> </div> </div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->

<script

src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

<!-- Include all compiled plugins (below), or include individual files as needed -->

<script src="js/bootstrap.min.js"></script>

(8)

var GPS = true; var currentMethod; var distanceTravelled; var timer; var transponderCode; var currentStop; var nextStop; var lat; var lng;

var simulatorContinue = true;

var myTimerStr; var skiptime;

$(document).ready(function(){ //If document is loaded, set current method to

GPS, reset all the variables $('.ioElement').hide(); $('#gpsDisabled').hide(); $("#dashCurrentStop").text(currentStop); currentMethod = 'GPS'; resetSimulate(); });

$('#gpsEnabled').click(function(){ // Click on the 'GPS enabled'

button, it will become disabled and the other 3 methods will be selectable $(this).hide();

$('#gpsDisabled').show();

$('.alternativeMethodButtons').removeClass('disabled');

$('#dashGPSstatus').addClass('label-danger').text('signal

lost').removeClass('label-info');

GPS = false;

});

$('#gpsDisabled').click(function(){ // Turn on the GPS mode again

$(this).hide();

$('#gpsEnabled').show();

$('.alternativeMethodButtons').addClass('disabled');

$('.alternativeMethodButtons').removeClass('btn-primary');

$('#dashGPSstatus').text('normal').removeClass(

'label-danger').addClass('label-info');

$('#manualControls').hide(); $('.ioElement').hide(); $('.methodGPSElements').show(); GPS = true; currentMethod = 'GPS'; }); $('#modeTransponder').click(function(){

$('.alternativeMethodButtons').removeClass('btn-primary');

$(this).addClass('btn-primary'); $('#manualControls').hide(); $('.ioElement').hide(); $('.methodTransponderElements').show(); currentMethod = 'transponder'; }); $('#modeDistance').click(function(){

(9)

$('.alternativeMethodButtons').removeClass('btn-primary'); $(this).addClass('btn-primary'); $('#manualControls').hide(); $('.ioElement').hide(); $('.methodDistanceElements').show(); currentMethod = 'distance'; }); $('#modeManual').click(function(){

$('.alternativeMethodButtons').removeClass('btn-primary');

$(this).addClass('btn-primary'); $('#manualControls').show(); $('.ioElement').hide(); $('.methodManualElements').show(); currentMethod = 'manual'; });

$('#startSimulate').click(function(){ // Start simulation button

myTimerStr = setInterval(function(){myTimer()},1000);

simulatorContinue = true; switch(currentMethod) { case 'GPS': return simulateGPS(); break; case 'transponder': return simulateTransponder(); break; case 'distance': return simulateDistance(); break; case 'manual': return true; break; } }); $('#pauseSimulate').click(function(){ simulatorContinue = false; window.clearInterval(myTimerStr) return true; }); $('#resetSimulate').click(function(){ resetSimulate(); return true; });

function resetSimulate() // Reset all variables to its begin value {

(10)

currentMethod = 'GPS';

distanceTravelled = 0;

transponderCode = 'DS9X';

currentStop = 'Diemen Sniep';

nextStop = 'Nicolaas Lublinkstraat';

lat = '52.336263'; lng = '4.970176'; simulatorContinue = false; window.clearInterval(myTimerStr) timer = 0; $("#dashTimer").text(timer); $('.ioElement').hide(); $('#gpsDisabled').hide(); $('#gpsEnabled').show(); $("#dashCurrentStop").text(currentStop); $("#dashNextStop").text(nextStop); $('#dashDistanceTravelled').text(distanceTravelled);

$('.alternativeMethodButtons').removeClass('btn-primary');

$('.alternativeMethodButtons').addClass('disabled');

$('#dashGPSstatus').text('normal').removeClass(

'label-danger').addClass('label-info');

$('#manualControls').hide();

$('.ioCurrentStop').text(currentStop);

$('#mapImage').html('<img src="img/0.png">');

$('#dashDoorStatus').text('Closed').removeClass(

'label-danger').addClass('label-success');

$('#ioDoors').text('closed');

$('#ioLat').text(lat); $('#ioLng').text(lng); $('.methodGPSElements').show(); } function myTimer() { timer = timer +1; $("#dashTimer").text(timer); } function simulateTransponder() { if (simulatorContinue) { distanceTravelled = distanceTravelled + 1;

getCall(dataObject, 'distance', distanceTravelled, null);

$("#dashCurrentStop").text(currentStop);

$('.ioCurrentStop').text(currentStop);

$("#dashNextStop").text(nextStop);

(11)

$('#ioTransponderCode').text(transponderCode);

if (distanceTravelled == 0 || distanceTravelled == 2 ||

distanceTravelled == 7 || distanceTravelled == 9 || distanceTravelled == 14 || distanceTravelled == 19 || distanceTravelled == 23)

{

$('#mapImage').html('<img src="img/' + distanceTravelled

+'.png">'); // Show image of the map with the vehicle at the position corresponding

to the distance it travelled

$('#dashDistanceTravelled').text(distanceTravelled); } if (distanceTravelled < 24) { if (distanceTravelled == 0 || distanceTravelled == 2 ||

distanceTravelled == 7 || distanceTravelled == 9 || distanceTravelled == 14 || distanceTravelled == 19 || distanceTravelled == 23)

{

openDoor(); // if the vehicle is at a stop, execute

function openDoor skiptime = 4000; } else { skiptime = 1000; } setTimeout(simulateTransponder, skiptime); } else { window.clearInterval(myTimerStr) } } } function simulateGPS() { if (simulatorContinue) { distanceTravelled = distanceTravelled + 1; $('#dashDistanceTravelled').text(distanceTravelled); $('#ioDistance').text(distanceTravelled);

getCall(dataObject, 'distance', distanceTravelled, null); //use of the

distance function because there is no real-time GPS coordinates input

$("#dashCurrentStop").text(currentStop);

$('.ioCurrentStop').text(currentStop);

$("#dashNextStop").text(nextStop);

$('#mapImage').html('<img src="img/' + distanceTravelled +'.png">');

if (distanceTravelled < 23)

{

(12)

} } } function simulateDistance() { if (simulatorContinue) { distanceTravelled = distanceTravelled + 1; $('#dashDistanceTravelled').text(distanceTravelled); $('#ioDistance').text(distanceTravelled);

getCall(dataObject, 'distance', distanceTravelled, null);

$("#dashCurrentStop").text(currentStop); $('.ioCurrentStop').text(currentStop); $('#ioLat').text(lat); $('#ioLng').text(lng); $("#dashNextStop").text(nextStop);

$('#mapImage').html('<img src="img/' + distanceTravelled +'.png">');

if (distanceTravelled < 23)

{

if (distanceTravelled == 0 || distanceTravelled == 2 ||

distanceTravelled == 7 || distanceTravelled == 9 || distanceTravelled == 14 || distanceTravelled == 19 || distanceTravelled == 23) { openDoor(); skiptime = 4000; } else { skiptime = 1000; } setTimeout(simulateDistance, skiptime); } } } function openDoor() {

$('#dashDoorStatus').text('Open').removeClass(

'label-success').addClass('label-danger');

$('#ioDoors').text('open');

setTimeout(closeDoor, 2500);

}

function closeDoor() {

$('#dashDoorStatus').text('Closed').removeClass(

'label-danger').addClass('label-success');

$('#ioDoors').text('closed');

(13)

$('#manualNextStop').click(function(){ // Manual method

getCall(dataObject, 'manual', nextStop, null);

$("#dashCurrentStop").text(currentStop); $('.ioCurrentStop').text(currentStop); $("#dashNextStop").text(nextStop); $('#dashDistanceTravelled').text(distanceTravelled);

if (distanceTravelled == 0 || distanceTravelled == 2 || distanceTravelled == 7

|| distanceTravelled == 9 || distanceTravelled == 14 || distanceTravelled == 19 || distanceTravelled == 23)

{

$('#mapImage').html('<img src="img/' + distanceTravelled +'.png">');

} });

// Database containing all the stops, stop coordinates, distances and transponder codes.

var targetData = '{"lines": {"9": {"stops": [{"call": "Diemen Sniep", "lat": "52.336263", "lng": "4.970176", "distance": "0", "transponder": "DS9X" },{"call": "Nicolaas Lublinkstraat", "lat": "52.337312", "lng": "4.966137", "distance": "2", "transponder": "NS9X" },{"call": "Schoolstraat", "lat": "52.338558", "lng":

"4.958889", "distance": "7", "transponder": "SS9X" },{"call": "Arent Krijtsstraat", "lat": "52.339436", "lng": "4.954684", "distance": "9", "transponder": "AK9X"

},{"call": "Brinkstraat", "lat": "52.342694", "lng": "4.947871", "distance": "14", "transponder": "BS9X" },{"call": "Kruislaan", "lat": "52.347525", "lng": "4.940221", "distance": "19", "transponder": "KL9X" },{"call": "Hugo de Vrieslaan", "lat":

"52.350624", "lng": "4.935222", "distance": "23", "transponder": "HG9X" }]}}}'; var dataObject = JSON.parse(targetData);

// This is the main function to determine the next stop

function getCall(data, method, param1, param2 )

{ switch(method) { case 'GPS': getCallByGPS(data,param1,param2); return true; break; case 'transponder': getCallByTransponder(data,param1); return true; break; case 'distance': getCallByDistance(data,param1); return true; break; case 'manual': getCallByManual(data, param1);

(14)

return true; break; } } function getCallByGPS(data,lat,lng) {

var linesAmount = dataObject.lines["9"].stops.length; for(i = 0;i<linesAmount;i++){

if (( dataObject.lines["9"].stops[i].lat == lat) &&

(dataObject.lines["9"].stops[i].lng == lng)) //Would be the if-statement used if there was actual GPS coordinates input

{

currentStop = dataObject.lines["9"].stops[i].call;

j = i + 1;

if ( j < linesAmount)

{

nextStop = dataObject.lines["9"].stops[j].call; } else { nextStop = ''; } } } } function getCallByTransponder(data,paramTransponderCode) {

var linesAmount = dataObject.lines["9"].stops.length; for(i = 0;i<linesAmount;i++){

if ( dataObject.lines["9"].stops[i].transponder == paramTransponderCode)

// If the transponder code matches a code from a row where the stop is 'i' // Would be the if-statement used if there was a real transponder code input

{

currentStop = dataObject.lines["9"].stops[i].call;

distanceTravelled =

parseInt(dataObject.lines["9"].stops[i].distance);

transponderCode = dataObject.lines["9"].stops[i].transponder;

j = i + 1;

if ( j < linesAmount)

{

nextStop = dataObject.lines["9"].stops[j].call; } else { nextStop = ''; } } }

(15)

}

function getCallByDistance(data,distance)

{

var linesAmount = dataObject.lines["9"].stops.length; for(i = 0;i<linesAmount;i++){

if ( dataObject.lines["9"].stops[i].distance == distance) // If distance driven equals a value of the column ‘distance’ in a row where the stop is 'i'

{

currentStop = dataObject.lines["9"].stops[i].call;

transponderCode = dataObject.lines["9"].stops[i].transponder;

lat = dataObject.lines["9"].stops[i].lat;

lng = dataObject.lines["9"].stops[i].lng;

j = i + 1;

if ( j < linesAmount)

{

nextStop = dataObject.lines["9"].stops[j].call; } else { nextStop = ''; } } } } function getCallByManual(data,paramNextStop) {

var linesAmount = dataObject.lines["9"].stops.length; for(i = 0;i<linesAmount;i++){

if ( dataObject.lines["9"].stops[i].call == paramNextStop) {

currentStop = dataObject.lines["9"].stops[i].call;

distanceTravelled =

parseInt(dataObject.lines["9"].stops[i].distance);

j = i + 1;

if ( j < linesAmount)

{

nextStop = dataObject.lines["9"].stops[j].call; } else { nextStop = ''; } } } } </script> </body> </html>

Referenties

GERELATEERDE DOCUMENTEN

(1) het gaat om eiken op grensstandplaatsen voor eik met langdu- rig hoge grondwaterstanden, wat ze potentieel tot gevoelige indi- catoren voor veranderingen van hydrologie

- Deltamethrin Decis micro werkt niet selectief, zodat het niet goed past bij geïntegreerde bestrijding - Er zijn tijdens het project geen natuurlijke vijanden uitgekweekt

In het eerste halfjaar van 1978 nam het aantal verkeersdoden onder bestuurders van personenauto's t.o.V. Het aantal overleden passagiers van per- sonenauto's was

Members of churches of the communions have been affected in various crises in Nigeria, such as the sectarian violence between Muslim groups and other minority ethnic groups 11

The data is uploaded to a PC via USB cable, using the proprietary SenseWear software; hence, the use of this model in the FOVEA project, for example, would involve importing

This chapter addresses issues pertaining to marketing constraints faced by emerging small scale farmers in the pig industry.A brief review of agricultural marketing

Starting with theoretical implications, a better understanding of utilitarian and hedonic value (non)fulfillment, postconsumption emotions of satisfaction, anger, delight

Using the optical simulation, the properties of the point spread function were measured as a function of camera position (Fig. 4.10a), iris diameter, light emission distribution