Global Statistics
Persistent statistics system that accumulates data from all trips during the vehicle’s lifetime.
- Persistence: Data saved in NVS (survives restarts)
- Automatic update: Updated at the end of each trip
- Size: 62 bytes in RAM + NVS
QTPGTOT - Complete Statistics
Returns all global statistics with calculated averages.
>QTPGTOT<
>RTPGTOT,trips:1234,km:125430,fuel:45230.5,hrs:3520h0m,idle:420h0m,avgspd:35.6,avgfuel:36.1,idle_pct:11.9,avgsco:85;ID=...<| Field | Description |
|---|---|
trips | Total completed trips |
km | Total accumulated kilometers |
fuel | Total liters consumed |
hrs | Total driving hours |
idle | Total idle hours |
avgspd | Average speed (km/h) |
avgfuel | Average consumption (L/100km) |
idle_pct | Idle time percentage |
avgsco | Average score of all trips |
QTPGREC - Historical Records
Maximum and minimum values for the vehicle’s lifetime.
>QTPGREC<
>RTPGREC,maxspd:142,minspd:45,maxrpm:5240,minrpm:780,maxtmp:98.5,mintmp:15.2,bestsco:98,worstsco:42;ID=...<QTPGSCO - Global Scores
>QTPGSCO<
>RTPGSCO,avg:85,best:98,worst:42,count:1234;ID=...<QTPGGC - Accumulated Counters
Historical sum of all GC0-GC7 counters.
>QTPGGC<
>RTPGGC,gc0:1245,gc1:567,gc2:890,gc3:234,gc4:123,gc5:45,gc6:12,gc7:8;ID=...<Quick Queries
QTPGKMS - Total Kilometers
>QTPGKMS<
>RTPGKMS,125430; Total kilometers ;ID=...<QTPGTRIPS - Total Trips
>QTPGTRIPS<
>RTPGTRIPS,1234; Total trips ;ID=...<QTPGHRS - Total Hours
>QTPGHRS<
>RTPGHRS,total:3520h0m,idle:420h0m;ID=...<STPGRST - Reset Statistics
CAUTION! This operation is irreversible.
>STPGRST<
>RTPGRST,OK; Global stats reset ;ID=...<After reset:
- All accumulators return to 0
- Records are reinitialized
- Reset timestamp is saved
- Data is immediately saved to NVS
Use Cases
Fleet Monitoring
// Global odometer
>QTPGKMS<
>RTPGKMS,125430; Total kilometers
// Recorded trips
>QTPGTRIPS<
>RTPGTRIPS,1234; Total trips
// Average: 125430 / 1234 = 101.6 km per tripPreventive Maintenance
// Accumulated event counters
>QTPGGC<
>RTPGGC,gc0:1245,gc1:567,gc2:890,gc3:234,...
// With 125,430 km:
// gc0 (OVERSPEED): 1245 → 9.9 events/1000km
// gc3 (HARSH_BRAKE): 234 → 1.9 events/1000kmNever execute STPGRST without client confirmation - the data is irrecoverable.
Last updated