Full Problem Specification

As input data for an OPF problem we have a power system (power grid for non-engineers) consisting of a network of buses (nodes) and branches (arcs).

Each branch is given as an ordered pair \(km\), where \(k\) is the from bus and \(m\) is the to bus.

  1. For each branch \(km\) we have a complex \(2\times 2\) matrix \(Y_{km}\), the admittance-matrix. The following notation will be used below

    \[\begin{split}Y _{km} = \left( \begin{array}{c c} G_{kk} +j B_{kk} & G_{km} +j B_{km}\\ G_{mk} +j B_{mk} & G_{mm} +j B_{mm} \end{array} \right).\end{split}\]

    We also have a value \(L_{km}\) defining the branch limit.

  2. For every bus \(k\) we have two positive values, \(L_k \, \text{and} \, U_k\) with \(L_k \leq U_k\), defining the voltage limits.

  3. For every bus \(k\) we have two values, \(P^{d}_k \, \text{and} \, Q^{d}_k\), the active and reactive loads (demands), respectively.

  4. For every generator \(i\) we have the active and reactive generation limits, \(P^{\min}_i, \, P^{\max}_i, \, Q^{\min}_i, \, \text{and} \, Q^{\max}_i\) with \(P^{\min}_i, \leq P^{\max}_i, \, Q^{\min}_i, \leq Q^{\max}_i\), as well as a (convex) function \(F_i\) defining the generation cost.

  5. At a bus \(k\) we have a set \(G(k)\) defining the set of generators located at bus \(k\).

  6. For a bus \(k\), denote by \(\delta^+(k) \, \text{and} \, \delta^-(k)\) the set of branches outgoing and incoming branches of the form \(km \, \text{and} \, mk\), respectively.

  7. There may be multiple parallel branches \(km\) but in this writeup, for the sake of simplicity, this is being ignored (the mathematical description is easily adapted). There may be multiple generators at a given bus (we account for this explicitly). The same bus may have generators and a nonzero load (demand). In this simple description we ignore bus shunts.

  8. Associated with each branch \(km\) there are values \(\tau_{km} > 0\) (ratio) and \(\phi_{km}\) (angle). These are meaningful in the case of transformers; for a non-transformer branch we set \(\tau_{km} = 1\) and \(\phi_{km} = 0\).

  9. In modern versions discussed in the Recommended Literature, network devices such as FACTS, phase-shifters, and impedance corrections are also incorporated into the model. We do not account for these in this mod.

ACOPF

In the standard ACOPF problem we set a minimum-cost operating point (complex voltages at all buses, active and reactive power generation at each generator) for a power system so that the correct amount of active and reactive power is delivered to each bus and all branch limits are satisfied; both using the AC power flow laws. Under this model, cost is incurred at the generators. At each generator we are given a convex quadratic or piecewise-linear (convex) cost function associated with active power generation.

AC Optimization Model

The following variables are used in the ACOPF problem.

  • For each bus \(k\) we have a complex voltage \(V_k = |V_k| e^{j \theta_k}\) (where \(j = \sqrt{-1}\)).

  • For each branch \(km\) we have the two complex variables \(S_{km} \, \text{and} \, S_{mk}\), the complex power injected into the branch at \(k \, \text{and at} \, m\), respectively. Recall that branches are given as ordered pairs.

  • For each generator \(i\) there is a (complex) generation \(P^{g}_i + j Q^{g}_i\).

There are five classes of constraints:

  1. branch AC power definitions

  2. flow balance

  3. branch limits

  4. generator limits

  5. voltage bounds

  1. The first set of constraints embody AC power flow laws. For each branch \(km\) we have

\[\begin{split}S _{km} = V_k \left[ Y \left( \begin{array}{r} V_{k} \\ V_{m} \end{array} \right) \right]^*_k \quad \text{and} \quad S _{mk} = V_m \left[ Y \left( \begin{array}{r} V_{k} \\ V_{m} \end{array} \right) \right]^*_m,\end{split}\]

where * indicates the complex conjugate. These are the only nonconvex expressions in the entire model. We will also describe alternative representations of these constraints using different notation.

  1. The next set of constraints represent flow balance. For each branch \(k\) we have

\[\sum_{i \in G(k)} (P^{g}_i + jQ^{g}_i) \ - \ (P^{d}_k + j Q^{d}_k) \quad = \quad \sum_{km \in \delta^+(k)} S_{km} \ + \ \sum_{mk \in \delta^-(k)}S_{km}.\]

In this expression, the left-hand side is the net excess of generation over load at bus \(k\). The right-hand side is the total power injected into the grid at bus \(k\).

  1. Next we have branch limits. For each branch \(km\),

\[\max\{ |S_{km}|, |S_{mk}| \} \ \le \, L_{km}.\]

Note: there are alternative versions of this particular constraint. In a power system under normal (non-stressed) operations this constraint is slack for all but a small number of branches.

4.-5. Finally we have generator limits and voltage bounds.

\[P^{\min}_i \, \le \, P^{g}_i \, \le \, P^{\max}_i \quad \text{and} \quad Q^{\min}_i \, \le \, Q^{g}_i \, \le \, Q^{\max}_i, \ \text{for each generator} \, i,\]

and

\[L_k \, \le \, |V_k| \, \le \, U_k, \ \text{for each bus} \, k.\]

The objective to optimize is the following cost expression:

\[\min \sum_{\text{generators} \, i} F_i(P^g_i).\]

Above we provided an expression defining the complex power flow \(S_{km}\) in terms of the admittance matrix \(Y\). In the following we derive a formulation independent of complex numbers. Denote

\[\theta_{km} = \theta_k - \theta_m - \phi_{km},\]

The real and imaginary components of \(S_{km}\) are

\[P_{km} \ = \ G_{kk} |V_k|^2 + G_{km}|V_k||V_m| \cos(\theta_{km}) + B_{km}|V_k||V_m| \sin(\theta_{km})\]

and

\[Q_{km} \ = \ -B_{kk} |V_k|^2 - B_{km}|V_k||V_m| \cos(\theta_{km}) + G_{km}|V_k||V_m| \sin(\theta_{km})\]

Likewise, in terms of \(S_{mk}\) we have

\[P_{mk} \ = \ G_{mm} |V_m|^2 + G_{mk}|V_k||V_m| \cos(\theta_{km}) - B_{mk}|V_k||V_m| \sin(\theta_{km})\]

and

\[Q_{mk} \ = \ -B_{mm} |V_m|^2 - B_{mk}|V_k||V_m| \cos(\theta_{km}) - G_{mk}|V_k||V_m| \sin(\theta_{km})\]

By introducing the auxiliary variables

\[v_{k}^{(2)} \ = \ |V_k|^2 \ \text{for every bus} \, k\]

and

\[c_{km} \ = \ |V_k||V_m| \cos(\theta_{km}), \quad s_{km} \ = \ |V_k||V_m| \sin(\theta_{km}) \ \text{for every branch} \, km\]

the power flow quantities can be rewritten without the need of complex numbers as

\[P_{km} \ = \ G_{kk} v_k^{(2)} + G_{km} c_{km} + B_{km} s_{km}\]

and

\[Q_{km} \ = \ -B_{kk} v_k^{(2)} - B_{km} c_{km} + G_{km} s_{km}.\]

respectively.

Jabr Relaxation

We can obtain a Second-Order Cone (SOC) relaxation of the ACOPF formulation by introducing auxiliary variables \(v^{(2)}_k, \ c_{km} \ \text{and} \ s_{km}\), removing the nonconvex definitions of such variables (which involve cosines and sines) and adding the rotated cone constraints

\[c_{km}^2 \ + \ s_{km}^2 \ \le \ v_k^{(2)} v_m^{(2)} \ \text{for every branch} \, km.\]

The resulting relaxation can prove very tight, though, despite its convexity, challenging in large cases.

QCQP

ACOPF can be reformulated as a Quadratically Constraints Quadratic Program (QCQP) by performing two reformulation steps.

  1. For each bus \(k\), introduce the real variables \(e_k \, \text{and} \, f_k\) and set \(v^{(2)}_k \, = \, e_k^2 + f_k^2\).

  2. For each branch \(km\), set \(c_{km} = e_k e_m + f_k f_m\) and \(s_{km} = -e_k f_m + f_k e_m\).

These constraints render an exact reformulation rendering the problem as a QCQP, i.e., one that removes the sines and cosines from the formulation. We remind the reader that, for example, we are writing the active power flow injected at bus \(k\) on branch \(km\) through the constraints

\[P_{km} \ = \ G_{kk} v_k^{(2)} + G_{km} c_{km} + B_{km} s_{km},\]

(and similarly with \(Q_{km}, \, P_{mk}, \,\text{and} \,Q_{mk}\)).

This is the so-called cartesian (or rectangular) formulation for ACOPF. This is the formulation that Gurobi currently solves in this mod.

DCOPF

In the so-called DC approximation to the standard ACOPF problem it is assumed that all voltage magnitudes are equal to \(1.0\) and that across all branches the phase angle difference is very small. The active power flow equations are linearized, using these assumptions, and the reactive power flow constraints are ignored. The objective function is the same as for ACOPF. In summary we obtain a linear approximation (not a relaxation) to standard ACOPF which is very commonly used in energy markets.

The network data requirements are likewise limited. For each branch \(km\) the models require the branch reactance \(x_{km}\) as well as a ratio \(\tau_{km}\) and angle \(\phi_{km}\); the latter two are relevant only in the case of transformers. In the non-transformer case we assume \(\tau_{km} = 1\) and \(\phi_{km} = 0\).

DC Optimization Model

The following variables are used in the DCOPF problem.

  • For each bus \(k\) we have a phase angle \(\theta_k\).

  • For each branch \(km\) we have the real power flow \(P_{km}\) from \(k\) to \(m\). As we shall see from the model, there is no need for a corresponding variable \(P_{mk}\).

  • For each generator \(i\) there is the (active) generation \(P^{g}_i\).

There are four classes of constraints:

  1. branch power definitions

  2. flow balance

  3. branch limits

  4. generator limits

  1. The first set of constraints embodies DC power flow laws. For each branch \(km\) we have

\[P_{km} = \frac{1}{\tau_{km} \,x_{km}}(\theta_k - \theta_m - \phi_{km}).\]

It is (implicitly) assumed that \(P_{mk} = -P_{km}\).

  1. The next set of constraints represents active flow balance at each bus \(k\).

\[\sum_{i \in G(k)} P^{g}_i \ - \ P^{d}_k \quad = \quad \sum_{km \in \delta^+(k)} P_{km} \ - \ \sum_{mk \in \delta^-(k)}P_{mk}.\]

In this expression, the left-hand side is the net excess of generation over load at bus \(k\). The right-hand side is the total power injected into the grid at bus \(k\).

  1. Next we have branch limits. For each branch \(km\),

\[|P_{km}| \ \le \, L_{km}.\]

Note: there are alternative versions of this particular constraint. In a power system under normal (non-stressed) operations this constraint is slack for all but a small number of branches.

  1. Finally we have generator limits.

\[P^{\min}_i \, \le \, P^{g}_i \, \le \, P^{\max}_i, \ \text{for each generator} \, i.\]

The objective to optimize is the same (usually quadratic convex) cost expression as for ACOPF:

\[\min \sum_{\text{generators} \, i} F_i(P^g_i).\]

Branch Switching

An important binary MILP extension of DCOPF is that where a binary variable \(z_{km}\) is used to decide if a branch \(km\) is “on” (\(z_{km} = 1\)) or not (\(z_{km} = 0\)). To achive this goal, we simply reformulate the power flow definition as

\[P_{km} = \frac{z_{km}}{\tau_{km} \,x_{km}}(\theta_k - \theta_m - \phi_{km}).\]

This constrained is linearized through standard methods.

Branch switching is most often used in DCOPF only due to its additional complexity. Still, it can be applied to an ACOPF model as well. Please note that introducing branch-switching greatly increases problem complexity and thus, obtaining feasible solution to branch-switching ACOPF models is very difficult.