This commit is contained in:
Fabian 2022-09-05 12:51:30 +02:00
parent 2b3f1701b0
commit 2eb26f7334
2 changed files with 22 additions and 16 deletions

View File

@ -12,6 +12,8 @@ Upcoming Release
* Add functionality to consider shipping routes when calculating the available area for offshore technologies. Data for the shipping density comes from the `Global Shipping Traffic Density dataset <https://datacatalog.worldbank.org/search/dataset/0037580/Global-Shipping-Traffic-Density>` * Add functionality to consider shipping routes when calculating the available area for offshore technologies. Data for the shipping density comes from the `Global Shipping Traffic Density dataset <https://datacatalog.worldbank.org/search/dataset/0037580/Global-Shipping-Traffic-Density>`
* When fixing line voltages to 380kV, the workflow now preserves the transmission capacity instead of the electrical impedance and reactance.
PyPSA-Eur 0.5.0 (27th July 2022) PyPSA-Eur 0.5.0 (27th July 2022)
===================================== =====================================

View File

@ -105,26 +105,30 @@ logger = logging.getLogger(__name__)
def simplify_network_to_380(n): def simplify_network_to_380(n):
## All goes to v_nom == 380 """
Fix all lines to a voltage level of 380 kV and remove all transformers.
The function preserves the transmission capacity for each line while updating
its voltage level, line type and number of parallel bundles (num_parallel).
Transformers are removed and connected components are moved from their
starting bus to their ending bus. The corresponing starting buses are
removed as well.
"""
logger.info("Mapping all network lines onto a single 380kV layer") logger.info("Mapping all network lines onto a single 380kV layer")
n.buses['v_nom'] = 380. n.buses['v_nom'] = 380.
linetype_380, = n.lines.loc[n.lines.v_nom == 380., 'type'].unique() linetype_380, = n.lines.loc[n.lines.v_nom == 380., 'type'].unique()
lines_v_nom_b = n.lines.v_nom != 380. n.lines['type'] = linetype_380
n.lines.loc[lines_v_nom_b, 'num_parallel'] *= (n.lines.loc[lines_v_nom_b, 'v_nom'] / 380.)**2 n.lines["v_nom"] = 380
n.lines.loc[lines_v_nom_b, 'v_nom'] = 380. n.lines["i_nom"] = n.line_types.i_nom[linetype_380]
n.lines.loc[lines_v_nom_b, 'type'] = linetype_380 n.lines['num_parallel'] = n.lines.eval("s_nom / (sqrt(3) * v_nom * i_nom)")
n.lines.loc[lines_v_nom_b, 's_nom'] = (
np.sqrt(3) * n.lines['type'].map(n.line_types.i_nom) *
n.lines.bus0.map(n.buses.v_nom) * n.lines.num_parallel
)
# Replace transformers by lines trafo_map = pd.Series(n.transformers.bus1.values, n.transformers.bus0.values)
trafo_map = pd.Series(n.transformers.bus1.values, index=n.transformers.bus0.values)
trafo_map = trafo_map[~trafo_map.index.duplicated(keep='first')] trafo_map = trafo_map[~trafo_map.index.duplicated(keep='first')]
several_trafo_b = trafo_map.isin(trafo_map.index) several_trafo_b = trafo_map.isin(trafo_map.index)
trafo_map.loc[several_trafo_b] = trafo_map.loc[several_trafo_b].map(trafo_map) trafo_map[several_trafo_b] = trafo_map[several_trafo_b].map(trafo_map)
missing_buses_i = n.buses.index.difference(trafo_map.index) missing_buses_i = n.buses.index.difference(trafo_map.index)
missing = pd.Series(missing_buses_i, missing_buses_i) missing = pd.Series(missing_buses_i, missing_buses_i)
trafo_map = pd.concat([trafo_map, missing]) trafo_map = pd.concat([trafo_map, missing])