Skip to content
Engineering Decision Intelligence
TutorialVersion 0.3.0

Build a Brightway foreground model and run uncertainty

Create a small foreground database, run deterministic LCIA, inspect contributions, and add Monte Carlo uncertainty.

1. Select the project and method

text
list_projects
→ list_databases(project=...)
→ list_methods(project=..., filter=...)

Record the exact Brightway project and method tuple returned by the server.

2. Create and write the foreground database

text
create_database(project="...", name="tutorial_fg", overwrite=false)
→ write_activities(project="...", database="tutorial_fg", activities=[...])

Each activity contains code, name, unit, and exchanges. Internal technosphere links can use the other activity code; biosphere exchanges can be resolved by flow name plus categories.

Warning

Use overwrite=true only when you deliberately want to clear and recreate the foreground database.

3. Run deterministic LCIA

text
run_lca(project="...", database="tutorial_fg", code="product_production", method=[...], amount=1.0)
→ contribution_analysis(result_id=...)
→ top_emissions(result_id=...)
→ dispose_result(result_id=...)

Keep the returned result_id for interpretation calls so they all refer to the same solved LCA.

4. Add uncertainty deliberately

text
set_uncertainty(project="...", database="tutorial_fg", code="material_production", scale=0.15, distribution="lognormal")

Supported distributions are lognormal, normal, uniform, and triangular. The distribution and scale are study assumptions and should be documented.

5. Run Monte Carlo

text
run_monte_carlo(project="...", database="tutorial_fg", code="product_production", method=[...], iterations=500, amount=1.0, seed=42)

Use a fixed seed when you need to reproduce the same sampled run. For longer studies, use run_monte_carlo_async and manage the returned job_id.

Record the study context

  • Brightway project and foreground database
  • Activity code and functional amount
  • LCIA method
  • Uncertainty distribution and scale
  • Iteration count and seed
  • Brightway MCP version

Note

A successful Monte Carlo run does not establish that the uncertainty model is representative.