From ed019ebbe17cb4695c49f637f188b6a261f7ff20 Mon Sep 17 00:00:00 2001 From: dzalkind Date: Tue, 22 Dec 2020 10:51:20 -0700 Subject: [PATCH 1/2] Add significant digits to wind speed lookup tables --- ROSCO_toolbox/utilities.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ROSCO_toolbox/utilities.py b/ROSCO_toolbox/utilities.py index ec31411c5..ab595d843 100644 --- a/ROSCO_toolbox/utilities.py +++ b/ROSCO_toolbox/utilities.py @@ -139,8 +139,8 @@ def write_DISCON(turbine, controller, param_file='DISCON.IN', txt_filename='Cp_C file.write( '"{}" ! PerfFileName - File containing rotor performance tables (Cp,Ct,Cq)\n'.format(txt_filename)) file.write('{:<7d} {:<10d} ! PerfTableSize - Size of rotor performance tables, first number refers to number of blade pitch angles, second number referse to number of tip-speed ratios\n'.format(len(turbine.Cp.pitch_initial_rad),len(turbine.Cp.TSR_initial))) file.write('{:<11d} ! WE_FOPoles_N - Number of first-order system poles used in EKF\n'.format(len(controller.A))) - file.write('{} ! WE_FOPoles_v - Wind speeds corresponding to first-order system poles [m/s]\n'.format(''.join('{:<4.2f} '.format(controller.v[i]) for i in range(len(controller.v))))) - file.write('{} ! WE_FOPoles - First order system poles\n'.format(''.join('{:<10.8f} '.format(controller.A[i]) for i in range(len(controller.A))))) + file.write('{} ! WE_FOPoles_v - Wind speeds corresponding to first-order system poles [m/s]\n'.format(''.join('{:<4.4f} '.format(controller.v[i]) for i in range(len(controller.v))))) + file.write('{} ! WE_FOPoles - First order system poles [1/s]\n'.format(''.join('{:<10.8f} '.format(controller.A[i]) for i in range(len(controller.A))))) file.write('\n') file.write('!------- YAW CONTROL ------------------------------------------------------\n') file.write('{:<13.1f} ! Y_ErrThresh - Yaw error threshold. Turbine begins to yaw when it passes this. [rad^2 s]\n'.format(0.0)) @@ -162,7 +162,7 @@ def write_DISCON(turbine, controller, param_file='DISCON.IN', txt_filename='Cp_C 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_WindSpeeds - Wind speeds corresponding to minimum blade pitch angles [m/s]\n'.format(''.join('{:<4.4f} '.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') From df28b09ade1739e5550921d8358e83f982282cc1 Mon Sep 17 00:00:00 2001 From: Nikhar Abbas Date: Thu, 19 Nov 2020 17:29:32 -0700 Subject: [PATCH 2/2] fix units in write_DISCON --- ROSCO_toolbox/utilities.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ROSCO_toolbox/utilities.py b/ROSCO_toolbox/utilities.py index ab595d843..69a001c9d 100644 --- a/ROSCO_toolbox/utilities.py +++ b/ROSCO_toolbox/utilities.py @@ -79,7 +79,7 @@ def write_DISCON(turbine, controller, param_file='DISCON.IN', txt_filename='Cp_C 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)) - file.write('{:<13.5f} ! F_LPFDamping - Damping coefficient [used only when F_FilterType = 2]\n'.format(controller.F_LPFDamping)) + file.write('{:<13.5f} ! F_LPFDamping - Damping coefficient {{used only when F_FilterType = 2}} [-]\n'.format(controller.F_LPFDamping)) file.write('{:<13.5f} ! F_NotchCornerFreq - Natural frequency of the notch filter, [rad/s]\n'.format(turbine.twr_freq)) 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)) @@ -89,9 +89,9 @@ def write_DISCON(turbine, controller, param_file='DISCON.IN', txt_filename='Cp_C 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))) - file.write('{} ! PC_GS_angles - Gain-schedule table: pitch angles\n'.format(''.join('{:<4.6f} '.format(controller.pitch_op_pc[i]) for i in range(len(controller.pitch_op_pc))))) - file.write('{} ! PC_GS_KP - Gain-schedule table: pitch controller kp gains\n'.format(''.join('{:<4.6f} '.format(controller.pc_gain_schedule.Kp[i]) for i in range(len(controller.pc_gain_schedule.Kp))))) - file.write('{} ! PC_GS_KI - Gain-schedule table: pitch controller ki gains\n'.format(''.join('{:<4.6f} '.format(controller.pc_gain_schedule.Ki[i]) for i in range(len(controller.pc_gain_schedule.Ki))))) + file.write('{} ! PC_GS_angles - Gain-schedule table: pitch angles [rad].\n'.format(''.join('{:<4.6f} '.format(controller.pitch_op_pc[i]) for i in range(len(controller.pitch_op_pc))))) + file.write('{} ! PC_GS_KP - Gain-schedule table: pitch controller kp gains [s].\n'.format(''.join('{:<4.6f} '.format(controller.pc_gain_schedule.Kp[i]) for i in range(len(controller.pc_gain_schedule.Kp))))) + file.write('{} ! PC_GS_KI - Gain-schedule table: pitch controller ki gains [-].\n'.format(''.join('{:<4.6f} '.format(controller.pc_gain_schedule.Ki[i]) for i in range(len(controller.pc_gain_schedule.Ki))))) file.write('{} ! PC_GS_KD - Gain-schedule table: pitch controller kd gains\n'.format(''.join('{:<1.1f} '.format(0.0) for i in range(len(controller.pc_gain_schedule.Ki))))) file.write('{} ! PC_GS_TF - Gain-schedule table: pitch controller tf gains (derivative filter)\n'.format(''.join('{:<1.1f} '.format(0.0) for i in range(len(controller.pc_gain_schedule.Ki))))) file.write('{:<014.5f} ! PC_MaxPit - Maximum physical pitch limit, [rad].\n'.format(controller.max_pitch)) @@ -115,13 +115,13 @@ def write_DISCON(turbine, controller, param_file='DISCON.IN', txt_filename='Cp_C file.write('{:<014.5f} ! VS_MaxTq - Maximum generator torque in Region 3 (HSS side), [Nm].\n'.format(turbine.max_torque)) file.write('{:<014.5f} ! VS_MinTq - Minimum generator (HSS side), [Nm].\n'.format(0.0)) file.write('{:<014.5f} ! VS_MinOMSpd - Optimal mode minimum speed, cut-in speed towards optimal mode gain path, [rad/s]\n'.format(controller.vs_minspd)) - file.write('{:<014.5f} ! VS_Rgn2K - Generator torque constant in Region 2 (HSS side), [N-m/(rad/s)^2]\n'.format(controller.vs_rgn2K)) + file.write('{:<014.5f} ! VS_Rgn2K - Generator torque constant in Region 2 (HSS side), [Nm/(rad/s)^2]\n'.format(controller.vs_rgn2K)) file.write('{:<014.5f} ! VS_RtPwr - Wind turbine rated power [W]\n'.format(turbine.rated_power)) file.write('{:<014.5f} ! VS_RtTq - Rated torque, [Nm].\n'.format(turbine.rated_torque)) file.write('{:<014.5f} ! VS_RefSpd - Rated generator speed [rad/s]\n'.format(controller.vs_refspd)) file.write('{:<11d} ! VS_n - Number of generator PI torque controller gains\n'.format(1)) - file.write('{:<014.5f} ! VS_KP - Proportional gain for generator PI torque controller [1/(rad/s) Nm]. (Only used in the transitional 2.5 region if VS_ControlMode =/ 2)\n'.format(controller.vs_gain_schedule.Kp[-1])) - file.write('{:<014.5f} ! VS_KI - Integral gain for generator PI torque controller [1/rad Nm]. (Only used in the transitional 2.5 region if VS_ControlMode =/ 2)\n'.format(controller.vs_gain_schedule.Ki[-1])) + file.write('{:<014.5f} ! VS_KP - Proportional gain for generator PI torque controller [-]. (Only used in the transitional 2.5 region if VS_ControlMode =/ 2)\n'.format(controller.vs_gain_schedule.Kp[-1])) + file.write('{:<014.5f} ! VS_KI - Integral gain for generator PI torque controller [s]. (Only used in the transitional 2.5 region if VS_ControlMode =/ 2)\n'.format(controller.vs_gain_schedule.Ki[-1])) file.write('{:<13.2f} ! VS_TSRopt - Power-maximizing region 2 tip-speed-ratio [rad].\n'.format(turbine.TSR_operational)) file.write('\n') file.write('!------- SETPOINT SMOOTHER ---------------------------------------------\n') @@ -151,8 +151,8 @@ def write_DISCON(turbine, controller, param_file='DISCON.IN', txt_filename='Cp_C file.write('{:<13.1f} ! Y_IPC_omegaLP - Low-pass filter corner frequency for the Yaw-by-IPC controller to filtering the yaw alignment error, [rad/s].\n'.format(0.0)) file.write('{:<13.1f} ! Y_IPC_zetaLP - Low-pass filter damping factor for the Yaw-by-IPC controller to filtering the yaw alignment error, [-].\n'.format(0.0)) file.write('{:<13.1f} ! Y_MErrSet - Yaw alignment error, set point [rad]\n'.format(0.0)) - file.write('{:<13.1f} ! Y_omegaLPFast - Corner frequency fast low pass filter, 1.0 [Hz]\n'.format(0.0)) - file.write('{:<13.1f} ! Y_omegaLPSlow - Corner frequency slow low pass filter, 1/60 [Hz]\n'.format(0.0)) + file.write('{:<13.1f} ! Y_omegaLPFast - Corner frequency fast low pass filter, 1.0 [rad/s]\n'.format(0.0)) + file.write('{:<13.1f} ! Y_omegaLPSlow - Corner frequency slow low pass filter, 1/60 [rad/s]\n'.format(0.0)) file.write('{:<13.1f} ! Y_Rate - Yaw rate [rad/s]\n'.format(0.0)) file.write('\n') file.write('!------- TOWER FORE-AFT DAMPING -------------------------------------------\n') @@ -175,7 +175,7 @@ def write_DISCON(turbine, controller, param_file='DISCON.IN', txt_filename='Cp_C 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.8e} ! Flp_Kp - Blade root bending moment proportional gain for flap control [s]\n'.format(controller.Kp_flap[-1])) - file.write('{:<014.8e} ! Flp_Ki - Flap displacement integral gain for flap control [s]\n'.format(controller.Ki_flap[-1])) + file.write('{:<014.8e} ! Flp_Ki - Flap displacement integral gain for flap control [-]\n'.format(controller.Ki_flap[-1])) file.write('{:<014.5f} ! Flp_MaxPit - Maximum (and minimum) flap pitch angle [rad]'.format(controller.flp_maxpit)) file.close()