-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed 'ROSCO_toolbox/' changes from 571baad..610755e
610755e load aeroelasticse from weis 3584c07 Hardcode debug outname 4b891d8 Revert "Update ROSCO pointer" 008c076 Update ROSCO pointer fbb5cbc fix previous commit with channel names 457a725 fix previous commit 954ef1e load binaries b1fe191 Optional wind speed, TMax inputs 12fbbd0 update path 1c4650b check for ROSCO path 17fbb65 Delete old test case run script bd39933 ROSCO testing as class, rename file 5d61c3c Increment version 46c42f8 Remove GBoxEff from rated torque 0653114 Increment version 37a4a8b More minimum pitch bug fixes b946e20 Check for spectral in WISDEM 187c2e1 Minimum pitch setting minor bug fix 4892573 typo fixes d0ee3cd Update requirements ac712ba move scripts to source folder, typos fixes, cleanup 494a7ab master doc as index dfc9c2a Standard use descriptions 644861c Compiling and DISCON generation - initial commit 6e2be5a Update project info 616bf27 readthedocs - initial commit 2937b19 Delete old files b6d4324 Dump outdata to structure and plot f1de571 formatting 3eb2b90 Load times from input files 057de6d Add checks for optional input files 4159ba5 Update Pl_FastPlots.m 0a03336 Revert examples 6 and 8 077b8d5 Create README.md 3da66f1 Fix some Simulink initial condition issues 4eb6466 Update ROSCO pointer b29d62b Add ROSCO Simulink Model and simple Matlab/Simulink run case 2866ebd Update ROSCO test, add to gitignore 637c3a1 Increment version 8ff621f Update submodule bb91651 Rename license file 707e898 Typo c635f7d Move output variables to init 52b2406 Run Testing - initial commit edb341f error handling bug fixes 6e6bb66 properly pass desired output channels 078e35f clean up filepaths bf2a441 6 minute test time for lite testing 5e05be9 ROSCO testing as class, rename file 301a7a3 Create testing suite init b94be5b Update test cases 913482a Merge remote-tracking branch 'dzalkind/master' into f/testing REVERT: 571baad Merge branch 'develop' of https://github.com/NREL/ROSCO_toolbox into develop REVERT: 9f2cf6a Increment version REVERT: 53cf8c2 Remove GBoxEff from rated torque REVERT: 4d43650 fix previous commit with channel names REVERT: 446186d fix previous commit REVERT: 2bf1888 load binaries REVERT: ed7f394 Increment version REVERT: 4e4e3f9 Merge branch 'hotfix/min_pitch' REVERT: 0a977d9 More minimum pitch bug fixes REVERT: 8744956 Check for spectral in WISDEM REVERT: 4351c05 Minimum pitch setting minor bug fix REVERT: 4ad87a8 typo fixes REVERT: 5cbcc31 Update requirements REVERT: de4bee2 move scripts to source folder, typos fixes, cleanup REVERT: b94f543 master doc as index REVERT: bb5ded1 Standard use descriptions REVERT: 9ae9d37 Compiling and DISCON generation - initial commit REVERT: 391da4a Update project info REVERT: 117333f readthedocs - initial commit REVERT: e4b3edb Merge pull request #18 from dzalkind/simulink REVERT: 5fa1bb9 Delete old files REVERT: 57196b7 Dump outdata to structure and plot REVERT: 3203430 formatting REVERT: 8b77df8 Load times from input files REVERT: 9424afb Add checks for optional input files REVERT: 8f0cdb7 Update Pl_FastPlots.m REVERT: 7122637 Revert examples 6 and 8 REVERT: 877a4b2 Revert "Update ROSCO pointer" REVERT: cc3b6fd Merge remote-tracking branch 'origin/master' into simulink REVERT: 2b7ef0e Fix some Simulink initial condition issues REVERT: a4a3dbe Create README.md REVERT: 29a1c65 Update ROSCO pointer REVERT: 76d2189 Increment version REVERT: bc29969 Increment version REVERT: 008260e Merge pull request #16 from NREL/develop REVERT: 963617e Update submodule REVERT: b0e4aeb Rename license file REVERT: 457a408 Add ROSCO Simulink Model and simple Matlab/Simulink run case REVERT: 1cd1bba Update ROSCO test, add to gitignore git-subtree-dir: ROSCO_toolbox git-subtree-split: 610755e876c9e942cccc1b1531a7ba6ab0574e0e
- Loading branch information
1 parent
df86611
commit 0160654
Showing
86 changed files
with
865 additions
and
212,074 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,5 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Testing package for the ROSCO controller.""" | ||
|
||
__author__ = """Dan Zalkind and Nikhar J. Abbas""" | ||
__email__ = 'daniel.zalkind@nrel.gov' |
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,190 @@ | ||
|
||
''' | ||
Run ROSCO lite testing scripts for controller functionality verification | ||
''' | ||
import os | ||
import glob | ||
import ROSCO_testing | ||
import importlib | ||
|
||
from wisdem.aeroelasticse.Util import FileTools | ||
from pCrunch import pdTools | ||
from pCrunch import Processing, Analysis | ||
|
||
rt = ROSCO_testing.ROSCO_testing() | ||
|
||
|
||
## =================== INITIALIZATION =================== | ||
turbine2test = 'NREL-5MW' # IEA-15MW | ||
testtype = 'binary-comp' # lite, heavy, binary-comp, discon-comp | ||
|
||
# Only fill one of these if comparing controllers | ||
rosco_binaries = [os.path.join(os.getcwd(), glob.glob('../ROSCO/build/libdiscon*')[0]), | ||
os.path.join(os.getcwd(), glob.glob('../ROSCO/build/libdiscon*')[0])] | ||
discon_files = [] | ||
|
||
# Setup simulation parameters | ||
rt.runDir = 'lite_testing' # directory for FAST simulations | ||
rt.namebase = 'ROSCO_lite_test' # Base name for FAST files | ||
rt.FAST_exe = 'openfast_single' # OpenFAST executable path | ||
rt.Turbsim_exe = 'turbsim_single' # Turbsim executable path | ||
rt.FAST_ver = 'OpenFAST' # FAST version | ||
rt.rosco_path = os.path.join(os.getcwd(), glob.glob('../ROSCO/build/libdiscon*')[0]) # path to compiled ROSCO controller | ||
rt.dev_branch = True # dev branch of Openfast? | ||
rt.debug_level = 2 # debug level. 0 - no outputs, 1 - minimal outputs, 2 - all outputs | ||
rt.overwrite = False # overwite fast sims? | ||
rt.cores = 4 # number of cores if multiprocessings | ||
rt.mpi_run = False # run using mpi | ||
rt.mpi_comm_map_down = [] # core mapping for MPI | ||
rt.outfile_fmt = 2 # 1 = .txt, 2 = binary, 3 = both | ||
|
||
# Post Processing Parameters | ||
reCrunch = True # re-run pCrunch? | ||
|
||
#### ============================================ #### | ||
# THE ACTION # | ||
# ----- Shouldn't need to change anything here ----- # | ||
|
||
# Check validity inputs | ||
if testtype.lower() == 'binary-comp' and len(rosco_binaries) < 2: | ||
raise ValueError('You need at least two binaries to compare for testtype = "binary-comp"!') | ||
if testtype.lower() == 'discon-comp' and len(rosco_binaries) < 2: | ||
raise ValueError('You need at least two discon files to compare for testtype = "binary-comp"!') | ||
|
||
# Setup test turbine | ||
if turbine2test == 'NREL-5MW': | ||
rt.Turbine_Class = 'I' | ||
rt.Turbulence_Class = 'A' | ||
rt.FAST_directory = os.path.join(os.getcwd(), '../Test_Cases/NREL-5MW') | ||
rt.FAST_InputFile = 'NREL-5MW.fst' | ||
elif turbine2test == 'IEA-15MW': | ||
rt.Turbine_Class = 'I' | ||
rt.Turbulence_Class = 'B' | ||
rt.FAST_directory = os.path.join(os.getcwd(), '../Test_Cases/IEA-15-240=RWT-UMaineSemi') | ||
rt.FAST_InputFile = 'IEA-15-240=RWT-UMaineSemi.fst' | ||
else: | ||
raise ValueError('{} is not an available turbine to test!'.format(turbine2test)) | ||
|
||
# Run test | ||
if testtype.lower() == 'lite': | ||
rt.ROSCO_Test_lite() | ||
elif testtype.lower() == 'heavy': | ||
rt.ROSCO_Test_heavy() | ||
elif testtype.lower() == 'binary-comp': | ||
rt.ROSCO_Controller_Comp(rosco_binaries) | ||
elif testtype.lower() == 'discon-comp': | ||
rt.ROSCO_DISCON_Comp(discon_files) | ||
else: | ||
raise ValueError('{} is an invalid test type!'.format(testtype)) | ||
|
||
|
||
|
||
# ----------- Post process ---------- | ||
|
||
# Set up pCrunch | ||
# Initialize processing classes | ||
fp = Processing.FAST_Processing() | ||
|
||
if testtype.lower() is any(['lite', 'heavy']): | ||
# Load generated .yaml for outfile names | ||
case_info = FileTools.load_yaml(os.path.join(rt.runDir,'case_matrix.yaml'), package=1) | ||
casenames = case_info['Case_Name'] | ||
if rt.outfile_fmt >= 2: | ||
outFileNames = [os.path.join(rt.runDir,fname+'.outb') for fname in casenames] | ||
else: | ||
outFileNames = [os.path.join(rt.runDir,fname+'.out') for fname in casenames] | ||
|
||
# Set some processing parameters | ||
fp.OpenFAST_outfile_list = outFileNames | ||
fp.t0 = 0 | ||
if rt.cores > 0: | ||
fp.parallel_analysis = True | ||
fp.results_dir = os.path.join(rt.runDir, 'stats') | ||
fp.verbose = True | ||
fp.save_LoadRanking = True | ||
fp.save_SummaryStats = True | ||
|
||
# Define load ranking stats | ||
fp.ranking_vars = [['RotSpeed'], | ||
['RootMyb1', 'RootMyb2', 'RootMyb3'], | ||
['TwrBsMyt']] | ||
fp.ranking_stats = ['max', | ||
'max', | ||
'max'] | ||
if turbine2test == 'IEA-15MW': | ||
fp.ranking_vars += [['PtfmPitch']] | ||
fp.ranking_stats += ['max'] | ||
|
||
# Load and save statistics and load rankings | ||
if not os.path.exists(os.path.join(fp.results_dir, 'dataset1_LoadRanking.yaml')) or reCrunch: | ||
stats, load_rankings = fp.batch_processing() | ||
|
||
# Print a summary | ||
print('----------------------------------------') | ||
print('\t\t{}'.format(turbine2test)) | ||
print('----------------------------------------') | ||
print('\t\t{}'.format('Test Outputs')) | ||
for meas in load_rankings[0].keys(): | ||
try: | ||
print('Max {} \t{:1.3e}'.format(meas, load_rankings[0][meas]['max'][0])) | ||
except: | ||
print('{} is not in load rankings'.format(meas)) | ||
print('----------------------------------------') | ||
|
||
else: | ||
# Save each set of outputs in a list | ||
allstats = [] | ||
allrankings = [] | ||
for i in range(max(len(discon_files), len(rosco_binaries))): | ||
# Define output file folder | ||
outputDir = os.path.join(os.getcwd(), rt.runDir,'controller_{}'.format(i)) # NJA - this is dependent on the hard-coded folder names in ROSCO_testing.py | ||
|
||
# Load output file paths using case matrices | ||
case_info = FileTools.load_yaml(os.path.join(outputDir, 'case_matrix.yaml'), package=1) | ||
casenames = case_info['Case_Name'] | ||
if rt.outfile_fmt >= 2: | ||
outFileNames = [os.path.join(outputDir, fname+'.outb') for fname in casenames] | ||
else: | ||
outFileNames = [os.path.join(outputDir, fname+'.out') for fname in casenames] | ||
|
||
# Set some processing parameters | ||
fp.OpenFAST_outfile_list = outFileNames | ||
fp.t0 = 0 | ||
if rt.cores > 0: | ||
fp.parallel_analysis = True | ||
fp.results_dir = os.path.join(outputDir, 'stats') | ||
fp.verbose = True | ||
fp.save_LoadRanking = True | ||
fp.save_SummaryStats = True | ||
|
||
# Define load ranking stats | ||
fp.ranking_vars = [['RotSpeed'], | ||
['RootMyb1', 'RootMyb2', 'RootMyb3'], | ||
['TwrBsMyt']] | ||
fp.ranking_stats = ['max', | ||
'max', | ||
'max'] | ||
if turbine2test == 'IEA-15MW': | ||
fp.ranking_vars += [['PtfmPitch']] | ||
fp.ranking_stats += ['max'] | ||
|
||
# Load and save statistics and load rankings | ||
if not os.path.exists(os.path.join(fp.results_dir, 'dataset1_LoadRanking.yaml')) or reCrunch: | ||
stats, load_rankings = fp.batch_processing() | ||
|
||
# Save all outputs | ||
allstats.append(stats) | ||
allrankings.append(load_rankings[0]) | ||
|
||
# Print a summary | ||
print('----------------------------------------') | ||
print('\t\t{}'.format(turbine2test)) | ||
print('----------------------------------------') | ||
print('\t\t{}\t{}'.format('Controller1', 'Controller2')) | ||
for meas in allrankings[0].keys(): | ||
try: | ||
print('Max {} \t{:1.3e}\t{:1.3e}'.format( | ||
meas, allrankings[0][meas]['max'][0], allrankings[1][meas]['max'][0])) | ||
except: | ||
print('{} is not in load rankings'.format(meas)) | ||
print('----------------------------------------') |
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
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
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
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
Oops, something went wrong.