diff --git a/.github/workflows/CI_rosco-compile.yml b/.github/workflows/CI_rosco-compile.yml index e653de70..39a13875 100644 --- a/.github/workflows/CI_rosco-compile.yml +++ b/.github/workflows/CI_rosco-compile.yml @@ -108,7 +108,7 @@ jobs: strategy: fail-fast: false #true matrix: - os: ["ubuntu-latest", "macOS-13", "macOS-14", "windows-latest"] #mac-13 intel, mac-14 arm + os: ["ubuntu-latest", "macOS-14", "macOS-latest", "windows-latest"] #mac-13 intel, mac-14 arm python-version: ["3.11", "3.12"] steps: diff --git a/.github/workflows/Publish_ROSCO.yml b/.github/workflows/Publish_ROSCO.yml index fdd4fb7c..ef017d94 100644 --- a/.github/workflows/Publish_ROSCO.yml +++ b/.github/workflows/Publish_ROSCO.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-13, macos-14, macos-15] + os: [ubuntu-latest, windows-latest, macos-14, macos-15] steps: - name: Set up QEMU @@ -64,14 +64,6 @@ jobs: CC: ${{ steps.install_cc.outputs.cc }} CXX: ${{ steps.install_cc.outputs.cxx }} - - name: Build wheels mac-13 - if: contains( matrix.os, 'macos-13') - uses: pypa/cibuildwheel@v2.23.3 - env: - CC: ${{ steps.install_cc.outputs.cc }} - CXX: ${{ steps.install_cc.outputs.cxx }} - CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET="13.0" - - name: Build wheels mac-14 if: contains( matrix.os, 'macos-14') uses: pypa/cibuildwheel@v2.23.3 diff --git a/Examples/02_ccblade.py b/Examples/02_ccblade.py index 96d7cdf0..9004adf8 100644 --- a/Examples/02_ccblade.py +++ b/Examples/02_ccblade.py @@ -16,38 +16,53 @@ from rosco.toolbox import turbine as ROSCO_turbine from rosco.toolbox.utilities import write_rotor_performance from rosco.toolbox.inputs.validation import load_rosco_yaml +import matplotlib.pyplot as plt + + +this_dir = os.path.dirname(os.path.abspath(__file__)) +tune_dir = os.path.join(this_dir,'Tune_Cases') + +example_out_dir = os.path.join(this_dir,'examples_out') +if not os.path.isdir(example_out_dir): + os.makedirs(example_out_dir) + def main(): + # Inputs: tuning yaml (will point to openfast model file for generating Cp surface) + parameter_filename = os.path.join(tune_dir,'IEA15MW.yaml') + + # Output: rotor performance text file + txt_filename = os.path.join(example_out_dir,'02_Cp_Ct_Cq.Ex03.txt') + # Initialize parameter dictionaries turbine_params = {} - control_params = {} - this_dir = os.path.dirname(os.path.abspath(__file__)) - example_out_dir = os.path.join(this_dir,'examples_out') - if not os.path.isdir(example_out_dir): - os.makedirs(example_out_dir) # Load yaml file - this_dir = os.path.dirname(os.path.abspath(__file__)) - tune_dir = os.path.join(this_dir,'Tune_Cases') - parameter_filename = os.path.join(tune_dir,'NREL5MW.yaml') inps = load_rosco_yaml(parameter_filename) path_params = inps['path_params'] turbine_params = inps['turbine_params'] - controller_params = inps['controller_params'] # Load turbine data from openfast model turbine = ROSCO_turbine.Turbine(turbine_params) turbine.load_from_fast( path_params['FAST_InputFile'], - os.path.join(tune_dir,path_params['FAST_directory']), + os.path.join(os.path.dirname(parameter_filename),path_params['FAST_directory']), rot_source='cc-blade', txt_filename=None) # Write rotor performance text file - txt_filename = os.path.join(example_out_dir,'02_Cp_Ct_Cq.Ex03.txt') write_rotor_performance(turbine,txt_filename=txt_filename) + # plot rotor performance + print('Plotting Cp data') + turbine.Cp.plot_performance() + + if False: + plt.show() + else: + plt.savefig(os.path.join(example_out_dir,'01_NREL5MW_Cp.png')) + if __name__ == "__main__": main() diff --git a/Examples/03_tune_controller.py b/Examples/03_tune_controller.py index 37ef3618..aa2abce2 100644 --- a/Examples/03_tune_controller.py +++ b/Examples/03_tune_controller.py @@ -25,25 +25,34 @@ from rosco.toolbox.utilities import write_DISCON from rosco.toolbox.inputs.validation import load_rosco_yaml +this_dir = os.path.dirname(os.path.abspath(__file__)) +tune_dir = os.path.join(this_dir,'Tune_Cases') +example_out_dir = os.path.join(this_dir,'examples_out') +os.makedirs(example_out_dir, exist_ok=True) + def main(): + # Inputs: tuning yaml (will point to openfast model file) + parameter_filename = os.path.join(tune_dir,'IEA15MW.yaml') + + # Output: controller DISCON input file + param_file = os.path.join(example_out_dir,'IEA15MW_DISCON.IN') + # Load yaml file - this_dir = os.path.dirname(os.path.abspath(__file__)) - tune_dir = os.path.join(this_dir,'Tune_Cases') - parameter_filename = os.path.join(tune_dir,'NREL5MW.yaml') inps = load_rosco_yaml(parameter_filename) path_params = inps['path_params'] turbine_params = inps['turbine_params'] controller_params = inps['controller_params'] + yaml_dir = os.path.dirname(parameter_filename) # Instantiate turbine, controller, and file processing classes turbine = ROSCO_turbine.Turbine(turbine_params) controller = ROSCO_controller.Controller(controller_params) # Load turbine data from OpenFAST and rotor performance text file - cp_filename = os.path.join(tune_dir,path_params['rotor_performance_filename']) + cp_filename = os.path.join(yaml_dir,path_params['rotor_performance_filename']) turbine.load_from_fast( path_params['FAST_InputFile'], - os.path.join(tune_dir,path_params['FAST_directory']), + os.path.join(yaml_dir,path_params['FAST_directory']), rot_source='txt',txt_filename= cp_filename ) @@ -51,12 +60,11 @@ def main(): controller.tune_controller(turbine) # Write parameter input file - example_out_dir = os.path.join(this_dir,'examples_out') - param_file = os.path.join(example_out_dir,'03_DISCON.IN') - write_DISCON(turbine,controller, - param_file=param_file, - txt_filename=cp_filename - ) + write_DISCON( + turbine,controller, + param_file=param_file, + txt_filename=cp_filename + ) # Plot gain schedule fig, ax = plt.subplots(2,2,constrained_layout=True,sharex=True) @@ -76,9 +84,7 @@ def main(): ax[3].set_ylabel('Integral Gain') plt.suptitle('Pitch Controller Gains') - - if not os.path.isdir(example_out_dir): - os.makedirs(example_out_dir) + if False: plt.show() diff --git a/Examples/06_peak_shaving.py b/Examples/06_peak_shaving.py index ce88e1a1..598b5362 100644 --- a/Examples/06_peak_shaving.py +++ b/Examples/06_peak_shaving.py @@ -31,6 +31,7 @@ # Python modules import matplotlib.pyplot as plt import os +import numpy as np # ROSCO toolbox modules from rosco.toolbox import controller as ROSCO_controller from rosco.toolbox import turbine as ROSCO_turbine @@ -45,6 +46,8 @@ def main(): # Load yaml file parameter_filename = os.path.join(tune_dir,'NREL5MW.yaml') + yaml_dir = os.path.dirname(parameter_filename) + inps = load_rosco_yaml(parameter_filename) path_params = inps['path_params'] turbine_params = inps['turbine_params'] @@ -61,19 +64,19 @@ def main(): # Load turbine data from OpenFAST and rotor performance text file turbine.load_from_fast( path_params['FAST_InputFile'], - os.path.join(tune_dir,path_params['FAST_directory']), - rot_source='txt',txt_filename=os.path.join(tune_dir,path_params['rotor_performance_filename']) + os.path.join(yaml_dir,path_params['FAST_directory']), + rot_source='txt',txt_filename=os.path.join(yaml_dir,path_params['rotor_performance_filename']) ) # Tune controller controller.tune_controller(turbine) # Plot minimum pitch schedule fig, ax = plt.subplots(1,1) - ax.plot(controller.v, controller.pitch_op,label='Steady State Operation') - ax.plot(controller.v, controller.ps_min_bld_pitch, label='Minimum Pitch Schedule') + ax.plot(controller.v, np.degrees(controller.pitch_op), label='Steady State Operation') + ax.plot(controller.v, np.degrees(controller.ps_min_bld_pitch), label='Minimum Pitch Schedule') ax.legend() ax.set_xlabel('Wind speed (m/s)') - ax.set_ylabel('Blade pitch (rad)') + ax.set_ylabel('Blade pitch (deg)') if False: plt.show() diff --git a/Examples/Test_Cases/BAR_10/BAR_10_DISCON.IN b/Examples/Test_Cases/BAR_10/BAR_10_DISCON.IN index 1490ea64..fdecfcfd 100644 --- a/Examples/Test_Cases/BAR_10/BAR_10_DISCON.IN +++ b/Examples/Test_Cases/BAR_10/BAR_10_DISCON.IN @@ -1,5 +1,5 @@ ! Controller parameter input file for the BAR_10 wind turbine -! - File written using ROSCO version 2.10.0 controller tuning logic on 09/08/25 +! - File written using ROSCO version 2.10.1 controller tuning logic on 11/26/25 !------- SIMULATION CONTROL ------------------------------------------------------------ 1 ! LoggingLevel - 0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3) @@ -101,7 +101,7 @@ !------- SETPOINT SMOOTHER --------------------------------------------- 1.00000 ! SS_VSGain - Variable speed torque controller setpoint smoother gain, [-]. -0.00100 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-]. +0.05000 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-]. !------- POWER REFERENCE TRACKING -------------------------------------- 0 ! PRC_Comm - Power reference communication mode when PRC_Mode = 2, 0- use constant DISCON inputs, 1- use open loop inputs, 2- use ZMQ inputs @@ -163,7 +163,7 @@ 200.0000 100.0000 ! SU_LoadHoldDuration - Array containing duration to hold the partial loads during startup [s] !------- SHUTDOWN ----------------------------------------------------------- -0 ! SD_TimeActivate - Time to acitvate shutdown modes, [s] +0 ! SD_TimeActivate - Time to acitvate shutdown modes; no shutdown events will occur before this time. [s] 0 ! SD_EnablePitch - Shutdown when collective blade pitch exceeds a threshold, [-] 0 ! SD_EnableYawError - Shutdown when yaw error exceeds a threshold, [-] 0 ! SD_EnableGenSpeed - Shutdown when generator speed exceeds a threshold, [-] diff --git a/Examples/Test_Cases/IEA-15-240-RWT/IEA-15-240-RWT-Monopile/IEA-15-240-RWT-Monopile_DISCON.IN b/Examples/Test_Cases/IEA-15-240-RWT/IEA-15-240-RWT-Monopile/IEA-15-240-RWT-Monopile_DISCON.IN index 19692bb2..285fe422 100644 --- a/Examples/Test_Cases/IEA-15-240-RWT/IEA-15-240-RWT-Monopile/IEA-15-240-RWT-Monopile_DISCON.IN +++ b/Examples/Test_Cases/IEA-15-240-RWT/IEA-15-240-RWT-Monopile/IEA-15-240-RWT-Monopile_DISCON.IN @@ -1,5 +1,5 @@ ! Controller parameter input file for the IEA-15-240-RWT-Monopile wind turbine -! - File written using ROSCO version 2.10.0 controller tuning logic on 09/08/25 +! - File written using ROSCO version 2.10.1 controller tuning logic on 11/26/25 !------- SIMULATION CONTROL ------------------------------------------------------------ 1 ! LoggingLevel - 0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3) @@ -101,7 +101,7 @@ !------- SETPOINT SMOOTHER --------------------------------------------- 1.00000 ! SS_VSGain - Variable speed torque controller setpoint smoother gain, [-]. -0.00100 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-]. +0.05000 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-]. !------- POWER REFERENCE TRACKING -------------------------------------- 0 ! PRC_Comm - Power reference communication mode when PRC_Mode = 2, 0- use constant DISCON inputs, 1- use open loop inputs, 2- use ZMQ inputs @@ -163,7 +163,7 @@ 200.0000 100.0000 ! SU_LoadHoldDuration - Array containing duration to hold the partial loads during startup [s] !------- SHUTDOWN ----------------------------------------------------------- -0 ! SD_TimeActivate - Time to acitvate shutdown modes, [s] +0 ! SD_TimeActivate - Time to acitvate shutdown modes; no shutdown events will occur before this time. [s] 0 ! SD_EnablePitch - Shutdown when collective blade pitch exceeds a threshold, [-] 0 ! SD_EnableYawError - Shutdown when yaw error exceeds a threshold, [-] 0 ! SD_EnableGenSpeed - Shutdown when generator speed exceeds a threshold, [-] diff --git a/Examples/Test_Cases/IEA-15-240-RWT/IEA-15-240-RWT-UMaineSemi/IEA-15-240-RWT-UMaineSemi_DISCON.IN b/Examples/Test_Cases/IEA-15-240-RWT/IEA-15-240-RWT-UMaineSemi/IEA-15-240-RWT-UMaineSemi_DISCON.IN index 94f9632f..06da1ccf 100644 --- a/Examples/Test_Cases/IEA-15-240-RWT/IEA-15-240-RWT-UMaineSemi/IEA-15-240-RWT-UMaineSemi_DISCON.IN +++ b/Examples/Test_Cases/IEA-15-240-RWT/IEA-15-240-RWT-UMaineSemi/IEA-15-240-RWT-UMaineSemi_DISCON.IN @@ -1,5 +1,5 @@ ! Controller parameter input file for the IEA-15-240-RWT-UMaineSemi wind turbine -! - File written using ROSCO version 2.10.0 controller tuning logic on 09/08/25 +! - File written using ROSCO version 2.10.1 controller tuning logic on 11/26/25 !------- SIMULATION CONTROL ------------------------------------------------------------ 2 ! LoggingLevel - 0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3) @@ -101,7 +101,7 @@ !------- SETPOINT SMOOTHER --------------------------------------------- 1.00000 ! SS_VSGain - Variable speed torque controller setpoint smoother gain, [-]. -0.00100 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-]. +0.05000 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-]. !------- POWER REFERENCE TRACKING -------------------------------------- 0 ! PRC_Comm - Power reference communication mode when PRC_Mode = 2, 0- use constant DISCON inputs, 1- use open loop inputs, 2- use ZMQ inputs @@ -163,7 +163,7 @@ 200.0000 100.0000 ! SU_LoadHoldDuration - Array containing duration to hold the partial loads during startup [s] !------- SHUTDOWN ----------------------------------------------------------- -0 ! SD_TimeActivate - Time to acitvate shutdown modes, [s] +0 ! SD_TimeActivate - Time to acitvate shutdown modes; no shutdown events will occur before this time. [s] 0 ! SD_EnablePitch - Shutdown when collective blade pitch exceeds a threshold, [-] 0 ! SD_EnableYawError - Shutdown when yaw error exceeds a threshold, [-] 0 ! SD_EnableGenSpeed - Shutdown when generator speed exceeds a threshold, [-] diff --git a/Examples/Test_Cases/MHK_RM1/MHK_RM1_DISCON.IN b/Examples/Test_Cases/MHK_RM1/MHK_RM1_DISCON.IN index b651db66..2cdd0429 100644 --- a/Examples/Test_Cases/MHK_RM1/MHK_RM1_DISCON.IN +++ b/Examples/Test_Cases/MHK_RM1/MHK_RM1_DISCON.IN @@ -1,5 +1,5 @@ ! Controller parameter input file for the MHK_RM1_Floating wind turbine -! - File written using ROSCO version 2.10.0 controller tuning logic on 09/08/25 +! - File written using ROSCO version 2.10.1 controller tuning logic on 11/26/25 !------- SIMULATION CONTROL ------------------------------------------------------------ 2 ! LoggingLevel - 0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3) @@ -101,7 +101,7 @@ !------- SETPOINT SMOOTHER --------------------------------------------- 1.00000 ! SS_VSGain - Variable speed torque controller setpoint smoother gain, [-]. -0.00100 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-]. +0.05000 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-]. !------- POWER REFERENCE TRACKING -------------------------------------- 0 ! PRC_Comm - Power reference communication mode when PRC_Mode = 2, 0- use constant DISCON inputs, 1- use open loop inputs, 2- use ZMQ inputs @@ -163,7 +163,7 @@ 200.0000 100.0000 ! SU_LoadHoldDuration - Array containing duration to hold the partial loads during startup [s] !------- SHUTDOWN ----------------------------------------------------------- -0 ! SD_TimeActivate - Time to acitvate shutdown modes, [s] +0 ! SD_TimeActivate - Time to acitvate shutdown modes; no shutdown events will occur before this time. [s] 0 ! SD_EnablePitch - Shutdown when collective blade pitch exceeds a threshold, [-] 0 ! SD_EnableYawError - Shutdown when yaw error exceeds a threshold, [-] 0 ! SD_EnableGenSpeed - Shutdown when generator speed exceeds a threshold, [-] diff --git a/Examples/Test_Cases/NREL-5MW/DISCON.IN b/Examples/Test_Cases/NREL-5MW/DISCON.IN index 67bddf55..55446a80 100644 --- a/Examples/Test_Cases/NREL-5MW/DISCON.IN +++ b/Examples/Test_Cases/NREL-5MW/DISCON.IN @@ -1,5 +1,5 @@ ! Controller parameter input file for the NREL-5MW wind turbine -! - File written using ROSCO version 2.10.0 controller tuning logic on 09/08/25 +! - File written using ROSCO version 2.10.1 controller tuning logic on 11/26/25 !------- SIMULATION CONTROL ------------------------------------------------------------ 1 ! LoggingLevel - 0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3) @@ -101,7 +101,7 @@ !------- SETPOINT SMOOTHER --------------------------------------------- 1.00000 ! SS_VSGain - Variable speed torque controller setpoint smoother gain, [-]. -0.00100 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-]. +0.05000 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-]. !------- POWER REFERENCE TRACKING -------------------------------------- 0 ! PRC_Comm - Power reference communication mode when PRC_Mode = 2, 0- use constant DISCON inputs, 1- use open loop inputs, 2- use ZMQ inputs @@ -163,7 +163,7 @@ 200.0000 100.0000 ! SU_LoadHoldDuration - Array containing duration to hold the partial loads during startup [s] !------- SHUTDOWN ----------------------------------------------------------- -0 ! SD_TimeActivate - Time to acitvate shutdown modes, [s] +0 ! SD_TimeActivate - Time to acitvate shutdown modes; no shutdown events will occur before this time. [s] 0 ! SD_EnablePitch - Shutdown when collective blade pitch exceeds a threshold, [-] 0 ! SD_EnableYawError - Shutdown when yaw error exceeds a threshold, [-] 0 ! SD_EnableGenSpeed - Shutdown when generator speed exceeds a threshold, [-] diff --git a/Examples/Test_Cases/NREL_2p8_127/NREL-2p8-127_DISCON.IN b/Examples/Test_Cases/NREL_2p8_127/NREL-2p8-127_DISCON.IN index 6fe57878..f8cd243f 100644 --- a/Examples/Test_Cases/NREL_2p8_127/NREL-2p8-127_DISCON.IN +++ b/Examples/Test_Cases/NREL_2p8_127/NREL-2p8-127_DISCON.IN @@ -1,5 +1,5 @@ ! Controller parameter input file for the NREL-2p8-127 wind turbine -! - File written using ROSCO version 2.10.0 controller tuning logic on 09/08/25 +! - File written using ROSCO version 2.10.1 controller tuning logic on 11/26/25 !------- SIMULATION CONTROL ------------------------------------------------------------ 2 ! LoggingLevel - 0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3) @@ -163,7 +163,7 @@ 200.0000 100.0000 ! SU_LoadHoldDuration - Array containing duration to hold the partial loads during startup [s] !------- SHUTDOWN ----------------------------------------------------------- -0 ! SD_TimeActivate - Time to acitvate shutdown modes, [s] +0 ! SD_TimeActivate - Time to acitvate shutdown modes; no shutdown events will occur before this time. [s] 0 ! SD_EnablePitch - Shutdown when collective blade pitch exceeds a threshold, [-] 0 ! SD_EnableYawError - Shutdown when yaw error exceeds a threshold, [-] 0 ! SD_EnableGenSpeed - Shutdown when generator speed exceeds a threshold, [-] diff --git a/pyproject.toml b/pyproject.toml index dcbb19ad..4e64e501 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "rosco" -version = "2.10.2" +version = "2.10.3" description = "A reference open source controller toolset for wind turbine applications." readme = "README.md" requires-python = ">=3.9" diff --git a/rosco/controller/rosco_registry/rosco_types.yaml b/rosco/controller/rosco_registry/rosco_types.yaml index 0e5f13d2..9026f1c9 100644 --- a/rosco/controller/rosco_registry/rosco_types.yaml +++ b/rosco/controller/rosco_registry/rosco_types.yaml @@ -872,233 +872,233 @@ WE: FilterParameters: lpf1_a1: <<: *real - dimension: (99) + dimension: (1024) description: First order filter - Denominator coefficient 1 lpf1_a0: <<: *real - dimension: (99) + dimension: (1024) description: First order filter - Denominator coefficient 0 lpf1_b1: <<: *real - dimension: (99) + dimension: (1024) description: First order filter - Numerator coefficient 1 lpf1_b0: <<: *real - dimension: (99) + dimension: (1024) description: First order filter - Numerator coefficient 0 lpf1_InputSignalLast: <<: *real - dimension: (99) + dimension: (1024) description: First order filter - Previous input lpf1_OutputSignalLast: <<: *real - dimension: (99) + dimension: (1024) description: First order filter - Previous output lpf2_a2: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Denominator coefficient 2 lpf2_a1: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Denominator coefficient 1 lpf2_a0: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Denominator coefficient 0 lpf2_b2: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Numerator coefficient 2 lpf2_b1: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Numerator coefficient 1 lpf2_b0: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Numerator coefficient 0 lpf2_InputSignalLast2: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Previous input 2 lpf2_OutputSignalLast2: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Previous output 2 lpf2_InputSignalLast1: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Previous input 1 lpf2_OutputSignalLast1: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Previous output 1 lpfV_a2: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Denominator coefficient 1 lpfV_a1: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Denominator coefficient 1 lpfV_a0: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Denominator coefficient 0 lpfV_b2: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Numerator coefficient 2 lpfV_b1: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Numerator coefficient 1 lpfV_b0: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Numerator coefficient 0 lpfV_InputSignalLast2: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Previous input 2 lpfV_OutputSignalLast2: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Previous output 2 lpfV_InputSignalLast1: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Previous input 1 lpfV_OutputSignalLast1: <<: *real - dimension: (99) + dimension: (1024) description: Second order filter - Previous output 1 hpf_InputSignalLast: <<: *real - dimension: (99) + dimension: (1024) description: High pass filter - Previous output 1 hpf_OutputSignalLast: <<: *real - dimension: (99) + dimension: (1024) description: High pass filter - Previous output 1 nfs_OutputSignalLast1: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter slopes previous output 1 nfs_OutputSignalLast2: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter slopes previous output 2 nfs_InputSignalLast1: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter slopes previous input 1 nfs_InputSignalLast2: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter slopes previous input 1 nfs_b2: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter slopes numerator coefficient 2 nfs_b0: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter slopes numerator coefficient 0 nfs_a2: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter slopes denominator coefficient 2 nfs_a1: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter slopes denominator coefficient 1 nfs_a0: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter slopes denominator coefficient 0 nf_OutputSignalLast1: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter previous output 1 nf_OutputSignalLast2: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter previous output 2 nf_InputSignalLast1: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter previous input 1 nf_InputSignalLast2: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter previous input 2 nf_b2: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter numerator coefficient 2 nf_b1: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter numerator coefficient 1 nf_b0: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter numerator coefficient 0 nf_a1: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter denominator coefficient 1 nf_a0: <<: *real - dimension: (99) + dimension: (1024) description: Notch filter denominator coefficient 0 rlParams: LastSignal: <<: *real - dimension: (99) + dimension: (1024) description: Last input signal piParams: ITerm: <<: *real - dimension: (99) + dimension: (1024) description: Integrator term ITermLast: <<: *real - dimension: (99) + dimension: (1024) description: Previous integrator term ITerm2: <<: *real - dimension: (99) + dimension: (1024) description: Integrator term - second integrator ITermLast2: <<: *real - dimension: (99) + dimension: (1024) description: Previous integrator term - second integrator ELast: <<: *real - dimension: (99) + dimension: (1024) description: Previous error term for derivative resParams: res_OutputSignalLast1: <<: *real - dimension: (99) + dimension: (1024) description: Previous output signal res_OutputSignalLast2: <<: *real - dimension: (99) + dimension: (1024) description: Previous output signal - second integrator res_InputSignalLast1: <<: *real - dimension: (99) + dimension: (1024) description: Previous input signal res_InputSignalLast2: <<: *real - dimension: (99) + dimension: (1024) description: Previous input signal - second integrator LocalVariables: diff --git a/rosco/controller/src/ControllerBlocks.f90 b/rosco/controller/src/ControllerBlocks.f90 index d8988dcc..1d096a7f 100644 --- a/rosco/controller/src/ControllerBlocks.f90 +++ b/rosco/controller/src/ControllerBlocks.f90 @@ -803,7 +803,7 @@ SUBROUTINE RefSpeedExclusion(LocalVar, CntrPar, objInst, DebugVar) IF (LocalVar%FA_Hist > 0) THEN LocalVar%VS_RefSpd_TRA = LocalVar%TRA_LastRefSpd ELSE - LocalVar%VS_RefSpd_TRA = LocalVar%VS_RefSpd + LocalVar%VS_RefSpd_TRA = VS_RefSpeed_LSS END IF ! Save last reference speed diff --git a/rosco/controller/src/ROSCO_Types.f90 b/rosco/controller/src/ROSCO_Types.f90 index 3407f602..a843a04c 100644 --- a/rosco/controller/src/ROSCO_Types.f90 +++ b/rosco/controller/src/ROSCO_Types.f90 @@ -236,71 +236,71 @@ MODULE ROSCO_Types END TYPE WE TYPE, PUBLIC :: FilterParameters - REAL(DbKi), DIMENSION(99) :: lpf1_a1 ! First order filter - Denominator coefficient 1 - REAL(DbKi), DIMENSION(99) :: lpf1_a0 ! First order filter - Denominator coefficient 0 - REAL(DbKi), DIMENSION(99) :: lpf1_b1 ! First order filter - Numerator coefficient 1 - REAL(DbKi), DIMENSION(99) :: lpf1_b0 ! First order filter - Numerator coefficient 0 - REAL(DbKi), DIMENSION(99) :: lpf1_InputSignalLast ! First order filter - Previous input - REAL(DbKi), DIMENSION(99) :: lpf1_OutputSignalLast ! First order filter - Previous output - REAL(DbKi), DIMENSION(99) :: lpf2_a2 ! Second order filter - Denominator coefficient 2 - REAL(DbKi), DIMENSION(99) :: lpf2_a1 ! Second order filter - Denominator coefficient 1 - REAL(DbKi), DIMENSION(99) :: lpf2_a0 ! Second order filter - Denominator coefficient 0 - REAL(DbKi), DIMENSION(99) :: lpf2_b2 ! Second order filter - Numerator coefficient 2 - REAL(DbKi), DIMENSION(99) :: lpf2_b1 ! Second order filter - Numerator coefficient 1 - REAL(DbKi), DIMENSION(99) :: lpf2_b0 ! Second order filter - Numerator coefficient 0 - REAL(DbKi), DIMENSION(99) :: lpf2_InputSignalLast2 ! Second order filter - Previous input 2 - REAL(DbKi), DIMENSION(99) :: lpf2_OutputSignalLast2 ! Second order filter - Previous output 2 - REAL(DbKi), DIMENSION(99) :: lpf2_InputSignalLast1 ! Second order filter - Previous input 1 - REAL(DbKi), DIMENSION(99) :: lpf2_OutputSignalLast1 ! Second order filter - Previous output 1 - REAL(DbKi), DIMENSION(99) :: lpfV_a2 ! Second order filter - Denominator coefficient 1 - REAL(DbKi), DIMENSION(99) :: lpfV_a1 ! Second order filter - Denominator coefficient 1 - REAL(DbKi), DIMENSION(99) :: lpfV_a0 ! Second order filter - Denominator coefficient 0 - REAL(DbKi), DIMENSION(99) :: lpfV_b2 ! Second order filter - Numerator coefficient 2 - REAL(DbKi), DIMENSION(99) :: lpfV_b1 ! Second order filter - Numerator coefficient 1 - REAL(DbKi), DIMENSION(99) :: lpfV_b0 ! Second order filter - Numerator coefficient 0 - REAL(DbKi), DIMENSION(99) :: lpfV_InputSignalLast2 ! Second order filter - Previous input 2 - REAL(DbKi), DIMENSION(99) :: lpfV_OutputSignalLast2 ! Second order filter - Previous output 2 - REAL(DbKi), DIMENSION(99) :: lpfV_InputSignalLast1 ! Second order filter - Previous input 1 - REAL(DbKi), DIMENSION(99) :: lpfV_OutputSignalLast1 ! Second order filter - Previous output 1 - REAL(DbKi), DIMENSION(99) :: hpf_InputSignalLast ! High pass filter - Previous output 1 - REAL(DbKi), DIMENSION(99) :: hpf_OutputSignalLast ! High pass filter - Previous output 1 - REAL(DbKi), DIMENSION(99) :: nfs_OutputSignalLast1 ! Notch filter slopes previous output 1 - REAL(DbKi), DIMENSION(99) :: nfs_OutputSignalLast2 ! Notch filter slopes previous output 2 - REAL(DbKi), DIMENSION(99) :: nfs_InputSignalLast1 ! Notch filter slopes previous input 1 - REAL(DbKi), DIMENSION(99) :: nfs_InputSignalLast2 ! Notch filter slopes previous input 1 - REAL(DbKi), DIMENSION(99) :: nfs_b2 ! Notch filter slopes numerator coefficient 2 - REAL(DbKi), DIMENSION(99) :: nfs_b0 ! Notch filter slopes numerator coefficient 0 - REAL(DbKi), DIMENSION(99) :: nfs_a2 ! Notch filter slopes denominator coefficient 2 - REAL(DbKi), DIMENSION(99) :: nfs_a1 ! Notch filter slopes denominator coefficient 1 - REAL(DbKi), DIMENSION(99) :: nfs_a0 ! Notch filter slopes denominator coefficient 0 - REAL(DbKi), DIMENSION(99) :: nf_OutputSignalLast1 ! Notch filter previous output 1 - REAL(DbKi), DIMENSION(99) :: nf_OutputSignalLast2 ! Notch filter previous output 2 - REAL(DbKi), DIMENSION(99) :: nf_InputSignalLast1 ! Notch filter previous input 1 - REAL(DbKi), DIMENSION(99) :: nf_InputSignalLast2 ! Notch filter previous input 2 - REAL(DbKi), DIMENSION(99) :: nf_b2 ! Notch filter numerator coefficient 2 - REAL(DbKi), DIMENSION(99) :: nf_b1 ! Notch filter numerator coefficient 1 - REAL(DbKi), DIMENSION(99) :: nf_b0 ! Notch filter numerator coefficient 0 - REAL(DbKi), DIMENSION(99) :: nf_a1 ! Notch filter denominator coefficient 1 - REAL(DbKi), DIMENSION(99) :: nf_a0 ! Notch filter denominator coefficient 0 + REAL(DbKi), DIMENSION(1024) :: lpf1_a1 ! First order filter - Denominator coefficient 1 + REAL(DbKi), DIMENSION(1024) :: lpf1_a0 ! First order filter - Denominator coefficient 0 + REAL(DbKi), DIMENSION(1024) :: lpf1_b1 ! First order filter - Numerator coefficient 1 + REAL(DbKi), DIMENSION(1024) :: lpf1_b0 ! First order filter - Numerator coefficient 0 + REAL(DbKi), DIMENSION(1024) :: lpf1_InputSignalLast ! First order filter - Previous input + REAL(DbKi), DIMENSION(1024) :: lpf1_OutputSignalLast ! First order filter - Previous output + REAL(DbKi), DIMENSION(1024) :: lpf2_a2 ! Second order filter - Denominator coefficient 2 + REAL(DbKi), DIMENSION(1024) :: lpf2_a1 ! Second order filter - Denominator coefficient 1 + REAL(DbKi), DIMENSION(1024) :: lpf2_a0 ! Second order filter - Denominator coefficient 0 + REAL(DbKi), DIMENSION(1024) :: lpf2_b2 ! Second order filter - Numerator coefficient 2 + REAL(DbKi), DIMENSION(1024) :: lpf2_b1 ! Second order filter - Numerator coefficient 1 + REAL(DbKi), DIMENSION(1024) :: lpf2_b0 ! Second order filter - Numerator coefficient 0 + REAL(DbKi), DIMENSION(1024) :: lpf2_InputSignalLast2 ! Second order filter - Previous input 2 + REAL(DbKi), DIMENSION(1024) :: lpf2_OutputSignalLast2 ! Second order filter - Previous output 2 + REAL(DbKi), DIMENSION(1024) :: lpf2_InputSignalLast1 ! Second order filter - Previous input 1 + REAL(DbKi), DIMENSION(1024) :: lpf2_OutputSignalLast1 ! Second order filter - Previous output 1 + REAL(DbKi), DIMENSION(1024) :: lpfV_a2 ! Second order filter - Denominator coefficient 1 + REAL(DbKi), DIMENSION(1024) :: lpfV_a1 ! Second order filter - Denominator coefficient 1 + REAL(DbKi), DIMENSION(1024) :: lpfV_a0 ! Second order filter - Denominator coefficient 0 + REAL(DbKi), DIMENSION(1024) :: lpfV_b2 ! Second order filter - Numerator coefficient 2 + REAL(DbKi), DIMENSION(1024) :: lpfV_b1 ! Second order filter - Numerator coefficient 1 + REAL(DbKi), DIMENSION(1024) :: lpfV_b0 ! Second order filter - Numerator coefficient 0 + REAL(DbKi), DIMENSION(1024) :: lpfV_InputSignalLast2 ! Second order filter - Previous input 2 + REAL(DbKi), DIMENSION(1024) :: lpfV_OutputSignalLast2 ! Second order filter - Previous output 2 + REAL(DbKi), DIMENSION(1024) :: lpfV_InputSignalLast1 ! Second order filter - Previous input 1 + REAL(DbKi), DIMENSION(1024) :: lpfV_OutputSignalLast1 ! Second order filter - Previous output 1 + REAL(DbKi), DIMENSION(1024) :: hpf_InputSignalLast ! High pass filter - Previous output 1 + REAL(DbKi), DIMENSION(1024) :: hpf_OutputSignalLast ! High pass filter - Previous output 1 + REAL(DbKi), DIMENSION(1024) :: nfs_OutputSignalLast1 ! Notch filter slopes previous output 1 + REAL(DbKi), DIMENSION(1024) :: nfs_OutputSignalLast2 ! Notch filter slopes previous output 2 + REAL(DbKi), DIMENSION(1024) :: nfs_InputSignalLast1 ! Notch filter slopes previous input 1 + REAL(DbKi), DIMENSION(1024) :: nfs_InputSignalLast2 ! Notch filter slopes previous input 1 + REAL(DbKi), DIMENSION(1024) :: nfs_b2 ! Notch filter slopes numerator coefficient 2 + REAL(DbKi), DIMENSION(1024) :: nfs_b0 ! Notch filter slopes numerator coefficient 0 + REAL(DbKi), DIMENSION(1024) :: nfs_a2 ! Notch filter slopes denominator coefficient 2 + REAL(DbKi), DIMENSION(1024) :: nfs_a1 ! Notch filter slopes denominator coefficient 1 + REAL(DbKi), DIMENSION(1024) :: nfs_a0 ! Notch filter slopes denominator coefficient 0 + REAL(DbKi), DIMENSION(1024) :: nf_OutputSignalLast1 ! Notch filter previous output 1 + REAL(DbKi), DIMENSION(1024) :: nf_OutputSignalLast2 ! Notch filter previous output 2 + REAL(DbKi), DIMENSION(1024) :: nf_InputSignalLast1 ! Notch filter previous input 1 + REAL(DbKi), DIMENSION(1024) :: nf_InputSignalLast2 ! Notch filter previous input 2 + REAL(DbKi), DIMENSION(1024) :: nf_b2 ! Notch filter numerator coefficient 2 + REAL(DbKi), DIMENSION(1024) :: nf_b1 ! Notch filter numerator coefficient 1 + REAL(DbKi), DIMENSION(1024) :: nf_b0 ! Notch filter numerator coefficient 0 + REAL(DbKi), DIMENSION(1024) :: nf_a1 ! Notch filter denominator coefficient 1 + REAL(DbKi), DIMENSION(1024) :: nf_a0 ! Notch filter denominator coefficient 0 END TYPE FilterParameters TYPE, PUBLIC :: rlParams - REAL(DbKi), DIMENSION(99) :: LastSignal ! Last input signal + REAL(DbKi), DIMENSION(1024) :: LastSignal ! Last input signal END TYPE rlParams TYPE, PUBLIC :: piParams - REAL(DbKi), DIMENSION(99) :: ITerm ! Integrator term - REAL(DbKi), DIMENSION(99) :: ITermLast ! Previous integrator term - REAL(DbKi), DIMENSION(99) :: ITerm2 ! Integrator term - second integrator - REAL(DbKi), DIMENSION(99) :: ITermLast2 ! Previous integrator term - second integrator - REAL(DbKi), DIMENSION(99) :: ELast ! Previous error term for derivative + REAL(DbKi), DIMENSION(1024) :: ITerm ! Integrator term + REAL(DbKi), DIMENSION(1024) :: ITermLast ! Previous integrator term + REAL(DbKi), DIMENSION(1024) :: ITerm2 ! Integrator term - second integrator + REAL(DbKi), DIMENSION(1024) :: ITermLast2 ! Previous integrator term - second integrator + REAL(DbKi), DIMENSION(1024) :: ELast ! Previous error term for derivative END TYPE piParams TYPE, PUBLIC :: resParams - REAL(DbKi), DIMENSION(99) :: res_OutputSignalLast1 ! Previous output signal - REAL(DbKi), DIMENSION(99) :: res_OutputSignalLast2 ! Previous output signal - second integrator - REAL(DbKi), DIMENSION(99) :: res_InputSignalLast1 ! Previous input signal - REAL(DbKi), DIMENSION(99) :: res_InputSignalLast2 ! Previous input signal - second integrator + REAL(DbKi), DIMENSION(1024) :: res_OutputSignalLast1 ! Previous output signal + REAL(DbKi), DIMENSION(1024) :: res_OutputSignalLast2 ! Previous output signal - second integrator + REAL(DbKi), DIMENSION(1024) :: res_InputSignalLast1 ! Previous input signal + REAL(DbKi), DIMENSION(1024) :: res_InputSignalLast2 ! Previous input signal - second integrator END TYPE resParams TYPE, PUBLIC :: LocalVariables diff --git a/rosco/toolbox/inputs/toolbox_schema.yaml b/rosco/toolbox/inputs/toolbox_schema.yaml index c52b5a70..84c60128 100644 --- a/rosco/toolbox/inputs/toolbox_schema.yaml +++ b/rosco/toolbox/inputs/toolbox_schema.yaml @@ -332,8 +332,12 @@ properties: ss_pcgain: description: Pitch controller setpoint smoother gain bias percentage [%, <= 1 ], {default = 0.1%} type: number - default: 0.001 + default: 0.05 unit: rad + ss_separation: + description: Decrease torque control gain by this amount (fraction) + type: number + default: 0.0 ps_percent: description: Percent peak shaving [%, <= 1 ], {default = 80%} type: number diff --git a/rosco/toolbox/utilities.py b/rosco/toolbox/utilities.py index 65c77e90..a4b116b4 100644 --- a/rosco/toolbox/utilities.py +++ b/rosco/toolbox/utilities.py @@ -253,7 +253,7 @@ def write_DISCON(turbine, controller, param_file='DISCON.IN', txt_filename='Cp_C file.write('{} ! SU_LoadHoldDuration - {}\n'.format(write_array(rosco_vt["SU_LoadHoldDuration"]), input_descriptions["SU_LoadHoldDuration"])) file.write('\n') file.write('!------- SHUTDOWN -----------------------------------------------------------\n') - file.write('{0:<12d} ! SD_TimeActivate - Time to acitvate shutdown modes, [s]\n'.format(int(rosco_vt['SD_TimeActivate']))) + file.write('{0:<12d} ! SD_TimeActivate - Time to acitvate shutdown modes; no shutdown events will occur before this time. [s]\n'.format(int(rosco_vt['SD_TimeActivate']))) file.write('{0:<12d} ! SD_EnablePitch - Shutdown when collective blade pitch exceeds a threshold, [-]\n'.format(int(rosco_vt['SD_EnablePitch']))) file.write('{0:<12d} ! SD_EnableYawError - Shutdown when yaw error exceeds a threshold, [-]\n'.format(int(rosco_vt['SD_EnableYawError']))) file.write('{0:<12d} ! SD_EnableGenSpeed - Shutdown when generator speed exceeds a threshold, [-]\n'.format(int(rosco_vt['SD_EnableGenSpeed']))) @@ -599,7 +599,7 @@ def DISCON_dict(turbine, controller, txt_filename=None): DISCON_dict['VS_Rgn2K'] = controller.vs_rgn2K DISCON_dict['VS_RtPwr'] = turbine.rated_power DISCON_dict['VS_RtTq'] = turbine.rated_torque - DISCON_dict['VS_RefSpd'] = controller.vs_refspd + DISCON_dict['VS_RefSpd'] = controller.vs_refspd * (1 - controller.controller_params['ss_separation']) DISCON_dict['VS_n'] = 1 DISCON_dict['VS_KP'] = controller.vs_gain_schedule.Kp[-1] DISCON_dict['VS_KI'] = controller.vs_gain_schedule.Ki[-1]