ANL TD Iterative Power Flow

Transmission-Distribution Power Flow

This example code demonstrates a transmission-distribution steady-state power flow using HELICS with one transmission federate and n distribution federates. Iterations are performed between transmission and distribution federates till consistent boundary conditions are obtained. The consistent boundary conditions, for this case, is given by the voltages (magnitudes and angles) converging to a nearly constant value. The code for the transmission-distribution power flow is written in C and it is tested on Ubuntu and MacOS. It uses the following libraries + PFLOW is a transmission steady-state power flow code that is used by the transmission federate code pflow-helics-trans.c. A shared library for PFLOW (for Linux and MacOS) is provided in the lib directory. PFLOW uses numerical routines from the PETSc library that needs to be installed for PFLOW. Download and installation instructions for PETSc are given below. + OpenDSSc is a C wrapper package for the distribution system package OpenDSS. A shared library for OpenDSSc (for Linux and MacOS) is provided in the lib directory. OpenDSSc uses routines from KLU and OpenDSSDirect. Shared libraries for these packages are available in the lib folder. + HELICS is the co-simulation library used to exchange values between transmission and distribution federates.


Clone the repository

git clone
cd HELICS-Use-Cases/ANL-TD-Iterative-Pflow/


Install HELICS and PETSc libraries by following the instructions below


Compile the broker, transmission, and distribution federate code. The targets are given in the makefile.

make helicsbroker

Running the code

A Jupyter notebook runtdpflow.ipynb is provided to run the T-D co-simulation code. The notebook uses Python2.7, it is not tested with Python 3. It runs a transmission-distribution steady-state power flow on a 200-bus transmission network with IEEE-8500 node feeders connected at the load (boundary) buses. The number of feeders at each boundary bus is determined based on the load at the bus and the feeder injection. The T-D connection configuration is given through a metadatafile that is generated by a MATLAB code (makemetadata.m). The metadata file for the above T-D network is already generated and included in the repo (metadata1). The format of the metadata file is given in makemetadata.m. For a T-D co-simulation of the 200-bus network with IEEE-8500 node feeders and considering T-D interface buses having distribution injection of 11 MW or more results in 37 boundary (T-D interface) buses with 126 distribution feeders.

The number of boundary buses can be varied by setting the nbdry_selected variable appropriately. By default, nbdry_selected is set to 1 that runs a T-D power flow simulation with 1 transmission federate and 3 distribution federates. Read the runtdpflow.ipynb for additional details.