Skip to main content

๐Ÿซ€ Real-time Dynamic Life Cycle Assessment โ€” live grid carbon data meets full LCA

Project description

๐ŸŒ dynlca-CarbonPulse โ€” 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

carbonpulse-0.2.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

carbonpulse-0.2.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file carbonpulse-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for carbonpulse-0.2.0.tar.gz
Algorithm Hash digest
SHA256 daf53f8dc535bf9973a270fcf2eb23cabbce5a3bcd96541add274b941cb2e492
MD5 7666ef5c273713f36846ae6cc21e065e
BLAKE2b-256 32a08ba0a7873b9916136aee9fbf9fa2545078b5e197bb61b7d2cb16f9ba575a

See more details on using hashes here.

File details

Details for the file carbonpulse-0.2.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for carbonpulse-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 766d2e439dc13bf98dee13e251fd37a6ba9b5888d70c1f09358d6bc732b4cd9a
MD5 8e72e10a136bed4ae76af74a0cbb11ec
BLAKE2b-256 70d484abb1409f2a6b805fa1e79418d553cb1e90e3bd03d9a96f5f17e5e862e1

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