Esempio n. 1
0
def run_timeseries_mod1(net,
                        time_steps=None,
                        continue_on_divergence=False,
                        verbose=True,
                        **kwargs):
    """
    Time Series main function

    Runs multiple PANDAPOWER AC power flows based on time series which are stored in a **DataSource** inside
    **Controllers**. Optionally other functions than the pp power flow can be called by setting the run function in kwargs

    INPUT:
        **net** - The pandapower format network

    OPTIONAL:
        **time_steps** (list or tuple, None) - time_steps to calculate as list or tuple (start, stop)
        if None, all time steps from provided data source are simulated

        **continue_on_divergence** (bool, False) - If True time series calculation continues in case of errors.

        **verbose** (bool, True) - prints progress bar or if logger.level == Debug it prints debug messages

        **kwargs** - Keyword arguments for run_control and runpp. If "run" is in kwargs the default call to runpp()
        is replaced by the function kwargs["run"]
    """

    ts_variables = init_time_series(net, time_steps, continue_on_divergence,
                                    verbose, **kwargs)

    control_diagnostic(net)
    return run_loop(net, ts_variables, **kwargs)

    # cleanup functions after the last time step was calculated
    cleanup(ts_variables)
Esempio n. 2
0
def run_timeseries(net,
                   time_steps=None,
                   continue_on_divergence=False,
                   verbose=True,
                   **kwargs):
    """
    Time Series main function

    Execution of pipe flow calculations for a time series using controllers.
    Optionally other functions than pipeflow can be called by setting the run function in kwargs.

    .. note:: Refers to pandapower power flow.

    :param net: The pandapipes format network
    :type net: pandapipesNet
    :param time_steps: Time steps to calculate as list or tuple (start, stop). If None, all time \
            steps from provided data source are simulated.
    :type time_steps: list or tuple, default None
    :param continue_on_divergence: If True, time series calculation continues in case of errors.
    :type continue_on_divergence: bool, default False
    :param verbose: Prints progress bar or if *logger.level == Debug*, it prints debug messages
    :type verbose: bool, default True
    :param kwargs: Keyword arguments for run_control and runpp
    :type kwargs: dict
    :return: No output
    """
    ts_variables = init_time_series(net, time_steps, continue_on_divergence,
                                    verbose, **kwargs)

    control_diagnostic(net)
    run_loop(net, ts_variables, **kwargs)

    # cleanup functions after the last time step was calculated
    cleanup(ts_variables)
Esempio n. 3
0
def run_timeseries_ppipe(net,
                         time_steps=None,
                         output_writer=None,
                         continue_on_divergence=False,
                         verbose=True,
                         **kwargs):
    """
    Time Series main function
    Runs multiple PANDAPOWER AC power flows based on time series in controllers
    Optionally other functions than the pp power flow can be called by setting the run function in
    kwargs.
    **NOTE: refers to pandapower power flow.
    :param net: The pandapipes format network
    :type net: pandapipesNet
    :param time_steps: time_steps to calculate as list or tuple(start, stop) if None, all time steps
                        from provided data source are simulated
    :type time_steps: list or tuple, default None
    :param output_writer: A predefined output writer. If None the a default one is created with
                            get_default_output_writer()
    :type output_writer: ?, default None
    :param continue_on_divergence: If True time series calculation continues in case of errors.
    :type continue_on_divergence: bool, default False
    :param verbose: prints progress bar or if logger.level == Debug it prints debug  messages
    :type verbose: bool, default True
    :param kwargs: Keyword arguments for run_control and runpp
    :return: No output.
    """
    ts_variables, kwargs = init_time_series_ppipe(net, time_steps,
                                                  output_writer,
                                                  continue_on_divergence,
                                                  verbose, **kwargs)

    control_diagnostic(net)
    for i, time_step in enumerate(ts_variables["time_steps"]):
        print_progress(i, time_step, ts_variables["time_steps"], verbose,
                       **kwargs)
        run_time_step(net, time_step, ts_variables, **kwargs)

    # cleanup functions after the last time step was calculated
    cleanup(ts_variables)
Esempio n. 4
0
def run_timeseries(multinet,
                   time_steps=None,
                   continue_on_divergence=False,
                   verbose=True,
                   **kwargs):
    """
    Time Series main function.
    Runs multiple run functions for each net in multinet. Within each time step several controller loops are conducted
    till all controllers and each net is converged.
    A normal pp.runpp/pps.pipeflow can be optionally replaced by other run functions by setting the run function in
    kwargs.

    :param multinet: multinet with multinet controllers, net distinct controllers and several pandapipes/pandapower nets
    :type multinet: pandapipes.Multinet
    :param time_steps: the number of times a time series calculation shall be conducted
    :type time_steps: sequence of array_like, default: None
    :param continue_on_divergence: What to do if loadflow/pipeflow is not converging, fires control_repair
    :type continue_on_divergence: bool, default: False
    :param verbose: prints progess bar or logger debug messages
    :type verbose: bool, default: True
    :param kwargs: additional keyword arguments handed to each run function
    :type kwargs: dict
    :return: runs the time series loop
    :rtype: None
    """
    ts_variables = init_time_series(multinet, time_steps,
                                    continue_on_divergence, verbose, **kwargs)

    for net_name in multinet['nets'].keys():
        control_diagnostic(multinet['nets'][net_name])

    run_loop(multinet, ts_variables, run_control, _call_output_writer,
             **kwargs)

    # cleanup functions after the last time step was calculated
    for net_name in multinet['nets'].keys():
        cleanup(ts_variables[net_name])