SkillAgentSearch skills...

VeraGrid

VeraGrid, a cross-platform power systems software written in Python with user interface, used in academia and industry.

Install / Use

/learn @SanPen/VeraGrid

README

VeraGrid

VeraGrid is a top tier power systems planning and simulation software. As such, it has all the static analysis studies that you can think of, plus linear and non-linear optimization functions. Some of these functions are well known, while others you may have never heard of as they are a product of cutting-edge research.

VeraGrid_banner.png VeraGrid

Codacy Badge Documentation Status Build Status DOI Downloads Discord

VeraGrid started in 2015 with a clear objective: create a solid programming library and a user-friendly interface. This straightforward approach sparked many innovations — some driven by the necessity for commercial use, and others fueled by curiosity and research.

Whether you're a pro needing free tools, a researcher wanting a real-world tested platform, a teacher sharing commercial-grade software insights, or student diving into practical algorithms, VeraGrid's got your back. It's a high quality product made for all of us now and for the future generations.

Installation

VeraGrid is a software made in the Python programming language. Therefore, it needs a Python interpreter installed in your operative system.

The VeraGrid project is divided in three packages:

  • VeraGridEngine: A package with the database and calculations logic.
  • VeraGridServer: A package that serves an API-rest to use VeraGridEngine remotely.
  • VeraGrid: A package that contains the Graphical User Interface (GUI) and operates with VeraGridEngine and VeraGridServer seamlessly.

To install everything, you only need to install the VeraGrid package and the others will be installed as dependencies.

<img height="300" src="doc/md_source/figures/Packages.png"/>

Standalone setup

If you don't know what is this Python thing, we offer a Windows installation:

Windows setup

This will install VeraGrid as a normal windows program, and you don't need to worry about any of the previous instructions. Still, if you need some guidance, the following video might be of assistance: Setup tutorial (video).

Package installation

We recommend installing the latest version of Python and then, install VeraGrid with the following terminal command:

pip install VeraGrid

You may need to use pip3 if you are under Linux or macOS, both of which come with Python pre-installed already.

Install into an environment

python3 -m venv gc5venv
source gc5venv/bin/activate
pip install VeraGrid
veragrid

Run the graphical user interface

Once you install VeraGrid in your local Python distribution, you can run the graphical user interface with the following terminal command:

veragrid

If this doesn't work, try:

python -c "from VeraGrid.ExecuteVeraGrid import runVeraGrid; runVeraGrid()"

You may save this command in a shortcut for easy future access.

Install only the engine

Some of you may only need VeraGrid as a library for some other purpose like batch calculations, AI training or simple scripting. Whatever it may be, you can get the VeraGrid engine with the following terminal command:

pip install VeraGridEngine

This will install the VeraGridEngine package that is a dependency of VeraGrid.

Again, you may need to use pip3 if you are under Linux or MacOS.

Features

VeraGrid is packed with features:

  • Large collection of devices to model electricity grids
  • AC/DC multi-grid power flow
  • 3-phase unbalanced power flow and short circuit
  • AC/DC multi-grid linear optimal power flow
  • AC linear analysis (PTDF & LODF)
  • AC linear net transfer capacity calculation
  • AC+HVDC optimal net transfer capacity calculation
  • AC/DC Stochastic power flow
  • AC Short circuit
  • AC Continuation power flow
  • Contingency analysis (Power flow and LODF variants)
  • Sigma analysis (one-shot stability analysis)
  • Investments analysis
  • Bus-branch schematic
  • Substation-line map diagram
  • Time series and snapshot for most simulations
  • Overhead tower designer
  • Inputs analysis
  • Model bug report and repair
  • Import many formats (PSSe .raw/rawx, epc, dgs, matpower, pypsa, json, cim, cgmes)
  • Export in many formats (veragrid .xlsx/.veragrid/.json, cgmes, psse .raw/.rawx)

All of these are industry tested algorithms, some of which surpass most commercially available software. The aim is to be a drop-in replacement for the expensive and less usable commercial software, so that you can work, research and learn with it.

Resources

In an effort to ease the simulation and construction of grids, We have included extra materials to work with. These are included in the standalone setups.

Tutorials and examples

Matpower grids

Matpower's excellent formulations and consistency has allowed this and other projects to develop, relying on its sound math. That is why VeraGrid reads Matpower cases out of the box, without you having to do anything special. And of course, VeraGrid solves all Matpower 8 provided grids, solving the continental USA case in about 1 second:

[VeraGrid]

Find the results at the benchmarks page for more details.

Results simulated with AMD 9750x and 64 GB of RAM under Ubuntu 24.04. All solved using Newton-Raphson, and only using the provided solution that comes with the files when the flat start fails.

Cool right?

API

Since day one, VeraGrid has been meant to be used as a library as much as it was meant to be used from the user interface. Following, we include some usage examples, but feel free to check the documentation out where you will find a complete description of the theory, the models and the objects.

Understanding the program structure

VeraGrid structure is composed by objects arranged in a "database" and by "structs" at a deeper level. Learn here why.

All simulations in VeraGrid are handled by the simulation drivers. The structure is as follows:

<img height="250" src="doc/md_source/figures/DataModelSimulation.png"/>

Any driver is fed with the data model (MultiCircuit object), the respective driver options, and often another object relative to specific inputs for that driver. The driver is run, storing the driver results object. Although this may seem overly complicated, it has proven to be maintainable and very convenient.

Snapshot vs. time series

VeraGrid has dual structure to handle legacy cases (snapshot), as well as cases with many variations (time series)

  • A snapshot is the grid for a particular moment in time. This includes the infrastructure plus the variable values of that infrastructure such as the load, the generation, the rating, etc.

  • The time series records the variations of the magnitudes that can vary. These are applied along with the infrastructure definition.

In VeraGrid, the inputs do not get modified by the simulation results. This essential concept helps to maintain the independence of the inputs and outputs, allowing the replicability of the results. This key feature is not true for other open-source or commercial programs.

A snapshot or any point of the time series, may be compiled to a NumericalCircuit. This object holds the numerical arrays and matrices of a time step, ready for the numerical methods. For those simulations that require many time steps, a collection of NumericalCircuit is compiled and used.

<img height="280" src="doc/rst_source/figures/DataModel.png"/>

It may seem that this extra step is redundant. However, the compilation step is composed by mere copy operations, which are fast. These steps greatly benefit the efficiency of the numerical calculations since the arrays are aligned in memory. The VeraGrid data model is object-oriented, while the numerical circuit is array-oriented (despite being packed into objects)

Loading a grid

import VeraGridEngine as vg

# load a grid (.veragrid, .m (Matpower), .raw (PSS/e) .rawx (PSS/e), .epc (PSLF), .dgs (PowerFactory)
my_grid = vg.open_file("my_file.veragrid")

In the case of CIM/CGMES, you may need to pass a lis

View on GitHub
GitHub Stars525
CategoryDevelopment
Updated2d ago
Forks124

Languages

Python

Security Score

100/100

Audited on Mar 26, 2026

No findings