Skip to content

Commit

Permalink
Include flap DISCON inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhar-abbas committed Jan 30, 2020
1 parent 791816f commit 1633db4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
8 changes: 7 additions & 1 deletion ROSCO_toolbox/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def __init__(self, controller_params):
self.PS_Mode = controller_params['PS_Mode']
self.SD_Mode = controller_params['SD_Mode']
self.Fl_Mode = controller_params['Fl_Mode']
self.Flp_Mode = controller_params['Flp_Mode']

# Necessary parameters
self.zeta_pc = controller_params['zeta_pc']
Expand Down Expand Up @@ -273,7 +274,12 @@ def tune_controller(self, turbine):
self.Kp_float = 0.0



# Flap actuation - dummy for now
if self.Flp_Mode >= 1:
self.flp_angle = 0.0
self.Kp_flap = 0.0
self.Ki_flap = 0.0

class ControllerBlocks():
'''
Class ControllerBlocks defines tuning parameters for additional controller features or "blocks"
Expand Down
6 changes: 6 additions & 0 deletions ROSCO_toolbox/turbine.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ def __init__(self, turbine_params):
else:
self.TSR_operational = None

if turbine_params['bld_flapwise_freq']:
self.bld_flapwise_freq = turbine_params['bld_flapwise_freq']
else:
self.bld_flapwise_freq = None


# Allow print out of class
def __str__(self):
'''
Expand Down
16 changes: 12 additions & 4 deletions ROSCO_toolbox/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ def write_param_file(self, turbine, controller, param_file='DISCON.IN', txt_file
file.write('{0:<12d} ! PS_Mode - Pitch saturation mode {{0: no pitch saturation, 1: implement pitch saturation}}\n'.format(controller.PS_Mode > 0))
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('{0:<12d} ! Fl_Mode - Floating specific feedback mode {{0: no nacelle velocity feedback, 1: nacelle velocity feedback}}\n'.format(controller.Fl_Mode))
file.write('{0:<12d} ! Flp_Mode - Flap control mode {{0: no flap control, 1: steady state flap angle, 2: Proportional flap control}}\n'.format(controller.Fl_Mode))
file.write('\n')
file.write('!------- FILTERS ----------------------------------------------------------\n')
file.write('{:<13.5f} ! F_LPFCornerFreq - Corner frequency (-3dB point) in the low-pass filters, [rad/s]\n'.format(turbine.bld_edgewise_freq * 1/4))
Expand All @@ -445,6 +446,8 @@ def write_param_file(self, turbine, controller, param_file='DISCON.IN', txt_file
file.write('{:<10.5f}{:<9.5f} ! F_NotchBetaNumDen - Two notch damping values (numerator and denominator, resp) - determines the width and depth of the notch, [-]\n'.format(0.0,0.25))
file.write('{:<014.5f} ! F_SSCornerFreq - Corner frequency (-3dB point) in the first order low pass filter for the setpoint smoother, [rad/s].\n'.format(controller.ss_cornerfreq))
file.write('{:<10.5f}{:<9.5f} ! F_FlCornerFreq - Corner frequency and damping in the second order low pass filter of the tower-top fore-aft motion for floating feedback control [rad/s, -].\n'.format(turbine.ptfm_freq, 1.0))
file.write('{:<10.5f}{:<9.5f} ! F_FlpCornerFreq - Corner frequency and damping in the second order low pass filter of the blade root bending moment for flap control [rad/s, -].\n'.format(turbine.bld_flapwise_freq, 0.7))

file.write('\n')
file.write('!------- BLADE PITCH CONTROL ----------------------------------------------\n')
file.write('{:<11d} ! PC_GS_n - Amount of gain-scheduling table entries\n'.format(len(controller.pitch_op_pc)))
Expand Down Expand Up @@ -524,15 +527,20 @@ def write_param_file(self, turbine, controller, param_file='DISCON.IN', txt_file
file.write('\n')
file.write('!------- MINIMUM PITCH SATURATION -------------------------------------------\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_min_bld_pitch)))
file.write('{} ! PS_WindSpeeds - Wind speeds corresponding to minimum blade pitch angles [m/s]\n'.format(''.join('{:<4.2f} '.format(controller.v[i]) for i in range(len(controller.v)))))
file.write('{} ! PS_BldPitchMin - Minimum blade pitch angles [rad]\n'.format(''.join('{:<10.8f} '.format(controller.ps_min_bld_pitch[i]) for i in range(len(controller.ps_min_bld_pitch)))))
file.write('{} ! PS_WindSpeeds - Wind speeds corresponding to minimum blade pitch angles [m/s]\n'.format(''.join('{:<4.2f} '.format(controller.v[i]) for i in range(len(controller.v)))))
file.write('{} ! PS_BldPitchMin - Minimum blade pitch angles [rad]\n'.format(''.join('{:<10.8f} '.format(controller.ps_min_bld_pitch[i]) for i in range(len(controller.ps_min_bld_pitch)))))
file.write('\n')
file.write('!------- SHUTDOWN -------------------------------------------\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]\n'.format(controller.sd_cornerfreq))
file.write('\n')
file.write('!------- Floating -------------------------------------------\n')
file.write('!------- Floating -----------------------------------------------------------\n')
file.write('{:<014.5f} ! Fl_Kp - Nacelle velocity proportional feedback gain [s]\n'.format(controller.Kp_float))
file.write('\n')
file.write('!------- FLAP ACTUATION -----------------------------------------------------\n')
file.write('{:<014.5f} ! Flp_Angle - Initial or steady state flap angle [rad]\n'.format(controller.flp_angle))
file.write('{:<014.5f} ! Flp_Kp - Blade root bending moment proportional gain for flap control [s]\n'.format(controller.Kp_flap))
file.write('{:<014.5f} ! Flp_Ki - Flap displacement integral gain for flap control [s]'.format(controller.Ki_flap))
file.close()

def write_rotor_performance(self,turbine,txt_filename='Cp_Ct_Cq.txt'):
Expand Down

0 comments on commit 1633db4

Please sign in to comment.