Running a Simulation

To run a simulation, simply initialize one or multiple controllers (see ref to controllers). An overview of all controllers registered in the net is given in the controller table:


Then, run a power flow with the run_control option set to true:

import pandapower as pp
pp.runpp(net, run_control=True)

The runpp function will now run multiple power flow calculations until all registered controllers are converged.

Instead of calling runpp it is also possible to call run_control from the control module directly:

import pandapower.control as control

By default, this will do the same as runpp with run_control=True. Calling the run_control function however gives you more flexibility to configurate the controller loop simulation.

pandapower.control.run_control(net, ctrl_variables=None, max_iter=30, **kwargs)

Main function to call a net with controllers Function is running control loops for the controllers specified in net.controller


net - pandapower network with controllers included in net.controller


ctrl_variables (dict, None) - variables needed internally to calculate the power flow. See prepare_run_ctrl()

max_iter (int, 30) - The maximum number of iterations for controller to converge


continue_on_divergence (bool, False) - if run_funct is not converging control_repair is fired (only relevant if ctrl_varibales is None, otherwise it needs to be defined in ctrl_variables anyway)

check_each_level (bool, True) - if each level shall be checked if the controllers are converged or not (only relevant if ctrl_varibales is None, otherwise it needs to be defined in ctrl_variables anyway)

Runs controller until each one converged or max_iter is hit.

  1. Call initialize_control() on each controller

  2. Calculate an inital power flow (if it is enabled, i.e. setting the initial_run veriable to True)

  3. Repeats the following steps in ascending order of controller_order until total convergence of all controllers for each level:

    1. Evaluate individual convergence for all controllers in the level

    2. Call control_step() for all controllers in the level on diverged controllers

    3. Calculate power flow (or optionally another function like runopf or whatever you defined)

  4. Call finalize_control() on each controller