Can I use Simulink Desktop Real-Time with the Instrument Control Toolbox?

1 view (last 30 days)
I am desiging a device that is meant to communicate with Simulink in real time over serial. I would like to use the "To Instrument" and "Query Instrument" blocks from the Instrument Control Toolbox, but they do not seem to play nicely with Simulink Desktop Real-Time in any mode other than "Normal". In "Normal" mode, everything works properly but the model cannot run fast enough to be Real-Time.
I am looking for a workaround or suggestion for the best way to implement this design.
I am aware that SDRT comes with its own serial blocks, but they do not have the same functionality as the instrument control blocks mentioned above. I have considered the "Packet Input" and "Packet Output" blocks; however, the "Packet Input" block does not allow more than one type of packet to be sent. I would like to be able to query individual values from my hardware rather than needing to read every piece of data every time.
Ideally, I would be able to send and receive around 20 bytes of data at a rate of at least 100 Hz.
Below is a screen capture of the current configuration which is meant to perform a sine-sweep on a motor attached to the hardware I am trying to interface with.
SDRT_screencap.png

Accepted Answer

Harsha Priya Daggubati
Harsha Priya Daggubati on 13 Aug 2019
Hi,
You cannot run a real-time simulation in Rapid Accelerator mode. You can synchronize a Simulink model with a real-time clock using Simulink Desktop Real-Time I/O blocks. I suggest using Stream Input/Output Blocks to transmit and receive your data.
For more information refer to these links:

More Answers (0)

Community Treasure Hunt

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

Start Hunting!