Logistics Intelligence Series | Module 1 of 6

Truck dwell time prediction:
The invisible costs at the loading bay

How an LSTM model uses your existing telematics data to forecast which customers are systematically slowing down your fleet - and what that really costs your dispatch operation.

Model scenario - fictional data

This module is part of a six-part worked example about a fictional mid-sized logistics company (150 trucks, 43 regular customers). All figures, datasets, model metrics and euro amounts are fully simulated - they illustrate the methodology and the order of magnitude of the achievable effect. They are not results of real clients and not a performance promise. What values are achievable on your real data is established only in a pilot project.

01 The dwell-time problem everyone knows - but nobody measures

Why dwell times are the blind spot in your cost calculation

Every dispatcher knows: at certain customers the truck waits at the loading bay far longer than planned. But how much longer? And what does it really cost? The data already exists in your system - telematics timestamps, order history, GPS positions. It just isn't being connected.

In this notebook we show how a deep-learning model (LSTM) learns from exactly this data to predict dwell times - per customer, per weekday, per load type. The result: a concrete euro figure that shows which routes are systematically costing you money.

Telematik-Daten
Feature Engineering
LSTM Training
Prediction
€-Wirkung

02 Data foundation - what your system already knows

Synthetic data reflecting real telematics structures

We simulate the dataset of a mid-sized logistics company with 150 trucks, 43 regular customers and approximately 18,000 visits over 12 months. The data fields match what typical telematics systems (Fleetboard, TomTom, Trimble) and ERP systems provide.

▸ Example values - method illustration, not a performed analysis
Dataset: 18.000 Anfahrten, 43 Kunden
DatumAnkunftKundeBrancheRampenLadungstypGewichtStandzeit
2024-01-1508:23K-007Automotive4Komplett18.3t32.4 min
2024-01-1509:41K-012FMCG2Stückgut5.7t67.8 min
2024-01-1511:52K-003Baustoffe1Komplett23.1t94.2 min
2024-01-1607:15K-028Pharma6Teilladung3.2t22.1 min
2024-01-1610:08K-019Lebensmittel3Komplett14.9t58.6 min

03 Exploratory analysis - where the dwell-time pattern hides

The data already speaks before we train a model

Average dwell time by weekday
↳ Insight

Mondays show average dwell times around a third higher than Wednesdays. The reason: backlog from weekend deliveries processed on Monday. Friday afternoons show a second peak - warehouse staff is reduced before the weekend.

Top 10 customers by average dwell time (minutes)
↳ The Hidden Cost Driver

Customer K-003 (building materials, 1 bay) has an average dwell time of 89 minutes - almost double the overall average. With 420 visits per year, this single customer generates €18,585 in mathematically avoidable dwell costs above the 30-minute target window. That doesn't appear in any invoice.

04 Feature engineering - from data point to signal

What the model needs to know to predict dwell times

▸ Example values - method illustration, not a performed analysis
Feature-Matrix: 12 Features × 18.000 Samples

The key trick: kunde_rolling_avg - the rolling average of the last 20 visits per customer. This single feature explains ~40% of the variance. It encodes the implicit knowledge your dispatchers carry in their heads ("deliveries to Müller always take forever") - but as an exact number.

05 LSTM model - sequences rather than individual values

Why a recurrent network sees more here than classical regression

A simple XGBoost could already deliver good results. But an LSTM (Long Short-Term Memory) can additionally learn that dwell times at a customer are increasing over time - for instance when a warehouse is losing capacity or reducing staff. It recognises trends within trends. In practice we start with gradient boosting - the LSTM shows the upgrade path.

The model uses an attention mechanism: it learns on its own which of the last visits are most relevant to the current prediction. For a customer currently reorganising their warehouse, it weights the most recent data points more heavily.

06 Results - what the model sees

Trained on 80% of the data, evaluated on the last 3 months

12 min
MAE (LSTM)
0.72
R² Score
24%
MAPE
16 min
MAE (Baseline)
↳ Interpretation

The LSTM model predicts dwell time with an error of ±12 minutes - 25% more accurate than the simple baseline (average of the last 5 visits, 16 minutes error). An R² of 0.72 means: the model explains just under three quarters of the variance in dwell times. The rest is genuine noise (weather, staff changes, etc.).

Predicted vs. actual dwell time - example data (excerpt, 200 points)
Prediction error by customer - where the model is uncertain

07 Business impact - what this means in euros

The calculation your controller will understand immediately

14.700 h
Dwell time / year
€661.500
Total dwell costs
€132.300
Of which achievable
20 %
Savings potential
Avoidable dwell costs per customer - top 10
↳ The Hard Truth

A typical fleet of 150 trucks generates around €661,500 in annual dwell costs. Mathematically avoidable: €264,600 (assumption: 40% of dwell costs fall on time above the 30-minute window) - of which half is realistically achievable: €132,300. The top 5 customers account for around €63,600 of the mathematically avoidable costs - a single time-window conversation per customer.

CustomerSectorDeliveriesAvg. dwellAvoidable costsRecommended action
K-003Baustoffe42089 min€18.585Time-slot agreement + early slot
K-029FMCG51068 min€14.535Prioritise arrival before 09:00
K-017Chemie38076 min€13.110Avoid Mondays, demand 2nd ramp
K-041Lebensmittel34071 min€10.455Consolidate LTL (fewer deliveries)
K-008Automotive29062 min€6.960Use JIT window (already in place)

08 Next steps for your fleet

From analysis to implementation

This model can be trained on your real data. What you need:

① Data export

CSV from telematics + ERP: arrival time, customer, loading time, weight. No cleaning required - we handle that.

② Pilot phase

Train the model on your top-20 customers. Output: dashboard with daily predictions for dispatch.

③ Integration

API connection to your TMS. Automatic dwell-time forecast at route creation. Live alerts on anomalies.

What this calculation means for your fleet is covered by our AI consulting for logistics.
All 6 modules: AI in logistics