Real-time Dynamic Life Cycle Assessment โ connect live grid carbon data to full LCA calculations
Project description
๐ DynLCA โ Real-time Dynamic Life Cycle Assessment
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®ion=CN-EAST
# Historical query
GET /lca/history?process=injection_molding&kwh=100®ion=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®ion=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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e928a8cb1e72d26fffca07ca8ffd3572658b403e119e9b8f7e20d97fcfaade4
|
|
| MD5 |
95ea6123d4a4a4a60f934131f0af6316
|
|
| BLAKE2b-256 |
677f8c787beb239a30055594a01f6d09d383fe099899626c3427f0b9eb0b11d5
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91658576b381ca3493a938be077e0a25fe4bffd73dbb55a69d9620d113da669e
|
|
| MD5 |
b0d0fe8e78b9d04611f7f185eb6e6a5e
|
|
| BLAKE2b-256 |
75f520f0afcc73c48ecdcd674d3a1281b5200802903b73f94fa1ce399785b949
|