Skip to main content

Real-time Dynamic Life Cycle Assessment โ€” connect live grid carbon data to full LCA calculations

Project description

๐ŸŒ DynLCA โ€” Real-time Dynamic Life Cycle Assessment

Python License: MIT PyPI

Dynamic LCA that breathes with the real world.

Traditional LCA uses static, annual-average emission factors. But the carbon intensity of electricity changes every 15 minutes. A product manufactured on a windy Sunday has a very different footprint than one made on a coal-heavy Monday morning.

DynLCA connects live data streams โ€” electricity grid carbon intensity, weather, transport โ€” into full LCA calculations, updating your environmental impact in real time.


โœจ Key Features

Feature DynLCA EcoDynElec Brightway2
Real-time data โœ… โŒ (historical only) โŒ
Full LCA (not just electricity) โœ… โŒ โœ…
Global coverage (incl. China) โœ… โŒ (Europe only) โœ…
REST API โœ… โŒ โŒ
Live dashboard โœ… โŒ โŒ
Brightway2 integration โœ… โŒ โ€”
No API key needed (basic mode) โœ… โœ… โœ…

๐Ÿš€ Quick Start

pip install dynlca
from dynlca import DynLCA

# Initialize with a process that uses electricity
lca = DynLCA(
    process="injection_molding",
    electricity_kwh=100,
    region="CN-EAST",   # China Eastern Grid
)

# Get current carbon footprint (uses real-time grid data)
result = lca.calculate()
print(f"Carbon footprint right now: {result.gwp:.2f} kg COโ‚‚-eq")

# Compare: same process at different times
result_peak   = lca.calculate(at="2024-01-15 09:00")  # Peak coal hours
result_offpeak = lca.calculate(at="2024-01-15 03:00") # Low demand, more renewables
print(f"Peak vs off-peak: {result_peak.gwp:.1f} vs {result_offpeak.gwp:.1f} kg COโ‚‚-eq")

๐Ÿ“ก Data Sources

DynLCA aggregates from multiple free and paid APIs:

Source Coverage API Key Update Freq
Carbon Intensity UK Great Britain โŒ Free 30 min
Electricity Maps 50+ countries Optional 15 min
WattTime USA + global Free tier 5 min
ENTSO-E Europe Free 1 hour
Static fallback (ecoinvent avg) Global โŒ โ€”

For China specifically, DynLCA uses regional grid data from publicly available sources (CEPD/CATARC).


๐Ÿ”ฌ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    DynLCA Core                      โ”‚
โ”‚                                                     โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚  Data Sourcesโ”‚โ”€โ”€โ”€โ–ถโ”‚   Emission Factor Cache  โ”‚  โ”‚
โ”‚  โ”‚  (real-time) โ”‚    โ”‚   (TTL-based, 15min)     โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚                                   โ”‚                 โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚            LCA Calculator                   โ”‚  โ”‚
โ”‚  โ”‚  - Midpoint indicators (GWP, AP, EP, ...)   โ”‚  โ”‚
โ”‚  โ”‚  - Endpoint (ReCiPe)                        โ”‚  โ”‚
โ”‚  โ”‚  - Temporal weighting                       โ”‚  โ”‚
โ”‚  โ”‚  - Uncertainty (Monte Carlo)                โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚                 โ”‚                                   โ”‚
โ”‚     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                       โ”‚
โ”‚     โ”‚                      โ”‚                       โ”‚
โ”‚  REST API              Dashboard                   โ”‚
โ”‚  (FastAPI)            (Plotly Dash)                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“Š Dashboard

dynlca dashboard --region CN-EAST --process cement

Opens a live browser dashboard showing:

  • Real-time carbon intensity heatmap
  • LCA results for your process updated every 15 min
  • Historical comparison (today vs. last week vs. annual average)
  • Optimal manufacturing window prediction

๐Ÿ”Œ REST API

dynlca serve --port 8000
# Get current LCA for a process
GET /lca/now?process=injection_molding&kwh=100&region=CN-EAST

# Historical query
GET /lca/history?process=injection_molding&kwh=100&region=DE&from=2024-01-01&to=2024-01-31

# Best time to run energy-intensive process (next 24h)
GET /lca/optimal?process=aluminum_smelting&kwh=5000&region=GB

๐ŸŒ Supported Regions

  • Europe: DE, FR, GB, ES, IT, SE, NO, PL, ...
  • USA: CAISO, ERCOT, PJM, MISO, ...
  • China: CN-NORTH, CN-EAST, CN-SOUTH, CN-CENTRAL, CN-NORTHWEST, CN-NORTHEAST
  • Global fallback: using ecoinvent world-average grid mix

๐Ÿ“ฆ Integration with Brightway2

import brightway2 as bw
from dynlca.brightway import DynLCAActivity

bw.projects.set_current("my_project")

# Wrap any brightway activity with dynamic electricity
activity = DynLCAActivity(
    bw.get_activity(("ecoinvent", "some_process_key")),
    electricity_input_kwh=500,
    region="DE"
)

# LCA with real-time electricity factor
result = activity.lca_now(method=("ReCiPe 2016", "Midpoint", "GWP100"))

๐Ÿ—บ๏ธ Roadmap

  • Core calculation engine
  • UK Carbon Intensity API integration (no key needed)
  • Electricity Maps integration
  • Static fallback factors
  • WattTime integration
  • ENTSO-E integration
  • China regional grid data
  • FastAPI REST server
  • Plotly Dash dashboard
  • Brightway2 plugin
  • PyPI release
  • Docker image

๐Ÿค Contributing

PRs welcome! See CONTRIBUTING.md.


๐Ÿ“„ License

MIT ยฉ 2024

Project details


Download files

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

Source Distribution

dynlca-0.1.0.tar.gz (28.0 kB view details)

Uploaded Source

Built Distribution

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

dynlca-0.1.0-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file dynlca-0.1.0.tar.gz.

File metadata

  • Download URL: dynlca-0.1.0.tar.gz
  • Upload date:
  • Size: 28.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for dynlca-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0e928a8cb1e72d26fffca07ca8ffd3572658b403e119e9b8f7e20d97fcfaade4
MD5 95ea6123d4a4a4a60f934131f0af6316
BLAKE2b-256 677f8c787beb239a30055594a01f6d09d383fe099899626c3427f0b9eb0b11d5

See more details on using hashes here.

File details

Details for the file dynlca-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dynlca-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for dynlca-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 91658576b381ca3493a938be077e0a25fe4bffd73dbb55a69d9620d113da669e
MD5 b0d0fe8e78b9d04611f7f185eb6e6a5e
BLAKE2b-256 75f520f0afcc73c48ecdcd674d3a1281b5200802903b73f94fa1ce399785b949

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page