vehicle detection using anisotropic...

90
THESIS FOR THE DEGREE OF MASTER OF SCIENCE IN ENGINEERING PHYSICS Vehicle Detection using Anisotropic Magnetoresistors Martin Isaksson Report no. EX034/2008 Communication Systems Department of Signals and Systems CHALMERS UNIVERSITY OF TECHNOLOGY oteborg, Sweden, 2007

Upload: others

Post on 02-Jun-2020

21 views

Category:

Documents


0 download

TRANSCRIPT

  • THESIS FOR THE DEGREE OF MASTER OF SCIENCE IN ENGINEERING PHYSICS

    Vehicle Detection usingAnisotropic Magnetoresistors

    Martin Isaksson

    Report no. EX034/2008

    Communication SystemsDepartment of Signals and Systems

    CHALMERS UNIVERSITY OF TECHNOLOGY

    Göteborg, Sweden, 2007

  • Vehicle Detection using Anisotropic Magnetoresistors

    Copyright © 2007 Martin Isaksson except where otherwise stated. All rights reserved.Master’s Thesis EX034/2008

    Communication SystemsDepartment of Signals and SystemsChalmers University of TechnologySE-412 96 GöteborgSweden

    Telephone +46 - (0)31 - 772 1000

    Typeset in LATEX2eGöteborg, Sweden 2007

  • Vehicle Detection using Anisotropic MagnetoresistorsMartin Isaksson

    Communication SystemsDepartment of Signals and SystemsChalmers University of Technology

    Abstract

    A Wireless Sensor Network (WSN) of anisotropic magnetoresistor sensors offers a low-cost alter-native to other traffic measurement technologies. The WSNs offer better reliability than othersolutions, they offer more information, can be deployed quickly and be reused. In this thesis thesensor algorithms used for detection, velocity estimation, queue detection and classification insuch a network are evaluated based on simulated and measured data. A number of algorithms areevaluated and the results are compared. A new algorithm for speed estimation using two sensornodes is proposed and evaluated. It is found to be much better than earlier algorithms, requiringa signal to noise ratio (SNR) of 20 dB less than the traditional algorithm.

    Keywords: Wireless Sensor Network, Anisotropic Magnetoresistor, Vehicle Detection, VehicleClassification

    i

  • Vehicle Detection using Anisotropic MagnetoresistorsMartin Isaksson

    Communication SystemsDepartment of Signals and SystemsChalmers University of Technology

    Sammanfattning

    Ett tr̊adlöst sensornätverk (Wireless Sensor Network, WSN) av anisotropiska magnetoresistorsen-sorer erbjuder ett l̊agkostnadsalternativ till andra trafikmätningsmetoder. De ger bättre tillför-litlighet än andra metoder, de ger mer information, kan installeras snabbt och kan återanvändas.I det här examensarbetet utvärderas sensoralgoritmer för detektion, hastighetsestimering, köde-tektion och klassificering i ett s̊adant nätverk baserat p̊a simuleringar och mätdata. Ett antalalgoritmer utvärderas och jämförs. En ny algoritm för hastighetsestimering förel̊as och evalueras.Det visas att den är bättre än föreg̊aende algoritmer och fordrar ett signal till brus-förh̊allande(SNR) p̊a 20 dB mindre än tidigare algoritmer.

    Nyckelord: Tr̊adlösa sensornätverk, anisotropisk magnetoresistor, fordonsdetektion, fordon-sklassificering

    iii

  • Preface

    This thesis is part of a bigger Intelligent Transportation System (ITS) project undertaken by thetwo closely related companies – Qamcom Technology AB1 and Amparo Solutions AB2. The goalof this project is to develop a traffic information system capable of delivering information in real-time to drivers, authorities and road maintenance personnel. The wireless sensor network proposedis evaluated in this project for different applications in an intelligent transportation system.

    Acknowledgements

    In the course of preparing this masters thesis I have realised that I am in debt to numerouspeople whose help I could not have done without. I would therefore like to thank everyone atQamcom Technology AB, Amparo Solutions AB, Mantra Communication AB for their interestin my work – a heartfelt thanks to my advisers Patrik Bohlin and Henrik Linell. My examinerProfessor Erik Ström should not only be credited for all his help during this thesis, but also forintroducing me to the deeper realms of communication systems.

    A mathematician named Alfréd Rényi once stated that “a mathematician is a device for turningcoffee into theorems”. Alfréd’s theorem is equally true for physicists and engineers though theoutput might differ. During this thesis I have consumed an estimated 300 cups or 60 litres ofcoffee and for that I would like to thank everyone in the coffee making chain, from the coffee beanpickers in the highlands of Kenya to the employees at Qamcom. Without any single one of them,this thesis would still be in the process of being written.

    I would also like to express my deep gratitude to all the researchers in this field for making theirwork available to me, through publications and Internet. My family has supported me through allof my studies – for that I am really thankful. Lastly I’d like to send my gratitude to those whohave proofread my work – you have all given me a severe headache.

    Göteborg, April 3, 2008

    Martin Isaksson

    1Qamcom Technology AB, http://www.qamcom.se2Amparo Solutions AB, http:///www.amparosolutions.se

    http://www.qamcom.sehttp:///www.amparosolutions.se

  • Contents

    Abstract i

    Sammanfattning iii

    Preface v

    Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v

    Contents ix

    List of Figures xiii

    List of Tables xv

    Definitions xvii

    Abbreviations and acronyms xix

    Notation xxi

    1 Introduction 1

    1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    1.2 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    1.3 Delimitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    2 Method 5

    2.1 Assault approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    2.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    2.1.2 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    2.2 Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    vii

  • 2.3 Validity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    2.4 Generality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    3 Wireless Sensor Networks 7

    3.1 “Ambient Intelligence” or putting electronics into groceries . . . . . . . . . . . . . 7

    3.2 Wireless Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    3.2.1 ZigBee Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    3.3 Wireless Sensor Networks for applications related to traffic . . . . . . . . . . . . . 8

    3.4 Sensor Node Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    3.4.1 Comparison of existing technologies . . . . . . . . . . . . . . . . . . . . . . 10

    3.4.2 Summary of different technologies . . . . . . . . . . . . . . . . . . . . . . . 12

    3.4.3 AMR Magnetic sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    3.5 Sensor Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    4 Theoretical model 17

    4.1 The earth magnetic field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    4.2 Sensing the world . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    4.3 Magnetic model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    4.4 Vehicle model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    4.5 Sensor and channel model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

    4.5.1 Reconstruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

    4.6 Comparison to real world data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    5 Algorithms 25

    5.1 System Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    5.2 Simulation of traffic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    5.3 Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    5.3.1 Thresholding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

    5.3.2 Target Tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

    5.4 Direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

    5.5 Speed estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    5.5.1 Speed of an individual vehicle . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    5.5.2 Average speed estimations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    5.6 Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    5.6.1 Tree method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    5.6.2 Hill patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    5.6.3 Transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    5.6.4 Bins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    5.6.5 Least-squares estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    5.7 Queue Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

  • 6 Performance analysis 37

    6.1 Sensor placement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

    6.1.1 Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

    6.1.2 Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

    6.2 Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

    6.3 Speed estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

    6.3.1 Speed of an individual vehicle . . . . . . . . . . . . . . . . . . . . . . . . . . 38

    6.3.2 Average speed estimations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

    6.4 Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

    6.4.1 Estimation of model parameters . . . . . . . . . . . . . . . . . . . . . . . . 43

    6.5 Verification of algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

    7 Discussion 47

    7.1 Model validity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

    7.2 Algorithm validity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

    8 Conclusion 49

    8.1 Theoretical model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

    8.2 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

    8.3 Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

    8.4 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

    Bibliography 51

    Appendix 53

    A Graphs 53

    A.1 Fast Fourier Transform of vehicle signatures . . . . . . . . . . . . . . . . . . . . . . 53

    B Simulator 57

    C Tables 61

    D Illustrations 63

    Index 65

  • List of Figures

    1.1 Traffic has increased exponentially . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    3.1 Wireless Sensor Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    3.2 Mesh network topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    3.3 Wireless Sensor Node Prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    3.4 Wireless Sensor Node Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    3.5 AMR Barber Pole Bias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    3.6 Wheatstone bridge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    3.7a Magnetoresistive effect. Permalloy resistor, no applied field . . . . . . . . . . . . . 14

    3.7b Magnetoresistive effect. Permalloy resistor, applied field . . . . . . . . . . . . . . . 14

    3.8a Magnetic moment domain orientations . . . . . . . . . . . . . . . . . . . . . . . . 14

    3.8b Magnetic moment domain orientations after a set pulse . . . . . . . . . . . . . . . 14

    3.8c Magnetic moment domain orientations after a reset pulse . . . . . . . . . . . . . . 14

    3.9 Set/Reset pulses for magnetic sensor . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    4.1 Simplified model of the earth magnetic field . . . . . . . . . . . . . . . . . . . . . . 18

    4.2a Traditional sensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    4.2b Magnetic sensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    4.3a Non-disturbed field lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    4.3b Field lines distributed by a vehicle . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    4.4 Simulated magnetic field strength depending on distance . . . . . . . . . . . . . . 21

    4.5 Input parameters to the Matlab-model. . . . . . . . . . . . . . . . . . . . . . . . 21

    4.6 Can our channel be modelled as an AWGN channel? . . . . . . . . . . . . . . . . . 22

    4.7a Simulated sensor data from passenger car . . . . . . . . . . . . . . . . . . . . . . . 23

    4.7b Simulated sensor data from another passenger car . . . . . . . . . . . . . . . . . . 23

    4.7c Simulated sensor data from a bus . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    4.7d Simulated sensor data from high car . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    4.8a Measured sensor data from passenger car . . . . . . . . . . . . . . . . . . . . . . . 24

    4.8b Simulated sensor data from passenger car . . . . . . . . . . . . . . . . . . . . . . . 24

    5.1 System overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

    5.2 Offset depending on temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

    5.3 Direction finding using one sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

    xi

  • 5.4 Parameters for speed estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

    5.5a Synchronisation pulse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

    5.5b Data stream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

    5.5c Synchronisation time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

    5.6 Sensor data and pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

    5.7 Decision tree for classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

    5.8a Average bar - y-axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

    5.8b Average bar - z-axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

    6.1a Effect of sensor node rotation. Yaw axis. . . . . . . . . . . . . . . . . . . . . . . . 38

    6.1b Effect of sensor node rotation. Pitch axis. . . . . . . . . . . . . . . . . . . . . . . . 38

    6.2 Time difference. Error due to sensor sensitivity difference . . . . . . . . . . . . . . 39

    6.3a Time difference, method comparison. Mean error. ẑ-axis. . . . . . . . . . . . . . . 39

    6.3b Time difference, method comparison. Error standard deviation. ẑ-axis . . . . . . . 39

    6.4a Time difference, method comparison. Mean error. ŷ-axis . . . . . . . . . . . . . . 40

    6.4b Time difference, method comparison. Error standard deviation. ŷ-axis . . . . . . . 40

    6.5a Time difference, method comparison. Mean error. ẑ-axis. (Bus) . . . . . . . . . . 40

    6.5b Time difference, method comparison. Error standard deviation. ẑ-axis. (Bus) . . . 40

    6.6a Time difference, method comparison. Mean error. Norm. . . . . . . . . . . . . . . 41

    6.6b Time difference, method comparison. Error standard deviation. Norm. . . . . . . 41

    6.7a Time difference, method comparison. Mean error versus velocity . . . . . . . . . . 41

    6.7b Time difference, method comparison. Error standard deviation versus velocity . . 41

    6.8 Estimated speed using the occupancy method. . . . . . . . . . . . . . . . . . . . . 42

    6.9 Estimated speed using the median velocity method. . . . . . . . . . . . . . . . . . 42

    6.10a Data from estimated parameters, three magnetic moments . . . . . . . . . . . . . 44

    6.10b Measured data from passing vehicle. . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    6.10c Data from estimated parameters, one magnetic moment. . . . . . . . . . . . . . . 44

    6.11a Measured data from traffic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    6.11b FFT of measured data from traffic. . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    6.12a Two-node vehicle detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

    6.12b Matched filter method. Convolution result. . . . . . . . . . . . . . . . . . . . . . . 45

    6.13 Sinc reconstruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

    A.1a FFT x̂-axis - Passenger car . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

    A.1b FFT x̂-axis - Another passenger car . . . . . . . . . . . . . . . . . . . . . . . . . . 54

    A.1c FFT x̂-axis - High car . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

    A.1d FFT x̂-axis - Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

    A.2a FFT ŷ-axis - Passenger car . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    A.2b FFT ŷ-axis - Another passenger car . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    A.2c FFT ŷ-axis - High car . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    A.2d FFT ŷ-axis - Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    A.3a FFT ẑ-axis - Passenger car . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    A.3b FFT ẑ-axis - Another passenger car . . . . . . . . . . . . . . . . . . . . . . . . . . 56

  • A.3c FFT ẑ-axis - High car . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    A.3d FFT ẑ-axis - Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    B.1 Simulator overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

    B.2a Simple simulator interface screenshot . . . . . . . . . . . . . . . . . . . . . . . . . 59

    B.2b Advanced simulator interface screenshot . . . . . . . . . . . . . . . . . . . . . . . . 60

    D.1a Addition to old sign. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

    D.1b Proposed new sign. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

    D.1c Sign with Amparo SeeMeTMMain Unit. . . . . . . . . . . . . . . . . . . . . . . . . . 64

  • List of Tables

    3.1 Capabilities of different technologies . . . . . . . . . . . . . . . . . . . . . . . . . . 16

    3.2 Sensitivity of technologies to environmental effects . . . . . . . . . . . . . . . . . . 16

    4.1 Simulated magnetic field strength versus distance. Sensor in road surface. . . . . . 20

    4.2 Simulated magnetic field strength versus distance. Sensor at 0.3 m. . . . . . . . . . 20

    5.1 Vehicle classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    C.1 Honeywell AMR sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

    xv

  • Definitions

    Queue – a line of people, vehicles or other objects. The first are dealt with first, so it issaid to have a first-in first-out order, FIFO. Up-time – arrival of a vehicle. Down-time – departure of a vehicle. On-time – time between arrival and departure of a vehicle.

    In this thesis the magnetic field strength refers to the magnetic field strength relative to the earthmagnetic field strength unless otherwise stated. The measured quantity is the disturbance of theearth magnetic field so this notation is applicable.

    xvii

  • Abbreviations and acronyms

    AMR Anisotropic Magnetoresistance

    AP Access Point

    AVI Automatic Vehicle Identification

    AWGN Additive White Gaussian Noise

    DFT Discrete Fourier Transform

    FFD Full-function Device

    FFT Fast Fourier Transform

    FIFO First-In First-Out

    GPS Global Positioning System

    ISM Industrial, Scientific and Medical

    ITS Intelligent Transportation System

    LR-WPAN Low-Rate Wireless Personal Area Networks

    KLT Karhunen-Loève Transform

    MAC Medium Access Control

    PHY Physical Layer

    radar Radio detection and ranging

    RF Radio Frequency

    RFD Reduced-function Device

    RSSI Received Signal Strength Indication

    RX Receive or receiver

    SN Sensor Node

    SNR Signal-to-Noise Ratio

    S/R Set/Reset

    SUV Sports Utility Vehicle

    ToF Time of Flight

    TRX Transceiver

    TX Transmit or transmitter

    VIP Video Image Processing

    xix

  • WIM Weigh In Motion

    WLAN Wireless Local Area Network

    WPAN Wireless Personal Area Network

    WSN Wireless Sensor Networks

  • Notation

    In the thesis, matrices and vectors are set in boldface, with upper-case letters for matrices andlower-case letters for vectors. The meaning of the following symbols – except where otherwisestated – are

    x[k], k = 0, 1, . . . , n kth sample of signal x

    θ̂ An estimate of the parameter θ

    E[·] Expectation of a variable∇ Gradient|u| Length (norm)B, B Magnetic flux density [T = Vs/m2]

    Rn n-dimensional Euclidean space

    µ0 Permeability in vacuum

    u · v Scalar productAT Transpose operator

    r̂ Unit vector

    u × v Vector product

    xxi

  • 1. Introduction

    Chapter 1

    Introduction

    1.1 Background

    During the last decades the number of vehicles on our roads has increased exponentially.Personal mobility has increased from 17 km a day in 1970 to 35 km in 1998 and is nowadays takenfor granted and seen as an acquired right [1]. This increased mobility has resulted in an increase oftraffic congestion, pollution and accidents. The increased mobility and the demands of improvedtraffic safety mean an increased need of correct and in real-time available information.

    The notion that a traffic system in the future will be based on real time communication betweenhuman–vehicle–infrastructure is not very far-fetched. A hypothesis is that the infrastructure willgo from being static to being dynamic [2] which also means that the demand for information abouttraffic situations will increase.

    If information about the current and future traffic situation can be forwarded from the infrastruc-ture to the vehicle, then information about the best route can be shown to the driver. Getting tothe desired destination within the specified time is however not the only benefit of such a system.The infrastructure of today was often planned many hundred of years ago with the national andinternational politics of the era in mind [1]. The roads were then widened to accommodate thetraffic of the modern era. This spells trouble – the roads cannot withstand the traffic intensity,resulting in queues and even accidents. Real-time information, and even predictions about futuretraffic situations will mean that traffic is spread out on the existing road network and thus reducingthe load on any single road.

    In order to make predictions about the future, one must first have information about the present.A Wireless Sensor Network (WSN) can give such information. We propose a WSN made up out ofmany sensor nodes (SNs), equipped with magnetic sensors. These SNs are cheap, easy to installand give detailed information about each passing vehicle. In its simplest form it can not do alot, but its strength comes from the network of SNs. There is also a choice to implement morecomputational power in each sensor node.

    1

  • 1.2 Purpose

    The purpose of this thesis is to evaluate the use of a Wireless Sensor Network for traffic surveillancein a number of fields including detection, speed estimation, classification and queue detection. Ineach of these fields a number of algorithms will be evaluated for use in the system. One of themain goals is to develop a simulator for cheap and easy testing of the system. The simulatorshould accurately portrait the model described in Chapter 4 and therefore be able to be used forsimulation of the algorithms found in this thesis.

    The main questions to answer are whether a WSN is suitable for traffic monitoring, i.e., primarily counting, speed estimation and classification, queue detection, i.e., speed estimation and presence,and what features of the sensor nodes and the algorithms used are needed for these applications.The thesis should investigate the performance of some algorithms for each case stated above andgive specifications for the hardware. The applications can be both permanent and temporaryin the sense that a pair of nodes can be placed permanently on-site or temporarily. The firstapplication for our system will be replacing the old technology based on pneumatic tubes andprovide statistics and queue detection.

    1.3 Delimitations

    This thesis is limited to the sensor part of the Wireless Sensor Network. This means that itis assumed that the network exists and works ideally except where otherwise stated. There area number of delimitations in the models themselves. The delimitations will be covered in laterchapters.

    2

  • 1.3. Delimitations

    Figure 1.1: During the last decades the number of vehicles on our roads has increased exponentially.

    3

  • 4

  • 2. Method

    Chapter 2

    Method

    This chapter aims to describe the scientific reasoning that forms the basis for the work done inthis project. As an introduction, the work process is outlined. Thereafter the methods chosen aredescribed. Finally a discussion about generality and validity follows.

    2.1 Assault approach

    Traditionally a completely deductive1 assault approach has been used – one made observations,noted them with more or less readable handwriting in a notebook and made conclusions fromthat. The method used to find the relation to real world data by Imego can be said to be strictlydeductive. The result has then been used to develop the model used in this thesis. The modelhas in its turn been used to develop the algorithms for use in the Wireless Sensor Network (WSN)that we propose, and we assume that they apply to real world situations. This method can besaid to be inductive2.

    2.1.1 Description

    The project is divided into parts. A short description of these parts now follows. A study of sensor networks, ad-hoc networks and previous work. Previous work includetheses within the same project. Simulation of magnetic model and sensor model in Matlab and other tools based on themagnetic model developed by Imego AB3, Implementation, evaluation and improvement of algorithms in the simulator, Implementation in hardware made by a previous thesis project at Qamcom Technology AB, Verification of the model by field trials.

    1deductive, “based on deduction from accepted premises: deductive argument; deductive reasoning.”http://www.dictionary.com

    2inductive, “of, pertaining to, or employing logical induction: inductive reasoning.” http://www.dictionary.com3http://www.imego.se

    5

    http://www.dictionary.comhttp://www.dictionary.comhttp://www.imego.se

  • 2.1.2 Discussion

    The usage of a model to develop algorithms is an inductive approach, but this thesis has notbeen written solely by using this approach. Throughout the projects, we have used measurementsto get more data for use in the model, an approach that can be said to be deductive. Thesemeasurements have been the foundation for the model developed, and the model has then beenthe basis for further studies. This approach is entirely inductive – therefore a combined inductiveand deductive approach has been used. In this case these approaches has the benefit of being cheap,time effective and non-destructive as opposed to only doing field trials which are time consumingand costly since hardware must be rebuilt if they don’t meet specifications and demands.

    2.2 Procedure

    In order to get acquainted with the Wireless Sensor Networks and the algorithms used today, theliterature in this field have been studied. Using this as a basis, along with the study made byImego AB, a simulator for the sensor system has then been developed. The simulator has beenused to evaluate algorithms for the different applications.

    2.3 Validity

    The validity of the model used in this thesis can be discussed. It is proved empirically that it isvalid at least in a small geographic area and its validity anywhere else in the world is assumed andinductively proved. The model should be iterative – one should go back and revise the model aftersimulations and field trials if the results do not match in order to increase validity. The downsideof basing decisions on a model is of course not knowing if the model matches reality and thereforethe results may not be valid. The validity is of course also determined by model parameters suchas number of magnetic dipoles moments considered.

    2.4 Generality

    The basis of the model applies to a lot of similar projects, where you want to simulate real eventsbecause they may be expensive, destructive or time consuming. The model itself applies to similardetection applications with magnetic sensors, but the more specific algorithms can not be appliedanywhere else.

    Regarding the scope of this thesis, it can be said that since we do not have data from every vehicleon the market, we cannot say that our model is valid for all of those vehicles. However when weadd more data, we do not change anything, and using the same methods discussed in this thesis,the model can be expanded to fit those vehicles.

    6

  • 3. Wireless Sensor Networks

    Chapter 3

    Wireless Sensor Networks

    Figure 3.1: Wireless Sensor Network together with a queue warning sign fitted with Amparo SeeMeTM

    flashing unit.

    3.1 “Ambient Intelligence” or

    putting electronics into groceries

    There has been a tendency for some time now to put embedded computational power intolarge things such as washing machines and refrigerators. That tendency is not limited to largeappliances but even disposable goods, groceries, living spaces and working spaces will soon be oralready are endowed with such capabilities [3]. Computational power that surrounds us in ourdaily lives can be – somewhat praisefully – called “Ambient Intelligence” wherein many differentdevices will work together to control processes or interact with us. We should take this technologyfor granted, it should be unobtrusive and even invisible.

    In the light of this, a new type of network emerged – the Wireless Sensor Network (WSN). Eachindividual node in the network is capable of sensing or interacting with its environment. However,it is first when they are connected to each other that they show their true power. WSNs havemany applications and the technical solutions are very different.

    7

  • An interesting example of a WSN is the “Smart Dust” proposed by the U.S. Defence AdvancedProjects Agency (DARPA). The smart-dust sensor nodes are extremely small - about the size ofa grain of sand or even a dust-particle. The idea is to scatter thousands of these small sensors onthe battlefield as an intelligent minefield to detect and monitor enemy movement. The sensors canbe spread out using aeroplanes or submunitions. An interesting civilian usage of these “intelligentminefields” can be found in accidents and catastrophe sites such as after an earthquake wherehumans can be trapped and wounded and need to be found quickly [4].

    The usage for the WSN we are proposing is entirely related to traffic. One interesting applicationcan be seen in Figure 3.1 and is a queue warning system. The sensor nodes collaborate and senda signal to the warning unit if there is a queue.

    3.2 Wireless Hardware

    The transceiver could use IEEE 802.15.4 and ZigBee1 standards [5]. The exact design of theWSN is not decided upon, here ZigBee is used for simplicity. The sensor nodes should be ableto perform short-range communication in small networks for which ZigBee and Wireless PersonalArea Networks (WPANs) are ideal. Unlike Wireless Local Area Network (WLANs), WPANs allowfor small, power-efficient, inexpensive solutions for a wide range of devices since they do not involveany or very little infrastructure [6].

    3.2.1 ZigBee Networks

    A Low-Rate Wireless Personal Area Network (LR-WPAN) is a simple, low-cost communicationfor applications where resources are limited [6]. An LR-WPAN offer easy installation, reliablecommunication, short-range operation, low cost and low power consumption. Two types of devicescan exist in such a network; reduced-function devices (RFD) and full function-devices (FFD). AFFD can talk to everyone while an RFD can only talk to a FFD. ZigBee Alliance defines thenetwork, security and application support layers (API) on top of the physical (PHY) and mediaaccess layer (MAC) defined by IEEE Standard 802.15.4 [6, 7].

    The network will consist mostly of sensor nodes (SNs) which are RFDs. These can unlike theFFDs, not become the coordinator in the star topology net used in this implementation [6, 7]. Wewill use an access point (AP) to transmit data to the backbone network. The network topologycan be seen in Figure 3.2. In the future, we will like to have the option to use a mesh networktopology instead. This will allow us to use SNs as relays.

    3.3 Wireless Sensor Networks

    for applications related to traffic

    Due to the different applications, the requirements for a WSN are also different. In our applicationsome of the important requirements are Multihop (wireless) communication. Sending information over large distances is only

    1ZigBee Alliance, www.zigbee.org

    8

    www.zigbee.org

  • 3.4. Sensor Node Hardware

    Figure 3.2: Star network topology with network coordinator [6, 7]. The network coordinator is in ourapplication the access point (AP) and the nodes are the wireless sensor nodes (SNs).

    possible using high transmission power. By using sensor nodes as relays we can reduce therequired power. Energy-efficient operation. Since the nodes are battery powered a strict power consump-tion policy is needed. When parts of the sensor node are not needed they are put to sleeponly to be awaken when they are needed. Auto-configuration. The nodes should be easily installed, by anyone, anywhere and at anytime. If the sensor nodes, and the wireless network, can be auto-configured it would be hugelybeneficial. A “must-have” property [8] of the sensor nodes is that they should autonomouslyposition themselves in the network. Preferably they should not rely on surrounding infras-tructure such as the Global Positioning System (GPS). There are many different techniquesthat forms the basis for autonomous positioning. In-network processing. An individual node may not be able to determine whether anevent has occurred or not but will depend on collaboration with its neighbours. We wouldlike to keep the inter-node traffic as low as possible to keep the power consumption low atthe same time as any calculations will take time, memory and power.

    The amount of processing needed in the SNs is highly dependant on their use. There are threemain usages for our equipment Vehicle detection, speed estimation and counting, Vehicle classification, Queue detection. See Figure 3.1.There is also a possibility to re-identify vehicles [9]. This requires more SNs and more computa-tional power.

    9

  • Figure 3.3: Wireless Sensor Node Prototype.

    3.4 Sensor Node Hardware

    The sensor node is comprised of two main parts, seen in Figure 3.4. The primary intent of thesensor node is obviously to sense something and therefore the sensor or sensors make up one ofthose parts. Our sensor node uses magnetoresistive sensors to sense the magnetic field and it issensitive enough to detect field in the range of at least tens of nanotesla. The prototype can beseen in Figure 3.3. In order to understand why we have chosen anisotropic magnetoresistors wehave to look at the arguments for and against other systems.

    Figure 3.4: Wireless Sensor Node Architecture.

    3.4.1 Comparison of existing technologies

    The different surveillance technologies can be classified as intrusive, non-intrusive or off-roadway [10].Intrusive sensor systems are installed in or on the pavement, non-intrusive are installed over orat the side of the road. Off-roadway systems are special since they need no equipment installedon-site.

    10

  • 3.4. Sensor Node Hardware

    Inductive loop

    The energy is used for measuring change in oscillator frequency [10] over the sensor loop and foranalog to digital (A/D) conversion [11]. The inductive loop is therefore an active sensor. Inductiveloops are today the most common vehicle detector in use and is today a mature technology. It hasa high detection accuracy. The disadvantages include high-cost installation and traffic disruptionduring installation. The loop wire is affected by stresses in the road surface and temperaturemaking the failure rate high [10].

    Pneumatic Tube

    A pneumatic tube system is a very basic system that uses pressurised tubes to measure trafficparameters. When a vehicle passes the tube a pulse of air pressure is transferred along the tube.The output is therefore only detection, however with more than one tube, you can find the speedand even classify vehicles. The simplicity of this system is apparent. One of the major drawbacks,especially in Sweden, is that measurements can not be done in the winter time due to the possibilitythat the tubes will be plowed away by snow plows.

    Installation and maintenance costs are kept low due to its simplicity. Drawbacks include inaccuracyin axle counting when buses and trucks are common [10]. The sensitivity is temperature dependant,and the equipment wear and tear is significant.

    Piezoelectric sensor

    A piezoelectric sensor uses a material that will generate an electrical potential when mechanicalstress is applied. The output is proportional to the force applied and is only present when theforce is changing. Classification is done here by axle count, spacing and vehicle weight. Thesetypes of sensors also have high-cost installation and maintenance.

    Weigh-In-Motion system

    A Weigh-In Motion (WIM) system will estimate the gross weight of a passing vehicle using differenttypes of technology embedded in the road or on the road. These sensors can be of the piezoelectrictype described previously. They can also depend on a capacitance mat, on hydraulic fluid in apressure transducer (load cell sensor) or fiberoptics. A fiberoptic system is popular since it isinstalled by sticking thin tubes onto the pavement as opposed to burying the sensors [10].

    Infrared-based system

    An infrared-based system can be either passive or active. A passive system relies on the emittedradiation from vehicles and ground surfaces while an active system uses the time difference betweentransmit and receive of the reflected pulse. The performance of the system is greatly affected bythe environment, for example rain and snow, sunlight and temperature.

    11

  • Ultrasonic system

    Ultrasonic sound waves are used for ranging in these systems and the principle is similar to that of aradar. There are models using Doppler shift to measure speed. Disadvantages include temperatureand wind dependence [10].

    Passive acoustic system

    By using an array of microphones, the acoustic energy produced by a vehicle is measured. Perfor-mance is affected by temperature and accuracy drops with slow moving vehicles [10].

    Video Image Processing

    A video traffic detection system relies on image processing of optical data and therefore it isaffected by weather conditions and lighting conditions. The system can also be affected by trafficintensity, and camera placements since vehicles in the background will make it harder for theimage processing algorithms.

    Microwave Radar

    A radar system works in the same way as a video system but since it is not using optical wavelengthsit is not affected by weather and lighting conditions to the same degree. It is however affectedby traffic intensity and radar sensor placement. There are a number of different types of radarsystems, each with its advantages and disadvantages. A continuous wave (CW) radar estimatethe vehicle speed with the use of a single radar sensor. With the use of frequency-modulatedcontinuous wave (FMCW) radar, a pair of of radar zones must be used.

    Off-roadway technologies

    These systems do not need any roadside hardware. Technologies include Global Positioning System(GPS) positioning of mobile phones and Automatic Vehicle Identification (AVI). Positioning bymobile phones is interesting because it is rare that any vehicle do not have a mobile phone so noequipment need to be installed. Remote sensing by satellite or aircraft, optical or radar, can beused but has limited coverage due to the low availability of aircraft and satellites.

    3.4.2 Summary of different technologies

    In Tables 3.1 and 3.2 a comparison between the different technologies are presented. In Table 3.1we can see the capabilities of the different systems and in Table 3.2 we can find what affects theirperformance. There is of course a big difference in installation cost and maintenance costs forthese systems and the data they produce differ in accuracy. Inductive loops, which are the mostused today, have a very good accuracy but are expensive. A WSN also has a good accuracy but ismuch cheaper, and can outperform the inductive loop. There are also differences within the samesystem. For example a side-fire or overhead-fire VIP system has much different performance.

    12

  • 3.4. Sensor Node Hardware

    Figure 3.5: AMR Barber Pole Bias.

    Figure 3.6: Wheatstonebridge. Voltage differencebetween OUT+ and OUT- ismeasured.

    3.4.3 AMR Magnetic sensors

    Some materials change their electrical resistance when exposed to a magnetic field [12]. Thismagnetoresistive effect is used in anisotropic magnetoresistance sensors (AMR) sensors. Theresistive elements are most often made of nickel-iron [13] (Permalloy) thin films.

    The benefits of using this type of sensor come from its ability to sense static magnetic fields as wellas the direction of those fields. The detection range is also suitable for our purposes. They are verysensitive to magnetic fields – according to [12] they have a noise specification of in the order ofnT/

    √Hz and one of the sensors we are using has a resolution of 2.7 nT. As a comparison computer

    floppy disks store data with field strengths of approximately 1 · 106 nT [14]. Another importantfact is that the sensors can be bulk manufactured on silicon wafers, and thus are cheaper.

    In an AMR sensor these magnetorestive materials are used in a “Wheatstone bridge” [15]. Atypical AMR sensor bridge can be seen in Figure 3.5 and the electrical diagram of a Wheatstonebridge can be seen in Figure 3.6. Each bridge has four resistive elements which are ordered sothat opposite elements are equal. If a magnetic field is applied, two of the resistive elements willdecrease slightly in resistance. The other two will increase slightly.

    The voltage between the out terminals Out+ and Out− on the sensor is measured. That voltageis dependant on the sensor sensitivity, the bridge supply voltage and the applied field [15].

    Out+ − Out− = SVbBs, (3.1)

    where S is the sensor sensitivity [mv/V/T], Vb the bridge supply voltage and Bs the applied

    13

  • magnetic field [T]. In order to detect a magnetic field of any orientation we will need three of thesesensors – one for each axis.

    The properties of the AMR sensor are only well-behaving when the magnetic domains of the film isaligned with each other. The “easy axis” of the magnetisation vector M is set during fabrication,see Figure 3.7a. The M vector is then parallel to the length of the resistor. The low-resistanceshorting bars (seen in Figure 3.5) is there to make the current flow at a 45 degree angle to the filmwhich gives us an angle θ between the current vector and the magnetisation vector. The resistanceis dependent on the angle θ and reaches its maximum when the current vector is parallel to themagnetisation vector [13]. The technique for producing this “shortest path” through the resistoris called barber pole biasing.

    θ

    Figure 3.7a: Magnetoresistiveeffect. Permalloy (NiFe) resist-or [13], no applied field.

    θ

    Figure 3.7b: Magnetoresistiveeffect. Permalloy resistor, ap-plied field.

    If we now apply a magnetic field normal to the easy axis the magnetisation vector will rotate andwe will see a change in the voltage output of the Wheatstone bridge. The magnetoresistive effectis directly related to the angle θ [16]. See Figure 3.7b.

    A magnetic field will break down the alignment of the magnetisation vector which is essentialto receive accurate measurements. The resistor is made up of many magnetic domains whosemagnetisation vector can point in any direction, see Figure 3.8a. For small disturbances, thesemagnetic domain magnetisation vectors will rotate back to their previous direction when the fieldis no longer applied. For large fields however they will not. To realign the total magnetisationvector with the easy axis we can apply a strong magnetic field in the right direction. The Honeywellsensors are for this reason equipped with a Set/Reset (S/R) strap that can be pulsed with highcurrent to reset the sensor and align the magnetisation vector with the easy axis again. The effectof the S/R pulses can be seen in Figure 3.8b and 3.8c.

    Figure 3.8a: Random mag-netic domain orientations [16,17] before set/reset pulse. Notethe sensitive axis.

    Figure 3.8b: Magnetic mo-ment domain orientations aftera set pulse [16, 17]. Momentsaligned to the right.

    Figure 3.8c: Magnetic mo-ment domain orientations aftera reset pulse [16, 17]. Momentsaligned to the left.

    We need to create the current through the S/R strap and this is done using an H-bridge. Thecurrent pulse shape can be seen in Figure 3.9. The S/R current has a high power requirement. Weneed to minimise the current, and maximise the time between the S/R pulses in order to conservebattery power. A number of schemes for doing this has been tested, among those are Use only set or reset pulse at any time, interchange them, Use less current for each pulse, Maximise the time between pulses,14

  • 3.5. Sensor Hardware

    ττPW

    Figure 3.9: Set/Reset pulses ofHMC100x, HMC1043. Only S/R when a high field has been present.

    It is most likely that a combination of the above will produce the best result. An importantparameter in this is the usage of the sensor. If we need to detect small fields, then we need to dothis more often.

    3.5 Sensor Hardware

    The sensor nodes should be inexpensive, battery powered (maybe with an option for an externalpower source), rugged, easy to maintain, and easy to install. A prototype sensor node has beenbuilt by a previous project [5] at Qamcom Technology AB.

    The sensor should be easy to operate, be capable of near-real-time calculations and withstandroad conditions in the most demanding of climates. Here in Sweden the climate offer snow andice in the winter and high temperatures in the summer. It should be able to operate for a longtime in these climates putting enormous strain on the power supply. The power supply can beinternally or parasitically powered.

    15

  • Table 3.1: Capabilities of different technologies [10].

    Technology Presence Count Direction Speed Classification

    Pneumatic tube • • • Wheel axesPiezoelectric sensor • • • Wheel axesWIM system • • • • Wheel axesCW radar • • •FMCW radar • • • • ShapeActive infrared • • • • ShapePassive infrared • • • • ShapeVideo Image Processing • • • • ShapeUltrasonic • • • • ShapePassive Acoustic • • • • SoundInductive loop • • • • Magnetic signatureAMR Sensors • • • • Magnetic signature

    Table 3.2: Sensitivity of technologies to environmental effects [10].

    Technology Wind Temperature Lighting Traffic flow

    Inductive loop •Pneumatic tube • •Piezoelectric sensor •WIM systemCW radar •FMCW radarActive infraredPassive infraredVideo Image Processing • •Ultrasonic •Passive Acoustic • • •AMR Sensors •

    16

  • 4. Theoretical model

    Chapter 4

    Theoretical model

    This is were we come to the pith of the matter. A vehicle is made up of different magneticmaterials. Some of them are soft magnetic materials and some are hard magnetic materials [12].The soft magnetic materials have no residual magnetisation but high magnetic susceptibility. Thehard magnetic materials have high residual magnetisation. These materials all have the propertythat they will disturb a present magnetic field. The disturbances in a magnetic field created by avehicle are large enough to be detected with a magnetic sensor.

    Different vehicles will disturb a magnetic field differently due to the different magnetic materialsand their distribution within the vehicle.

    4.1 The earth magnetic field

    The magnetic field that we live and work in everyday is always changing. For this application itis of critical importance that the earth magnetic field does not change too rapidly, at least notduring the passing of a vehicle.

    The magnetic field in a particular position has been known to be affected by magnetic mineral,iron artifacts, and similar. Short-term effects from solar flares are frequent. The earth magneticfield reverses polarity with an estimated frequency of a quarter of a million years. On a morerapid time scale, the field is estimated to have decayed about 5–15 % over 150 years [18]. Even ifthe decay is twice as much, it would not pose a problem for our application.

    The earth magnetic field looks very different depending on your location in the world. Themeasurements discussed in this thesis have all been made in Göteborg, Sweden1. A common andnon-complex model of the earth magnetic field can be seen in Figure 4.1.

    1Lat 57 43 00 N Long 011 58 00 E

    17

  • Figure 4.1: Simplified model of the earth magnetic field. Theearth magnetic field can be modelled like an ordinary magnet butin reality it is much more complex and is changing constantly.

    4.2 Sensing the world

    The primary intent of a magnetic sensor is often not measuring the magnetic field. Instead onewishes to measure other parameters such as speed, heading, and presence, and to do so one has tolook at the effect those parameters have on the magnetic field. Figures 4.2a and 4.2b illustratesthe difference between conventional sensing and magnetic sensing. In order to get the parameterswe want from the magnetic fields, we have to apply signal processing.

    Figure 4.2a: Conventional sensing. Figure 4.2b: Magnetic sensing.

    4.3 Magnetic model

    When a vehicle moves into a magnetic field the magnetic field lines are disturbed. These dis-turbances are not located solely inside the vehicle but also outside, allowing us to measure themagnetic field in order to sense the presence of that vehicle. See Figures 4.3a and 4.3b.

    18

  • 4.3. Magnetic model

    Figure 4.3a: Non-disturbed field lines. A ve-hicle is about to enter.

    Figure 4.3b: Field lines distributed by a pass-ing vehicle. Simulated in Femlab2.

    All electromagnetics are governed by Maxwell’s equations [19–21],

    ∇ · D = ρc Gauss’s law (4.1)∇ · B = 0 Gauss’ law for magnetism (4.2)

    ∇× E = −∂B∂t

    Faraday’s law of induction (4.3)

    ∇× H = J + ∂D∂t

    Ampère’s circuital law (with Maxwell’s correction), (4.4)

    where B is the magnetic flux density, H is the magnetic field strength, E is the electric fluxdensity, D is the displacement field, J is the current density and µ0 = 4π · 10−7 Vs/Am is thepermeability in vacuum [21]. µr is the relative permeability of the medium and ρc is the electriccharge density. In linear materials

    D = ε0E + P = (1 + χe)ε0E = εE, (4.5)

    B = µ0(H + M) = (1 + χm)µ0H = µ0µrH, (4.6)

    where P is the polarisation density, M is the magnetisation density, χe is the electrical suscepti-bility and χm is the magnetic susceptibility. Assuming that the magnetic field is changing slowly,so that we reach a steady state, Maxwell’s equations reduce [19–21] to the magnetostatic equations

    ∇ · B = 0 Gauss’ law for magnetism (4.7)∇× B = µ0µrJ Ampère’s circuital law. (4.8)

    The vector potential of a magnetic dipole [20, 21] can be written as

    A(µ, r) =µ04π

    µ × r|r|3

    , (4.9)

    where µ is the magnetic moment and r is the vector from the dipole. This can be related to themagnetic flux density [21] by

    B = ∇× A. (4.10)The field from a magnetic dipole moment [22] situated at the origin can then be written in vectorform as

    B(µi, ri) =µ04π

    3 (µi · ri) ri − µi |ri|2

    |ri|5, ri,µi ∈ R3. (4.11)

    2Now Comsol Multiphysics, http://www.comsol.com/

    19

    http://www.comsol.com/

  • Table 4.1: Maximum magnetic field strengthat different distances from a passing passengercar. The node is placed in the road surface.

    Distance [m] |Bz| [nT]0 2.2 · 1051 17652 3223 102

    Table 4.2: Maximum magnetic field strengthat different distances from a passing passengercar. The node is placed at a height of 0.3 m.

    Distance [m] |Bz| [nT]0 2.5 · 10111 30002 3753 111

    The total magnetic field, B, from n individual magnetic moments [22] can be written as

    B(r1,µ1, r2,µ2, ..., rn,µn) =µ04π

    n∑

    i=1

    3 (µi · ri) ri − µi |ri|2

    |ri|5, (4.12)

    where ri is the position for the ith magnetic moment µi.

    It is assumed in [22] that the permanent and induced magnetic fields from a vehicle can be viewedas the field from a number of magnetic moments. We shall later see that this is a good assumption.If we have knowledge of all the positions and strengths of the magnetic moments within the vehicle,we can calculate the field from that vehicle in any point in space. However, we will have an infinitenumber of magnetic moments.

    Each of the magnetic moments will have six degrees of freedom, making a large system verycomplex to handle. Each vehicle will therefore be approximated to be comprised of a low numberof magnetic moments.

    The earth magnetic field will have different direction and strength at different locations, but wecan assume it to be constant near the sensor so that a vehicle will experience the same field in thevicinity of the sensor node. We also assume that the field does not change during the vehicle’spassing of the sensor. The earth magnetic field does not have to be exactly equal at two differentsensor node positions since the disturbances caused by the vehicle is similar. They are howevernot the same due to the orientation of the earth magnetic field and its impact on the magneticdipole moments we assume our vehicle to be comprised of. For this application we assume thatthe magnetic dipoles are not time dependant. The time dependant magnetic field can now bewritten as

    B(r1(t),µ1, r2(t),µ2, ..., rn(t),µn) =µ04π

    n∑

    i=1

    3 (µi · ri(t)) ri(t) − µi |ri(t)|2

    |ri(t)|5. (4.13)

    4.4 Vehicle model

    In the model used, a vehicle of any type is said to be equivalent to at most three magnetic momentsdistributed in the car seen in Figure 4.5. A few simplifications are hereby made. The moments areassumed to be placed on the centerline of the vehicle, thereby reducing the degrees of freedom permagnetic moment by two. Since we have three magnetic moments each now having four degreesof freedom, we have a total number of twelve degrees of freedom. Compare this to the eighteenwe had originally or even the unlimited degrees of freedom we really have. This is certainly alimitation of the model. The vehicle will move in a coordinate system relative to the sensor, wherethe sensor is placed in the origin.

    20

  • 4.4. Vehicle model

    Magnetic field strength versus distance

    Distance [m]

    Magnet

    icfiel

    dst

    rength

    [nT

    ]

    xyz

    0 0.5 1 1.5 2 2.5 3−2500

    −2000

    −1500

    −1000

    −500

    0

    500

    1000

    1500

    2000

    Figure 4.4: Magnetic field strength depending on distance. Thesensor is placed on the road surface and the field is measuredexactly when the vehicle passes the sensor. This is not the pointwhere the field is the strongest.

    The simulated maximum sfield strengths from a single passenger vehicle pass versus distance tosensor can be seen in Tables 4.1 and 4.2 The simulated maximum field strengths versus distanceat the instant the vehicle passes the sensor can be seen in Figure 4.4.

    ŷ ẑ

    r

    v

    µ1

    µ2

    µ3

    Figure 4.5: Input parameters to theMatlab-model. The sensor is placed atthe origin. The magnetic dipoles are as-sumed to be positioned on the vehicle cen-terline.

    21

  • v

    µ1

    µ2

    µ3

    ησ(t)

    Figure 4.6: Can our channel be modelled as an AWGN chan-nel?

    4.5 Sensor and channel model

    It is assumed that the data is affected by additive white Gaussian noise with some power as canbe seen in Figure 4.6. We do not know exactly what the channel will do to the magnetic field,and we do not know exactly what the sensor will introduce, but their joint effect is modelled asan Additive White Gaussian Noise, AWGN, channel. The signal in one of the sensor axis is thenrepresented by

    xi(r1(t),µ1, r2(t),µ2, ..., rn(t),µn) = Bi(r1(t),µ1, r2(t),µ2, ..., rn(t),µn) + ηi,σ(t), (4.14)

    where ηi,σ(t) is a zero-mean Gaussian distributed random variable with standard deviation σ indirection i ∈ {x̂, ŷ, ẑ}.

    4.5.1 Reconstruction

    As will be shown later we have sampled the signal at more than twice the Nyquist frequency andour signal x(t) with one-sided baseband bandwidth W is therefore uniquely determined by itssamples

    x[n] = x(nTs) n = 0,±1, . . . (4.15)

    if the sampling frequency is

    fs =1

    Ts> 2W (4.16)

    where the Fourier transform X(f) of x(t) satisfies

    X(f) = 0 |f | > W. (4.17)

    2W is called the Nyquist rate, and fs/2 is the Nyquist frequency. We can now reconstruct thesignal x(t) by lowpass filtering [23] the train of impulses x(nTs)δ(t − nTs). This will give us thereconstruction as

    x(t) =

    ∞∑

    n=−∞

    x(nTs)sin (π(t − nTs)/Ts)

    π(t − nTs)/Ts. (4.18)

    22

  • 4.6. Comparison to real world data

    4.6 Comparison to real world data

    Simulated data from four different vehicles can be seen in Figures 4.7a through 4.7d. The sensorhas been placed 1.5 m from the vehicles on the left side on the road surface. The speed was100 km/h. No noise was added. For the passenger car, one dipole situated 0.3 m over the sensorin the ẑ-direction and 0.7 m from the sensor in the x̂-direction. The magnetic dipole strength was[−3, 0,−30]Am2, i.e., almost entirely in the negative ẑ-direction as expected at this location.

    A comparison between simulated and real data for all axes can be found in Figures 4.8a and 4.8b.There are some discrepancies due to the fact that there are many unknown parameters in themeasured data, such as velocity and distance to the sensor and these had to be estimated beforesimulation.

    From this simple comparison we can conclude that our model is a reasonable model. However,we can not say anything about how good it is from this case where numerous parameters areunknown.

    Passenger car

    Time [s]

    Magnet

    icfiel

    dst

    rength

    [nT

    ] zyz

    -0.2 -0.1 0 0.1 0.2-3000

    -2000

    -1000

    0

    1000

    2000

    3000

    Figure 4.7a: Simulated sensor data from pas-senger car.

    Passenger car

    Time [s]

    Magnet

    icfiel

    dst

    rength

    [nT

    ] xyz

    -0.2 -0.1 0 0.1 0.2-3000

    -2000

    -1000

    0

    1000

    2000

    3000

    Figure 4.7b: Simulated sensor data from an-other passenger car.

    Bus

    Time [s]

    Magnet

    icfiel

    dst

    rength

    [nT

    ]

    xyz

    −0.2 −0.15 −0.1 −0.05 0 0.05 0.1 0.15 0.2

    −1

    −0.5

    0

    0.5

    1

    ×104

    Figure 4.7c: Simulated sensor data from bus.Note the complexity.

    High car

    Time [s]

    Magnet

    icfiel

    dst

    rength

    [nT

    ]

    xyz

    −0.2 −0.15 −0.1 −0.05 0

    −1

    −0.5

    0

    0.5

    1

    ×104

    Figure 4.7d: Simulated sensor data from highcar. Note the complexity.

    23

  • Measurement data

    Time [s]

    Magnet

    icfiel

    dst

    rength

    [nT

    ] x̂ŷẑ

    73 73.2 73.4 73.6 73.8 74 74.2 74.4 74.6 74.8−3000

    −2000

    −1000

    0

    1000

    2000

    3000

    4000

    5000

    6000

    Figure 4.8a: Measured sensor data from pas-senger car [22]. Note the different timescale dueto difference in speed.

    Passenger car

    Time [s]

    Magnet

    icfiel

    dst

    rength

    [nT

    ] x̂ŷẑ

    −0.5−0.4−0.3−0.2−0.1 0 0.1 0.2 0.3 0.4 0.5−3000

    −2000

    −1000

    0

    1000

    2000

    3000

    4000

    5000

    6000

    Figure 4.8b: Simulated sensor data from pas-senger car. Speed was 30 km/h and the distanceto the sensor was 0.7 m. The sensor was placedon the roadway.

    24

  • 5. Algorithms

    Chapter 5

    Algorithms

    5.1 System Overview

    This chapter will describe the algorithms that could be used in our system. For each node we havethe option to put the sensor node in the center of the lane, at the side of the lane or anywhere inbetween. The first two positions will give rise to much different characteristics in the signal so theposition will be important when assessing the algorithms. An overview of the system can be seenin Figure 5.1.

    5.2 Simulation of traffic

    It is more important to monitor oversized vehicles such as buses and trucks than other types ofvehicles. These vehicles have distinctively different characteristics in terms of speed, acceleration,road space, and manoeuvre times [24]. They also have longer breaking times and are sometimesonly permitted to drive in certain lanes or even roads. The heavier vehicles will contribute dis-proportionally to the wear and tear of the road surface. In this thesis, the focus has however beenlaid on passenger cars, buses and high cars or SUVs. Together they give rise to very differenttypes of sensor outputs and can be used for most simulation purposes. Since these types are themost common we can feel confident that our algorithms will work. The model takes into accountthe different probabilities of the different vehicle types, and more types of vehicles can be added.

    A traffic model can be very complex. In this thesis it is assumed that all vehicles travel along thesame line, at the same velocity. Furthermore, they do not accelerate, the vehicle path is parallelto the sensor ŷ-axis and they all have the same height. In the simulator it is easy to implementanother traffic model if needed.

    5.3 Detection

    We need to have enough samples in order to distinguish key features in the vehicle. The number ofsamples needed is of course determined by the application. If we wish to merely detect a vehicle,

    25

  • we need at least one sample when the vehicle is passing the sensor and generate a signal with anamplitude over a pre-defined threshold value. If we assume that no vehicle will travel faster than110 km/h, we will need to sample at 7 Hz in order to get one sample at a time where a part of thevehicle is directly above the sensor. However, it is not certain that every part of the vehicle willgenerate a signal greater than the threshold value. It is not even guaranteed that the maximumwill occur exactly when the vehicle passes the sensor. If we instead need to classify vehicles, wewill need many more samples. If we need four times more samples, the highest frequency will beless than 40 Hz. Since we need to sample faster the twice the Nyquist frequency we find thata sampling frequency of 100 Hz is enough, and this hypothesis is strengthened by the FFT ofsimulated and measured data. In the literature a sampling frequency from 64 Hz to 128 Hz isreported [11]. The sampling frequency is in some cases up to 2 kHz [25] for short periods of time,which is thus unnecessary. We would like to keep the sampling frequency to a minimum – if wesample less often we can let the sensor and processor sleep longer to reduce power consumption.

    5.3.1 Thresholding

    Detection using simple threshold values is not as simple as it might sound to the casual reader.The sensor output is temperature dependant and the effect will be significant. However thetemperature change can be made slow in comparison to the magnetic signature of a vehicle byclever design of the enclosure. An illustration of the temperature dependant offset can be seen inFigure 5.2.

    The threshold value can be set at design time or by training the sensor. An adaptive algorithmcan be used to make sure that the threshold is larger than the noise and change depending ontemperature. The threshold value also depends on the closeness to disturbing traffic etc.

    5.3.2 Target Tracking

    If we have many small sensor nodes with only one task – to report the magnetic equivalent toReceived Signal Strength Indication (RSSI) values – we can track vehicles within the area coveredby the WSN. This is a known problem, commonly encountered in radar systems. In our case wewill have different sensor nodes i.e. a spatial problem and in a radar system you will have differentdirections at different times, i.e. a time dependant problem. We have decided not to give thisarea any focus even though target tracking will be implementable in our system if sensors arepositioned for such an application.

    5.4 Direction

    Direction can be found by a single sensor node [15]. The sensor should be placed at the side of theroad, and the ŷ-axis response will show the direction of travel. The signature for a vehicle travellingin the forward direction can be seen in Figure 5.3 – a vehicle travelling in the reverse directionwill produce a mirrored signature. Note that the sensor placement and the dipole orientation willaffect the signature.

    However a more reliable method involves using two sensor nodes, a SN pair, to find the speed andthereby the direction. In order for this to work the SN pair needs to be time synchronised in orderfor this to work and the distance between them must be known.

    26

  • 5.5. Speed estimation

    5.5 Speed estimation

    Speed estimation can be either one of two things – the estimation of the speed of an individualvehicle or the average speed of a number of vehicles in an area. The algorithms used for theseestimations use different parameters that can be seen in Figure 5.4 and the definitions can befound in Chapter 2. We can use a single sensor, or more sensors, to find a speed estimation.

    To find the speed in the two-sensor case we need to consider the distance between the sensors. Alarge distance between the sensors means that we will not need a high sampling rate. The samplingrate needs to be large compared to the velocity. The velocity in turn depends on the time and thedistance between sensor nodes which means that the inverse sampling rate, the sampling period,should be small compared to the time it takes for a vehicle to pass the SN pair.

    A large distance will also mean that we will get a average velocity as opposed to a instantaneousvelocity, a shorter distance will get us closer to the instantaneous velocity. However, the error invelocity due to error in time difference will decrease when the distance is increased. Since it isdifficult to synchronise clocks between sensors, it will however be beneficial to put two sensors inthe same node but placed at a distance from each other on the circuit board. In this case we canlet the second sensor sleep until the first sensor triggers and then start to sample both sensors ata higher rate in order to minimise the error. The fact that we can let one sensor sleep lets us savepower and money since we do not need a dedicated processor and transceiver for the extra sensor.

    5.5.1 Speed of an individual vehicle

    Traditional time difference

    Using two sensors we can estimate the speed for an individual vehicle. As seen in (5.1), we canuse both up-time, ton,i and down-time toff,i to get an accurate estimation. See Figure 5.4. Thisgives us two speed estimations, v1 and v2 of which we can take the average to form our estimatedspeed.

    vest =v1 + v2

    2=

    1

    2

    (

    d

    t2,on − t1,on+

    d

    t2,off − t1,off

    )

    . (5.1)

    The estimation is affected by a difference in sensitivity [10]. The difference in sensitivity introducesa delay ε, assuming that the pulse is symmetric. This assumption is a good assumption for normalvehicles, but not for larger vehicles like buses and trucks - for these vehicles we need an εon andan εoff. The estimated speed is now

    vest =1

    2

    (

    d

    t2,on − t1,on + ε+

    d

    t2,off − t1,off − ε

    )

    (5.2)

    =d (t2,on − t1,on + t2,off − t1,off)

    (t2,on − t1,on)(t2,off − t1,off) + ε ([t2,on − t1,on] − [t2,off − t1,off]) + ε2. (5.3)

    The distance between sensors should be large, or equivalently the sampling frequency should belarge in order to get accurate measurements. We also have the option to interpolate the signalsince we are sampling at a frequency greater than twice the Nyquist frequency. A small distance

    27

  • and high sampling frequency will get a average speed closer to the instantaneous speed. Thisinformation is often not required, and uses a lot of power since the AMR sensors consumes a lotof power, it is better to interpolate instead of oversampling. Sending information between nodesis also expensive.

    If we can assume that all vehicles that passes the first sensor node also will pass the second sensornode, we can synchronise the data. In this case we also need to synchronise the time betweensensor nodes, so that we will have accurate timestamps. Another solution is to put two magneticsensors on each sensor node circuit board. This will allow us to use the same clock but the samplingfrequency needs to be larger resulting in a higher power requirement.

    Time difference using matched filter

    A matched filter is a filter, h, that maximises the Signal-to-Noise Ratio (SNR) in the presence ofadditive stochastic noise.

    y[n] =

    ∞∑

    k=−∞

    h[n − k]x[k], (5.4)

    where x is the indata, and y is the outdata. This filter can for example be used to find thesynchronisation time in a communication system as illustrated in Figures 5.5a, 5.5b and 5.5c.

    By choosing our matched filter as the time reversed output from the first sensor, we can find thetime difference between the two similar outputs. The pulse shape should be chosen so that thematched filter output has a sharp peak as possible to not be affected as much by noise. Things thatwill affect the peak are for example distance to sensor, speed, sensor axis, and sampling frequency.By choosing the matched filter like this, we can see that it can be implemented in real-time andthe peak is found when the vehicle has passed both sensors. With this algorithm, we can getsubsample resolution by interpolation of the two signals. We can also interpolate around the peakof the convolution.

    5.5.2 Average speed estimations

    An average speed estimation for a number of vehicles can be done with a single sensor assumingwe know the distribution of vehicle lengths [11]. Consider n vehicles with on-times t1, . . . , tn andlengths l1, . . . , ln. Their unknown assumed common speed is v = v1 = v2 = . . . = vn. We haven + 1 unknowns and n equations of the form

    li = tiv i = 1, . . . , n. (5.5)

    If we now know or assume the distribution of the vehicle lengths, we can obtain a maximumlikelihood estimate of the vehicle speed v̂ and also the vehicle lengths

    l̂i = tiv̂, i = 1, . . . , n. (5.6)

    An estimate of the speed is then just

    v̄ =l̄

    t̄, (5.7)

    28

  • 5.6. Classification

    where x̄ denotes the median value of that variable. The median length l̄ is assumed to be 5 meters.The accuracy of this methods depends on the difference between the actual vehicle length and thevalue of l̄.

    If we use the speed estimate v̄ for v̂ in (5.6), we will get the vehicle length estimates [26]

    l̂i = tiv̄, i = 1, . . . , n. (5.8)

    The number of vehicles, n, must be small enough for the assumption v = v1 = v2 = . . . = vn tohold [26]. Alternatively we can define two new parameters [27] for each lane,

    q =n

    T(5.9)

    θ =

    ∑n

    i=1 tiT

    , (5.10)

    where q is the flow and θ is the occupancy. T is the time period length. Assuming that there isno correlation between vehicle length and vehicle velocity, we reach an estimate of the speed as

    v̂ =q · l̂θ

    , (5.11)

    where l̂ is assumed to be known and constant.

    5.6 Classification

    There are many methods for classification of vehicles. Older sensor systems has set the standardfor what features in the sensor outputs are used. Traditionally when pressure tube measurementshave been used, one could easily find the number of axles, and the distance between them, andthe direction of travel. Sometimes – depending on the setup – one could also find in which lanethe vehicle travelled Later, even when magnetic loop sensor was introduced, the classes were stillbasically light and heavy traffic although much research has been made in this area. We propose asystem based on a classification scheme found in [24] for use with other sensors. This classificationhas seven classes, based on the information we can get from the AMR sensors. The seven usedclasses can be found in Table 5.1. The classification classes is different between different countries.

    Table 5.1: Vehicle classes [24]

    Class number Type

    1 Passenger car, mini-van, sports car, station wagon2 SUV, pickup3 Van, full-size pickup4 Bus5 Mini-truck6 Truck7 Other

    For a random variable X or function g(X) moments can be defined. The signature of a passingvehicle, i.e., the sensor output has properties that make these parameters usable. The momentscan be used as parameters in the classification of vehicles. An example of this can be see inFigure 5.7. The kth central moment µk is defined [28] as

    µk = E[(X − µ)k], (5.12)

    29

  • where µ is the expectation value. The skewness γ1 and kurtosis γ2 are defined as

    γ1 = E

    [

    (

    (X − µ)σ

    )3]

    (5.13)

    γ2 = E

    [

    (

    (X − µ)σ

    )4]

    − 3. (5.14)

    For the normal distribution γ1 = γ2 = 0. The skewness and kurtosis are estimated as

    γ̂1 =1

    n

    n∑

    1=i

    (

    xi − µs

    )3

    , (5.15)

    γ̂2 =1

    n

    n∑

    1=i

    (

    xi − µs

    )4

    − 3, (5.16)

    where s is the estimated standard deviation.

    A distribution having a longer tail at earlier times, i.e. the “left side” of the signature distribution,then it is negatively skewed and vice versa. If the tails are thinner than those of the normaldistribution it has positive kurtosis.

    5.6.1 Tree method

    Significant pre-processing of the raw data is required [11] for this method. The signal magnitudeneeds to be normalised, the on-time must be converted into length by multiplying with the speedand every data set must be re-sampled to the same number of samples. The decision method isthen based on a decision tree which can be seen in Figure 5.7. A number of thresholds, bi, arechosen which are related to signature length, signature magnitude and skewness. The thresholdscan be chosen at design time or more intelligently by training the sensor. The thresholds are thenused in a greedy best-first search in the tree seen in Figure 5.7.

    If the sensors are placed in the center of the lane the signatures will be very different comparedto when the sensors are placed at the side of the road. They will show more distinct features andby using a basic thresholding algorithm, we can classify them using a tree in the same way asabove. We will receive a pattern consisting of ±1 that will have different lengths depending on thevehicle. If we instead of the thresholds bi use a single threshold we can define this pattern. Nowwe proceed in the same manner as before using the decision tree in Figure 5.7. The bit patterncan be defined as

    c(n) =

    +1 x(nTs) ≥ c+−1 x(nTs) < c−0 otherwise,

    (5.17)

    where x(nTs) is our sampled signal. The bit pattern can be compared to a database somewherein the network and the closest match determines the vehicle class. An example can be seen inFigure 5.6.

    5.6.2 Hill patterns

    Another way of finding a pattern like the one described in the previous section is to use hillpatterns. These are found exactly in the same way as the pattern above, but using the time

    30

  • 5.6. Classification

    derivative of the signature. This method has the benefit that we do not need to place the sensor inthe middle of the lane but rather at the side of the road. Noise will be an issue with this method,and therefore the signal will need filtering.

    The hill pattern is defined [10] as

    d(n) =x(nTs) − x([n − 1]Ts)

    Ts, n ∈ Z (5.18)

    d(n) =

    +1 d(n) ≥ d+−1 d(n) < d−0 otherwise,

    (5.19)

    where d+ and d− are the thresholds, positive and negative respectively. Normally they are chosenso that d+ = −d−.

    5.6.3 Transforms

    Algorithms based on on discrete Fourier transform, DFT, and Karhunen-Loève transform, KLT,are proposed in [24]. In Appendix A we can find the Fast Fourier Transform, FFT, of the vehiclesignatures in each axis. The sensor was placed at the side of the road. We can see that thesignatures contain a very different frequency content, and therefore classification could be doneusing FFT.

    5.6.4 Bins

    If we do the normalisation and re-sampling as in earlier methods, we can divide the signature intobins. Two examples can be seen in Figures 5.8a and 5.8b. We take the mean of the magnitudes ina number of time slots and so we have produced a vector that can be compared with a database.The number of time slots are the same for all vehicles, but the length of each time slot might bedifferent. The length of a signature is an important parameter, and therefore it is necessary tomeasure that parameter in some way. One way could be to always “record” the same signaturelength, or pad with zeros after the vehicle has passed. Of course we could compare the signatureitself with the database entry, but this would require the whole signature to be sent over the WSN,which would perhaps not be effective.

    5.6.5 Least-squares estimation

    Using least squares analysis we seek to minimise (5.20) in order to find the parameters of themagnetic model. This method although very good requires extreme computational power.

    S =n∑

    i

    (yi − f(ti,a))2 , (5.20)

    where yi is the measured data, f(ti,a) is the output from our model described in Chapter 4 and ais a vector containing the parameters we want to estimate. ti is the time samples, n is the numberof samples we have.

    31

  • The parameters estimated are

    µi = [µx,i µy,i µz,i ] (5.21)

    ri = [xi yi zi ] , (5.22)

    and also the speed v. It is assumed that the magnetic moments will lie on a straight line, elim-inating two degrees of freedom. The vehicle is assumed to be travelling a path perpendicularto the sensor. Three magnetic moments each with four degrees of freedom will have a total oftwelve degrees of freedom. Placing one of the magnetic moments in the origin of the vehicle coor-dinate system will eliminate another degree of freedom. Since the vehicle coordinate system willmove, we can add the speed v as another parameter. In all, twelve parameters are estimated frommeasurements.

    5.7 Queue Detection

    A queue is a number of vehicles that travel slowly close together. This tells us that we can definea function q(v, d) ≥ 0 where v is the average velocity, and d is the mean distance between vehicles.We can then set a threshold for a function q(v, d) ∈ {0, 1} below which we have a queue. A valueof 0 means that there are no vehicles on the road, a value of 1 means that the road is completelyfilled with still-standing vehicles. The mean speed and distance between vehicles can be found indifferent ways. We can also just see how often the sensor is “occupied”. A high occupancy meansa large number of vehicles, or few slow moving vehicle. We also note that if we are interestedin minimising the number of “catching-up accidents”, just one vehicle is enough to make a verydangerous situation, and therefore it is enough to detect one slow-moving or parked vehicle.

    In a queue detection system the nodes need to be complemented by a warning unit. A number ofthese are presented in Appendix D including a flashing unit from Amparo SeeMeTM.

    No performance analysis will be done for queue detection since velocity estimation forms the basisfor queue detection. However, if queue detection will be used the threshold for the q(v, d) functionneeds to be trimmed in so that we are not sending a warning too often, or too seldom.

    32

  • 5.7. Queue Detection

    Figure 5.1: System overview. Road surface with cars and buses. SNs are placed in pairs to estimatespeed. Note the in-lane sensors and the roadside sensors. APs send the information to the backbone.

    33

  • Figure 5.2: Offset depending on temperature

    Vehicle travelling in forward direction

    Time [s]

    Magnet

    icfiel

    dst

    rength

    [nT

    ]

    −0.2 −0.15 −0.1 −0.05 0 0.05 0.1 0.15 0.2

    −500

    −400

    −300

    −200

    −100

    0

    100

    200

    300

    400

    500

    Figure 5.3: Direction finding using one sensor. Vehicle travel-ling in forward direction. If the vehicle backs up, the signaturelooks like a mirror image. Note that the signature depends onthe sensor position.

    Figure 5.4: Parameters for speed estimation. Up time is thearrival time of the vehicle. Off time is the departure time. Ontime is the difference between the two first.

    34

  • 5.7. Queue Detection

    Ts

    A

    t

    Figure 5.5a: Synchronisation pulse. Thisis the pulse that we are looking for using thematched filter.

    τ τ + Ts

    A

    t

    Figure 5.5b: Measured data. This is basicallya delayed version of the first signal.

    τ + Ts

    A2Ts

    Figure 5.5c: Convolution between the signals.The peak will be located at Ts + τ .

    Magnetic

    Fie

    ld S

    trength

    Hill Pattern

    Threshold

    Curre

    nt Time

    Time

    Figure 5.6: Sensor data and pattern.

    35

  • 5

    Figure 5.7: Decision tree for classification into seven types of vehicles [24].

    Magnet

    icFie

    ldStr

    ength

    [nT

    ]

    [bar]

    Average Bar - ŷ-axis

    2 4 6 8 10 12 14 16 18 20−600

    −400

    −200

    0

    200

    400

    600

    800

    Figure 5.8a: Average bar - y-axis.

    Magnet

    icFie

    ldStr

    ength

    [nT

    ]

    [bar]

    Average Bar - ẑ-axis

    2 4 6 8 10 12 14 16 18 200

    500

    1000

    1500

    2000

    2500

    3000

    3500

    4000

    Figure 5.8b: Average bar - z-axis.

    36

  • 6. Performance analysis

    Chapter 6

    Performance analysis

    6.1 Sensor placement

    6.1.1 Translation

    The general rule about sensor placement is that the closer the sensors are to each other, themore accurate the placing has to be. For example at the desired inter-sensor distance 2 m, amisplacement of 5 cm yields a 2.5 % error in velocity. At the desired inter-sensor distance 0.2 m,a misplacement of 5 mm yields the same error. Since it is complex to sample too often, and byonly considering sensor placement, the nodes in a sensor pair should be placed as far from eachother as possible.

    6.1.2 Rotation

    When placing the sensor it is important that the axes point in the correct directions. However itis easy to accidentally rotate the sensor. The effect of rotating the sensor in the yaw (ẑ) and pitch(ŷ) axes can be seen in Figures 6.1a and 6.1b. If the rotation is known the software could easilycorrect for this.

    6.2 Detection

    In the simulator a number of potential problems have been identified. If two vehicles are travellingclose to each other, especially if they are large, the signal will be indistinguishable from a singlevery long vehicle. This can be combated by placing the sensor as close to the vehicles as possible.Similarly, a vehicle in an adjacent lane will disturb our signal. This is remedied by choosing thethreshold value wisely. Some vehicles such as motorcycles and some small cars will not produce asignal with high enough magnitude. Placing the sensor closer to the vehicle will help, more sensorswill ensure that the vehicle pass at least one sensor.

    In the real-life tests performed, we detected 100 % of normal-sized vehicles. The vehicles not

    37

  • Magnet

    icfiel

    dst

    rength

    [nT

    ]

    Time [s]

    Magnetic field strength for different sensor yaw angle.

    α = 0◦α = 30◦α = 60◦α = 90◦

    -0.5 0 0.5-60

    -40

    -20

    0

    20

    40

    Figure 6.1a: Effect of sensor node rotation.The sensor is rotated around its yaw axis andthe effect on the x̂-axis can be seen.

    Magnet

    icfiel

    dst

    rength

    [nT

    ]

    Time [s]

    Magnetic field strength for different sensor pitch angle.

    β = 0◦β = 30◦β = 60◦β = 90◦

    -0.5 0 0.5-100

    -50

    0

    50

    100

    Figure 6.1b: Effect of sensor node rotation.The sensor is rotated around its pitch axis andthe effect on the ẑ-axis can be seen.

    detected were bicycles and a very small motorcycle. The signature from each vehicle was clearlyvisible, and could be both seen by eye or by a simple counting algorithm. The simulations displayedvery similar vehicle signatures, but not all vehicles were detected due to the minimum distancebetween vehicles set in the simulator. In the real life test there were no vehicles travelling bumper