[
https://issues.apache.org/jira/browse/QUARKS-21?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15216281#comment-15216281
]
ASF GitHub Bot commented on QUARKS-21:
--------------------------------------
Github user mnwone commented on a diff in the pull request:
https://github.com/apache/incubator-quarks/pull/49#discussion_r57754004
--- Diff:
test/svt/src/main/java/quarks/test/svt/apps/GpsAnalyticsApplication.java ---
@@ -0,0 +1,216 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+package quarks.test.svt.apps;
+
+
+import java.util.concurrent.TimeUnit;
+import com.google.gson.JsonObject;
+import quarks.connectors.iot.QoS;
+import quarks.test.svt.utils.sensor.gps.GpsSensor;
+import quarks.test.svt.utils.sensor.gps.SimulatedGeofence;
+import quarks.test.svt.utils.sensor.gps.SimulatedGpsSensor;
+import quarks.topology.TStream;
+import quarks.topology.TWindow;
+import quarks.topology.Topology;
+
+/**
+ * GPS analytics
+ * <p>
+ * Source is a stream of GPS sensor data {@link GpsSensor}
+ * <p>
+ * Here's an outline of the topology
+ * <ul>
+ * <li>Log GPS coordinates by publishing to IotF. The data may be used by
a server application to display the vehicle on a map.
+ * </li>
+ * <li>Filter to detect speeds above a threshold and publish alert IotF
+ * </li>
+ * <li>Filter for GPS coordinates that are outside of a defined Geofence
boundary
+ * </li>
+ * <li>Windowing to detect hard driving: hard braking or hard acceleration
and publish alert to IotF
+ * </li>
+ * </ul>
+ * <p>
+ */
+public class GpsAnalyticsApplication{
+
+ private final FleetManagementAnalyticsClientApplication app;
+ private final Topology topology;
+
+ //TODO: make these configurable properties
+ boolean trackGpsLocation = true;
+ boolean trackSpeeding = true;
+ boolean trackGeofence = true;
+ boolean trackHardDriving = true;
+ // Hard braking and acceleration thresholds may depend on the vehicle
model
+ double hardBrakingThreshold_MphPerSec = -8.25;
+ double hardAccelerationThreshold_MphPerSec = 7.37;
+ String driverId = "driver1";
+ String VIN = "123456";
+ double maxSpeed_Mph = 70;
+
+
+ static double MILES_PER_HOUR_TO_METERS_PER_SEC = 0.44704;
+ double METERS_PER_HOUR_TO_MILES_PER_SEC = 1 /
MILES_PER_HOUR_TO_METERS_PER_SEC;
+ // Convert 70 miles per hour to meters to sec
+ double MAX_SPEED_METERS_PER_SEC = maxSpeed_Mph *
MILES_PER_HOUR_TO_METERS_PER_SEC ;
+ static double MPS_TO_MPH = 3.6;
+
+
+ public GpsAnalyticsApplication(Topology t,
FleetManagementAnalyticsClientApplication app) {
+ this.topology = t;
+ this.app = app;
+ }
+
+ /**
+ * Add the GPS sensor analytics to the topology.
+ */
+ public void addAnalytics() {
+
+ // Generate source GPS data
+ SimulatedGpsSensor g = new SimulatedGpsSensor();
+ TStream<GpsSensor> gpsSensor = topology.poll(() -> g.nextGps(),
500, TimeUnit.MILLISECONDS);
+
+ // Publish GPS data to IotF every 1 second
--- End diff --
The thinking was that a server application can have a real-time
visualization of a map displaying all the vehicles. In general, I agree the
goal is to run analytics on the car and minimize transmission cost.
Is publishing every 10 secs more reasonable?
Will make the comment and code consistent.
> Create test application using GPS/OBD sensors
> ---------------------------------------------
>
> Key: QUARKS-21
> URL: https://issues.apache.org/jira/browse/QUARKS-21
> Project: Quarks
> Issue Type: Improvement
> Components: Test
> Reporter: May Wone
> Assignee: May Wone
> Priority: Minor
> Labels: test
>
> I’m looking at creating a ‘Fleet Management’ application that uses simulated
> GPS and On-Board Diagnostics aka OBD data.
> Here are some initial thoughts:
> h4. GPS
> Create a simulated GPS sensor that reads in saved real GPS data collected
> from my Garmin (say from a drive from IBM SVL to IBM research). The GPS
> sensor will read from a .csv file that contains extracted relevant data from
> a .gmz file.
> h5. Potential applications:
> 1. Send GPS data to say, Kafka. Potentially, there can be a server
> application to track the fleet of vehicles in real time (ex. vehicles moving
> on a map).
> 2. Speeding monitor – filter for > 70mph
> 3. Geofence exception monitor if the vehicle is outside the Geofence
> boundaries (simple definition). This may indicate the vehicle is lost,
> stolen, or making an unauthorized trip.
> 4. …
> h4. OBD
> Create a simulated OBD sensor that reads in made-up data.
> h5. Potential applications:
> 1. Send alert if a sensor value is out of range. For example, engine oil
> temperature overheating.
> 1a.. Battery voltage low, ….
> 2. Send alert for Diagnostic Trouble Codes.
> 3. Show simple embedded analytics (more complex analytics requires domain
> knowledge). For example:
> 3a. Hard braking (>7mph) - send alert to driver and send alert to on
> server. A metric can count the number of such incidents.
> 3b. Hard acceleration (> ? mph)
> 3c. Ignition off & motion detected(GPS) -> possible towing
> 3d. …
> Comments?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)