Optimal Power Flow

The Optimal Power Flow (OPF) model represents the problem of determining the best operating levels for electric power plants in order to meet demands given throughout a transmission network, usually with the objective of minimizing operating cost.

Because electrical power flows according to nonlinear, nonconvex functions of the system's physical characteristics, this can be a difficult problem. However, in actual operations, an instance with the entire distribution network must be solved in real time (every five minutes for many Independent System Operators) to ensure demand is met accurately.

This case study will present several of the most commonly used formulations of the OPF problem and allow for running of the model with data sets given in one of several supported formats, which can be converted to a native GDX format.

Quick Start Guide

To get started with this collection of Optimal Power Flow models, you will need the following items.

  1. Download and install the latest version of GAMS.
  2. Download and extract the model archive from the Model Archive section into a suitable directory, for example, /path/models.
  3. Download and extract the Testcases suite from the the Data Utilities and Test Cases section into a suitable directory, for example, /path/data/testcases.
  4. Consult the model options document located in the Model Archive section to see the available runtime options.
  5. To utilize the Data Utilities archive, download and extract the Data Utilities archive from the Data Utilities and Test Cases section into a suitable directory, for example, /path/data/utils. Consult the Data Utilities documentation located in the same section to see the available runtime options.

Model Archive

The files contained in this section include two documents and a zip archive of the GAMS models. The model formulation document describes the various OPF formulations and the model options document provides a list of the available features and options for each model. The zip archive includes the GAMS models for the OPF formulations and auxiliary files that are required in multiple models.

Data Utilities and Test Cases

The data utility archive (updated on 5/21/2015) provides data management utilities and includes tools for:

  1. Data conversion between 3 different formats - GAMS (.gdx), Matpower (.m), PSSE(.raw)
  2. Shift matrix generation for use with the GAMS model archive
  3. Output the information into an Excel spreadsheet for easy viewing

Usage details for the data utility archive can be found in the Data Utilities documentation.

The Testcase suite (updated on 5/21/2015) consists of GDX files of IEEE testcases and includes six RTS-96 with 24 hour demand data. More information on the RTS-96 testcases can be found in this document: info_rts96.pdf.

If you require the use of Shift Matrices with the test case suite, you also will need to download the shift matrix archive (~380MB, updated on 5/21/2015) and extract the files into the same location as the GDX testcases. To avoid the large download on a slow connection, you may instead generate the shift matrices using the data utilities archive. See the documentation for more information on how to do this.

  • Matpower and PSSE formatted data files

    The zip archives included below provide the Matpower and PSSE versions of the test cases and were generated using the tools in the data utility archive.

    The Matpower archive consists of .m files and can be used with Matpower [1], which is a downloadable package available for use in Matlab. Note that additional data fields have been generated as part of this project, which Matpower is unable to use. The information has been retained for completeness, and the files provided here should work the same as any regular Matpower case study.

    The PSSE archive consists of .raw files in PSSE format and do not currently include cost data as this format does not have fields for generator cost characteristics.

    The GDX archive was first introduced in the Data Utilities section above.

  • Excel Archive

    The Excel archive (updated on 5/21/2015) consists of .xlsx files describing the Testcase data.

    All Excel files start with a "Table_of_Contents" sheet that lists all set and parameter entries of the GAMS formatted data file in the first column. Each entry is a clickable link that guides the user to the appropriate sheet with the stored data values. All other data sheets are named after GAMS sets and parameters from the input file and have a clickable link ("TOC") in the A1 cell that returns the user to the main "Table_of_Contents" sheet.

  • Solution Files
    The solution archive provides gdx-formatted files of DC, DC-shift and AC (polar) solutions. The RTS solutions are provided by UC DC and UC Polar models. These files were created using the --savesol option provided in the OPF models of the model archive.

System Characteristic Inference

The following three documents provide more information on inferring physical characteristics and auxiliary data that were added as part of the GDX files.

  1. The Line Flow Approximation document (last updated on 5/13/2015) describes the 'uwcalc' fields of line-flow limits.
  2. The documentation on capability curves (last updated on 5/13/2015) explains the process of estimating the elements regarding generator capability curve, also referred to as D-curves.
  3. This document on ramp rates (last updated on 5/13/2015) describes how ramp rates for active power are inferred in the 'uwcalc' fields.

Model Results

This section presents results from model testing.

  • Model, Solver and Initial Point Comparison

    To evaluate ACOPF solution characteristics, three different ACOPF model formulations (polar power-voltage, rectangular power-voltage and rectangular current-voltage) are utilized. Based on these results, the Polar Power-Voltage formulation seems to scale best. On the larger cases, Ipopt and KNITRO perform by far the best of the solvers, generally solving the models at least 5 times faster than the other solvers. Additionally, Ipopt and KNITRO generally were able to find the locally optimal solution using any of the deterministic methods for initial point choice, while Conopt and Snopt frequently hit the time limit or converged to an infeasible point, and Minos occasionally exited with status unbounded/badly scaled problem.

    The attached report, TASK4.pdf, provides a more in depth examination of the different ACOPF formulations, initial conditions and solvers.

  • Initial Condition Improvements

    The report TASK5.pdf discusses our testing of possible improvements on the existing initial conditions to improve robustness. It follows from the report TASK4.pdf available above in the Model, Solver and Initial Point Comparison section. It also compares performance of the different UC AC models and discusses strategies for finding feasible solutions in large scale datasets.

  • Comparison with Matpower

    Comparing the performance of Matpower with our Polar ACOPF model (both using IPOPT with linear solver MA27) with standard options, we find that our model, although slightly slower, has very comparable time performance statistics to Matpower. The table here displays the real time (in seconds) it takes to converge to objective values within numerical tolerances of each other.


[1] Zimmerman, R.D.; Murillo-Sánchez, C.E.; Thomas, R.J., "MATPOWER: Steady-State Operations, Planning, and Analysis Tools for Power Systems Research and Education," IEEE Transactions on Power Systems, vol.26, no.1, pp.12,19, Feb. 2011.

Optimization Category (Linear Programing, Integer, MIP and etc.):