Presentation is loading. Please wait.

Presentation is loading. Please wait.

11 Processing Data Dr. Miguel A. Labrador Department of Computer Science & Engineering

Similar presentations


Presentation on theme: "11 Processing Data Dr. Miguel A. Labrador Department of Computer Science & Engineering"— Presentation transcript:

1 11 Processing Data Dr. Miguel A. Labrador Department of Computer Science & Engineering labrador@csee.usf.edu http://www.csee.usf.edu/~labrador

2 2 Copyright© Dr. Miguel A. Labrador 2 2 Outline Mobile Device-side Processing Server-side Processing

3 3 Copyright© Dr. Miguel A. Labrador 3 3 Mobile Device-side Processing The Critical Point Algorithm

4 4 Copyright© Dr. Miguel A. Labrador 4 4 Distance-Based Critical Point Algorithm (DB-CPA) First fix is marked as critical and sent to server Distance from every valid coordinate to the last critical point is calculated –If the distance is greater than some distance threshold, then the last valid coordinate is marked as critical and sent to the server –If the distance is less than the threshold then the algorithm compares the Horizontal Dilution of Precision (HDOP) values of the last critical point and the last valid point A lower HDOP value means better precision, therefore, if the last valid coordinate has a lower HDOP than the last critical, then the last valid coordinate is marked as critical point If neither of the two conditions described above marks the last valid coordinate as critical, then the elapsed time from the last critical point to this last valid coordinate is calculated. If the elapsed time is greater than a time threshold, then the last valid coordinate is marked as critical

5 5 Copyright© Dr. Miguel A. Labrador 5 5 Distance-Based Critical Point Algorithm (DB-CPA) The thresholds play an important role in the algorithm –If the distance threshold is set too high, then many details of the path traversed by a field client will not be sent to the server –If the distance threshold is set too low, then many coordinates will be sent, incrementing the network and server processing overhead –In our current implementation, the distance threshold is set to 20 meters This means that the field client will send a location update every second only if it is moving at a rate faster than 20 m/s (72 Km/h) – Also in our current implementation, we have kept the time threshold to 30 seconds –These two values can be easily changed to any other value that will make better sense and provide better performance to the system according to the tracking application.

6 6 Copyright© Dr. Miguel A. Labrador 6 6 Distance-Based Critical Point Algorithm (DB-CPA)

7 7 Copyright© Dr. Miguel A. Labrador 7 7 Short Trip – All Points

8 8 Copyright© Dr. Miguel A. Labrador 8 8 Short Trip – Critical Points Only

9 9 Copyright© Dr. Miguel A. Labrador 9 9 Long Trip – All Points

10 10 Copyright© Dr. Miguel A. Labrador 10 Copyright© Dr. Miguel A. Labrador 10 Long Trip – Critical Points Only

11 11 Copyright© Dr. Miguel A. Labrador 11 Copyright© Dr. Miguel A. Labrador 11 Distance Based Critical Point Algorithm (DB CPA) TripTotal Number of GPS Fixes Fixes Sent by DB CPA Short24759 (23%) Long768218 (28%)

12 12 Copyright© Dr. Miguel A. Labrador 12 Copyright© Dr. Miguel A. Labrador 12 Server-side Processing Many possibilities, as server has current and historical data –Entire picture of the application and users Path prediction algorithm based on current data and past behavior Finding friends, restaurants, etc. Geo-fencing Geo-sensing Geo-advertisement based on user profile Situational awareness Traffic alert and emergency notifications Etc.

13 13 Copyright© Dr. Miguel A. Labrador 13 Copyright© Dr. Miguel A. Labrador 13 Situational Awareness Wireless sensor network with intrusion detection capabilities integrated into the LBIS Upon an intrusion detection, the WSN takes a picture and sends a message to the LBIS server The LBIS server notifies the control station sending a message that also includes the picture The LBIS server checks if there is any users within a radius of 100 meters from the WSN, and if so, it sends a message with picture to each of those users –Needs to track each user and calculate distances from each user to the location of the WSN

14 14 Copyright© Dr. Miguel A. Labrador 14 Copyright© Dr. Miguel A. Labrador 14 Situational Awareness

15 15 Copyright© Dr. Miguel A. Labrador 15 Copyright© Dr. Miguel A. Labrador 15 Intrusion in Main Control Station

16 16 Copyright© Dr. Miguel A. Labrador 16 Copyright© Dr. Miguel A. Labrador 16 View in Field Client Device

17 17 Copyright© Dr. Miguel A. Labrador 17 Copyright© Dr. Miguel A. Labrador 17 Calculating the Distance Between Two Users In order to send notifications, the server needs to calculate the distance between the WSN and the individual active users If distance is less than threshold (100 meters), then server sends a notification message to the user –Otherwise, the user is not notified PostGIS has functions that make those calculations for you –ST_distance_sphere returns minimum distance in meters between two lon/lat geometries This function currently does not look at the SRID of a geometry and will always assume its in WGS 84

18 18 Copyright© Dr. Miguel A. Labrador 18 Copyright© Dr. Miguel A. Labrador 18 Calculating Closest Distance to a Point double distance = Double.MAX_VALUE; TrackingUpdate theClosestOne = new TrackingUpdate(); try { try{ javax.naming.InitialContext ic = new javax.naming.InitialContext(); javax.sql.DataSource dataSource = (javax.sql.DataSource)ic.lookup("jdbc/lbsbook"); Connection theConnection = dataSource.getConnection(); double latitude = Double.parseDouble(request.getParameter("lat")); double longitude = Double.parseDouble(request.getParameter("lng")); PreparedStatement queryStatement = theConnection.prepareStatement("select fieldsession.sessionid as sesid, fielduser.username as uname, ST_AsText(tracking.position) as pos, ST_distance_sphere(tracking.position, ST_GeomFromText('POINT(? ?)', 32661)) as distance"+“ from fieldsession, tracking,fielduser, select max(idtracking) as idtrack"+"from fieldsession, tracking"+"where fieldsession.datestop is NULL and fieldsession.sessionid = tracking.sessionid“+"group by fieldsession.sessionid) as s2“+"where fieldsession.datestop is NULL and“+"fieldsession.sessionid = tracking.sessionid and“+"tracking.idtracking = s2.idtrack and“+"fieldsession.iduser = fielduser.iduser”);

19 19 Copyright© Dr. Miguel A. Labrador 19 Copyright© Dr. Miguel A. Labrador 19 Calculating Closest Distance to a Point queryStatement.setDouble(1, longitude); queryStatement.setDouble(2, latitude); ResultSet rs = queryStatement.executeQuery(); double d_temp = 0.0; while(rs.next()) { d_temp = rs.getDouble("distance"); if(d_temp < distance) { theClosestOne.setSessionid(rs.getInt("sesid")); theClosestOne.setUsername(rs.getString("uname")); Point theNewPoint = new Point(rs.getString("pos")); theClosestOne.setLongitude(theNewPoint.getX()); theClosestOne.setLatitude(theNewPoint.getY()); distance = d_temp; } String theReturnString = "<"; theReturnString = theReturnString + ";“ +theClosestOne.getUsername()+";"+theClosestOne.getsessionId()+";“ +theClosestOne.getLongitude()+";"+theClosestOne.getLatitude()+">"; out.write(theReturnString); }

20 20 Copyright© Dr. Miguel A. Labrador 20 Copyright© Dr. Miguel A. Labrador 20 Calculating Closest Distance to a Point catch (NamingException ex){ Logger.getLogger(DevicerServiceManagerImpl.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex){ Logger.getLogger(DevicerServiceManagerImpl.class.getName()).log(Level.SEVERE, null, ex); } finally { out.close(); }


Download ppt "11 Processing Data Dr. Miguel A. Labrador Department of Computer Science & Engineering"

Similar presentations


Ads by Google