'''
An example script to run a comparison between two DLC cases 
(sort of strange, but showcases some functionalities)
'''

# Python Modules and instantiation
import numpy as np
import matplotlib.pyplot as plt 
import pandas as pd
import time
import os
# ROSCO toolbox modules 
from ROSCO_toolbox import utilities as ROSCO_utilites
fast_io = ROSCO_utilites.FAST_IO()
fast_pl = ROSCO_utilites.FAST_Plots()
# WISDEM modules
from wisdem.aeroelasticse.Util import FileTools
# Batch Analysis
from pCrunch import pdTools
from pCrunch import Processing, Analysis


# Define input files paths
outfile_base      = '../../BatchOutputs/5MW_Land/5MW_Land_ROSCO/'
fname_case_matrix = '../../BatchOutputs/5MW_Land/5MW_Land_ROSCO/case_matrix.yaml'

# Load case matrix into dataframe
case_matrix = FileTools.load_yaml(fname_case_matrix, package=1)
cm = pd.DataFrame(case_matrix)

# Define DLCs
Exemple #2
0
''' 
----------------- Run_TestCases -----------------
- Run the simulation cases in the Test_Cases folder
- Plot some basic results to make sure they worked

Notes:
    By default, the provided test case models point to a compiled controller at:
    "../../ROSCO/build/libdiscon.dylib". You will need have this compiled, or 
    change the path to the controller in the ServoDyn input files.
-------------------------------------------------
'''
# Import and define modules and classes
import os
import matplotlib.pyplot as plt
from ROSCO_toolbox import utilities as ROSCO_Utilities
fast_io = ROSCO_Utilities.FAST_IO()

# Define call for OpenFAST and turbsim
openfast_call    = 'openfast_dev'
turbsim_call = 'turbsim_dev'

# Define folder names in Test_Cases to run
test_cases = ['5MW_Land_DLL_WTurb',
                '5MW_OC3SPAR_DLL_WTurb_WavesIrr']

# Names of wind turbulent wind binaries
wind_binaries = ['Wind/90m_12mps_twr.bts']

# Define data to plot 
plot_categories = {}
plot_categories['LandBased'] = ['Wind1VelX', 'BldPitch1', 'GenTq', 'RotSpeed']
elif platform.system() == 'Darwin':
    openfast_call = 'openfast'

# Load yaml file
parameter_filename = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                                  'BAR_00', 'ServoData', 'BAR_00.yaml')
inps = yaml.safe_load(open(parameter_filename))
path_params = inps['path_params']
turbine_params = inps['turbine_params']
controller_params = inps['controller_params']

# Instantiate turbine, controller, and file processing classes
turb = turbine.Turbine(turbine_params)
cont = controller.Controller(controller_params)
file_processing = utilities.FileProcessing()
fast_io = utilities.FAST_IO()

# Load turbine data from OpenFAST and rotor performance text file
turb.load_from_fast(path_params['FAST_InputFile'],
                    path_params['FAST_directory'],
                    dev_branch=True)

# Tune controller
cont.tune_controller(turb)

# Write parameter input file
param_filename = 'OpenFAST_BAR_00_DISCON.IN'
param_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                          'BAR_00', param_filename)
file_processing.write_DISCON(
    turb,