Multiple Simulink runs only changing signal vector
5 views (last 30 days)
Show older comments
Martin Ryba
on 20 Sep 2023
Edited: Murali Yeddanapudi
on 27 Sep 2023
I'm much more practiced at MATLAB than Simulink, but this problem has stumped me on a few models. I do signal processing and am using Simulink->HDL Coder so doing more in Simulink. I want to sometimes run "Monte Carlo" runs of a model with randomized signal streams to for instance calculate Probability of Detection. However, I've tried From Workspace blocks and Signal From Workspace and any time you simply rebuild the signal vector it triggers a model recompile. I want to be able to have a simple iteratative loop (and ability to parfor would be nice) that builds the signal, calls sim() (preferably in 'rapid' mode) and then parses the output, without recompiling every time. Is Binary File Reader the only viable option? The parsim() documentation talks about establishing Configuration Sets but that seems very confusing and I'm not sure it avoids the problem. Examples that have solved this would be most helpful.
0 Comments
Accepted Answer
Murali Yeddanapudi
on 26 Sep 2023
Hi Martin:
Bharath brought your quesiton to my attention.
Firstly you are correct that changing the From Workspace variable causes the rapid-accelerator target rebuilt. We plan to fix this in a future release so that it does not rebuild and works as you expect with RapidAcceleratorUpToDateCheck off.
In the latest release, R2023b, using the root-level input port to feed the input sequence can avoid rebuild. I have attached a modified version of the example (that Bharath linked above) to demo this approach.
Best Regarfs
Murali
3 Comments
Murali Yeddanapudi
on 27 Sep 2023
Edited: Murali Yeddanapudi
on 27 Sep 2023
Changing a Constant block's value from run-to-run should not trigger a rebuild. If you can send us reproduction steps (with the necessary files), I can look into it.
The wall clock execution time in accelerator (or rapid accelerator) mode can be longer in some cases, if the computational content of the model is dominated by precompiled/optimized blocks implemented a C-Mex S-Functions. Not sure if this applies in your case, if you can send an example, we can dig into it and see if we can speed up the accelerator modes.
More Answers (1)
Bharath Venkataraman
on 20 Sep 2023
This example shows how to accelerate BER measurements for HDL LTE Turbo Decoder model with data from MATLAB feeding a Simulink model. Does this help?
3 Comments
Bharath Venkataraman
on 24 Sep 2023
I will check with some of the Simulink folks to see what the best approach is. One thing you could try is to put most of the model into another model and use model reference. That may reduce the time for the model compilation since the top level model will be pretty simple (assuming the model reference will need no compilation).
See Also
Categories
Find more on Sources 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!