HyDesign Sizing P2X Example
Sizing wind, solar, batteries and electrolyzers for a hybrid power plant
[1]:
# Install hydesign if needed
import importlib
if not importlib.util.find_spec("hydesign"):
!pip install git+https://gitlab.windenergy.dtu.dk/TOPFARM/hydesign.git
[2]:
from hydesign.assembly.hpp_assembly_P2X import hpp_model_P2X as hpp_model
from hydesign.Parallel_EGO import EfficientGlobalOptimizationDriver
from hydesign.examples import examples_filepath
import pandas as pd
import os
[3]:
n_procs = os.cpu_count()
if n_procs > 2:
n_procs -= 1
n_doe = int(3 * n_procs)
else:
n_procs -= 0
n_doe = int(8 * n_procs)
print(n_doe, n_procs)
21 7
[4]:
examples_sites = pd.read_csv(f'{examples_filepath}examples_sites.csv', index_col=0, sep=';')
ex_site = examples_sites.loc[4]
longitude = ex_site['longitude']
latitude = ex_site['latitude']
altitude = ex_site['altitude']
input_ts_fn = examples_filepath+ex_site['input_ts_fn']
sim_pars_fn = examples_filepath+ex_site['sim_pars_fn']
H2_demand_fn = examples_filepath+ex_site['H2_demand_col']
inputs = {
'name': ex_site['name'],
'longitude': longitude,
'latitude': latitude,
'altitude': altitude,
'input_ts_fn': input_ts_fn,
'sim_pars_fn': sim_pars_fn,
'H2_demand_fn': H2_demand_fn,
'opt_var': "NPV_over_CAPEX",
'num_batteries': 10,
'n_procs': n_procs,
'n_doe': n_doe,
'n_clusters': n_procs,
'n_seed': 0,
'max_iter': 10,
'final_design_fn': 'hydesign_design_0.csv',
'npred': 3e4,
'tol': 1e-6,
'min_conv_iter': 3,
'work_dir': './',
'hpp_model': hpp_model,
'variables': {
'clearance [m]':
{'var_type':'design',
'limits':[10, 60],
'types':'int'
},
# {'var_type':'fixed',
# 'value': 35
# },
'sp [W/m2]':
{'var_type':'design',
'limits':[200, 360],
'types':'int'
},
'p_rated [MW]':
{'var_type':'design',
'limits':[1, 10],
'types':'int'
},
# {'var_type':'fixed',
# 'value': 6
# },
'Nwt':
{'var_type':'design',
'limits':[0, 400],
'types':'int'
},
# {'var_type':'fixed',
# 'value': 200
# },
'wind_MW_per_km2 [MW/km2]':
# {'var_type':'design',
# 'limits':[5, 9],
# 'types':'float'
# },
{'var_type':'fixed',
'value': 7
},
'solar_MW [MW]':
# {'var_type':'design',
# 'limits':[0, 400],
# 'types':'int'
# },
{'var_type':'fixed',
'value': 200
},
'surface_tilt [deg]':
# {'var_type':'design',
# 'limits':[0, 50],
# 'types':'float'
# },
{'var_type':'fixed',
'value': 25
},
'surface_azimuth [deg]':
# {'var_type':'design',
# 'limits':[150, 210],
# 'types':'float'
# },
{'var_type':'fixed',
'value': 180
},
'DC_AC_ratio':
# {'var_type':'design',
# 'limits':[1, 2.0],
# 'types':'float'
# },
{'var_type':'fixed',
'value':1.0,
},
'b_P [MW]':
# {'var_type':'design',
# 'limits':[0, 100],
# 'types':'int'
# },
{'var_type':'fixed',
'value': 50
},
'b_E_h [h]':
# {'var_type':'design',
# 'limits':[1, 10],
# 'types':'int'
# },
{'var_type':'fixed',
'value': 6
},
'cost_of_battery_P_fluct_in_peak_price_ratio':
# {'var_type':'design',
# 'limits':[0, 20],
# 'types':'float'
# },
{'var_type':'fixed',
'value': 10},
'ptg_MW [MW]':
{'var_type':'design',
'limits':[1, 50],
'types':'int'
},
}}
EGOD = EfficientGlobalOptimizationDriver(**inputs)
[5]:
EGOD.run()
Sizing a HPP plant at France_good_wind:
Fixed parameters on the site
-------------------------------
longitude = -0.864258
latitude = 48.744116
altitude = 302.0
Initial 21 simulations took 2.73 minutes
Current solution -NPV_over_CAPEX = -1.116E+00
Current No. model evals: 21
Update sm and extract candidate points took 0.26 minutes
Check-optimal candidates: new 17 simulations took 4.3 minutes
Current solution -NPV_over_CAPEX = -1.260E+00
Current No. model evals: 38
rel_yopt_change = -1.14E-01
Iteration 1 took 4.58 minutes
Update sm and extract candidate points took 0.21 minutes
Check-optimal candidates: new 17 simulations took 2.41 minutes
Current solution -NPV_over_CAPEX = -1.355E+00
Current No. model evals: 53
rel_yopt_change = -7.01E-02
Iteration 2 took 2.64 minutes
Update sm and extract candidate points took 0.2 minutes
Check-optimal candidates: new 17 simulations took 1.98 minutes
Current solution -NPV_over_CAPEX = -1.363E+00
Current No. model evals: 69
rel_yopt_change = -5.74E-03
Iteration 3 took 2.2 minutes
Update sm and extract candidate points took 0.22 minutes
Check-optimal candidates: new 17 simulations took 2.33 minutes
Current solution -NPV_over_CAPEX = -1.385E+00
Current No. model evals: 86
rel_yopt_change = -1.63E-02
Iteration 4 took 2.59 minutes
Update sm and extract candidate points took 0.24 minutes
Check-optimal candidates: new 17 simulations took 2.04 minutes
Current solution -NPV_over_CAPEX = -1.385E+00
Current No. model evals: 102
rel_yopt_change = -0.00E+00
Iteration 5 took 2.33 minutes
Update sm and extract candidate points took 0.24 minutes
Check-optimal candidates: new 17 simulations took 1.91 minutes
Current solution -NPV_over_CAPEX = -1.385E+00
Current No. model evals: 118
rel_yopt_change = -0.00E+00
Iteration 6 took 2.19 minutes
Update sm and extract candidate points took 0.22 minutes
Check-optimal candidates: new 17 simulations took 2.0 minutes
Current solution -NPV_over_CAPEX = -1.393E+00
Current No. model evals: 133
rel_yopt_change = -5.71E-03
Iteration 7 took 2.28 minutes
Update sm and extract candidate points took 0.24 minutes
Check-optimal candidates: new 17 simulations took 2.14 minutes
Current solution -NPV_over_CAPEX = -1.393E+00
Current No. model evals: 149
rel_yopt_change = -0.00E+00
Iteration 8 took 2.45 minutes
Update sm and extract candidate points took 0.24 minutes
Check-optimal candidates: new 17 simulations took 2.07 minutes
Current solution -NPV_over_CAPEX = -1.403E+00
Current No. model evals: 164
rel_yopt_change = -7.00E-03
Iteration 9 took 2.4 minutes
Update sm and extract candidate points took 0.25 minutes
Check-optimal candidates: new 17 simulations took 1.94 minutes
Current solution -NPV_over_CAPEX = -1.403E+00
Current No. model evals: 180
rel_yopt_change = -0.00E+00
Iteration 10 took 2.29 minutes
Design:
---------------
clearance [m]: 42.000
sp [W/m2]: 285.000
p_rated [MW]: 4.000
Nwt: 83.000
wind_MW_per_km2 [MW/km2]: 7.000
solar_MW [MW]: 200.000
surface_tilt [deg]: 25.000
surface_azimuth [deg]: 180.000
DC_AC_ratio: 1.000
b_P [MW]: 50.000
b_E_h [h]: 6.000
cost_of_battery_P_fluct_in_peak_price_ratio: 10.000
ptg_MW [MW]: 50.000
HSS_kg [kg]: 0.000
NPV_over_CAPEX: 1.403
NPV [MEuro]: 697.279
IRR: 0.154
LCOE [Euro/MWh]: 30.975
LCOH [Euro/kg]: 5.762
Revenue [MEuro]: 1678.490
CAPEX [MEuro]: 496.981
OPEX [MEuro]: 7.464
penalty lifetime [MEuro]: 0.000
AEP [GWh]: 983.368
GUF: 0.374
annual_H2 [tons]: 5574.228
annual_P_ptg [GWh]: 375.740
grid [MW]: 300.000
wind [MW]: 332.000
solar [MW]: 200.000
PtG [MW]: 50.000
HSS [kg]: 0.000
Battery Energy [MWh]: 300.000
Battery Power [MW]: 50.000
Total curtailment [GWh]: 181.184
Awpp [km2]: 47.429
Apvp [km2]: 2.452
Rotor diam [m]: 133.679
Hub height [m]: 108.839
Number of batteries used in lifetime: 1.000
Break-even H2 price [Euro/kg]: -1.595
Break-even PPA price [Euro/MWh]: 2.551
Capacity factor wind [-]: 0.403
Optimization with 10 iterations and 180 model evaluations took 28.99 minutes
[6]:
EGOD.result
[6]:
clearance [m] | sp [W/m2] | p_rated [MW] | Nwt | wind_MW_per_km2 [MW/km2] | solar_MW [MW] | surface_tilt [deg] | surface_azimuth [deg] | DC_AC_ratio | b_P [MW] | ... | Apvp [km2] | Rotor diam [m] | Hub height [m] | Number of batteries used in lifetime | Break-even H2 price [Euro/kg] | Break-even PPA price [Euro/MWh] | Capacity factor wind [-] | design obj | opt time [min] | n_model_evals | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
France_good_wind | 42.0 | 285.0 | 4.0 | 83.0 | 7.0 | 200.0 | 25.0 | 180.0 | 1.0 | 50.0 | ... | 2.452 | 133.678827 | 108.839413 | 1.0 | -1.594641 | 2.550869 | 0.403192 | NPV_over_CAPEX | 28.99 | 180 |
1 rows × 50 columns
[ ]: