Is concurrent execution not possible for a Simulink model with sample time less than 1ms ?

9 views (last 30 days)
I have a simple simulink model same as the example Mathworks Data Parallelism. When I change the sample time of this model from 1 (original value in the sample model) to 0.0001 and try to build the model, simulink throws a block diagram error,
### Build procedure for model: 'data_parallel_model' aborted due to an error.
Error: The periodic trigger Periodic of model data_parallel_model has a base rate smaller than 1 ms. The current base rate is 0.0001 seconds. Increase the base rate of the periodic trigger by increasing the rate in the model.
For easy reference, I have attached the snippet of the concurrent execution window,
The periodic Trigger has a period of 0.0001 and also the same for every Task under it.
Is this because the concurrent execution or the CPU cores have a Limitation for sample time less than 1ms or am I doing something wrong?

Answers (3)

shi chen
shi chen on 15 Nov 2018
Have you solved this problem?
  2 Comments
Bhavanithya Thiraviaraja
Bhavanithya Thiraviaraja on 17 Nov 2018
The error did not arise when I increased the sample time to 1ms or more. I am not sure if this helps you.
Unfortunately, for my application, concurrent execution was not the optimal solution, so I had to drop it.
shi chen
shi chen on 18 Nov 2018
I also changed the sample time to 1ms or more like you, and the model passed. But for my application, the sample time must be less than 100us. I have to manually write the code to assign tasks.

Sign in to comment.


Dimitri Lindt
Dimitri Lindt on 22 Feb 2019
Hello, I have the same problem.
How can I automatically generate a code with a cycle time (periodic time/sample time) shorter than 1 ms?
Can one help?
Thanks in advance!

Qing Liu
Qing Liu on 16 Dec 2019
I answered the same question here:
An tricky method : manually modify the tlc file( <MATLAB_ROOT>/rtw/c/tlc/mw/ertwinthread.tlc )
comment out lines 773-780 (as follow) from
773 %if ((period * 1000) < 1)
774 %if LibIsDeploymentDiagram()
775 %assign errormsg = "The periodic trigger %<LibGetTriggerName(ehIdx)> of model %<::CompiledModel.Name> has a base rate smaller than 1 ms. The current base rate is %<period> seconds. Increase the base rate of the periodic trigger by increasing the rate in the model."
776 %else
777 %assign errormsg = "%<::CompiledModel.Name> has a base rate smaller than 1 ms. The current base rate is %<period> seconds. Increase the base rate of the model."
778 %endif
779 %exit %<errormsg>
780 %endif
to this
773 /%%if ((period * 1000) < 1)
774 %if LibIsDeploymentDiagram()
775 %assign errormsg = "The periodic trigger %<LibGetTriggerName(ehIdx)> of model %<::CompiledModel.Name> has a base rate smaller than 1 ms. The current base rate is %<period> seconds. Increase the base rate of the periodic trigger by increasing the rate in the model."
776 %else
777 %assign errormsg = "%<::CompiledModel.Name> has a base rate smaller than 1 ms. The current base rate is %<period> seconds. Increase the base rate of the model."
778 %endif
779 %exit %<errormsg>
780 %endif%/
and the Code Generation process will skip the check of the time step greater than 1ms.
Hopes to help you!

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!