Skip to content
Engineering Decision Intelligence
TutorialVersion 0.6.0

Run a recoverable SwolfPy project and Monte Carlo analysis

Use operation keys, keep project and result identities separate, and run reproducible Monte Carlo analysis.

1. Inspect the runtime

text
health_check
→ list_templates
→ list_impact_methods

Use the qualified Python 3.10 SwolfPy environment for the full calculation runtime.

2. Create the project with an operation key

text
create_project(template="lf_wte_basic", operation_key="lf-wte-study-v1")

Keep both the returned project result_id and the operation_key. They serve different purposes.

3. Recover interrupted project creation

text
get_project_operation_status(operation_key="lf-wte-study-v1")
→ recover_project_operation(operation_key="lf-wte-study-v1")

Use recovery only when the recorded operation state is recoverable. The server refuses ready projects and live initializations.

4. Run the baseline LCA

text
get_project_summary(result_id=...)
→ run_lca(result_id=..., functional_unit={"baseline": 1}, method=[...])
→ contribution_analysis(lca_result_id=...)

Do not substitute the project result_id where a later tool requires an lca_result_id.

5. Run Monte Carlo

text
run_monte_carlo(result_id=..., functional_unit={"baseline": 1}, method=[...], n=100, nproc=1, seed=42)
→ get_mc_results(mc_result_id=...)

Use a fixed seed when you need to reproduce the same sampled run.

6. Use background jobs for longer runs

text
run_monte_carlo_async(...)
→ get_job_status(job_id=...)
→ get_job_result(job_id=...)
→ dispose_job(job_id=...)

Keep project result_id, lca_result_id, mc_result_id, job_id, and operation_key separate in the study record.

Interpret the uncertainty carefully

Monte Carlo reflects the uncertainty distributions encoded in the SwolfPy/Brightway model. It does not establish that those distributions represent actual uncertainty in the waste-management system.