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

RES generation and capacity target updates #231

Merged
merged 24 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e6d7a33
Added TotalAnnualMaxCapacity to powerplant
maartenbrinkerink Nov 8, 2024
6605036
Moved build rate constraints to powerplant
maartenbrinkerink Nov 8, 2024
114953e
Moved fuel limits to powerplant
maartenbrinkerink Nov 8, 2024
b8edc0b
RES target integration in powerplant
maartenbrinkerink Nov 9, 2024
70666c6
Enabled tech specific targets for RES generation shares
maartenbrinkerink Nov 9, 2024
0ddb988
Merge branch 'master' into target-updates
maartenbrinkerink Nov 11, 2024
35fdc1a
Nodal level generation targets and capacity targets
maartenbrinkerink Nov 11, 2024
cc13b30
Moved emissions to individual folder
maartenbrinkerink Nov 12, 2024
95f498c
Added linear interpolation for emission targets and removed old emiss…
maartenbrinkerink Nov 14, 2024
5ddf3b3
Removed RES targets from max_capacity
maartenbrinkerink Nov 14, 2024
02b5c8d
Bug fix empty target list
maartenbrinkerink Nov 15, 2024
f339cc4
Merge branch 'master' into target-updates
maartenbrinkerink Nov 15, 2024
23c2338
Integrated calibration in power plant
maartenbrinkerink Nov 15, 2024
7e3960e
Bug fix empty calibration parameter
maartenbrinkerink Nov 15, 2024
c94c54b
YEAR filter fix build rates
maartenbrinkerink Nov 18, 2024
2c0f614
snakefile fix missing storage files
maartenbrinkerink Nov 18, 2024
419450f
Duplicate storage set definition fix for custom nodes
maartenbrinkerink Nov 18, 2024
9af55fd
Merge branch 'master' into target-updates
maartenbrinkerink Nov 19, 2024
1afb321
Remove set_annual_activity_upper_limit from powerplant/activity.py
maartenbrinkerink Nov 19, 2024
080eb08
Added global res targets
maartenbrinkerink Nov 20, 2024
95fa5cf
Remove storage dependency emission rule
maartenbrinkerink Nov 20, 2024
526b665
Moved CCS losses to constants
maartenbrinkerink Nov 20, 2024
13baea3
Removed TotalTechnologyModelPeriodActivityUpperLimit from powerplant
maartenbrinkerink Nov 20, 2024
8694bf6
Small final fixes
maartenbrinkerink Nov 20, 2024
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
62 changes: 31 additions & 31 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ timeshift: 0 # value between -11 and 12

# Spatial Parameters
geographic_scope:
- "BTN"
- "IND"

crossborderTrade: True
Expand Down Expand Up @@ -133,19 +134,6 @@ nodes_to_remove:
#- "AAAXX" where AAA is a 3-letter country code, and XX is a 2-letter
# sub-national code

powerplant_build_rates:
# [TECHNOLOGY, COUNTRY, METHOD, VALUE, START_YEAR, END_YEAR]
# where TECHNOLOGY_TYPE is, for example, all coal powerplants and is in the
# format COA.
# COUNTRY is the 3-letter country code. E.g. "IND" for "Indonesia"
# METHOD specifies how the build rate is applied: absolute ("ABS" or as a
# percentage ("PCT") of the maximum capacity for a TECHNOLOGY_TYPE.
# VALUE is the value - either absolute or percentage - by which the capacity
# of the associated TECHNOLOGY can increase. It is applied from the START_YEAR
# to the END_YEAR.
# E.g. - ["SPV", "IND", "ABS", 0, 2020, 2025]
- ["SPV", "IND", "PCT", 25, 2020, 2025]

reserve_margin:
# RESERVE_MARGIN: [PERCENTAGE, START_YEAR, END_YEAR]
# Years for which there is no PERCENTAGE value will be interpolated
Expand Down Expand Up @@ -178,27 +166,39 @@ reserve_margin_technologies:
LDS : 77

emission_limit:
# - [EMISSION, COUNTRY, YEAR, VALUE]
# - [EMISSION, COUNTRY, TYPE, YEAR, VALUE]
# where VALUE is emissions in million tonnes of CO2-equivalent and YEAR is
# when that constraint must be adhered to. All years between multiple emission
# constraints will be interpolated.
- ["CO2", "IND", 2040, 1]

fuel_limits:
# FUEL: [VALUE, COUNTRY/INTERNATIONAL, YEAR]
# Where FUEL is the fuel on which a limit is being applied (e.g. COA), VALUE is
# the value in Petajoules (PJ), COUNTRY/INTERNATIONAL specific which domestic
# fuel (e.g. IND) or international fuel ("INT") the limit is being applied to,
# and YEAR is the year for which the limit is applied. All years between multiple
# fuel extraction constraints will be interpolated.

# constraints will be interpolated if TYPE is set to "LINEAR". If "POINT" is used
# it means that a singular year value is set without interpolation occuring in
# previous target years. A combination of TYPE targets can be set per EMISSION and
# COUNTRY yet only a single target per YEAR.
- ["CO2", "IND", "POINT", 2048, 0]
- ["CO2", "IND", "LINEAR", 2040, 1]
- ["CO2", "IND", "LINEAR", 2028, 400]
- ["CO2", "IND", "POINT", 2030, 300]

calibration:
# OCG1: [50, "IND", 2021]
# TECHNOLOGY: [VALUE, COUNTRY, YEAR]
# where VALUE is percentage (%) availability of a given technology. This can be used
# to constrain power plant output (generation).
OCG1: [50, "IND", 2021]

re_targets:
# E.g. - ["IND", 2030, 2040, 30]
# where "IND" is the country code; 2030, 2040 are the start and end years
# respectively; and 30 is the target between the start and end years (inclusive)
# in %
- ["IND", 2030, 2040, 30]
# TARGET: [COUNTRY/NODE, [TECHNOLOGY], START_YEAR, END_YEAR, VALUE]
# E.g. TO1: ["IND", [], "PCT", 2030, 2040, 60]
# E.g. TO2: ["INDSO", ['WOF', 'WON'], "PCT", 2025, 2045, 15]
# E.g. TO3: ["INDSO", ['WOF'], "ABS", 2040, 2050, 200]
# Targets can be set in absolute terms ("ABS", VALUE = GW) or in relative terms
# ("PCT", VALUE = %) where targets in relative terms represent the share of generation.
# For "PCT", targets can be set at national (e.g. "IND") and nodal levels (e.g. "INDSO")
# whereas "ABS" can only be set at nodal levels. For "PCT", a single technology can
# be set for the target (e.g. ["WOF"]) a technology subset can be set (e.g. ['WOF', 'WON'])
# or the TECHNOLOGY list can be left empty (e.g. []) as such that all renewable
# technologies contribute to the target. For "ABS", only one technology can be
# selected per target. Note that a combination of targets can be set that affect
# the same countries/nodes/technologies. This can be computationally intensive.
T01: ["", [], "PCT", 2048, 2050, 95]
T02: ["IND", [], "PCT", 2030, 2040, 60]
T03: ["INDSO", ['WOF','WON'], "PCT", 2025, 2045, 15]
T04: ["INDSO", ['WOF'], "ABS", 2040, 2050, 200]
2 changes: 0 additions & 2 deletions resources/data/transmission_build_rates.csv
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ TRNINDEAINDWE,0,2021,2024
TRNINDEANPLXX,0,2021,2024
TRNINDNEINDNO,0,2021,2024
TRNINDNEMMRXX,0,2021,2024
TRNINDNOINDSO,0,2021,2024
TRNINDNOINDWE,0,2021,2024
TRNINDNONPLXX,0,2021,2024
TRNINDNOPAKXX,0,2021,2024
Expand Down Expand Up @@ -1043,7 +1042,6 @@ TRNINDEAINDWE,3,2025,2050
TRNINDEANPLXX,3,2025,2050
TRNINDNEINDNO,3,2025,2050
TRNINDNEMMRXX,3,2025,2050
TRNINDNOINDSO,3,2025,2050
TRNINDNOINDWE,3,2025,2050
TRNINDNONPLXX,3,2025,2050
TRNINDNOPAKXX,3,2025,2050
Expand Down
3 changes: 2 additions & 1 deletion workflow/rules/model.smk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ rule geographic_filter:
input:
csv_files = expand('results/data/{csv}.csv', csv = OTOOLE_PARAMS),
params:
geographic_scope = config['geographic_scope']
geographic_scope = config['geographic_scope'],
res_targets = config['re_targets']
output:
csv_files = expand('results/{{scenario}}/data/{csv}.csv', csv = OTOOLE_PARAMS),
# conda:
Expand Down
126 changes: 62 additions & 64 deletions workflow/rules/preprocess.smk
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ power_plant_files = [
'powerplant/ResidualCapacity',
'powerplant/TECHNOLOGY',
'YEAR',
'AvailabilityFactor'
'AvailabilityFactor',
'TotalAnnualMaxCapacity',
'AccumulatedAnnualDemand',
'TotalAnnualMinCapacity'
]

transmission_files = [
Expand Down Expand Up @@ -100,11 +103,6 @@ emission_files = [
'AnnualEmissionLimit'
]

max_capacity_files = [
'TotalAnnualMaxCapacity',
'AccumulatedAnnualDemand',
]

user_capacity_files = [
'TotalAnnualMinCapacityInvestment',
'TotalAnnualMaxCapacityInvestment'
Expand All @@ -116,7 +114,8 @@ fuel_limit_files = [

GENERATED_CSVS = (
power_plant_files + transmission_files + storage_files + timeslice_files \
+ reserves_files + demand_files + emission_files + max_capacity_files + fuel_limit_files
+ reserves_files + demand_files + emission_files + fuel_limit_files

)
GENERATED_CSVS = [Path(x).stem for x in GENERATED_CSVS]
EMPTY_CSVS = [x for x in OTOOLE_PARAMS if x not in GENERATED_CSVS]
Expand All @@ -127,37 +126,78 @@ rule make_data_dir:
output: directory('results/data')
shell: 'mkdir -p {output}'

def demand_custom_csv() -> str:
if config["nodes_to_add"]:
return "resources/data/custom_nodes/specified_annual_demand.csv"
else:
return []

rule demand_projections:
message:
"Generating demand data..."
input:
plexos = "resources/data/PLEXOS_World_2015_Gold_V1.1.xlsx",
plexos_demand = "resources/data/All_Demand_UTC_2015.csv",
iamc_gdp ="resources/data/iamc_db_GDPppp_Countries.xlsx",
iamc_pop = "resources/data/iamc_db_POP_Countries.xlsx",
iamc_urb = "resources/data/iamc_db_URB_Countries.xlsx",
iamc_missing = "resources/data/iamc_db_POP_GDPppp_URB_Countries_Missing.xlsx",
td_losses = "resources/data/T&D Losses.xlsx",
ember = "resources/data/ember_yearly_electricity_data.csv",
custom_nodes = demand_custom_csv()
params:
start_year = config['startYear'],
end_year = config['endYear'],
custom_nodes = config["nodes_to_add"]
output:
csv_files = 'results/data/SpecifiedAnnualDemand.csv',
log:
log = 'results/logs/demand_projections.log'
script:
"../scripts/osemosys_global/demand/main.py"

def powerplant_cap_custom_csv() -> str:
if config["nodes_to_add"]:
return "resources/data/custom_nodes/residual_capacity.csv"
else:
return []
return []

def powerplant_res_potentials_custom_csv() -> str:
if config["nodes_to_add"]:
return "resources/data/custom_nodes/RE_potentials.csv"
else:
return []

rule powerplant:
message:
"Generating powerplant data..."
input:
rules.demand_projections.output.csv_files,
plexos = 'resources/data/PLEXOS_World_2015_Gold_V1.1.xlsx',
res_limit = 'resources/data/PLEXOS_World_MESSAGEix_GLOBIOM_Softlink.xlsx',
fuel_limit = 'resources/data/fuel_limits.csv',
build_rates = 'resources/data/powerplant_build_rates.csv',
weo_costs = 'resources/data/weo_2020_powerplant_costs.csv',
weo_regions = 'resources/data/weo_region_mapping.csv',
default_op_life = 'resources/data/operational_life.csv',
naming_convention_tech = 'resources/data/naming_convention_tech.csv',
default_av_factors = 'resources/data/availability_factors.csv',
custom_res_cap = powerplant_cap_custom_csv(),
cmo_forecasts = 'resources/data/CMO-October-2024-Forecasts.xlsx',
fuel_prices = 'resources/data/fuel_prices.csv',
custom_res_potentials = powerplant_res_potentials_custom_csv(),
params:
start_year = config['startYear'],
end_year = config['endYear'],
region_name = 'GLOBAL',
geographic_scope = config['geographic_scope'],
custom_nodes = config['nodes_to_add'],
remove_nodes = config['nodes_to_remove'],
user_defined_capacity = config['user_defined_capacity'],
no_investment_techs = config['no_invest_technologies'],
res_targets = config['re_targets'],
calibration = config['calibration'],
output_data_dir = 'results/data',
input_data_dir = 'resources/data',
powerplant_data_dir = 'results/data/powerplant',

output:
csv_files = expand('results/data/{output_file}.csv', output_file = power_plant_files)
log:
Expand Down Expand Up @@ -298,36 +338,6 @@ rule reserves:
script:
"../scripts/osemosys_global/reserves/main.py"

def demand_custom_csv() -> str:
if config["nodes_to_add"]:
return "resources/data/custom_nodes/specified_annual_demand.csv"
else:
return []

rule demand_projections:
message:
"Generating demand data..."
input:
plexos = "resources/data/PLEXOS_World_2015_Gold_V1.1.xlsx",
plexos_demand = "resources/data/All_Demand_UTC_2015.csv",
iamc_gdp ="resources/data/iamc_db_GDPppp_Countries.xlsx",
iamc_pop = "resources/data/iamc_db_POP_Countries.xlsx",
iamc_urb = "resources/data/iamc_db_URB_Countries.xlsx",
iamc_missing = "resources/data/iamc_db_POP_GDPppp_URB_Countries_Missing.xlsx",
td_losses = "resources/data/T&D Losses.xlsx",
ember = "resources/data/ember_yearly_electricity_data.csv",
custom_nodes = demand_custom_csv()
params:
start_year = config['startYear'],
end_year = config['endYear'],
custom_nodes = config["nodes_to_add"]
output:
csv_files = 'results/data/SpecifiedAnnualDemand.csv',
log:
log = 'results/logs/demand_projections.log'
script:
"../scripts/osemosys_global/demand/main.py"

rule demand_projection_figures:
message:
"Generating demand figures..."
Expand All @@ -350,36 +360,24 @@ rule emissions:
message:
'Generating emission data...'
input:
'resources/data/emission_factors.csv',
'results/data/InputActivityRatio.csv',
ember = 'resources/data/ember_yearly_electricity_data.csv',
emissions_factors = 'resources/data/emission_factors.csv',
iar = 'results/data/InputActivityRatio.csv',
oar = 'results/data/OutputActivityRatio.csv',
params:
start_year = config['startYear'],
end_year = config['endYear'],
emission = config['emission_penalty'],
storage_parameters = config['storage_parameters']
region_name = 'GLOBAL',
output_data_dir = 'results/data',
input_data_dir = 'resources/data',
emission_penalty = config['emission_penalty'],
emission_limit = config['emission_limit'],
output:
csv_files = expand('results/data/{output_file}.csv', output_file = emission_files),
log:
log = 'results/logs/emissions.log'
shell:
'python workflow/scripts/osemosys_global/emissions.py 2> {log}'

rule max_capacity:
message:
'Generating capacity limits...'
input:
'resources/data/PLEXOS_World_MESSAGEix_GLOBIOM_Softlink.xlsx',
'results/data/ResidualCapacity.csv',
'results/data/SpecifiedAnnualDemand.csv'
params:
start_year = config['startYear'],
end_year = config['endYear'],
output:
csv_files = expand('results/data/{output_file}.csv', output_file = max_capacity_files),
log:
log = 'results/logs/max_capacity.log'
shell:
'python workflow/scripts/osemosys_global/max_capacity.py 2> {log}'
script:
"../scripts/osemosys_global/emissions/main.py"

rule create_missing_csv:
message:
Expand Down
Loading
Loading