pythonieeepandapower

Pandapower: Connect two networks


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)

Solution

  • I had a similar problem, when editing the IEEE Europoean LV network from pandapower (https://pandapower.readthedocs.io/en/v2.14.11/networks/3phase_grids.html)

    There is a bug in the pandapower plotting function, where lines without geodata are not visualised next to lines with geodata. Here is the given issue : https://github.com/e2nIEE/pandapower/issues/2275. This bug should be fixed in the next release.

    So check if the lines in the given grid contain geodata. If so, try to delete those geodate, so that only bus geodata remain. This might work.