cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

How to get an activity graph and stats for vehicles?

LaurentGermain
10-Marble

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

ACCEPTED SOLUTION

Accepted Solutions
ibanham
12-Amethyst
(To:paic)

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

View solution in original post

3 REPLIES 3

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

ibanham
12-Amethyst
(To:paic)

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

ckulak
12-Amethyst
(To:ibanham)

Thanks a lot Ian, I got a whole bunch of useful insights from this comment!

Announcements


Top Tags