e2nIEE / pandapower

Convenient Power System Modelling and Analysis based on PYPOWER and pandas
https://www.pandapower.org
Other
836 stars 477 forks source link

Merge two networks as DSO/TSO network? #2352

Open samabu2011 opened 1 month ago

samabu2011 commented 1 month ago

Hi

I was wondering if and how you can use the merge function to merge two networks such that one functions as a dso and one as TSO?

vogt31337 commented 1 month ago

@samabu2011 you can merge two networks. It should work, but you have to identify the merging points / busses. What exactly do you mean with one functions as dso and one as tso?

samabu2011 commented 1 month ago

Thanks for the answer! I would like to construct an example where I can use two of the IEEE cases from here: https://pandapower.readthedocs.io/en/v2.1.0/networks/power_system_test_cases.html#pandapower.networks.case24_ieee_rts and build a new network with them. Ideally one would represent a TSO and one would respresent DSO, such that I can do some further simulations. Currently for example I am trying to connect case14() as a TSO with case4gs() playing the role as a DSO.

How would you identify the merging points and busses?

Here is the code example I am using, but I am unsure if it is correct:

import pandapower as pp import pandapower.networks as pn import pandas as pd import pandapower.plotting.plotly as pplot from Solve_Networks import solve_networks from parameters import OptParams

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=135, zone = 1.0, 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

`import pandapower as pp import pandapower.networks as pn import pandas as pd import pandapower.plotting.plotly as pplot from Solve_Networks import solve_networks from parameters import OptParams

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=135, zone = 1.0, 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)`