Abstract
Mobile sensor networks (MSN) in the city environment have dynamic topology and large amounts of data. In order to overcome the problem of data uploading and exchange, data uploading and exchange algorithm (DUEA) is proposed. In DUEA, the three-tier network architecture composed of vehicle nodes, relay nodes and sink nodes is considered. The link estimator, routing engine, and forwarding engine are modified based on CTP (collection tree protocol). In the link estimator, beacon packet is simplified. In the routing engine, the numbers of elements in the send queue of neighbor nodes, and link quality are weighed. The new calculation formulae of ETX value and selection method of father node are proposed. In the forwarding engine, different snooping methods are used for two types of data named general data and warning data. Simulation results show that compared with CTP, DUEA increases data throughput and transmission rate and reduces energy consumption of packet transmission when data is uploaded. DUEA also reduces average transmission delay when data is exchanged. Physical test results show that DUEA achieves desired effect in the testbed. DUEA is effective and feasible and outperforms CTP in the city traffic environment.
1. Introduction
Transportation is the basic industry of national economy and the basic condition of social development and people's living standard improvement. With the rapid development of society, scale of modern cities has been expanding and traffic demand increases. But the problems such as traffic jam and accident are more prominent. Traffic problem is a primary bottleneck in the city development. It is a widespread global problem in the economic and social development [1, 2].
In order to curb the growing number of traffic accidents, drivers need technical methods to prevent all kinds of accidents. Therefore, driver assistance technology comes into existence [3]. MSN in the city traffic environment which consists of mobile vehicle nodes with wireless communication devices is an important part of driver assistance technology. It provides information for safe driving warning, traffic information dissemination, and some other applications. It also increases the traffic efficiency and offers reliability, safety, and convenience for the driver. Thus, key technologies of MSN have become a research hotspot in the wireless network field and smart traffic field [4].
In the smart traffic field, data have to be uploaded to sink nodes and exchanged between vehicles. The function realization is based on the routing algorithm. Nonetheless some traditional routing algorithms are difficultly applied in the city traffic environment. The reason is that it has some features such that network scale is enormous; network topology changes frequently; the location distribution of roadside nodes is tubular; the low transmission delay of key data is required. Thus, routing algorithm for MSN in the city traffic environment is one of the problems which must be solved. At present, scholars have gotten some accomplishment. Reference [5] proposes a stable routing protocol for intelligent traffic service. According to the information of mobile vehicles (such as location coordinates, direction, speed, and road electronic map), the protocol avoids data transmission interruption by predicting the probability of broken links. For sparse network environment of villages, [6] proposes a protocol based on partial connection of boundary nodes. Reference [7] proposes a real-time protocol for sensing real-time traffic information. The protocol deploys location servers in the monitoring area to gather location data of vehicles and realizes vehicle density estimation with adaptive path selection method. Reference [8] proposes an application in the desert environment and the cluster routing algorithm. Reference [9] proposes traffic adaptive routing (TAR) for MSN. TAR analyzes and predicts the patterns of both traffic and mobility. It reduces the control packet and has fast route recovery process. Reference [10] proposes a mobility-aware efficient routing (MAER). MAER integrates proactive and reactive components, uses the sink cluster to provide stable paths, and uses mobile information to select alternative paths when route needs rediscovery. Reference [11] uses corona mechanism and computes optimal forwarding node with RSSI, residual battery level of sensor nodes, and packet delay over one hop. The algorithm has high packet delivery ratio and minimum end-to-end delay. References [5–10] only use simulation software such as NS2, Matlab to verify the effectiveness of algorithms. They do not consider physical test in the hardware devices. References [9–11] do not consider the city traffic environment.
Reference [12] proposes a CTP protocol. In CTP, some nodes are set as root nodes. Other nodes form collection tree according to routing gradient values. However, when nodes send data intensively, it is easy to cause data transmission congestion of hub nodes. The CTP is fit for the wireless sensor networks with fixed nodes but is quite difficultly applied in MSN. Thus, DUEA (data uploading and exchange algorithm for mobile sensor networks in the city traffic environment) is proposed. Based on CTP, the link estimator, routing engine, and forwarding engine are modified. In the link estimator, the location and link quality information of neighbor nodes at the end of beacon packets are deleted. Each vehicle node is considered as a leaf of the collection tree and is unable to forward data to other nodes. On the other hand, relay nodes take data relay task of all vehicle nodes. In the routing engine, link quality and the numbers of elements in the send queue of neighbor nodes are used to find the father node. In the forwarding engine, the data are divided into general data and warning data. Different snooping methods are used for the two types of data. Simulation results show that, in the data uploading process, DUEA increases data throughput and transmission rate and reduces energy consumption of packet transmission. In the data exchange process, DUEA has low average transmission delay. Physical test results show that DUEA achieves desired effect in the testbed.
The remaining parts of paper are organized as follows. In Section 2, the algorithm principle is described. The content contains link estimator, routing engine, and forwarding engine. In Section 3, the realization of DUEA is proposed. In Section 4, the results of simulation experiment and physical test are presented. In Section 5, the paper is concluded.
2. Algorithm Principle
Assume that all vehicles install vehicle nodes. As shown in Figure 1, the MSN in the city traffic environment is composed of mobile vehicle nodes, fixed relay nodes, and sink nodes. The mobile vehicle nodes periodically gather vehicle driving data which include their own location coordinates, speed, state of accelerator pedal, state of brake pedal, pyroelectric infrared sensor signal, and steering wheel angle and send the data to relay nodes in the vicinity. Meanwhile, vehicle nodes snoop, gather, and analyze the data of other vehicles to judge whether or not to respond.

Three-tier network architecture.
Roadside relay nodes gather driving data of vehicles in vicinity and forward them to sink nodes directly or by multihop way. Sink nodes gather all driving data in their monitoring area and forward them to process center for further analysis by the way of serial port, 3 G or 4 G.
There are two kinds of data, namely, general data when vehicles are normally driven and warning data when vehicles encounter emergencies such as vehicle breakdown and traffic jam. Those two kinds of data need different exchange methods. The data transmission of vehicle nodes and relay nodes is also different. Thus, DUEA is proposed. But it needs to solve the following three questions: firstly, how to simplify link estimator and evaluate link quality for MSN in the city traffic environment; secondly, how to select father node, ease data congestion of hub nodes, and balance the transmission data amount of relay nodes; thirdly, how to upload and exchange data. The three questions can be solved by the modified link estimator, routing engine, and forwarding engine as follows.
2.1. Link Estimator
To evaluate link quality, DUEA uses link estimate exchange protocol [13]. However, in CTP, location and link quality information of neighbor nodes are added at the end of beacon packets. The long beacon packets greatly increase the network cost of link evaluation. Thus, the link estimator of DUEA is simplified by deleting the location and link quality information of neighbor nodes.
Because of the dynamic topology, it is easy to lose packets when multihop transmission is used in vehicle nodes. Therefore each vehicle node is considered as a leaf of the collection tree and is unable to forward data to other nodes. On the other hand, relay nodes take data relay task of all vehicle nodes. As shown in Figure 2, all relay nodes and sink nodes send beacon packets to neighbor nodes every now and then. When neighbor nodes receive beacon packet, the number of received packets in the information table of neighbor nodes updates correspondingly. At the same time, the number of lost packets, the number of send packets, link quality, and LETX (link expected number of transmission) are calculated [13].

Principle of link estimator.
2.1.1. Data Format of Beacon Packet
In DUEA, nodes need to quickly respond to the dynamic network, and beacon packet's transmission period is short. If there are too many bytes in the beacon packet, it increases the network cost and has negative influence on data communication. Thus, in link estimator, data format of simplified beacon packet is used. As shown in Table 1, the field of packet type takes 1 byte to distinguish other types of packet. Its default value is 0 × 70. The field of serial number takes 1 byte to specify a unique serial number for each packet. The serial number is used to calculate the number of lost packets and the link quality. The field of routing packet is defined by routing engine according to specific routing scheme. It is shown in Section 2.2.
Data format of beacon packet.
2.1.2. Link Estimating Method
As shown in Figure 2, all relay nodes and sink nodes send beacon packets to neighbor nodes every now and then. The beacon packet includes serial number of transmission packet which adds 1 automatically after transmission. When neighbor nodes receive beacon packet, the number of received packets
According to
The smaller the
2.2. Routing Engine
As shown in Table 2, in the routing engine of DUEA, relay nodes and sink nodes generate latest routing packets which include routing bit P, congestion bit C, the number of elements in the send queue, father node, and ETX (expected number of transmission) value. If relay nodes or sink nodes receive the routing packet when bit P is 1, it is necessary to generate and broadcast beacon packet. Bit C represents the congestion state of the node. The not congested node is selected as father node under the same condition. They transfer the routing packets to link estimator. The beacon packet is packaged in the link estimator and sent.
Data format of routing packet.
As shown in Table 3, when node receives the beacon packet, it updates the information which includes address of neighbor node, the number of elements in the send queue of neighbor node, address of father node, ETX value, bit S, and bit C in the information table of neighbor nodes, calculates the corresponding ETX value, and starts to select father node. Bit S represents whether the neighbor nodes are snooped. In addition, routing engine has one timer to periodically update routing information. Once routing information changes a lot, it is necessary to generate routing packet and notify neighbor nodes to update their information tables of neighbor nodes.
Data format of information table of neighbor nodes.
2.2.1. Father Node Selection
CTP selects the father node only according to link quality. When nodes send data intensively, several nodes select the identical father node. It easily causes data transmission congestion of the father node, reduces data throughput, and increases packet loss rate. Thus, the selection method of the father node in DUEA is different from CTP. DUEA uses RETX (routing expected number of transmission) value as the evaluation criteria. RETX consists of link quality and the number of elements in the send queue of the neighbor node. The formula is as follows:
If RETX value is small, the quality of corresponding transmission link is good and the transmission task of the neighbor node is light. ETX represents expected number of paths from source node to sink node. It is necessary to select one neighbor node as father node through which it has the smallest ETX value. ETX value of sink node is 0. ETX value of one node is equal to the sum of all links' RETX values in the path from the node to sink node:
2.3. Forwarding Engine
As shown in Table 4, in DUEA vehicle nodes need to upload the sensed data packets which include bit S, bit C, bit D, THL, ETX, MSH, Origin, Seqno, Collect_id, and data to sink node. The meanings of bit S, bit C, and ETX are in accordance with routing packet. Bit D represents the type of data packet. According to the driving information of its own vehicle and surrounding vehicles, the vehicle node predicts whether it will be at risk driving state, judges whether it is at risk driving state or normal driving state, and generates the warning data (bit D is 1) or general data. The judgment and prediction methods are not the study content and are not described in the article. THL represents the lifetime of data packet in relay node. If vehicle node generates one data packet, its THL is 0. When relay node forwards the data packet, its THL adds 1. MSH represents maximum snooping hop of vehicle nodes. If relay node forwards the data packet, MSH subtracts 1. When MSH is 0, the data packet is not snooped by vehicle nodes. Origin represents original node address of the data packet. Seqno represents original sequence of data packet. It adds 1 automatically when original node sends one data packet. Collect_id represents identification number of high-level protocol. It can be set by the designer of high-level protocol. Data represents payload area of data which is 0 or multibytes. Original node sets fields like origin, Seqno, Collect_id, and data. They cannot be modified by relay nodes.
Data format of data packet.
Vehicle nodes also need to obtain the data of other vehicle nodes and realize data exchange. Thus, forwarding engine of DUEA inherits part of CTP forwarding method, modifies the transmission target of vehicle node, and adds the methods to snoop and process the two types of data packets.
As shown in Figure 3, when vehicles are normally driven, vehicle nodes A, B, C, and D are not in especial situations. The vehicle nodes access relay nodes on the roadside, set bit D values of data packets 0, set MSH values of data packets 1, and send the general data packets to sink node through relay nodes. At the same time, other vehicle nodes in vicinity snoop the data packets and judge MSH values of the packets. If the MSH value is 1, it means that the node is its neighbor node and receives the data packet. 1-hop exchange of general data packets between vehicle nodes is realized.

Data uploading and 1-hop exchange when the vehicle is normally driven.
When vehicles confront breakdown, traffic jam, or other especial situations, besides sending warning data packets to sink node through relay nodes, it is necessary to fast send the information to the following vehicles. As shown in Figure 4, vehicle node A and vehicle node B confront traffic jam, set bit D 1, and set MSH initial value in the data packet. If relay node receives the warning data packet, it judges the MSH value. If the MSH value is 0, relay node stops forwarding data packet, else it forwards data packet to other relay nodes in vicinity, and the MSH value is subtracted from 1. If vehicle node snoops warning data packet, it receives the data packet directly. According to the information in the data packet, it reminds the driver and puts the data packet in cache. In multihop exchange process, one vehicle node may receive the same data packet several times; thus it is necessary to judge whether the data packet already exists in cache. If it does, the data packet is discarded.

Data multihop exchange when the vehicle is in especial situations.
3. Algorithm Realization
DUEA is a distributed algorithm. Vehicle nodes, relay nodes, and sink nodes separately implement their own program. The implementation is as shown in Figure 5.

The work flowchart of sink nodes.
As shown in Figure 5, when network starts, sink nodes broadcast beacon packets with their own information and receive data packets of vehicle nodes from time to time.
As shown in Figure 6, when network starts, each relay node broadcasts beacon packets with its own information, if relay node receives beacon packet, estimates the link quality, and updates the information table of neighbor nodes. According to (4), relay node calculates RETX value. According to (5), the node calculates its own ETX value for selecting father node and ensures that the father node let ETX value of its own smallest. If relay node receives data packet of vehicle node, it judges the MSH value. When the MSH value is greater than 0, it is subtracted from 1 and the data packet is forwarded. When the MSH value is 0, the data packet is discarded.

The work flowchart of relay nodes.
As shown in Figure 7, each vehicle node receives beacon packets and processes the beacon packets in the same way that relay node processes. If vehicle node wants to send data, adds the packet head information in the data packet, and sends to sink node through father node, vehicle node keeps snooping data packets of other vehicle nodes. If it is general data packet, vehicle node receives the general data packet within 1-hop range. If it is warning data packet, vehicle node judges whether the data packet has been received. If the data packet has not been received, vehicle node receives it immediately and analyzes the content. If it has been received before, the data packet is discarded.

The work flowchart of vehicle nodes.
DUEA is realized with several independent events on TinyOS system. Different events are scheduled with the same schedule method in CTP [13]. According to the above content, based on CTP, link estimator (LinkEstimatorP component), routing engine (RoutingEngineP component), and forwarding engine (CtpForwardingEngineP component) are modified.
4. Simulation Experiment and Physical Test
4.1. Simulation Experiment
TOSSIM is simulation software in the TinyOS operating system. If the application software is simulated in TOSSIM, it can be directly applied in real hardware devices. It significantly reduces the development time. Thus, TOSSIM is utilized to simulate DUEA.
4.1.1. Simulation Platform
The simulation platform considers the city traffic environment. Vehicle nodes, relay nodes, and sink node have sufficient energy supply. As shown in Figure 8, the area of simulation platform is 250 m ∗ 250 m. There are 41 vehicle nodes, 24 relay nodes, and 1 sink node in the area. The sink node is distributed in the center of the platform. Relay nodes are distributed on the roadside. Vehicle nodes move along the roads from right to left and from top to down. The simulation time is 300 s. Maximum transmission distance of nodes is 100 m. Proportion factor β is 0.9. Maximum number of elements in the send queue of node is 4. The performance of DUEA is simulated, analyzed, and compared with the performance of CTP. In order to evaluate maximum network data throughput, in the simulation assume that there are always 41 vehicle nodes which send data periodically, namely, one vehicle node leaves and another vehicle node enters.

Diagram of simulation platform.
In the simulation, data throughput is the total amount of vehicle nodes' data packets successfully gathered by sink node. Transmission rate is the ratio of sensed data amount which sink node successfully gathers to the total sensed data amount which vehicle nodes send. Average packet transmission delay is the average transmission delay value of all data packets from original vehicle nodes to sink node. Assume that node consumes 2 units of energy when it sends one data packet and consumes 1 unit of energy when it receives one data packet. Average energy consumption of packet transmission is the average energy consumption value of all data packets from original vehicle nodes to sink node. Average communication overhead is the average number of auxiliary bits which is needed to send one data packet. In DUEA and CTP, the auxiliary bits include nonuser information bits in data packet and bits of beacon packet. The number of nonuser information bits in data packet is 9 bytes.
4.1.2. Simulation Results
Firstly, the effects of link quality factor
As shown in Figure 9, the maximum data throughput of vehicle nodes does not change when

The effect of
As shown in Figure 10, when

The effect of
In conclusion, appropriate
Secondly, in order to verify the effectiveness of DUEA, DUEA and CTP are compared. In the simulation,
Figure 11 compares the average data throughput between DUEA and CTP. As shown in Figure 11, when the data packet transmission period is 0.7 s, 0.8 s, 0.9 s, or 1 s, network congestion almost does not exist, and DUEA a little outperforms CTP. When data packet transmission period is lower than 0.7 s, network congests. DUEA considers vehicle node as leaf node which does not take part in data relay and also considers transmission task of neighbor nodes. Those improvements reduce network congestion of hub nodes in communication process and increase data throughput. When the network congestion is more serious, the improvement of data throughput is greater. Thus, average data throughput of DUEA is relatively larger than that of CTP. DUEA can increase data throughput.

Comparison of average data throughput.
Figure 12 compares the average transmission rate between DUEA and CTP. As shown in Figure 12, DUEA has larger average transmission rate than the one that CTP has. When data packet transmission period is lower than 0.7 s, it has great improvement. When data packet transmission period is 0.2 s, the data transmission rate increases by at least 50%. Thus, DUEA can increase data packet transmission rate.

Comparison of average transmission rate.
Figure 13 compares average packet transmission delay between DUEA and CTP. Because DUEA and CTP use CSMA/CA mechanism and random backoff time to share the radio channel, the communication has certain randomness. As shown in Figure 13, the curves of average packet transmission delay fluctuate. But DUEA still has lower average packet transmission delay than the one that CTP has. Because the two algorithms use the same queuing scheme and queuing delay takes the major part in the packet transmission delay, the difference of average packet transmission delay between DUEA and CTP is not large.

Comparison of average packet transmission delay.
Figure 14 compares average energy consumption of packet transmission between DUEA and CTP. In CTP, some vehicle nodes select other vehicle nodes as father nodes to avoid congestion. It increases transmission hops and average energy consumption. Thus, as shown in Figure 14, the curves of average energy consumption also fluctuate. But average energy consumption of packet transmission in DUEA is lower than that in CTP. DUEA can reduce average energy consumption of packet transmission.

Comparison of average energy consumption of packet transmission.
Figure 15 compares average communication overhead between DUEA and CTP. In DUEA, large number of data packets let some relay nodes prematurely fall into congestion. Although the beacon packet is simplified, the number of beacon packets in communication increases. And the number of data packets is much larger than the number of beacon packets; therefore as shown in Figure 15, the average communication overhead value is a little more than 9 bytes. The average communication overhead in DUEA is little lower than that in CTP. The difference of average communication overhead between DUEA and CTP is not large.

Comparison of average communication overhead.
Let vehicle nodes 25, 26, and 27 which are near relay node (0,0) sense and send data. Other vehicle nodes do not sense data but can snoop the three nodes' date packets. Node 26 sends warning data packet. The other two nodes send general data packet.
As shown in Table 5, no matter whether it is general data packet or warning data packet, the average transmission delay of 1-hop snooping is lower than 40 ms. Vehicles response in dozens of milliseconds by snooping the data packets; thus DUEA can be applied to safe driving warning and other aspects.
Delay table of 1-hop snooping data packet.
As shown in Table 6, in 41 vehicle nodes, the proportion of vehicle nodes which can snoop warning data packet in hundreds of milliseconds time is more than 76.34%. Warning data packet can be sent to other vehicle nodes in time and average transmission delay is short; thus DUEA can be applied to vehicle breakdown warning, road congestion warning, and other aspects.
Delay table of warning data packet.
With above simulation analysis, it is concluded that, during data uploading process, DUEA increases data throughput and transmission rate and reduces energy consumption of packet transmission. During data exchange process, DUEA reduces average transmission delay, keeps transmission delay of 1-hop snooping data packet in dozens of milliseconds, and keeps transmission delay of 3-hop snooping warning data packet in hundreds of milliseconds. It satisfies the requirement of data delay for some MSN applications. DUEA outperforms CTP in the city traffic environment.
4.2. Physical Test
In order to test the real effect of DUEA and gather data of all vehicle nodes, the testbed which is composed of physical test environment and PC software is built.
4.2.1. Physical Test Environment
Physical test environment mainly consists of test platform, simulated car, and IRIS node of MEMSIC [14]. As shown in Figure 16, the area of test platform surrounded by green belt is 2.4 m * 2.4 m. There are several roads, T-junctions, crossings, flyover, traffic lights, simulated cars, and IRIS nodes. They make up simple city traffic environment.

Test platform.
As shown in Figure 17, the simulated car with IRIS node is used to emulate the real driving vehicle. The car uses Cortex-M3 series chip STM32F103ZET6 of ST Company as the system's core controller. It uses the pin to control the two DC motors and one steering gear and obtain data with ultrasonic sensor, pyroelectric infrared sensor, speed sensor, GPS module, and other sensors.

The simulated car with IRIS node.
4.2.2. Test Results
When the cars and all nodes are powered on, PC software opens and gathers the vehicles' data. As shown in Figure 18, the PC software successfully gathers the driving data of three cars. The data contains node address, the distance of forward car, whether someone in front of car (infrared information), speed, state of acceleration pedal, state of brake pedal, steering wheel angle, location coordinates, and whether confronting obstacles. The software stores the data in database for following analysis. Because GPS module does not work in the indoor, its value is represented by constant 00000000.

PC display software.
As shown in Figure 19, vehicle node 1 not only uploads data to PC, but also snoops the data of vehicle nodes 2 and 3. Vehicle controller receives and analyzes the data such as the distance of forward car, infrared information, speed, state of acceleration pedal, state of brake pedal, steering wheel angle, and location coordinates. For example, if the infrared sensor value is 0, there is no one in the front of the car and the vehicle node judges that it does not watch for pedestrians. According to the driving information of its own vehicle and surrounding vehicles, the vehicle node predicts whether it will be at risk driving state, judges whether it is at risk driving state or normal driving state, and decides whether or not to respond.

Snooping data of node 2 in LCD screen.
5. Conclusion
The paper proposes the data uploading and exchange algorithm for mobile sensor networks in the city traffic environment. Firstly, MSN in the city traffic environment is divided into three-tier network architecture composed of vehicle nodes, relay nodes, and sink nodes. Next, based on CTP, link estimator, routing engine, and forwarding engine are modified. Finally, in TOSSIM, the effect of link quality factor
DUEA is a distributed algorithm based on CTP. The routing scheme is proposed for several applications such as safe driving warning and traffic information dissemination. However, the algorithm does not consider reverse order data transmission of sink node. Thus, our next target is to study the routing algorithm for sink node's order data transmission.
Footnotes
Conflict of Interests
The authors declare that there is no conflict of interests regarding the publication of this paper.
Acknowledgments
This study was supported by Zhejiang Provincial Natural Science Foundation of China under Grants nos. LY13F010013, LY14F030006, and Y15F030007, Zhejiang Provincial Public Welfare Technology Application and Research Project of China under Grant no. 2014C33108, and National Natural Science Foundation of China under Grant no. 61304256.
