Documentation Center

  • Trial Software
  • Product Updates

rebuffer_delay

Number of samples of delay introduced by buffering and unbuffering operations

Syntax

d = rebuffer_delay(f,n,v)
d = rebuffer_delay(f,n,v,'mode')

Description

d = rebuffer_delay(f,n,v) returns the delay, in samples, introduced by the Buffer or Unbuffer block in multitasking operations.

d = rebuffer_delay(f,n,v,'mode') returns the delay, in samples, introduced by the Buffer or Unbuffer block in the specified tasking mode.

Input Arguments

f

Frame size of the input to the Buffer or Unbuffer block.

n

Size of the output buffer. Specify one of the following:

  • The value of the Output buffer size parameter, if you are computing the delay introduced by a Buffer block.

  • 1, if you are computing the delay introduced by an Unbuffer block.

v

Amount of buffer overlap. Specify one of the following:

  • The value of the Buffer overlap parameter, if you are computing the delay introduced by a Buffer block.

  • 0, if you are computing the delay introduced by an Unbuffer block.

'mode'

The tasking mode of the model. Specify one of the following options:

  • 'singletasking'

  • 'multitasking'

Default: 'multitasking'

Examples

Compute the delay introduced by a Buffer block in a multitasking model:

  1. Open a model containing a Buffer block. For this example, open the ex_buffer_tut4 model by typing ex_buffer_tut4ex_buffer_tut4 at the MATLAB® command line.

  2. Double-click the Buffer block to open the block mask. Verify that you have the following settings:

    • Output buffer size = 3

    • Buffer overlap = 1

    • Initial conditions = 0

    Based on these settings, two of the required inputs to the rebuffer_delay function are as follows:

    • n = 3

    • v = 1

  3. To determine the frame size of the input signal to the Buffer block, open the Signal From Workspace block mask. Verify that you have the following settings:

    • Signal = sp_examples_src

    • Sample time = 1

    • Samples per frame = 4

    Because Samples per frame = 4, you know the f input to the rebuffer_delay function is 4.

  4. After you verify the values of all the inputs to the rebuffer_delay function, determine the delay that the Buffer block introduces in this multitasking model. To do so, type the following at the MATLAB command line:

    d = rebuffer_delay(4,3,1)
    
    d =
         8
    
 

Compute the delay introduced by an Unbuffer block in a multitasking model:

  1. Open a model containing an Unbuffer block. For this example, open the ex_unbuffer_ref1 model by typing ex_unbuffer_ref1ex_unbuffer_ref1 at the MATLAB command line.

  2. To determine the frame size of the input to the Buffer block, open the Signal From Workspace block mask by double-clicking the block in your model. Verify that you have the following settings:

    • Signal = sp_examples_src

    • Sample time = 1

    • Samples per frame = 3

    Because Samples per frame = 3, you know the f input to the rebuffer_delay function is 3.

  3. Use the rebuffer_delay function to determine the amount of delay that the Unbuffer block introduces in this multitasking model. To compute the delay introduced by the Unbuffer block, use f = 3, n = 1 and v = 0.

    d = rebuffer_delay(3,1,0)
    
    d =
         3
    

More About

expand all

Multitasking

When you run a model in MultiTasking mode, Simulink® processes groups of blocks with the same execution priority through each stage of simulation based on task priority. Multitasking mode helps to create valid models of real-world multitasking systems, where sections of your model represent concurrent tasks. The Tasking mode for periodic sample times parameter on the Solver pane of the Configuration Parameters dialog box controls this setting.

Singletasking

When you run a model in SingleTasking mode, Simulink processes all blocks through each stage of simulation together. The Tasking mode for periodic sample times parameter on the Solver pane of the Configuration Parameters dialog box controls this setting.

See Also

|

Was this topic helpful?