Why does the maximum scan/sampling rate differ significantly between MATLAB and Simulink Desktop Real Time?
Show older comments
I'm working with Simulink Desktop Real Time (SDRT) to receive analog inputs from sensors and send control signals. The DAQ board is NI PCIe 6343. The SDRT file is currently quite simple - just analog input and frequency output blocks (see attached file). However, the PC keeps crashing whenever I set the sampling rate to 1ms. I use the external mode, and I've tried running the model step-by-step (build --> connect --> run). The build and connect steps were completed successfully, then my PC crashed several seconds after I clicked run. If I set the sampling rate to e.g., 2ms, the model runs without problem.
While this might simply be due to the limitations of the PC, I recalled that other students have ran MATLAB scripts that do similar stuff on the same PC. Here's a snippet of the script:

The full script shows that they were measuring 8 analog inputs at 0.1ms sampling rate, which seems to be the default setting (in contrast, the default rate for SDRT blocks is 0.1s). So, why is there such a big difference between the viable sampling rate between MATLAB and SDRT?
A couple things that I've explored:
- Commented out I/O blocks in the SDRT model, then run the model with 1ms sampling rate. The runs were completed successfully up to 6 active (uncommented) blocks.
- Checked the configuration parameters to ensure that the fixed-step size is consistent with sampling rate - I assigned step size & sampling rate using the same MATLAB variable.
Another thing I'm going to try is to combine similar analog inputs into 1 block as shown in the default SDRT model example. However, I'm not sure how much improvement this would do. My final model will include at least double the amount of I/O signals, and include many computations. So, while I don't necessarily need 1ms sampling rate, I'd like to have significant wiggle room when I finally include those other stuff.
Thank you,
Kevin Hartoyo
Accepted Answer
More Answers (0)
Categories
Find more on Signal Integrity Kits for Industry Standards in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!