line-rating: clip s_max_pu to account for max voltage angle difference

This commit is contained in:
Fabian 2022-02-16 14:29:44 +01:00
parent 246d5f5964
commit 75b695eed4
2 changed files with 18 additions and 14 deletions

View File

@ -526,9 +526,13 @@ def estimate_renewable_capacities(n, tech_map):
.where(lambda s: s>0.1, 0.)) # only capacities above 100kW .where(lambda s: s>0.1, 0.)) # only capacities above 100kW
n.generators.loc[tech_i, 'p_nom_min'] = n.generators.loc[tech_i, 'p_nom'] n.generators.loc[tech_i, 'p_nom_min'] = n.generators.loc[tech_i, 'p_nom']
def attach_line_rating(n, fn): def attach_line_rating(n, fn, s_max_py_factor):
s_max = xr.open_dataarray(fn).to_pandas().transpose() s_max = xr.open_dataarray(fn).to_pandas().transpose()
n.lines_t.s_max_pu = s_max / n.lines.s_nom[s_max.columns] #only considers overhead lines n.lines_t.s_max_pu = s_max / n.lines.s_nom[s_max.columns] #only considers overhead lines
# account for maximal voltage angles of maximally 30 degree.
x = n.lines.x_pu
s_max_pu_cap = np.pi / (6 * x * n.lines.s_nom)
n.lines_t.s_max_pu = n.lines_t.s_max_pu.clip(upper=s_max_pu_cap, lower=1)
def add_nice_carrier_names(n, config): def add_nice_carrier_names(n, config):
carrier_i = n.carriers.index carrier_i = n.carriers.index
@ -580,7 +584,8 @@ if __name__ == "__main__":
update_p_nom_max(n) update_p_nom_max(n)
if snakemake.config["lines"]["line_rating"]: if snakemake.config["lines"]["line_rating"]:
attach_line_rating(n, snakemake.input.line_rating) s_max_pu_factor = snakemake.config["lines"]["s_max_pu"]
attach_line_rating(n, snakemake.input.line_rating, s_max_pu_factor)
add_nice_carrier_names(n, snakemake.config) add_nice_carrier_names(n, snakemake.config)

View File

@ -124,7 +124,6 @@ if __name__ == "__main__":
configure_logging(snakemake) configure_logging(snakemake)
n = pypsa.Network(snakemake.input.base_network) n = pypsa.Network(snakemake.input.base_network)
s_max_pu_factor=snakemake.config["lines"]["s_max_pu"]
da=calculate_line_rating(n)*s_max_pu_factor
da=calculate_line_rating(n)
da.to_netcdf(snakemake.output[0]) da.to_netcdf(snakemake.output[0])