# Performance Evaluation of Magnetic Wireless Sensor Networks Algorithm for Traffic Flow Monitoring in Chaotic Cities

Authors: Haji Said Fimbombaya; Nerey H. Mvungi; Ndyetabura Y. Hamisi; Hashimu U. Iddi
Journal: Modelling and Simulation in Engineering
 (2018)

---

## Abstract

Traffic flow monitoring involves the capturing and dissemination of real-time traffic flow information for a road network. When a vehicle, a ferromagnetic object, travels along a road, it disturbs the ambient Earth’s magnetic field, causing its distortion. The resulting distortion carries vehicle signature containing traffic flow related information such as speed, count, direction, and classification. To extract such information in chaotic cities, a novel algorithm based on the resulting magnetic field distortion was developed using nonintrusive sensor localization. The algorithm extracts traffic flow information from resulting magnetic field distortions sensed by magnetic wireless sensor nodes located on the sides of the road. The model magnetic wireless sensor networks algorithm for local Earth’s magnetic field performance was evaluated through simulation using Dar es Salaam City traffic flow conditions. Simulation results for vehicular detection and count showed 93% and 87% success rates during normal and congested traffic states, respectively. Travel Time Index (TTI) was used as a congestion indicator, where different levels of congestion were evaluated depending on the traffic state with a performance of 87% and 88% success rates during normal and congested traffic flow, respectively.


---

## Body

## 1. Introduction

Magnetic-based wireless sensor networks (WSN) offer installation and implementation costs flexibility advantage when used to monitor traffic flow in cities with chaotic traffic mostly in developing countries [1]. However, the major constraint is powering the sensors [2] which require an independent source away from the main power supply. Other challenges include cost and technological limitation [3, 4]. A vehicle detection wireless sensor node has four main components, namely, a sensor to sense physical signals modified by vehicles passing, a processor to process the sensed data, a communication unit to transfer the processed data to the base station for further processing, and an energy source [5, 6]. Conventional vehicle detection technologies, such as inductive loop detectors, are not preferable for large-scale deployment in developing country cities with chaotic traffic because they are intrusive and disruptive to traffic and have high installation and maintenance costs [5]. The advancement in microelectronics and MEMS technologies [7] provides an alternative solution where a single board wireless sensor node can be assembled combining all the necessary components with energy harvesting capability. This alternative can lower installation and maintenance costs when sensor nodes are located on the roadside, powered by a renewable energy source, and operated with energy-efficiency algorithms. Due to easy availability, installation, and maintenance of magnetic WSN, they can be installed all over the city road networks to perform traffic flow monitoring and management [8]. Therefore, a wireless sensor node processes the sensed data locally and sends traffic flow information to the base station hence optimizing bandwidth requirement [9, 10].Most signal processing algorithms used for traffic flow monitoring in magnetic WSN were designed for developed countries traffic conditions where sensor nodes are buried under the road surface [11]. Developing countries face many challenges to implementing such systems. We observed that mostly in developing countries traffic monitoring systems should be cost-effective to realize and maintain. It is a big challenge to implement the sensor buried under the road surface due to economical and maintenance factors. The alternative and effective implementation strategy are to localize the magnetic wireless sensor nodes on the roadside, thus creating a new challenge in developing an effective algorithm for detection and extraction of traffic flow information.This research deployed a newly developed wireless sensor node called KiliNode depicted in Figures1 and 2. KiliNode is built based on the PIC24FJ128GC006 microcontroller which has a number of features suitable for high signal processing in energy efficient environment such as high-performance CPU:(i)
17 bit × 17 bit single-cycle hardware fractional/integer multiplier(ii)
32 bit by 16 bit hardware divider(iii)
16 × 16 bit working register arrayFigure 1
KiliNode top view showing various hardware components.Figure 2
KiliNode back view showing the hardware interfacing, programming, and power interfacing ports.KiliNode integrated with HMC1052 AMR magnetometer from Honeywell has two-axis high sensitivity and is reliable for low field sensing which had the following characteristics:(i)
sensitivity 1 mV/V/gauss(ii)
resolution 120 nT(iii)
maximum current consumption 0.5 A(iv)
low voltage supply 1.8 V(v)
set/reset strap current 0.5 A


## 2. Related Works

Most signal processing algorithms based on magnetic field for vehicular traffic detection are deployed on sensor nodes buried under the road. The adaptive threshold detection algorithm (ATDA) is an efficient vehicle detection algorithm with high precision of 97%, but its classification scheme is not efficient having a low performance where the overall recognition rate is below 60% [12]. Its implementation depends mostly on sensors buried under the road surface to monitor single lane individually, which is demanding for multilane and chaotic environments. This drawback will be similar to all other intrusive algorithms based on ATDA such as magnetic sensors-based vehicle classification algorithm (MVSCA) [13, 14].Earth magnetic fields depend on geographical location. The field strength differs from the North poles to the Equator. On the poles, the field is about 50,000 nT, and on the Equator, it is about 30,000 nT. Most detection algorithms using magnetic field were conducted in America and Europe with stronger Earth magnetic fields compared to East Africa which lies near the Equator with a less strong field. Therefore, the vehicular magnetic anomaly detection requires high-resolution sensors and alternative signal processing algorithms to extract desired traffic flow information.


## 3. Theoretical Model Formation

This work assumes that magnetic wireless sensor nodes are installed on the sides of the road, above the ground for traffic flow monitoring. When a vehicle travels along a road, it disturbs local ambient Earth’s magnetic field causing changes in its direction and strength. Magnetic wireless sensor node senses both Earth’s magnetic field and magnetic distortions due to vehicular ferromagnetic contents. The wireless sensor node is integrated with three axes anisotropic magnetoresistance (AMR) sensor [15] which is installed at Cartesian coordinates xo,yo,z relative to the origin xo,yo,zo at the ground as depicted in Figure 3. A road link is located at Cartesian coordinates xo,y,zo perpendicular to the origin xo,yo,zo. The vehicle at an instant location x,y,zo is moving along the road with speed v. Magnetic wireless sensor node x-direction is aligned parallel with the road making an angle φ with Earth’s magnetic north Xe on the horizontal x-y plane. Sensor node y-direction is aligned perpendicularly to the road link in the horizontal x-y plane. Sensor node z-direction is aligned parallel with Earth’s magnetic downward component Ze in a vertical z-y plane. Vehicular magnetic moment m induced by total Earth’s magnetic field Be [16] has the same direction as inducing field.Figure 3
Model formation showing wireless sensor node location with respect to the origin, total Earth’s magnetic field and its components, wireless sensor node and its directions, road link, and a moving vehicle.The magnetic moment of any ferromagnetic object is caused by induced and permanent magnetization [17]. This research assumes that vehicles can be modelled as a dipole moment, which is influenced by only induced magnetization due to its soft-iron composition [15]. Each ferromagnetic part of a vehicle has its own induced moment based on the inducing field. The total magnetic moment of a vehicle is the vector sum of individual ferromagnetic part moments based on the inducing total Earth magnetic field Be. Therefore, the total induced vehicular magnetic moment m is given by Equation (1). The shortest proximity distance r between the wireless sensor node xo,yo,z and vehicular current location at coordinate x,y,zo is given by Equation (2):(1)m=∑i=1Nmi=∑i=1NkiViBe,(2)r=x−xo2+y−yo2+z−zo21/2,where N is the total number of ferromagnetic parts within a vehicle, mi is the vehicle’s ferromagnetic part moment, ki is the vehicle’s ferromagnetic part volumetric susceptibility constant, Vi is the vehicle’s ferromagnetic part volume, and Be is the total Earth’s magnetic field. The vehicle is travelling along a straight line (road) near an observation spot (magnetic wireless sensor node). Therefore, y and z can be treated as constant distances measured during wireless sensor node installation, and x varies as the vehicle moves.The vehicle can be considered as a dipole model if its total length is very small compared to a distance between its centre and observation spot. Basic expression for establishing the maximum amplitude of an anomaly due to the magnetization [17] is given by(3)T=mrn,where T is the magnetic anomaly in nanotesla (nT), m is the target magnetic moment in Ampere-meter2 (Am2), r is distance between observation spot and dipole in meters (m), and n is a measure of the rate of decay with distance or fall-off rate (n=3 for dipole; n=2 for monopole).The total magnetic anomaly of a dipole (vehicle)Ba at distance r from the vehicle to the observation spot (wireless sensor node) based on Equation (3) is given by the following equation:(4)Ba=2mr3,where Ba is the total magnetic anomaly (vehicular target) due to magnetization, m is the vehicular magnetic moment, and r is a proximity distance between a vehicle and wireless sensor node.The dipole (vehicular target) magnetic anomalyBa can be resolved into two components in spherical coordinates at any distance r from the centre of a dipole with magnetic moment m on a radius that makes an angle θ to the dipole axis [17, 18]. As depicted in Figure 4, the magnetic anomaly Ba has radial component Br and tangential component Bθ given in the following equation:(5)Br=2mr3cosθ,Bθ=mr3sinθ.Figure 4
Model formation showing tangentialBθ and radial Br components of the induced vehicular magnetic anomaly at r distance from the vehicle’s current position.α is an angle between vehicle instant position on the road and y-axis. When a vehicle is moving, α changes depending on the current position and direction. When α=0, r is the shortest proximity distance between a vehicle and the wireless sensor node. θ is the angle between vehicle current position in the x-y plane and r.The two anomaly magnetic componentsBr and Bθ are resolved into the horizontal component Ha and the vertical component Za [19] as shown in Equations (6) and (7), respectively. In this case, the vehicle is moving along the road at a distance r away from the wireless sensor node:(6)Ha=−Bθcosθ−Brsinθ,Ha=−3mr3sinθcosθ,(7)Za=Brcosθ−Bθsinθ,Za=mr33cos2θ−1.Model formation established the localization of the magnetic wireless sensor node on the roadside for traffic flow monitoring. When a vehicle travels along a road, it disturbs local ambient Earth’s magnetic fields, causing its anomaly scattering in all directions [16]. The anomaly reaches the magnetic wireless sensor node and then senses and processes to extract vehicular signature and traffic flow information. However, locating the magnetic wireless sensor node on the roadside causes an increase in the proximity distance to the vehicle target resulting in the dipole anomaly field to weaken. Therefore, the wireless magnet sensor node with high resolution will give an added advantage when selected for traffic flow monitoring. Model formation showed how to extract magnet anomaly components in the horizontal and vertical directions. These fields are essentials in magnetic signal models for traffic flow monitoring.


## 4. Magnetic Signal Models

The construction of vehicular magnetic signalsBax, Bay, and Baz at the respective direction of the wireless sensor node is presented. The signals are the functions of space and time. Figure 5 shows the summary of all the magnetic field components and their directions in a horizontal x-y plane and vertical z-y plane, respectively. Figure 5(a) shows horizontal x-y plane magnetic fields; Earth’s magnetic North Xe, East Ye, and horizontal He are components of total Earth’s Magnetic field Be. D is the declination angle between Xe and He. Wireless sensor node horizontal plane (Bax−Bay) is aligned at an angle φ with Earth’s magnetic plane (Xe−Ye). Vehicular magnetic anomaly horizontal component Ha is at an angle α with sensor node East Bay. Figure 5(b) shows vertical z-y plane magnetic fields; total Earth’s magnetic field Be is at an angle I with the horizontal plane x-y. Earth’s magnetic downward component Ze is a vertical component of Be. Baz is a wireless sensor node downward component in a vertical plane x-y. Za is a vertical component of the vehicular magnetic anomaly. These fields are the basis of magnetic signal models to be sensed by the wireless sensor node for further processing and extraction of traffic flow information of the designated road network.Figure 5
(a) Horizontalx-y plane magnetic fields; (b) vertical z-y plane magnetic fields.
(a)
(b)


### 4.1. Anomalous SignalBax

Total magnetic signal observable at the magnetometer in thex-direction is composed of two magnetic field components: total Earth’s field horizontal component He and horizontal vehicular anomaly Ha. Both were aligned to the wireless sensor node North, given by(8)Bax=HecosD−φ+Hasinα+w,(9)Bax=HecosD−φ−3mr3sinθcosθsinα+w,where Bax, r, θ, and α are functions of time and space; D and He are the angles of declination and the horizontal component of total Earth’s field Be, respectively; and φ is the angle between magnetic north Xe and magnetometer north. This angle is measured during wireless sensor node installation. w is a noise due to different environmental sources. According to research, the noise influencing the magnetometer is regarded as White Gaussian Noise, that is normally distributed [20]. The magnetic anomalous signal Bax in Equation (9) depends on vehicular moment m and sensor location relative to the moving vehicle.


### 4.2. Anomalous SignalBay

Total magnetic signal observable at the magnetometer in they-direction is composed of two magnetic field components: total Earth’s field horizontal component He and horizontal vehicular anomaly Ha. Both were aligned to the wireless sensor node East, given by(10)Bay=HesinD−φ+Hacosα+w,(11)Bay=HesinD−φ−3mr3sinθcosθcosα+w.where Bay, r, θ, and α are functions of time and space; D and He are the angles of declination and the horizontal component of total Earth’s field Be, respectively; φ is the angle between magnetic Earth’s North Xe and magnetometer’s North Bax; and magnetic anomalous signal Bay in Equation (11) sensed by the magnetometer depends on vehicular moment m and sensor location relative to the moving vehicle r.


### 4.3. Anomalous SignalBaz

Total magnetic signal observable at the magnetometer in thez-direction is composed of two magnetic field components: total Earth’s field downward component Ze and vertical vehicular magnetic anomaly Za. Both signals have the same downward direction as Baz. The magnetic anomalous Baz is given as follows:(12)Baz=BesinI+Za+w,(13)Baz=BesinI+mr33cos2θ−1+w,where Baz, r, and θ are functions of time and space; I and Be are the angle of inclination and total Earth’s magnetic field; and magnetic anomalous signal Baz Equation (13), sensed by a magnetometer, depends on vehicular moment m and magnetometer location relative to the moving vehicle.


### 4.4. Anomalous Signal Graphs

Considering traffic monitoring in Dar es Salaam City located at latitude −6.8° and longitude 39.1°, the total Earth magnetic field at this geographical location is approximately 33,125 nT [21]. The magnetic sensor node (KiliNode) is located at z = 3 m above the ground and y = 5 m from the road. Assume sensor observability is between x = −30 m and 30 m. A small car such as the Toyota Vitz moves along the road (x-axis). The magnetic susceptibility of a ferromagnetic parts content of a car is quite high, ≈ 1000 [22]. Assume the wireless sensor node and road are aligned to the Earth magnetic North direction (φ=00). Figure 6 depicts magnetic anomalous field plots using Matlab; Figure 6(a) shows magnetic anomalous field Bax sensed by the magnetic wireless sensor node in the x-direction and plotted against the vehicle position x. Figure 6(b) shows magnetic anomalous field Bay sensed by the magnetic wireless sensor node in the y-direction and plotted against the vehicle position x. Figure 6(c) shows magnetic anomalous field Baz sensed by the magnetic wireless sensor node in the z-direction and plotted against the vehicle position x.Figure 6
(a)Bax, (b) Bay, and (c) Baz present in vehicular magnetic anomalous fields in x, y, and z directions.
(a)
(b)
(c)


## 4.1. Anomalous SignalBax

Total magnetic signal observable at the magnetometer in thex-direction is composed of two magnetic field components: total Earth’s field horizontal component He and horizontal vehicular anomaly Ha. Both were aligned to the wireless sensor node North, given by(8)Bax=HecosD−φ+Hasinα+w,(9)Bax=HecosD−φ−3mr3sinθcosθsinα+w,where Bax, r, θ, and α are functions of time and space; D and He are the angles of declination and the horizontal component of total Earth’s field Be, respectively; and φ is the angle between magnetic north Xe and magnetometer north. This angle is measured during wireless sensor node installation. w is a noise due to different environmental sources. According to research, the noise influencing the magnetometer is regarded as White Gaussian Noise, that is normally distributed [20]. The magnetic anomalous signal Bax in Equation (9) depends on vehicular moment m and sensor location relative to the moving vehicle.


## 4.2. Anomalous SignalBay

Total magnetic signal observable at the magnetometer in they-direction is composed of two magnetic field components: total Earth’s field horizontal component He and horizontal vehicular anomaly Ha. Both were aligned to the wireless sensor node East, given by(10)Bay=HesinD−φ+Hacosα+w,(11)Bay=HesinD−φ−3mr3sinθcosθcosα+w.where Bay, r, θ, and α are functions of time and space; D and He are the angles of declination and the horizontal component of total Earth’s field Be, respectively; φ is the angle between magnetic Earth’s North Xe and magnetometer’s North Bax; and magnetic anomalous signal Bay in Equation (11) sensed by the magnetometer depends on vehicular moment m and sensor location relative to the moving vehicle r.


## 4.3. Anomalous SignalBaz

Total magnetic signal observable at the magnetometer in thez-direction is composed of two magnetic field components: total Earth’s field downward component Ze and vertical vehicular magnetic anomaly Za. Both signals have the same downward direction as Baz. The magnetic anomalous Baz is given as follows:(12)Baz=BesinI+Za+w,(13)Baz=BesinI+mr33cos2θ−1+w,where Baz, r, and θ are functions of time and space; I and Be are the angle of inclination and total Earth’s magnetic field; and magnetic anomalous signal Baz Equation (13), sensed by a magnetometer, depends on vehicular moment m and magnetometer location relative to the moving vehicle.


## 4.4. Anomalous Signal Graphs

Considering traffic monitoring in Dar es Salaam City located at latitude −6.8° and longitude 39.1°, the total Earth magnetic field at this geographical location is approximately 33,125 nT [21]. The magnetic sensor node (KiliNode) is located at z = 3 m above the ground and y = 5 m from the road. Assume sensor observability is between x = −30 m and 30 m. A small car such as the Toyota Vitz moves along the road (x-axis). The magnetic susceptibility of a ferromagnetic parts content of a car is quite high, ≈ 1000 [22]. Assume the wireless sensor node and road are aligned to the Earth magnetic North direction (φ=00). Figure 6 depicts magnetic anomalous field plots using Matlab; Figure 6(a) shows magnetic anomalous field Bax sensed by the magnetic wireless sensor node in the x-direction and plotted against the vehicle position x. Figure 6(b) shows magnetic anomalous field Bay sensed by the magnetic wireless sensor node in the y-direction and plotted against the vehicle position x. Figure 6(c) shows magnetic anomalous field Baz sensed by the magnetic wireless sensor node in the z-direction and plotted against the vehicle position x.Figure 6
(a)Bax, (b) Bay, and (c) Baz present in vehicular magnetic anomalous fields in x, y, and z directions.
(a)
(b)
(c)


## 5. Proposed Signal Processing Algorithm

Scanning and decision algorithm (SDA) is a novel energy efficient, time-domain signal processing algorithm for vehicular detection and extraction of traffic flow information such as count, speed, and Travel Time Index (TTI) based on three axes magnetic WSNs located noninvasive on sides of the road. This algorithm is a combination of mathematical and logical operations on the observed magnetic signal to extract output traffic flow information.


### 5.1. Algorithm Development

The magnetic anomalous signalsBax, Bay, and Baz are sensed by the wireless sensor node in x, y, and z-direction, respectively, are sent into the system through the A/D converter block as depicted in Figure 7. The anomalous signal magnitudes are then converted to digital xn,yn,andzn signal, respectively. From the A/D converter, the digital signals are then sent into the difference equation (moving average filter) and adaptive baseline blocks. The content of the input signal xn could be either baseline x^n or anomalous xn. When the magnetometer senses Earth magnetic field without any moving vehicle, the signal captured is referred to as baseline, while when sensing Earth magnetic field together with the moving object the captured signal is referred to as anomalous. Adaptive baseline block is controlled by the error signal en to identify whether the input signal is anomalous or baseline using logical operations:Ifexn=0, then x^n=xn,Ifeyn=0, then y^n=yn,Ifezn=0, then z^n=zn,Figure 7
Block diagram of the SDA algorithm for magnetic WSNs showing data inputs, processes, and the outputs.Baseline signals are updated and stored to be used by the difference equation block. Earth magnetic fields are not constant over a period of time. It is influenced by small fluctuation due to factors such as noise, magnetic storms, or temperature drift [21, 23]. Therefore, the baseline signals are updated periodically by repeating the logical operations at some fixed intervals of time.Difference equation filters in Equations (14)–(16) are used to extract the error signal en from anomalous and baseline signals:(14)exn=xn−x^n,(15)eyn=yn−y^n,(16)ezn=zn−z^n,where n is the sample size; exn,eyn, and ezn are the error signals; andxn, yn, and zn are the anomalous signals sensed when vehicles are moving near the wireless sensor node. x^n, y^n, and z^n are baseline signals sensed when no vehicle is moving near the wireless sensor node.The square decimator⋅2 block [5] is used to calculate the signal energy Ey in Equation (17) and Ez in Equation (18) from the error signals ey and ez and then put into the SDA blocks. Signal ex is used to deduce the vehicular direction, and therefore, it is not necessary to calculate its energy:(17)Eyn=eyn2,(18)Ezn=ezn2.SDA logic has two blocks depicted in Figure7: “SDA-scanning” and ”SDA-decision.” When the energy signal enters the SDA-scanning block, it is sliced into small segments xk, yk, and zk. Their width Ts depends on the sampling frequency of the wireless sensor node fs. Each segment contains traffic flow raw data that will be used for further operations within SDA-decision block to extract vehicular traffic flow information.


### 5.2. SDA Finite State Machine

This section presents SDA state machine for calculating vehicle counts, speed, and TTI by using only a single energy signalEyn. However, both energy signal Eyn and Ezn can be used for the same operation for high precision results.


#### 5.2.1. Vehicular Detection, Count, and Average Speed

In the scanning state as depicted in Figure8, the signal segment yk is tested whether it is anomalous by comparing the transition condition yk>0. If the transition is true, the detection is made by updating the detection flag dw, where w is the current window. Otherwise, the operation will proceed to the decision state either Decision_1 or Decision_2 depending on the current w value. In the decision state, there are three options in each depending on the transition condition: either Decision_11, Decision_12, Decision_13 or Decision_21, Decision_22, Decision_23. The Decision_11 or Decision_21 states are used to update vehicular count variable C and increment period (Ts) counter j. The Decision_12 or Decision_22 is used to calculate total observation time t, average speed varg, and Travel Time Index TTI. Decision_13 or Decision_23 states are used to increment period (Ts) counter j. Finally, the Init_12 or Init_22 states are used to update local variables before completing and exiting the cycle. Vehicular speeds were calculated based on a single sensor node:(19)vt=Lt,(20)vavgt=1N∑i=1Nvit,where vt is the vehicle speed, vavgt is the average vehicle speed for N vehicles, L is the estimated vehicle length, and t is the vehicle observation time by the wireless sensor node.Figure 8
SDA finite state machine diagram for calculating vehicular count, speed, and TTI.The main inputs into the algorithm are magnetic signals (Bax, Bay, and Baz) and the constant free flow speed vff. The main outputs are vehicle count C and TTI.


#### 5.2.2. Congestion State

Traffic congestion can be described as the condition that occurs when the traffic flow demand exceeds by far the infrastructure supply resulting in long queues, travel delays, and increased travel costs [24]. Expressing the congestion state of a road segment is one of the key aspects of traffic flow monitoring. Many research works were conducted to study the congestion behaviour and formation. The challenges still remain due to the nonlinearity nature of congestion formation [24]. Selection of congestion metric is paramount; how do we measure the congestion state of a road network or city? This work adopted a congestion metric called TTI, proposed by Schrank and Lomax [25], which is a ratio of travel time in the peak period to travel time at free-flow conditions while accounting for both recurring and incident delays such as traffic accident. It determines how long it takes to travel during a peak hour and uses both main and arterial travel rates. This index has the advantage of expressing traffic congestion in terms of space and time, given by the following equation:(21)TTI=ttff=vffvarg,where TTI is the Travel Time Index, t is the average peak period travel time, tff is the free-flow travel time, vff is the free-flow travel speed, and varg is the average peak period travel speed. TTI of 1.35 indicates a 20-minute free-flow trip takes 27 minutes at the peak. Note that free-flow speed of 50 km/h at arterial roads in Dar es Salaam is used in this study.TheTTI can be understood by relating the value to a percentage. If the TTI is 1, then the average travel time is the same as the free flow travel time, meaning there is no delay. If the TTI is 1.5, then the actual travel time is 150% of the free flow time, or it takes 1.5 times longer to travel a road segment than it would under uncongested conditions. For this analysis, it was assumed that the TTI cannot be less than 1, which occurs when the average speed is greater than vff. TTI requires only two parameters on its calculation as shown by Equation (21) Therefore, the TTI computation is simple and suitable for deployment in the wireless sensor networks in an energy efficient environment.


## 5.1. Algorithm Development

The magnetic anomalous signalsBax, Bay, and Baz are sensed by the wireless sensor node in x, y, and z-direction, respectively, are sent into the system through the A/D converter block as depicted in Figure 7. The anomalous signal magnitudes are then converted to digital xn,yn,andzn signal, respectively. From the A/D converter, the digital signals are then sent into the difference equation (moving average filter) and adaptive baseline blocks. The content of the input signal xn could be either baseline x^n or anomalous xn. When the magnetometer senses Earth magnetic field without any moving vehicle, the signal captured is referred to as baseline, while when sensing Earth magnetic field together with the moving object the captured signal is referred to as anomalous. Adaptive baseline block is controlled by the error signal en to identify whether the input signal is anomalous or baseline using logical operations:Ifexn=0, then x^n=xn,Ifeyn=0, then y^n=yn,Ifezn=0, then z^n=zn,Figure 7
Block diagram of the SDA algorithm for magnetic WSNs showing data inputs, processes, and the outputs.Baseline signals are updated and stored to be used by the difference equation block. Earth magnetic fields are not constant over a period of time. It is influenced by small fluctuation due to factors such as noise, magnetic storms, or temperature drift [21, 23]. Therefore, the baseline signals are updated periodically by repeating the logical operations at some fixed intervals of time.Difference equation filters in Equations (14)–(16) are used to extract the error signal en from anomalous and baseline signals:(14)exn=xn−x^n,(15)eyn=yn−y^n,(16)ezn=zn−z^n,where n is the sample size; exn,eyn, and ezn are the error signals; andxn, yn, and zn are the anomalous signals sensed when vehicles are moving near the wireless sensor node. x^n, y^n, and z^n are baseline signals sensed when no vehicle is moving near the wireless sensor node.The square decimator⋅2 block [5] is used to calculate the signal energy Ey in Equation (17) and Ez in Equation (18) from the error signals ey and ez and then put into the SDA blocks. Signal ex is used to deduce the vehicular direction, and therefore, it is not necessary to calculate its energy:(17)Eyn=eyn2,(18)Ezn=ezn2.SDA logic has two blocks depicted in Figure7: “SDA-scanning” and ”SDA-decision.” When the energy signal enters the SDA-scanning block, it is sliced into small segments xk, yk, and zk. Their width Ts depends on the sampling frequency of the wireless sensor node fs. Each segment contains traffic flow raw data that will be used for further operations within SDA-decision block to extract vehicular traffic flow information.


## 5.2. SDA Finite State Machine

This section presents SDA state machine for calculating vehicle counts, speed, and TTI by using only a single energy signalEyn. However, both energy signal Eyn and Ezn can be used for the same operation for high precision results.


### 5.2.1. Vehicular Detection, Count, and Average Speed

In the scanning state as depicted in Figure8, the signal segment yk is tested whether it is anomalous by comparing the transition condition yk>0. If the transition is true, the detection is made by updating the detection flag dw, where w is the current window. Otherwise, the operation will proceed to the decision state either Decision_1 or Decision_2 depending on the current w value. In the decision state, there are three options in each depending on the transition condition: either Decision_11, Decision_12, Decision_13 or Decision_21, Decision_22, Decision_23. The Decision_11 or Decision_21 states are used to update vehicular count variable C and increment period (Ts) counter j. The Decision_12 or Decision_22 is used to calculate total observation time t, average speed varg, and Travel Time Index TTI. Decision_13 or Decision_23 states are used to increment period (Ts) counter j. Finally, the Init_12 or Init_22 states are used to update local variables before completing and exiting the cycle. Vehicular speeds were calculated based on a single sensor node:(19)vt=Lt,(20)vavgt=1N∑i=1Nvit,where vt is the vehicle speed, vavgt is the average vehicle speed for N vehicles, L is the estimated vehicle length, and t is the vehicle observation time by the wireless sensor node.Figure 8
SDA finite state machine diagram for calculating vehicular count, speed, and TTI.The main inputs into the algorithm are magnetic signals (Bax, Bay, and Baz) and the constant free flow speed vff. The main outputs are vehicle count C and TTI.


### 5.2.2. Congestion State

Traffic congestion can be described as the condition that occurs when the traffic flow demand exceeds by far the infrastructure supply resulting in long queues, travel delays, and increased travel costs [24]. Expressing the congestion state of a road segment is one of the key aspects of traffic flow monitoring. Many research works were conducted to study the congestion behaviour and formation. The challenges still remain due to the nonlinearity nature of congestion formation [24]. Selection of congestion metric is paramount; how do we measure the congestion state of a road network or city? This work adopted a congestion metric called TTI, proposed by Schrank and Lomax [25], which is a ratio of travel time in the peak period to travel time at free-flow conditions while accounting for both recurring and incident delays such as traffic accident. It determines how long it takes to travel during a peak hour and uses both main and arterial travel rates. This index has the advantage of expressing traffic congestion in terms of space and time, given by the following equation:(21)TTI=ttff=vffvarg,where TTI is the Travel Time Index, t is the average peak period travel time, tff is the free-flow travel time, vff is the free-flow travel speed, and varg is the average peak period travel speed. TTI of 1.35 indicates a 20-minute free-flow trip takes 27 minutes at the peak. Note that free-flow speed of 50 km/h at arterial roads in Dar es Salaam is used in this study.TheTTI can be understood by relating the value to a percentage. If the TTI is 1, then the average travel time is the same as the free flow travel time, meaning there is no delay. If the TTI is 1.5, then the actual travel time is 150% of the free flow time, or it takes 1.5 times longer to travel a road segment than it would under uncongested conditions. For this analysis, it was assumed that the TTI cannot be less than 1, which occurs when the average speed is greater than vff. TTI requires only two parameters on its calculation as shown by Equation (21) Therefore, the TTI computation is simple and suitable for deployment in the wireless sensor networks in an energy efficient environment.


## 5.2.1. Vehicular Detection, Count, and Average Speed

In the scanning state as depicted in Figure8, the signal segment yk is tested whether it is anomalous by comparing the transition condition yk>0. If the transition is true, the detection is made by updating the detection flag dw, where w is the current window. Otherwise, the operation will proceed to the decision state either Decision_1 or Decision_2 depending on the current w value. In the decision state, there are three options in each depending on the transition condition: either Decision_11, Decision_12, Decision_13 or Decision_21, Decision_22, Decision_23. The Decision_11 or Decision_21 states are used to update vehicular count variable C and increment period (Ts) counter j. The Decision_12 or Decision_22 is used to calculate total observation time t, average speed varg, and Travel Time Index TTI. Decision_13 or Decision_23 states are used to increment period (Ts) counter j. Finally, the Init_12 or Init_22 states are used to update local variables before completing and exiting the cycle. Vehicular speeds were calculated based on a single sensor node:(19)vt=Lt,(20)vavgt=1N∑i=1Nvit,where vt is the vehicle speed, vavgt is the average vehicle speed for N vehicles, L is the estimated vehicle length, and t is the vehicle observation time by the wireless sensor node.Figure 8
SDA finite state machine diagram for calculating vehicular count, speed, and TTI.The main inputs into the algorithm are magnetic signals (Bax, Bay, and Baz) and the constant free flow speed vff. The main outputs are vehicle count C and TTI.


## 5.2.2. Congestion State

Traffic congestion can be described as the condition that occurs when the traffic flow demand exceeds by far the infrastructure supply resulting in long queues, travel delays, and increased travel costs [24]. Expressing the congestion state of a road segment is one of the key aspects of traffic flow monitoring. Many research works were conducted to study the congestion behaviour and formation. The challenges still remain due to the nonlinearity nature of congestion formation [24]. Selection of congestion metric is paramount; how do we measure the congestion state of a road network or city? This work adopted a congestion metric called TTI, proposed by Schrank and Lomax [25], which is a ratio of travel time in the peak period to travel time at free-flow conditions while accounting for both recurring and incident delays such as traffic accident. It determines how long it takes to travel during a peak hour and uses both main and arterial travel rates. This index has the advantage of expressing traffic congestion in terms of space and time, given by the following equation:(21)TTI=ttff=vffvarg,where TTI is the Travel Time Index, t is the average peak period travel time, tff is the free-flow travel time, vff is the free-flow travel speed, and varg is the average peak period travel speed. TTI of 1.35 indicates a 20-minute free-flow trip takes 27 minutes at the peak. Note that free-flow speed of 50 km/h at arterial roads in Dar es Salaam is used in this study.TheTTI can be understood by relating the value to a percentage. If the TTI is 1, then the average travel time is the same as the free flow travel time, meaning there is no delay. If the TTI is 1.5, then the actual travel time is 150% of the free flow time, or it takes 1.5 times longer to travel a road segment than it would under uncongested conditions. For this analysis, it was assumed that the TTI cannot be less than 1, which occurs when the average speed is greater than vff. TTI requires only two parameters on its calculation as shown by Equation (21) Therefore, the TTI computation is simple and suitable for deployment in the wireless sensor networks in an energy efficient environment.


## 6. Simulation

A simulator for traffic flow monitoring was developed using Matlab based on discrete-event simulation formalization [26, 27]. It simulates the proposed SDA algorithm and other wireless sensor events. Figures 9 and 10 show the simulator interfaces, respectively.Figure 9
Simulator interface shows road link and the total Earth’s magnetic field contours in Dar es Salaam City located at latitude −6.8° and longitude 39.1°.Figure 10
Simulator interface showing sensor nodes and their coverages on the sides of the road 3 m above the ground and 5 m from the centre of the lane.The simulation was conducted along a designated double road network of the city. Thevff for the road system was set to 50 km/hour. The road segment was installed with four sensor nodes, one sink node, and TMC. Each sensor node detects a vehicular presence, travel speed, and count. It then computes vavg and TTI. These data are sent to the TMC so that the average TTI and the vehicular count will be calculated and stored in the database periodically. The stored data are useful for estimating traffic congestion for the designated road network or city.Perforated lines show the wireless communication links between sensor nodes based on the IEEE 802.15.4 protocol [28, 29]. Communication between a base station and TMC is achieved through mobile communication technology such as GPRS, LTE, or EDGE. The simulator has a specific discrete event to record manually vehicular counts, speed, and calculate TTI. The manual traffic flow data are used to validate the data from the wireless sensor node. The two road signs show the manual vehicle count over a road segment and a maximum free flow speed.


## 7. Results and Evaluation

The simulation was conducted for 30 minutes, where normal and congested traffic flows were simulated on eastbound and westbound lane, respectively, of the double road system.Congested traffic flow results were plotted in Figure11. Two sensor nodes were installed on eastbound lanes (nodes 1 and 5). Figure 11(a) shows vehicle count graphs performed manually and by sensor nodes 1 and 5. Figure 11(b) shows the TTI calculation graph done manually and by sensor nodes 1 and 5. The threshold line has TTI = 1, and the area above the threshold line represents high delays (congested) while below represents normal traffic flow.Figure 11
Simulation results were two sensors nodes (1 and 5) were used to monitor congested traffic flow on eastbound lanes: (a) cumulative vehicular count; (b) Travel Time Index (TTI).
(a)
(b)Normal traffic flow was depicted in Figure12. Two sensor nodes were installed on westbound lanes (nodes 2 and 6). Figure 12(a) shows vehicle count graphs performed manually, by the sensor nodes 2 and 6. Figure 12(b) shows the TTI calculation graph done manually and by the sensor nodes 2 and 6.Figure 12
Simulation results were two sensors nodes (2 and 6) were used to monitor normal traffic flow on westbound lanes: (a) cumulative vehicular count; (b) Travel Time Index (TTI).
(a)
(b)Table1 summaries the performance based on traffic flow data captured by four sensor nodes with respect to the manual counts. The manual count was used to validate wireless sensor nodes performance. On the westbound, normal traffic flow was simulated and results on vehicular counts were 462 manually and 428.5 average counts on nodes. Therefore, the wireless sensor node missed 33.5 counts out of 462 during normal traffic flow. It is equivalent to 93% success rate. On the eastbound, congested traffic flow was simulated and results on vehicle counts were 1022 manually and 781 average counts on nodes. Wireless sensor nodes missed 241 out of 1022 during the congested traffic flow state. It is equivalent to 76% success rate.Table 1
Vehicular counts performance evaluation.
Flow type
Lane
Vehicular counts
Performance (NodeAvg/manual) (%)
Manual
Node 1
Node 2
Node 5
Node 6
NodeAvg
Normal
Eastbound
462
429
428.5
428
93
Congested
Westbound
1022
795
767
781
76Table2 summaries the performance based on traffic flow data captured by four sensor nodes with respect to manual TTI calculation. Manual TTI was used to validate TTI based on wireless sensor nodes. During normal traffic flow, TTI of 1.1 for manual and 0.96 for wireless sensor nodes were calculated. Therefore, wireless sensor node showed 87% success rate. During congested traffic flow state, TTI of 2.8 for manual and 2.48 for wireless sensor node was calculated. Wireless sensor node showed 88% success rate.Table 2
TTI performance evaluation.
Flow type
Lane
TTI
Performance (NodeAvg/manual) (%)
Manual
Node 1
Node 2
Node 5
Node 6
NodeAvg
Normal
Eastbound
1.1
0.98
0.94
0.96
87
Congested
Westbound
2.8
2.17
2.78
2.475
88


## 8. Conclusion

This work proposed a novel traffic flow monitoring algorithm called SDA based on magnetic WSNs installed on the sides of the road above the ground. The model formation and performance evaluation of the proposed magnetic-based WSNs algorithm for vehicular traffic flow monitoring in a chaotic environment were studied. The performance evaluation of simulation results for traffic flow monitoring in chaotic cities of developing countries using SDA based on WSNs showed 93% vehicular detection and count success rate for the normal traffic flow state and 76% for the congested traffic flow state. Congestion state metric, TTI, was used to measure the congestion state of the road segment with a performance of 87% and 88% success rates during normal and congested traffic flow states, respectively. This research suggests further studies on microscopic and macroscopic mathematical algorithms to improve detection, especially during the congested traffic flow.



---

*Source: 2591304-2018-10-16.xml*