Using Buffer Block in Simulink Real-Time while executing concurrently

39 visualizaciones (últimos 30 días)
Hi there,
I want to load a 64kHz vibration signal from my Matlab workspace and buffer it for four seconds so that I have a vector of 256000 elements.
This works as intended in Simulink, but unfortunately I get the error in Simulink Real-Time: The block of type 'Buffer' is a multi-rate block. Currently, Simulink only supports single-rate blocks of this type when the model is configured for concurrent execution. Since the Allow tasks to run concurrently on target option is always enabled in Simulink Real-Time, I tried inserting a Rate Transition block between the From workspace and the Buffer block. I got the Rate Transition block to work in buf mode by unchecking the Ensure deterministic data transfer option. But this only buffers the first input value and holds it for four seconds, while the remaining 255999 values are lost. I cannot get it to run in Db_buf mode in the hope that it will save all incoming data, because if I change the inTsOffset or outTsOffset values, by specifying the Sample time in the From workspace block to [1/64000, 1/128000] and the Output port sample time in the Rate transition block to [4, 0], I get the error: Non-zero sample time offsets are not supported. Even though the table in the Rate Transition Documentation specifies that for a fast to slow conversion inTsOffset > outTsOffset with only data integrity should result in Db_buf.
I am a bit lost as to what options I have as this is my first time working with Simulink Real-Time and SpeedGoat Real-Time targets. A caveat is also that any solution would need to work on R2021b if possible, as the SpeedGoat I have available runs on that version.
It would be fine for my use case if the Buffer block would output its last full vector at the same rate (1/64000s) as the input. So a zero vector for the first 4s then a vector with the data collected in the first four seconds from 4s to 8s and so on.

Respuestas (1)

SANKALP DEV
SANKALP DEV el 17 de Nov. de 2023
Dear Tobias,
I understand that you're encountering challenges in buffering a 64kHz vibration signal within Simulink Real-Time.
The error message you've received, which states, "The block of type 'Buffer' is a multi-rate block," suggests that the 'Buffer' block may not be compatible with the concurrent execution mode in Simulink Real-Time.
To address the issue where only the first input value is being buffered and held for four seconds, causing the loss of the remaining 255,999 values, you can try the following steps:
  • In the properties of the 'Buffer' block, configure it with a buffer size of 256,000 samples.
  • In the buffer overlap section, specify the amount of overlap in each successive output frame, which in this case should be set to 256,000.
By following these steps, you should be able to resolve the problem effectively.
To know more about ‘buffer’ block, please refer the following MATLAB documentation.
Hope it helps.
Regards,
Sankalp

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by