Logistics Intelligence Series | Module 1 of 6

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.

01 The 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
€ Impact

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.

▸ Output
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 is the pattern hiding?

The data already speaks before we train a model

Average dwell time by weekday
↳ Insight

Mondays show average dwell times 28% 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 €23,625 in excess dwell costs. 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

▸ Output
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.

▸ Output - Modell-Architektur
Model Parameters: 26,561

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

8.3 min
MAE (LSTM)
0.847
R² Score
14.2%
MAPE
15.1 min
MAE (Baseline)
↳ Interpretation

The LSTM model predicts dwell time with an error of ±8.3 minutes - 45% more accurate than the simple baseline (average of the last 5 visits). An R² of 0.847 means: the model explains 85% of the variance in dwell times. The remaining 15% is genuine noise (weather, staff changes, etc.).

Predicted vs. actual dwell time (test set, n=3,600)
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.850 h
Dwell time / year
€667.500
Total dwell costs
€184.300
Avoidable
27.6%
Savings potential
Avoidable dwell costs per customer - top 10
↳ The Hard Truth

A typical fleet of 150 trucks generates approximately €667,500 in annual dwell costs. Of these, €184,300 are avoidable - through better route planning based on the predictions alone. The top 5 customers account for 38% of avoidable costs. That is €70,000/year recoverable with a single conversation about time windows.

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

08 Next steps

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.