How to Use Historical GPS Data to Plan EV Charging Infrastructure for Heavy-Duty Fleets

How to Use Historical GPS Data to Plan EV Charging Infrastructure for Heavy-Duty Fleets

This is a proof of work from a heavy-duty EV deployment. I spent three weeks watching a depot charging plan fail. The problem was not the charger spec. It was the planning method. We had 12 weeks of vehicle tracking data from 48 heavy-duty electric trucks, but the first layout used average daily distance. That number looked clean. It was also wrong. Heavy-duty vehicles return to the depot with different state of charge because payload, grade, weather, route mix, and driver behavior all change the energy balance. If you size chargers on the average, you either buy too much hardware or strand trucks at the end of the day.

A professional, photorealistic exterior view of a heavy-duty fleet depot at dusk, showing several large electric trucks parked at charging bays, industrial lighting casting long shadows on wet asphalt, a technician in high-visibility clothing walking between vehicles, clean composition with no visible text, signage, or letters

Why the first charger plan failed

The initial plan assumed every truck needed a 150 kW DC fast charge after 180 km. The depot had room for nine chargers. The electrical panel could support six. We needed a number that would hold under real duty cycles, not a spreadsheet average.

The bottleneck was stop detection. Our fleet management GPS tracking units were sending pings every 15 minutes. That interval is fine for route monitoring. It is too coarse for charging planning. A 15-minute ping gap can hide a 12-minute charge, a 20-minute driver break, or a 45-minute customer wait. The data looked like continuous movement. It was not.

I also had a driver trainer problem: I could see that route energy use varied by driver, but I could not isolate the cause from the tracking feed alone. My MC license tells me that a 40-tonne truck does not behave like a passenger car. A hard brake, a slow start, or a loaded 8% grade can change the day's energy draw more than an extra 10 km.

What I changed in the GPS data pipeline

I rebuilt the data path around three questions: Where did the truck stop? How long did it stay stopped? What was its likely battery state when it arrived?

I moved the historical GPS data into Postgres with PostGIS. The pipeline ingested 1.4M pings from 48 trucks over 12 weeks. I filtered invalid points first: speed over 120 km/h, duplicate timestamps, heading jumps over 90 degrees, and points outside the service geofence. The script does not crash on missing pings; it marks gaps and fills them only when the gap is under 90 seconds.

A professional, photorealistic close-up of a technician installing an external GPS antenna and CAN bus connector on the roof of a heavy-duty electric truck, overcast daylight, shallow depth of field, hands wearing work gloves, clean industrial setting, no visible text, labels, or letters

Stop detection: 10-second pings, 8-minute dwell, 50-meter minimum move

For the pilot, I enabled 10-second pings on 12 trucks while moving and 30-second pings while stationary. I then wrote a Python script that grouped pings into trips using a 10-minute, 250-meter break rule. A stop was counted when speed stayed under 2 km/h for at least 8 minutes and the next move was more than 50 meters.

That gave me a stop table, not just a track line. Each stop had start time, end time, location, dwell duration, and the distance traveled since the previous stop. I classified stops by geofence: depot, customer site, layover, and charging point.

Energy model: payload, grade, and pack temperature

Distance alone was not enough. I built a simple energy model in Python. It used vehicle mass, payload estimate, rolling resistance, drag, air density, and grade from 10-meter elevation data. For heavy-duty trucks, I set rolling resistance at 0.012, drag coefficient at 0.62, and frontal area at 9.5 square meters. Regenerative braking was modeled at 70% recovery on downhill sections. Heating and cooling were added as a 4 to 8 kWh per hour adjustment based on ambient temperature.

I also added a CAN bus module to the pilot trucks. It read battery state of charge, pack temperature, charge state, and available power. That hardware change mattered. GPS tells you where the truck is. The CAN feed tells you whether the battery can accept a 150 kW charge at that moment.

Charger sizing: available dwell time, not maximum power

The charging plan used the 10% to 80% charge curve for the battery pack. I did not use the full 0% to 100% range, because the tail of the curve is slow and the depot needs throughput. For each trip, the model calculated the energy needed to reach the minimum departure state of charge, then divided that by the available dwell time at the depot or customer stop.

The rule was simple. If the required power was under 150 kW and the dwell time was over 25 minutes, the stop was a viable fast-charge window. If the required power exceeded 150 kW, the truck needed a longer stop, a higher-power unit, or a route change. That turned the charging question into a time-and-energy calculation.

The benchmark: 6 chargers instead of 9

After the rebuild, the plan changed. The historical data showed that only 31% of depot arrivals needed a full 150 kW fast charge. The rest arrived with enough state of charge for a 40 to 60 minute top-up. The lowest 5% of arrivals were at 22% state of charge on loaded uphill routes, and the top 5% of departures reached 78% when the driver used the full dwell window.

A professional, photorealistic interior view of a fleet operations office at night, a large monitor showing a map with multiple vehicle route lines and stop clusters, a second laptop showing a clean grid of colored squares, warm desk lighting, clean desk with a coffee cup and notebook, no visible text, labels, or letters

What the 12-week pilot showed

The pilot covered 48 trucks, 1.4M GPS pings, 32,000 stops, and 9,800 charging or layover events. The final layout used six 150 kW DC chargers instead of nine. The hardware saving was $214,000. The planning review time dropped from 14 days to 3 days. During the pilot, no truck was scheduled to leave the depot below 25% state of charge, and the average departure state of charge was 74%.

The data also surfaced a driver safety issue. Three drivers consistently had higher energy use on the same route. The difference was not route length. It was acceleration and braking pattern. I used that as a training point, not a penalty. The historical telemetry made the coaching conversation specific.

The lesson I keep

Historical GPS data is not a dashboard. It is a duty-cycle model. Real-time data tells you where a truck is now. Historical data tells you where the charger should be. For heavy vehicle logistics, the charger count is not decided by maximum range. It is decided by arrival state of charge, available dwell time, pack temperature, payload, and the driver's actual route behavior.

If the data does not make the job easier for the driver and the dispatcher, it is not useful. The pipeline marks gaps, and it does not pretend that every truck is the same. It separates the trucks that need a fast charge from the trucks that only need a top-up. That is the difference between a charging plan that works on paper and one that works at the depot.