Skip to content

Power Systems - Optimal Power Flow

Updated: at 01:39 PM

Table of contents

Open Table of contents

Introduction

This Power flow optimization is a fina

Example

The following code optimizes the power flow for a three generator system with different power costs per generate. Line losses are included in optimization calculate performed by PandaPower.


import pandapower as pp

net = pp.create_empty_network()

max_vm_pu = 1.05
min_vm_pu = 0.95

# Define Busses
bus1 = pp.create_bus(net, vn_kv=110., min_vm_pu=min_vm_pu, max_vm_pu=max_vm_pu)
bus2 = pp.create_bus(net, vn_kv=110., min_vm_pu=min_vm_pu, max_vm_pu=max_vm_pu)
bus3 = pp.create_bus(net, vn_kv=110., min_vm_pu=min_vm_pu, max_vm_pu=max_vm_pu)


# Define Lines
line1 = pp.create_line(net, bus1, bus2, length_km=250., std_type='149-AL1/24-ST1A 110.0')
line2 = pp.create_line(net, bus2, bus3, length_km=15., std_type='149-AL1/24-ST1A 110.0')
line3 = pp.create_line(net, bus3, bus1, length_km=5., std_type='149-AL1/24-ST1A 110.0')

# Define Generators
  # Slack generate - Hydro line
gen1 = pp.create_gen(net, bus1, p_mw=300, min_p_mw=0, max_p_mw=300, controllable=True, slack=True)

  # Natural Gas Generator
gen2 = pp.create_gen(net, bus2, p_mw=200, min_p_mw=0, max_p_mw=50, controllable=True)

  # Local Generation - Solar & Congeneration
gen3 = pp.create_gen(net, bus3, p_mw=125, min_p_mw=0, max_p_mw=25, controllable=True)


# Configure Generation Costs
pp.create_poly_cost(net, element=gen1, et="gen", cp1_eur_per_mw=20.)
pp.create_poly_cost(net, element=gen2, et="gen", cp1_eur_per_mw=40.)
pp.create_poly_cost(net, element=gen3, et="gen", cp1_eur_per_mw=7.)

# Define Load - Aurora Mill & Camp
pp.create_load(net, bus3, p_mw=38)

pp.runopp(net)
print(net.res_gen)

Previous Post
Power Systems - Short Circuit Analysis
Next Post
Power Systems Definitions and PandaPower