In this section, we describe the system architecture and detailed design of our PES from a top-down approach. Rather than mentioning evaluated vehicle detection systems, this section focuses on the proposed PES itself.
3.2. Telematics Sensor Network
The most essential component of the PES is the TSN. The TSN is comprised of T-Sensor nodes, T-Sink nodes, and a T-BS-com node. In this sub-section, we describe the network architecture of the PES first, and the design of each kind of node follows.
The network architecture (Figure 2
) of the PES is based on that of S3 [29
], a two-tiered architecture targeting simple and stable operation. However, it is enhanced to meet the new requirements of the PES such as 1-hop broadcast packet support, event packet retransmission, and time synchronization. The lower tier network is used for communication between T-Sensor nodes and the T-Sink node. It is time-critical and easily interfered by the vehicles. To avoid packet collision between different lanes, T-Sensor nodes in each lane are assigned a unique frequency channel. The Physical (PHY) layer of TSN is compatible with IEEE 802.15.4-2003 (2.4 GHz). Normal packets are delivered to the T-Sink node through Lightweight MAC (LW-MAC) based on a simple CSMA/CA algorithm similar to the unslotted CSMA/CA of IEEE 802.15.4 [30
]. If the MAC-level ACK frame is not received from the receiver for the ACK wait duration, the sender identifies the packet lost and retransmit the lost packet in the MAC-level. However, LW-MAC treats the event packets differently, and the event packets are transmitted to the T-Sink node without Clear Channel Assessment (CCA), random back-off, and MAC-level retransmission. If an event packet from a T-Sensor node fails to be delivered to the T-Sink node (i.e.
, the MAC-level ACK frame for the packet is not received from the T-Sink node to the T-Sensor node for the ACK wait duration), now the application layer of the T-Sensor node (instead of the MAC layer) tries to retransmit the failed event packet after updating the delay field of the original packet to accommodate the retransmission latency. Another function of LW-MAC is to take the received time stamp and add it to the header of a buffer retaining the received packet. The time stamp is used to measure the traverse time of a vehicle between two consecutive T-Sensor nodes in the same lane. By measuring the traverse time in the T-Sink node, time synchronization between the T-Sensor nodes is not required.
All packets are routed to their destination using the Level-based Static Routing (LSR) protocol, which is based on level-based static addressing, for fast and robust routing. The level-based static addressing scheme allocates a 16-bit address to each node so as to assign each level to each nibble of the 16 bit address as described in Figure 3
. By sacrificing 6% of the address space, the LSR protocol gains the advantages of simplicity, speed, and table-less routing.
The upper tier network is used for data exchange between the T-Sink nodes and the T-BS-com node. The network uses a common frequency channel different from the channels used by the T-Sensor nodes. Every packet exchanged between them is delivered over IEEE802.15.4-2003 PHY, LW-MAC, and LSR. The packets over the upper tier network are not time-critical, so the LW-MAC in the tier is configured to use normal CSMA/CA and multiple retransmissions.
In the case of T-Mon Host failure, T-BS-com saves every traffic information packet in its local storage. The saved information can be retrieved to evaluate the VDS after the recovery of the T-Mon Host. In addition, in the case of T-Sink node failure, every event generated by a T-Sensor node is saved in its local Secure Digital (SD) card. Any undelivered traffic information of the T-Sensor node can be restored during post-processing of the locally-saved events. To do that, time synchronization between two T-Sensor nodes in the same lane is required. Since the maximum operation time of PES is less than 6 hours and the accuracy of the Temperature Compensated Crystal Oscillator (TCXO) used is 2.5 parts per million (ppm) between −30 °C and 75 °C, with a single time synchronization packet exchange, the worst possible time offset during a 10 minute period between two T-Sensor nodes in the same lane is [10 × 60 × (2.5/(106) = 1.5 ms] + 1.5 ms, or 3 ms. Although periodic handshaking is necessary to maintain the required time synchronization accuracy, a single synchronization scheme is designed and implemented for an operation time of 6 hours for this pilot project.
Before explaining the time synchronization details, we will briefly outline the timer operation in the T-Sensor and T-sink nodes. In PES, the continuous mode of Timer_A is used among various timer operation modes of MSP430 [31
]. In the continuous mode, the Timer_A Register (TAR) is repeatedly increased to 0xFFFF and restarts from zero, according to the timer clock. Whenever TAR reaches the value of Timer_A Capture/Compare 0 Register (TACCR0), a TACCR0 interrupt is triggered. In the Interrupt Service Routine (ISR) for the interrupt, a global variable, u32Tick
(a 32-bit software time tick), is increased by 1 and 0x0A00 is added to TACCR0 to generate the next periodic timer interrupt with a period of 0x0A00 counts on the timer clock. With this configuration, assuming an 8MHz timer clock, TAR increases every 0.125 μs, and 0x0A00 counts generates a 0.125 × 0x0A00 = 320 μs periodic timer interrupt.
The detailed procedure is explained in Figures 4
, and the notations used in the figures are summarized in Table 3
. In PES, data on the second, minute, hour, day, month, and year is distributed from the T-Mon Host to the T-Sensor nodes via T-Sink nodes using so-called sender-receiver synchronization, but the time tick synchronization between T-Sensor nodes in the same lane is achieved by a broadcast packet from their immediate parent, the T-Sink node based on mutual receiver-receiver synchronization [32
]. After receiving the START message from the T-Mon Host, a T-Sink node broadcasts a time-synch command (Sync_Req, 1-hop broadcast packet) to every T-Sensor node in each lane.
The Sync_Req packet includes the date and time (i.e., year, month, day, hour, minute, and second) of the T-Mon Host and the local time tick value (u32Tick) of the T-Sink node which is broadcasting this Sync_Req packet. Whenever a T-Sensor node receives the broadcast message, it takes a time stamp for the packet with its local TAR value and 32-bit local time tick value (u32Tick). Depending on the local processing state of each T-Sensor node, the processing latency for the received Sync_Req packet varies. Although the processing latency of each T-Sensor node in the same lane is diverse, as long as the processing latency is measured accurately, the u32Tick is updated and TAR and TACCR0 can be aligned correctly to the reference point.
Let us briefly describe the hardware design of each kind of node. All kinds of nodes in the TSN are based on a MSP430 Micro-Controller Unit (MCU) and CC2420 IEEE 802.15.4 compliant transceiver and CC2590 RF front-end amplifier from Texas Instruments [34
]. To detect vehicles the T-Sensor node is equipped with a HMC1041Z magneto-resistive (MR) sensor from Honeywell [35
]. The reasons why we adopt such an MR sensor are as follows: firstly, an MR sensor has been used in the vehicle detection field and proven with inductance loops for many years [17
]. Unlike laser or PIR sensors, a MR sensor measuring perturbation of the Earth's ambient magnetic field (−6∼+6 gauss for HMC1041Z) by a vehicle doesn't detect other objects such as humans, and it is not easily interfered by weather as explained in Section 2. Although a small amount of day to day change in the Earth's magnetic field and the temperature change can be sources of false detections [36
], they can be overcome by a simple algorithm, baseline adaptation which is explained in Section 3.3. Secondly, since it's small-sized (1 mm × 1 mm × 4 mm for HMC1041Z) and can be operated in low voltage level (2∼20 V for HMC1041Z) and low average current with the help of duty cycling, it makes possible to design a slim and small sized portable sensor node. To provide fault-tolerance to the failure of the wireless network after the start of the evaluation, the T-Sensor node has a back-up SD card on which to save undelivered packets. The T-Sink node is expendable for up to four sets of modules, each of which is responsible for a lane and consists of two communication modules connected via a Universal Asynchronous Receiver and Transmitter (UART). One communication module is for the upper tier network and the one is for the lower tier network. The T-BS-com is a gateway between the TSN and the T-Mon Host, and is attached with a back-up SD card in case the T-Mon Host fails.
Before ending this sub-section, the overall operation of a T-Sensor node is described. In our pervious project, S3 [29
], through downscaling measurement, we have already demonstrated the battery-life time is over two years against the maximum traffic (155,000 vehicles/day or 1.8 vehicles/second) with careful hardware and software design. In this pilot project, we leave the T-sensor node always on, and the overall operation procedure of a T-Sensor node is described in Figure 6
. When a T-Sensor node turns on, it prepares its operation in ‘Initialization
’ by initializing several variables, the timer expiration period, the baseline (details in Section 3.3), and so on. The main routine consists of four tasks triggered by three event bits which are set in different interrupt service routines (ISRs). ADC event is set in an ADC ISR, which is executed by ADC conversion complete interrupt. Actually, a timer is set to expire every sampling period Ps in ‘Initialization’ phase, and the timer ISR starts ADC to sample the ambient magnetic field. Once ADC event is set, ‘VehicleDetectionTask
’ is executed to decide two major detection events (APPROACH or DEPARTURE), and the details are explained in Section 3.3. The other two events, Radio and UART events are set by CC2420 and an internal UART controller, respectively. ‘NwRxProtocolTask
’ is the main task for the network and application merged layer to process every received packet from the MAC layer. Depending on the destination address of the received packet, it takes the received packet and processes it in the application layer or just forwards the packet to a proper neighbor. If the destination of the packet is the current node and requires the response, it prepares the response packet and sends it to the requesting node. For the UART event, there are two tasks (ConsoleTask
) to process the received character. The ConsoleTask
processes each received character from any serial terminal emulator, and the SeiralRxProtocolTask
is responsible for processing a serial packet generated from a local monitoring S/W which is a Graphic User Interface (GUI) software to monitor each node's internal state or to display the Earth magnetic field being measured by the node in real-time.
3.3. Vehicle Detection and Traffic Event Gathering
To measure traffic information such as speed, occupancy, and volume, the fundamental function is to accurately detect the approach or departure of a vehicle regardless of the kind of vehicle or the state it is in. A T-Sensor node is responsible for detecting an APPROACH or DEPARTURE event caused by a vehicle, and the main role of the T-Sink node is to take a time stamp for each event packet and to filter out unpaired event packets and retransmitted application-level packets. In this sub-section, the vehicle detection algorithm is summarized.
To detect a vehicle, a magneto-resistive sensor is used and the overall detection flow is described in Figure 7
. Since the Earth itself is a big magnet, there is an ambient magnetic field everywhere on Earth. When a T-Sensor node is turned on, it initializes the baseline for the ambient magnetic field. A ferrous object that drives by, such as a vehicle, distorts the ambient magnetic field. To monitor the distortion, the T-Sensor node samples the ambient magnetic field with a build-in Analog to Digital Converter (ADC) for a sampling period of Ps, which is decided by the maximum detectable speed and the minimum detectable length of a vehicle. The raw sampled data, R(k
), usually has noise, which is filtered out by the noise filter. The refined data, D(k
), is provided to both the Baseline Adapter block and the State Machine-based Decision block. It is worthwhile to refer to the gathered data (Figure 8
), D(k), for different vehicles with different speeds from a prototype sensor node to continue to describe the remaining blocks. The State Machine-based Decision block decides the next state, S(k
), based on D(k
), and the current state. To provide hysteresis, two different thresholds are applied to the difference of D(k) and B(k) depending on the current state. The higher threshold is used to detect an approaching vehicle to a T-sensor node while the lower threshold is compared to detect a departing vehicle from the sensor node with the difference. To separate two consecutive vehicles is not so difficult, for there is enough space between two moving vehicles. Of course, the lower threshold should not be too small. If so, the sensor node regards them as a single vehicle. On the other hand, the Earth's magnetic field varies by small amounts day-to-day [36
]. In addition, temperature changes on the sensor due to the movement of the sun and clouds result in the slow change of the sensed magnetic field [36
]. To cope with those two sources of drift, the baseline adapter block is designed to adapt the baseline to those environmental changes. Depending on the output state of the State machine-based decision block, the baseline adapter modifies the baseline quickly or slowly to the recent trend of D(k). Once the next state, S(k), is decided by the decision block, the Event Packet Generator block prepares an event packet (APPROACH or DEPARTURE) with the current battery-level and sends the event to the T-Sink node.
When the T-Sink node receives the event packet, it updates the packet's timestamp field with its local time (tick) and forwards it to the T-BS-com. The T-BS-com gathers every packet from TSN and forwards them to the T-Mon Host via USB interface. For the case of failure of T-Mon Host, it saves only event packets in its local SD card.
The speed of a vehicle is easily calculated with v = (the separation of T-Sensor nodes in the same lane)/(time difference of APPROACH packets from them). The length of a vehicle is also estimated by v × (time interval between the paired APPROACH/DEPARTURE packets of one of T-Sensor nodes). Volume (or count) of traffic is measured by the paired APPROACH/DEPARTURE packets of one of the T-Sensor nodes. The occupancy is calculated by (time interval between APPROACH and DEPARTURE packets)/(unit time).