Skip to main content

PyPSA-CL — Long-Term Capacity Expansion Model of the Chilean National Electricity System

A long-term generation, storage and transmission capacity expansion model of Chile's National Electricity System (Sistema Eléctrico Nacional, SEN, 234 nodes), built on PyPSA. The model was developed for the Long-Term Energy Planning process (Planificación Energética de Largo Plazo, PELP 2028-2032).

The optimisation co-optimises investment and hourly operation across multiple representative periods, subject to system-level operating constraints (inertia, operating reserve), build-rate limits, CO₂ emission caps, unserved-energy limits and discrete transmission expansion. A detailed hydraulic network couples hydro generation to water balances, inflows and irrigation.

Repository layout

.
├── src/
│   └── pypsa_cl/        Python package
│       ├── main.py      Entry point and epoch/scenario driver
│       ├── GUI.py       Scenario and epoch configuration interface
│       ├── tools.py     Data loaders, constraints and result exporters
│       ├── cli.py       `pypsa-cl` command
│       └── assets/      GUI images
├── data/                Input workbooks (not tracked; see below)
├── outputs/             Model outputs (generated at run time)
├── pyproject.toml
├── CHANGELOG.md
├── LICENSE
└── README.md

Installation

The model requires Python 3.10 or newer (with Tk, which the standard Windows installer includes) and a mixed-integer linear programming solver supported by PyPSA. The open-source HiGHS solver is installed automatically and is the default; Gurobi (licence required), CPLEX and CBC can also be selected. The GUI is developed and tested on Windows.

From PyPI

python -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
pip install pypsa-cl             # with Gurobi: pip install "pypsa-cl[gurobi]"
pypsa-cl                         # downloads the input data on first run, then opens the GUI

From source

git clone https://github.com/paredes-vergara/PyPSA-CL.git
cd PyPSA-CL
pip install -e .                 # or: pip install -e ".[gurobi]"

Working folder

The model writes its results to an outputs/ folder inside a working folder. The working folder is:

  1. the folder given by the PYPSA_CL_ROOT environment variable, if set;
  2. otherwise, the current directory if it contains data/;
  3. otherwise, the repository root when running from a source checkout;
  4. otherwise, the current directory.
my-pelp-run/
├── data/        Optional: your own copy of the input workbooks (see below)
└── outputs/     Created automatically

Input data

The model reads the following workbooks:

File Contents
Topology.xlsx Buses, lines and generator/storage technical data
Loads.xlsx Demand time series by node and scenario
Profiles.xlsx Variable renewable and CSP availability profiles
Costs.xlsx Fuel prices and generation/storage investment costs
Hydraulic network.xlsx Water nodes, links and reservoirs
Water time series.xlsx Inflow and irrigation series
Policy levers.xlsx CO₂ tax, coal phase-out and expansion schedules

These workbooks (about 245 MB) are too large for the PyPI package, so they are published separately on Zenodo (doi:10.5281/zenodo.24204230) and downloaded automatically the first time the model runs. Each download is checked against its SHA-256 checksum. To fetch them without starting the model, run pypsa-cl --download-data; pypsa-cl --data-dir shows where they are stored.

The data folder is:

  1. the folder given by the PYPSA_CL_DATA_DIR environment variable, if set;
  2. otherwise, the data/ folder of the working folder, if it exists;
  3. otherwise, ~/.pypsa-cl/data-v<data version> (shared by all working folders).

Workbooks already present in the data folder are used as they are and never overwritten, so you can run the model with your own modified inputs by placing all seven workbooks in data/. Only missing workbooks are downloaded. The download source can be changed with the PYPSA_CL_DATA_URL environment variable (a base URL under which the files are served by name).

The GUI header logo and network map ship with the package; files named logo_PELP.png or sen_network.png placed in data/ take precedence.

Disclaimer: Although the data for CSP and hydro ROR candidate generators is present in the Topology file, these candidates were not implemented in this version due to time constraints. These candidates should be implemented in the Final Report version.

Usage

Interactive (GUI)

cd my-pelp-run          # working folder: results go to my-pelp-run/outputs/
pypsa-cl                # equivalent: python -m pypsa_cl

The interface lets you queue one or more global scenarios, each composed of one or more investment epochs. Preset scenario packages (E1-N3) auto-fill and lock the six component selectors (demand, climate, hydrology, fuel price, generation investment cost, storage investment cost); the Otro option unlocks free configuration. Scenarios can be executed sequentially or in parallel (one independent process per scenario, with a configurable RAM limit).

Headless (single scenario)

A single scenario can be run without the GUI by supplying its configuration as JSON:

pypsa-cl --scenario-json path/to/scenario.json

Output location is controlled by the PYPSA_CL_OUTPUTS_DIR environment variable; when unset, results are written under outputs/ in the working folder. Run pypsa-cl --help for a summary of the command-line options.

Versioning

Releases follow the stages of the PELP 2028-2032 process: 0.1.x corresponds to the Preliminary Report, 0.2.x to the Final Report and 1.0.0 to the Definitive Report. See CHANGELOG.md.

Outputs

Each run writes the following CSV files to the output folder:

File Contents
generation_results.csv Dispatch per asset and snapshot, with reserve, available and curtailment columns
transmission_results.csv Flows per line and snapshot
generation_expansion.csv Generation and storage expansion per epoch
transmission_expansion.csv Transmission expansion per epoch
installed_capacity.csv Installed capacity per epoch
system_costs.csv System cost breakdown
nodal_marginal_prices.csv Nodal marginal prices
run_metadata_log.csv Parameters, solver settings and timings per epoch
progress.json Live run status for monitoring

In multi-scenario runs the outputs are concatenated into the same files, ordered by scenario and identified by the global_scenario column.

Acknowledgements

Developed by the Unit of Planning and Climate Change (Unidad de Planificación y Cambio Climático), Division of Strategic Planning and Sustainable Development, Ministry of Energy of Chile.

License

Released under the MIT License. See LICENSE.

Metadata

Release files for pypsa-cl 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypsa-cl 0.1.0
File Size Uploaded Provenance Actions
pypsa_cl-0.1.0.tar.gz 181.1 kB Without provenance Details for pypsa_cl-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pypsa-cl 0.1.0
File Interpreter ABI Platform Actions
pypsa_cl-0.1.0-py3-none-any.whl Python 3 none any Details for pypsa_cl-0.1.0-py3-none-any.whl

Total release size: 358.7 kB

Release files / pypsa_cl-0.1.0.tar.gz

Download URL pypsa_cl-0.1.0.tar.gz
Size 181.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c83ae7102cd2ea7a67e7cc06748b2163f09458c8cecfc5653a292d762c34a8e6
BLAKE2b-256 checksum
How to use checksums
86336b28e128af4c26bfb475cbbbafddfc968aa733a1471e2053896c2982c053
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / pypsa_cl-0.1.0-py3-none-any.whl

Download URL pypsa_cl-0.1.0-py3-none-any.whl
Size 177.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
284175595844ea7a2953cc98acd33c8a71af590fd8d621d9bcfecc53910566dd
BLAKE2b-256 checksum
How to use checksums
81a2efe85e4e1bd5fcf00bf16abda9314b25be30d5a97b016d94e82785b0cba5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for pypsa-cl 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page