1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Pandapower: Connect two networks

Discussão em 'Python' iniciado por Stack, Setembro 11, 2024 às 11:52.

  1. Stack

    Stack Membro Participativo

    I would like to use two of the IEEE case examples and connect them using pandapower. One should represent a DSO net and one a TSO net. Now the issue is that I am unsure whether I have connected them correctly. If I plot the TSO net after adding the additional bus and additional line, they are not represented in the plot. You can also not see them if you plot the merged net. But after adding the bus and line, one can see that TSO net has indeed an additional bus and an additional line. Moreover, I can run a powerflow simulation on the whole net.

    import pandapower as pp
    import pandapower.networks as pn
    import pandas as pd
    import pandapower.plotting.plotly as pplot


    def fix_nan_values_in_boolean_columns(net):
    for element, df in net.items():
    if isinstance(df, pd.DataFrame):
    for col in df.columns:
    if pd.api.types.is_bool_dtype(df[col]):
    df[col].fillna(False, inplace=True)

    # Load the IEEE 14-bus system as the TSO network
    tso_net = pn.case14()

    # Load the IEEE 4-bus system as the DSO network
    dso_net = pn.case4gs()

    pplot.simple_plotly(tso_net)

    pplot.simple_plotly(dso_net)



    # Add a bus in the TSO network to connect the DSO
    tso_bus_new = pp.create_bus(tso_net, vn_kv=110, name="TSO Bus New")

    # Connect the new bus in the TSO network to an existing bus in the TSO network with a line
    pp.create_line(tso_net, from_bus=1, to_bus=tso_bus_new, length_km=10, std_type="149-AL1/24-ST1A 110.0")

    # Add a transformer to connect the TSO bus and the DSO bus
    pp.create_transformer(tso_net, hv_bus=tso_bus_new, lv_bus=dso_net.bus.index[0], std_type="25 MVA 110/20 kV")

    pplot.simple_plotly(tso_net)


    # Ensure there are no NaN values in boolean columns in all elements of the networks
    fix_nan_values_in_boolean_columns(tso_net)
    fix_nan_values_in_boolean_columns(dso_net)

    # Merge the networks
    merged_net = pp.merge_nets(tso_net, dso_net, std_prio_on_net1=True, net2_reindex_log_level='INFO', return_net2_reindex_lookup=False)

    # Run power flow calculation
    pp.runpp(merged_net)


    pplot.simple_plotly(merged_net)

    Continue reading...

Compartilhe esta Página