3 Replies Latest reply on Oct 21, 2015 11:00 AM by ckulak RSS
    laurentger Apprentice

    How to get an activity graph and stats  for vehicles?

    Hello,

     

    I have in a dataTable, the history of location and status for a vehicle:

     

    When it is moving, i have a record with timestamp, location and eventType=Drive.

     

    When the vehicle stops i have a record with timestamp, location and eventType=Stop.

     

    It is not obvious to get stats from such data, so can someone help to answer the following ?

     

    I need to extract from this:

     

    * % of time vehicle was driving vs stopped

    * get a graph with average speed when vehicule was not stopped

    * get a graph like this one to display for each vehicle when he was used, and display in blue/green/yellow based on average seed.Capture.GIF

    * Display a graph that display for a specific day

      • Re: How to get an activity graph and stats  for vehicles?
        paic Collaborator

        I think you can 'somewhat' build that with the Range Chart

          • Re: How to get an activity graph and stats  for vehicles?
            ianban Creator

            Hi Laurent

             

            I think you need to do a bit more processing of your data. When your Stop event fires, you need to find the previous Drive event and calculate the time between the two events and store that in a cumulative drive-time property. Likewise, for Drive events you need to find out the time between now and the previous Stop event, store this in a cumulative stop-time property - depending on your needs, you may need to filter out some of these or you'll be including the time the vehicle is parked. If you're recording this on a daily basis use a scheduled event to reset the cumulative properties once a day. You can always log these two properties so you can show activity on a chart later.

             

            % time driving vs % time stopped is now simple math using the two properties.

             

            Average Speed, assuming you're logging this on a regular basis, then at each stop event, you can work this out from (sum of speed readings since drive started) / number of readings. If you're using a valuestream then this is harder to do as you will only get readings when the value changes. If you're recording GPS position, you may be able to calculate average speed based on the route information.

             

            For the graph have two number properties, isDriving and isStopped. Set them to 10 when true, 0 when false. Log the properties. Display using a bar chart.

             

            Hope this helps

             

            Regards

             

            Ian