Open and run in Colab (interactive) Edit on Gitlab Open and run in Kaggle (interactive) Launch with Binder

HyDesign Sizing Example

Sizing wind, solar and batteries 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 import 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},
    }}
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 1.76 minutes
  Current solution -NPV_over_CAPEX = -7.774E-01
  Current No. model evals: 21

Update sm and extract candidate points took 0.22 minutes
Check-optimal candidates: new 17 simulations took 1.62 minutes
  Current solution -NPV_over_CAPEX = -8.270E-01
  Current No. model evals: 37
  rel_yopt_change = -6.00E-02
Iteration 1 took 1.86 minutes

Update sm and extract candidate points took 0.21 minutes
Check-optimal candidates: new 16 simulations took 1.46 minutes
  Current solution -NPV_over_CAPEX = -8.276E-01
  Current No. model evals: 51
  rel_yopt_change = -6.61E-04
Iteration 2 took 1.69 minutes

Update sm and extract candidate points took 0.23 minutes
Check-optimal candidates: new 15 simulations took 1.35 minutes
  Current solution -NPV_over_CAPEX = -8.276E-01
  Current No. model evals: 64
  rel_yopt_change = -0.00E+00
Iteration 3 took 1.6 minutes

Update sm and extract candidate points took 0.23 minutes
Check-optimal candidates: new 15 simulations took 1.36 minutes
  Current solution -NPV_over_CAPEX = -8.395E-01
  Current No. model evals: 77
  rel_yopt_change = -1.42E-02
Iteration 4 took 1.62 minutes

Update sm and extract candidate points took 0.21 minutes
Check-optimal candidates: new 15 simulations took 1.23 minutes
  Current solution -NPV_over_CAPEX = -8.395E-01
  Current No. model evals: 89
  rel_yopt_change = -0.00E+00
Iteration 5 took 1.46 minutes

Update sm and extract candidate points took 0.23 minutes
Check-optimal candidates: new 15 simulations took 1.23 minutes
  Current solution -NPV_over_CAPEX = -8.429E-01
  Current No. model evals: 102
  rel_yopt_change = -4.04E-03
Iteration 6 took 1.49 minutes

Update sm and extract candidate points took 0.23 minutes
Check-optimal candidates: new 15 simulations took 1.25 minutes
  Current solution -NPV_over_CAPEX = -8.429E-01
  Current No. model evals: 114
  rel_yopt_change = -0.00E+00
Iteration 7 took 1.52 minutes

Update sm and extract candidate points took 0.2 minutes
Check-optimal candidates: new 15 simulations took 1.21 minutes
  Current solution -NPV_over_CAPEX = -8.429E-01
  Current No. model evals: 128
  rel_yopt_change = -0.00E+00
Iteration 8 took 1.46 minutes

Update sm and extract candidate points took 0.22 minutes
Check-optimal candidates: new 15 simulations took 1.25 minutes
  Current solution -NPV_over_CAPEX = -8.429E-01
  Current No. model evals: 141
  rel_yopt_change = -0.00E+00
Iteration 9 took 1.54 minutes

Surrogate based optimization is converged.

Design:
---------------
clearance [m]: 60.000
sp [W/m2]: 287.000
p_rated [MW]: 10.000
Nwt: 31.000
wind_MW_per_km2 [MW/km2]: 5.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


NPV_over_CAPEX: 0.843
NPV [MEuro]: 407.749
IRR: 0.123
LCOE [Euro/MWh]: 34.895
Revenues [MEuro]: 50.812
CAPEX [MEuro]: 483.739
OPEX [MEuro]: 8.286
Wind CAPEX [MEuro]: 342.383
Wind OPEX [MEuro]: 7.386
PV CAPEX [MEuro]: 46.000
PV OPEX [MEuro]: 0.900
Batt CAPEX [MEuro]: 25.774
Batt OPEX [MEuro]: 0.000
Shared CAPEX [MEuro]: 69.582
Shared OPEX [MEuro]: 0.000
penalty lifetime [MEuro]: 0.000
AEP [GWh]: 1281.154
GUF: 0.488
grid [MW]: 300.000
wind [MW]: 310.000
solar [MW]: 200.000
Battery Energy [MWh]: 300.000
Battery Power [MW]: 50.000
Total curtailment [GWh]: 725.295
Total curtailment with deg [GWh]: 280.323
Awpp [km2]: 62.000
Apvp [km2]: 2.452
Plant area [km2]: 62.000
Rotor diam [m]: 210.627
Hub height [m]: 165.314
Number of batteries used in lifetime: 2.000
Break-even PPA price [Euro/MWh]: 23.340
Capacity factor wind [-]: 0.415

Optimization with 9 iterations and 141 model evaluations took 16.19 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] Plant area [km2] Rotor diam [m] Hub height [m] Number of batteries used in lifetime Break-even PPA price [Euro/MWh] Capacity factor wind [-] design obj opt time [min] n_model_evals
France_good_wind 60.0 287.0 10.0 31.0 5.0 200.0 25.0 180.0 1.0 50.0 ... 2.452 62.0 210.627033 165.313517 2.0 23.339817 0.41521 NPV_over_CAPEX 16.19 141

1 rows × 52 columns

[ ]: