DEPARTEMNT OF ELECTRICAL POWER SYSTEM ENGINEERING
Computer Application In Power System
Assignment: AC and DC Optimal Power Flow(OPF)
By: G/miskle Kindie Tigabu
Submission Date:25/12/2025 G.C
Submitted To: Dr. Wondwossen
1. AC and DC Optimal Power Flow ( OPF)
1.1. Introduction
The set of optimization problems in electric power systems engineering known collectively as
Optimal Power Flow (OPF) is one of the most practically important and well-researched
subfields of constrained non-linear optimization.
The presence of the power flow equations distinguishes OPF from other classes of power
systems problems, such as:
(1) Unit commitment (UC),
(2) Market clearing problems,
(3) Economic dispatch (ED).
1.2. Notation and Network representation
We use the following general notation for optimization formulations:
u vector of control variables (independent decision variables)
x vector or state variables (dependent decision variables)
f (u, x) objective function (scalar)
g(u, x) vector function of equality constraints
h(u, x) vector function of inequality constraints.
Each system bus i, has an associated voltage ̃ , which is measured with respect to the system
reference (typically Earth ground). When connected via the branch network, or “grid,” these
voltages induce current in each branch in proportion to the branch admittance.
The most common and concise mathematical description of this phenomenon is the matrix
equation
̃= ̃ ̃ …………………………………………………………………………………………..(1)
In which, ̃ = ( ̃ , . . . , ̃ ) is an N-dimensional vector of phasor voltages at each system bus,
̃= ( ̃ , . . . , ) is an N-dimensional vector of phasor currents injected into the network at each
system bus, ̃ is the N × N complex bus admittance matrix and N is the total number of bus in
the network.
1
At each bus i, injection current ̃ represents the net current supplied to the network: generation (supply)
minus load (demand). In this framework, voltages ̃ are state variables that fully characterize system
power flow for a given matrix ̃ .
The purpose of an electric power system is to transfer electrical energy from generation (supply) buses to
load (demand) buses elsewhere in the network.
It is more convenient to work with power flows than currents because
(i) injected powers are independent of system voltage angle whereas injected currents are not and
(ii) working directly with power allows straightforward computation of required electrical energy
via integration with respect to time.
Therefore we transform Equation (1) by applying the definition of complex power S = ̃ ̃* to each side
of the matrix equation.
The result is the complex power flow equation
S = ̃ ◦ ( ̃ ̃ )*……………………………………………………………………….……………..…..(2)
In which S = P + jQ is a vector of complex power injections at each bus.
At each bus i, the total injected power is the difference between the generation and the load
= − ⇔ +j =( − )+j( − ).
If each bus voltage is represented in polar form with magnitude V and phase angle δ, then Equation (2)
decomposes into the set of power flow equations
(V, δ) = − ,∀ i ∈ N……..……………………………………………………………….… (3)
Q i (V, δ) =( − ), ∀ i ∈ N……………...……………………………………………………… (4)
In which net real and reactive power injections Pi and Q i are trigonometric functions of the system
voltages.
Each system bus has four variables (net real power injection Pi, net reactive power injection Q i, voltage
magnitude , and voltage angle ) and is governed by two equations. Thus, a deterministic solution to
the conventional PF problem requires fixing the values of two out of four variables at each bus.
In conventional PF, all system buses are assigned to one of three bus types.
1. Slack Bus: at the slack bus, swing bus,or reference bus the voltage magnitude and angle are
fixed and the power injections are free. There is only one slack bus in a power system model.
2. Load Bus: At a load bus, or “PQ” bus, the power injections are fixed while the voltage magnitude
and angle are free. There are a fixed number of PQ buses in the system; the symbol M denotes
this number.
2
3. Voltage-Controlled Bus/Generator bus: At a voltage-controlled bus, or “PV”bus, the real power
injection and voltage magnitude are fixed while the reactive power injection and the voltage angle
are free. (This corresponds to allowing a local source of reactive power to regulate the voltage to
a desired set point or compensator apply.) There are N − M − 1 PV buses in the system.
1.3. AC Optimal Power Flow(AC OPF)
OPF combines an objective function with the PF Equations (3) and (4) to form an optimization
[Link] power system is modeled as a set of buses N connected by a set of branches L, with
controllable generators located at a subset G ⊆ N of the system buses. the operating cost of each generator
is a (typically quadratic) function of its real output power: ( ).
The objective is to minimize the total cost of [Link] classic form of the formulation is:
min ∑ Ci(PGi) , i∈G………………………….……………………………………………………….….(5)
AC power flow equation with selection of polar coordinates for voltage, ̃ = ∠ ,and rectangular
coordinates for admittance, = G +j is:
s.t. (V, δ) = − ,∀ i ∈ N………………………….………………………………………….… (6)
Q i (V, δ) =( − ), ∀ i ∈ N,………………………………………………………………………… (7)
≤ ≤ , ∀ i ∈ G………………………………………………………………………….. (8)
≤ ≤ ,∀ i ∈ G …………………………………………………………………….……(9)
3
≤ ≤ ,∀ i ∈ N………………………………………………..……………………………. (10)
≤ ≤ ,∀ i ∈ N………..……………………………………………………………….…..(11)
Constraints (6) and (7) are the PF equations in polar form. The remaining constraints represent bounds on
the system voltages and powers. Typically, load real and reactive power are fixed while generator real and
reactive power are control variables subject to minimum and maximum limits.
The voltage magnitude and angle at the system slack bus (by convention, bus 1) are also fixed, usually to
̃ = 1.0∠0.
Early methods partition the decision variables into a set of control variables u (typically the controllable
bus power injections) and a set of state variables x (the voltage magnitudes and angles).
Under this framework, the vector of control variables (independent decision variables) for the classic
formulation is u = ( :i∈G, i:i∈G) and the vector of state variables (dependent decision variables) is
x=( ,..., , ,..., ).
Additional constraints: as modern power grids include additional control devices such as:-
load tap changers
phase shifters
series and shunt capacitors
FACTS devices .
Because such controls exert a big influence on power flow, it is necessary that they are incorporated into
practical OPF formulations.
If the system contains controllable phase-shifting or tap changing transformers, then the corresponding
phase angles ϕ and tap ratios T are introduced into the set of control variables.
The control variable vector u becomes
Where H and K are the sets of branches with controllable-phase shifting transformers and tap-changing
transformers, respectively. Since ϕ and T alter the elements of admittance matrix ˜Y ,the left-hand sides of
Equations (6) and (7) become functions of ϕ and T : Pi (V, δ, ϕ, T ) and Q i (V, δ, ϕ, T ), respectively. The
formulation is also augmented with bound constraints on the :
4
many recent OPF formulations also include line limits; that is, upper bounds on the branch current
magnitudes. Since line current is voltage dependent, an exact bound requires a function inequality
constraint. By Ohm’s law, the current magnitude in branch ik is
in which yik is the magnitude of the branch admittance. Thus,one version of the exact bound is
(For branches with off-nominal turns ratios, the tap bus voltage Vi and angle δi in the above equation
must be corrected for the off-nominal turns ratio. In this case, Vi is replaced by Vi ′= Vi/Tik and δi is
replaced by δi′ = δi − ϕik.)
Rather than bounding the square of the current as is given in Equation, most formulations instead bound
the real and reactive PF in the line
In almost all cases, this simplification is sufficiently accurate.
1.4. DC Optimal Power Flow(DC OPF)
The AC PF equations are nonlinear. In order to simplify the system representation, power systems
engineers have developed a linear approximation to the PF equations. This approximation is called
DC PF.
The conventional development of the DC PF equations requires several assumptions regarding the power
system.
1. All system branch resistances are approximately zero; that is, the transmission system is assumed to be
lossless. As a result, all = ±90◦ and all = 0.
5
2. The differences between adjacent bus voltage angles are small, such that sin(δi − δk ) ≈ δi − δk and
cos(δi −δk ) ≈ 1.
3. The system bus voltages are approximately equal to 1.0. This assumption requires that there is
sufficient reactive power generation in the system to maintain a level voltage profile.
4. Reactive PF is neglected.
Applying these assumptions to the above AC power flow equation produces the DC power flow
equation.
With its objective function
min ∑ Ci(PGi) ,i∈G
s.t. ≤ ≤ ,∀i∈G
Pi (δ) ≈∑ B ik (δi − δk )<=Pik max, ∀ i&k ∈ N.
Under normal operating conditions, DC PF models real power transfer quite accurately. It has been
successfully used in many OPF applications that require rapid and robust solutions including in
commercial software.
1.5. OPF Challenges
Size of the problem
thousands of lines, hundreds of controls
It is not always clear which inequality constraints are binding
Problem is non‐linear
Problem is non‐convex
Some of the variables are discrete
Position of transformer and phase shifter taps
Status of switched capacitors or reactors
1.6. Solution methods
Conventional methods
Gradient Methods
Newton’s Method
Linear Programming Method
Quadratic Programming Method
Interior Point Method
Computational Intelligence based approaches
Artificial Neural Networks (ANN)
Genetic Algorithms
6
Particle Swarm Optimization (PSO)
Ant Colony Algorithm
etc.