How can I improve the live streaming performance of Simulation Data Inspector (SDI) when using Simulink Real-Time and Speedgoat?

25 visualizzazioni (ultimi 30 giorni)
I use Simulink Real-Time (SLRT) to run simulations on a Speedgoat real-time target and wish to see the live signal data in the Simulation Data Inspector (SDI). To do this, I selected signals for streaming using Signal Logging Badges, the SLRT Explorer, or by using instrument objects.
However, I see noticeable gaps in the data in the SDI, or see that some timesteps are lost when I inspect the 'logsout' variable or export data from the SDI.
Additionally, I may see:
Live Stream overload
warnings in the Speedgoat system log.
Is there any way that I can improve the performance of SDI without reducing my model sample rate?

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 13 Nov 2023
Modificato: MathWorks Support Team il 13 Nov 2023
Live streaming from a real-time application does not guarantee all the data appears in the Simulation Data Inspector (SDI). Live stream instrumentation runs at a lower priority than the real-time application. So, data sent by live streaming could be dropped if the host-target connection cannot keep up. This behavior is documented in Troubleshoot Gaps in Streamed Data.
In addition, there may be other limiting factors imposed by the SDI implementation in your current release of MATLAB. Below is a list of recommended steps to try in order to improve live streaming performance with Simulink Real-Time:
(1) Upgrade to the latest MATLAB release and/or install the latest MATLAB Update for your release.
We are continuously working on improving the performance of SDI so that using the newest MATLAB can be beneficial. In particular, if you use External Mode ("Run on Target" button) and your model contains many graphical elements (Dashboard blocks, Scopes, Displays), an upgrade to R2022b and beyond may be beneficial since signals connected to such blocks will no longer be streamed to SDI.
(2) Decrease the data rate for live streaming data.
To do this, you could decrease the model sample rate, stream fewer signals, increase the decimation of instrumented signals, or adjust the logging sample time. The latter can be done by changing the "Logging Sample Time" of the signal so that you will see a lower rate signal in SDI, allowing SDI to run more smoothly during simulation. To edit the "Logging Sample Time", right-click the logging badge (wi-fi symbol) for the signal, and select "Properties".
You can also use the Decimate data field as another way to reduce the amount of data transferred from the target to the host. Decimation reduces the effective sample rate for logged data. To reduce the number of data points logged, specify a decimation factor greater than one. For example, a decimation of factor of 2 logs every other data point, reducing the number of logged points and effective sample rate by half.
(3) Consider file logging instead of (or in addition to) live streaming.
At the same time when streaming the signal at a lower rate in SDI, you can log the signals on the Speedgoat target via a File Log block which will preserve the original sample time of the signal. File logging is capable of logging much higher data rates without dropping data. More information on File Logs can be found at Signal Logging and Streaming Basics.
(4) Remove DMR files and monitor the host computer disk space.
Another useful step is to delete any *.dmr artifacts that you find in your Windows temp folder:
>> winopen(tempdir))
Normally, MATLAB should automatically remove these artifacts upon closing. However, in cases of abnormal exits, these files may persist on the C drive and occupy valuable space. While your simulation is running, monitor the remaining space on your C drive. If you notice the drive is running full and you have no way of freeing up more space, make sure to apply methods (2), (3), or (5).
(5) Change the Record mode of SDI to not retain data.
To avoid disk space issues on the host computer altogether, you can also choose to retain no streamed data after simulation using the SDI record mode setting (simulink.sdi.setrecorddata). When you change the Record mode setting to "View during simulation only", no logged data is available in SDI or the workspace after the simulation completes. Only use this mode when you do not want to save the data captured in SDI. See the following documentation for details on this feature and other tips to improve SDI performance: Limit the Size of Logged Data.
(6) Use Normal Mode instead of External Mode simulation.
When working with large Simulink models, it may be beneficial to run the real-time simulation in Normal Mode instead of External Mode. This means that instead of starting the real-time simulation using the "Run on Target" button in Simulink, you open Simulink Real-Time Explorer (>> slrtExplorer) and load/start the simulation from there, or you use MATLAB "slrealtime" commands. See Configure and Control Real-Time Application by Using Simulink Real-Time Explorer and Execute Real-Time Application with MATLAB Language.
(7) Check your network setup and hardware.
In some rare cases, users may see "Live stream overload" warnings although no data is being streamed to the development computer during simulation. This can be caused by hardware/network issues, for example, a faulty USB-Ethernet adaptor. See Troubleshooting connection issues with Speedgoat target computers.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by