How to change the execution mode of the real-time application in slrt from Singletasking to Multitasking?

3 次查看(过去 30 天)
As shown in the figure below,I create a simulink model that have 3 unrelated tasks. I hope these tasks can simultaneously run on different cores of the target computer cpu. What should I do? I try to build this model into Real-Time Multitasking Execution mode.
As shown in the figure below,I chose the Allow task execute concurrently on target option in the Solver pane. Furthermore,the get_param function return the MultiTasking result.
But, when i load this real-time application into the target and run it. The application execution mode is still Single-Tasking.
So, How to change the execution mode of the real-time application from Singletasking to Multitasking?

采纳的回答

Dimitri MANKOV
Dimitri MANKOV 2022-4-4
Hi Liqun,
This is most likely due to the fact that your model uses only one sample rate. You can confirm this by highlighting the blocks of your model according to their sample time, see here.
By default, Simulink Coder can automatically partition the model into several tasks only if there are multiple rates defined in the model. Then each rate would get its own task.
If you need to run blocks that use the same step size in different tasks, you need to use explicit (manual) partitioning. You can find an example showing how to do that here.
Best,
Dimitri
  3 个评论
Dimitri MANKOV
Dimitri MANKOV 2022-4-5
That's correct: each task runs on a separate CPU core. The core assignment is done automatically, the user has no control over that. Tasks are sorted by priority (lower step size => higher priority), and a task can be preempted ("paused") to free a CPU core for a task with higher priority if necessary.

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by