Skip to content

Commit

Permalink
Merge pull request #142 from pypsa-meets-earth/demand_linker
Browse files Browse the repository at this point in the history
Demand linker
  • Loading branch information
energyLS authored Nov 1, 2022
2 parents 0ed264a + c6f460e commit 719386d
Show file tree
Hide file tree
Showing 25 changed files with 681 additions and 637 deletions.
268 changes: 143 additions & 125 deletions Snakefile

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions config.pypsa-earth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ scenario:
opts: [Co2L1-144H]

countries: ["MA"]
# Can be replaced by country ["NG", "BJ"] or user specific region, more at https://pypsa-meets-africa.readthedocs.io/en/latest/configuration.html#top-level-configuration
# Can be replaced by country ["NG", "BJ"] or user specific region, more at https://pypsa-meets-earth.readthedocs.io/en/latest/configuration.html#top-level-configuration

snapshots:
start: "2013-01-01"
Expand Down Expand Up @@ -96,7 +96,7 @@ load_options:

electricity:
voltages: [220., 300., 380.]
co2limit: 4.0e+6 # 0.05 * 3.1e9*0.5
co2limit: 4.0e+3 # 0.05 * 3.1e9*0.5
co2base: 1.487e+8
agg_p_nom_limits: data/agg_p_nom_minmax.csv
hvdc_as_lines: true # should HVDC lines be modeled as `Line` or as `Link` component?
Expand Down Expand Up @@ -291,6 +291,20 @@ costs:
emission_prices: # in currency per tonne emission, only used with the option Ep
co2: 0.

monte_carlo:
options:
add_to_snakefile: false
samples: 7 # number of optimizations
sampling_strategy: "chaospy" # "pydoe2", "chaospy", "scipy", packages that are supported
pypsa_standard:
# User can add here flexibly more features for the Monte-Carlo sampling.
# Given as "key: value" format
# Key: add below the pypsa object for the monte_carlo sampling, "network" is only allowed for filtering!
# Value: currently supported format [l_bound, u_bound] or empty [], represent multiplication factors for the object
loads_t.p_set: [0.9, 1.1]
generators_t.p_max_pu.loc[:, n.generators.carrier == "wind"]: [0.9, 1.1]
generators_t.p_max_pu.loc[:, n.generators.carrier == "solar"]: [0.9, 1.1]


solving:
options:
Expand Down
57 changes: 41 additions & 16 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ results_dir: results/
summary_dir: results/
costs_dir: data/ #TODO change to the equivalent of technology data

run: runname_test
run: runname_test_new_gadm7

foresight: overnight

scenario:
simpl: # only relevant for PyPSA-Eur
- ""
clusters: # number of nodes in Europe, any integer between 37 (1 node per country-zone) and several hundred
- 20
- 117
planning_horizons: # investment years for myopic and perfect; or costs year for overnight
- 2030
ll:
Expand All @@ -22,12 +22,19 @@ scenario:
- "Co2L"
sopts:
- "730H"
demand:
- "NZ"

clustering_options:
alternative_clustering: false

countries: ['MA']

custom_data:
renewables: [] #['csp', 'rooftop-solar', 'solar', 'onwind', 'onwind-2', 'offwind', 'offwind-2']
renewables: ['csp', 'rooftop-solar', 'solar', 'onwind', 'onwind2', 'offwind', 'offwind2']
elec_demand: true
industry_demand: true

costs:
lifetime: 25 #default lifetime
# From a Lion Hirth paper, also reflects average of Noothout et al 2016
Expand All @@ -53,7 +60,7 @@ costs:
length_factor: 1.25 #to estimate offwind connection costs

industry:
St_primary_fraction: 0.9 # fraction of steel produced via primary route versus secondary route (scrap+EAF); today fraction is 0.6
St_primary_fraction: 0.90 # fraction of steel produced via primary route versus secondary route (scrap+EAF); today fraction is 0.6
# 2020: 0.6
# 2025: 0.55
# 2030: 0.5
Expand Down Expand Up @@ -172,31 +179,49 @@ sector:
biomass_transport: true # biomass transport between nodes


land_transport_fuel_cell_share: 0.05 # 1 means all FCEVs
# 2020: 0
# 2030: 0.05
# 2040: 0.1
# 2050: 0.15
land_transport_electric_share: 0.15 # 1 means all EVs # This leads to problems when non-zero
# 2020: 0
# 2030: 0.25
# 2040: 0.6
# 2050: 0.85
land_transport_fuel_cell_share: # 1 means all FCEVs HERE
BU_2030: 0.00
AP_2030: 0.004
NZ_2030: 0.02
DF_2030: 0.01
BU_2050: 0.00
AP_2050: 0.06
NZ_2050: 0.28
DF_2050: 0.05

land_transport_electric_share: # 1 means all EVs # This leads to problems when non-zero HERE
BU_2030: 0.00
AP_2030: 0.075
NZ_2030: 0.13
DF_2030: 0.01
BU_2050: 0.00
AP_2050: 0.42
NZ_2050: 0.68
DF_2050: 0.15

co2_network: true
co2_sequestration_potential: 200 #MtCO2/a sequestration potential for Europe
co2_sequestration_cost: 10 #EUR/tCO2 for sequestration of CO2
hydrogen_underground_storage: true
shipping_hydrogen_liquefaction: false
shipping_average_efficiency: 0.4 #For conversion of fuel oil to propulsion in 2011
shipping_hydrogen_share: 1.0
shipping_hydrogen_share:
BU_2030: 0.00
AP_2030: 0.00
NZ_2030: 0.10
DF_2030: 0.10
BU_2050: 0.00
AP_2050: 0.25
NZ_2050: 0.36
DF_2050: 0.36

gadm_level: 2
h2_cavern: true
marginal_cost_storage: 0
methanation: true
helmeth: true
dac: true
SMR: true
SMR: false
cc_fraction: 0.9

conventional_generation: # generator : carrier
Expand Down
22 changes: 13 additions & 9 deletions data/airports.csv
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
name,country,fraction,y,x
Casablanca-Mohammed V,MA,0.428393181,33.373831,-7.579726
Marrakesh,MA,0.265873634,31.60416425,-8.035166526
Agadir,MA,0.083484208,30.325,-9.413056
Fez,MA,0.05893589,33.927222,-4.978056
Tangiers,MA,0.056274782,35.179557,-3.839891
Rabat,MA,0.045757958,34.051389,-6.751389
Nador,MA,0.032104508,34.988889,-3.028333
Oujda,MA,0.029175839,34.787222,-1.923889
name,country,fraction,y,x
Casablanca-Mohammed V,MA,0.428393181,33.373831,-7.579726
Marrakesh,MA,0.265873634,31.60416425,-8.035166526
Agadir,MA,0.083484208,30.325,-9.413056
Fez,MA,0.05893589,33.927222,-4.978056
Tangiers,MA,0.056274782,35.179557,-3.839891
Rabat,MA,0.045757958,34.051389,-6.751389
Nador,MA,0.032104508,34.988889,-3.028333
Oujda,MA,0.029175839,34.787222,-1.923889
Dummy Airport1,NG,0.7,11.423,6.032
Dummy Airport2,NG,0.3,8.34321,9.143
Dummy Airport1,BJ,0.7,10.23,2.32
Dummy Airport2,BJ,0.3,7.3,2.24
4 changes: 4 additions & 0 deletions data/energy_totals_DF_2030.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
country,total residential space,electricity residential space,total residential water,electricity residential water,total residential cooking,electricity residential cooking,total residential,electricity residential,derived heat residential,thermal uses residential,total services space,electricity services space,total services water,electricity services water,total services cooking,electricity services cooking,total services,electricity services,derived heat services,thermal uses services,total agriculture electricity,total agriculture heat,total agriculture machinery,total agriculture,total road,electricity road,total two-wheel,total passenger cars,electricity passenger cars,total other road passenger,electricity other road passenger,total light duty road freight,electricity light duty road freight,total heavy duty road freight,total rail,electricity rail,total rail passenger,electricity rail passenger,total rail freight,electricity rail freight,total aviation passenger,total aviation freight,total domestic aviation passenger,total international aviation passenger,total domestic aviation freight,total international aviation freight,total domestic aviation,total international aviation,total domestic navigation,district heat share,total international navigation
MA,4.2,0.28,7.3,0.23,4.9,3.3,23.31,8.03,,,,,,,,,15.89,9.13,,,4.91,0,,12.03,64.23,,,,,,,,,,,,,,,,,,,,,,0.39,8.93,10.32,,1.32
NG,4.2,0.28,7.3,0.23,4.9,3.3,23.31,8.03,,,,,,,,,15.89,9.13,,,4.91,0,,12.03,64.23,,,,,,,,,,,,,,,,,,,,,,0.39,8.93,10.32,,1.32
BJ,4.2,0.28,7.3,0.23,4.9,3.3,23.31,8.03,,,,,,,,,15.89,9.13,,,4.91,0,,12.03,64.23,,,,,,,,,,,,,,,,,,,,,,0.39,8.93,10.32,,1.32
2 changes: 2 additions & 0 deletions data/energy_totals_NZ_2030.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
country,total residential space,electricity residential space,total residential water,electricity residential water,total residential cooking,electricity residential cooking,total residential,electricity residential,derived heat residential,thermal uses residential,total services space,electricity services space,total services water,electricity services water,total services cooking,electricity services cooking,total services,electricity services,derived heat services,thermal uses services,total agriculture electricity,total agriculture heat,total agriculture machinery,total agriculture,total road,electricity road,total two-wheel,total passenger cars,electricity passenger cars,total other road passenger,electricity other road passenger,total light duty road freight,electricity light duty road freight,total heavy duty road freight,total rail,electricity rail,total rail passenger,electricity rail passenger,total rail freight,electricity rail freight,total aviation passenger,total aviation freight,total domestic aviation passenger,total international aviation passenger,total domestic aviation freight,total international aviation freight,total domestic aviation,total international aviation,total domestic navigation,district heat share,total international navigation,Unnamed: 52
MA,5.766916119,0.342850196,8.711837404,0.517929358,6.345549244,3.965968278,26.79420503,22.8,,,,,,,,,18.12963843,10.87778306,,,5.893436668,0,,14.73359167,71.52182725,8.960706721,0.246818419,44.53787907,5.11363105,1.090110939,0.178445734,2.433799832,0.280386662,23.21321899,3.378036398,1.194635708,1.818410082,0.799396967,1.559626316,0.395238741,,,0.507593252,,,,0.507593252,11.2666949,11.83967678,,1.82134562,
23 changes: 23 additions & 0 deletions data/industrial_database.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
country,y,x,technology,capacity,unit,quality,location,Source
MA,33.592793,-7.475613,Industry Steel Secondary EAF,1000,Kt/yr,actual,"Ahl Moughlam, Tit Mellil",Tracker Map - Global Energy Monitor
MA,33.136529,-8.603555,Industry Steel Secondary EAF,800,Kt/yr,actual,"El Jadida, Jorf Lasfar",Tracker Map - Global Energy Monitor
MA,33.603593,-7.640174,Industry Steel Secondary EAF,800,Kt/yr,actual,Casablanca,Tracker Map - Global Energy Monitor
MA,30.218836,-9.157324,Industry NMM Cement,2200,Kt/yr,actual,Chtouka-Aït Baha,Cement Plants located in Morocco (cemnet.com)
MA,31.585034,-8.502796,Industry NMM Cement,1400,Kt/yr,actual,Mzoudia,"Our History| Cements from Morocco (cimentsdumaroc.com), https://www.cemnet.com/global-cement-report/country/morocco"
MA,32.550023,-9.10011,Industry NMM Cement,1000,Kt/yr,actual,Safi,Marrakech factory| Cements from Morocco (cimentsdumaroc.com)
MA,32.584623,-6.148034,Industry NMM Cement,1600,Kt/yr,actual,Beni Mellal,Cimat - NOS SITES
MA,32.990162,-7.145939,Industry NMM Cement,1600,Kt/yr,actual,Ben Ahmed,Cimat - NOS SITES
MA,33.05424,-7.533158,Industry NMM Cement,1700,Kt/yr,actual,Settat,"Morocco’s Settat cement plant ranked as second most efficient in LafargeHolcim Group - Cement industry news from Global Cement, https://www.archyde.com/lafargeholcim-morocco-settat-cement-plant-stands-out-on-a-global-scale/"
MA,33.36865,-7.748368,Industry NMM Cement,3000,Kt/yr,actual,Bouskoura,Communiqué de presse Lafarge / Lafarge press release (holcim.com)
MA,33.891323,-6.946778,Industry NMM Cement,1200,Kt/yr,actual,Temara,Company Votorantim Cimentos Morocco History
MA,33.909977,-5.495519,Industry NMM Cement,1800,Kt/yr,actual,Meknes,GID cement database
MA,33.944215,-5.117161,Industry NMM Cement,1900,Kt/yr,actual,Fes,GID cement database
MA,34.59326,-2.349346,Industry NMM Cement,1300,Kt/yr,actual,Oujda,GID cement database
MA,36.602102,-5.43119,Industry NMM Cement,2500,Kt/yr,actual,Tétouan,GID cement database
MA,27.093082,-13.133753,Industry NMM Cement,500,Kt/yr,actual,Laâyoune,Our History| Cements from Morocco (cimentsdumaroc.com)
MA,27.180683,-13.394904,Industry NMM Cement,500,Kt/yr,actual,Laâyoune,anouar-undated.pdf (wsrw.org)
MA,27.896842,-12.893876,Industry NMM Cement,300,Kt/yr,actual,Tarfaya,CEMOS CIMENT S.A | Society
MA,33.157731,-8.605763,Industry NMM Cement,450,Kt/yr,actual,El Jadida,Jorf Lasfar shredding centre | Cements from Morocco (cimentsdumaroc.com)
MA,35.656333,-5.915386,Industry NMM Cement,500,Kt/yr,actual,Tangier,
NG,9.164421,-9.191386,Industry NMM Cement,500,Kt/yr,actual,test,
BJ,9.164421,-2.032412,Industry NMM Cement,400,Kt/yr,actual,test,
11 changes: 11 additions & 0 deletions data/industry_sector_ratios_DF_2030.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
MWh/tMaterial,Electric arc,DRI + Electric arc,Integrated steelworks,HVC,HVC (mechanical recycling),HVC (chemical recycling),Ammonia,Chlorine,Methanol,Other chemicals,Pharmaceutical products etc.,Cement,Ceramics & other NMM,Glass production,Pulp production,Paper production,Printing and media reproduction,"Food, beverages and tobacco",Alumina production,Aluminium - primary production,Aluminium - secondary production,Other non-ferrous metals,Transport Equipment,Machinery Equipment,Textiles and leather,Wood and wood products,Other Industrial Sectors
elec,1.08131011263201,1.40331011263201,1.02081290065712,2.85171802237564,0.547,6.9,1.17,3.6,0.167,4.59413467649299,2.74571454900933,0.061927560760266,0.444131182274648,2.07129313682578,1.18836563342834,0.671816951975397,2.58433845085736,0.609579312924535,1.7148611860778,13.6682779635768,1.70679863625316,3.21870208268845,0.26360808307069,0.302321103903853,0.465709368129419,0.959299391661276,1.28392230762155
coal,0,0,1.37700428586814,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
coke,0,0,1.31179002640128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
biomass,0,0,0,0,0,0,0,0,0,0,0,0.197014429694347,0,0,2.11770263341691,2.3556399768381,0,0.639097011494721,0,0,0,0,0.063791711155947,0.046328443575653,0.25434164393245,1.81917612747947,0.385739912368899
gas,0.22647645142597,0.22647645142597,0.223726256567725,4.07019298065976,0,0,0,0,10.25,0,0,0.517919514482129,0,0,0,0,0,0,2.33849373100086,0,0,0,0,0,0,0,0
hydrogen,0,1.7,0,0.000172661076923,0,0,6.5,-0.9372,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
heat,0.003017860956765,0.003017860956765,0.005250701955935,0.246660062683918,0,0,0,0,0,0.14504371624202,0.093834952759942,0.002137249780593,0.002499487519859,0.017944882377285,0.039954020725194,0.03386441536949,0.726758205777018,0.026536577121055,0.00315480532373,0.010242405894815,0.002131812723607,0.003474096021933,0.010264108163452,0.010450031028829,0.060237643860528,0.058567765114422,0.042513616053224
oil,0,0,0,14.0078364473941,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
process emission,0.027663169349199,0.027663169349199,0.216388525166488,0.024489586623069,0,0,0,0,0,6.86721429642212E-05,0,0.542433217279835,0.031681531903839,0.102551470416709,0,0,0,0,0,1.49134585796386,0,0.169966661912688,0,0,0,0,0
process emission from feedstock,0,0,0,0.490384615384615,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
9 changes: 9 additions & 0 deletions data/industry_sector_ratios_NZ_2030.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
,Industry Steel Primary Blast Furnace Open Hearth Furnace,Industry Steel Primary Blast Furnace Basic Oxygen Furnace,Industry Steel Primary DRI,Industry Steel Secondary EAF,Industry Steel Casting Rolling Finishing,Industry Steel Other,Industry Chemical Ammonia SMR,Industry Chemical Ammonia Other conventional,Industry Chemical Ammonia Renewable,Industry Chemical HVC Naphtha,Industry Chemical HVC LPG,Industry Chemical HVC Methanol,Industry Chemical Other,Industry NMM Cement,Industry NMM Other,Industry Food and tobacco,Industry Construction,Industry Mining,Industry Non ferrous metals Aluminium Primary,Industry Non ferrous metals Aluminium Secondary,Industry Non ferrous metals Other,Industry Paper and pulp Pulp Primary,Industry Paper and pulp Pulp Secondary,Industry Paper and pulp Paper,Industry Paper and pulp Other,Industry Transport equipment,Industry Textiles and leather,Industry Wood,Industry Miscellaneous
oil,0,0,0,0.16,0,2,0,3.52,0,4.55,5.2,0,310143,1.18,17968,1600257,541532,3220424,5.57,2.07,600620,0.58,0.12,0.78,1366,38486,346145,0,204340
gas,0,0,0,0,0,0,2.63,0,0,0,0,0,0,0.02,49910,0,0,0,0,0,0,1.85,0,0.07,3375,27490,0,0,0
electricity,0.27,0.23,0.51,0.57,0,0,0.23,1.17,1.8,0.29,0.34,0.97,1329186,0.33,79856,2046841,370279,3252954,16.7,0.7,1449772,1.65,0.37,1.31,3214,206173,862283,35612,255426
coal,4.15,3.45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
heat,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
biomass,0,0,0,0,0,0,0,0,0,0,0,0,97474,0.1,49910,37215,9257,0,0,0,0,0,0,0,0,0,11086,1874,0
hydrogen,1.1,0.92,2.35,0,0,0,0,0,0,0.05,0.06,0,35445,0.02,1996,37215,4628,32530,0,0.03,20711,0.04,0,0.02,80,2749,12318,0,4644
process emission,0.216388525,0.216388525,0.027663169349199,0.027663169349199,0,0,0,0,0,0.024489586623069,0.024489586623069,0.024489586623069,6.86721429642211E-05,0.542433217279835,0.031681531903839,0,0,0,1.49134585796386,0,0.169966661912688,0,0,0,0,0,0,0,0
9 changes: 8 additions & 1 deletion data/ports.csv
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
name,country,fraction,y,xPort of Nador,MA,0.2,35.2748795,-2.92229843Port of Tanger Med,MA,0.2,35.5324,-5.3036Port of Kenitra,MA,0.1,34.26101,-6.5802Port of Casablanca,MA,0.4,33.5999976,-7.6166642Port of Kenitra,MA,0.1,33.1267,-8.62028
name,country,fraction,y,x
Port of Nador,MA,0.2,35.2748795,-2.92229843
Port of Tanger Med,MA,0.2,35.5324,-5.3036
Port of Kenitra,MA,0.1,34.26101,-6.5802
Port of Casablanca,MA,0.4,33.5999976,-7.6166642
Port of Kenitra,MA,0.1,33.1267,-8.62028
dummy port 1,NG,1,6.455,4.234
dummy port 1,BJ,1,6.47,2.63
2 changes: 2 additions & 0 deletions energy_totals_NZ_2030_ready.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
country,total residential space,electricity residential space,total residential water,electricity residential water,total residential cooking,electricity residential cooking,total residential,electricity residential,derived heat residential,thermal uses residential,total services space,electricity services space,total services water,electricity services water,total services cooking,electricity services cooking,total services,electricity services,derived heat services,thermal uses services,total agriculture electricity,total agriculture heat,total agriculture machinery,total agriculture,total road,electricity road,total two-wheel,total passenger cars,electricity passenger cars,total other road passenger,electricity other road passenger,total light duty road freight,electricity light duty road freight,total heavy duty road freight,total rail,electricity rail,total rail passenger,electricity rail passenger,total rail freight,electricity rail freight,total aviation passenger,total aviation freight,total domestic aviation passenger,total international aviation passenger,total domestic aviation freight,total international aviation freight,total domestic aviation,total international aviation,total domestic navigation,district heat share,total international navigation,agriculture electricity, agriculture oil,residential biomass,residential gas,services electricity,services biomass,services oil,services gas,residential oil
MA,11.22,0.001,9.9,0.001,0.001,0.001,0.001,21.62,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,18.12963843,10.87778306,0.001,0.001,5.893436668,0.001,0.001,14.73359167,58.25,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,3.61,1.08,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.001,0.5,11.27,12.09,0.001,1.82,3.66,5.3,0.49,0.001,8.45,6.45,0.46,0.001,0.001
Loading

0 comments on commit 719386d

Please sign in to comment.