Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linopy Integration #351

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ if not config["custom_data"]["gas_network"]:
+ "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
),
output:
clustered_gas_network="resources/gas_networks/gas_network_elec_s{simpl}_{clusters}.csv",
# TODO: Should be a own snakemake rule
# gas_network_fig_1="resources/gas_networks/existing_gas_pipelines_{simpl}_{clusters}.png",
# gas_network_fig_2="resources/gas_networks/clustered_gas_pipelines_{simpl}_{clusters}.png",
clustered_gas_network="resources/gas_networks/gas_network_elec_s{simpl}_{clusters}.csv",
script:
"scripts/prepare_gas_network.py"

Expand Down Expand Up @@ -547,6 +547,8 @@ rule copy_config:
if config["foresight"] == "overnight":

rule solve_network:
params:
solving=config["solving"],
input:
overrides="data/override_component_attrs",
# network=RDIR
Expand Down
134 changes: 91 additions & 43 deletions config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ scenario:

policy_config:
hydrogen:
temporal_matching: "no_res_matching" #either "h2_yearly_matching", "h2_monthly_matching", "no_res_matching"
temporal_matching: "no_res_matching" # either "h2_yearly_matching", "h2_monthly_matching", "no_res_matching"
spatial_matching: false
additionality: false # RE electricity is equal to the amount required for additional hydrogen export compared to the 0 export case ("reference_case")
allowed_excess: 1.0
is_reference: false # Whether or not this network is a reference case network, relevant only if additionality is _true_
remove_h2_load: false #Whether or not to remove the h2 load from the network, relevant only if is_reference is _true_
remove_h2_load: false # Whether or not to remove the h2 load from the network, relevant only if is_reference is _true_
path_to_ref: "" # Path to the reference case network for additionality calculation, relevant only if additionality is _true_ and is_reference is _false_
re_country_load: false # Set to "True" to force the RE electricity to be equal to the electricity required for hydrogen export and the country electricity load. "False" excludes the country electricity load from the constraint.

Expand All @@ -61,7 +61,7 @@ enable:
retrieve_irena: true #If true, downloads the IRENA data

fossil_reserves:
oil: 100 #TWh Maybe redundant
oil: 100 # TWh Maybe redundant


export:
Expand Down Expand Up @@ -91,7 +91,7 @@ custom_data:

costs: # Costs used in PyPSA-Earth-Sec. Year depends on the wildcard planning_horizon in the scenario section
version: v0.6.2
lifetime: 25 #default lifetime
lifetime: 25 # default lifetime
# From a Lion Hirth paper, also reflects average of Noothout et al 2016
discountrate: [0.071] #, 0.086, 0.111]
# [EUR/USD] ECB: https://www.ecb.europa.eu/stats/exchange/eurofxref/html/eurofxref-graph-usd.en.html # noqa: E501
Expand All @@ -112,7 +112,7 @@ costs: # Costs used in PyPSA-Earth-Sec. Year depends on the wildcard planning_ho
co2: 0.

lines:
length_factor: 1.25 #to estimate offwind connection costs
length_factor: 1.25 # to estimate offwind connection costs


industry:
Expand Down Expand Up @@ -155,20 +155,20 @@ sector:
coal:
shift_to_elec: true # If true, residential and services demand of coal is shifted to electricity. If false, the final energy demand of coal is disregarded

international_bunkers: false #Whether or not to count the emissions of international aviation and navigation
international_bunkers: false # Whether or not to count the emissions of international aviation and navigation

oil:
spatial_oil: true

district_heating:
potential: 0.3 #maximum fraction of urban demand which can be supplied by district heating
#increase of today's district heating demand to potential maximum district heating share
#progress = 0 means today's district heating share, progress=-1 means maximum fraction of urban demand is supplied by district heating
potential: 0.3 # maximum fraction of urban demand which can be supplied by district heating
# increase of today's district heating demand to potential maximum district heating share
# progress = 0 means today's district heating share, progress=-1 means maximum fraction of urban demand is supplied by district heating
progress: 1
#2020: 0.0
#2030: 0.3
#2040: 0.6
#2050: 1.0
# 2020: 0.0
# 2030: 0.3
# 2040: 0.6
# 2050: 1.0
district_heating_loss: 0.15
reduce_space_heat_exogenously: true # reduces space heat demand by a given factor (applied before losses in DH)
# this can represent e.g. building renovation, building demolition, or if
Expand All @@ -192,31 +192,31 @@ sector:
chp: true
micro_chp: false
solar_thermal: true
heat_pump_sink_T: 55 #Celsius, based on DTU / large area radiators; used un build_cop_profiles.py
time_dep_hp_cop: true #time dependent heat pump coefficient of performance
solar_cf_correction: 0.788457 # = >>>1/1.2683
bev_plug_to_wheel_efficiency: 0.2 #kWh/km from EPA https://www.fueleconomy.gov/feg/ for Tesla Model S
bev_charge_efficiency: 0.9 #BEV (dis-)charging efficiency
heat_pump_sink_T: 55 # Celsius, based on DTU / large area radiators; used un build_cop_profiles.py
time_dep_hp_cop: true # time dependent heat pump coefficient of performance
solar_cf_correction: 0.788457 # = >>>1/1.2683
bev_plug_to_wheel_efficiency: 0.2 # kWh/km from EPA https://www.fueleconomy.gov/feg/ for Tesla Model S
bev_charge_efficiency: 0.9 # BEV (dis-)charging efficiency
transport_heating_deadband_upper: 20.
transport_heating_deadband_lower: 15.
ICE_lower_degree_factor: 0.375 #in per cent increase in fuel consumption per degree above deadband
ICE_lower_degree_factor: 0.375 # in per cent increase in fuel consumption per degree above deadband
ICE_upper_degree_factor: 1.6
EV_lower_degree_factor: 0.98
EV_upper_degree_factor: 0.63
bev_avail_max: 0.95
bev_avail_mean: 0.8
bev_dsm_restriction_value: 0.75 #Set to 0 for no restriction on BEV DSM
bev_dsm_restriction_time: 7 #Time at which SOC of BEV has to be dsm_restriction_value
v2g: true #allows feed-in to grid from EV battery
bev_dsm: true #turns on EV battery
bev_energy: 0.05 #average battery size in MWh
bev_availability: 0.5 #How many cars do smart charging
bev_dsm_restriction_value: 0.75 # Set to 0 for no restriction on BEV DSM
bev_dsm_restriction_time: 7 # Time at which SOC of BEV has to be dsm_restriction_value
v2g: true # allows feed-in to grid from EV battery
bev_dsm: true # turns on EV battery
bev_energy: 0.05 # average battery size in MWh
bev_availability: 0.5 # How many cars do smart charging
transport_fuel_cell_efficiency: 0.5
transport_internal_combustion_efficiency: 0.3
industry_util_factor: 0.7

biomass_transport: true # biomass transport between nodes
biomass_transport_default_cost: 0.1 #EUR/km/MWh
biomass_transport_default_cost: 0.1 # EUR/km/MWh
solid_biomass_potential: 40 # TWh/a, Potential of whole modelled area
biogas_potential: 0.5 # TWh/a, Potential of whole modelled area

Expand Down Expand Up @@ -276,13 +276,13 @@ sector:
DF_2050: 0.011

co2_network: true
co2_sequestration_potential: 200 #MtCO2/a sequestration potential for Europe
co2_sequestration_cost: 10 #EUR/tCO2 for sequestration of CO2
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_average_efficiency: 0.4 # For conversion of fuel oil to propulsion in 2011

shipping_hydrogen_share: #1.0
shipping_hydrogen_share: # 1.0
BU_2030: 0.00
AP_2030: 0.00
NZ_2030: 0.10
Expand Down Expand Up @@ -310,7 +310,7 @@ sector:

conventional_generation: # generator : carrier
OCGT: gas
#Gen_Test: oil # Just for testing purposes
# Gen_Test: oil # Just for testing purposes

# snapshots are originally set in PyPSA-Earth/config.yaml but used again by PyPSA-Earth-Sec
snapshots:
Expand All @@ -326,7 +326,7 @@ build_osm_network: # TODO: To Remove this once we merge pypsa-earth and pypsa-e
force_ac: false # When true, it forces all components (lines and substation) to be AC-only. To be used if DC assets create problem.

solving:
#tmpdir: "path/to/tmp"
# tmpdir: "path/to/tmp"
options:
formulation: kirchhoff
clip_p_max_pu: 1.e-2
Expand All @@ -339,17 +339,65 @@ solving:

solver:
name: gurobi
threads: 25
method: 2 # barrier
crossover: 0
BarConvTol: 1.e-6
Seed: 123
AggFill: 0
PreDual: 0
GURO_PAR_BARDENSETHRESH: 200
#FeasibilityTol: 1.e-6

mem: 30000 #memory in MB; 20 GB enough for 50+B+I+H2; 100 GB for 181+B+I+H2
options: gurobi-default

solver_options:
highs-default:
# refer to https://ergo-code.github.io/HiGHS/dev/options/definitions/
threads: 4
solver: "ipm"
run_crossover: "off"
small_matrix_value: 1e-6
large_matrix_value: 1e9
primal_feasibility_tolerance: 1e-5
dual_feasibility_tolerance: 1e-5
ipm_optimality_tolerance: 1e-4
parallel: "on"
random_seed: 123
gurobi-default:
threads: 4
method: 2 # barrier
crossover: 0
BarConvTol: 1.e-6
Seed: 123
AggFill: 0
PreDual: 0
GURO_PAR_BARDENSETHRESH: 200
gurobi-numeric-focus:
NumericFocus: 3 # Favour numeric stability over speed
method: 2 # barrier
crossover: 0 # do not use crossover
BarHomogeneous: 1 # Use homogeneous barrier if standard does not converge
BarConvTol: 1.e-5
FeasibilityTol: 1.e-4
OptimalityTol: 1.e-4
ObjScale: -0.5
threads: 8
Seed: 123
gurobi-fallback: # Use gurobi defaults
crossover: 0
method: 2 # barrier
BarHomogeneous: 1 # Use homogeneous barrier if standard does not converge
BarConvTol: 1.e-5
FeasibilityTol: 1.e-5
OptimalityTol: 1.e-5
Seed: 123
threads: 8
cplex-default:
threads: 4
lpmethod: 4 # barrier
solutiontype: 2 # non basic solution, ie no crossover
barrier.convergetol: 1.e-5
feasopt.tolerance: 1.e-6
copt-default:
Threads: 8
LpMethod: 2
Crossover: 0
cbc-default: {} # Used in CI
glpk-default: {} # Used in CI

mem: 30000 # memory in MB; 20 GB enough for 50+B+I+H2; 100 GB for 181+B+I+H2
runtime: "12:00:00"

plotting:
map:
Expand Down
70 changes: 60 additions & 10 deletions config.pypsa-earth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -390,16 +390,66 @@ solving:
track_iterations: false
#nhours: 10
solver:
name: gurobi
threads: 4
method: 2 # barrier (=ipm)
crossover: 0
BarConvTol: 1.e-5
FeasibilityTol: 1.e-6
AggFill: 0
PreDual: 0
GURO_PAR_BARDENSETHRESH: 200

name: highs
options: highs-default

solver_options:
highs-default:
# refer to https://ergo-code.github.io/HiGHS/dev/options/definitions/
threads: 4
solver: "ipm"
run_crossover: "off"
small_matrix_value: 1e-6
large_matrix_value: 1e9
primal_feasibility_tolerance: 1e-5
dual_feasibility_tolerance: 1e-5
ipm_optimality_tolerance: 1e-4
parallel: "on"
random_seed: 123
gurobi-default:
threads: 4
method: 2 # barrier
crossover: 0
BarConvTol: 1.e-6
Seed: 123
AggFill: 0
PreDual: 0
GURO_PAR_BARDENSETHRESH: 200
gurobi-numeric-focus:
NumericFocus: 3 # Favour numeric stability over speed
method: 2 # barrier
crossover: 0 # do not use crossover
BarHomogeneous: 1 # Use homogeneous barrier if standard does not converge
BarConvTol: 1.e-5
FeasibilityTol: 1.e-4
OptimalityTol: 1.e-4
ObjScale: -0.5
threads: 8
Seed: 123
gurobi-fallback: # Use gurobi defaults
crossover: 0
method: 2 # barrier
BarHomogeneous: 1 # Use homogeneous barrier if standard does not converge
BarConvTol: 1.e-5
FeasibilityTol: 1.e-5
OptimalityTol: 1.e-5
Seed: 123
threads: 8
cplex-default:
threads: 4
lpmethod: 4 # barrier
solutiontype: 2 # non basic solution, ie no crossover
barrier.convergetol: 1.e-5
feasopt.tolerance: 1.e-6
copt-default:
Threads: 8
LpMethod: 2
Crossover: 0
cbc-default: {} # Used in CI
glpk-default: {} # Used in CI

mem: 30000 #memory in MB; 20 GB enough for 50+B+I+H2; 100 GB for 181+B+I+H2
walltime: "12:00:00"

plotting:
map:
Expand Down
Loading
Loading