Skip to main content

carculator

Prospective environmental and economic life cycle assessment of passenger cars and light-duty vehicles.

Installed artifacts PyPI

Developed at the Paul Scherrer Institute. This checkout prepares the unpublished release 1.9.7; 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==1.9.7"

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. The matching carculator_utils runtime installs brightpath>=1.0.0a6,<1.1 for Brightway Excel, SimaPro CSV and openLCA JSON-LD exports. It uses Brightpath's v1 API, currently an alpha; model and LCIA calculations do not import Brightpath or Brightway.

The excel extra remains a compatibility alias. To select the tested legacy Brightway stack (bw2io<0.9, bw2data<4, bw2calc<2), use:

python -m pip install "carculator[brightway]==1.9.7"

Brightpath also installs bw2io without that extra. Export targets ecoinvent 3.12 cut-off by default; legacy 3.9/3.10 targets reject suppliers without verified older links. External suppliers must be matched to the corresponding background in the destination tool. See inventory export.

Quick start

from carculator import (
    CarInputParameters,
    CarModel,
    InventoryCar,
    fill_xarray_from_input_parameters,
)

inputs = CarInputParameters()
inputs.static()
_, array = fill_xarray_from_input_parameters(
    inputs,
    scope={"size": ["Medium"], "powertrain": ["ICEV-p", "BEV"], "year": [2025]},
)
model = CarModel(array, cycle="WLTC")
model.set_all()
print(model["TtW energy"])  # kJ per vehicle-kilometre

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

The example reports impacts per vehicle-kilometre.

Inventory export

With the completed inventory from the quick start:

workbook = inventory.export_lci(software="brightway2", format="file", directory="exports")
simapro_csv = inventory.export_lci(software="simapro", format="file", directory="exports")
foreground_zip = inventory.export_lci(software="openlca", format="file", directory="exports")

Retain exactly one sample before constructing the model and inventory. Each year gets its own export; multiple years return a list. Exports preserve the original inventory and calculated impacts. The default export_lci() returns an unlinked Brightway importer.

The openLCA ZIP contains foreground processes, without an ecoinvent background or LCIA methods; map external providers and elementary flows before calculation. SimaPro CSV uses Latin-1 and warns when omitting custom noise flows. See the export guide for return types, sample selection and format-specific limitations.

Battery sizing

Set nominal capacity with energy_storage={"capacity": {("BEV", "Medium", 2025): 60}}. Set pack mass through the input array parameter energy battery mass (kg). Set a desired range with target_range={("BEV", "Medium", 2025): 400}. Range targets supersede capacity overrides; capacity overrides supersede pack-mass inputs. The range solver converges battery mass and energy demand together. See the battery-sizing documentation for complete examples.

Modelling and validation

For a guided explanation of the inputs, units and assumptions, read Understanding inputs and results. The validation examples include bar charts, source records and the limits of each comparison. Measured energy comparisons are separate from the model-to-model comparison of the background database update.

Battery unit prices supplied by users now survive chemistry selection and cost adjustment. Use battery_costs for explicit prices scoped by vehicle, year and sample; see battery-cost inputs.

The vehicle models include tabulated 2025 parameters and documented temporal extensions. These combine engineering assumptions 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 draws and the projected-cost factors used by the current array builder. Keep its auxiliary sample coordinates; older hand-built arrays do not recover that seed automatically.

See validation and limitations, migration notes and the documentation.

Development and release

Use matching sibling checkouts, especially carculator_utils 1.3.7 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: Cox et al. (2018).

The shared LCA background now uses premise 2.5.4 and ecoinvent 3.12 cutoff. The former NMC-523 option is replaced by NMC-532 (actual Ni:Mn:Co 5:3:2 inventory); update custom chemistry selections. See docs/release.rst.

Metadata

Release files for carculator 1.9.7

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 1.9.7
File Size Uploaded
carculator-1.9.7.tar.gz 1.6 MB Details

Built distribution (wheel)

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

Total release size: 1.7 MB

Release files / carculator-1.9.7.tar.gz

Download URL carculator-1.9.7.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
65a5aa2c6443ea932c432fc3d92312be6384a8369d2c1c8e597d2d7b0731b249
BLAKE2b-256 checksum
How to use checksums
1125634b4dd01a48b2844a1d7cdf98185877a856a618567329508f0d7904adf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / carculator-1.9.7-py3-none-any.whl

Download URL carculator-1.9.7-py3-none-any.whl
Size 109.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1cb6cf663340c038e87c8ddd556188c998245185cf0cb6f1ee9784546d9d64a
BLAKE2b-256 checksum
How to use checksums
1c7c563e95e670bdec26d000f9ee4fc5ad4542bf2f43bd6e6ff2154c553bd34b
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

This release

1.9.7 This release

2 release files

1.9.6

2 release files

1.9.5

2 release files

1.9.4

2 release files

1.9.3

2 release files

1.9.2

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.5

2 release files

1.8.4

2 release files

1.8.3

2 release files

1.8.2

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.3

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.9

2 release files

1.6.8

2 release files

1.6.7

2 release files

1.6.5

2 release files

1.6.4

2 release files

1.6.3

2 release files

1.6.2

2 release files

1.6.0

2 release files

1.5.9

2 release files

1.5.6

2 release files

1.5.4

2 release files

1.4.8

2 release files

1.4.7

2 release files

1.4.6

2 release files

1.4.5

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.9

2 release files

1.3.8

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.9

2 release files

1.2.8

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

3 release files

0.0.1

3 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