def Ainslie(a, Nt, rad):

    import wake
    from eddy_viscosity import ainslie
    from math import sqrt, log, cos, sin
    from numpy import deg2rad
    from power_curve5MW import power5MW_kW as power  # Power curve 5 MW NREL

    windrose = open('horns_rev_windrose.dat', 'r')

    def determine_front(wind_angle, x_t1, y_t1, x_t2, y_t2):
        wind_angle = deg2rad(wind_angle)
        b = (x_t2 - x_t1) * cos(wind_angle) + (y_t2 - y_t1) * sin(wind_angle)
        if b > 0.0:
            return True, b
        else:
            return False, 0.0

    nt = Nt  # Number of turbines
    D = 2.0 * rad  # Diameter
    layout_x = [0.0 for x in range(nt)]
    layout_y = [0.0 for x in range(nt)]
    for x in range(nt):
        layout_x[x] = float(a[x][0] / D)
        layout_y[x] = float(a[x][1] / D)

    windrose_angle = []
    windrose_speed = []
    windrose_frequency = []
    for line in windrose:
        columns = line.split()
        windrose_angle.append(float(columns[0]))
        windrose_speed.append(float(columns[1]))
        windrose_frequency.append(float(columns[2]))

    windrose.close()
    summation = 0.0

    ##  Power curve 2 MW Siemens
    # def power(U0):
    #     if U0 < 4.0:
    #         return 0.0
    #     elif U0 >= 4.0:
    #         return 19.7907842158 * U0 ** 2.0 - 74.9080669331 * U0 + 37.257967033  # From 4 to 11 m/s

    # for wind in range(0, len(windrose_speed)):
    for wind in range(0, 1):
        U1 = windrose_speed[wind]  # Free stream wind speed
        U0 = U1 * (90.0 / 10.0) ** 0.11  # Power or log law for wind shear profile
        # U0 = U1 * log(70.0 / 0.005) / log(10.0 / 0.005)
        angle = windrose_angle[wind]
        angle3 = angle + 180.0
        wake_deficit_matrix = [[0.0 for x in range(nt)] for x in range(nt)]
        for turbine in range(0, nt):
            parallel_distance = [0.0 for x in range(0, nt)]
            perpendicular_distance = [0.0 for x in range(0, nt)]
            flag = [False for x in range(nt)]
            for i in range(nt):
                flag[i], parallel_distance[i] = determine_front(angle3, layout_x[turbine], layout_y[turbine], layout_x[i], layout_y[i])
                perpendicular_distance[i] = wake.crosswind_distance(deg2rad(angle3), layout_x[turbine], layout_y[turbine], layout_x[i], layout_y[i])

            # Matrix with effect of each turbine <i = turbine> on every other turbine <j> of the farm
            for j in range(nt):
                if flag[j] is True:
                    if perpendicular_distance[j] <= 2.5:
                        wake_deficit_matrix[turbine][j] = ainslie(0.46, U0, parallel_distance[j], perpendicular_distance[j])
                    else:
                        wake_deficit_matrix[turbine][j] = 0.0
                elif flag[j] is False:
                    wake_deficit_matrix[turbine][j] = 0.0

        total_deficit = [0.0 for x in range(nt)]
        total_speed = [0.0 for x in range(nt)]
        for j in range(nt):
            for i in range(nt):
                total_deficit[j] += wake_deficit_matrix[i][j] ** 2.0
            total_deficit[j] = sqrt(total_deficit[j])
            total_speed[j] = U0 * (1.0 - total_deficit[j])

        # Farm efficiency
        profit = 0.0
        efficiency_proportion = [0.0 for x in range(0, len(windrose_frequency))]
        efficiency = 0.0
        for l in range(nt):
            profit += power(total_speed[l])
            efficiency = profit * 100.0 / (nt * power(U0))
        efficiency_proportion[wind] = efficiency * windrose_frequency[wind] / 100.0
        summation += efficiency_proportion[wind]
    return summation
Example #2
0
def analysis():
    nt = 80  # Number of turbines
    D = 80.0  # Diameter
    layout_x = []
    layout_y = []
    for line in layout:
        columns = line.split()
        layout_x.append(float(columns[0]) / D)
        layout_y.append(float(columns[1]) / D)

    windrose_angle = []
    windrose_speed = []
    windrose_frequency = []
    for line in windrose:
        columns = line.split()
        windrose_angle.append(float(columns[0]))
        windrose_speed.append(float(columns[1]))
        windrose_frequency.append(float(columns[2]))

    layout.close()
    windrose.close()
    summation = 0.0

    def power(U0):
        if U0 < 4.0:
            return 0.0
        elif U0 >= 4.0:
            return 19.7907842158 * U0**2.0 - 74.9080669331 * U0 + 37.257967033  # From 4 to 11 m/s

    # def Cp(U0):
    #     return power(U0) / (0.5 * 1.225 * pi * r0**2.0 * U0**3.0)

    # for U0 in range(4, 20):
    #     summation = 0.0
    for wind in range(0, len(windrose_speed)):
        # for wind in range(0, 1):
        # U1 = windrose_speed[wind]  # Free stream wind speed
        # U0 = U1 * (70.0 / 10.0) ** 0.11  # Power or log law for wind shear profile
        # U0 = U1 * log(70.0 / 0.005) / log(10.0 / 0.005)
        U0 = 8.5
        angle = windrose_angle[wind]
        angle3 = angle + 180.0
        wake_deficit_matrix = [[0.0 for x in range(nt)] for x in range(nt)]
        for turbine in range(0, nt):
            parallel_distance = [0.0 for x in range(0, nt)]
            perpendicular_distance = [0.0 for x in range(0, nt)]
            flag = [False for x in range(nt)]
            for i in range(nt):
                flag[i], parallel_distance[i] = determine_front(
                    angle3, layout_x[turbine], layout_y[turbine], layout_x[i],
                    layout_y[i])
                perpendicular_distance[i] = wake.crosswind_distance(
                    deg2rad(angle3), layout_x[turbine], layout_y[turbine],
                    layout_x[i], layout_y[i])

            # Matrix with effect of each turbine <i = turbine> on every other turbine <j> of the farm
            for j in range(nt):
                if flag[j] is True:
                    if perpendicular_distance[j] <= 2.5:
                        wake_deficit_matrix[turbine][j] = ainslie(
                            0.81, U0, parallel_distance[j],
                            perpendicular_distance[j])
                    else:
                        wake_deficit_matrix[turbine][j] = 0.0
                elif flag[j] is False:
                    wake_deficit_matrix[turbine][j] = 0.0
                output.write('{0:f}\t'.format(wake_deficit_matrix[j][turbine]))
            output.write('\n')

        total_deficit = [0.0 for x in range(nt)]
        total_speed = [0.0 for x in range(nt)]
        for j in range(nt):
            for i in range(nt):
                total_deficit[j] += wake_deficit_matrix[i][j]**2.0
            total_deficit[j] = sqrt(total_deficit[j])
            total_speed[j] = U0 * (1.0 - total_deficit[j])
            output2.write(
                '{0:d}\t{1:.1f}\t{2:.1f}\t{3:f}\t{4:f}\t{5:d}\t{6:f}\n'.format(
                    j, layout_x[j] * D, layout_y[j] * D, total_deficit[j],
                    total_speed[j], int(angle), power(total_speed[j])))
        output2.write('\n')

        turb_data.write('{0:f}\t{1:f}\n'.format(angle, power(total_speed[14])))

        # Farm efficiency
        profit = 0.0
        efficiency_proportion = [
            0.0 for x in range(0, len(windrose_frequency))
        ]
        efficiency = 0.0
        for l in range(nt):
            profit += power(total_speed[l])
            efficiency = profit * 100.0 / (nt * power(U0))
        efficiency_proportion[
            wind] = efficiency * windrose_frequency[wind] / 100.0
        print 'Farm efficiency with wind direction = {0:d} deg: {1:2.2f}%'.format(
            int(angle), efficiency)
        # direction.write('{0:f}\t{1:f}\n'.format(angle, efficiency))
        summation += efficiency_proportion[wind]
    print 'total farm efficiency is {0:f} %'.format(summation)
    # print U0, summation

    turb_data.close()
    output.close()
    output2.close()
    draw.close()
    direction.close()
Example #3
0
def analysis():
    nt = 80  # Number of turbines
    D = 80.0  # Diameter
    layout_x = []
    layout_y = []
    for line in layout:
        columns = line.split()
        layout_x.append(float(columns[0]) / D)
        layout_y.append(float(columns[1]) / D)

    windrose_angle = []
    windrose_speed = []
    windrose_frequency = []
    for line in windrose:
        columns = line.split()
        windrose_angle.append(float(columns[0]))
        windrose_speed.append(float(columns[1]))
        windrose_frequency.append(float(columns[2]))

    layout.close()
    windrose.close()
    summation = 0.0

    def power(U0):
        if U0 < 4.0:
            return 0.0
        elif U0 <= 25.0:
            return 0.0003234808 * U0**7.0 - 0.0331940121 * U0**6.0 + 1.3883148012 * U0**5.0 - 30.3162345004 * U0**4.0 + 367.6835557011 * U0**3.0 - 2441.6860655008 * U0**2.0 + 8345.6777042343 * U0 - 11352.9366182805
        else:
            return 0.0

    for wind in range(0, len(windrose_speed)):
        # for wind in range(0, 1):
        U1 = windrose_speed[wind]  # Free stream wind speed
        # U0 = U1 * (70.0 / 10.0) ** 0.11  # Power or log law for wind shear profile
        # U0 = U1 * log(70.0 / 0.005) / log(10.0 / 0.005)
        U0 = 8.5
        angle = windrose_angle[wind]
        angle3 = angle + 180.0
        wake_deficit_matrix = [[0.0 for x in range(nt)] for x in range(nt)]
        for turbine in range(0, nt):
            parallel_distance = [0.0 for x in range(0, nt)]
            perpendicular_distance = [0.0 for x in range(0, nt)]
            flag = [False for x in range(nt)]
            for i in range(nt):
                flag[i], parallel_distance[i] = determine_front(
                    angle3, layout_x[turbine], layout_y[turbine], layout_x[i],
                    layout_y[i])
                perpendicular_distance[i] = wake.crosswind_distance(
                    deg2rad(angle3), layout_x[turbine], layout_y[turbine],
                    layout_x[i], layout_y[i])

            # Matrix with effect of each turbine <i = turbine> on every other turbine <j> of the farm
            for j in range(nt):
                if flag[j] is True:
                    if perpendicular_distance[j] <= 1.5:
                        wake_deficit_matrix[turbine][j] = ainslie(
                            0.81, U0, parallel_distance[j],
                            perpendicular_distance[j])
                    else:
                        wake_deficit_matrix[turbine][j] = 0.0
                elif flag[j] is False:
                    wake_deficit_matrix[turbine][j] = 0.0
            #     output.write('{0:f}\t'.format(wake_deficit_matrix[j][turbine]))
            # output.write('\n')

        total_deficit = [0.0 for x in range(nt)]
        total_speed = [0.0 for x in range(nt)]
        for j in range(nt):
            for i in range(nt):
                total_deficit[j] += wake_deficit_matrix[i][j]**2.0
            total_deficit[j] = sqrt(total_deficit[j])
            total_speed[j] = U0 * (1.0 - total_deficit[j])
        turb_data.write('{0:f}\t{1:f}\n'.format(angle, power(total_speed[14])))
        #     output2.write('{0:d}\t{1:.1f}\t{2:.1f}\t{3:f}\t{4:f}\t{5:d}\t{6:f}\n'.format(j, layout_x[j] * D, layout_y[j] * D, total_deficit[j], total_speed[j], int(angle), power(total_speed[j])))
        # output2.write('\n')

        # Farm efficiency
        profit = 0.0
        efficiency_proportion = [
            0.0 for x in range(0, len(windrose_frequency))
        ]
        efficiency = 0.0
        for l in range(nt):
            profit += power(total_speed[l])
        efficiency = profit * 100.0 / (nt * power(U0))
        efficiency_proportion[
            wind] = efficiency * windrose_frequency[wind] / 100.0
        direction.write('{0:f}\t{1:f}\n'.format(angle, efficiency))
        summation += efficiency_proportion[wind]
    print 'total farm efficiency is {0:f} %'.format(summation)

    turb_data.close()
    output.close()
    output2.close()
    draw.close()
    direction.close()
def analysis():
    nt = 80  # Number of turbines
    D = 80.0  # Diameter
    layout_x = []
    layout_y = []
    for line in layout:
        columns = line.split()
        layout_x.append(float(columns[0]) / D)
        layout_y.append(float(columns[1]) / D)

    windrose_angle = []
    windrose_speed = []
    windrose_frequency = []
    for line in windrose:
        columns = line.split()
        windrose_angle.append(float(columns[0]))
        windrose_speed.append(float(columns[1]))
        windrose_frequency.append(float(columns[2]))

    layout.close()
    windrose.close()
    summation = 0.0

    def power(U0):
        if U0 < 4.0:
            return 0.0
        elif U0 <= 25.0:
            return 0.0003234808 * U0 ** 7.0 - 0.0331940121 * U0 ** 6.0 + 1.3883148012 * U0 **5.0 - 30.3162345004 * U0 **4.0 + 367.6835557011 * U0 ** 3.0 - 2441.6860655008 * U0 ** 2.0 + 8345.6777042343 * U0 - 11352.9366182805
        else:
            return 0.0

    for wind in range(0, len(windrose_speed)):
    # for wind in range(0, 1):
        U1 = windrose_speed[wind]  # Free stream wind speed
        # U0 = U1 * (70.0 / 10.0) ** 0.11  # Power or log law for wind shear profile
        # U0 = U1 * log(70.0 / 0.005) / log(10.0 / 0.005)
        U0 = 8.5
        angle = windrose_angle[wind]
        angle3 = angle + 180.0
        wake_deficit_matrix = [[0.0 for x in range(nt)] for x in range(nt)]
        for turbine in range(0, nt):
            parallel_distance = [0.0 for x in range(0, nt)]
            perpendicular_distance = [0.0 for x in range(0, nt)]
            flag = [False for x in range(nt)]
            for i in range(nt):
                flag[i], parallel_distance[i] = determine_front(angle3, layout_x[turbine], layout_y[turbine], layout_x[i], layout_y[i])
                perpendicular_distance[i] = wake.crosswind_distance(deg2rad(angle3), layout_x[turbine], layout_y[turbine], layout_x[i], layout_y[i])

            # Matrix with effect of each turbine <i = turbine> on every other turbine <j> of the farm
            for j in range(nt):
                if flag[j] is True:
                    if perpendicular_distance[j] <= 1.5:
                        wake_deficit_matrix[turbine][j] = ainslie(0.81, U0, parallel_distance[j], perpendicular_distance[j])
                    else:
                        wake_deficit_matrix[turbine][j] = 0.0
                elif flag[j] is False:
                    wake_deficit_matrix[turbine][j] = 0.0
            #     output.write('{0:f}\t'.format(wake_deficit_matrix[j][turbine]))
            # output.write('\n')

        total_deficit = [0.0 for x in range(nt)]
        total_speed = [0.0 for x in range(nt)]
        for j in range(nt):
            for i in range(nt):
                total_deficit[j] += wake_deficit_matrix[i][j] ** 2.0
            total_deficit[j] = sqrt(total_deficit[j])
            total_speed[j] = U0 * (1.0 - total_deficit[j])
        turb_data.write('{0:f}\t{1:f}\n'.format(angle, power(total_speed[14])))
        #     output2.write('{0:d}\t{1:.1f}\t{2:.1f}\t{3:f}\t{4:f}\t{5:d}\t{6:f}\n'.format(j, layout_x[j] * D, layout_y[j] * D, total_deficit[j], total_speed[j], int(angle), power(total_speed[j])))
        # output2.write('\n')

        # Farm efficiency
        profit = 0.0
        efficiency_proportion = [0.0 for x in range(0, len(windrose_frequency))]
        efficiency = 0.0
        for l in range(nt):
            profit += power(total_speed[l])
        efficiency = profit * 100.0 / (nt * power(U0))
        efficiency_proportion[wind] = efficiency * windrose_frequency[wind] / 100.0
        direction.write('{0:f}\t{1:f}\n'.format(angle, efficiency))
        summation += efficiency_proportion[wind]
    print 'total farm efficiency is {0:f} %'.format(summation)

    turb_data.close()
    output.close()
    output2.close()
    draw.close()
    direction.close()
Example #5
0
def Ainslie(a, Nt, rad):

    import wake
    from eddy_viscosity import ainslie
    from math import sqrt, log, cos, sin
    from numpy import deg2rad
    from power_curve5MW import power5MW_kW as power  # Power curve 5 MW NREL

    windrose = open('horns_rev_windrose.dat', 'r')

    def determine_front(wind_angle, x_t1, y_t1, x_t2, y_t2):
        wind_angle = deg2rad(wind_angle)
        b = (x_t2 - x_t1) * cos(wind_angle) + (y_t2 - y_t1) * sin(wind_angle)
        if b > 0.0:
            return True, b
        else:
            return False, 0.0

    nt = Nt  # Number of turbines
    D = 2.0 * rad  # Diameter
    layout_x = [0.0 for x in range(nt)]
    layout_y = [0.0 for x in range(nt)]
    for x in range(nt):
        layout_x[x] = float(a[x][0] / D)
        layout_y[x] = float(a[x][1] / D)

    windrose_angle = []
    windrose_speed = []
    windrose_frequency = []
    for line in windrose:
        columns = line.split()
        windrose_angle.append(float(columns[0]))
        windrose_speed.append(float(columns[1]))
        windrose_frequency.append(float(columns[2]))

    windrose.close()
    summation = 0.0

    ##  Power curve 2 MW Siemens
    # def power(U0):
    #     if U0 < 4.0:
    #         return 0.0
    #     elif U0 >= 4.0:
    #         return 19.7907842158 * U0 ** 2.0 - 74.9080669331 * U0 + 37.257967033  # From 4 to 11 m/s

    # for wind in range(0, len(windrose_speed)):
    for wind in range(0, 1):
        U1 = windrose_speed[wind]  # Free stream wind speed
        U0 = U1 * (90.0 /
                   10.0)**0.11  # Power or log law for wind shear profile
        # U0 = U1 * log(70.0 / 0.005) / log(10.0 / 0.005)
        angle = windrose_angle[wind]
        angle3 = angle + 180.0
        wake_deficit_matrix = [[0.0 for x in range(nt)] for x in range(nt)]
        for turbine in range(0, nt):
            parallel_distance = [0.0 for x in range(0, nt)]
            perpendicular_distance = [0.0 for x in range(0, nt)]
            flag = [False for x in range(nt)]
            for i in range(nt):
                flag[i], parallel_distance[i] = determine_front(
                    angle3, layout_x[turbine], layout_y[turbine], layout_x[i],
                    layout_y[i])
                perpendicular_distance[i] = wake.crosswind_distance(
                    deg2rad(angle3), layout_x[turbine], layout_y[turbine],
                    layout_x[i], layout_y[i])

            # Matrix with effect of each turbine <i = turbine> on every other turbine <j> of the farm
            for j in range(nt):
                if flag[j] is True:
                    if perpendicular_distance[j] <= 2.5:
                        wake_deficit_matrix[turbine][j] = ainslie(
                            0.46, U0, parallel_distance[j],
                            perpendicular_distance[j])
                    else:
                        wake_deficit_matrix[turbine][j] = 0.0
                elif flag[j] is False:
                    wake_deficit_matrix[turbine][j] = 0.0

        total_deficit = [0.0 for x in range(nt)]
        total_speed = [0.0 for x in range(nt)]
        for j in range(nt):
            for i in range(nt):
                total_deficit[j] += wake_deficit_matrix[i][j]**2.0
            total_deficit[j] = sqrt(total_deficit[j])
            total_speed[j] = U0 * (1.0 - total_deficit[j])

        # Farm efficiency
        profit = 0.0
        efficiency_proportion = [
            0.0 for x in range(0, len(windrose_frequency))
        ]
        efficiency = 0.0
        for l in range(nt):
            profit += power(total_speed[l])
            efficiency = profit * 100.0 / (nt * power(U0))
        efficiency_proportion[
            wind] = efficiency * windrose_frequency[wind] / 100.0
        summation += efficiency_proportion[wind]
    return summation