Skip to content

Commit

Permalink
Check for text file
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhar-abbas committed Oct 30, 2019
1 parent 1a25568 commit 0eef0f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions ROSCO_toolbox/turbine.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,11 @@ def load_from_fast(self, FAST_InputFile,FAST_directory, FAST_ver='OpenFAST',dev_
elif rot_source == 'cc-blade':
self.load_from_ccblade(fast)
else: # default load from cc-blade
print('No desired rotor performance data source specified, running CC-Blade.')
self.load_from_ccblade(fast)
if os.path.exists(txt_filename):
self.load_from_txt(txt_filename)
else:
print('No rotor performance data source available, running CC-Blade.')
self.load_from_ccblade(fast)

# Parse rotor performance data
self.Cp = RotorPerformance(self.Cp_table,self.pitch_initial_rad,self.TSR_initial)
Expand Down
8 changes: 5 additions & 3 deletions ROSCO_toolbox/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class FileProcessing():

def __init__(self):
pass
def write_param_file(self, turbine, controller, param_file='DISCON.IN'):
def write_param_file(self, turbine, controller, param_file='DISCON.IN', txt_filename='Cp_Ct_Cq.txt'):
"""
Print the controller parameters to the DISCON.IN input file for the generic controller
Expand All @@ -99,7 +99,9 @@ def write_param_file(self, turbine, controller, param_file='DISCON.IN'):
controller: class
Controller class containing controller operation information (gains, etc...)
param_file: str, optional
filename to for parameter input file, should be DISCON.IN
filename for parameter input file, should be DISCON.IN
txt_filename: str, optional
filename of rotor performance file
"""
print('Writing new controller parameter file parameter file: %s.' % param_file)
# Should be obvious what's going on here...
Expand Down Expand Up @@ -219,7 +221,7 @@ def write_rotor_performance(self,turbine,txt_filename='Cp_Ct_Cq.txt'):
txt_filename: str, optional
Desired output filename to print rotor performance data. Default is Cp_Ct_Cq.txt
'''

print('Writing rotor performance text file: {}'.format(txt_filename))
file = open(txt_filename,'w')
# Headerlines
file.write('# ----- Rotor performance tables for the {} wind turbine ----- \n'.format(turbine.TurbineName))
Expand Down

0 comments on commit 0eef0f0

Please sign in to comment.