forked from WISDEM/WEIS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22d6f40
commit 92fdb43
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Controller Tuning Script for NREL-5MW Wind Turbine | ||
# -- Made to run the tools distributed as a part of the WTC_Toolbox | ||
|
||
#------------------------------------- INITIALIZATION ----------------------------------# | ||
# Import python modules | ||
import numpy as np | ||
from scipy import interpolate | ||
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 | ||
|
||
# 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'] | ||
turbine_params = inps['turbine_params'] | ||
controller_params = inps['controller_params'] | ||
|
||
#---------------------------------- DO THE FUN STUFF ------------------------------------# | ||
# Initialiize turbine, controller, and file processing classes | ||
turbine = wtc_turbine.Turbine(turbine_params) | ||
controller = wtc_controller.Controller(controller_params) | ||
file_processing = wtc_controller.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']) | ||
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') | ||
|
||
# Tune controller | ||
controller.tune_controller(turbine) | ||
|
||
# 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) |