Skip to content

Commit

Permalink
towards 100 percent renewable scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Franken committed Aug 15, 2023
1 parent eea64fd commit 09081dd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
4 changes: 2 additions & 2 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ scenario:
- 'LW' # Leading the Way
# - 'ST' # System Transformation
year: # investment years for myopic and perfect; for overnight, year of cost assumptions can be different and is defined under 'costs'
- 2023
- 2040
# - 2025
# - 2030
# - 2035
Expand All @@ -49,7 +49,7 @@ scenario:
dt_event:
- '1' # selects file for turndown timing and magnitude in data/turndown_events/
opts: # only relevant for PyPSA-Eur
- ''
- 'ATK'
sector_opts: # this is where the main scenario settings are
- Co2L0-3H-T-H-B-I-A-solar+p3-dist1
timeseries_mode:
Expand Down
38 changes: 21 additions & 17 deletions scripts/prepare_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def convert_generators_to_links(n, costs):

if carrier == "biomass": continue

print(f"Adding bus GB_{carrier}_bus, and generator GB_{carrier}")
logger.info(f"Adding bus GB_{carrier}_bus, and generator GB_{carrier}")

n.add("Bus",
f"GB_{carrier}_bus",
Expand Down Expand Up @@ -737,6 +737,7 @@ def add_bev(n, transport_config):
* electric_share
)

# logger.warning("BEV charge efficiency set to 1.")
logger.info("Assuming BEV charge efficiency of 0.9")
n.madd(
"Link",
Expand All @@ -748,6 +749,7 @@ def add_bev(n, transport_config):
carrier="BEV charger",
p_max_pu=avail_profile[gb_nodes],
efficiency=0.9,
# efficiency=1.,
# These were set non-zero to find LU infeasibility when availability = 0.25
# p_nom_extendable=True,
# p_nom_min=p_nom,
Expand All @@ -759,9 +761,7 @@ def add_bev(n, transport_config):
snakemake.wildcards.fes,
year)

logger.warning("V2G currently switched off!")
# if v2g_share > 0. and bev_flexibility:
if False:
if v2g_share > 0. and bev_flexibility:
logger.info("Assuming V2G efficiency of 0.9")
v2g_efficiency = 0.9
n.madd(
Expand Down Expand Up @@ -797,7 +797,7 @@ def add_bev(n, transport_config):
e_nom=e_nom,
e_max_pu=1,
e_min_pu=dsm_profile[gb_nodes],
standing_loss=0.01, # prevent abuse of storage
# standing_loss=0.01, # prevent abuse of storage
)


Expand Down Expand Up @@ -1039,7 +1039,7 @@ def add_flexibility(n, mode):
n.links_t.p_max_pu.loc[mask, reg] = 0.


def add_batteries(n):
def add_batteries(n, opts=[], costs=None):
"""Adds battery storage (exluding V2G)
Batteries are added as Storage Units
Expand All @@ -1049,6 +1049,19 @@ def add_batteries(n):
"""

if "100percent" in opts:
assert costs is not None, "In 100 percent renewables, cost kwargs must be passed"

costs_dict = {}

else:
costs_dict = {}

import sys
sys.exit()

wy = snakemake.wildcards.year

gb_buses = pd.Index(n.generators.loc[n.generators.bus.str.contains("GB")].bus.unique())
gb_buses = n.buses.loc[gb_buses].loc[n.buses.loc[gb_buses].carrier == "AC"].index

Expand Down Expand Up @@ -1301,23 +1314,14 @@ def scale_load(n, fes, year):
)

logger.info("Adding battery storage.")
add_batteries(n)
other_costs.to_csv("costs.csv")
add_batteries(n, opts=opts, costs=other_costs)

logger.info("Adding transmission limit.")
set_line_s_max_pu(n, snakemake.config["lines"]["s_max_pu"])

flexopts = snakemake.wildcards.flexopts.split("-")


logger.warning("Flexopts wildcard constraints commented out currently.")
# print(flexopts)
# if not (len(flexopts) == 1 and "" in flexopts):
# assert sum(list(map(lambda x: x in {"ss", "reg", "bev", "heat"}, flexopts))) == len(flexopts), (
# "flexopts must be a combination of 'ss', 'reg', 'bev', 'heat', currently is {}".format(
# snakemake.wildcards.flexopts
# )
#)

logger.info(f"Using Flexibility Options: {flexopts}")

if "reg" in flexopts:
Expand Down

0 comments on commit 09081dd

Please sign in to comment.