Skip to content

Commit 79462d7

Browse files
committed
Update
1 parent 0abf81f commit 79462d7

4 files changed

Lines changed: 81 additions & 0 deletions

File tree

.DS_Store

6 KB
Binary file not shown.

inputs/.DS_Store

10 KB
Binary file not shown.

inputs/ENSPRESO_BIOMASS.xlsx

15 MB
Binary file not shown.

scripts/compile_cost_assumptions.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,85 @@ def get_data_DEA(tech, data_in, expectation=None):
762762

763763
return df_final
764764

765+
def add_biomass_costs(costs):
766+
def add_biomass_costs(costs):
767+
# Scenarios: ENS_Low, ENS_Med, ENS_High
768+
# Years: 2010, 2020, ... , 2050
769+
770+
database_file = "inputs/ENSPRESO_database.xlsx"
771+
scenario = "ENS_High"
772+
year = 2050
773+
774+
costs = pd.read_excel(
775+
database_file,
776+
sheet_name="COST - NUTS0 EnergyCom",
777+
header=0
778+
).fillna(0)
779+
780+
potentials = pd.read_excel(
781+
database_file,
782+
sheet_name="ENER - NUTS0 EnergyCom",
783+
header=0
784+
).fillna(0)
785+
786+
name_dict = {
787+
'MINBIOAGRW1': 'Agricultural waste',
788+
'MINBIOGAS1': 'Manure solid, liquid',
789+
'MINBIOFRSR1a': 'Residues from landscape care',
790+
'MINBIOCRP11': 'Bioethanol barley, wheat, grain maize, oats, other cereals and rye',
791+
'MINBIOCRP21': 'Sugar from sugar beet',
792+
'MINBIOCRP31': 'Miscanthus, switchgrass, RCG',
793+
'MINBIOCRP41': 'Willow',
794+
'MINBIOCRP41a': 'Poplar',
795+
'MINBIOLIQ1': 'Sunflower, soya seed',
796+
'MINBIORPS1': 'Rape seed',
797+
'MINBIOFRSR1': 'Fuelwood residues',
798+
'MINBIOWOO': 'FuelwoodRW',
799+
'MINBIOWOOa': 'C&P_RW',
800+
'MINBIOWOOW1': 'Secondary Forestry residues - woodchips',
801+
'MINBIOWOOW1a': 'Sawdust',
802+
'MINBIOMUN1': 'Municipal waste',
803+
'MINBIOSLU1': 'Sludge'
804+
}
805+
806+
# Filter the costs and potentials DataFrames based on the year and scenario
807+
filtered_costs = costs[(costs['Year'] == year) & (costs['Scenario'] == scenario)]
808+
filtered_potentials = potentials[(potentials['Year'] == year) & (potentials['Scenario'] == scenario)]
809+
# Rename the third column (energy commodity) based on the name_dict
810+
filtered_costs = filtered_costs.replace({"Energy Commodity": name_dict})
811+
filtered_potentials = filtered_potentials.replace({"Energy Commodity": name_dict})
812+
# Convert costs from per GJ to per MWh
813+
filtered_costs['NUTS0 Energy Commodity Cost '] = filtered_costs['NUTS0 Energy Commodity Cost '] * 3.6
814+
815+
816+
# Select the desired columns (4, 3, 5)
817+
selected_costs = filtered_costs[['NUTS0', 'Energy Commodity', 'NUTS0 Energy Commodity Cost ']] # Replace 'Cost1', 'Cost2', 'Cost3' with actual column names
818+
selected_potentials = filtered_potentials[['NUTS0', 'Energy Commodity', 'Value']] # Replace with actual column names
819+
820+
# Merge the costs and potentials DataFrames on 'NUTS0' and 'Energy Commodity'
821+
merged_df = pd.merge(selected_costs, selected_potentials, on=['NUTS0', 'Energy Commodity'])
822+
823+
# Calculate the weighted average costs for each biomass type
824+
weighted_avg_costs = merged_df.groupby('Energy Commodity').agg(
825+
Weighted_Average_Cost=('NUTS0 Energy Commodity Cost ', lambda x: np.average(x, weights=merged_df.loc[x.index, 'Value']))
826+
).reset_index() # in Euro2010/MWh
827+
828+
# Define the new technology data
829+
parameter = 'fuel'
830+
unit = 'Euro2010/MWh_th'
831+
source = 'Weighted average costs from JLC ENSPRESO, scenario ENS_High, year 2050'
832+
description = 'Weighted by country potentials'
833+
currency_year = 2010
834+
835+
for row in weighted_avg_costs.iterrows():
836+
costs.loc[(row['Energy Commodity'], parameter), 'value'] = row['Weighted_Average_Cost']
837+
costs.loc[(row['Energy Commodity'], parameter), 'unit'] = unit
838+
costs.loc[(row['Energy Commodity'], parameter), 'source'] = source
839+
costs.loc[(row['Energy Commodity'], parameter), 'further description'] = description
840+
costs.loc[(row['Energy Commodity'], parameter), 'currency_year'] = currency_year
841+
return costs
842+
843+
765844
def add_desalinsation_data(costs):
766845
"""
767846
add technology data for sea water desalination (SWRO) and water storage.
@@ -2699,6 +2778,8 @@ def prepare_inflation_rate(fn):
26992778
costs.loc[('digestible biomass', 'fuel'), 'unit'] = 'EUR/MWh_th'
27002779
costs.loc[('digestible biomass', 'fuel'), 'source'] = "JRC ENSPRESO ca avg for MINBIOAGRW1, ENS_Ref for 2040"
27012780
costs.loc[('digestible biomass', 'fuel'), 'currency_year'] = 2010
2781+
2782+
costs = add_biomass_costs(costs)
27022783

27032784
# add solar data from other source than DEA
27042785
if any([snakemake.config['solar_utility_from_vartiaien'], snakemake.config['solar_rooftop_from_etip']]):

0 commit comments

Comments
 (0)