Main Content

generate

Generate next On-Off application traffic packet

    Description

    [dt,packetSize] = generate(cfgOnOff) generates the next On-Off application traffic packet based on the specified configuration object, cfgOnOff. The object function returns the time remaining to generate the next packet, dt, and the size of the current packet, packetSize.

    [dt,packetSize] = generate(cfgOnOff,elapsedTime) specifies the time elapsed, elapsedTime, since the previous call of this object function.

    example

    [___,packet] = generate(___) returns an On-Off application traffic packet. Specify an argument combination from any of the previous syntaxes.

    Examples

    collapse all

    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);

    Input Arguments

    collapse all

    Configuration object to generate an On-Off application traffic pattern, specified as a networkTrafficOnOff object.

    Time elapsed since the previous call of this object function, specified as a nonnegative scalar. Units are in milliseconds.

    Data Types: double

    Output Arguments

    collapse all

    Time remaining to generate the next packet, returned as a nonnegative scalar. Units are in milliseconds.

    Data Types: double

    Size of the current packet, returned as a positive scalar. Units are in bytes.

    Data Types: double

    Application data packet, returned as a column vector of integers in the range [0, 255]. This output contains application data that the ApplicationData property of the input cfgOnOff specifies. If you do not specify ApplicationData, this output is a column vector of 1s.

    Dependencies

    To enable this output argument, set the GeneratePacket property of the cfg input to 1 (true).

    Data Types: double

    Extended Capabilities

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

    Version History

    Introduced in R2022a

    See Also

    Objects