def test_layout(): layout = read_layout(easy_layout) assert_same_layout(layout, easy_expected) layout = read_layout(sixty_percent_layout) assert_same_layout(layout, sixty_expected) layout = read_layout(weird_layout) assert_same_layout(layout, weird_expected)
def ainsliefull_windrose(layout_file, windrose_file): layout_x, layout_y = read_layout(layout_file) wind_direction, wind_speed, wind_frequency = read_windrose(windrose_file) efficiency = [] profit = [] summation = 0.0 nt = len(layout_y) P = [] U = [] efficiency_proportion = [] for wind in range(len(wind_direction)): U0 = wind_speed[wind] # Free stream wind speed angle = wind_direction[wind] # angle2 = - 270.0 - angle # To read windroses where N is 0 and E is 90 U.append(ainsliefull_1angle(layout_x, layout_y, U0, angle, rotor_radius=40.0, TI=0.08)) P.append([power(u) for u in U[-1]]) # Farm efficiency profit.append(sum(P[-1])) efficiency.append(profit[-1] * 100.0 / (float(nt) * max(P[-1]))) # same as using U0 efficiency_proportion.append(efficiency[-1] * wind_frequency[wind] / 100.0) summation += efficiency_proportion[wind] # print profit # print efficiency # print efficiency_proportion # print U # print P return profit
def ainsliefull_windrose(layout_file, windrose_file): layout_x, layout_y = read_layout(layout_file) wind_direction, wind_speed, wind_frequency = read_windrose(windrose_file) nt = len(layout_y) U = Parallel(n_jobs=-1)(delayed(ainsliefull_1angle)(layout_x, layout_y, wind_speed[i], wind_direction[i], rotor_radius=40.0, TI=0.08) for i in range(len(wind_direction))) P = [[power(u) for u in U[i]] for i in range(len(wind_direction))] profit = [sum(powers) for powers in P] efficiency = [ profit[ii] * 100.0 / (float(nt) * max(P[ii])) for ii in range(len(wind_direction)) ] # same as using U0 efficiency_proportion = [ efficiency[i] * wind_frequency[i] / 100.0 for i in range(len(wind_direction)) ] summation = sum(efficiency_proportion) # print profit # print efficiency # print efficiency_proportion # print U # print P return profit
def ainsliefull_windrose(layout_file, windrose_file): layout_x, layout_y = read_layout(layout_file) wind_direction, wind_speed, wind_frequency = read_windrose(windrose_file) nt = len(layout_y) U = Parallel(n_jobs=-1)(delayed(ainsliefull_1angle)(layout_x, layout_y, wind_speed[i], wind_direction[i], rotor_radius=40.0, TI=0.08) for i in range(len(wind_direction))) P = [[power(u) for u in U[i]] for i in range(len(wind_direction))] profit = [sum(powers) for powers in P] efficiency = [profit[ii] * 100.0 / (float(nt) * max(P[ii])) for ii in range(len(wind_direction))] # same as using U0 efficiency_proportion = [efficiency[i] * wind_frequency[i] / 100.0 for i in range(len(wind_direction))] summation = sum(efficiency_proportion) # print profit # print efficiency # print efficiency_proportion # print U # print P return profit
profit.append(sum(P[-1])) efficiency.append(profit[-1] * 100.0 / (float(nt) * max(P[-1]))) # same as using U0 efficiency_proportion.append(efficiency[-1] * wind_frequency[wind] / 100.0) summation += efficiency_proportion[wind] # print profit # print efficiency # print efficiency_proportion # print U # print P unknowns['array_efficiency'] = summation if __name__ == '__main__': layout_x, layout_y = read_layout('coordinates.dat') windrose_direction, windrose_speed, windrose_probability = read_windrose('windrose.dat') root = Group() root.add('jensen', JensenWindRose()) root.add('ainslie', AinslieWindRose()) root.add('larsen', LarsenWindRose()) prob = Problem(root) prob.setup() prob['jensen.layout_x'] = prob['ainslie.layout_x'] = prob['larsen.layout_x'] = array(layout_x) prob['jensen.layout_y'] = prob['ainslie.layout_y'] = prob['larsen.layout_y'] = array(layout_y) prob['jensen.windrose_direction'] = prob['ainslie.windrose_direction'] = prob['larsen.windrose_direction'] = array(windrose_direction) prob['jensen.windrose_speed'] = prob['ainslie.windrose_speed'] = prob['larsen.windrose_speed'] = array(windrose_speed) prob['jensen.windrose_probability'] = prob['ainslie.windrose_probability'] = prob['larsen.windrose_probability'] = array(windrose_probability) prob.run()