Design and implementation of a P2P communication infrastructure for WSN-based vehicular traffic control applications

Design and implementation of a P2P communication infrastructure for WSN-based vehicular traffic control applications

Journal of Systems Architecture xxx (2013) xxx–xxx Contents lists available at ScienceDirect Journal of Systems Architecture journal homepage: www.e...

781KB Sizes 0 Downloads 42 Views

Journal of Systems Architecture xxx (2013) xxx–xxx

Contents lists available at ScienceDirect

Journal of Systems Architecture journal homepage: www.elsevier.com/locate/sysarc

Design and implementation of a P2P communication infrastructure for WSN-based vehicular traffic control applications Juan Pedro Muñoz-Gea ⇑, Pilar Manzanares-Lopez, Josemaria Malgosa-Sanahuja, Joan Garcia-Haro Department of Information and Communication Technologies, Universidad Politécnica de Cartagena, Campus Muralla del Mar s/n, 30202 Cartagena, Spain

a r t i c l e

i n f o

Article history: Available online xxxx Keywords: P2P WSN Intelligent Transportation Systems Distributed Hash Table Path planning

a b s t r a c t Wireless Sensor Network (WSN) technology has recently started to be applied to Intelligent Transportation Systems (ITS). In this kind of network, sensor nodes are scattered over a sensor field and they transmit information to a sink node. In this paper, we first propose the design of a proxy functionality for the sink node, which will be responsible for exchanging information with other proxy nodes by means of a new Peer-to-Peer (P2P) communication infrastructure implemented using a Distributed Hash Table (DHT). This infrastructure will also facilitate the distributed processing of sensing data in order to perform path planning in a vehicular traffic control application. This approach will be able to distribute the computational tasks for route calculations over the different sink nodes in the network. This paper will present a detailed prototype of the proposed P2P communication infrastructure. Ó 2013 Elsevier B.V. All rights reserved.

1. Introduction One of the major aspects of ITSs (Intelligent Transportation Systems) is sensing the environment to provide traffic control services, such as traffic guidance applications (e.g., path planning services) or applications which manage the traffic at intersections by means of traffic lights. In general, traffic control applications need to estimate the state of the road segments. Traditionally, this task has been conducted by employing intrusive sensors, such as magnetometers, pneumatic road tubes, or inductive loops. However, the installation of this type of sensor is not economically feasible for big cities, where there could be more than one hundred thousand intersections. Furthermore, the information acquired by these sensors must be transmitted to distant Traffic Management Centers (TMCs) for data processing, in general using expensive communication infrastructures and generating unacceptable data dissemination delays, which limits the utility of such a system [1]. An alternative to the previous solution is to use Wireless Sensor Network (WSN) technology. WSNs involve medium to large networks of inexpensive wireless sensor nodes capable of sensing and distributing the information acquired from the environment [2]. In a WSN, the sensor nodes gather information and transmit it to a sink node, perhaps via other sensor nodes [3]. Finding the appropriate path to transfer the sensing data to the sink node is very important because both the data transfer and the routing protocol should consume as little power as possible, since the power in the sensor nodes is a limited resource [4]. Furthermore, the ⇑ Corresponding author. Tel.: +34 968 338893; fax: +34 968 325973. E-mail addresses: [email protected], [email protected] (J.P. Muñoz-Gea).

communication processing should not require too much computation or memory, since these are also limited resources, especially if we want to achieve low cost for sensor nodes [5]. Another important characteristic of WSNs is their self-organization. Since sensors are generally left unattended, they must discover a valid path to the sink node by themselves, taking into account that the environment of the sensor field may change, modifying both the topology and the set of events that need to be reported. With the emergence of WSN technology, the IEEE 802.15.4 committee began to work on a low data rate standard. The latest version of this standard is IEEE Std 802.15.4-2006 [6], and it specifies the lower layers of the OSI model: the wireless Medium Access Control (MAC) and Physical Layer (PHY). On the other hand, the upper layers (from the network layer and above) are specified by the ZigBee Alliance [7]. In this kind of application, the design of the sink node is critical. These nodes have fewer resource constraints (including energy) than ordinary sensor nodes in the WSN, and they, for instance, will be powered by mains. Therefore, in this paper, we first propose the design of a proxy functionality for the sink node. The proxy node is both WSN and wide area network (WAN) enabled. Thanks to it, the sink will act as a gateway of the WSN, exchanging data with other WSNs, by means of a new Peer-to-Peer (P2P) communication infrastructure [8]. This infrastructure is implemented using a Distributed Hash Table (DHT), which is a class of decentralized distributed systems that manages a key table for the participating nodes. Each node maintains a set of links to other nodes (a routing table) and is responsible for a set of (key, value) pairs. Using the routing information, a node can retrieve the value associated to a given key. This interface will facilitate the location of the information

1383-7621/$ - see front matter Ó 2013 Elsevier B.V. All rights reserved. http://dx.doi.org/10.1016/j.sysarc.2013.08.002

Please cite this article in press as: J.P. Muñoz-Gea et al., Design and implementation of a P2P communication infrastructure for WSN-based vehicular traffic control applications, J. Syst. Architect. (2013), http://dx.doi.org/10.1016/j.sysarc.2013.08.002

2

J.P. Muñoz-Gea et al. / Journal of Systems Architecture xxx (2013) xxx–xxx

gathered by the sensors located in a specific road segment, associating a given key in the DHT to this road segment. On the other hand, route calculation is one of the basic functions of an ITS. One of the major difficulties of route calculation is the computational time needed when the size of the topographical road map data is large. In order to speed up this process, multilevel network methods have been proposed [9–12]. These methods first divide a large network of roads into several smaller zones or subnetworks, and then organize them into a multilevel network structure by pushing up boundary nodes into the higher level network as new nodes. After that, the optimal routes between the boundary nodes of each subnetwork are computed to decide the sections in the higher level network. With this structure, the cost of the optimal route between two nodes on the higher level network is the same as that for the original network. Previous multilevel network methods were usually carried out in centralized server environments, which means that the server has to periodically carry out all the operations needed to calculate the optimal routes between the boundary nodes of each subnetwork, in order to take into account the changes in the network of roads. That is, it has to obtain the cost associated to each road in the different subnetworks (this cost is usually the traveling time) and then apply the associated routing algorithm. DHTs facilitate the implementation of reliable distributed data processing approaches, offering several advantages over centralized approaches. One of the most important is that in a centralized system, there is a bottleneck at the root of the architecture, whereas in a DHT system, the failure of a node does not affect the whole system. In addition, DHTs are optimized for massive search and update operations. Therefore, in this paper, we also propose a distributed data processing approach to the route calculations, which takes advantage of the DHT communication infrastructure. Each subnetwork and each boundary point of the different subnetworks receives a unique identifier. The DHT nodes (sink nodes) responsible for the previous identifiers become Subnetwork Managers (SM) and Routing Manager (RM). Routing Managers are in charge of dynamically calculating the optimal routes between the boundary nodes of each subnetwork, continuously maintaining an up to date version of these routes. Thanks to this process, the speed-up efficiency of the route computation greatly improves. On the other hand, Subnetwork Managers are able to calculate the optimal routes between any road segment in the corresponding subnetwork and the associated boundary points. In this way, it is clear that the computational tasks for the route calculation are distributed over the different sink nodes in the network, and are no longer centralized in a server. To sum up, the contributions of this paper are two. First, we propose the design of a proxy functionality for sink nodes that will enable communication between them using a new P2P communication infrastructure implemented using a DHT (see Sections 4 and 5). This infrastructure will facilitate the fast discovery of the information gathered by the different sensors located in each WSN, including the time cost of the road segments, which is essential for route calculation. Second, we propose a distributed data processing approach for the route calculation (see Section 6). This approach is able to distribute the computational tasks for the route calculation over the different sink nodes in the network. Furthermore, this proposal also speeds up the route computation. The rest of this paper is organized as follows. Section 2 reviews the research in several related papers. Section 3 introduces Distributed Hash Tables. Section 4 discusses the design of the P2P communication infrastructure. Section 5 describes the prototype implementation. Section 6 presents the path planning service. Section 7 presents some system performance evaluation. Finally, Section 8 summarizes the conclusions.

2. Related works Traffic control applications consider a road network as a graph composed of intersections (vertices) and road segments (edges). Sensor nodes along the road segments are used to measure the information related to traffic flows, and this information is usually sent to a TMC for processing. As previously mentioned in the introduction, two different types of traffic control applications can be identified. The first includes traffic guidance applications such as path planning [13]. In them, WSNs can be used to monitor road networks, estimating the time cost of each road segment in order to obtain the optimum path for a specific destination. The second group includes applications which manage traffic at intersections by means of traffic lights [14]. Both kinds of systems require a very small number of deployed nodes, providing very cost-effective solutions. Collaborative processing between the sensor nodes may be used to reduce the amount of information delivered. A mechanism is proposed in [15] that reduces the frequency of transmissions by segmenting the data into time series of variable length. This length is established by the similarity of the sensed data, so that only when the traffic state presents significant variations is a message sent. In addition, that mechanism reduces the number of transmissions by means of data fusion. Collaborative data processing can also improve the functionality of traffic accidents detection systems. A purely collaborative WSN solution is proposed in [16], based on the fact that an accident causes two shockwaves in the traffic flow: one of them propagating in the opposite direction of traffic (upstream), forming a queue of stopped or slowing vehicles, and the other one propagating in the direction of traffic (downstream), decreasing the vehicle density beyond the incident. This method can be seen in practice in [17], where sensor nodes placed along the road estimate the traffic volume and detect potential shockwaves, which are then validated by the adjacent sensor nodes. However, it should be taken into account that most of the sensor nodes in a WSN are so resource constrained that it is not feasible to run more advanced protocols on them. This type of protocol could be useful for the communication between WSNs located at distant places, and even for heterogeneous sensor nodes to communicate with each other. On the other hand, although data aggregation mechanisms may be used with the sensor nodes, these mechanisms may not produce satisfactory results due to their own limitations. Hence, it is essential to perform the data aggregation at a sink node. If this is taken into account in the design of a proxy functionality for the sink nodes, it could help implement more advanced communications in WSN-based traffic control applications. In addition, such a proxy node could also act as a firewall for the WSN and help to simplify the functionality implemented by the sensor nodes as well.

3. Distributed Hash Tables DHT applications (introduced in Section 1) require a structured P2P network. There currently exist several structured P2P overlay network proposals, such as Chord [18], Pastry [19], Tapestry [20], and Kademlia [21]. The differences between them is the way in which nodes are organized in the overlay network. In Chord, the nodes are organized in a ring. However, in Pastry, Tapestry, and Kademlia, the nodes are organized in a tree structure [22]. On the other hand, more recent proposals, such as OneHop [23] and D1HT [24], try to implement one-hop overlays. In this kind of network, the peers maintain a full routing table and approach O (1)hop performance in DHT operations, compared to the O (log N) hop performance of multi-hop overlays, but at the cost of increased routing table updates and storage.

Please cite this article in press as: J.P. Muñoz-Gea et al., Design and implementation of a P2P communication infrastructure for WSN-based vehicular traffic control applications, J. Syst. Architect. (2013), http://dx.doi.org/10.1016/j.sysarc.2013.08.002

J.P. Muñoz-Gea et al. / Journal of Systems Architecture xxx (2013) xxx–xxx

In general, structured P2P networks offer a routing service to send a message, with an associated key, to a single node, responsible for that key. For this reason, this service is called Key-Based Routing (KBR). A common API to interact with the KBR service offered by any structured P2P network is described in [25]. The methods are as follows: void route (key k, msg m), which forwards a message m towards the node responsible for key k; void forward (key k, msg m, nodehandle nexthopnode), which is invoked from the structured P2P network layer of each node that forwards message m during its routing; and void deliver (key k, msg m), which is invoked from the structured P2P network layer of the node that is responsible for key k upon the arrival of message m. Any service offered by a DHT application can be implemented over the previous interface. The DHT abstraction provides the same functionality as a traditional hash table, that is, it implements a simple store and retrieves functionality, where the value is always stored at the overlay node to which the key is mapped by the KBR layer. The DHT application provides two operations: insert (key, value) and value = lookup (key). A simple implementation of insert () routes a PUT message containing a value and the local node’s nodehandle (S) using route (key, [PUT,value,S]). The node in charge of that key, upon receiving the message, stores the (key, value) pair in its local memory. On the other hand, the lookup operation routes a GET message using route (key, [GET,S]) to the node responsible for that key, and it returns the associated value directly to the source node using its nodehandle (S).

4. Design of the P2P communication infrastructure In this paper, we assume a scenario as shown in Fig. 1, where a number of WSNs are deployed in different geographic locations. The distance from one WSN to another can be tens of kilometers or more. Thus, it is impossible for the sensor nodes in one WSN to communicate with the nodes in another WSN. The sensor nodes are assumed to be battery powered and have very constrained

3

computational capability. Under these assumptions, one proxy is introduced into each WSN in order to connect the WSNs together. This proxy node is both wireless wide area network (WAN) and WSN enabled. To simplify the problem, we assume the underlying WAN link technology is a 3G connection, since this is a mature technology and easily accessible. Finally, in order to interconnect the proxy nodes, a DHT infrastructure is developed. This infrastructure is based on the DHT-based prototype developed in our previous paper, [26]. As indicated previously, the road network consists of intersections and road segments. Each road segment (the portion of road located between two intersections) is associated with a proxy node, which will generate the corresponding road segment information after processing the data provided by the sensors. The traffic information for a road segment will be integrated into the DHT system using the SHA-1 hash of the road segment identifier as key. In some situations it is possible that a proxy node is responsible for generating the road segment information associated to more than one road segment: this depends on the distance between the proxy node and the sensing devices associated to the different road segments, and also on the amount of processing tasks performed by the proxy node. The proposed system will provide the traveling time of the different road segments. For this, it is necessary to assume that the proxy nodes have two different functions: they behave as sink nodes, but also as DHT nodes. In Fig. 1, there is also a special DHT node called PQI (Publish/Query Interface). This node will be accessed by the other DHT nodes in order to publish new information in the DHT storage system, and by external application/users to obtain specific traffic information. In this sense, it is necessary to consider that the PQI functionality could be provided by any DHT node. The extra functionality that it implements is only an interface with the DHT application, which helps proxy nodes and external applications/users to publish information and to query specific information, respectively. In addition to this, it is feasible that more than one DHT node implements the PQI functionality simultaneously. Therefore, introducing well-known techniques of load-balancing and backup it is possible to avoid bottleneck problems or single points of failure.

5. Implementation of the prototype The objective of the prototype is to return the traffic information (traveling time) of a road segment requested by users. Upon this service, it is possible to build other more advanced services, such as the path planning service which will be presented in Section 6. The architecture of the full prototype has been divided into a set of logical components which are illustrated in Fig. 2. 5.1. Distributed Access Service The Distributed Access Service (DAS) is composed of two components: the DHT application and the Publish/Query Interface. 5.1.1. DHT application There exist several free software implementations of structured P2P networks, such as Chimera (a C implementation of Tapestry), the Chord project (a C implementation of Chord), and FreePastry (a Java implementation of Pastry). From among these, FreePastry was selected because it is implemented in Java and because it is an active project under development at the MPI-MPG,1 although it initially started at Rice University in the USA. Fig. 1. Overall architecture.

1

http://www.mpi-inf.mpg.de.

Please cite this article in press as: J.P. Muñoz-Gea et al., Design and implementation of a P2P communication infrastructure for WSN-based vehicular traffic control applications, J. Syst. Architect. (2013), http://dx.doi.org/10.1016/j.sysarc.2013.08.002

4

J.P. Muñoz-Gea et al. / Journal of Systems Architecture xxx (2013) xxx–xxx

SSL

DHT node

SSL

SSL

DHT node SSL

DHT node

DHT node SSL

DHT APPLICATION RMI/SSL

ZigBee WSN

Proxy node

SOAP

PUBLISH/QUERY INTERFACE Query Itf. SOAP SOAP Publish Itf.

SOAP

QUERY APPLICATION

Fig. 2. Distributed Access Service architecture.

We have implemented our own DHT application over the FreePastry software. The public methods (insert (), lookupUrl (), and lookupTravelingTime ()) of every DHT node in our implementation can be accessed by a remote application using Java RMI, which is a Java API performing the object-oriented equivalent of remote procedure calls (RPC). The prototype of the previous methods is as follows: public Boolean insert (MessageDigest key, String url, float travelingTime) public String[] lookupUrl (MessageDigest key) public float lookupTravelingTime (MessageDigest key). The insert method has three parameters: String url represents the URL of the proxy node query interface with information about a specific road segment; MessageDigest key represents the SHA-1 hash of the road segment identifier; and float travelingTime represents the current traveling time of the road segment. The FreePastry software is in charge of routing the message to the node responsible for key. That node will insert the key, the url, and the TravelingTime into its MySQL database. The communication between our Java application and the database is implemented by the JDBC driver. This method returns a Boolean that indicates whether the insert operation has been properly finished. The traveling time of road segments is the default information provided by our system to users, and it will also be used by the path planning service (presented in Section 6) to calculate optimal routes. However, if the user is interested in any other parameter related to the traffic situation, they can be accessed using the URL of the corresponding proxy node: the lookupUrl () method returns the URL of the proxy node query interface associated to the road segment with key key, and the lookupTravelingTime () method returns the traveling time associated to the road segment with key key. 5.1.2. Publish/Query Interface This interface was implemented as a Web Service using three methods available through SOAP operations: publish (), queryUrl (), and queryTravelingTime (). A web service is defined by the W3C as ‘‘a software system designed to support interoperable machine-to-machine interaction over a network.’’ It has an interface described in a machine-processable format, called the Web Services Description Language (WSDL). There are currently several frameworks for programming Java Web Services, but we selected the JAX-WS implementation since it directly supports all the major Web Service standards. In this respect, the enterprise pack of the NetBeans development environment supports JAX-WS very well. The publish () method of the web service implementation has three parameters: the SHA-1 hash of the road segment identifier, the URL where the information related to the road segment is available, and the traveling time of the road segment. The web service has been previously configured with the URL where the RMI

stubs of all the DHT nodes are available. Therefore, the web service randomly selects one of the DHT nodes of the network, it obtains its RMI stub, and then calls the insert () method of the DHT application. After calling the insert () method, the web service received the information as to whether or not the insert operation has been performed correctly. The queryUrl () and the queryTravelingTime () methods only accept one parameter: the SHA-1 hash of a road segment identifier. These methods randomly select one of the DHT nodes and call the RMI lookupUrl () or lookupTravelingTime () methods of the DHT application. Then, the web service receives the requested information which will be returned to the application which called the queryUrl () or the queryTravelingTime () methods. 5.1.3. Query application This is a very simple program which allows a user to make queries to the deployed prototype. It accepts a road segment identifier and returns the URL associated to the proxy node with information about that road segment, and the current traveling time in that road segment. In order to do that, the application implements a web service client which interacts with the queryUrl () and the queryTravelingTime () methods of the publish/query web service interface. 5.2. Traveling time calculation Each road segment has an associated proxy node which provides updated information about the traffic conditions in the corresponding road segment. A proxy node obtains the traffic measurements (vehicle count, occupancy and speed data) from one or more sensors located along the road section. As previously mentioned, the traveling time of the road segments is the default information provided by our system to the users, and it will also be used by the route calculation service to compute optimal routes. For this reason, we are going to present the processing procedure to obtain this value [27]. Given the speed at time t and location x on a road section, we can estimate the traveling times by computing the vehicle trajecto~ i ; xj Þ be the measured speed at the discrete times t i and ries. Let Vðt locations xj , and let Vðt; xÞ be the actual speeds for all times and locations. The proxy node receives speed estimates periodically from one or more sensors located along the road section. ^ xÞ be the approximation to the actual speed Vðt; xÞ. Let Vðt; ^ xÞ is found by interpolating between the four measurements Vðt; closest to ðt; xÞ in space and time (see Fig. 3). Let us define a distance function dðt 1 ; x1 ; t 2 ; x2 Þ by

dðt 1 ; x1 ; t2 ; x2 Þ ¼

qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ððt1  t 2 Þv 0 Þ2 þ ðx1  x2 Þ2 ;

ð1Þ

Please cite this article in press as: J.P. Muñoz-Gea et al., Design and implementation of a P2P communication infrastructure for WSN-based vehicular traffic control applications, J. Syst. Architect. (2013), http://dx.doi.org/10.1016/j.sysarc.2013.08.002

J.P. Muñoz-Gea et al. / Journal of Systems Architecture xxx (2013) xxx–xxx

where v 0 is the normalized road speed, which is set to 50 km/h. Let  di be the distance between (t; x) and point i, and let di be the inverse  ^ xÞ can be computed multiplicative of di ; that is: di ¼ 1=di . Then, Vðt; by

^ xÞ ¼ Vðt;

8 P4 ~  > < Pi¼1 V i di

if di – 0 for all i

> :~ Vi

if di ¼ 0 for some i;

4

d i¼1 i

ð2Þ

~ i is the measured speed at point i (i = 1, 2, 3, 4). where V Given a departure time t 0 and a starting location x0 on the road section, the above formula allows estimating a discrete trajectory (t 0 ; x0 ), (t 1 ; x1 ), . . ., (tn ; xn ), where each successive point is computed from the previous one using the speed at that point:

^ m ; xm Þðtmþ1  t m Þ þ xm : xmþ1 ¼ Vðt

5

network is divided into different subnetworks, delimited by the bold lines. The points where the bold lines cut the road segments are known as boundary points. In fact, the boundary points of a subnetwork can be interpreted as the set of points through which one can leave that zone. In this paper, the optimal route between any pair of points in a given road map is calculated in two steps. First, the optimal route between each pair of boundary points in the network is continuously updated, thanks to the route calculation tasks performed by specific DHT nodes and an adaptive routing protocol (OSPF). Second, the optimal routes from each road segment in the network to its adjacent boundary points are easily calculated on-demand by other specific DHT nodes with the needed knowledge to perform this task.

ð3Þ

The traveling time of a road segment between location x0 and xdest , departing at time t 0 , is found by counting the time it takes for the discrete trajectory to reach the end point. After obtaining an updated value of the traveling time, the proxy node calls the publish () method of the Publish/Query Interface. This method has three parameters: a key, which corresponds to the SHA-1 hash of the road segment identifier; a URL, which corresponds to the URL of the query interface of the proxy node; and the new traveling time. 6. Path planning service As mentioned previously, multilevel network methods [9–12] divide a large network of roads into several smaller zones or subnetworks. An example is shown in Fig. 4-a, where the original

Fig. 3. Approximation of the speed at point (t; x) from measured speeds at points 1, 2, 3 and 4.

6.1. Description The topographical road map is divided into different subnetworks, and each one of them receives a unique identifier (SN-ID). The DHT node responsible for the SHA-1 hash of a SN-ID becomes the Subnetwork Manager (SM) of that subnetwork. In the same way, each boundary point of a subnetwork also receives a unique identifier (BP-ID), and the DHT node responsible for the SHA-1 hash of a BP-ID becomes the Routing Manager (RM) of that boundary point. The different proxy nodes receive the identifiers of the subnetwork (SN-ID) in which their road segments are included. Thanks to this identifier, each proxy node will be able to inform the corresponding SM about the identifiers of the road segments to which they are associated, using the DHT application. Each RM also receives the identifiers of the two subnetworks in which it is involved and, using the same mechanisms as before, they inform the corresponding SMs about their identities. Thanks to this communication mechanism, all the SMs know the identifiers of all the road segments and all the RMs in their subnetwoks. With this information, it will be able to obtain the optimal routes within its subnetwork. On the other hand, the RMs can request the previous identifiers to the SMs of the two subnetworks in which they are involved. Using these identifiers, together with the topographical information, an RM associated to a boundary point is able to access the traveling times associated to each road segment located in both subnetworks, and then it can calculate the optimal routes from the boundary point to the rest of boundary points in both subnetworks, using the Dijkstra algorithm [28] (see Fig. 4-b). Once the optimal routes between the boundary points of neighboring subnetworks are pre-computed, they are configured as the paths (edges) in the second-level network. In this new scenario, a distributed routing algorithm is used to obtain the optimal route

Fig. 4. A road network segmentation into subnetworks. (a) The subnetworks with their boundary points. (b) The optimal route between adjacent boundary points. (c) The optimal route between all boundary points. In (b) and (c), to reduce the complexity of the diagram, only the paths from one boundary point are shown.

Please cite this article in press as: J.P. Muñoz-Gea et al., Design and implementation of a P2P communication infrastructure for WSN-based vehicular traffic control applications, J. Syst. Architect. (2013), http://dx.doi.org/10.1016/j.sysarc.2013.08.002

6

J.P. Muñoz-Gea et al. / Journal of Systems Architecture xxx (2013) xxx–xxx

between any possible pair of boundary points in the road map (see Fig. 4-c). For that, we have implemented a version of OSPF (Open Shortest Path First) [29], an adaptive link-state routing protocol for IP networks, which uses the traveling time as a weight for route calculation. The message exchange remains the same as in the original protocol. To sum up, the SM nodes are responsible for optimizing the route from a road-segment to a boundary point (and vice versa), and the RM nodes are responsible for optimizing the route between any pair of boundary points. 6.2. Implementation RM nodes implement the OSPF protocol. Like all link-state routing protocols, the database of each RM is identical, describing the complete topology of the network. To maintain an identical and synchronized database, each RM (responsible for a boundary point) periodically sends to the RMs in charge of the other boundary points located in the adjacent subnetworks a description of the optimal routes from its boundary point to the rest of the boundary points in the adjacent subnetworks. As a result of the OSPF process, every RM stores a new routing table with an entry associated to each subnetwork composing the whole network, with the following information: the identifier of the subnetwork (SN-ID), the route between the boundary point and the corresponding subnetwork, and the cost associated to this route. Next, we present the integration of the path planning service within our DHT-based prototype. We have added a new public method to our DHT application, called route_calculation (), which can also be accessed by a remote application using Java RMI. The prototype of the previous method is public Object[] route_calculation (MessageDigest originSubnetwork, MessageDigest originSegment, MessageDigest destinationSubnetwork, MessageDigest destination Segment). This method has four parameters: the SHA-1 hashes of the subnetworks containing the origin and destination points, and their road segment identifiers. It returns an array of Objects which contains the identifiers of all the road segments in the optimal route between the origin and the destination points. The route_calculation () method of the DHT node routes a message to the node responsible for the origin SN-ID, that is, the corresponding SM. Then, this node performs three tasks:  First, it sends requests, to all the RMs responsible for the boundary points in that subnetwork, for their entries in the (OSPF) routing table towards the destination subnetwork.  Then, it calculates the optimal routes from the origin road segment to all the boundary points in the subnetwork, by using the Dijkstra algorithm. With the cost associated to these routes, and the cost associated to the routes towards the destination subnetwork, the SM is able to obtain the optimal route from the origin road segment to the destination subnetwork.  Finally, it asks the SM of the destination subnetwork to calculate the final portion of the route, from the corresponding boundary point towards the destination road segment. After finishing the previous process, the road segment identifiers of the optimal route between the origin and the destination road segments are added to an Object array and it is returned. This method is called on-demand, just when a user needs the service. We have also added a new method to the Web Service Publish/ Query Interface, called route (). The route () method accepts two parameters: the road segment identifier containing the origin point and the road segment identifier containing the destination point. This method is able to obtain the identifiers of the subnetworks in which the origin and destination points are located, and then

calculates their SHA-1 hashes. Then, it selects one of the DHT nodes and it calls the RMI route_calculation () method of the DHT application. After that, the Web Service receives the previous Object array, with all the necessary information to represent the route. All this information will be returned to the application which called the route () method. 6.3. Route presentation The last step in the route reconstruction process is the graphical representation of the received data so that the information can be easily understood and interpreted by the final user. This functionality has been added to the previously presented Query Application. This application implements a new Web Service client which interacts with the route () method of the Publish/Query Web Service interface. With the information received, the program represents the optimal route between the specific origin and destination points. 7. Performance evaluation The prototype presented in Section 5 and the service presented in Section 6 have been completely implemented and tested in a lab scenario. This deployment has been performed using host and network virtualization techniques, thanks to the use of KVM [30] and OpenNebula [31]. Several measures have been obtained from the experiments accomplished in this virtualized scenario. However, we consider that these results are not concluding enough due to the fact that they have been obtained in a virtualized environment. Due to the previous reasons, we decided to present in this section a graphical representation of the theoretical complexity of the mechanisms proposed in this work. We consider that this is an easy way to perceive the potential benefits of our proposal. It is well-known in the routing literature that the complexity of the Dijkstra algorithm is O (n2 ), where n is the number of network nodes. When optimizing the traveling time in path planning services, the road segments play the role of network nodes. Therefore, in traditional path planning solutions, where the Dijkstra algorithm is applied and considers all the road segments in the city, the complexity of the service is also O (n2 ). In big cities, the large number of streets can make this solution very resource consuming. However, in our proposal, the road network is segmented into a set of subnetworks. As previously presented, the RMs are responsible for calculating the optimal route between any pair of boundary points in each subnetwork, and the SMs are responsible for optimizing the route from a specific road segment to any boundary point in the subnetwork (and vice versa, when arriving at the des2 tination subnetwork). Both tasks involve a complexity of O (ðn=kÞ ), where the number of road segments n in the subnetwork is the same for both procedures, and k is the number of subnetworks. Fig. 5 compares the complexity of the Dijkstra algorithm as a function of the urban area (in km2) in the common range of European cities, for different numbers of subnetworks (k). Each one of these curves describes the asymptotic behavior of this algorithm for specific values of k, as a function of the number of road segments (n) in the network. This means that the real complexity of the system will be always lower than the one represented in this figure. The case of k ¼ 1 refers to the scenario in which the algorithm considers all the road segments in the city, while in the other cases, the road network is divided into k subnetworks. The maximum value of k evaluated in this figure has been 9. The main reason for this decision was that we detected that the complexity of the system does not decrease significantly for higher values of k. These results have been obtained while assuming a road segment density equal to 64 road segments per km2, which corresponds

Please cite this article in press as: J.P. Muñoz-Gea et al., Design and implementation of a P2P communication infrastructure for WSN-based vehicular traffic control applications, J. Syst. Architect. (2013), http://dx.doi.org/10.1016/j.sysarc.2013.08.002

7

J.P. Muñoz-Gea et al. / Journal of Systems Architecture xxx (2013) xxx–xxx

16000

8

x 10

10

Complexity

8

k=1 k=3 k=5 k=7 k=9

14000

k=1 k=3 k=5 k=7 k=9

12000 10000 Complexity

12

6

8000 6000

4

4000 2000

2

0

0 0

100

200

300

400

500

0

100

400

500

2

2

to the average road segment density in the city of Barcelona (Spain). The most remarkable conclusion from this figure is the enormous reduction in complexity when the road network is divided into subnetworks. This complexity reduction means a lower level of resource consumption and also of time delays caused by the algorithm resolution. On the other hand, the maximum possible complexity of the Dijkstra algorithm corresponds to the curve represented for k ¼ 1. That is, the asymptotic behavior of this algorithm is given by that curve, independently of the value of k. On the other hand, it is also necessary to assume that the routes between any pair of boundary nodes are automatically calculated by the OSPF protocol. This process runs in background during the operation of the path planning service. The number of calculations that must be performed by any RM in the network implementing the OSPF protocol is proportional to n log n, where n is the total number of RMs in the network. Fig. 6 compares the complexity of the OSPF protocol as a function of the urban area (in km2), for different numbers of subnetworks (k). There are a couple of important conclusions that can be extracted from this figure. First of all, in this case, the complexity increases when k increases. Logically, increasing the number of subnetworks means increasing the number of boundary points in the network, and also the number of Routing Managers n, which makes the expression n log n increase. However, if we compare these results with the results presented in Fig. 5, it is clearly seen that the complexity associated to this procedure is much lower that associated to the Dijkstra algorithm (note the differences in the y-axis scales). Therefore, in global terms, the complexity of the total system decreases when the number of subnetworks increases. Finally, another parameter of interest is the lookup time for the optimal routes between specific origin and destination road segments. This mainly depends on the lookup time in the DHT network. For the Pastry case, it is estimated that this time is O (log n), where n is the number of nodes in the DHT network. This number corresponds with the number of sink nodes, which is at most equal to the number of road segments (in some situations it is possible that the number of sink nodes is lower than the number of road segments, as was discussed in Section 4), and it is independent of the number of subnetworks. Therefore, during the development phase of the infrastructure presented in this paper, it would be necessary to consider how many DHT nodes are strictly necessary, in order not to increase unnecessarily the response time of the system.

300

Urban Area (Km )

Urban Area (Km ) Fig. 5. Comparison of route calculation complexities as functions of the number, k, of subnetworks.

200

Fig. 6. Comparison of OSPF complexities as functions of the number, k, of subnetworks.

8. Conclusions This paper studied a scenario where a number of WSNs are scattered in different geographic locations, with the objective of sensing the environment for ITS applications. Under this assumption, one proxy node was introduced into each WSN in order to connect the WSNs together. This proxy node was both wireless wide area network (WAN) and WSN enabled, and it was connected to all the proxy nodes using a DHT overlay. It was assumed that each road segment had an associated proxy node. Under this assumption, the traffic information of the road segments was integrated into the data structure of the DHT using the SHA1 hashes of the road segments identifiers as the keys. The default information offered by the system was the traveling time of the different road segments, which was generated by the corresponding proxy nodes after processing the data provided by the sensor nodes. The traveling time of the road segments was also used by a path planning service to calculate optimal routes. Our future work will focus on extending the proposed system by evaluating parameters such as the realibility in a real scenario. Furthermore, new enhancements to balance the storage data load or to care for the reliability of the data will be included, as well as, the capabilities to provide satisfying end-to-end security service. Acknowledgments This research was supported by the MINECO/FEDER Project Grant TEC2010-21405-C02-02/TCM (CALM) and was also developed in the framework of the ‘‘Programa de Ayudas a Grupos de Excelencia de la Región de Murcia, de la Fundación Séneca, Agencia de Ciencia y Tecnología de la RM (Plan Regional de Ciencia y Tecnología 2007/2010).’’ References [1] F. Losilla, A.-J. Garcia-Sanchez, F. Garcia-Sanchez, J. Garcia-Haro, Z.J. Haas, A comprehensive approach to WSN-based ITS applications: a survey, Sensors 11 (11) (2011) 10220–10265. . [2] I.F. Akyildiz, W. Su, Y. Sankarasubramaniam, E. Cayirci, A survey on sensor networks, IEEE Communications Magazine 40 (8) (2002) 102–114. [3] M. Hiyama, E. Kulla, T. Oda, M. Ikeda, L. Barolli, Application of a MANET testbed for horizontal and vertical scenarios: performance evaluation using delay and jitter metrics, Human-centric Computing and Information Sciences 1 (3) (2011) 1–14.

Please cite this article in press as: J.P. Muñoz-Gea et al., Design and implementation of a P2P communication infrastructure for WSN-based vehicular traffic control applications, J. Syst. Architect. (2013), http://dx.doi.org/10.1016/j.sysarc.2013.08.002

8

J.P. Muñoz-Gea et al. / Journal of Systems Architecture xxx (2013) xxx–xxx

[4] X. Zhou, Y. Ge, X. Chen, Y. Jing, W. Sun, A distributed cache based reliable service execution and recovery approach in MANETs, Journal of Convergence 3 (1) (2012) 5–12. [5] P. Sarkar, A. Saha, Security enhanced communication in wireless sensor networks using Reed–Muller codes and partially balanced incomplete block designs, Journal of Convergence 2 (1) (2011) 23–30. [6] L.S.C. of the IEEE Computer Society, Wireless Medium Access Control (MAC) and Physical Layer (PHY) Specifications for Low-Rate Wireless Personal Area Networks (LR-WPANs), IEEE, IEEE Std 802.15.4-2006 ed., New York, 2006. [7] S.C. Ergen, ZigBee/IEEE 802.15.4 Summary, 2004. [8] A. Aikebaier, T. Enokido, M. Takizawa, Trustworthy group making algorithm in distributed systems, Human-centric Computing and Information Sciences 1 (6) (2011) 1–15. [9] N. Jing, Y.-W. Huang, E.A. Rundensteiner, Hierarchical optimization of optimal path finding for transportation applications, in: Proceedings of the Fifth International Conference on Information and Knowledge Management, CIKM ’96, ACM, New York, 1996, pp. 261–268. [10] N. Jing, Y.-W. Huang, E.A. Rundensteiner, Hierarchical encoded path views for path query processing: an optimal model and its performance evaluation, IEEE Transactions on Knowledge and Data Engineering 10 (1998) 409–432. [11] S. Jung, S. Pramanik, An efficient path computation model for hierarchically structured topographical road maps, IEEE Transactions on Knowledge and Data Engineering 14 (2002) 1029–1046. [12] S.M. Feng Wen, K. Hirasawa, Fast computation method for route calculation, in: Proceedings of the 2011 International Conference on Mechatronic Science, Electric Engineering and Computer, 2011, pp. 1857–1860. [13] Y.-S. Chang, T.-Y. Juang, C.-Y. Su, Wireless sensor network assisted dynamic path planning for transportation systems, in: Proceedings of the 5th International Conference on Autonomic and Trusted Computing, ATC ’08, Springer-Verlag, Berlin, 2008, pp. 615–628. [14] C. Wenjie, C. Lifeng, C. Zhanglong, T. Shiliang, A realtime dynamic traffic control system based on wireless sensor network, in: Proceedings of the International Conference on Parallel Processing, 2005, ICPP ’05, 2005, pp. 258–264. [15] M. Shuai, K. Xie, X. Ma, G. Song, An on-road wireless sensor network approach for urban traffic state monitoring, in: Proceedings of the 11th International IEEE Conference on Intelligent Transportation Systems, ITSC ’08, 2008, pp. 1195–1200. [16] D. Gazis, The origins of traffic theory, Operations Research 50 (2002) 60–77. [17] M. Chowdhury, K. Wang, R. Fries, Y. Ma, D. Bagaria, A distributed wireless sensor network system for transportation safety and security, in: Proceedings of the SPI, the International Society for, Optical Engineering, 2007, pp. 1–9. [18] I. Stoica, R. Morris, D. Liben-Nowell, D.R. Karger, M.F. Kaashoek, F. Dabek, H. Balakrishnan, Chord: a scalable peer-to-peer lookup protocol for internet applications, IEEE/ACM Transactions on Networking 11 (1) (2003) 17–32. [19] A. Rowstron, P. Druschel, Pastry: scalable, distributed object location and routing for large-scale peer-to-peer systems, in: IFIP/ACM International Conference on Distributed Systems Platforms (Middleware), Heidelberg, Germany, 2001, pp. 329–350. [20] B.Y. Zhao, L. Huang, J. Stribling, S.C. Rhea, A.D. Joseph, J. Kubiatowicz, Tapestry: a resilient global-scale overlay for service deployment, IEEE Journal on Selected Areas in Communications 22 (1) (2004) 41–53. [21] P. Maymounkov, D. Mazières, Kademlia: a peer-to-peer information system based on the XOR metric, in: IPTPS ’01: Revised Papers from the First International Workshop on Peer-to-Peer Systems, London, 2002, pp. 53–65. [22] H. Balakrishnan, M.F. Kaashoek, D. Karger, R. Morris, I. Stoica, Looking up data in P2P systems, Communications of the ACM 46 (2) (2003) 43–48. [23] P. Fonseca, R. Rodrigues, A. Gupta, B. Liskov, Full-information lookups for peerto-peer overlays, IEEE Transactions on Parallel and Distributed Systems 20 (9) (2009) 1339–1351. [24] L. Monnerat, C. Amorim, Peer-to-peer single hop distributed hash tables, in: Proceedings of the 28th IEEE Conference on Global Telecommunications, GLOBECOM ’09, 2009, pp. 4250–4287. [25] F. Dabek, B. Zhao, P. Druschel, J. Kubiatowicz, I. Stoica, Towards a common API for structured peer-to-peer overlays, in: Proceedings of the 2nd International Workshop on Peer-to-Peer Systems (IPTPS03), Berkeley, CA, 2003, pp. 33–44. [26] J.P. Munoz-Gea, J. Malgosa-Sanahuja, P. Manzanares-Lopez, J.C. SanchezAarnoutse, Implementation of traceability using a distributed RFID-based mechanism, Computers in Industry 61 (5) (2010) 480–496. [27] C. Chen, Freeway performance measurement system (PeMS), Ph.D. thesis, University of California at Berkeley, Berkeley, CA, USA, 2002. [28] E.W. Dijkstra, A note on two problems in connection with graphs, Numerical Mathematics 1 (1959) 269–271. [29] J. Moy, OSPF Version 2, Available from: (April 1998). [30] KVM (Kernel-based Virtual Machine), Available from: (June 2011).

[31] OpenNebula – Open Source Data Center Virtualization, Available from: (May 2013).

Juan Pedro Muñoz-Gea received the Master’s Degree in Telecommunications Engineering in 2005 from Universidad Politécnica de Cartagena (UPCT), Spain. In 2006, he started working as a research assistant at UPCT where he obtained his PhD in 2011. Currently, he works as an assistant professor in the Department of Information and Communication Technologies at UPCT. His research interests are focused on overlay networks and peer-to-peer systems.

Pilar Manzanares-Lopez received the Engineering degree in Telecommunications in 2001 from the Technical University of Valencia (UPV), Spain. In April 2006, she received the Ph.D. degree in Telecommunication from the Polytechnic University of Cartagena (UPCT), Spain. She is an Assistant Professor at the Department of Information Technologies and Communications (Polytechnic University of Cartagena) since 2001. She has been involved in several National research projects related to multicast technology and multimedia facilities. She is the co-author of several papers in the fields of transport protocols and distributed systems.

Josemaria Malgosa-Sanahuja received the Telecommunication Engineering degree in 1994 from the Polytechnic University of Catalonia (UPC), Spain. In November 2000, he received the Ph.D. degree in Telecommunication from the University of Zaragoza (UZ), Spain. He has been an assistant professor at the Department of Electronic and Communications Engineering (University of Zaragoza) since 1995. In September 1999, he joined the Polytechnic University of Cartagena (UPCT), Spain, as associated professor. He has been involved in several National and International research projects related to multicast technologies (switching and protocols), multimedia value-added services design and in-home/building networks design. He is author of several papers in the fields of switching, multicast technologies and distributed systems. He is regional correspondent of the Global Communications included in the IEEE Communications Magazine since 2002. His research group has been awarded with the Excellent Research Group honorable mention in the Spanish’ Murcia Region.

Joan Garcia-Haro is a Professor at the UPCT, Spain. He is author or co-author of more than 60 journal papers mainly in the fields of switching and performance evaluation. From April 2002 to December 2004 he served as EIC of the IEEE Global Communications Newsletter. He is Technical Editor of the same magazine from March 2001. He also holds an Honorable Mention for the IEEE Comm. Society Best Tutorial paper Award (1995).

Please cite this article in press as: J.P. Muñoz-Gea et al., Design and implementation of a P2P communication infrastructure for WSN-based vehicular traffic control applications, J. Syst. Architect. (2013), http://dx.doi.org/10.1016/j.sysarc.2013.08.002