def pyWrapper(): print 'Executing FAST using pure Python wrapper' print '' # Import from runFAST_v8 import runFAST_v8 # Initialize FAST instance fstInst = runFAST_v8() # Define various members of the FAST instance. Can use relative locations. fstInst.fst_exe = "/home/sebasanper/PycharmProjects/owf_MDAO/aero_loads_models/bin/FAST_glin64" fstInst.fst_dir = "input_FAST" fstInst.fst_file = "Test18.fst" fstInst.run_dir = "FAST_run" fstInst.fst_file_type = 2 # specifies v8.15 fstInst.fst_exe_type = 2 # specifies v8.15 # Define inputs (could be FAST, ElastoDyn, or AeroDyn inputs) fstInst.fstDict['TMax'] = 20 # changed from 60 fstInst.fstDict['BlPitch(1)'] = 0 fstInst.fstDict['BlPitch(2)'] = 0 fstInst.fstDict['BlPitch(3)'] = 0 fstInst.fstDict['RotSpeed'] = 10.0 # change initial rotational speed # Define outputs (currently just FST outputs, others have to be changed in template input files) fstInst.setOutputs(['Azimuth', 'RootMyb1']) # Execute FAST fstInst.execute() # Give some output to command line loads = list(fstInst.getOutputValue("RootMyb1")) time = list(fstInst.getOutputValue("Time")) return time, loads
def __init__(self, config, case): """ A FAST component that executes the workflow. Takes a single dictionary, config, as well as a case name as the input. Executes FAST workflow in the associated case running directory. """ super(FASTv8_Workflow, self).__init__() # Initialize instance self.fastInst = runFAST_v8() # Extract file and directory names/locations from config file, assign to instance for key in config: if key == 'fst_exe': self.fastInst.fst_exe = config[key] elif key == 'fst_dir': self.fastInst.fst_dir = config[key] elif key == 'fst_file': self.fastInst.fst_file = config[key] self.fastInst.run_dir = os.path.join('run_omdao', case) # setup relative running directory--directory 'run_omdao' must already exist # self.fastInst.run_dir = "run_{0}".format(case) #another option for relative running directories self.fastInst.fst_file_type = 2 # specifies v8.15 self.fastInst.fst_exe_type = 2 # specifies v8.15 self.fastInst.fstDict = config # assign configuration dictionary to this instance of FAST # Calculate size of output fields # This currently only works when TMax is a multiple of DT. # Otherwise case will still run but vector sizes will be incorrect self.outSize = (self.fastInst.fstDict['TMax'] / self.fastInst.fstDict['DT']) + 1 self.outSize = math.trunc(self.outSize) # If an OpenMDAO input paramter is to be specified, it would look something like this: # self.add_param('RotSpeed_input', val = 0.0) # This parameter would also have to be added and connected when the omdao problem is set up. # Define OpenMDAO output parameters to be assigned in FAST self.add_output('Time', shape=[self.outSize]) self.add_output('BldPitch1', shape=[self.outSize]) self.add_output('RotSpeed', shape=[self.outSize]) self.add_output('GenPwr', shape=[self.outSize]) self.add_output('Wind1VelX', shape=[self.outSize])