MATLAB: Do I get different results when using the Buffer and Unbuffer Blocks from the DSP Blockset 3.1 (R11.1) and 4.0 (R12)

delayinconsistentr12simulinkwrong

Why do I get different results when using the Buffer and Unbuffer Blocks from the DSP Blockset 3.1 (R11.1) and 4.0 (R12)?
For example:
1) Type the followin at the MATLAB command prompt:
dspstartup
2) Open a new Simulink model. Create the following model:
Sine -> Buffer -> Unbuffer -> Scope
3) Change the frequency of the Sine Wave to 2 Hz, the Buffer size to 64 and the simulation stop time to 4 seconds.
4) Run the model and notice the size of the delay from the buffer:
td=(sizeOfBuffer*sampleTime)
5) Repeat the same steps 1-3 in MATLAB 6.0 (R12).
6) Run the model and notice the size of the delay from the buffer:
td=(2*sizeOfBuffer*sampleTime)

Best Answer

There is no different behavior between the Unbuffer Blocks in the DSP Blockset 3.1 (R11.1) and 4.x (R12.x). If the Simulink model is running in the "Single Tasking" mode, the time delay of the Unbuffer block is:
td=(sizeOfBuffer*sampleTime)
If the Simulink model is running in the "Multiple Tasking" mode, the time delay of the unbuffer block is:
td = (2 * sizeOfBuffer*sampleTime).
When creating a new Simulink model with Simulink 3.1 (R11.1), the "Single Tasking" mode is automatically selected (td = 0.2sec). When creating a new Simulink model with Simulink 4.0 (R12), the "Auto" mode automatically is selected, which is "Multiple Tasking" as soon as there are different sample rates. This is the case when using the Buffer and the Unbuffer block (td = 0.4sec).
As a workaround, you can explicitly set the Tasking Mode of your model to match that of your model in Simulink 3.1 (R11.1).