Skip to main content

fmLCA

Create and simulate dynamic Life Cycle Assessment (LCA) models with the Functional Mockup Interface (FMI). The fmLCA project supports CLI and Python API workflows for inventory conversion, LCA runs, FMU generation, and sequential co-simulation.

License CI Tests

Contributors

Kathryn Hinkelman, Fitzwilliam Keenan-Koch, and Anastasija Mensikova - SEE Lab, University of Vermont

Features

  • Dynamic energy propagation through LCA calculations
  • Parameterized subsystem composition from CSV inventories
  • Single-input single-output LCA FMUs translating power to single score impacts overtime
  • FMU generation for FMI-compatible co-simulation with optional black-box protection
  • Brightway + ecoinvent based impact assessment workflows

Installation

git clone https://github.com/see-lab/fmLCA.git
cd fmLCA
python -m venv venv
source venv/bin/activate  # macOS/Linux
pip install -r requirements.txt

Requirements:

  • Python 3.9-3.13
  • ecoinvent 3.8+ database

Brightway And Ecoinvent Setup

# Check status
python scripts/setup_brightway.py --name fmlca --ecoinvent 3.12 --check

# Import ecoinvent (LCI + LCIA)
python scripts/setup_brightway.py --name fmlca --ecoinvent 3.12 --system-model cutoff

For complete setup options, run:

python scripts/setup_brightway.py -h

Safe Project Selection

Set the target Brightway project explicitly in multi-project environments:

$env:FMLCA_BW_PROJECT = "fmlca"

Optional non-interactive project switching:

$env:FMLCA_AUTO_CONFIRM_PROJECT_SWITCH = "true"

CLI Workflow (Primary Reference)

Get full options for each command with -h.

1) Convert CSV To Inventory JSON

python scripts/csv_to_json_translator.py example.csv
python scripts/csv_to_json_translator.py example1 example2 --output combined_system.json
python scripts/csv_to_json_translator.py -h

2) Run LCA

python src/lca_engine.py example --methods ipcc
python src/lca_engine.py -h

3) Build FMU

python scripts/create_fmu.py example --method ipcc
python scripts/create_fmu.py example --method ipcc --bw-project fmlca
python scripts/create_fmu.py -h

4) Run FMU / Sequential Co-simulation

python scripts/run_fmu.py --mode single --fmu fmu/Example_Ipcc_v0.0.1.fmu --u0 100 --step-size 60
python scripts/run_fmu.py --mode cosim --system-fmu fmu/PV_System_WECC.fmu --lca-fmu fmu/PvWecc_Ipcc_v0.0.1.fmu --system-output gri.P.real --lca-input u --lca-output y --parameter-name n_pv --parameter-value 2.0 --output-interval 3600 --solver CVode --save-plot results/cosim.png
python scripts/run_fmu.py -h

Python API Workflow

Use lowercase package import:

from fmlca import csv_to_json_translator, create_fmu, lca_engine, run_fmu
csv_to_json_translator("data/inventory/example.csv", "data/inventory/example.json")
fmu_path = create_fmu("data/inventory/example.json", "fmu", method="ipcc", version="0.0.1")
results = lca_engine("data/inventory/example.json", ["IPCC 2021 climate change total excl biogenic GWP100"])
sim = run_fmu(fmu_path, stop_time=3600.0, input_u=100.0)

Two-FMU co-simulation API:

from pathlib import Path
from fmlca.run_fmu import sequential_cosim
system_result, lca_result = sequential_cosim(system_fmu=Path("fmu/PV_System_WECC.fmu"), lca_fmu=Path("fmu/PvWecc_Ipcc_v0.0.1.fmu"), start_s=0.0, stop_s=3600.0, system_output="gri.P.real", lca_input="u", lca_output="y")

Advanced Options

  • Dymola preset: python scripts/create_fmu.py grid --method ipcc --target-tool dymola.
  • Strict distribution mode: python scripts/create_fmu.py grid --method ipcc --target-tool dymola --export-mode bytecode --blackbox-policy enforce.
  • Default safety posture: bytecode export + black-box enforce; run python scripts/create_fmu.py -h for all policy/export options.

Project Structure

├── src/                    # Core library modules
├── scripts/                # CLI tools
├── data/                   # Inventories and LCIA methods
│   ├── inventory/
│   └── methods/
├── config/                 # Configuration files
├── fmu/                    # Generated FMUs
├── results/                # Analysis outputs
└── tests/                  # Test suite

Testing

python tests/test_cumulative_fmu.py
python -m pytest tests/

Documentation

Contributing

Contributions are welcome. See CONTRIBUTING.md.

License

BSD 3-Clause License. See LICENSE.

Citation

Citation details will be added here when available.

Links


Maintained by the SEE Lab at University of Vermont

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fmlca-0.0.1.tar.gz (98.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fmlca-0.0.1-py3-none-any.whl (110.7 kB view details)

Uploaded Python 3

File details

Details for the file fmlca-0.0.1.tar.gz.

File metadata

  • Download URL: fmlca-0.0.1.tar.gz
  • Upload date:
  • Size: 98.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fmlca-0.0.1.tar.gz
Algorithm Hash digest
SHA256 98e6aed8de165dd5806ebf6bc1846e5c4452cd74aeed129c89e846ffacb05959
MD5 fe30881d5e8a36eb0934b81f34e87206
BLAKE2b-256 f2fdeeb65cea195c572af073dc2e106092054a99422ce3e2691ec0a8b2d53a73

See more details on using hashes here.

Provenance

The following attestation bundles were made for fmlca-0.0.1.tar.gz:

Publisher: pypi-publish.yml on see-lab/fmLCA

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fmlca-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: fmlca-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 110.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fmlca-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f96824e07b1cfba5c7dfe263f4494fe37da22b647a1d278c04bd0b38b8ff22c
MD5 9c98e111f3a8cfb90ccabbe6e92d44f5
BLAKE2b-256 de7f446344a05848db07e794957489f1bf1fb13a5a6ae3f1f6ca69dba29ca73c

See more details on using hashes here.

Provenance

The following attestation bundles were made for fmlca-0.0.1-py3-none-any.whl:

Publisher: pypi-publish.yml on see-lab/fmLCA

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 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