1
# Copyright (c) 2020 by Fraunhofer Institute for Energy Economics
2
# and Energy System Technology (IEE), Kassel. All rights reserved.
3
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4

5 1
from pandapower.control import run_control as run_control_pandapower, prepare_run_ctrl as prepare_run_control_pandapower
6 1
import pandapipes as ppipe
7 1
from pandapipes.pipeflow import PipeflowNotConverged
8

9 1
def run_control(net, ctrl_variables=None, max_iter=30, continue_on_lf_divergence=False,
10
                      **kwargs):
11
    """
12
    Function to run a control of the pandapipes network.
13

14
    :param net: The pandapipes network
15
    :type net: pandapipesNet
16
    :param ctrl_variables: Used control variables. If None, default control variables are used.
17
    :type ctrl_variables: dict, default None
18
    :param max_iter: Maximal amount of iterations
19
    :type max_iter: int, default 30
20
    :param continue_on_lf_divergence: ?
21
    :type continue_on_lf_divergence: bool, default False
22
    :param kwargs: Additional keyword arguments
23
    :type kwargs: dict
24
    :return: No output
25
    """
26 0
    if ctrl_variables is None:
27 0
        ctrl_variables = prepare_run_ctrl(net, None)
28

29

30 0
    run_control_pandapower(net, ctrl_variables=ctrl_variables, max_iter=max_iter,
31
                           continue_on_lf_divergence=continue_on_lf_divergence, **kwargs)
32

33

34 1
def prepare_run_ctrl(net, ctrl_variables):
35
    """
36
    Function that defines default control variables.
37

38
    :param net: The pandapipes network
39
    :type net: pandapipesNet
40
    :return: ctrl_variables
41
    :rtype: dict
42
    """
43 0
    if ctrl_variables is None:
44 0
        ctrl_variables  = prepare_run_control_pandapower(net, None)
45 0
        ctrl_variables["run"] = ppipe.pipeflow
46

47 0
    ctrl_variables["errors"] = (PipeflowNotConverged)
48

49 0
    return ctrl_variables
50

51

52

Read our documentation on viewing source code .

Loading