From 0ab5bd200ae83cc72522dd364c7a8937b3c91718 Mon Sep 17 00:00:00 2001 From: Tom Brown Date: Wed, 8 May 2019 12:18:18 +0200 Subject: [PATCH] Fix gas and oil stores so that they allow fossil fuel extraction Before both initial SOC and final SOC were set to be zero, which prevents synthetic fuel transfer over the year boundary, and prevents the use of fossil fuels for non-zero CO2 scenarios. Now done properly with cyclic Store (prevents accumulation of fossil fuels as a form of sequestration) and Generator (to imitate fossil fuel extraction). --- Snakefile | 2 +- config.yaml | 8 ++++---- scripts/prepare_sector_network.py | 27 +++++++++++++++++++++------ 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Snakefile b/Snakefile index 072307a7..b0a575a2 100644 --- a/Snakefile +++ b/Snakefile @@ -197,7 +197,7 @@ rule solve_network: memory="logs/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}_memory.log" benchmark: "benchmarks/solve_network/{network}_s{simpl}_{clusters}_lv{lv}_{opts}_{sector_opts}" threads: 4 - resources: mem=230000 #memory in MB; 40 GB enough for 45+B+I; 100 GB based on RESI usage for 128 + resources: mem=100000 #memory in MB; 40 GB enough for 45+B+I; 100 GB based on RESI usage for 128 # group: "solve" # with group, threads is ignored https://bitbucket.org/snakemake/snakemake/issues/971/group-job-description-does-not-contain script: "scripts/solve_network.py" diff --git a/config.yaml b/config.yaml index 918ea668..68381e42 100644 --- a/config.yaml +++ b/config.yaml @@ -2,15 +2,15 @@ logging_level: INFO results_dir: 'results/' summary_dir: results -run: '190502-181' +run: '190508-test_fossil' scenario: sectors: [E] # ,E+EV,E+BEV,E+BEV+V2G] # [ E+EV, E+BEV, E+BEV+V2G ] simpl: [''] - lv: [1.0,1.25]#[1.0, 1.125, 1.25, 1.5, 2.0, opt]# or opt - clusters: [181] #[90, 128, 181] #[45, 64, 90, 128, 181, 256] #, 362] # (2**np.r_[5.5:9:.5]).astype(int) minimum is 37 + lv: [1.0]# or opt + clusters: [128] #[90, 128, 181] #[45, 64, 90, 128, 181, 256] #, 362] # (2**np.r_[5.5:9:.5]).astype(int) minimum is 37 opts: [''] #for pypsa-eur - sector_opts: [Co2L0-3H-T-H-B-I-solar3,Co2L0-3H-T-H-B-I-onwind0p25-solar3]#,Co2L0p05-3H-T-H-B-I,Co2L0p10-3H-T-H-B-I,Co2L0p20-3H-T-H-B-I,Co2L0p30-3H-T-H-B-I,Co2L0p50-3H-T-H-B-I]#[Co2L-3H-T-H,Co2L0p10-3H-T-H,Co2L0-3H-T-H,Co2L0p20-3H-T-H] #Co2L-3H-T-H,Co2L0p10-3H-T-H,Co2L0p20-3H-T-HCo2L-3H-T-H,Co2L0p10-3H-T-H,Co2L0p30-3H-T-H,Co2L0p50-3H-T-H] #Co2L-3H,Co2L-3H-T,, LC-FL, LC-T, Ep-T, Co2L-T] + sector_opts: [Co2L0-3H-T-H-B-I,Co2L0p1-3H-T-H-B-I,Co2L0p25-3H-T-H-B-I,Co2L0p50-3H-T-H-B-I]#[Co2L0-3H-T-H-B-I-onwind0-solar3,Co2L0-3H-T-H-B-I-onwind0p125-solar3,Co2L0-3H-T-H-B-I-onwind0p25-solar3,Co2L0-3H-T-H-B-I-onwind0p50-solar3,Co2L0-3H-T-H-B-I-solar3]#,Co2L0-3H-T-H-B-I-onwind0p25-solar3]#,Co2L0p05-3H-T-H-B-I,Co2L0p10-3H-T-H-B-I,Co2L0p20-3H-T-H-B-I,Co2L0p30-3H-T-H-B-I,Co2L0p50-3H-T-H-B-I]#[Co2L-3H-T-H,Co2L0p10-3H-T-H,Co2L0-3H-T-H,Co2L0p20-3H-T-H] #Co2L-3H-T-H,Co2L0p10-3H-T-H,Co2L0p20-3H-T-HCo2L-3H-T-H,Co2L0p10-3H-T-H,Co2L0p30-3H-T-H,Co2L0p50-3H-T-H] #Co2L-3H,Co2L-3H-T,, LC-FL, LC-T, Ep-T, Co2L-T] # Co2L will give default (5%); Co2L0p25 will give 25% CO2 emissions; Co2Lm0p05 will give 5% negative emissions diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index ca620e1c..5b89a5f6 100644 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -452,10 +452,18 @@ def add_generation(network): ["EU " + carrier + " Store"], bus=["EU " + carrier], e_nom_extendable=True, - #force fossil to be empty at end of period; can start higher to represent fossil input - e_max_pu=pd.DataFrame({ "EU " + carrier + " Store" : pd.Series([1.]*(len(network.snapshots)-1)+[0.],index=network.snapshots)}), + e_cyclic=True, carrier=carrier, - marginal_cost=costs.at[carrier,'fuel']) + capital_cost=0.) #could correct to e.g. 0.2 EUR/kWh * annuity and O&M + + network.add("Generator", + "EU fossil " + carrier, + bus="EU " + carrier, + p_nom_extendable=True, + carrier=carrier, + capital_cost=0., + marginal_cost=costs.at[carrier,'fuel']) + network.madd("Link", nodes + " " + generator, @@ -1148,10 +1156,17 @@ def add_industry(network): ["Fischer-Tropsch Store"], bus="Fischer-Tropsch", e_nom_extendable=True, - #force fossil to be empty at end of period; can start higher to represent fossil input - e_max_pu=pd.DataFrame({ "Fischer-Tropsch Store" : pd.Series([1.]*(len(network.snapshots)-1)+[0.],index=network.snapshots)}), + e_cyclic=True, carrier="Fischer-Tropsch", - marginal_cost=costs.at["oil",'fuel']) + capital_cost=0.) #could correct to e.g. 0.001 EUR/kWh * annuity and O&M + + network.add("Generator", + "fossil oil", + bus="Fischer-Tropsch", + p_nom_extendable=True, + carrier="oil", + capital_cost=0., + marginal_cost=costs.at["oil",'fuel']) network.madd("Link", nodes + " Fischer-Tropsch",