AGM Center
AboutResearchLearningGallery
Documentation
  • Introduction
    • KPG Run Overview
    • Getting Started with KPG Run
    • Installation Guide
    • User Interface Guide
      • Economic Dispatch (ED)
      • Unit Commitment (UC)
      • DC Optimal Power Flow (DC-OPF)
      • AC Optimal Power Flow (AC-OPF)
      • Solver Comparison & Selection Guide

AGM Center

Advancing power systems for a sustainable future through research, tools, and collaboration.

About

  • Who We Are
  • Our Team
  • What We Do
  • Get Involved

Documentation

  • Introduction
  • KPG TestGrid
  • KPG Run
  • KPG View

Our Location

Korea Institute of Energy Technology (KENTECH)
200 Hyeoksin-ro, Naju-si, Jeollanam-do
Korea 58330

Office Hours
Mon–Fri 09:00–18:00 KST

© 2026 AGM CENTER. All rights reserved

Terms and Conditions|Privacy Policy
Docs/kpg run/AC Optimal Power Flow (AC-OPF)

AC Optimal Power Flow (AC-OPF)

AC Optimal Power Flow determines the cost-minimizing generator dispatch while satisfying the complete AC power flow equations, voltage constraints, and reactive power limits.

flowchart TB A[System Demand] --> B[AC-OPF] C[Generator P, Q Limits] --> B D[Network Full AC Model] --> B E[Voltage Constraints] --> B B --> F{Nonlinear Program} F --> G[Active Power Dispatch P<sub>i</sub>] F --> H[Reactive Power Dispatch Q<sub>i</sub>] F --> I[Voltage Magnitudes V<sub>b</sub>] F --> J[Voltage Angles θ<sub>b</sub>]

AC vs. DC Power Flow

Key Differences

Aspect

DC-OPF

AC-OPF

Power Flow

P only

P and Q

Voltage

1.0 (fixed)

Variable

Network Model

X only

R + jX

Equations

Linear

Nonlinear

Variables

θ (angles)

|V| (magnitudes) + θ

Losses

Ignored

Included

Problem Type

LP/QP

NLP

Solution

Global optimum

Local optimum

Speed

Faster

Slower

Accuracy

Approximate

High

When AC-OPF is Required

graph TD A{Analysis<br/>Type?} --> B[Economic<br/>Studies] A --> C[Operational<br/>Feasibility] A --> D[Voltage<br/>Analysis] A --> E[Reactive<br/>Planning] B --> F[DC-OPF<br/>Sufficient] C --> G[AC-OPF<br/>Required] D --> G E --> G
  • Use AC-OPF when:

    • Validating dispatch feasibility

    • Voltage stability critical

    • Reactive power planning

    • Accurate loss calculation

    • Generator capability curves matter

    • Detailed operational studies

  • Use DC-OPF when:

    • Faster speed is critical

    • Voltage is not a concern

    • Large-scale studies (many scenarios)

    • Market clearing considering active power only

Mathematical Formulation

Complete AC-OPF Model

Sets and Indices

Symbol

Description

Set of generators

Set of buses

Set of transmission lines

Bus indices

Generator index

Line index

Decision Variables

Variable

Unit

Domain

Description

p.u.

Continuous

Active power generation

p.u.

Continuous

Reactive power generation

p.u.

Continuous

Voltage magnitude at bus

rad

Continuous

Voltage angle at bus

  • Key difference from DC: Voltage magnitudes are now variables!

Parameters

Network Parameters

Parameter

Description

Admittance matrix element

Conductance between buses and

Susceptance between buses and

Angle difference

Generator Parameters

Parameter

Unit

Description

p.u.

Active power limits

p.u.

Reactive power limits

$/h

Generation cost (function of P only)

System Parameters

Parameter

Unit

Description

p.u.

Active load at bus

p.u.

Reactive load at bus

p.u.

Voltage magnitude limits

p.u.

Apparent power limit on line

Formulation Explanation

(1a) Objective Function

  • Minimize total generation cost:

Constraint Explanation

(1b) Active Power Balance

  • Kirchhoff's Current Law (real part):

  • Physical meaning: For every bus, the net active power injection is balanced by the local active power demand.

  • Nonlinearity in AC power flow

  • Compare to DC: DC used simplified equation

(1c) Reactive Power Balance

  • Kirchhoff's Current Law (imaginary part):

  • Physical meaning:

    • Reactive power must also satisfy a nodal power balance at each bus.

(1d) & (1e) Generator Limits

  • Active power limits:

  • Reactive power limits:

  • Important: Real generators have coupled P-Q capability curves (more complex than box constraints).

(1f) Voltage Magnitude Limits

  • Operational voltage range:

  • Limits in KPG 193:

    • 345 kV, 765 kV: 0.95 ≤ V ≤ 1.05 p.u.

    • 154 kV: 0.90 ≤ V ≤ 1.10 p.u.

  • Why limits matter:

    • Equipment designed for nominal voltage

    • Low voltage → Poor motor performance, dimming lights

    • High voltage → Insulation stress, equipment damage

(1g) Line Flow Limits

  • Apparent power (thermal) limit:

  • More accurate than DC: Considers both P and Q flows

  • Line flow calculation:

  • Where is conjugate of line current.

(1h) Reference Angle

  • Slack bus angle:

  • Same as DC-OPF: angles are relative.

AC Power Flow Equations

Complex Power Formulation

graph TB subgraph "Complex Voltage" A["V<sub>b</sub> = |V<sub>b</sub>| ∠ θ<sub>b</sub>"] B["Magnitude: |V<sub>b</sub>|"] C[Angle: θ<sub>b</sub>] end subgraph "Complex Power" D[S = P + jQ] E["Active: P (MW)"] F["Reactive: Q (MVAr)"] end subgraph "Power Flow" G[S<sub>b</sub> = V<sub>b</sub> Σ Y<sub>bk</sub> V<sub>k</sub><sup>*</sup>] end A --> G D --> G

Expanded Form

  • For line from bus to bus :

    • Active power flow:

  • Reactive power flow:

  • Where:

    • - Conductance

    • - Susceptance

    • - Line charging (half at each end)

Why Nonlinear?

  • Products of variables:

    • (bilinear term)

    • , (trigonometric)

  • Consequence:

    • No global optimum guarantee

    • Multiple local optima possible

    • Convergence not guaranteed

    • Sensitive to starting point

Reactive Power and Voltage

Relationship

graph LR A[Reactive Power Q] <-->|Controls| B[Voltage Magnitude V] C[Increase Q<br/>Generation] --> D[Voltage<br/>Increases] E[Decrease Q<br/>Consumption] --> D
  • Key principle: Reactive power supports voltage

Voltage Control

  • Methods to control voltage:

    1. Generator excitation (increase Q output)

    2. Shunt capacitors (inject Q)

    3. Shunt reactors (absorb Q)

    4. Transformer taps (change voltage ratio)

  • In AC-OPF: Optimize generator Q dispatch

Voltage Stability

Voltage Collapse

  • Phenomenon: Insufficient reactive power → voltage decay

sequenceDiagram participant Load participant Voltage participant Reactive Load->>Voltage: Demand increases Voltage->>Reactive: Need more Q Reactive->>Voltage: Q support limited Voltage->>Voltage: Voltage drops Load->>Load: Current increases (constant P) Voltage->>Voltage: Further drop Note over Voltage: COLLAPSE!
  • Indicators in AC-OPF:

    • Voltage limits binding

    • Reactive limits binding

    • High losses

Transmission Losses

Loss Calculation

  • Power losses in line:

Where:

  • = Line current

  • = Line resistance

  • = Power flows

  • = Voltage magnitude

  • Key observations:

    • Losses are nonlinear in P and Q

    • Losses increase with square of power flow

    • Low voltage → higher losses

Extensions

  • Security-Constrained AC-OPF with N-1 contingencies

  • Optimal Reactive Dispatch: Given P dispatch, optimize Q for voltage profile

Solver Comparison

Feature

ED

UC

DC-OPF

AC-OPF

Problem Type

LP/QP

MIP

LP/QP

NLP

Network Model

✗

✗

✓ DC (Linearized)

✓ AC

Time Periods

Single

Multiple (24+)

Single

Single

Commitment

✗

✓ Binary

✗

✗

Transmission Limits

✗

✗

✓

✓

Voltage Constraints

✗

✗

✗

✓

Reactive Power

✗

✗

✗

✓

Transmission Losses

✗

✗

✗

✓

Solve Time

Fastest

Slow

Fast

Medium

→ Detailed Comparison

Next Steps

  • Compare all models: Solver Comparison →

  • Learn simpler models: DC-OPF → or ED →

  • Multi-period scheduling: Unit Commitment →

  • Try it: KPG Run Getting Started →

← DC Optimal Power Flow (DC-OPF)Solver Comparison & Selection Guide →

ON THIS PAGE

AC vs. DC Power FlowKey DifferencesWhen AC-OPF is RequiredMathematical FormulationComplete AC-OPF ModelSets and IndicesDecision VariablesParametersFormulation ExplanationConstraint ExplanationAC Power Flow EquationsComplex Power FormulationExpanded FormWhy Nonlinear?Reactive Power and VoltageRelationshipVoltage ControlVoltage StabilityVoltage CollapseTransmission LossesLoss CalculationExtensionsSolver ComparisonNext Steps