diff --git a/Snakefile b/Snakefile index 55ee0594..6400a3cb 100644 --- a/Snakefile +++ b/Snakefile @@ -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: diff --git a/scripts/add_extra_components.py b/scripts/add_extra_components.py index 287dd66e..d65fa15d 100644 --- a/scripts/add_extra_components.py +++ b/scripts/add_extra_components.py @@ -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) diff --git a/scripts/build_line_rating.py b/scripts/build_line_rating.py index 30dd2674..c492c22f 100755 --- a/scripts/build_line_rating.py +++ b/scripts/build_line_rating.py @@ -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]) \ No newline at end of file diff --git a/scripts/prepare_network.py b/scripts/prepare_network.py index f984ace6..5cef1afd 100755 --- a/scripts/prepare_network.py +++ b/scripts/prepare_network.py @@ -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('-') diff --git a/scripts/solve_operations_network.py b/scripts/solve_operations_network.py index e308b503..faa11b90 100644 --- a/scripts/solve_operations_network.py +++ b/scripts/solve_operations_network.py @@ -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'] = \