Main Content

uavWindGust

Generate wind gust for UAV platform

Since R2024a

    Description

    The uavWindGust object generates a wind gust of the standard “1-cosine” shape for a UAV platform. For more information on the gust shape, see 1-Cosine Gust Shape. To simulate a wind gust in a UAV scenario:

    1. Create the uavWindGust object and set its properties.

    2. Attach the wind model to a UAV platform by using the addWind function.

    3. Obtain the wind velocity from the UAV scenario by using the windVelocity function while the UAV scenario is running.

    Note

    Simulating a UAV scenario that contains a uavWindGust object requires Aerospace Toolbox.

    Creation

    Description

    gustWind = uavWindGust creates a wind gust object with default property values.

    gustWind = uavWindGust(Name=Value) specifies properties using one or more name-value arguments. For example, uavWindGust(StartTime=10) sets the wind start time to 10 seconds.

    example

    Properties

    expand all

    You can modify these properties before you add the uavWindGust object to the UAV platform using the addWind function.

    Gust amplitude in the UAV platform body frame, specified as a vector of the form [ vx vy vz]. The values of vx, vy, and vz are the wind velocity amplitudes in the positive x-, y-, and z-axes, respectively. Units are in m/s.

    Example: [1 0 0]

    Data Types: double

    The length over which the gust builds up in each axis of the UAV platform body frame, specified as a vector of the form [dx dy dz], where dx dy dz are gust length in the x-, y-, and z-axes, respectively. Units are in meters.

    Example: [1 0 0]

    Data Types: double

    Wind start time, specified as a nonnegative scalar. This value is relative to the simulation start time of the UAV scenario. Units are in seconds.

    Example: 2

    Data Types: double

    Wind stop time, specified as a nonnegative scalar. This value is relative to the simulation start time of the UAV scenario. If specified as inf, the wind gust continues until the UAV scenario simulation ends. Units are in seconds.

    Example: 5

    Data Types: double

    Examples

    collapse all

    Create a UAV scenario with default properties.

    scene = uavScenario;

    Create a UAV platform. Specify a trajectory to fly the platform 80 meters north of the scenario origin in 80 seconds.

    distance = 80;
    duration = 80;
    platformTrajectory = waypointTrajectory([0 0 -50; distance 0 -50],[0 duration]);
    platform = uavPlatform("UAV",scene,Trajectory=platformTrajectory);

    Create a wind gust object. Specify the amplitude as 5 m/s on the z-axis, with a gust length of 80 meters. Add the wind object to the UAV platform.

    gustWind = uavWindGust(GustAmplitude=[0 0 5],GustLength=[80 80 80]);
    addWind(platform,gustWind)

    Set up the scenario.

    setup(scene)
    
    % initialize arrays of zeros to store the vertical wind velocity and x-position of the UAV
    wv = zeros(scene.UpdateRate*duration,1);
    xpos = zeros(scene.UpdateRate*duration,1);
    
    % Start a counter index
    idx = 1;

    Run the scenario. Obtain the vertical wind velocity at each time step.

    while scene.CurrentTime <= duration
        % Obtain resultant wind velocity
        vel = windVelocity(platform);
        
        % Obtain UAV position
        [motion,lla] = read(platform);
        
        % Obtain UAV x-position
        xpos(idx) = motion(1);
    
        % Obtain vertical wind velocity
        wv(idx) = vel(3);
    
        % Increment counter index
        idx = idx + 1;
    
        % Advance the scenario time step
        advance(scene);
    end

    Plot the vertical wind velocity against distance.

    plot(xpos,wv)
    title("Vertical Wind Velocity")
    xlabel("Distance (m)")
    ylabel("Vertical Wind Velocity (m/s)")

    Figure contains an axes object. The axes object with title Vertical Wind Velocity, xlabel Distance (m), ylabel Vertical Wind Velocity (m/s) contains an object of type line.

    More About

    expand all

    Version History

    Introduced in R2024a