Skip to content

Commit

Permalink
Add shutdown mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhar-abbas committed Nov 11, 2019
1 parent 02df480 commit e603e52
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
16 changes: 16 additions & 0 deletions ROSCO_toolbox/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __init__(self, controller_params):
self.SS_Mode = controller_params['SS_Mode']
self.WE_Mode = controller_params['WE_Mode']
self.PS_Mode = controller_params['PS_Mode']
self.SD_Mode = controller_params['SD_Mode']

# Necessary parameters
self.zeta_pc = controller_params['zeta_pc']
Expand Down Expand Up @@ -105,6 +106,17 @@ def __init__(self, controller_params):
else:
self.F_LPFDamping = 0.0

# Shutdown filter default cornering freq at 15s time constant
if controller_params['sd_cornerfreq']:
self.sd_cornerfreq = controller_params['sd_cornerfreq']
else:
self.sd_cornerfreq = 0.41888

if controller_params['sd_maxpit']:
self.sd_maxpit = controller_params['sd_maxpit']
else:
self.sd_maxpit = None

def tune_controller(self, turbine):
"""
Given a turbine model, tune a controller based on the NREL generic controller tuning process
Expand Down Expand Up @@ -198,6 +210,10 @@ def tune_controller(self, turbine):

# Define some setpoints
self.vs_minspd = (turbine.Cp.TSR_opt * turbine.v_min / turbine.rotor_radius) * Ng
if self.sd_maxpit:
self.sd_maxpit = self.sd_maxpit
else:
self.sd_maxpit = pitch_op[-1]

# Store some variables
self.v = v # Wind speed (m/s)
Expand Down
7 changes: 6 additions & 1 deletion ROSCO_toolbox/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ def write_param_file(self, turbine, controller, param_file='DISCON.IN', txt_file
file.write('{0:<12d} ! SS_Mode - Setpoint Smoother mode {{0: no setpoint smoothing, 1: introduce setpoint smoothing}}\n'.format(controller.SS_Mode))
file.write('{0:<12d} ! WE_Mode - Wind speed estimator mode {{0: One-second low pass filtered hub height wind speed, 1: Immersion and Invariance Estimator, 2: Extended Kalman Filter}}\n'.format(controller.WE_Mode))
file.write('{0:<12d} ! PS_Mode - Peak shaving mode {{0: no peak shaving, 1: implement peak shaving}}\n'.format(controller.PS_Mode))
file.write('{0:<12d} ! SD_Mode - Shutdown mode {{0: no shutdown procedure, 1: pitch to max pitch at shutdown}}\n'.format(controller.SD_Mode))
file.write('\n')
file.write('!------- FILTERS ----------------------------------------------------------\n')
file.write('{:<13.2f} ! F_LPFCornerFreq - Corner frequency (-3dB point) in the low-pass filters, [rad/s]\n'.format(turbine.bld_edgewise_freq * 1/4))
Expand Down Expand Up @@ -499,7 +500,11 @@ def write_param_file(self, turbine, controller, param_file='DISCON.IN', txt_file
file.write('!------- PEAK SHAVING -------------------------------------------\n')
file.write('{:<11d} ! PS_BldPitchMin_N - Number of values in minimum blade pitch lookup table (should equal number of values in PS_WindSpeeds and PS_BldPitchMin)\n'.format(len(controller.ps.pitch_min)))
file.write('{} ! PS_WindSpeeds - Wind speeds corresponding to minimum blade pitch angles [m/s]\n'.format(''.join('{:<4.2f} '.format(controller.ps.v[i]) for i in range(len(controller.ps.v)))))
file.write('{} ! PS_BldPitchMin - Minimum blade pitch angles [rad]'.format(''.join('{:<10.8f} '.format(controller.ps.pitch_min[i]) for i in range(len(controller.ps.pitch_min)))))
file.write('{} ! PS_BldPitchMin - Minimum blade pitch angles [rad]\n'.format(''.join('{:<10.8f} '.format(controller.ps.pitch_min[i]) for i in range(len(controller.ps.pitch_min)))))
file.write('\n')
file.write('!------- SHUTDOWN -------------------------------------------\n')
file.write('{:<014.5f} ! SD_MaxPit - Maximum blade pitch angle to initiate shutdown, [rad]\n'.format(controller.sd_maxpit))
file.write('{:<014.5f} ! SD_CornerFreq - Cutoff Frequency for first order low-pass filter for blade pitch angle, [rad/s]'.format(controller.sd_cornerfreq))
file.close()

def write_rotor_performance(self,turbine,txt_filename='Cp_Ct_Cq.txt'):
Expand Down
3 changes: 3 additions & 0 deletions Tune_Cases/DTU10MW.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ controller_params:
SS_Mode: 1 # Setpoint Smoother mode {0: no setpoint smoothing, 1: introduce setpoint smoothing}
WE_Mode: 2 # Wind speed estimator mode {0: One-second low pass filtered hub height wind speed, 1: Immersion and Invariance Estimator 2: Extended Kalman Filter}
PS_Mode: 1 # Peak shaving mode {0: no peak shaving, 1: implement peak shaving}
SD_Mode: 0 # Shutdown mode {0: no shutdown procedure, 1: pitch to max pitch at shutdown}
# Controller parameters
zeta_pc: 0.8 # Pitch controller desired damping ratio [-]
omega_pc: 0.3 # Pitch controller desired natural frequency [rad/s]
Expand All @@ -45,3 +46,5 @@ controller_params:
ss_vsgain: # None # Torque controller setpoint smoother gain bias percentage [%, <= 1 ], {default = 100%}
ss_pcgain: # None # Pitch controller setpoint smoother gain bias percentage [%, <= 1 ], {default = 0.1%}
ps_percent: # None # Percent peak shaving [%, <= 1 ], {default = 80%}
sd_maxpit: # None # Maximum blade pitch angle to initiate shutdown [rad], {default = bld pitch at v_max}
sd_cornerfreq: # None # Cutoff Frequency for first order low-pass filter for blade pitch angle [rad/s], {default = 0.41888 ~ time constant of 15s}
3 changes: 3 additions & 0 deletions Tune_Cases/IEA15MW.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ controller_params:
SS_Mode: 1 # Setpoint Smoother mode {0: no setpoint smoothing, 1: introduce setpoint smoothing}
WE_Mode: 2 # Wind speed estimator mode {0: One-second low pass filtered hub height wind speed, 1: Immersion and Invariance Estimator (Ortega et al.)}
PS_Mode: 0 # Peak shaving mode {0: no peak shaving, 1: implement peak shaving}
SD_Mode: 0 # Shutdown mode {0: no shutdown procedure, 1: pitch to max pitch at shutdown}
# Controller parameters
zeta_pc: 1. # Pitch controller desired damping ratio [-]
omega_pc: 0.1 # Pitch controller desired natural frequency [rad/s]
Expand All @@ -45,3 +46,5 @@ controller_params:
ss_vsgain: # None # Torque controller setpoint smoother gain bias percentage [%, <= 1 ], {default = 100%}
ss_pcgain: # None # Pitch controller setpoint smoother gain bias percentage [%, <= 1 ], {default = 0.1%}
ps_percent: # None # Percent peak shaving [%, <= 1 ], {default = 80%}
sd_maxpit: # None # Maximum blade pitch angle to initiate shutdown [rad], {default = bld pitch at v_max}
sd_cornerfreq: # None # Cutoff Frequency for first order low-pass filter for blade pitch angle [rad/s], {default = 0.41888 ~ time constant of 15s}
5 changes: 4 additions & 1 deletion Tune_Cases/NREL5MW.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ controller_params:
Y_ControlMode: 0 # Yaw control mode {0: no yaw control, 1: yaw rate control, 2: yaw-by-IPC}
SS_Mode: 1 # Setpoint Smoother mode {0: no setpoint smoothing, 1: introduce setpoint smoothing}
WE_Mode: 2 # Wind speed estimator mode {0: One-second low pass filtered hub height wind speed, 1: Immersion and Invariance Estimator (Ortega et al.)}
PS_Mode: 1 # Peak shaving mode {0: no peak shaving, 1: implement peak shaving}
PS_Mode: 0 # Peak shaving mode {0: no peak shaving, 1: implement peak shaving}
SD_Mode: 0 # Shutdown mode {0: no shutdown procedure, 1: pitch to max pitch at shutdown}
# Controller parameters
zeta_pc: 0.7 # Pitch controller desired damping ratio [-]
omega_pc: 0.6 # Pitch controller desired natural frequency [rad/s]
Expand All @@ -46,3 +47,5 @@ controller_params:
ss_vsgain: # None # Torque controller setpoint smoother gain bias percentage [%, <= 1 ], {default = 100%}
ss_pcgain: # None # Pitch controller setpoint smoother gain bias percentage [%, <= 1 ], {default = 0.1%}
ps_percent: # None # Percent peak shaving [%, <= 1 ], {default = 80%}
sd_maxpit: 0.2618 # Maximum blade pitch angle to initiate shutdown [rad], {default = bld pitch at v_max}
sd_cornerfreq: # None # Cutoff Frequency for first order low-pass filter for blade pitch angle [rad/s], {default = 0.41888 ~ time constant of 15s}

0 comments on commit e603e52

Please sign in to comment.