# Evaluation of Deployment Challenges of Wireless Sensor Networks at Signalized Intersections
## 6 Application
### Application Architecture  
In our scenario we have deployed numerous sensors. Each one has common software to execute. Each node communicates its information to a common server. The server collects the information, and present the information to the users. As we have similar tasks at different locations, their results are collected in a common point, and it is not required any temporal restriction. We have deployed a message bus software architecture. The main advantage is the scalability of the approach, and minimization of application coupling. Each sensor can work independently.  
Figure 21 depicts the message bus architecture, which uses a software system that can receive and send messages using one or more communication channels, so that applications can interact without needing to know specific details about each other. Interaction between applications is accomplished by passing messages (asynchronously) over a common bus. We implement the message bus architecture using a messaging router, and it is implemented using message queuing.  
The motes placed around the scenario collect traffic information from sensors (microwave radar, image processing, infrared and ultrasonic in our case) and introduce it into the system by means of the message bus. The information sensed is persistently stored into a database. Data collected is analyzed in order to detect traffic congestion levels. Such congestion levels are presented to experts (traffic managers) in order to allow them to take decisions within the existing traffic control systems. The congestion level service may be used to provide real-time information to experts or either it could be embedded as part of a traffic control system. Figure 20 shows the traffic monitoring tool that  
Figure 20: Traffic monitoring tool.  
allows experts to visualize the traffic incidences observed by the sensor network. Making use of the publish/subscribe paradigm, the congestion level service pushes the traffic flows to those monitoring tools that have subscribed the service. In the same way, the traffic control system may also subscribe this service, so that the traffic control system has a new source of information to be considered in decision algorithms and internal processes.  
Data integration is performed at motes. Each mote collects the information from sensors and aggregates this information in order to minimize the number and length of traffic messages. Each mote communicates the information, using a ZigBee interface, to a gateway. The gateway inserts the information on the message bus where a set of parallel process manage the existing queues and store the information into a database. The message bus includes a set of message queues geographically distributed in order to collect information according to the geographical location of the sensors. The queue hierarchy allows the arranged gathering of the traffic information, avoiding duplicated or incomplete information. A pool of database connections allows maximizing the data insertion rate into the database. Figure 22 depicts the gathering process.  
Figure 21: Message bus software architecture.  
Figure 22: Queueing system and data insertion into the database.  
The message bus uses services for communication between the bus and components (sensors) attached to the bus. In addition, the bus provides services that transform message from one format to another, allowing sensors using incompatible message formats to communicate with each other. In Figure 19 we can see the capacity of the system in terms of number of users. This means applications can be hosted in the cloud instead of on an enterprise network. The cloud improves the scalability of the system, because multiple instances of motes can be attached to the bus in order to handle multiple requests at the same time.