Skip to content

Commit

Permalink
Use turbine specific rotor performance files
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhar-abbas committed Oct 31, 2019
1 parent d8670c9 commit d627f06
Show file tree
Hide file tree
Showing 6 changed files with 255 additions and 31 deletions.
93 changes: 93 additions & 0 deletions Tune_Cases/Cp_Ct_Cq.DTU10MW.txt

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions Tune_Cases/Cp_Ct_Cq.NREL5MW.txt

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion Tune_Cases/DTU10MW.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ path_params:
FAST_InputFile: 'DTU_10MW_RWT.fst' # Name of *.fst file
FAST_directory: '/Users/nabbas/Documents/TurbineModels/DTU_10MW/DTU10MWRWT/Baseline' # Main OpenFAST model directory, where the *.fst lives
# Optional
rotor_performance_filename: #'Cp_Ct_Cq.txt' # Filename for rotor performance text file (if it has been generated by ccblade already)
rotor_performance_filename: 'Cp_Ct_Cq.DTU10MW.txt' # Filename for rotor performance text file (if it has been generated by ccblade already)

# -------------------------------- TURBINE PARAMETERS -----------------------------------
turbine_params:
Expand All @@ -22,6 +22,18 @@ turbine_params:

#------------------------------- CONTROLLER PARAMETERS ----------------------------------
controller_params:
# Controller flags
LoggingLevel: 1 # {0: write no debug files, 1: write standard output .dbg-file, 2: write standard output .dbg-file and complete avrSWAP-array .dbg2-file
F_LPFType: 1 # {1: first-order low-pass filter, 2: second-order low-pass filter}, [rad/s] (currently filters generator speed and pitch control signals)
F_NotchType: 0 # Notch on the measured generator speed {0: disable, 1: enable}
IPC_ControlMode: 0 # Turn Individual Pitch Control (IPC) for fatigue load reductions (pitch contribution) {0: off, 1: 1P reductions, 2: 1P+2P reductions}
VS_ControlMode: 2 # Generator torque control mode in above rated conditions {0: constant torque, 1: constant power, 2: TSR tracking PI control}
PC_ControlMode: 1 # Blade pitch control mode {0: No pitch, fix to fine pitch, 1: active PI blade pitch control}
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}
# Controller parameters
zeta_pc: 0.8 # Pitch controller desired damping ratio [-]
omega_pc: 0.3 # Pitch controller desired natural frequency [rad/s]
zeta_vs: 0.7 # Torque controller desired damping ratio [-]
Expand Down
2 changes: 1 addition & 1 deletion Tune_Cases/NREL5MW.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ path_params:
FAST_directory: '/Users/nabbas/Downloads/OpenFAST_5MW' # Main OpenFAST model directory, where the *.fst lives
# FAST_directory: '/Users/nabbas/Documents/WindEnergyToolbox/WTC_toolbox/Test_Cases/5MW_Land' # Main OpenFAST model directory, where the *.fst is
# Optional
rotor_performance_filename: 'Cp_Ct_Cq_NREL5MW.txt' # Filename for rotor performance text file (if it has been generated by ccblade already)
rotor_performance_filename: 'Cp_Ct_Cq.NREL5MW.txt' # Filename for rotor performance text file (if it has been generated by ccblade already)

# -------------------------------- TURBINE PARAMETERS -----------------------------------
turbine_params:
Expand Down
55 changes: 36 additions & 19 deletions Tune_Cases/tune_DTU10MW.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Controller Tuning Script for NREL-5MW Wind Turbine
# -- Made to run the tools distributed as a part of the WTC_Toolbox
# -- Made to run the tools distributed as a part of the ROSCO_Toolbox

#-------------------------------- LOAD INPUT PARAMETERS ---------------------------------#
parameter_filename = 'DTU10MW.yaml' # Name of .yaml input file for the specific turbine


#----------------------------------------------------------------------------------------#
#--------------------- NOTHING SHOULD NEED TO CHANGE AFTER THIS -------------------------#
#----------------------------------------------------------------------------------------#


#------------------------------------- INITIALIZATION ----------------------------------#
# Import python modules
Expand All @@ -8,14 +17,14 @@
import matplotlib.pyplot as plt
import yaml
import os
# Import WTC_Toolbox modules
from WTC_toolbox import controller as wtc_controller
from WTC_toolbox import turbine as wtc_turbine
from WTC_toolbox import sim as wtc_sim

os.chdir('/Users/nabbas/Documents/WindEnergyToolbox/WTC_toolbox/Tune_Cases')
#-------------------------------- LOAD INPUT PARAMETERS ---------------------------------#
parameter_filename = 'DTU10MW.yaml' # Name of .yaml input file for the specific turbine
# Import ROSCO_toolbox modules
from ROSCO_toolbox import controller as wtc_controller
from ROSCO_toolbox import turbine as wtc_turbine
from ROSCO_toolbox import sim as wtc_sim
from ROSCO_toolbox import utilities as wtc_utilities
# Initialize parameter dictionaries
turbine_params = {}
control_params = {}

# Load input file contents, put them in some dictionaries to keep things cleaner
inps = yaml.safe_load(open(parameter_filename))
Expand All @@ -24,22 +33,30 @@
controller_params = inps['controller_params']

#---------------------------------- DO THE FUN STUFF ------------------------------------#
# Initialiize turbine, controller, and file processing classes
# Initialiize turbine and controller
turbine = wtc_turbine.Turbine(turbine_params)
controller = wtc_controller.Controller(controller_params)
file_processing = wtc_controller.FileProcessing()
file_processing = wtc_utilities.FileProcessing()

# Load Turbine
if inps['path_params']['rotor_performance_filename']:
turbine.load_from_fast(path_params['FAST_InputFile'],path_params['FAST_directory'],dev_branch=True,rot_source='txt',txt_filename=path_params['rotor_performance_filename'])
# Load Turbine, write rotor performance file if it doesn't exist
if path_params['rotor_performance_filename']:
if os.path.exists(path_params['rotor_performance_filename']):
turbine.load_from_fast(path_params['FAST_InputFile'],path_params['FAST_directory'],dev_branch=True,rot_source='txt',txt_filename=path_params['rotor_performance_filename'])
else:
turbine.load_from_fast(path_params['FAST_InputFile'],path_params['FAST_directory'],dev_branch=True,rot_source=None, txt_filename=path_params['rotor_performance_filename'])
file_processing.write_rotor_performance(turbine,txt_filename=path_params['rotor_performance_filename'])
else:
turbine.load_from_fast(path_params['FAST_InputFile'],path_params['FAST_directory'],dev_branch=True,rot_source=None)
# Write rotor performance file
turbine.write_rotorperformance(txt_filename='Cp_Ct_Cq.txt')
file_processing.write_rotor_performance(turbine,txt_filename=path_params['rotor_performance_filename'])

# Tune controller
# Initialize controller tuning and tune controller
controller = wtc_controller.Controller(controller_params)
controller.tune_controller(turbine)

# Initialize
# Write parameter input file
param_file = 'DISCON.IN' # This must be named DISCON.IN to be seen by the compiled controller binary.
file_processing.write_param_file(param_file,turbine,controller,new_file=True)
file_processing.write_param_file(turbine,controller,param_file=param_file, txt_filename=path_params['rotor_performance_filename'])

# plot rotor performance
turbine.Cp.plot_performance(turbine.Cp_table, turbine.pitch_initial_rad, turbine.TSR_initial)
plt.show()
29 changes: 19 additions & 10 deletions Tune_Cases/tune_NREL5MW.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Controller Tuning Script for NREL-5MW Wind Turbine
# -- Made to run the tools distributed as a part of the WTC_Toolbox
# -- Made to run the tools distributed as a part of the ROSCO_Toolbox

#-------------------------------- LOAD INPUT PARAMETERS ---------------------------------#
parameter_filename = 'NREL5MW.yaml' # Name of .yaml input file for the specific turbine


#----------------------------------------------------------------------------------------#
#--------------------- NOTHING SHOULD NEED TO CHANGE AFTER THIS -------------------------#
#----------------------------------------------------------------------------------------#


#------------------------------------- INITIALIZATION ----------------------------------#
# Import python modules
Expand All @@ -17,9 +26,6 @@
turbine_params = {}
control_params = {}

#-------------------------------- LOAD INPUT PARAMETERS ---------------------------------#
parameter_filename = 'NREL5MW.yaml' # Name of .yaml input file for the specific turbine

# Load input file contents, put them in some dictionaries to keep things cleaner
inps = yaml.safe_load(open(parameter_filename))
path_params = inps['path_params']
Expand All @@ -31,13 +37,16 @@
turbine = wtc_turbine.Turbine(turbine_params)
file_processing = wtc_utilities.FileProcessing()

# Load Turbine
if inps['path_params']['rotor_performance_filename']:
turbine.load_from_fast(path_params['FAST_InputFile'],path_params['FAST_directory'],dev_branch=True,rot_source='txt',txt_filename=path_params['rotor_performance_filename'])
# Load Turbine, write rotor performance file if it doesn't exist
if path_params['rotor_performance_filename']:
if os.path.exists(path_params['rotor_performance_filename']):
turbine.load_from_fast(path_params['FAST_InputFile'],path_params['FAST_directory'],dev_branch=True,rot_source='txt',txt_filename=path_params['rotor_performance_filename'])
else:
turbine.load_from_fast(path_params['FAST_InputFile'],path_params['FAST_directory'],dev_branch=True,rot_source=None, txt_filename=path_params['rotor_performance_filename'])
file_processing.write_rotor_performance(turbine,txt_filename=path_params['rotor_performance_filename'])
else:
turbine.load_from_fast(path_params['FAST_InputFile'],path_params['FAST_directory'],dev_branch=True,rot_source=None)
# Write rotor performance file
file_processing.write_rotor_performance(turbine,txt_filename='Cp_Ct_Cq.txt')
file_processing.write_rotor_performance(turbine,txt_filename=path_params['rotor_performance_filename'])

# Initialize controller tuning and tune controller
controller = wtc_controller.Controller(controller_params)
Expand All @@ -46,7 +55,7 @@
# Initialize
# Write parameter input file
param_file = 'DISCON.IN' # This must be named DISCON.IN to be seen by the compiled controller binary.
file_processing.write_param_file(turbine,controller,param_file=param_file)
file_processing.write_param_file(turbine,controller,param_file=param_file, txt_filename=path_params['rotor_performance_filename'])

# plot rotor performance
turbine.Cp.plot_performance(turbine.Cp_table, turbine.pitch_initial_rad, turbine.TSR_initial)
Expand Down

0 comments on commit d627f06

Please sign in to comment.