Пример #1
0
def WindFrame(coords, windDirDeg):
    """Convert map coordinates to downwind/crosswind coordinates"""

    # Convert from meteorological polar system (CW, 0 deg.=N)
    # to standard polar system (CCW, 0 deg.=W)
    # Shift so North comes "along" x-axis, from left to right.
    windDirDeg = 270. - windDirDeg
    # Convert inflow wind direction from degrees to radians
    windDirRad = DegToRad(windDirDeg)

    # Convert to downwind(x) & crosswind(y) coordinates
    cos_min_wind_dir = np.cos(-windDirRad)
    sin_min_wind_dir = np.sin(-windDirRad)
    frame_coords = np.recarray(coords.shape, coordinate)
    frame_coords.x = coords.x * cos_min_wind_dir - coords.y * sin_min_wind_dir
    frame_coords.y = coords.x * sin_min_wind_dir + coords.y * cos_min_wind_dir

    return frame_coords
Пример #2
0
def WindFrame(turb_coords, wind_dir_deg):
    """Convert map coordinates to downwind/crosswind coordinates."""

    # Convert from meteorological polar system (CW, 0 deg.=N)
    # to standard polar system (CCW, 0 deg.=W)
    # Shift so North comes "along" x-axis, from left to right.
    wind_dir_deg = 270. - wind_dir_deg
    # Convert inflow wind direction from degrees to radians
    wind_dir_rad = DegToRad(wind_dir_deg)

    # Constants to use below
    cos_dir = np.cos(-wind_dir_rad)
    sin_dir = np.sin(-wind_dir_rad)
    # Convert to downwind(x) & crosswind(y) coordinates
    frame_coords = np.recarray(turb_coords.shape, coordinate)
    frame_coords.x = (turb_coords.x * cos_dir) - (turb_coords.y * sin_dir)
    frame_coords.y = (turb_coords.x * sin_dir) + (turb_coords.y * cos_dir)

    return frame_coords
Пример #3
0
def rotatedFrame(turb_coords, wind_drct):
    """
    -**-THIS FUNCTION SHOULD NOT BE MODIFIED-**-
    
    Rotates euclidean coordinates to downwind-crosswind coordinates.
    Rotate the axes such that the wind flow direction aligns with the
    positive x-axis. 
    
    :called from
        partAEP
        
    :param
        turb_coords   - 2D array. turbine euclidean x,y coordinates
        wind_drct     - wind direction in degrees. 
                        [{'N':0},{'E':90},{'S':180},{'W':270}]
        
    :return    
        Rotated turbine locations. 
    """

    # so that the wind flow direction aligns with the +ve x-axis.
    wind_drct = wind_drct - 90

    # Convert inflow wind direction from degrees to radians
    wind_drct = DegToRad(wind_drct)

    # Contants for coordinate transformation
    cos_dir = np.cos(wind_drct)
    sin_dir = np.sin(wind_drct)

    # Coordinate Transformation. Rotate coordinates to downwind, crosswind coordinates
    rotate_coords = np.zeros((turb_coords.shape[0], 2), dtype=np.float32)
    rotate_coords[:, 0] = (turb_coords[:, 0] * cos_dir) - (turb_coords[:, 1] *
                                                           sin_dir)
    rotate_coords[:, 1] = (turb_coords[:, 0] * sin_dir) + (turb_coords[:, 1] *
                                                           cos_dir)

    return (rotate_coords)