def get_all_simbench_profiles(scenario, input_path=None, sep=";"):
    """
    Returns a dict of DataFrames with all simbench profiles of the given scenario.
    These include all profiles with the net data received by
    get_simbench_net("1-complete_data-mixed-all-%s-sw" % str(scenario)).

    INPUT:
        **scenario** (int) - defines to which scenario the requested profiles belong to. Should be
        within [0, 1, 2].

    OPTIONAL:
        **input_path** (path) - option to change the path to all simbench grid csv files. However,
        a change should not be necessary.

        **sep** (str, ";") - seperator of the csv files which contain the profiles information.

    OUTPUT:
        **profiles** (dict) - dict of DataFrames with all simbench profiles of the given scenario
    """
    input_path = input_path if input_path is not None else complete_data_path(scenario)
    csvtablenames = csv_tablenames(['profiles'])

    # read all profiles data
    profiles = read_csv_data(input_path, sep=sep, tablename=csvtablenames)

    # rename csv_tablenames by pandapower element names
    for csv_name, pp_name in zip(csvtablenames, pp_profile_names()):
        profiles[pp_name] = profiles.pop(csv_name)

    return profiles
示例#2
0
def get_extracted_csv_data(relevant_subnets, input_path, sep=";", **kwargs):
    """ Returns extracted csv data of the requested SimBench grid
    (per default from all SimBench grids csv data).
    **kwargs are ignored.
    """
    # --- import input data
    if 'complete_data' in relevant_subnets[0]:  # return complete data
        return read_csv_data(input_path, sep=sep)
    else:
        csv_data = dict()
        for tablename in csv_tablenames(['elements', 'profiles', 'types', 'cases']):
            csv_data[tablename] = _get_extracted_csv_table(relevant_subnets, tablename,
                                                           input_path=input_path)
    return csv_data
示例#3
0
def filter_unapplied_profiles(csv_data):
    """ Filters unapplied profiles from csv_data. """
    profile_tables = csv_tablenames('profiles')
    element_tables = list(
        pd.Series(profile_tables).str.split("Profile", expand=True)[0])
    for prof_tab, elm_tab in zip(profile_tables, element_tables):
        applied_profiles = list(csv_data[elm_tab].profile.dropna().unique())
        if elm_tab == "Load" and len(applied_profiles):
            applied_profiles_p = pd.Series(applied_profiles) + "_pload"
            applied_profiles_q = pd.Series(applied_profiles) + "_qload"
            applied_profiles = list(applied_profiles_p) + list(
                applied_profiles_q)
        applied_profiles.append("time")
        unapplied_profiles = csv_data[prof_tab].columns.difference(
            applied_profiles)
        logger.debug("These %ss are dropped: " % prof_tab +
                     str(unapplied_profiles))
        csv_data[prof_tab].drop(unapplied_profiles, axis=1, inplace=True)