networkTrafficOnOff

On-Off application traffic pattern generator

    Description

    The networkTrafficOnOff object specifies the configuration parameters to generate an On-Off application traffic pattern.

    You can use the On-Off application traffic pattern in WLAN and 5G (requires 5G Toolbox™) system-level simulations to accurately model the real-world data traffic.

    Creation

    Description

    example

    cfgOnOff = networkTrafficOnOff creates a default On-Off application traffic pattern object.

    example

    cfgOnOff = networkTrafficOnOff(Name,Value) sets properties using one or more name-value pair arguments. Enclose each property name in quotes. For example, 'GeneratePacket',true generates an application packet.

    Properties

    expand all

    On state duration, specified as a positive scalar. This property must be expressed in seconds. To specify a customized value for the On time, specify this property. If you do not specify this property, the object uses the exponential distribution to calculate the On time.

    Data Types: double

    Off state duration, specified as a nonnegative scalar. This property must be expressed in seconds. To specify a customized value for the Off time, specify this property. If you do not specify this property, the object uses the exponential distribution to calculate the Off time.

    Data Types: double

    Exponential distribution mean value to calculate the On state duration, specified as a positive scalar. This property must be expressed in seconds.

    Dependencies

    To enable this property, set the OnTime property to [ ].

    Data Types: double

    Exponential distribution mean value to calculate the Off state duration, specified as a nonnegative scalar. This property must be expressed in seconds.

    Dependencies

    To enable this property, set the OffTime property to [ ].

    Data Types: double

    Packet generation rate during the On state, specified as a positive scalar. This property must be expressed in Kbps. If the value of this property is low and the PacketSize is large, the object might not generate packets in the On state.

    Data Types: double

    Length of the packet to be generated, specified as a positive scalar. This property must be expressed in bytes. If the value of this property is greater than the DataRate property value, the object accumulates the data across multiple On times to generate a packet.

    Data Types: double

    Flag to indicate whether the object generates an application packet, specified as a logical 1 (true) or 0 (false).

    Data Types: logical

    Application data to be added in the packet, specified as a column vector of integers in the range [0, 255]. If the size of the application data is greater than the PacketSize property value, the object truncates the application data. If the size of the application data is less than the PacketSize property value, the object appends zeros.

    Dependencies

    To enable this property, set the GeneratePacket property to 1 (true).

    Data Types: double

    Object Functions

    expand all

    generateGenerate next FTP, On-Off, or VoIP application traffic packet

    Examples

    collapse all

    Create a default On-Off application traffic pattern object.

    cfgOnOff = networkTrafficOnOff;

    Generate an On-Off application traffic pattern.

    [dt,packetSize] = generate(cfgOnOff);

    Create an On-Off application traffic pattern object, specifying the exponentially distributed mean value of the On state.

    cfgOnOff = networkTrafficOnOff('OnExponentialMean',5);

    Generate an On-Off application traffic pattern.

    [dt,packetSize] = generate(cfgOnOff);

    Create an On-Off application traffic pattern object to generate an On-Off data packet.

    cfgOnOff = networkTrafficOnOff('GeneratePacket',true);

    Generate an On-Off application traffic pattern and data packet.

    [dt,packetSize,packet] = generate(cfgOnOff);

    Create a default On-Off application traffic pattern object.

    cfgOnOff = networkTrafficOnOff;

    Generate an On-Off application traffic pattern with 200 On-Off packets.

    for packetCount = 1:200
        [dt(packetCount),packetSize(packetCount)] = generate(cfgOnOff);
    end

    Visualize the On-Off packet sizes.

    stem(packetSize); 
    title('Packet Size Versus Packet Number');
    xlabel('Packet Number');
    ylabel('Packet Size in Bytes');

    Visualize the On-Off packet intervals.

    figure;
    stem(dt); 
    title('dt Versus Packet Number');
    xlabel('Packet Number');
    ylabel('dt in Milliseconds');

    Extended Capabilities

    C/C++ Code Generation
    Generate C and C++ code using MATLAB® Coder™.

    Introduced in R2020b