Skip to content

Commit

Permalink
remove weis dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhar-abbas committed Nov 6, 2020
1 parent d6e7157 commit 3c8ae31
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 23 deletions.
13 changes: 6 additions & 7 deletions ROSCO_testing/ROSCO_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import glob
import multiprocessing as mp

from weis.aeroelasticse.FAST_reader import InputReader_Common, InputReader_OpenFAST, InputReader_FAST7
from weis.aeroelasticse.FAST_writer import InputWriter_Common, InputWriter_OpenFAST, InputWriter_FAST7
from weis.aeroelasticse.runFAST_pywrapper import runFAST_pywrapper_batch
from weis.aeroelasticse.CaseGen_General import CaseGen_General
from weis.aeroelasticse.CaseGen_IEC import CaseGen_IEC
import ofTools.fast_io.read_fast_input as fast_io
from ofTools.fast_io.FAST_reader import InputReader_OpenFAST
from ofTools.case_gen.CaseGen_IEC import CaseGen_IEC
from ofTools.case_gen.runFAST_pywrapper import runFAST_pywrapper_batch

from pCrunch import pdTools
from pCrunch import Processing, Analysis

Expand Down Expand Up @@ -435,7 +435,7 @@ def ROSCO_Controller_Comp(self, controller_paths, testtype='light', more_case_in
self.runDir = run_dir_init
self.windDir = wind_dir_init

def ROSCO_DISCON_Comp(self, DISCON_filenames, testtype='light'):
def ROSCO_DISCON_Comp(self, DISCON_filenames, testtype='light', more_case_inputs={}):
'''
Heavy or light testing for n DISCON.IN files, n = len(DISCON_paths)
Expand All @@ -456,7 +456,6 @@ def ROSCO_DISCON_Comp(self, DISCON_filenames, testtype='light'):
self.windDir = os.path.join(run_dir_init, 'wind') # wind in base runDir

# Point to different DISCON.IN files using more_case_inputs
more_case_inputs = {}
more_case_inputs[('ServoDyn', 'DLL_ProcName')] = {'vals': [discon], 'group': 0}
self.windDir = os.path.join(run_dir_init, 'wind') # wind in base runDir

Expand Down
9 changes: 4 additions & 5 deletions ROSCO_testing/run_Testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import ROSCO_testing
import importlib

from weis.aeroelasticse.Util import FileTools
from ofTools.util import FileTools
from pCrunch import pdTools
from pCrunch import Processing, Analysis

Expand Down Expand Up @@ -193,8 +193,8 @@ 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'
# weis_dir = os.environ.get('weis_dir') # works if we do `export weis_dir=$(pwd)` in WEIS directory in terminal
weis_dir = '/Users/nabbas/Documents/WindEnergyToolbox/WEIS'

# Setup ROSCO testing parameters
rt_kwargs = {}
Expand All @@ -216,8 +216,7 @@ def run_testing(turbine2test, testtype, rosco_binaries=[], discon_files=[], **kw
testtype = 'lite' # 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])] # Differently named libdiscons to compare
rosco_binaries = [os.path.join(os.getcwd(), glob.glob('../ROSCO/build/libdiscon*')[0])] # Differently named libdiscons to compare
discon_files = [] # Differently named DISCON.IN files to compare


Expand Down
13 changes: 7 additions & 6 deletions ROSCO_toolbox/turbine.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def load_from_fast(self, FAST_InputFile,FAST_directory, FAST_ver='OpenFAST',dev_
txt_filename: str, optional
filename for *.txt, only used if rot_source='txt'
"""
from weis.aeroelasticse.FAST_reader import InputReader_OpenFAST
from ofTools.fast_io.FAST_reader import InputReader_OpenFAST

print('Loading FAST model: %s ' % FAST_InputFile)
self.TurbineName = FAST_InputFile.strip('.fst')
Expand Down Expand Up @@ -315,8 +315,8 @@ def generate_rotperf_fast(self, openfast_path, FAST_runDirectory=None, run_BeamD
'''

# Load additional WEIS tools
from weis.aeroelasticse import runFAST_pywrapper, CaseGen_General
from weis.aeroelasticse.Util import FileTools
from ofTools.case_gen import runFAST_pywrapper, CaseGen_General
from ofTools.util import FileTools
# Load pCrunch tools
from pCrunch import pdTools, Processing

Expand Down Expand Up @@ -498,7 +498,7 @@ def load_blade_info(self):
-----------
self - note: needs to contain fast input file info provided by load_from_fast.
'''
from weis.aeroelasticse.FAST_reader import InputReader_OpenFAST
from ofTools.fast_io.FAST_reader import InputReader_OpenFAST

# Create CC-Blade Rotor
r0 = np.array(self.fast.fst_vt['AeroDynBlade']['BlSpn'])
Expand Down Expand Up @@ -608,7 +608,8 @@ def interp_surface(self,pitch,TSR):
'''

# Form the interpolant functions which can look up any arbitrary location on rotor performance surface
interp_fun = interpolate.interp2d(self.pitch_initial_rad, self.TSR_initial, self.performance_table, kind='linear')
interp_fun = interpolate.interp2d(
self.pitch_initial_rad, self.TSR_initial, self.performance_table, kind='cubic')
return interp_fun(pitch,TSR)

def interp_gradient(self,pitch,TSR):
Expand Down Expand Up @@ -659,4 +660,4 @@ def plot_performance(self):
plt.annotate('max = {:<1.3f}'.format(np.max(self.performance_table)),
(max_beta_id+0.2, max_tsr_id+0.2), color='red')
plt.xticks(fontsize=12)
plt.yticks(fontsize=12)
plt.yticks(fontsize=12)
6 changes: 1 addition & 5 deletions ROSCO_toolbox/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
from itertools import takewhile, product
import struct

try:
from weis.aeroelasticse.Util import spectral
except:
pass

from ofTools.util import spectral
# Some useful constants
now = datetime.datetime.now()
pi = np.pi
Expand Down

0 comments on commit 3c8ae31

Please sign in to comment.