Skip to main content

carculator_truck

Prospective environmental and economic life cycle assessment of freight vehicles, with coupled payload, range, energy storage and charging infrastructure.

Installed artifacts PyPI

Developed at the Paul Scherrer Institute. This checkout prepares 0.5.1; see CHANGELOG.md for release status and changes.

Installation

Use Python 3.12 (>=3.12,<3.13) and a fresh environment. The shared runtime requires NumPy >=1.26.4,<2.

python3.12 -m venv .venv
source .venv/bin/activate

On Windows, activate with .venv\Scripts\activate. After publication, install this release from PyPI:

python -m pip install "carculator_truck==0.5.1"

Before publication, use the matching source checkouts as described under development. Core calculations use bundled resources and need no Brightway project, ecoinvent installation or network access. Inventory export has optional dependencies:

python -m pip install "carculator_truck[excel,brightway]==0.5.1"

The Brightway extra supports the legacy stack (bw2io<0.9, bw2data<4, bw2calc<2). Export currently targets ecoinvent 3.9 and 3.10; importing those inventories requires the corresponding background database in the destination tool.

Quick start

from carculator_truck import (
    TruckInputParameters,
    TruckModel,
    InventoryTruck,
    fill_xarray_from_input_parameters,
)

inputs = TruckInputParameters()
inputs.static()
_, array = fill_xarray_from_input_parameters(
    inputs,
    scope={"size": ["40t"], "powertrain": ["ICEV-d", "BEV"], "year": [2025]},
)
model = TruckModel(array, cycle="Long haul")
model.set_all()
print(model["TtW energy"])  # kJ per vehicle-kilometre

inventory = InventoryTruck(model, functional_unit="tkm")
impacts = inventory.calculate_impacts()
print(impacts.sel(impact_category="climate change").sum("impact"))

Truck model costs are per vehicle-kilometre; the example reports impacts per tonne-kilometre of actual cargo.

Modelling and validation

The vehicle models include native 2025 parameters and documented temporal extensions. These combine engineering priors and selected calibration evidence; they are not independent measurements for every vehicle configuration.

TtW energy is in kJ/km. For BEVs it is net stored-energy depletion; model.battery_terminal_energy reports terminal DC separately, while electricity consumption is grid electricity in kWh/km. Identify the measurement boundary before comparing energy outputs. Availability-masked zeroes do not represent physically zero consumption.

Supported background scenarios are SSP2-NPi, SSP2-PkBudg1000, SSP2-PkBudg650, and static. ReCiPe supports midpoint/endpoint and EF midpoint. Use fresh model instances for independent cases. inputs.stochastic(n, seed=...) seeds parameter sampling, not every downstream cost adjustment.

See validation and limitations, migration notes and the documentation.

Development and release

Use matching sibling checkouts, especially carculator_utils 1.3.6 or newer:

python -m pip install -e "../carculator_utils[test,excel,brightway]" -e ".[test,docs,excel,brightway]"
python -m pip check
python -m pytest
python -m sphinx -b html docs docs/_build/html

The docs extra includes the extensions used by this repository. See RELEASING.md for artifact verification, release order and publication.

Support and license

Contact carculator@psi.ch or open an issue. Maintained by Romain Sacchi, with contributions from the carculator development team. See contributing. Licensed under BSD-3-Clause.

Scientific background: Sacchi, Bauer and Cox (2021), Does Size Matter?.

Metadata

Release files for carculator-truck 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for carculator-truck 0.5.1
File Size Uploaded
carculator_truck-0.5.1.tar.gz 723.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for carculator-truck 0.5.1
File Interpreter ABI Platform
carculator_truck-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 847.8 kB

Release files / carculator_truck-0.5.1.tar.gz

Download URL carculator_truck-0.5.1.tar.gz
Size 723.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ebfd6982fffa361c6df30c30c07db9591960703eec9393700bbf9b1a65c06790
BLAKE2b-256 checksum
How to use checksums
7fa04053cdfeeffc3e2b04e2e887a695c321754daf842f64b58a4d2b3c38a679
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / carculator_truck-0.5.1-py3-none-any.whl

Download URL carculator_truck-0.5.1-py3-none-any.whl
Size 124.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9379c2a945b3917c080429693748728542a7444fe2c973ec7daf03007cc99aa2
BLAKE2b-256 checksum
How to use checksums
9baff2f0214f8b885ceee7f29b5e54c280b7da3d7deaacbdede0d413a0a9193e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.5.2

2 release files

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.2

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.3

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page