01 / 16
← → or scroll
EU HDV Benchmarking · Demo

Competitive Powertrain Benchmarking

Mining, validating and modelling the EU heavy-duty-vehicle CO₂ record — from raw regulator data to a live decision tool.
EU HDV CO₂ monitoring  /  Reg. (EU) 2018/956  /  VECTO
01The brief

Benchmark competitor powertrains — on free, recurring data

Give R&D and the Benchmarking Team an evidence base on engine specs, driveline configuration and certified whole-vehicle CO₂ — without paid market-intelligence subscriptions.

  • Frame — turn "how do we compare?" into measurable questions across OEM × segment × year.
  • Mine & validate — recurring ingest from an authoritative EU source, reproducible and auditable.
  • Analyse & model — honest statistics; a CO₂ predictor that says what it does and does not know.
  • Deliver — an interactive dashboard R&D can drive, plus a static, offline record.
02The data source

EEA HDV CO₂ monitoring — queried live over HTTP

Regulation (EU) 2018/956: Member States and manufacturers report every certified truck to the European Environment Agency. Exposed through Discodata — a SQL Server reachable by plain HTTP, no authentication.

756,149Vehiclesafter validation & de-duplication
2019 / 20 / 23Reporting yearsthe years Discodata currently serves
7Major truck OEMsScania, DAF, Daimler, Volvo, MAN, Renault, IVECO
€0Data costpublic regulator data only
03The pipeline

Five stages, offline-first, one shared core package

01MineDiscodata SQL over HTTP → raw JSON snapshots + provenance
02Validatepydantic gate, physical bounds, OEM canonicalisation
03StoreDuckDB + Parquet + SHA-256 manifest
04Analysedistributions, OEM × segment CO₂, correlations
05Modelhonest CO₂v regression + what-if predictor

powerbench/ holds paths, the Discodata client, the schema, data-IO, features and evaluation — imported by every script and by the Streamlit app.

04Mining

Work around the endpoint, don't fight it

  • Pagination is broken — Discodata's p parameter repeats page one. Instead, bound every request with a WHERE on year × manufacturer and pull each chunk whole.
  • Two source tables, one schema — CO2_HeavyDutyVehicles (2019–20, full VECTO detail) and HDV_2023_viewer (2023, + registration country); a mapper reconciles them.
  • Every pull is a record — one JSON snapshot per source with a SHA-256 sidecar; retry with backoff; unpublished years skipped with one clear message.
05The validation gate

Reject the row's mistakes, not the row

  • Physical bounds — displacement ≤ 40 L, power ≤ 1500 kW, GVW ≤ 120 t.
  • Out-of-range → null — a bad optional measurement drops to None; the vehicle is kept. Saved ~3,600 rows.
  • OEM names are dirty — "Daimler AG" and "Daimler Truck AG" become one brand; address junk → "Unknown".
  • Derived, not guessed — powertrain class from the EEA flag columns + fuel type.
# powerbench/schema.py
class HDVRow(BaseModel):
    Engine_RatedPower_kw: float | None
    GrossVehicleMass_t:   float | None
    # value outside (0, hi] -> None,
    # never a rejected record
06Storage & provenance

The manifest is the authority

Clean rows land in DuckDB (powerbench.duckdb) and a Parquet mirror. manifest.json records every source snapshot, its SHA-256 and row count — so the active dataset is always known and reproducible.

QueryDuckDBcolumnar, single file, zero-server
PortabilityParquethand-off without the database
AuditSHA-256per snapshot, in the manifest
07Reading the numbers

Three different "CO₂", three different jobs

WHTC / WHSC
g·kWh⁻¹
Engine on a test bench — fuel efficiency of the engine alone. Independent of truck weight, aero, mission.
CO₂v
g·km⁻¹
Whole truck, simulated by VECTO — engine + gearbox + axles + aero + tyres. The headline number. Our benchmark and ML target.
COL CO₂
g·t⁻¹km⁻¹
Freight efficiency — CO₂ per tonne of goods moved one km. The real logistics figure; only ~3% populated.
08Analysis — the competitive picture

Who is lowest, and who is improving fastest

~747Scania mean CO₂v (g/km)lowest of the majors, groups 4/5/9/10
−3.9%MAN, 2019 → 2020largest year-on-year drop
~flatDAF, 2019 → 2020no material change
~690Fleet mean CO₂v, 2023down from ~780 — directional (newer VECTO)

The dashboard renders this as OEM box plots plus a 2019→2023 change ranking — narrowed to comparable vehicle groups.

09Analysis — a trap avoided

Engine-cycle CO₂ is not a league table

Correlation analysis shows engine-bench CO₂ (g/kWh) falls as engine displacement rises — r ≈ −0.5. Bigger diesels run closer to their efficient point.

  • The consequence — ranking OEMs on raw g/kWh flatters whoever sells the heaviest long-haul tractors.
  • The rule — benchmark on CO₂v (whole vehicle); use g/kWh as a model feature, never as a scoreboard.
10Machine learning — the question

Predict whole-vehicle CO₂ from the spec sheet

Target: CO₂v (g/km), restricted to the VECTO classes with a comparable figure. Two feature sets, so coverage and ceiling are both explicit:

  • base — mass, vehicle class, powertrain, fuel, flags. Works on every reporting year.
  • rich — base + engine ratings + axle configuration. 2019–2020 only.
11Machine learning — honesty first

The evaluation method is the result

  • Out-of-fold headline — shuffled 5-fold cross-validation; every row scored by a model that never saw it.
  • Baseline in view — "predict the median" MAE shown next to every model. A useful model must beat it.
  • Optimism gap shown — the naive train-on-test R² is printed beside the CV number, not instead of it.
  • Leakage guard — assert_no_leakage() bans every CO₂ / fuel-consumption column; g/kWh feeds the VECTO calc that makes the target.
12Machine learning — results

Spec sheet explains about half; engine specs push it to ~60%

rich — out-of-foldR² 0.60MAE 27.8 g/km  vs  49.4 median baseline
base — out-of-foldR² 0.45MAE 45.2 g/km  vs  62.2 median baseline
linear modelR² ~0.31signal is non-linear — gradient boosting wins

Curb mass and vehicle group carry most of it; engine displacement and power add the rich set's lift. The naive↔CV gap is small — not overfit.

13The what-if predictor

A number that admits what it can't see

  • Inputs — sliders for GVW, curb mass, vehicle group, powertrain, and (rich) engine power / displacement / speed.
  • Output — predicted CO₂v ± the model's cross-validated MAE.
  • Scope flag — any input outside the training min–max raises an extrapolation warning.
  • Labelled illustrative — the model sees only these fields; real CO₂v also depends on aero, tyres, gearbox, auxiliaries.
14The deliverable

An eight-tab Streamlit app R&D can drive

  • Pipeline — mine → validate → load → train, live from the browser, streamed progress. Nothing pre-downloaded.
  • Overview · Distributions · Correlations · Benchmark — the analysis, filterable by year / OEM / powertrain / segment.
  • ML — both feature sets side by side, out-of-fold scatter, feature importance, what-if.
  • Metrics · Documentation · Provenance — definitions, this write-up, and the SHA-256 lineage. Light / dark.
15Where it goes next

Reproducible, offline, auditable — and easy to extend

  • 2024 data — one button in the Pipeline tab the moment the EEA publishes it (~9–12 month lag).
  • 2021–2022 — wire the bulk CSV for a contiguous 2019–2023 trend.
  • Market weighting — add KBA / ACEA registration volumes for share-weighted benchmarks.

github.com/mohamed-soubhi/Competitive-Powertrain-Benchmarking