Skip to content

Quick start

cleorf92 edited this page Sep 24, 2026 · 1 revision

The fastest way to see what aiphoria does is to run the example scenario that comes with the package. This is also a good way to check that your installation works.

1. Run the example

  1. Create a new text file in your project directory, for example aiphoria_example.py.
  2. Copy this code into it and save:
from aiphoria.example import run_example

run_example(remove_existing_output_dir=True)
  1. Run it:
python aiphoria_example.py

By default the results are written to a folder called aiphoria_example in your home directory (C:\Users\<your-name>\aiphoria_example on Windows, ~/aiphoria_example on Linux/macOS).

To write them somewhere else, give an absolute path:

run_example(r"C:\results\aiphoria_example", remove_existing_output_dir=True)

NOTE: remove_existing_output_dir=True deletes the output folder first. Without it, the run stops if the folder already exists.

2. What the example contains

The example uses illustrative values for a simple sawnwood chain in one country, from 2021 to 2030:

  • Industrial roundwood goes to sawmilling, which produces sawnwood and residues.
  • Sawnwood is also imported and exported.
  • Sawnwood is used in construction (mean lifetime 10 years) and furniture (5 years). These are stocks.
  • At end of life, 40% of construction wood is recycled back to sawmilling; the rest, and all furniture, is incinerated.
  • An alternative scenario reduces sawmilling residues by 50% between 2025 and 2030.

You can download the example file from Home and open it in Excel to see how it is built.

3. What to look at first

  1. combined_sankey.html: open it in a web browser. Move the year slider from 2021 to 2030 and watch the flows to incineration and the recycling loop appear as the first products reach end of life.
  2. Baseline/network_graph.html: the same system as a network of processes and flows.
  3. Baseline/Baseline_dynamic_stocks.xlsx, sheet Total_stock: the stock in each product, in m³ and in carbon.

All output files are described in Output files.


Next: Running your own scenario or, to understand the model first, How aiphoria works.

Clone this wiki locally