Location Tracker     

Provides visual representation of real time location data of assets.

 

SUMMARY

 

To develop a Swing based applet application, which provides a real-time and historical locations of an asset (eg: hospital equipments, patients, employees etc) in a visual form.

TECHNOLOGIES

 

1.      Eclipse 3.2 IDE for development, debugging.

2.      JBoss-4.0.4.GA as the web server.

3.      SVN version control for versioning and code delivery.

4.      Ant for our build and remote deploy.

5.      Programming Language: Java (jdk 1.5)

6.      PostgreSQL8.1 as the database

7.      Hibernate is used as the object/relational persistence

8.      Java\Swings for Visual Mapper.

9.      JMS for feeding the location data.

 

 

PROJECTS IMPLEMENTATION DETAILS

 

This applet pulls a stream of location co-ordinates data from a web server and plots the location on X-Y graph. It provides the following options to the user. It draws a particular location as a map. It represents different zones in a location as circles. It shows the location of the assets.

Based on the co-ordinate and map information obtained from an RTLS engine, the map will be populated with asset information. If an asset’s location changes, the asset’s position on the map will be redrawn. This project also supports Active and Passive RFID technology. Unlike RTLS where the co-ordinate information will be provided by an external engine, for active and passive RFID technology, Web Application will need to have logic to identify where to show the assets in the map. This involves two steps – a design-time step of understanding how the site is made up of (what constitutes a room, where are readers located, etc), and a run-time step of displaying asset information on a visual map.

 

Design-Time:

In order to support displaying visual location information of passive assets, we need to get information of what constitutes an area (such as a room). In order to deduce the current location of an item based on where it was seen, we need to get information about where readers are positioned on the map.

 

Run-Time:

In order to display the location of the asset, the system shall launch an applet using JNLP technology. Applet shall provide various options for the user to select. Based on the selection the applet shall fetch the data from the Web application to draw the position of the asset on the map. The position of the asset drawn on the applet shall continuously be updated based on the data rendered by an external engine.

 

Following shall be the features provided by the applet:

Ř       User shall be able to select an area (such as a room). Applet shall draw the location of all the assets in the area selected.

Ř       User shall be able to select an asset. Applet shall draw the location of the selected asset.

Ř       User shall be able to select a date (with time) and an area or asset. Applet shall display the location of the assets based on the date selected.

Ř       Upon rendering the response based on the user selected option(s), applet shall start to record the drawing to provide fast forward and re-wind functionalities.

Ř       Applet shall be able to display the details of an asset when the user moves the mouse over the asset.

 

 

As shown in Figure 1, the Applet communicates to the Web Application through Http connection. Web Application fetches the location information from a JMS Queue and supplies to the Applet for displaying.


 

Figure 1

 

Following are the challenges that we had while developing this project:

1. Develop the Applet as a client application to display the real time view of the equipments using the data received from the web application.

 

2. Communication between the Applet and the web Application is established through an Http Connection using a servlet.

 

3. Develop a JMS client Application to generate the test data. We developed a JMS client that feeds data continuously to the JMS Queue and another JMS client that fetches the data from the JMS Queue and stores into the database.

 

4. Applet shall be launched through JNLP technology. On launch, it shall start 2 threads. One shall be responsible for co-coordinating the effort to display the data and other to collect the data over the network from web application. We shall call the former thread as “Data Displayer” and the later as “Data Collector”.  These two threads share a common object called “Data Repository”.

 

DataRepository:

DataRepository object is a HashMap. Its key shall represent the asset and the value shall be an ArrayList of Location objects. Location object encapsulates assetID, mapID, timestamp, x and y positions. MapID is a unique representation of the area an asset belongs to. DataRepository is updated by Data Collector and the information in it is retrieved by Data Displayer.

 

For instance, we have 5 assets (say Asset1, Asset2, Asset3, Asset4 and Asset5) in MapID = MapID1 then the data in DataRepository object would like

 

Key

Value

Asset1

ArrayList <Location>

Index

Object

1

Location1

2

Location2

3

Location3

4

Location4

5

Location5

6

Location6

7

Location7

8

Location8

9

Location9

Asset2

 

Asset3

 

Asset4

 

Asset5

 

                                     

Figure 2

 

Data Displayer:

This thread shall fetch the data from DataRepository object. It shall draw the location of an asset at the speed set by the user. Figure 2 shows life cycle representation of this thread.

 

Figure 3

 

This thread shall wait for a predefined amount of time till enough of data is accumulated in the DataRepository object. Data shall be retrieved in batch mode from DataRepository object.  Every time data is retrieved, this thread shall maintain a marker on the DataRepository object for an asset. This marker shall help this thread to identify the next index from where it has to start to read the data. Once a set of data is gathered, the locations of the assets are drawn on the area selected. Upon completion of the current data set, this thread shall check with DataRepository object (based on the marker set earlier) if there are enough data to draw the locations during the next cycle. If there is enough data then this thread shall fetch the next pre-defined amount of data starting from the marker that was set earlier otherwise this thread shall not update the location until there is new data for an asset in DataRepository object.

 

For example,

Ř       At the beginning, this thread waits until it is notified by Data Collector thread.

Ř       Upon receiving notification, this thread shall read pre-defined set of data from DataRepository (let’s say 2 amount of the pre-defined data set). The marker shall be

Key

Value

Marker Position

 
Asset1

ArrayList <Location>

Index

Object

1

Location1

2

Location2

3

Location3

4

Location4

5

Location5

6

Location6

7

Location7

8

Location8

Asset2

ArrayList <Location>

Index

Object

1

Location1

2

Location2

3

Location3

4

Location4

5

Location5

Asset3

ArrayList <Location>

Index

Object

1

Location1

2

Location2

3

Location3

4

Location4

5

Location5

6

Location6

7

Location7

 

Ř       Next cycle

Ř        

Key

Value

Asset1

ArrayList <Location>

Index

Object

1

Location1

2

Location2

3

Location3

4

Location4

5

Location5

6

Location6

7

Location7

8

Location8

Asset2

ArrayList <Location>

Index

Object

1

Location1

2

Location2

3

Location3

4

Location4

5

Location5

Asset3

ArrayList <Location>

Index

Object

1

Location1

2

Location2

3

Location3

4

Location4

5

Location5

6

Location6

7

Location7

 

Ř       In the next cycle, since the marker is at 5 for Asset2 and does not have enough of data the location of the asset will not be updated.

Key

Value

Asset1

ArrayList <Location>

Index

Object

1

Location1

2

Location2

3

Location3

4

Location4

5

Location5

6

Location6

7

Location7

8

Location8

Asset2

ArrayList <Location>

Index

Object

1

Location1

2

Location2

3

Location3

4

Location4

5

Location5

Asset3

ArrayList <Location>

Index

Object

1

Location1

2

Location2

3

Location3

4

Location4

5

Location5

6

Location6

7

Location7

New Asset Added

 
Asset4

ArrayList <Location>

Index

Object

1

Location1

2

Location2

3

Location3

 

Figure 4

 

Data Collector:

          This thread will start before the Data display thread. It connects to the SAM web server to collect the location points of the all equipments based on the search options selected by the user. Before it notifies the Data display thread it collects data for a predefined amount of time. Every time data is appended to DataRepository. Data is received in terms of predefined fixed number of rows.

 

Following are the features of Location Tracker:

User can select:

Ř       The mode as current Location or History Location.

Ř       The starting date from which the user is interested to view the location of equipments.

Ř       Depending on the category selected, the available data for the selected category will be populated in the dropdown Box.

Ř       User can vary the speed of movement.

 

Figure 7 shows couple of equipments location changing over different zones on a map.

 

Figure 7

 

When the user selects Category ‘Map’, the dropdown Box will be populated with the available location maps. When User selects any map from the list, the map and the different zones on that map will be displayed. The configuration data for the zones comes from the properties file. The location data of the equipments for the selected map will be fetched from the database and drawn continuously on the map.

                             

When Category ‘Asset’ is selected all the available assets will be listed in the dropdown box. When user selects a particular asset, its location data will be fetched from the database and drawn continuously on the map. When the asset’s location changes from one map to other, map will be redrawn.