diff --git a/.gitignore b/.gitignore index f65c8759..2987cc72 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ gurobi.log *.pyc /cutouts +/tmp \ No newline at end of file diff --git a/Snakefile b/Snakefile index 1cb625b2..b0668fce 100644 --- a/Snakefile +++ b/Snakefile @@ -178,7 +178,7 @@ rule prepare_sector_network: transport_name='data/transport_data.csv', biomass_potentials='data/biomass_potentials.csv', timezone_mappings='data/timezone_mappings.csv', - heat_profile="data/heat_load_profile.csv", + heat_profile="data/heat_load_profile_BDEW.csv", costs="data/costs.csv", clustered_pop_layout="resources/pop_layout_{network}_s{simpl}_{clusters}.csv", industrial_demand="resources/industrial_demand_{network}_s{simpl}_{clusters}.csv", @@ -219,7 +219,7 @@ rule solve_network: memory="logs/" + config['run'] + "/{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=100000 #memory in MB; 40 GB enough for 45+B+I; 100 GB based on RESI usage for 128 + resources: mem=50000 #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 e660a889..b0f56b10 100644 --- a/config.yaml +++ b/config.yaml @@ -2,15 +2,15 @@ logging_level: INFO results_dir: 'results/' summary_dir: results -run: '190728-space0p5' +run: '190807-resserv_bdew' scenario: sectors: [E] # ,E+EV,E+BEV,E+BEV+V2G] # [ E+EV, E+BEV, E+BEV+V2G ] simpl: [''] lv: [1.0]#, 1.125, 1.25, 1.5, 2.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 + clusters: [50] #[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-space0p5,Co2L0-3H-T-H-B-I-nodistrict-space0p5]#,Co2L0p1-3H-T-H-B-I,Co2L0p25-3H-T-H-B-I,Co2L0p5-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] + sector_opts: [Co2L0-3H-T-H-B-I]#,Co2L0p1-3H-T-H-B-I,Co2L0p25-3H-T-H-B-I,Co2L0p5-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 @@ -116,6 +116,7 @@ costs: solving: + #tmpdir: "/mnt/lsdf/tom/playground/pypsa-eur-sec/tmp" options: formulation: kirchhoff clip_p_max_pu: 1.e-2 @@ -133,14 +134,18 @@ solving: method: 2 # barrier crossover: 0 BarConvTol: 1.e-5 - FeasibilityTol: 1.e-6 - # solver: - # name: cplex - # threads: 4 - # lpmethod: 4 # barrier - # solutiontype: 2 # non basic solution, ie no crossover - # barrier.convergetol: 1.e-5 - # feasopt.tolerance: 1.e-6 + Seed: 123 + AggFill: 0 + PreDual: 0 + GURO_PAR_BARDENSETHRESH: 200 + #FeasibilityTol: 1.e-6 + + #name: cplex + #threads: 4 + #lpmethod: 4 # barrier + #solutiontype: 2 # non basic solution, ie no crossover + #barrier_convergetol: 1.e-5 + #feasopt_tolerance: 1.e-6 plotting: map: diff --git a/data/heat_load_profile_BDEW.csv b/data/heat_load_profile_BDEW.csv new file mode 100644 index 00000000..d57ee76f --- /dev/null +++ b/data/heat_load_profile_BDEW.csv @@ -0,0 +1,25 @@ +,residential space weekday,residential space weekend,services space weekday,services space weekend,residential water weekday,residential water weekend,services water weekday,services water weekend +0,0.5437843306385036,0.5391846410003029,0.740230434593118,0.7918173557545402,1.0,1.0,1.0,1.0 +1,0.5690496225400243,0.5641534370440313,0.7642025524842398,0.7929627291950984,1.0,1.0,1.0,1.0 +2,0.5624023211873742,0.5575494117194042,0.8264420882344785,0.8961602364492307,1.0,1.0,1.0,1.0 +3,0.6120351867307156,0.6074588966300298,0.9338477492552973,1.066547622880321,1.0,1.0,1.0,1.0 +4,0.8210089232467712,0.8188451841881503,1.1288089786462463,1.2779268432155158,1.0,1.0,1.0,1.0 +5,1.2287073985428116,1.2315677844536332,1.3311522394966053,1.2808129834243316,1.0,1.0,1.0,1.0 +6,1.327953505819319,1.3349874311629708,1.3976491755316236,1.3076676145167292,1.0,1.0,1.0,1.0 +7,1.2533048874868005,1.2584095945395426,1.3529869654334066,1.239881414312941,1.0,1.0,1.0,1.0 +8,1.204661538907097,1.206562127967529,1.2631870820835946,1.157513929299677,1.0,1.0,1.0,1.0 +9,1.1511425365003825,1.152931252109671,1.183486516733693,1.1001631309844286,1.0,1.0,1.0,1.0 +10,1.0982914366923946,1.0987739728887453,1.1056637898031139,1.0553379006911972,1.0,1.0,1.0,1.0 +11,1.0602079991199889,1.0598534287519163,1.0536117591812475,0.9953570175561463,1.0,1.0,1.0,1.0 +12,1.0430483470403709,1.042552786631541,1.0075511014823457,0.9238971341830102,1.0,1.0,1.0,1.0 +13,1.023765876994618,1.0234573235486537,0.983633820661761,0.928978159404834,1.0,1.0,1.0,1.0 +14,1.0250355817085612,1.0241187665206792,0.973887563496691,0.9277637088455348,1.0,1.0,1.0,1.0 +15,1.0419068035344277,1.0407369052119213,0.968639109712126,0.940383626933661,1.0,1.0,1.0,1.0 +16,1.0886607269753739,1.0871365340901091,0.9776106671510321,0.9762628252848075,1.0,1.0,1.0,1.0 +17,1.1391891744979068,1.1377875788466947,0.9713068946564802,0.9923707220696051,1.0,1.0,1.0,1.0 +18,1.1813708458227477,1.1815796155786216,0.97710710371407,0.9822063279944322,1.0,1.0,1.0,1.0 +19,1.2048721952031847,1.2066686818939167,0.9620977486617706,0.9872726025741575,1.0,1.0,1.0,1.0 +20,1.1883594612741015,1.1911629803333679,0.9096499832485738,0.9736368622053816,1.0,1.0,1.0,1.0 +21,1.0841006081889941,1.0875548281900813,0.7954827338259405,0.8733383541170725,1.0,1.0,1.0,1.0 +22,0.8887378869444746,0.8893062174837649,0.7007233800713178,0.7753100551108082,1.0,1.0,1.0,1.0 +23,0.6584028044030574,0.6576606192147261,0.6910405618412271,0.756430842996538,1.0,1.0,1.0,1.0 diff --git a/scripts/copy_config.py b/scripts/copy_config.py index e2ea3889..689dd31f 100644 --- a/scripts/copy_config.py +++ b/scripts/copy_config.py @@ -2,6 +2,7 @@ from shutil import copy files = ["config.yaml", + "Snakefile", "scripts/solve_network.py", "scripts/prepare_sector_network.py"] diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 7aa34547..535bdda4 100644 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -21,8 +21,6 @@ from vresutils.benchmark import memory_logger - - #First tell PyPSA that links can have multiple outputs by #overriding the component_attrs. This can be done for #as many buses as you need with format busi for i = 2,3,4,5,.... @@ -73,9 +71,11 @@ def prepare_network(n, solve_opts=None): #if 'capital_cost' in t.df: # t.df['capital_cost'] += 1e1 + 2.*(np.random.random(len(t.df)) - 0.5) if 'marginal_cost' in t.df: + np.random.seed(174) t.df['marginal_cost'] += 1e-2 + 2e-3*(np.random.random(len(t.df)) - 0.5) for t in n.iterate_components(['Line', 'Link']): + np.random.seed(123) t.df['capital_cost'] += (1e-1 + 2e-2*(np.random.random(len(t.df)) - 0.5)) * t.df['length'] if solve_opts.get('nhours'): @@ -243,6 +243,7 @@ def solve_network(n, config=None, solver_log=None, opts=None): solver_options=solver_options, formulation=solve_opts['formulation'], extra_postprocessing=extra_postprocessing + #keep_files=True #free_memory={'pypsa'} )