DC Optimal Power Flow

The dc optimal power flow is a linearized optimization of the grid state. It offers two cost function options, that are fitting special use cases. To understand the usage, the OPF tutorial is recommended (see tutorial).

pandapower.rundcopp(net, verbose=False, check_connectivity=True, suppress_warnings=True, r_switch=0.0, delta=1e-10, trafo3w_losses='hv', **kwargs)

Runs the pandapower Optimal Power Flow. Flexibilities, constraints and cost parameters are defined in the pandapower element tables.

Flexibilities for generators can be defined in net.sgen / net.gen. net.sgen.controllable / net.gen.controllable signals if a generator is controllable. If False, the active and reactive power are assigned as in a normal power flow. If yes, the following flexibilities apply:

  • net.sgen.min_p_kw / net.sgen.max_p_kw
  • net.gen.min_p_kw / net.gen.max_p_kw
  • net.load.min_p_kw / net.load.max_p_kw

Network constraints can be defined for buses, lines and transformers the elements in the following columns: - net.line.max_loading_percent - net.trafo.max_loading_percent - net.trafo3w.max_loading_percent

net - The pandapower format network

verbose (bool, False) - If True, some basic information is printed

suppress_warnings (bool, True) - suppress warnings in pypower

If set to True, warnings are disabled during the loadflow. Because of the way data is processed in pypower, ComplexWarnings are raised during the loadflow. These warnings are suppressed by this option, however keep in mind all other pypower warnings are suppressed, too.

Flexibilities, costs and constraints (except voltage constraints) are handled as in the Optimal Power Flow. Voltage constraints are not considered in the DC OPF, since voltage magnitutes are not part of the linearized power flow equations.


If you are interested in the pypower casefile that pandapower is using for power flow, you can find it in net[“_ppc_opf”]. However all necessary informations are written into the pandpower format net, so the pandapower user should not usually have to deal with pypower.