A python-based tool for the design and analysis of hybrid AC/DC grids
Project description
pyflow-acdc
A python-based tool for the design and analysis of hybrid AC/DC grids
pyflow-acdc is a program worked on by ADOreD Project by CITCEA-UPC in collaboration with Youwind
This project has received funding from the European Union’s Horizon Europe Research and Innovation programme under the Marie Skłodowska-Curie grant agreement No 101073554.
Important
This project is experimental and under active development. Issue reports and contributions are very welcome.
Citation
If you use this package in your research, please cite the appropriate publication(s):
General usage:
B. C. Valerio, V. A. Lacerda, M. Cheah-Mane, P. Gebraad and O. Gomis-Bellmunt,
"An Optimal Power Flow Tool for AC/DC Systems, Applied to the Analysis of the
North Sea Grid for Offshore Wind Integration," in IEEE Transactions on Power Systems,
vol. 40, no. 5, pp. 4278-4291, Sept. 2025, doi: 10.1109/TPWRS.2025.3533889.
For market integration into optimal power flow:
Valerio B C, Lacerda V A, Cheah-Ma˜ne M, Gebraad P and Gomis-Bellmunt O 2025
Optimizing offshore wind integration through multi-terminal dc grids: a market-based opf
framework for the north sea interconnectors IET Conference Proceedings 2025(6) 150–155
URL https://digital-library.theiet.org/doi/abs/10.1049/icp.2025.1198
For transmission expansion planning:
B. C. Valerio, M. Cheah-Mane, V. A. Lacerda, P. Gebraad, and O. Gomis-
Bellmunt, “Transmission expansion planning for hybrid AC/DC grids using
a mixed-integer non-linear programming approach,” International Journal of
Electrical Power & Energy Systems, vol. 174, p. 111459, 2026. [Online]. Available:
https://www.sciencedirect.com/science/article/pii/S0142061525010075
For array optimization:
Castro Valerio, B., Gebraad, P. M. O., Cheah-Mane, M., A. Lacerda, V., and Gomis-Bellmunt, O.: A multi-stage methodology for wind park inter-array cabling: graph preparation, layout, and sizing, Wind Energ. Sci. Discuss. [preprint], https://doi.org/10.5194/wes-2026-53, in review, 2026.
Installation
Basic Installation
Install from PyPI:
pip install pyflow-acdc
Requirements: Python 3.10 or higher
Quick start
Bundled example grids are registered on pyf.cases when you import the package:
import pyflow_acdc as pyf
grid, res = pyf.cases["case24_TEP"]() # static TEP case with expandable AC lines
grid, res = pyf.cases["case39_acdc"]() # hybrid AC/DC OPF case
Factories live under pyflow_acdc/example_grids/ (PF/, OPF/, TEP/,
Wind_Array/). See the usage guide
for the full case list and keyword arguments (for example NS_MTDC_2025).
To load a MATPOWER / MATACDC case saved as a .mat file:
grid, res = pyf.create_grid_from_mat("path/to/case.mat")
TEP-style .mat files may include expandable elements via keys such as
ne_branch (AC), branchdc_ne / busdc_ne (DC), and convdc_ne
(converters). Sample files used in tests are under pyflow_tests/.
For Users
Example grids and wind-farm data ship with the installed package. Some cases
(for example NS_MTDC_2025) also use CSV time series from
examples/North_Sea_grid_data/ in the repository, or from GitHub when
online=True.
For Developers
Initial Setup
-
Install Git if you haven't already:
# For Ubuntu/Debian sudo apt-get install git # For Windows: Download from https://git-scm.com/download/win
-
Clone the repository:
git clone https://github.com/CITCEA-UPC/pyflow_acdc.git
cd pyflow_acdc
- Install in development mode:
pip install -e .
This installs the package in "editable" mode, allowing you to modify the code without reinstalling.
Making Changes
- Create a new branch for your changes:
git checkout -b new-branch-name
git push origin new-branch-name
- To push your changes to the remote repository:
git add .
git commit -m "Description of your changes"
git pull origin new-branch-name
git push origin new-branch-name
- To pull the latest changes from the remote repository:
git pull origin main
To merge your changes into the main branch please contact the repository owner.
TestPyPI Publishing (Collaborators)
Any collaborator with permission to run GitHub Actions can publish a test build to TestPyPI using the manual workflow.
- Open the repository on GitHub.
- Go to Actions -> Publish to TestPyPI (manual).
- Click Run workflow and confirm.
This publishes the current branch build to TestPyPI for validation without affecting the production PyPI package.
Optional Dependencies
You can install pyflow_acdc with optional dependencies using pip:
# Install with all optional dependencies (excludes gurobipy, which requires a license)
pip install pyflow-acdc[All]
# Or install specific optional dependency groups:
pip install pyflow-acdc[mapping] # For mapping features (folium, branca)
pip install pyflow-acdc[OPF] # For optimal power flow (pyomo)
pip install pyflow-acdc[Dash] # For Dash web applications
pip install pyflow-acdc[LINEAR_ARRAY] # OR-Tools route MIP + CSS + HiGHS (ortools, highspy)
pip install pyflow-acdc[TEP_pymoo] # For TEP with pymoo (pymoo, pyomo)
pip install pyflow-acdc[Gurobi] # For Gurobi solver (requires license)
pip install pyflow-acdc[plotting] # For static image export (kaleido)
Or install individual packages manually:
For mapping:
pip install folium branca
For OPF:
pip install pyomo
conda install -c conda-forge ipopt
For Array Optimization (OR-Tools path):
pip install ortools
pip install highspy # Optional: for HiGHS solver
For Array Optimization (Pyomo CSS path):
pip install pyomo
# Optional: Gurobi for faster MIP/CSS
pip install gurobipy
For TEP with pymoo: (still in development)
pip install pymoo pyomo
Note: Both pymoo (for outer optimization) and pyomo (for inner OPF subproblems) are required.
For static image export (plotly):
pip install kaleido
pyflow_acdc has callback capabilities and has been tested with the following pyomo linked solvers:
ipopt
conda install -c conda-forge ipopt
highs
pip install highspy
gurobi (requires external licensing)
pip install gurobipy
glpk
pip install glpk
cbc
conda install -c conda-forge coincbc
bonmin
conda install -c conda-forge coin-or-bonmin
Note: ipopt and bonmin are not available on PyPI and must be installed via conda-forge.
For Bonmin (Linux only):
# First install system package:
sudo apt update
sudo apt install coinor-libbonmin-dev
# Then install Python interface:
conda install -c conda-forge coin-or-bonmin
For Dash:
pip install dash
Test
Run the test suite:
pyflow-acdc-test
Test flags (see also docs/testing.rst and CONTRIBUTING.md):
--quick # Fast subset (run before opening a PR)
--docs # Documentation literalinclude examples
--tep # TEP tests only
--opf # OPF tests only
--show-output # Stream each case's output
Coverage:
pip install -e ".[tests]"
pytest pyflow_tests/ --cov=pyflow_acdc --cov-report=term-missing
CI uploads coverage to Codecov on each
push/PR to main (requires the CODECOV_TOKEN repository secret). Reports include
pyflow_acdc package code (including example_grids factories); pyflow_tests/
fixtures are excluded. Per-module reports and the coverage badge are maintained there.
Documentation
Online documentation can be found at:
https://pyflow-acdc.readthedocs.io/
To build the latest documentation of a branch, build it locally.
To build the documentation:
cd docs
pip install -r requirements.txt
make html
Note: On Windows, you may need to use make.bat html or install make (e.g., via Chocolatey or WSL).
The documentation will be available in docs/_build/html/index.html
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 pyflow_acdc-0.6.0.tar.gz.
File metadata
- Download URL: pyflow_acdc-0.6.0.tar.gz
- Upload date:
- Size: 13.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5637e2ecf62605e462110721b98a8cd8f32a104224d6df71fb8f2cb370cf92aa
|
|
| MD5 |
8c2cf727592192129d46034ba02720f6
|
|
| BLAKE2b-256 |
c14337daa8e8b52e320b4ededa8398be1651d442fdda1bee7e92fb29c1f83e41
|
Provenance
The following attestation bundles were made for pyflow_acdc-0.6.0.tar.gz:
Publisher:
publish-to-pypi.yml on CITCEA-UPC/pyflow_acdc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyflow_acdc-0.6.0.tar.gz -
Subject digest:
5637e2ecf62605e462110721b98a8cd8f32a104224d6df71fb8f2cb370cf92aa - Sigstore transparency entry: 2010187302
- Sigstore integration time:
-
Permalink:
CITCEA-UPC/pyflow_acdc@d4c8d4791cbc5f6dca702aa40b3c845860c3732b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/CITCEA-UPC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@d4c8d4791cbc5f6dca702aa40b3c845860c3732b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyflow_acdc-0.6.0-py3-none-any.whl.
File metadata
- Download URL: pyflow_acdc-0.6.0-py3-none-any.whl
- Upload date:
- Size: 13.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e108ef7de9aa47152c9648fa891b67e7275f18080fbe76ae9df176110733edc
|
|
| MD5 |
7c093a7e2e306a28a1ef6b4bab2e8a1b
|
|
| BLAKE2b-256 |
e8846ce2b22b81d1cc359f6167ed36038f5e0559b73c0f323aa27d02ef1f406e
|
Provenance
The following attestation bundles were made for pyflow_acdc-0.6.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on CITCEA-UPC/pyflow_acdc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyflow_acdc-0.6.0-py3-none-any.whl -
Subject digest:
3e108ef7de9aa47152c9648fa891b67e7275f18080fbe76ae9df176110733edc - Sigstore transparency entry: 2010187494
- Sigstore integration time:
-
Permalink:
CITCEA-UPC/pyflow_acdc@d4c8d4791cbc5f6dca702aa40b3c845860c3732b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/CITCEA-UPC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@d4c8d4791cbc5f6dca702aa40b3c845860c3732b -
Trigger Event:
workflow_dispatch
-
Statement type: