This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| access:track_statistics_definitions [2015/10/27 23:03] mjallison | access:track_statistics_definitions [2016/12/22 18:37] (current) mjallison | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| The following statistics are computed from various track. The meanings and definitions of each statistic is as follows: | The following statistics are computed from various track. The meanings and definitions of each statistic is as follows: | ||
| + | * Track_Line: The connected line of locations along a single track | ||
| * Travel: The total length of the track from the first point to the last point. | * Travel: The total length of the track from the first point to the last point. | ||
| - | * Cycle_Count: (Cycle_Line/Track intersections) / 2 | + | * Cycle_Count: (Track_Line/Track intersections) / 2 | 
| - | * Cycle_Time: Time from first cycle xing to last xing | + | * Cycle_Time: Same as Moving_Time | 
| * Avg_Seconds_Per_Cycle: Cycle_Time / Cycle_count | * Avg_Seconds_Per_Cycle: Cycle_Time / Cycle_count | ||
| - | * Moving_Time: The time during which a vehicle moves during the entire day | + | * Moving_Time: The time during which a vehicle moves during the entire day. | 
| * Average_Speed: Travel / Moving_Time | * Average_Speed: Travel / Moving_Time | ||
| * Average_Cycle_Length: Travel / Cycle_Count | * Average_Cycle_Length: Travel / Cycle_Count | ||
| Line 17: | Line 18: | ||
| Notes: | Notes: | ||
| - | * Lengths are computed by linear X-Y projected distances between adjacent track points. \\ | + | * Lengths are computed by linear X-Y projected distances between adjacent track points. (track altitude is ignored) | 
| - | (track altitude is ignored) | + | |
| * If Working_Time is not defined, Morning_Start == Track_Start, Afternoon_End == Track_End, no lunch period. | * If Working_Time is not defined, Morning_Start == Track_Start, Afternoon_End == Track_End, no lunch period. | ||
| * The "Moving" (for Moving_Time) is defined as: | * The "Moving" (for Moving_Time) is defined as: | ||
| + | * time between adjacent points < 3 seconds AND | ||
| + | * velocity between points > 0.5 FP | ||
| + | |||
| + | |||
| + | Example loop to calculate moving time and moving distance: | ||
| + | <code> | ||
| + | // Uses some trackwork conventions for methods, reader is encouraged to translate  | ||
| + | // to the appropriate idiom for their environment. | ||
| + | |||
| + | // | ||
| + | // Points are assumed to be order in time such that time(pt[0]) < time(pt[1]) | ||
| + | // | ||
| + | int movingTime = 0; | ||
| + | float movingDistance = 0.0; | ||
| + | |||
| + | for( int i = 1; i < GetNPoints(); i++ ) | ||
| + | { | ||
| + | CAgVertex v1 = GetAgVertexAt(i); | ||
| + | CAgVertex prev = GetAgVertexAt(i-1); | ||
| + | |||
| + | time_t seconds = GetUTCTimeAtIndex(i).GetTimeT(); | ||
| + | time_t prevSeconds = GetUTCTimeAtIndex(i-1).GetTimeT(); | ||
| + | |||
| + | float distanceDelta = v1.Distance(prev); | ||
| + | int prevTimeDelta  = CAgTime::GetTimeDifferenceSeconds(GetUTCTimeAtIndex(i), GetUTCTimeAtIndex(i-1)); | ||
| + | float tmpspeed = (prevDelta > 0) ? distance/prevDelta : 0; | ||
| + | |||
| + | if( (prevDelta < idleTime) && (tmpspeed > idleFPS) ) | ||
| + | { | ||
| + | movingTime += prevTimeDelta; | ||
| + | movingDistance += distanceDelta; | ||
| + | } | ||
| + |  | ||
| + | printf( "Moving seconds: %d\n", movingTime ); | ||
| + | printf( "Moving feet : %d\n", movingDistance ); | ||
| + | }   | ||
| + | </code> | ||