Ejemplo n.º 1
0
def generate_random_GenericWindTurbinePowerCurveVT(D=None):
    """
    Generate a random turbine and power curve using the GenericWindTurbinePowerCurveVT class

    Parameters
    ----------
    D       float, default=random, (optional)
            The wind turbine rotor diameter

    Returns
    -------
    wt_desc GenericWindTurbinePowerCurveVT
            A random wind turbine power curve and c_t curve variable tree
    """
    if not D:
        D = 200 * random()

    wt_desc = GenericWindTurbinePowerCurveVT()
    wt_desc.rotor_diameter = D
    wt_desc.hub_height = D * (0.5 + random())
    wt_desc.cut_in_wind_speed = 2. + 4. * random()
    wt_desc.cut_out_wind_speed = 20. + 10. * random()
    rho = 1.225
    rated_wind_speed = 8. + 4. * random()
    max_a = 0.333 * random()
    max_cp = 4 * max_a * (1 - max_a)**2.
    max_ct = 4 * max_a * (1 - max_a)
    A = 0.25 * pi * D**2.  # Rotor area
    ideal_power = lambda ws: 0.5 * rho * A * max_cp * ws**3.
    real_power = lambda ws: ideal_power(
        ws) if ws < rated_wind_speed else ideal_power(rated_wind_speed)
    #a_ct = -sqrt(-c_t + 1)/2 + 1/2
    ct_from_cp = lambda cp: min(0.89, cp * 2.)
    cp_from_power = lambda power, ws: power / (0.5 * rho * A * ws**3.)
    ct_from_power = lambda pws: ct_from_cp(cp_from_power(pws[0], pws[1]))
    N = 3 + int(random() * 100)
    ws = linspace(wt_desc.cut_in_wind_speed, wt_desc.cut_out_wind_speed, N)
    wt_desc.power_curve = vstack([ws, map(real_power, ws)]).T
    wt_desc.c_t_curve = vstack(
        [ws, map(ct_from_power, zip(wt_desc.power_curve[:, 1], ws))]).T
    wt_desc.power_rating = ideal_power(rated_wind_speed)
    wt_desc.rated_wind_speed = rated_wind_speed
    wt_desc.air_density = rho
    wt_desc.test_consistency()
    return wt_desc
Ejemplo n.º 2
0
def generate_random_GenericWindTurbinePowerCurveVT(D=None):
    """
    Generate a random turbine and power curve using the GenericWindTurbinePowerCurveVT class

    Parameters
    ----------
    D       float, default=random, (optional)
            The wind turbine rotor diameter

    Returns
    -------
    wt_desc GenericWindTurbinePowerCurveVT
            A random wind turbine power curve and c_t curve variable tree
    """
    if not D:
        D = 200*random()

    wt_desc = GenericWindTurbinePowerCurveVT()
    wt_desc.rotor_diameter = D
    wt_desc.hub_height = D * (0.5 + random())
    wt_desc.cut_in_wind_speed = 2. + 4. * random()
    wt_desc.cut_out_wind_speed = 20. + 10. * random()
    rho = 1.225
    rated_wind_speed = 8. + 4. * random()
    max_a = 0.333 * random()
    max_cp = 4 * max_a * (1 - max_a)**2.
    max_ct = 4 * max_a * (1 - max_a)
    A = 0.25 * pi * D**2. # Rotor area
    ideal_power = lambda ws: 0.5 * rho * A * max_cp * ws **3.
    real_power = lambda ws: ideal_power(ws) if ws < rated_wind_speed else ideal_power(rated_wind_speed)
    #a_ct = -sqrt(-c_t + 1)/2 + 1/2
    ct_from_cp = lambda cp: min(0.89, cp  * 2.)
    cp_from_power = lambda power, ws: power/(0.5 * rho * A * ws**3.)
    ct_from_power = lambda pws: ct_from_cp(cp_from_power(pws[0], pws[1]))
    N = 3+int(random() * 100)
    ws = linspace(wt_desc.cut_in_wind_speed, wt_desc.cut_out_wind_speed, N)
    wt_desc.power_curve = vstack([ws, map(real_power, ws)]).T
    wt_desc.c_t_curve = vstack([ws, map(ct_from_power, zip(wt_desc.power_curve[:,1],ws))]).T
    wt_desc.power_rating = ideal_power(rated_wind_speed)
    wt_desc.rated_wind_speed = rated_wind_speed
    wt_desc.air_density = rho
    wt_desc.test_consistency()
    return wt_desc