fix operations network infeasibilities

This commit is contained in:
Philipp Glaum 2022-02-04 15:58:29 +01:00
parent 4341827952
commit 246d5f5964
5 changed files with 12 additions and 7 deletions

View File

@ -346,7 +346,7 @@ rule solve_network:
rule solve_operations_network:
input:
unprepared="networks/elec_s{simpl}_{clusters}_ec.nc",
unprepared="networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
optimized="results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"
output: "results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_op.nc"
log:

View File

@ -190,7 +190,7 @@ if __name__ == "__main__":
if 'snakemake' not in globals():
from _helpers import mock_snakemake
snakemake = mock_snakemake('add_extra_components', network='elec',
simpl='', clusters=5)
simpl='', clusters=40)
configure_logging(snakemake)
n = pypsa.Network(snakemake.input.network)

View File

@ -94,7 +94,7 @@ def calculate_line_rating(n):
-------
xarray DataArray object with maximal power.
"""
relevant_lines=n.lines[(n.lines['underground']==False) & (n.lines['under_construction']==False)]
relevant_lines=n.lines[(n.lines['underground']==False)]
buses = relevant_lines[["bus0", "bus1"]].values
x = n.buses.x
y = n.buses.y
@ -120,10 +120,11 @@ if __name__ == "__main__":
if 'snakemake' not in globals():
from _helpers import mock_snakemake
snakemake = mock_snakemake('build_line_rating', network='elec', simpl='',
clusters='40', ll='copt', opts='Co2L-4H')
clusters='40', ll='v1.0', opts='Co2L-4H')
configure_logging(snakemake)
n = pypsa.Network(snakemake.input.base_network)
da=calculate_line_rating(n)
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.to_netcdf(snakemake.output[0])

View File

@ -203,7 +203,7 @@ if __name__ == "__main__":
if 'snakemake' not in globals():
from _helpers import mock_snakemake
snakemake = mock_snakemake('prepare_network', network='elec', simpl='',
clusters='40', ll='v0.3', opts='Co2L-24H')
clusters='40', ll='v1.0', opts='Co2L-4H')
configure_logging(snakemake)
opts = snakemake.wildcards.opts.split('-')

View File

@ -80,6 +80,10 @@ def set_parameters_from_optimized(n, n_optim):
n.generators.loc[gen_extend_i, 'p_nom'] = \
n_optim.generators['p_nom_opt'].reindex(gen_extend_i, fill_value=0.)
n.generators.loc[gen_extend_i, 'p_nom_extendable'] = False
#Use load shredding to avoid infeasibilites
n.generators.loc["dummy"]=n.generators.iloc[0]
n.generators.loc[["dummy"],["p_nom_extendable"]]=True
n.generators.loc[["dummy"],["marginal_cost"]]=3000
stor_units_extend_i = n.storage_units.index[n.storage_units.p_nom_extendable]
n.storage_units.loc[stor_units_extend_i, 'p_nom'] = \