Skip to content

grid-opt-alg-lab/PowerDiff.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

123 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PowerDiff.jl

PowerDiff.jl

CI Docs

A Julia package for differentiable power system analysis. Compute sensitivities of power flow solutions, optimal power flow dispatch, and locational marginal prices with respect to network parameters.

Features

  • Unified sensitivity API: calc_sensitivity(state, :operand, :parameter) with Sensitivity{T} return type
  • DC OPF: B-theta formulation with analytical KKT sensitivities for demand, switching, cost, flow limits, and susceptances
  • DC power flow: Switching and demand sensitivities via matrix perturbation theory
  • AC power flow: Voltage and current sensitivities w.r.t. power injections
  • AC OPF: Full sensitivity analysis (switching, demand, costs, flow limits) via implicit differentiation of KKT conditions
  • LMP analysis: Locational marginal prices with energy/congestion decomposition
  • Load shedding: Sensitivity of optimal load curtailment to network parameters

Installation

Requires Julia 1.9 or later.

using Pkg
Pkg.add(url="https://github.com/grid-opt-alg-lab/PowerDiff.jl.git")

Quick Start

using PowerDiff, PowerModels

# Load network (make_basic_network is optional)
net = parse_file("case14.m")
dc_net = DCNetwork(net)
d = calc_demand_vector(net)

# Solve DC OPF and compute sensitivities
prob = DCOPFProblem(dc_net, d)
solve!(prob)

dlmp_dd = calc_sensitivity(prob, :lmp, :d)   # dLMP/dd (n x n)
dpg_dsw = calc_sensitivity(prob, :pg, :sw)   # dg/dsw (k x m)

dlmp_dd.formulation  # :dcopf
dlmp_dd[2, 3]        # dLMP_2 / dd_3

See the Getting Started guide for DC/AC power flow and OPF walkthroughs.

Documentation

Dependencies

License

Apache License 2.0

About

Differentiable power system analysis in Julia. Sensitivity of power flow, OPF, and LMPs to network parameters.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors