🚛

Competitive Powertrain Benchmarking

Technical Docs v1.0

EU Heavy-Duty Vehicle Benchmarking Platform · Demo

1. Executive Overview & Scope

The Competitive Powertrain Benchmarking Platform provides deep empirical benchmarking of European Heavy-Duty Vehicles (HDV, trucks and buses) to evaluate competitor engine specifications, transmission configurations, aerodynamic properties, and certified whole-vehicle CO2 emissions.

Total Verified Fleet

756,149 Vehicles

Reporting Years

2019, 2020 & 2023

Regulatory Framework

Reg. (EU) 2018/956

2. Data Engineering Pipeline

The pipeline executes an offline-first, highly reproducible ingest and validation flow without any external runtime dependencies:

Competitive Powertrain Benchmarking — system architecture Live EEA Discodata is mined into raw JSON snapshots, validated by a pydantic gate, loaded into a DuckDB / Parquet store with a SHA-256 manifest, then analysed and modelled, and finally surfaced through an eight-tab Streamlit application. A shared powerbench core package underpins every stage. EEA HDV CO₂ monitoring  ·  Regulation (EU) 2018/956 discodata.eea.europa.eu/sql  —  SQL over HTTP, no auth 01   MINE Chunked HTTP pull fetch_eea_hdv.py fetch_eea_hdv_viewer.py WHERE year × OEM retry + backoff ↓ output data/raw/*.json + .prov.txt (sha256) 02   VALIDATE + LOAD pydantic gate reclean.py · schema.py physical bounds out-of-range → None OEM canonicalisation powertrain classifier ↓ store powerbench.duckdb hdv.parquet · manifest.json 03   ANALYSE + MODEL EDA & honest ML benchmark.py · features.py modeleval.py · train_co2v.py OEM × segment CO₂v leakage guard 5-fold out-of-fold CV ↓ artefact co2v_models.json 04   DELIVER Streamlit app — 8 tabs app/streamlit_app.py Pipeline · Overview · Distributions Correlations · Benchmark · ML Metrics · Documentation · Provenance live pipeline runner (subprocess) light / dark · static HTML export shared core   powerbench/ paths · config · discodata · schema · viewer_map · dataio · benchmark · features · modeleval · theme — imported by every stage above
Figure 1 — end-to-end architecture. Everything after the mine step is offline; manifest.json is the authority on the active dataset.

A. Discodata SQL Mining (powerbench/discodata.py)

Queries the EEA Discodata SQL Server via REST (https://discodata.eea.europa.eu/sql). Due to pagination quirks in Discodata's p parameter, requests are segmented by SQL WHERE [MS_Year]=... AND LOWER([Manufacturer]) LIKE ... clauses with exponential backoff.

B. Pydantic Validation Gate (powerbench/schema.py)

Enforces physical bounds on optional continuous measurements (displacement $\le 40$ L, power $\le 1500$ kW, GVW $\le 120$ t). Out-of-bounds measurements are converted to None rather than discarding valid rows.

C. High-Performance Columnar Storage (powerbench/dataio.py)

Stores clean records into DuckDB (powerbench.duckdb) and Parquet (hdv.parquet) alongside cryptographic audit manifests (manifest.json).

D. Data Availability & Refresh Cadence

EEA publishes HDV CO2 monitoring on annual reporting periods (1 Jul – 30 Jun) with a ~9–12 month lag, so there is always a 1–2 year gap between "now" and the newest available year.

  • 2019, 2020 — [CO2Emission].[latest].[CO2_HeavyDutyVehicles] (full VECTO detail: engine ratings, WHTC/WHSC, axle config).
  • 2023 — [CO2Emission].[latest].[HDV_2023_viewer] (pre-joined OEM + Member-State view: CO2v, registration country, mass, segment — no engine ratings).
  • 2021, 2022 — only in the 280 MB bulk CSV (not wired into the pipeline).
  • 2024 — listed in Discodata metadata but not yet queryable; expected to appear over the coming months.
  • 2025 / 2026 — reporting period not closed long enough (or still open); not expected before 2027.

Refreshing: the Pipeline tab has one button per period (⛏ 2019–2020, ⛏ 2023, and a number picker for any year ≥ 2024) that runs mine → validate → load → train. fetch_eea_hdv_viewer.py probes each requested year once (SELECT TOP 1); a year whose HDV_<year>_viewer table does not exist yet is skipped with a single warning (published years in the same request still mine). reclean.py then merges every raw snapshot on disk, so mining one period keeps the others; delete 1-mining/data/raw/*.json to rebuild from scratch. Cross-year CO2v comparisons are directional — 2019–2020 and 2023 use different VECTO versions.

3. Regulatory Metrics & Test Cycles

Understanding European heavy-duty emissions testing requires distinguishing between engine dynamometer approvals, whole-vehicle simulations, and logistics efficiency:

Metric Field Test / Method Unit Engineering Interpretation
WHTC_CO2_gkwh World Harmonised Transient Cycle (Euro VI) g/kWh Engine dynamometer brake efficiency under transient stop-and-go conditions.
WHSC_CO2_gkwh World Harmonised Steady-State Cycle g/kWh 13 steady operating points. Represents the engine's optimal thermodynamic efficiency.
CO2v VECTO Vehicle Simulation (Reg. 2018/956) g/km Primary Benchmark Target. Whole-truck declared CO2 including aerodynamics, tyres, gearbox, and auxiliaries.
COL_CO2_gtkm VECTO Payload Specific Mission g/t-km Freight transport efficiency: grams of CO2 per metric tonne of payload moved 1 km.

What is VECTO?

VECTO (Vehicle Energy Consumption calculation TOOL) is the European Commission's official simulation program for heavy-duty CO2, mandatory for most new lorries since 1 January 2019 under Regulation (EU) 2017/2400. Trucks are built-to-order in thousands of configurations, so road-testing every one is impossible — the EU mandates a simulation instead.

  1. Each component is bench-measured once and certified — engine fuel map, gearbox and axle losses, tyre rolling resistance, aerodynamic drag (CdxA).
  2. The OEM feeds those certified inputs plus the vehicle's mass and layout into VECTO.
  3. VECTO drives the virtual truck over standard mission profiles (Long Haul, Regional Delivery, Urban Delivery) at defined payloads and speed cycles.
  4. Output = declared CO2 in g/km (CO2v) and g/t‑km (COL_CO2_gtkm) per mission.

Why this matters here: CO2v captures the vehicle as a system (engine + gearbox + axles + aero + tyres + auxiliaries) — that is what we benchmark and predict. The engine-only bench figures WHTC_CO2_gkwh / WHSC_CO2_gkwh are inputs to the VECTO run, so they are banned as model features (predicting a CO2 from a CO2 that helped compute it is target leakage). VECTO is revised over time (v3.x → v4.x), so a 2023 CO2v is not strictly comparable to a 2019 one — cross-year moves are directional, not exact.

4. Machine Learning & What-If Simulator

📖 Read ML Case Study ↗

To predict whole-vehicle CO2v without requiring proprietary CAD/VECTO simulation runs, we train a gradient-boosted regression pipeline (HistGradientBoostingRegressor) with strictly audited leakage protection:

Rich Feature Model (2019–2020)

  • • Features: GVW, Curb Mass, Displacement, Power, RPM, Axle Config, Group, Fuel.
  • • CV R²: 0.595 ± 0.006
  • • CV MAE: 27.8 g/km (vs 49.4 g/km baseline)
  • • Error Reduction: 43.7% improvement over median prediction.

Base Feature Model (All Years)

  • • Features: GVW, Curb Mass, Vehicle Group, Powertrain Class, Fuel Type.
  • • CV R²: 0.448 ± 0.018
  • • CV MAE: 45.2 g/km (vs 62.2 g/km baseline)
  • • Coverage: 100% of reporting periods (2019, 2020, 2023).

💡 Hyperparameters & Engineering Rationale:

Configured with max_iter=300, learning_rate=0.08, and max_leaf_nodes=31 ($2^5 - 1$). This depth restriction prevents overfitting on rare vehicle variants while capturing 3-to-4-way non-linear physics interactions (Mass $\times$ Displacement $\times$ Aerodynamic Group). Complete engineering analysis is available in the ML Case Study & Parameter Selection Document.

5. Streamlit Dashboard Architecture

The dashboard (app/streamlit_app.py) provides 8 tabs organized logically from data operations to deep analysis:

1. Pipeline Tab: Live mining interface that triggers subprocess fetching and DuckDB updates with streaming progress.
2. Overview Tab: Fleet KPIs, powertrain mix charts, OEM vehicle counts, and curated data table.
3. Distributions Tab: Nested subtabs: Overall (stacked histograms by powertrain) and By manufacturer (per-OEM box plots across all engineering specs).
4. Correlations Tab: Pearson r matrix between engine size, chassis mass, and emissions.
5. Benchmark Tab: OEM CO2v box plots, multi-year trend tracking, and relative efficiency Δ %.
6. ML Tab: CV metrics, actual vs predicted scatter, permutation importance, and What-If simulator.
7. Documentation Tab: Interactive embedded technical docs & one-click HTML download.
8. Provenance Tab: SHA-256 audit manifest, snapshot record counters, and Discodata lineage.

6. CLI Reference & Verification

Run the offline test suite (82 tests):

uv run pytest -v

Launch the Streamlit benchmarking tool:

uv run streamlit run app/streamlit_app.py

Refresh mining to a newly published EEA year (availability in §2D):

# probe whether the year has landed (0 rows / error = not yet published)
curl -s "https://discodata.eea.europa.eu/sql?nrOfHits=1&query=SELECT%20TOP%201%201%20x%20FROM%20%5BCO2Emission%5D.%5Blatest%5D.%5BHDV_2024_viewer%5D"

# mine just the new year (older snapshots on disk are reused), then rebuild
uv run python 1-mining/fetch_eea_hdv_viewer.py --years 2024
uv run python 2-pipeline/reclean.py
uv run python 3-ml-prediction/train_co2v.py

Or, in the app: Pipeline tab → set the year → ⛏ <year>. An unpublished year is skipped with a single warning rather than failing the run.