update line rating(documentation, bundles)

This commit is contained in:
Philipp Glaum 2021-12-28 08:28:07 +01:00
parent 8500aac743
commit e51d714d55
2 changed files with 44 additions and 6 deletions

View File

@ -233,7 +233,7 @@ rule add_electricity:
base_network = "networks/base.nc",
tech_costs=COSTS,
regions="resources/regions_onshore.geojson",
line_rating="resources/line_rating.nc" if config['lines'].get('line_rating', False) else None,
line_rating="resources/line_rating.nc" if config['lines'].get('line_rating', False) else "networks/base.nc",
powerplants='resources/powerplants.csv',
hydro_capacities='data/bundle/hydro_capacities.csv',
geth_hydro_capacities='data/geth2015_hydro_capacities.csv',

View File

@ -11,8 +11,9 @@ Relevant Settings
.. code:: yaml
lines_t:
s_max_pu
lines:
cutout:
line_rating:
.. seealso::
@ -26,7 +27,7 @@ Inputs
Outputs
-------
- ``networks/base_with_line_rating.nc``
- ``resources/line_rating.nc``
Description
@ -58,9 +59,41 @@ import geopandas as gpd
from shapely.geometry import Point, LineString as Line
import atlite
import xarray as xr
import re
def calculate_resistance(T, R_ref, T_ref=20, alpha=0.00403):
"""
Calculates the resistance at other temperatures than the reference temperature.
Parameters
----------
T : Temperature at which resistance is calculated in [°C] or [K]
R_ref : Resistance at reference temperature in [Ohm] or [Ohm/Per Length Unit]
T_ref : Reference temperature in [°C] or [K]
alpha: Temperature coefficient in [1/K]
Defaults are:
* T_ref : 20 °C
* alpha : 0.00403 1/K
Returns
-------
Resistance of at given temperature.
"""
R=R_ref+(1+alpha*(T-T_ref))
return R
def calculate_line_rating(n):
"""
Calculates the maximal allowed power flow in each line for each time step considering the maximal temperature.
Parameters
----------
n : pypsa.Network object containing information on grid
Returns
-------
xarray DataArray object with maximal power.
"""
relevant_lines=n.lines[(n.lines['underground']==False) & (n.lines['under_construction']==False)]
buses = relevant_lines[["bus0", "bus1"]].values
x = n.buses.x
@ -71,8 +104,13 @@ def calculate_line_rating(n):
if relevant_lines.r_pu.eq(0).all():
#Overwrite standard line resistance with line resistance obtained from line type
relevant_lines["r_pu"]=relevant_lines.join(n.line_types["r_per_length"], on=["type"])['r_per_length']/1000 #in meters
Imax=cutout.line_rating(shapes, relevant_lines.r_pu)
da = xr.DataArray(data=np.sqrt(3) * Imax * relevant_lines["v_nom"].values.reshape(-1,1) * relevant_lines["num_parallel"].values.reshape(-1,1)/1e3, #in mW
#Set default number of bundles per line
relevant_lines["n_bundle"]=1
#If line type with bundles is given retrieve number of conductors per bundle
if relevant_lines["type"].str.contains("bundle").all():
relevant_lines["n_bundle"]=relevant_lines["type"].apply(lambda x: int(re.findall(r"(\d+)-bundle", x)[0]))
Imax=cutout.line_rating(shapes, relevant_lines.r_pu, D=0.0218 ,Ts=353 , epsilon=0.8, alpha=0.8)
da = xr.DataArray(data=np.sqrt(3) * Imax * relevant_lines["v_nom"].values.reshape(-1,1) * np.sqrt(relevant_lines["n_bundle"].values.reshape(-1,1)) * relevant_lines["num_parallel"].values.reshape(-1,1)/1e3, #in mW
attrs=dict(description="Maximal possible power in MW for given line considering line rating"))
return da