VeraGrid Feature Spotlight: Optimal Power Flow:

Titouan Delorme
October 31, 2025

VeraGrid Feature Spotlight: Optimal Power Flow

Welcome back to the VeraGrid Feature Spotlight series. In each installment, we explore one of the core capabilities of VeraGrid, our open-source platform for modern power system analysis. This time, we focus on Optimal Power Flow (OPF) — a key tool that helps engineers and operators determine how to supply electricity at minimum cost while respecting all physical and operational constraints of the grid.

From Power Flow to Optimization

Where a conventional power flow determines the steady-state behavior of the network, an optimal power flow adds an extra layer: economics. OPF minimizes the cost of generation while ensuring that power balance, line ratings, voltage limits, and other technical conditions are satisfied. It forms the basis for how most power systems are planned and operated.

DC and AC OPF in VeraGrid

The video first introduces the DC Optimal Power Flow, the most widely used formulation in industry. It assumes that voltage magnitudes remain close to nominal and focuses on active power and phase angles. The result is a linear optimization problem that can be solved very efficiently even for large systems, providing a clear view of congestion patterns and marginal costs.

In VeraGrid, the DC OPF is solved using a Mixed-Integer Programming (MIP) framework. This allows users to include discrete decisions such as unit commitment or line switching in the same optimization, combining speed with flexibility.

The second part of the video covers the AC Optimal Power Flow, which models the full electrical behavior of the grid, including reactive power, voltage variation, and losses. VeraGrid’s custom interior-point solver handles these nonlinear equations and constraints simultaneously, providing a realistic picture of how the system behaves when close to voltage or reactive limits.

Running and Validating the OPF

For the demonstration, we use the IEEE-14-bus test system to show how an OPF study is configured and executed within VeraGrid. The walkthrough explains how to define generator cost functions, load-shedding penalties, and line-overload costs, and then explores the main solver settings for both linear and nonlinear runs.

The video then examines key results: generator dispatch, voltage angles, marginal prices, and branch loadings. Finally, it shows how to transfer OPF results directly into a power flow to perform a full AC validation, ensuring that the optimized dispatch remains feasible when the nonlinear equations are considered.

Integrating OPF into Modern Workflows

The session closes by highlighting how these studies can be automated through VeraGrid’s scripting interface, allowing users to combine DC and AC simulations, run time-series optimizations, or benchmark different solver configurations. Together, these capabilities make OPF a practical tool for everything from operational studies to long-term grid planning.

If you want to see OPF in action, watch the full video and explore how VeraGrid brings optimization and grid equations together in one environment.

Share your thoughts with us
Titouan Delorme
October 31, 2025
Avatar photoAvatar photoAvatar photo

Let's solve your doubts

Cannot find the answer you are looking for? Please chat to our friendly team.