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:
print(net.controller)
Then, run a power flow with the run_control option set to true:
from pandapower import runpp
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:
from pandapower.control import run_control
run_control(net)
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
- INPUT:
net - pandapower network with controllers included in net.controller
- OPTIONAL:
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
- KWARGS:
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.
Call initialize_control() on each controller
Calculate an inital power flow (if it is enabled, i.e. setting the initial_run veriable to True)
Repeats the following steps in ascending order of controller_order until total convergence of all controllers for each level:
Evaluate individual convergence for all controllers in the level
Call control_step() for all controllers in the level on diverged controllers
Calculate power flow (or optionally another function like runopf or whatever you defined)
Call finalize_control() on each controller