When simulating a Simulink® Desktop Real-Time™ model in external mode run, I notice slow updates of Scope blocks or failure to plot data in Scope blocks.
Slow updates of Scope blocks or failure to plot data in Scope blocks could indicate that the real-time application sample time is near the lower threshold for the computer and I/O hardware.
The sample time is set in the Fixed step size (fundamental sample
time) field in the Configuration Parameters
Solver pane. The Fixed step size field
appears only when Type is set to
Plotting data has a lower priority than executing the application. A small sample time allows the application to run but can leave insufficient resources for plotting. If the sample time is so small that the application itself cannot run, an error message is displayed and real-time execution is terminated.
To check the sample time, select a larger sample time for your application. Change the sample time of any I/O drivers to be the same as the new application sample time or to an integer multiple of that time. Then rebuild the model, connect to the target, and restart the real-time application.
As required, iterate changing the application sample time until scope output appears.
For example, start with a sample time of
0.01 seconds, and
confirm that your system runs and plots are displayed. Then decrease the sample time
until you can display scopes and meet your
accuracy and response time requirements.
After changing the application sample time, update the I/O driver sample time and
rebuild the application .