ENS - An Electric Network Simulator
- C code freely available for academic purposes -

Screenshot of ens GUI

 Lluís Ros
Institut de Robòtica i Informàtica Industrial (CSIC / UPC)
Llorens Artigas 4-6, 08028 Barcelona

e-mail: llros followed by at ir dot upc dot es

Introduction | Snapshots | Conditions of useC code | Future work


ENS is an electric network simulator for weakly-meshed distribution networks. It was initially built as a pluggin application for a loss reduction tool developed at IRI, in the course of a Master's degree project. Along the years, I've been working the code until arriving at its present form, which surely will evolve in the future with necessary enhancements.

The simulator implements, with some improvements, the sweeping/compensation method by Luo and Semlyen, published in:

G. X. Luo and A. Semlyen. "Efficient load flow for large weakly meshed networks", IEEE Trans. on Power Systems, Vol. 5, No. 4, November 1990.

The network state is computed from the following input:
As output, the simulator returns all complex bus voltages and complex branch currents. Cycles (i.e., loops, or meshes) are allowed to exist in the network, even if they have null-impedance. PV buses can also be dealt with, if treated as a special kind of loop breakpoint (see the above paper). The current implementation allows changing any branch state (open or closed) and recomputing only the network portion which is affected by such change.

The simulator comes along with a simple gnome-based graphical user interface, written with Glade 2. This interface allows seeing a diagram of the network, changing the branch states, and automatically recomputing the whole network state. It also highlights any existent de-energized areas.

Currently, there is no documentation available for ENS. I hope to be able to provide one in the future. In the meantime, an experienced programmer can get a grasp of the programming philosophy by browsing the code, which includes numerous comments throughout.

Conditions of use

The software included below may be used by anyone (hereafter the "user") agreeing with the following conditions:
  1. The user will only use the software for nonprofit, nonmilitary purposes. Any commercial use of this software requires the obtention of an appropriate software license jointly issued by the author and the Institut de Robòtica i Informàtica Industrial (UPC/CSIC). Should you be interested in such license, please contact the author at the address above.
  2. On any publication reporting results using this software, the user commits to make a reference to the software, as follows:
    L. Ros, "ENS: An Electric Network Simulator for Distribution Networks".
    Institut de Robòtica i Informàtica Industrial, Barcelona, Spain.
    Available through http://www-iri.upc.es/people/ros
  3. The user will report the software's author about any trouble he meets in the use ofthis software. The author will remove eventual bugs at his earliest convenience.
  4. The author assumes no responsibility for any trouble or damage caused by the user when using this software for any purpose. 
  5. The user will notify the author (to the address given above) that she will use the software. In her notification the user is asked to please identify herself, to state she accepts these conditions, and briefly report the purpose for which the software will be used.

C code

The C files of the plain ENS simulator follow:

Functions to create, destroy, simulate, and manoeuvre a network:
ens.c, ens.h
Functions to solve linear systems: 
ens_dludcmp.c, ens_dlubksb.c, ens_nrutil.c, ens_nrutil.h
Functions for complex arithmetic:
 complex.c, complex.h
Functions to handle undirected graphs:
glr.c, glr.h, llr.c, llr.h
Suport files:
complex.c, complex.h, general.h, debug_macros.h, boolean.h
Simple test files:
enstest.c, glrtest.c
Makefile (for Linux Ubuntu with gcc):

The C files of the graphical user interface follow:

Main program:
Functions to handle event callbacks (as generated by glade-2):
callbacks.c, callbacks.h
Global variables:
Non-editable files generated by glade-2:
interface.c, support.c

Two fictitious test-case networks are also provided, given according to the following format:

Test case 1 (1207 buses, 1209 buses, 6 loops, 4 sources):
Test case 2 (1360 buses, 1369 branches, 13 loops, 4 sources):

Future work

The software can be extended in a number of ways. Here's a list of possible enhancements that would be worthwhile to include: