Skip to content

Commit 823546d

Browse files
committed
update README
1 parent ab1869e commit 823546d

File tree

10 files changed

+230
-51
lines changed

10 files changed

+230
-51
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The EOLES-ResIRF Coupling model is a tool for studying integrated decarbonizatio
66

77
## Installation
88

9+
The current version of the code should be run on Unix.
10+
911
### Step 1: Git clone the folder in your computer.
1012

1113
```bash
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{ "trash": {
2+
"profile": ["reference", "ProfileFlat"],
3+
"capacity_nuc": ["reference", "Nuc-"],
4+
"capacity_pv": ["reference", "PV-"],
5+
"capacity_offshore": ["reference", "Offshore-"],
6+
"woodprices": ["reference", "PriceWood+"],
7+
"weather": ["reference", "cold"],
8+
"policy_mix": ["reference", "NoPolicy"],
9+
"cop": ["reference", "COP+"],
10+
"biogas": ["reference", "Biogas-", "Biogas+"],
11+
"capacity_ren": ["reference", "Ren-", "Ren+"],
12+
"demand": ["reference", "Sufficiency", "Reindustrialisation"],
13+
"carbon_budget": ["reference", "CarbonBudget-"]
14+
},
15+
"supply" : {
16+
"discount_rate": ["reference", "DiscountRate-", "DiscountRate--", "DiscountRate+", "DiscountRate++"]
17+
},
18+
"demand" : {
19+
20+
},
21+
"prices": {
22+
23+
}
24+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"supply" : {
3+
"weather": ["reference", "2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016"]
4+
},
5+
"demand" : {},
6+
"prices": {}
7+
}

eoles/inputs/resources.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@
200200
'Solar PV': color_palette[8],
201201
'peaking plants': color_palette[5],
202202
'Peaking Plants': color_palette[5],
203+
'Peaking \nPlants': color_palette[5],
203204
'nuclear': color_palette[7],
204205
'Nuclear': color_palette[7],
205206
'natural gas': color_palette[10],

eoles/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,6 +1556,9 @@ def create_configs_coupling(list_design, config_coupling: dict, config_additiona
15561556

15571557
config_coupling_update['resirf'] = {} # we create a dictionary for the ResIRF configuration specs
15581558

1559+
if 'discount_rate' in config_additional.keys():
1560+
config_coupling_update['discount_rate'] = config_additional['discount_rate']
1561+
15591562
if 'prices' in config_additional.keys():
15601563
config_coupling_update['resirf']['prices'] = config_additional['prices']['resirf']
15611564
config_coupling_update['resirf']['energy'] = config_additional['energy'] # information necessary to update prices afterwards in modif_config_resirf

eoles/write_output.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
'pv': 'Solar PV',
7777
'battery': 'Battery',
7878
'hydro': 'Hydroelectricity',
79-
'peaking plants': 'Peaking Plants',
79+
'peaking plants': 'Peaking \nPlants',
8080
'Generation offshore (TWh)': 'Offshore',
8181
'Generation onshore (TWh)': 'Onshore',
8282
'Generation pv (TWh)': 'Solar PV',
@@ -2671,7 +2671,7 @@ def format_ax(ax: plt.Axes, title=None, y_label=None, x_label=None, x_ticks=None
26712671

26722672
def format_ax_new(ax, y_label=None, title=None, format_x=None,
26732673
format_y=lambda y, _: y, ymin=None, ymax=None, xinteger=True, xmin=None, x_max=None, loc_title=None,
2674-
c_title=None):
2674+
c_title=None, y_fontsize=20, x_fontsize=20):
26752675
"""
26762676
26772677
Parameters
@@ -2700,7 +2700,7 @@ def format_ax_new(ax, y_label=None, title=None, format_x=None,
27002700
ax.xaxis.set_major_formatter(plt.FuncFormatter(format_x))
27012701

27022702
if y_label is not None:
2703-
ax.set_ylabel(y_label)
2703+
ax.set_ylabel(y_label, fontsize=y_fontsize)
27042704

27052705
if title is not None:
27062706
if loc_title is not None:
@@ -3216,7 +3216,7 @@ def plot_blackbox_optimization(dict_optimizer, save_path, two_stage_optim=False)
32163216

32173217
def waterfall_chart(df, colors=None, rotation=0, save=None, format_y=lambda y, _: '{:.0f}'.format(y), title=None,
32183218
y_label=None, hline=False, dict_legend=None, total=True, unit='B€', float_precision=0, neg_offset=None,
3219-
pos_offset=None, df_max=None, df_min=None):
3219+
pos_offset=None, df_max=None, df_min=None, x_fontsize=24, y_fontsize=24, annotate_fontsize=20):
32203220
if isinstance(df, pd.DataFrame):
32213221
df = df.squeeze()
32223222
if dict_legend is not None:
@@ -3289,9 +3289,9 @@ def waterfall_chart(df, colors=None, rotation=0, save=None, format_y=lambda y, _
32893289
y -= neg_offset
32903290
# if loop > 0:
32913291
if float_precision == 0:
3292-
ax.annotate("{:+,.0f} {}".format(val, unit), (loop, y), ha="center")
3292+
ax.annotate("{:+,.0f} {}".format(val, unit), (loop, y), ha="center", fontsize=annotate_fontsize)
32933293
else:
3294-
ax.annotate("{:+,.1f} {}".format(val, unit), (loop, y), ha="center")
3294+
ax.annotate("{:+,.1f} {}".format(val, unit), (loop, y), ha="center", fontsize=annotate_fontsize)
32953295
loop += 1
32963296

32973297
if blank.max() > 0: # total est True quand on fait les graphes pour les coûts, et False quand on fait les graphes pour les capacités
@@ -3315,7 +3315,7 @@ def waterfall_chart(df, colors=None, rotation=0, save=None, format_y=lambda y, _
33153315
ax.set_ylim(ymax=y_max)
33163316
ax.set_ylim(ymin=y_min)
33173317
ax.set_xlabel('')
3318-
ax = format_ax_new(ax, format_y=format_y, xinteger=True)
3318+
ax = format_ax_new(ax, format_y=format_y, xinteger=True, x_fontsize=x_fontsize)
33193319

33203320
if title is not None:
33213321
if total:
@@ -3336,8 +3336,8 @@ def waterfall_chart(df, colors=None, rotation=0, save=None, format_y=lambda y, _
33363336
# fig.legend(handles, labels, loc='center left', frameon=False, ncol=1,
33373337
# bbox_to_anchor=(1, 0.5))
33383338

3339-
plt.setp(ax.xaxis.get_majorticklabels(), rotation=rotation)
3340-
ax.tick_params(axis='both', which='major', labelsize=18)
3339+
plt.setp(ax.xaxis.get_majorticklabels(), rotation=rotation, fontsize=x_fontsize)
3340+
ax.tick_params(axis='both', which='major', labelsize=x_fontsize)
33413341

33423342
save_fig(fig, save=save)
33433343

postprocessing/process_outputs.py

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
MAPPING = {'Learning+': 'High', 'Learning-': 'Low',
3434
'Elasticity+': 'High', 'Elasticity-': 'Low',
3535
'Biogas+': 'High', 'Biogas-': 'Low',
36-
'Capacity_ren+': 'High', 'Ren-': 'Low',
37-
'Demand+': 'High', 'Sufficiency': 'Low',
36+
'Capacity_ren+': 'High', 'Ren-': 'Low', 'Ren+': 'High',
37+
'Demand+': 'High', 'Sufficiency': 'Low', 'Reindustrialisation': 'High',
3838
'PriceGas+': 'High', 'PriceGas-': 'Low',
3939
'PriceWood+': 'High', 'PriceWood-': 'Low',
4040
'Policy_mix+': 'High', 'Policy_mix-': 'Low',
@@ -49,7 +49,7 @@
4949
'learning': 'Technical progress heat-pumps',
5050
'elasticity': 'Heat-pump price elasticity',
5151
'biogas': 'Biogas potential',
52-
'capacity_ren': 'Renewable capacity',
52+
'capacity_ren': 'Renewable potential',
5353
'demand': 'Other electricity demand',
5454
'gasprices': 'Gas prices',
5555
'woodprices': 'Wood prices',
@@ -66,6 +66,7 @@
6666
'demand', 'carbon_budget', 'gasprices']
6767

6868

69+
6970
def parse_outputs(folderpath, features, emissions=False):
7071
"""Parses the outputs of the simulations and creates a csv file with the results.
7172
Return scenarios_complete, and output which has been processed to only include information on the difference between the Ban and the reference scenario."""
@@ -141,8 +142,8 @@ def make_table_summary(data, folderpath):
141142
'Consumption Wood fuel (TWh)': 'Consumption Wood',
142143
'offshore': 'Offshore capacity',
143144
'onshore': 'Onshore capacity',
144-
'pv': 'Solar PV',
145-
'battery': 'Battery',
145+
'pv': 'Solar PV capacity',
146+
'battery': 'Battery capacity',
146147
'peaking plants': 'Peaking plants capacity',
147148
'methanization': 'Methanization capacity',
148149
'pyrogazification': 'Pyrogazification capacity',
@@ -168,6 +169,49 @@ def make_table_summary(data, folderpath):
168169
return df
169170

170171

172+
def make_table_summary_resirf(data1, data2, folderpath):
173+
scenarios = {('S0', 'reference'): 'Counterfactual', ('S0', 'Ban'): 'Ban'}
174+
selected_keys = [
175+
'Stock (Million)',
176+
'Surface (Million m2)',
177+
'Consumption (TWh)',
178+
'Consumption (kWh/m2)',
179+
'Consumption PE (TWh)',
180+
'Consumption Electricity (TWh)',
181+
'Consumption Natural gas (TWh)',
182+
'Consumption Oil fuel (TWh)',
183+
'Consumption Wood fuel (TWh)',
184+
'Consumption Heating (TWh)',
185+
'Energy poverty (Million)',
186+
'Emission (MtCO2)',
187+
'Stock G (Million)',
188+
'Stock F (Million)',
189+
'Stock E (Million)',
190+
'Stock D (Million)',
191+
'Stock C (Million)',
192+
'Stock B (Million)',
193+
'Stock A (Million)',
194+
'Stock Heat pump (Million)',
195+
'Stock Direct electric (Million)',
196+
'Stock Natural gas (Million)',
197+
'Stock Oil fuel (Million)',
198+
'Stock Wood fuel (Million)',
199+
'Stock District heating (Million)',
200+
'Energy poverty (Million)'
201+
]
202+
df1 = data1.loc[selected_keys, '2049'].rename({'2049': 2050})
203+
df1 = df1.astype('int')
204+
205+
df2 = data2.loc[selected_keys, '2049'].rename({'2049': 2050})
206+
df2 = df2.astype('int')
207+
208+
df = pd.concat([df1, df2], axis=1)
209+
df.to_csv(folderpath / Path('summary_table_resirf.csv'))
210+
211+
return df
212+
213+
214+
171215
def get_distributional_data(df):
172216
"""Extracts detailed distributional data, using the knowledge that those distributional data are tuples."""
173217

@@ -512,7 +556,7 @@ def frequency_chart_subplot(results1, results2, category_names=None, save_path=N
512556

513557
plt.tight_layout()
514558

515-
def horizontal_stack_bar_plot(df, columns=None, title=None, order=None, save_path=None):
559+
def horizontal_stack_bar_plot(df, columns=None, title=None, order=None, save_path=None, fontsize=20):
516560
"""
517561
Create a horizontal stacked bar plot from a DataFrame.
518562
@@ -561,7 +605,7 @@ def horizontal_stack_bar_plot(df, columns=None, title=None, order=None, save_pat
561605
ax.spines['left'].set_visible(False)
562606

563607
# size of x-axis and y-axis ticks
564-
ax.tick_params(axis='both', which='major', labelsize=18)
608+
ax.tick_params(axis='both', which='major', labelsize=fontsize)
565609
# size of title
566610

567611
# Remove the x-axis and y-axis titles
@@ -684,6 +728,7 @@ def distributional_plot(df, folder_name=None):
684728
# scenarios_complete, output, hourly_generation = parse_outputs(folderpath, features=features)
685729

686730
# LOCAL
687-
folderpath = Path('assessing_ban/simulations/exhaustive_20240506_195738') # for cluster use
731+
folderpath = Path('assessing_ban/simulations/exhaustive_20240826_120338') # for cluster use
688732
features = ['policy_heater', 'policy_insulation', 'learning', 'elasticity', 'biogas', 'capacity_ren', 'demand', 'carbon_budget', 'gasprices']
733+
features = ['discount_rate']
689734
scenarios_complete, output, hourly_generation = parse_outputs(folderpath, features=features)

preprocessing_data.py

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,33 @@
77

88
####### Demand profile #########
99

10-
# Process csv file to get the demand profile
11-
# First column is the type of vehicule, second is the hour, last is the demand value in MW
12-
demand_ev = pd.read_csv('eoles/inputs/demand_data_other/demand_transport2050.csv', index_col=0, header=None).reset_index().rename(columns={0: 'vehicule', 1: 'hour', 2: 'demand'})
13-
demand_rte = pd.read_csv("eoles/inputs/demand/demand2050_RTE.csv", index_col=0, header=None).squeeze("columns")
14-
15-
adjust_demand = (530 * 1e3 - 580 * 1e3) / 8760 # 580TWh is the total of the profile we use as basis for electricity hourly demand (from RTE), c'est bien vérifié
16-
demand_rte_rescaled_1 = demand_rte + adjust_demand
17-
demand_rte_rescaled_2 = demand_rte * (530 / 580)
18-
19-
plt.plot(demand_rte_rescaled_1[0:150], c='red')
20-
plt.plot(demand_rte_rescaled_2[0:150], c='blue')
21-
# plt.plot(demand_rte[0:1000], c='green')
22-
plt.show()
23-
24-
# plot the demand profile for vehicule = 'light'
25-
26-
demand_ev_light = demand_ev.loc[demand_ev.vehicule == 'light']
27-
demand_ev_light = demand_ev_light.drop(columns=['vehicule'])
28-
demand_ev_light = demand_ev_light.set_index('hour')
29-
30-
demand_ev_heavy = demand_ev.loc[demand_ev.vehicule == 'heavy']
31-
demand_ev_heavy = demand_ev_heavy.drop(columns=['vehicule'])
32-
demand_ev_heavy = demand_ev_heavy.set_index('hour')
33-
34-
demand_ev_bus = demand_ev.loc[demand_ev.vehicule == 'bus']
35-
demand_ev_bus = demand_ev_bus.drop(columns=['vehicule'])
36-
demand_ev_bus = demand_ev_bus.set_index('hour')
10+
# # Process csv file to get the demand profile
11+
# # First column is the type of vehicule, second is the hour, last is the demand value in MW
12+
# demand_ev = pd.read_csv('eoles/inputs/demand_data_other/demand_transport2050.csv', index_col=0, header=None).reset_index().rename(columns={0: 'vehicule', 1: 'hour', 2: 'demand'})
13+
# demand_rte = pd.read_csv("eoles/inputs/demand/demand2050_RTE.csv", index_col=0, header=None).squeeze("columns")
14+
#
15+
# adjust_demand = (530 * 1e3 - 580 * 1e3) / 8760 # 580TWh is the total of the profile we use as basis for electricity hourly demand (from RTE), c'est bien vérifié
16+
# demand_rte_rescaled_1 = demand_rte + adjust_demand
17+
# demand_rte_rescaled_2 = demand_rte * (530 / 580)
18+
#
19+
# plt.plot(demand_rte_rescaled_1[0:150], c='red')
20+
# plt.plot(demand_rte_rescaled_2[0:150], c='blue')
21+
# # plt.plot(demand_rte[0:1000], c='green')
22+
# plt.show()
23+
#
24+
# # plot the demand profile for vehicule = 'light'
25+
#
26+
# demand_ev_light = demand_ev.loc[demand_ev.vehicule == 'light']
27+
# demand_ev_light = demand_ev_light.drop(columns=['vehicule'])
28+
# demand_ev_light = demand_ev_light.set_index('hour')
29+
#
30+
# demand_ev_heavy = demand_ev.loc[demand_ev.vehicule == 'heavy']
31+
# demand_ev_heavy = demand_ev_heavy.drop(columns=['vehicule'])
32+
# demand_ev_heavy = demand_ev_heavy.set_index('hour')
33+
#
34+
# demand_ev_bus = demand_ev.loc[demand_ev.vehicule == 'bus']
35+
# demand_ev_bus = demand_ev_bus.drop(columns=['vehicule'])
36+
# demand_ev_bus = demand_ev_bus.set_index('hour')
3737
# plot only for a subset of hours
3838
# demand_ev_light.loc[0:100].plot()
3939
# plt.show()
@@ -179,7 +179,8 @@
179179
lake_inflows = pd.read_csv('eoles/inputs/hourly_profiles/lake_2000-2019.csv', index_col=0, header=None).reset_index()
180180
lake_inflows.columns = ["month", "capacity_factor"]
181181
#
182-
list_year = [2012]
182+
year = 2016
183+
list_year = [year]
183184
vre_profiles_subset = pd.DataFrame()
184185
lake_inflows_subset = pd.DataFrame()
185186

@@ -203,8 +204,8 @@
203204

204205
lake_inflows_subset = lake_inflows_subset.set_index('month')
205206
#
206-
vre_profiles_subset.to_csv('eoles/inputs/hourly_profiles/vre_profiles_2012.csv', header=False)
207-
lake_inflows_subset.to_csv('eoles/inputs/hourly_profiles/lake_2012.csv', header=False)
207+
vre_profiles_subset.to_csv(f'eoles/inputs/hourly_profiles/vre_profiles_{year}.csv', header=False)
208+
lake_inflows_subset.to_csv(f'eoles/inputs/hourly_profiles/lake_{year}.csv', header=False)
208209
#
209210
# ############## Estimate run of river values for different years ######################
210211
#

0 commit comments

Comments
 (0)