Optimal Power Flow

OPF tries to allocate available generation to meet the current load while keeping transmission lines within the limits of what they can carry. OPF adds a dimension of space to the ED problem. Currently minpower performs the simplest version of power flow, called decoupled OPF and considers only real power [1]. The classic text is Bergen & Vittal.

The problem

mingCg(Pg)

System Message: ERROR/3 (/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/minpower/checkouts/v1.1.2/doc/optimal-power-flow.rst, line 20)

Syntax error: "\;"

\mathrm{s.t.} \; P_{\min (g)} \leq P_g \leq P_{\max (g)}  \; \forall  \; \mathrm{generators} \;(g)

System Message: ERROR/3 (/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/minpower/checkouts/v1.1.2/doc/optimal-power-flow.rst, line 22)

Syntax error: "\;"

\mathrm{s.t.} \; P_{\mathrm{gen} (i)} - P_{\mathrm{load} (i)} - \sum_j P_{ij} = 0   \; \forall  \; \mathrm{buses} \;(i)

System Message: ERROR/3 (/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/minpower/checkouts/v1.1.2/doc/optimal-power-flow.rst, line 24)

Syntax error: "\;"

\mathrm{s.t.} \; P_{\min (ij)} \leq P_{ij} \leq P_{\max (ij)} \forall  \; \mathrm{lines} \;(ij)

In this mathematical formulation generators are indexed by g. Pg is a generator’s power output and Cg() is its cost function. The objective is to minimize the total cost. There are three constraints:

  • each generator must be within its real power limits
  • inflow must equal outflow at each bus
  • each line must be within its real power limits

For DCOPF, the real power flow on a line P ij= 1 X ij θi-θj depends linearly on the voltage angles of the buses it connects ( θ i, θ j) and its own reactance X ij. Bus angles are the difference in voltage angle between the bus and the reference bus which has angle 0 .

The basics

Let’s say you have made a folder called mypowerflow and put the information about your problem in the folder. Then if you run the script:

from minpower import solve
solve.problem('mypowerflow/')

OPF is difficult to visualize (please send suggestions), but here is what minpower creates:

./_static/demos/powerflow/powerflow.png
  • A red colored transmission line indicates a limit on that line, while gray lines are below their limits. The Tacoma Seattle line is at its limit. The other two gray colored lines are running below their limits.
  • The width of the line indicates the amount of power flow. The Olympia-Seattle line has the largest flow.
  • The stubs at one end indicate direction of flow. Flow direction is Olympia Seattle.
  • Injected power is shown by the color of the bus. Olympia is injecting power into the system while Seattle is pulling power.

There are also spreadsheet outputs of generator and line information:

generator name, u,    P,       IC
cheap,          True,  0.667,   5.013334
mid grade,      True, 57.6667,  8.153334
expensive,      True, 41.6667, 10.833334

Each generator’s real power output (P) and incremental cost (IC) is output. Because this is a power flow each generator is on (u=True) unless specified in the input spreadssheet.

from,    to,      power,   congestion shadow price
Seattle, Tacoma,  -3.0,    13.7499
Olympia, Tacoma,  2.33333, 0.0
Olympia, Seattle, 5.33333, 0.0

Each line’s real power flow is output. Lines that have congestion will show a positive shadow price. Because the flow is Tacoma Seattle and the from/to fields of the spreadsheet are the other way around, we see a negative power flow. The Seattle-Tacoma line is at its limit, so there is an extra cost to the system from the congestion and the line has a positive shadow price.

These outputs are saved in the mypowerflow folder as powerflow.png, powerflow-generators.csv, and powerflow-lines.csv.

What’s actually going on?

It’s easy once you get the hang of it. minpower will:
  1. read in your files (see get_data)
  2. set up an optimization problem (see solve.create_problem())
  3. send it off to a solver (see optimization.solve())
  4. show you the results (see results.Solution_OPF)

minpower just looks for the files in the mypowerflow directory that describe the generators, loads, and lines.

Tell it the specifics of your problem by editing the generator file (generators.csv):

name,      bus,     cost curve equation
cheap,     Tacoma,  5P + .01P^2
mid grade, Olympia, 7P + .01P^2
expensive, Seattle, 10P + .01P^2

the loads file (loads.csv):

name,       bus,     P
UW,         Seattle, 50
paper mill, Tacoma,  0
smelter,    Olympia, 50

the lines file (lines.csv):

From,    To,      Pmax
Seattle, Tacoma,  3
Olympia, Tacoma,  10000
Olympia, Seattle, 10000

Note

For more information about what options you can specify in each spreadsheet see: Data Input.

Footnotes

[1]Modern power systems often have reactive power issues. While DCOPF is a decent approximate solution with reactive power considered, your results may vary significantly from reality without it.

Project Versions

Table Of Contents

Previous topic

Data Input

Next topic

Data Input

This Page