RoutesMobilityModel

From Nsnam
Revision as of 06:35, 28 January 2015 by TiagoCerqueira (Talk | contribs) (Documentation)

Jump to: navigation, search

Main Page - Current Development - Developer FAQ - Tools - Related Projects - Project Ideas - Summer Projects

Installation - Troubleshooting - User FAQ - HOWTOs - Samples - Models - Education - Contributed Code - Papers

Project Overview

  • Student: Tiago Cerqueira
  • Mentors: Tom Henderson and Scott Carpenter
  • On-Site mentor Michele Albano
  • Abstract: Mobility trace generation in ns-3 is done either by using the Mobility module included in NS-3 or by importing mobility traces generated by third party programs in a compatible format. The Mobility module included in ns-3 gives programmers the building blocks to create simple or complex traces, but is hindered by the fact that creating complex traces using the current module alone takes too long, even for simulations with just a couple of mobility capable nodes. As for mobility traces generated by third party programs, such as SUMO, they can involve too much work for their generation, especially when the researcher's interest - and expertise - is more on the data communication than on the traffic simulation. Using the Google Maps API it is possible to generate complex mobility traces, simply by providing a start and end point. Since the API is robust, well documented and supported, it can be assumed it will be available in the future.
  • About me: I'm a bachelor's student, currently doing an internship at CISTER (Research Center in Real-Time and Embedded Computing Systems) as part of my course's curriculum, where I'm working closely with ns-3. As part of my internship, I’ll be working closely with VANET simulations in ns-3.

Approach

I plan to download a mobility trace as the XML output of the Google Maps Directions API. This API provides its user with an encoded polyline string, which can be easily transformed into geographical coordinates. These, in turn, can be transformed into Cartesian coordinates for use with the NS-3 mobility module. I plan to use in particular ns3::Waypoint and ns3::WaypointMobilityModule classes to import the data contained in the XML trace into the simulator. I plan to allow easy integration for other APIs, if needed, but I'm not going to implement it in this project. I will also provide examples with different wireless technologies, such as LTE and 802.11p/WAVE.

Deliverables

I plan to add classes to the Mobility model to contact the Google API and parse the information received into geographical coordinates. By converting those coordinates to Cartesian coordinates it is then possible to create mobility waypoints It is also possible to provide a rough simulation for the speed at which a node can travel between given waypoints, by considering the speed limits in the tract for a car, and using default values for cycling, walking, and public transportation.

Plan

Each Milestone includes a period of half a week dedicated to test that milestone.

  • First and second week – Design the application and further study its implementation
  • Third and fourth weeks – Implement the design skeleton and implement methods for specifying the information to access and to convert that information to a format that NS-3 can understand
  • Fifth and sixth weeks – Implement methods for converting the information given by Google Maps into waypoints in order to generate a trace based on the Google Maps route. Develop an algorithm to set up reasonable values for the speed of the car/person between two waypoints.
  • Seventh and eight weeks – Perform exhaustive testing to the functionalities implemented.
  • Ninth and tenth weeks – Correct existing bugs and prepare patch

Code repository

My code can be found here

Status Reports

Per agreement with my mentors, I opted for status reports instead of weekly reviews. The idea behind these code reviews is to post one once I accomplish a milestone.

First Status Report

I set my first milestone as being able to generate a mobility trace given real world start and endpoints (street names, for example), from the ns3 simulation environment.

Notes

The ns3::WaypointMobilityModel works by adding ns3::Waypoints to a dequeue sequentially.

The Google Maps Directions service, however, provides an XML that contains the following concepts:

  • Leg - A Leg is a list of Steps. Legs only occur if the user specifies a Waypoint (A to B, passing through C)
  • Step - A Step contains Points encoded in a polyline
  • Point - A latitude/longitude set

To create a mobility trace, my module uses a list of Legs, each one containing a list of Steps and these, in turn, with a list of points.

At the time, the ns3::WaypointMobilityModel defines a journey as an ordered (by time) sequence of ns3::Waypoints. My module defines journey as a list of Legs, with each Leg having a list of Steps and each Step with a list of Points.

Module Design

In order to provide a robust module, it was crucial to design it in such a way that it could be possible to add support for other APIs (such as the OpenStreetMaps's). To achieve this, the Strategy design pattern was used.

Use Cases

I identified the following use cases:

Create mobility trace for a node

  • Name: Create mobility trace for a node
  • Actors: User
  • Description: The user is able to request the module to generate a mobility trace for a single node, based on a given real world route.
  • Preconditions:
  1. The user has internet access
  2. The user possesses a valid API key
  3. The Google Maps Directions service identifies correctly the start and endpoint provided

Create mobility traces for various nodes

  • Name: Create mobility traces for various nodes
  • Actors: User
  • Description: The user is able to request the module to generate a mobility trace for a fixed number of nodes, based on a real world route.
  • Preconditions:
  1. The user has internet access
  2. The user possesses a valid API key
  3. The user provides a list or an array of start and endpoint tokens correctly
  4. The user provides the same number of start and endpoint tokens as nodes in the node container
  5. The Google Maps Directions service identifies correctly the start and endpoint provided

Automatic creation of mobility traces for a node container

  • Name: Automatic creation of mobility traces for a node container
  • Actors: User
  • Description: The user is able to request the module to generate a mobility trace for various nodes, based on a real world route.

This use case will require further study as how to implement it in a way that it is able to generate mobility traces for all nodes in a numerous node container (1000 nodes, for example).

I'm planning on using the Google Maps Places service to generate the start and endpoint tokens required, but due to a few limitations of the service, I'll need to find a workaround to support numerous node containers.

For this iteration, this feature was not implemented

Summary

In summary, these past weeks I achieved the following:

  • Designed the module
  • Coded the classes responsible for performing the API request and treat the information received into a format ns3 can understand
  • Coded use cases: "Create mobility trace for a node" and "Create mobility traces for various nodes"
  • Documented the application using Doxygen and with UML Diagrams

Bellow, you can view the class diagram, the use case diagram and the sequence diagram for the "Create mobility trace for a node" use case.

Second Status Report

For this second status report, my milestones where: Providing an offline mode to the module, automatic generation of mobility traces for a node container of any size, the ability to redirect a node to a different destination dynamically and implementing error handling and logging.

A few notes on the Google Maps Places API

The Google Maps Places API was chosen to provide the module with start and endpoints. The idea was to use this huge database to gather a huge number of start and endpoints and use this in conjunction with the previously developed functionalities.

Unfortunately, due to a limitation of the API, only 60 addresses can be returned in a single search. In order to achieve automatic generation of mobility traces for a node container of any size, the user must input a list with tokens of latitude and longitude.

Another approach might be to use every address of those 60 addresses and creates mobility traces using every one of them as start and endpoints. This would generate mobility traces for 3540 nodes, but the mobility trace might be too geographically compact, and the nodes would essentially keep traveling using many of the same streets/freeways, etc. This was not implemented at this time, but could be implemented in the future.

Changes to the Module Design

In order to allow the addition of other sources of information of real-world places, I used the Strategy Design Pattern. To perform automatic generation of mobility traces for an entire node container, I had to add the following classes to my model: ns3::PlacesApiConnect - An interface for the connection of an API with real-world locations. ns3::GoogleMapsPlacesApiConnect - An implementation of the above interface, responsible for performing the connection to the Google Maps Places service ns3::Place - A logical representation of a real-world location. ns3::SaxPlacesHandler - The parser responsible for parsing the information retrieved from the Google Maps Places service

Changes to the Use Cases

For this status report, I'm adding a couple of use case suggestions made by my mentors.

Create mobility trace for nodes

  • Name: Create mobility trace for a node
  • Actors: User
  • Description: The user is able to request the module to generate a mobility trace for a single node, based on a given real world route.
  • Preconditions:
  1. The user has internet access
  2. The user possesses a valid API key
  3. The Google Maps Directions service identifies correctly the start and endpoint provided

Automatic creation of mobility traces for a node container

  • Name: Automatic creation of mobility traces for a node container
  • Actors: User
  • Description: The user is able to request the module to generate a mobility trace for various nodes, based on a real world route.
  • Preconditions:
  1. The user has internet access
  2. The user possesses a valid API key
  3. The user provides the correct coordinates

Create a mobility trace for a node using a local XML file

  • Name: Create a mobility trace for a node using a local XML file
  • Actors: User
  • Description: The user is able to generate a mobility trace based on a XML file downloaded to the local filesystem.
  • Preconditions:
  1. The file exists and is valid

Create mobility traces with dynamic node redirections

  • Name: Create mobility traces with dynamic node redirections
  • Actors: User
  • Description: The user is able to generate a mobility trace for a node that, at a specified point in time, is redirected to another destination.
  • Preconditions:
  1. The user has internet access.
  2. The user has provided valid start and endpoints. The redirection address must also be valid.
  3. The Google Maps Directions service identifies correctly the start point, the end point and the redirection address.

Summary

In summary, these past few weeks I've achieved the following:

  • Implemented every use case mentioned, such as node redirection, automatic mobility trace generation and an offline mode.
  • Documented every function introduced with Doxygen
  • Implemented error handling
  • Implemented logging
  • Updated UML documentation

Documentation

In addition to the Doxygen documentation, the existing UML documentation was updated to include the new functionalities. Bellow, you can view the final class diagram, the final use case diagram, the sequence diagram for the "Create mobility trace for a single node" use case and the sequence diagram for the "Automatic creation of mobility traces for a node container" use case.

Additional documentation was created using sphynx, which documents the module in further detail. This documentation will be available in the ns-3 models documentation once the module is released.

Dependencies

This module is dependent of the following libraries:

  • libcurlpp
  • Xerces-C++
  • GeographicLib