Ejemplo n.º 1
0
    def set_openfast_data(self):
        # Openfast
        if self.modeling_options['Analysis_Flags']['OpenFAST'] == True:
            # Load Input OpenFAST model variable values
            fast = InputReader_OpenFAST(
                FAST_ver=self.modeling_options['openfast']['file_management']
                ['FAST_ver'])
            fast.FAST_InputFile = self.modeling_options['openfast'][
                'file_management']['FAST_InputFile']
            fast.FAST_directory = self.modeling_options['openfast'][
                'file_management']['FAST_directory']
            fast.path2dll = self.modeling_options['openfast'][
                'file_management']['path2dll']
            fast.execute()
            self.modeling_options['openfast']['fst_vt'] = fast.fst_vt

            if os.path.exists(self.modeling_options['openfast']
                              ['file_management']['Simulation_Settings_File']):
                self.modeling_options['openfast']['fst_settings'] = dict(
                    sch.load_yaml(
                        self.modeling_options['openfast']['file_management']
                        ['Simulation_Settings_File']))
            else:
                print(
                    'WARNING: OpenFAST is called, but no file with settings is found.'
                )
                self.modeling_options['openfast']['fst_settings'] = {}

        else:
            self.modeling_options['openfast']['fst_vt'] = {}
Ejemplo n.º 2
0
def initialize_problem(Analysis_Level):
    
    # Initialize blade design
    refBlade = ReferenceBlade()
    refBlade.verbose  = True
    refBlade.NINPUT       = 200
    Nsection_Tow          = 19
    refBlade.NPTS         = 200
    refBlade.spar_var     = ['Spar_cap_ss', 'Spar_cap_ps'] # SS, then PS
    refBlade.te_var       = 'TE_reinforcement'
    refBlade.validate     = False
    refBlade.fname_schema = fname_schema
    blade = refBlade.initialize(fname_input)
    
    FASTpref                        = {}
    FASTpref['Analysis_Level']      = Analysis_Level
    # Set FAST Inputs
    if Analysis_Level >= 1:
        # File management
        FASTpref['FAST_ver']            = 'OpenFAST'
        FASTpref['dev_branch']          = True
        FASTpref['FAST_exe']            = '~/local/bin/openfast'
        FASTpref['FAST_directory']      = '../OpenFAST'   # Path to fst directory files
        FASTpref['FAST_InputFile']      = 'IEA-15-240-RWT.fst' # FAST input file (ext=.fst)
        FASTpref['Turbsim_exe']         = '~/local/bin/turbsim'
        FASTpref['FAST_namingOut']      = 'IEA-15-240-RWT'
        FASTpref['FAST_runDirectory']   = 'temp/' + FASTpref['FAST_namingOut']
        
        # Run Settings
        FASTpref['cores']               = 1
        FASTpref['debug_level']         = 2 # verbosity: set to 0 for quiet, 1 & 2 for increasing levels of output

        # DLCs
        FASTpref['DLC_gust']            = None      # Max deflection
        # FASTpref['DLC_gust']            = RotorSE_DLC_1_4_Rated       # Max deflection    ### Not in place yet
        FASTpref['DLC_extrm']           = None      # Max strain
        # FASTpref['DLC_extrm']           = RotorSE_DLC_7_1_Steady      # Max strain        ### Not in place yet
        FASTpref['DLC_turbulent']       = None
        # FASTpref['DLC_turbulent']       = RotorSE_DLC_1_1_Turb      # Alternate turbulent case, replacing rated and extreme DLCs for calculating max deflection and strain
        FASTpref['DLC_powercurve']      = None      # AEP
        # FASTpref['DLC_powercurve']      = None      # AEP

        # Initialize, read initial FAST files to avoid doing it iteratively
        fast = InputReader_OpenFAST(FAST_ver=FASTpref['FAST_ver'], dev_branch=FASTpref['dev_branch'])
        fast.FAST_InputFile = FASTpref['FAST_InputFile']
        fast.FAST_directory = FASTpref['FAST_directory']
        fast.execute()
        fst_vt = fast.fst_vt
    else:
        fst_vt = {}

    prob = om.Problem()
    prob.model=MonopileTurbine(RefBlade=blade, Nsection_Tow=Nsection_Tow, VerbosityCosts=False, FASTpref=FASTpref)
    prob.model.nonlinear_solver = om.NonlinearRunOnce()
    prob.model.linear_solver    = om.DirectSolver()

    return prob, blade, fst_vt
Ejemplo n.º 3
0
    def execute(self):
        # FAST version specific initialization
        if self.FAST_ver.lower() == 'fast7':
            reader = InputReader_FAST7(FAST_ver=self.FAST_ver)
            writer = InputWriter_FAST7(FAST_ver=self.FAST_ver)
        elif self.FAST_ver.lower() in ['fast8', 'openfast']:
            reader = InputReader_OpenFAST(FAST_ver=self.FAST_ver)
            writer = InputWriter_OpenFAST(FAST_ver=self.FAST_ver)
        wrapper = FastWrapper(FAST_ver=self.FAST_ver,
                              debug_level=self.debug_level)

        # Read input model, FAST files or Yaml
        if self.fst_vt == {}:
            if self.read_yaml:
                reader.FAST_yamlfile = self.FAST_yamlfile_in
                reader.read_yaml()
            else:
                reader.FAST_InputFile = self.FAST_InputFile
                reader.FAST_directory = self.FAST_directory
                reader.dev_branch = self.dev_branch
                reader.execute()

            # Initialize writer variables with input model
            writer.fst_vt = reader.fst_vt
        else:
            writer.fst_vt = self.fst_vt
        writer.FAST_runDirectory = self.FAST_runDirectory
        writer.FAST_namingOut = self.FAST_namingOut
        writer.dev_branch = self.dev_branch
        # Make any case specific variable changes
        if self.case:
            writer.update(fst_update=self.case)
        # Modify any specified output channels
        if self.channels:
            writer.update_outlist(self.channels)
        # Write out FAST model
        writer.execute()
        if self.write_yaml:
            writer.FAST_yamlfile = self.FAST_yamlfile_out
            writer.write_yaml()

        # Run FAST
        wrapper.FAST_exe = self.FAST_exe
        wrapper.FAST_InputFile = os.path.split(writer.FAST_InputFileOut)[1]
        wrapper.FAST_directory = os.path.split(writer.FAST_InputFileOut)[0]
        wrapper.execute()

        FAST_Output = os.path.join(wrapper.FAST_directory,
                                   wrapper.FAST_InputFile[:-3] + 'outb')
        return FAST_Output
Ejemplo n.º 4
0
    def execute(self):

        # FAST version specific initialization
        if self.FAST_ver.lower() == 'fast7':
            reader = InputReader_FAST7(FAST_ver=self.FAST_ver)
            writer = InputWriter_FAST7(FAST_ver=self.FAST_ver)
        elif self.FAST_ver.lower() in ['fast8', 'openfast']:
            reader = InputReader_OpenFAST(FAST_ver=self.FAST_ver)
            writer = InputWriter_OpenFAST(FAST_ver=self.FAST_ver)
        wrapper = FastWrapper(FAST_ver=self.FAST_ver,
                              debug_level=self.debug_level)

        # Read input model, FAST files or Yaml
        if self.fst_vt == {}:
            if self.read_yaml:
                reader.FAST_yamlfile = self.FAST_yamlfile_in
                reader.read_yaml()
            else:
                reader.FAST_InputFile = self.FAST_InputFile
                reader.FAST_directory = self.FAST_directory
                reader.execute()

            # Initialize writer variables with input model
            writer.fst_vt = reader.fst_vt
        else:
            writer.fst_vt = self.fst_vt
        writer.FAST_runDirectory = self.FAST_runDirectory
        writer.FAST_namingOut = self.FAST_namingOut
        # Make any case specific variable changes
        if self.case:
            writer.update(fst_update=self.case)
        # Modify any specified output channels
        if self.channels:
            writer.update_outlist(self.channels)
        # Write out FAST model
        writer.execute()
        if self.write_yaml:
            writer.FAST_yamlfile = self.FAST_yamlfile_out
            writer.write_yaml()

        # Run FAST
        wrapper.FAST_exe = self.FAST_exe
        wrapper.FAST_InputFile = os.path.split(writer.FAST_InputFileOut)[1]
        wrapper.FAST_directory = os.path.split(writer.FAST_InputFileOut)[0]

        FAST_Output = os.path.join(wrapper.FAST_directory,
                                   wrapper.FAST_InputFile[:-3] + 'outb')
        FAST_Output_txt = os.path.join(wrapper.FAST_directory,
                                       wrapper.FAST_InputFile[:-3] + 'out')

        #check if OpenFAST is set not to overwrite existing output files, TODO: move this further up in the workflow for minor computation savings
        if self.overwrite_outfiles or (not self.overwrite_outfiles and
                                       not (os.path.exists(FAST_Output) or
                                            os.path.exists(FAST_Output_txt))):
            wrapper.execute()
        else:
            if self.debug_level > 0:
                print(
                    'OpenFAST not execute: Output file "%s" already exists. To overwrite this output file, set "overwrite_outfiles = True".'
                    % FAST_Output)

        return FAST_Output
Ejemplo n.º 5
0
        # DLCs
        FASTpref['DLC_gust'] = None  # Max deflection
        # FASTpref['DLC_gust']            = RotorSE_DLC_1_4_Rated       # Max deflection    ### Not in place yet
        FASTpref['DLC_extrm'] = None  # Max strain
        # FASTpref['DLC_extrm']           = RotorSE_DLC_7_1_Steady      # Max strain        ### Not in place yet
        FASTpref['DLC_turbulent'] = RotorSE_DLC_1_1_Turb
        # FASTpref['DLC_turbulent']       = RotorSE_DLC_1_1_Turb      # Alternate turbulent case, replacing rated and extreme DLCs for calculating max deflection and strain
        FASTpref['DLC_powercurve'] = power_curve  # AEP
        # FASTpref['DLC_powercurve']      = None      # AEP

        # Initialize, read initial FAST files to avoid doing it iteratively
        fast = InputReader_OpenFAST(FAST_ver=FASTpref['FAST_ver'],
                                    dev_branch=FASTpref['dev_branch'])
        fast.FAST_InputFile = FASTpref['FAST_InputFile']
        fast.FAST_directory = FASTpref['FAST_directory']
        fast.execute()
        fst_vt = fast.fst_vt
    else:
        FASTpref = {}
        fst_vt = {}

    rotor = Problem()
    npts_coarse_power_curve = 20  # (Int): number of points to evaluate aero analysis at
    npts_spline_power_curve = 200  # (Int): number of points to use in fitting spline to power curve
    regulation_reg_II5 = True  # calculate Region 2.5 pitch schedule, False will not maximize power in region 2.5
    regulation_reg_III = True  # calculate Region 3 pitch schedule, False will return erroneous Thrust, Torque, and Moment for above rated
    flag_Cp_Ct_Cq_Tables = True  # Compute Cp-Ct-Cq-Beta-TSR tables
    rc_verbosity = False  # Verbosity flag for the blade cost model
    rc_tex_table = False  # Flag to generate .tex ready tables from the blade cost model
    rc_generate_plots = False  # Flag to generate plots in the blade cost model
Ejemplo n.º 6
0
    # Turbine Setup
    testTurbines = ['IEA-15MW']  # current options are: IEA-15MW, NREL-5MW

    # Loop through test turbines
    for turbine in testTurbines:

        # Get FAST input (15MW only for now)
        if turbine == 'IEA-15MW':
            dev_branch = True
            FAST_ver = 'OpenFAST'

            fastRead = InputReader_OpenFAST(FAST_ver=FAST_ver,
                                            dev_branch=dev_branch)
            fastRead.FAST_InputFile = 'IEA-15-240-RWT-UMaineSemi.fst'  # FAST input file (ext=.fst)
            fastRead.FAST_directory = '/Users/dzalkind/Tools/ROSCO_toolbox/Test_Cases/IEA-15-240-RWT-UMaineSemi'  # Path to fst directory files

        elif turbine == 'NREL-5MW':
            dev_branch = True
            FAST_ver = 'OpenFAST'

            fastRead = InputReader_OpenFAST(FAST_ver=FAST_ver,
                                            dev_branch=dev_branch)
            fastRead.FAST_InputFile = '5MW_Land_DLL_WTurb.fst'  # FAST input file (ext=.fst)
            fastRead.FAST_directory = '/Users/dzalkind/Tools/ROSCO_toolbox/Test_Cases/5MW_Land_DLL_WTurb'  # Path to fst directory files

        # Read FAST inputs for generating cases
        fastRead.execute()

        runDir = os.path.join(baseRunDir, turbine)
        namebase = 'ROTest'