Sizing optimization under uncertainty
[ ]:
# Install hydesign if needed
import importlib
if not importlib.util.find_spec("hydesign"):
!pip install git+https://gitlab.windenergy.dtu.dk/TOPFARM/hydesign.git
[1]:
from hydesign.assembly.hpp_assembly import hpp_model
from hydesign.assembly.hpp_assembly_reliability import ReliabilityModel
from hydesign.Parallel_EGO import EfficientGlobalOptimizationDriver
import os
import pandas as pd
from hydesign.examples import examples_filepath
from hydesign.utils import sample_mean
HyDesign can run different realizations of up and down time of individual components throughout the lifetime. These can be aggregated together and utilized to perform sizing optimization under uncertainty. In this example we will include inverter and PV panel sizes as design variables.
[2]:
name = 'France_good_wind'
examples_sites = pd.read_csv(f'{examples_filepath}examples_sites.csv', index_col=0, sep=';')
ex_site = examples_sites.loc[examples_sites.name == name]
longitude = ex_site['longitude'].values[0]
latitude = ex_site['latitude'].values[0]
altitude = ex_site['altitude'].values[0]
sim_pars_fn = examples_filepath+ex_site['sim_pars_fn'].values[0]
input_ts_fn = examples_filepath+ex_site['input_ts_fn'].values[0]
inputs = {
# HPP Model Inputs
'name': name,
'longitude': longitude,
'latitude': latitude,
'altitude': altitude,
'input_ts_fn': input_ts_fn,
'sim_pars_fn': sim_pars_fn,
'num_batteries': 10,
'work_dir': './',
'hpp_model': ReliabilityModel,
# EGO Inputs
'opt_var': "NPV_over_CAPEX",
'n_procs': 4,
'n_doe': 10,
'n_clusters': 4, # total number of evals per iteration = n_clusters + 2*n_dims
'n_seed': 0,
'max_iter': 3,
'final_design_fn': 'hydesign_design_0.csv',
'npred': 2e4,
'tol': 1e-6,
'min_conv_iter': 3,
# Reliability Model Inputs
'reliability_data_set_path': os.path.join(examples_filepath, 'reliability'),
'battery_ds_fn': 'reliability_data_set_BESS.nc',
'transformer_ds_fn': 'reliability_data_set_transformer.nc',
'inverter_ds_fn': 'reliability_data_set_inverter.nc',
'PV_ds_fn': 'reliability_data_set_PV.nc',
'WT_ds_fn': 'reliability_data_set_WT.nc',
'n_reliability_seed': 2,
'aggregation_method': sample_mean,
'reliability_hpp_model': hpp_model,
# Design Variables
'variables': {
'clearance [m]': {
'var_type':'fixed',
'value': 10
},
'sp [W/m2]': {
'var_type':'fixed',
'value': 350,
},
'p_rated [MW]': {
'var_type':'fixed',
'value': 6
},
'Nwt': {
'var_type':'fixed',
'value': 200
},
'wind_MW_per_km2 [MW/km2]': {
'var_type':'fixed',
'value': 7
},
'solar_MW [MW]': {
'var_type':'fixed',
'value': 200
},
'surface_tilt [deg]': {
'var_type':'fixed',
'value': 25
},
'surface_azimuth [deg]': {
'var_type':'design',
'limits':[150, 210],
'types':'float'
},
'DC_AC_ratio': {
'var_type':'fixed',
'value':1.0,
},
'b_P [MW]': {
'var_type':'fixed',
'value': 50
},
'b_E_h [h]': {
'var_type':'fixed',
'value': 6
},
'cost_of_battery_P_fluct_in_peak_price_ratio': {
'var_type':'fixed',
'value': 10
},
'inverter_size [kW]': {
'var_type':'design',
'limits':[100, 2000],
'types':'float'
},
'panel_size [W]': {
'var_type':'design',
'limits':[100, 500],
'types':'float'
},
},
}
[3]:
EGOD = EfficientGlobalOptimizationDriver(**inputs)
EGOD.run()
result = EGOD.result
Sizing a HPP plant at France_good_wind:
Fixed parameters on the site
-------------------------------
longitude = -0.864258
latitude = 48.744116
altitude = 302.0
Initial 10 simulations took 1.87 minutes
Current solution -NPV_over_CAPEX = 1.765E-01
Current No. model evals: 10
Update sm and extract candidate points took 0.15 minutes
Check-optimal candidates: new 10 simulations took 2.48 minutes
Current solution -NPV_over_CAPEX = 1.763E-01
Current No. model evals: 20
rel_yopt_change = 1.21E-03
Iteration 1 took 2.64 minutes
Update sm and extract candidate points took 0.19 minutes
Check-optimal candidates: new 10 simulations took 2.49 minutes
Current solution -NPV_over_CAPEX = 1.763E-01
Current No. model evals: 29
rel_yopt_change = 4.62E-06
Iteration 2 took 2.7 minutes
Update sm and extract candidate points took 0.15 minutes
Check-optimal candidates: new 10 simulations took 2.16 minutes
Current solution -NPV_over_CAPEX = 1.763E-01
Current No. model evals: 39
rel_yopt_change = -0.00E+00
Iteration 3 took 2.32 minutes
Fixed parameters on the site
-------------------------------
longitude = -0.864258
latitude = 48.744116
altitude = 302.0
Fixed parameters on the site
-------------------------------
longitude = -0.864258
latitude = 48.744116
altitude = 302.0
Design:
---------------
clearance [m]: 10.000
sp [W/m2]: 350.000
p_rated [MW]: 6.000
Nwt: 200.000
wind_MW_per_km2 [MW/km2]: 7.000
solar_MW [MW]: 200.000
surface_tilt [deg]: 25.000
surface_azimuth [deg]: 209.891
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
inverter_size [kW]: 624.827
panel_size [W]: 100.000
NPV_over_CAPEX: -0.176
NPV [MEuro]: -196.510
IRR: 0.000
LCOE [Euro/MWh]: 71.302
Revenues [MEuro]: 61.001
CAPEX [MEuro]: 1114.451
OPEX [MEuro]: 21.278
Wind CAPEX [MEuro]: 940.493
Wind OPEX [MEuro]: 20.378
PV CAPEX [MEuro]: 46.000
PV OPEX [MEuro]: 0.900
Batt CAPEX [MEuro]: 25.548
Batt OPEX [MEuro]: 0.000
Shared CAPEX [MEuro]: 102.411
Shared Opex [MEuro]: 0.000
penalty lifetime [MEuro]: 0.000
AEP [GWh]: 1542.530
GUF: 0.587
grid [MW]: 300.000
wind [MW]: 1200.000
solar [MW]: 200.000
Battery Energy [MWh]: 300.000
Battery Power [MW]: 50.000
Total curtailment [GWh]: 39848.165
Total curtailment with deg [GWh]: 27678.758
Awpp [km2]: 171.429
Apvp [km2]: 2.452
Plant area [km2]: 171.429
Rotor diam [m]: 147.740
Hub height [m]: 83.870
Number of batteries used in lifetime: 2.000
Break-even PPA price [Euro/MWh]: 46.091
Capacity factor wind [-]: 0.270
Inverter size nominal [kW]: 624.827
Panel size nominal [W]: 100.000
Number of inverters [-]: 320.000
Inverter size real [kW]: 625.000
Number of panels per inverter [-]: 6250.000
Panel size real [W]: 100.000
Optimization with 3 iterations and 39 model evaluations took 9.95 minutes