Skip to content

Commit

Permalink
Update examples, testing for conda-installed openfast call
Browse files Browse the repository at this point in the history
  • Loading branch information
dzalkind committed Feb 2, 2021
1 parent 639a23f commit b492424
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
9 changes: 6 additions & 3 deletions Examples/example_06.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
this_dir = os.path.dirname(__file__)

# Load yaml file
parameter_filename = os.path.join(this_dir,'NREL5MW_example.yaml')
parameter_filename = '/Users/dzalkind/Tools/ROSCO_toolbox/Tune_Cases/BAR.yaml' #os.path.join(this_dir,'NREL5MW_example.yaml') #
inps = yaml.safe_load(open(parameter_filename))
path_params = inps['path_params']
turbine_params = inps['turbine_params']
Expand All @@ -33,7 +33,10 @@
controller = ROSCO_controller.Controller(controller_params)

# Load turbine data from OpenFAST and rotor performance text file
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'])
turbine.load_from_fast(path_params['FAST_InputFile'], \
os.path.join(this_dir,path_params['FAST_directory']), \
dev_branch=True,rot_source='txt',\
txt_filename=os.path.join(this_dir,path_params['FAST_directory'],path_params['rotor_performance_filename']))

# Tune controller
controller.tune_controller(turbine)
Expand All @@ -44,7 +47,7 @@

# Run OpenFAST
# --- May need to change fastcall if you use a non-standard command to call openfast
run_openfast(path_params['FAST_directory'], fastcall='openfast_sdev', fastfile=path_params['FAST_InputFile'], chdir=True)
run_openfast(path_params['FAST_directory'], fastcall='openfast', fastfile=path_params['FAST_InputFile'], chdir=True)



Expand Down
2 changes: 1 addition & 1 deletion Examples/example_09.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
wind_directory = os.path.join(this_dir,'../Test_Cases/Wind/')
turbsim_infile = '90m_12mps_twr.inp'

run_openfast(wind_directory, fastcall='turbsim_sdev', fastfile=turbsim_infile, chdir=False)
run_openfast(wind_directory, fastcall='turbsim', fastfile=turbsim_infile, chdir=False)

10 changes: 4 additions & 6 deletions ROSCO_testing/run_Testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,14 @@ def run_testing(turbine2test, testtype, rosco_binaries=[], discon_files=[], **kw
if __name__ == "__main__":

# WEIS directory, for running openfast, etc.
# weis_dir = os.environ.get('weis_dir') # works if we do `export weis_dir=$(pwd)` in WEIS directory in terminal
weis_dir = '/Users/dzalkind/Tools/WEIS-3'
this_dir = os.path.dirname(__file__)

# Setup ROSCO testing parameters
rt_kwargs = {}
rt_kwargs['runDir'] = os.path.join(this_dir,'results/') # directory for FAST simulations
rt_kwargs['namebase'] = 'lite_test' # Base name for FAST files
rt_kwargs['FAST_exe'] = os.path.join(weis_dir,'local','bin','openfast') # OpenFAST executable path
rt_kwargs['Turbsim_exe']= os.path.join(weis_dir,'local','bin','turbsim') # Turbsim executable path
rt_kwargs['FAST_exe'] = 'openfast' # OpenFAST executable path
rt_kwargs['Turbsim_exe']= 'turbsim' # Turbsim executable path
rt_kwargs['FAST_ver'] = 'OpenFAST' # FAST version
rt_kwargs['dev_branch'] = True # dev branch of Openfast?
rt_kwargs['debug_level']= 2 # debug level. 0 - no outputs, 1 - minimal outputs, 2 - all outputs
Expand All @@ -99,11 +97,11 @@ def run_testing(turbine2test, testtype, rosco_binaries=[], discon_files=[], **kw
rt_kwargs['outfile_fmt'] = 2 # 1 = .txt, 2 = binary, 3 = both

# ---- Define test type ----
turbine2test = 'IEA-15MW' # IEA-15MW or NREL-5MW
turbine2test = 'NREL-5MW' # IEA-15MW or NREL-5MW
testtype = 'lite' # lite, heavy, binary-comp, discon-comp

# Only fill one of these if comparing controllers
rosco_binaries = [glob.glob(os.path.join(this_dir,'../ROSCO/build/libdiscon*'))[0]] # Differently named libdiscons to compare
rosco_binaries = [glob.glob(os.path.join(this_dir,'../ROSCO/build/libdiscon.*'))[0]] # Differently named libdiscons to compare
discon_files = [] # Differently named DISCON.IN files to compare


Expand Down
2 changes: 1 addition & 1 deletion ROSCO_toolbox/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def DISCON_dict(turbine, controller, txt_filename=None):
return DISCON_dict


def run_openfast(fast_dir,fastcall='OpenFAST',fastfile=None,chdir=False):
def run_openfast(fast_dir,fastcall='openfast',fastfile=None,chdir=False):
'''
Runs a openfast openfast simulation.
Expand Down

0 comments on commit b492424

Please sign in to comment.