def add_distribution(method_dict): # Specify the distribution according to the uncertain variable if method_dict['uncertain_var'] == 'speed': dist = distributions.getWeibull() method_dict['distribution'] = dist elif method_dict['uncertain_var'] == 'direction': dist = distributions.getWindRose() method_dict['distribution'] = dist else: raise ValueError('unknown uncertain_var option "%s", valid options "speed" or "direction".' %method_dict['uncertain_var']) return method_dict
# Specify the rest of arguments # method_dict = {} method_dict = vars(args) # Start a dictionary with the arguments specified in the command line method_dict['method'] = 'dakota' # select model: floris, jensen, gauss, larsen (larsen not working yet) TODO get larsen model working method_dict['wake_model'] = 'floris' method_dict['uncertain_var'] = 'direction' # method_dict['layout'] = 'optimized' # Now this is specified in the command line method_dict['dakota_filename'] = 'dakotageneral.in' # method_dict['dakota_filename'] = 'dakotageneralPy.in' # Interface with python support # To Do specify the number of points (directions or speeds) as an option as well. method_dict['coeff_method'] = 'quadrature' # Specify the distribution according to the uncertain variable if method_dict['uncertain_var'] == 'speed': dist = distributions.getWeibull() method_dict['distribution'] = dist elif method_dict['uncertain_var'] == 'direction': dist = distributions.getWindRose() method_dict['distribution'] = dist elif method_dict['uncertain_var'] == 'direction_and_speed': dist1 = distributions.getWindRose() dist2 = distributions.getWeibull() dist = cp.J(dist1, dist2) method_dict['distribution'] = dist else: raise ValueError('unknown uncertain_var option "%s", valid options "speed", "direction" or "direction_and_speed".' %method_dict['uncertain_var']) # Run the problem multiple times for statistics convergence mean = [] std = []
# 'method' = 'dakota', 'rect' or 'chaospy' # 'chaospy' needs updating # 'uncertain_var' = 'speed' or 'direction' # 'layout' = 'amalia', 'optimized', 'grid', 'random', 'lhs', 'test' # 'layout1', 'layout2', 'layout3' # 'distribution' = a distribution object # 'dakota_filename' = 'dakotaInput.in', applicable for dakota method # Get arguments args = get_args() method_dict = vars(args) # Start a dictionary with the arguments specified in the command line method_dict['method'] = 'dakota' method_dict['uncertain_var'] = 'direction' method_dict['layout'] = 'layout3' if method_dict['uncertain_var'] == 'speed': dist = distributions.getWeibull() method_dict['distribution'] = dist elif method_dict['uncertain_var'] == 'direction': dist = distributions.getWindRose() method_dict['distribution'] = dist else: raise ValueError('unknown uncertain_var option "%s", valid options "speed" or "direction".' %method_dict['uncertain_var']) method_dict['dakota_filename'] = 'dakotageneral.in' # n = int(sys.argv[1]) # number of points, i.e., number of winddirections and windspeeds pairs n = 10 points, weights = windfarm_setup.getPoints(method_dict, n) if method_dict['uncertain_var'] == 'speed': # For wind speed