Clear Filters
Clear Filters

Simulate two event-driven tasks using Task Manager to execute 2 function-call subsystems - SoC Blockset

3 views (last 30 days)
I would like to know if it is possible or if there is a way to use SoC Blockset's Task Manager to simulate 2 event-driven tasks that trigger the execution of 2 independent function-call subsystems within a model. I haven't found a way to get it work as the model compiles but when trying to simulate the Task Manager RTE throws different errors.
My objective is to simulate 2 tasks. The first one with fixed period and variable execution time, while the second only triggered immidiately after the first. I am able to simulate the execution time plots, but since these are triggering 2 sub-systems, I was expecting to see also the time variation at the output of the algorithm in the second task (I only implemented a simple counter increment, so it is easy to spot delays in the plotted ramp).
I am not sure if SoC Blockset's blocks are teh best way to simulate this condition, but I really like how it plots simulated the task execution times.

Answers (1)

Anagha Mittal
Anagha Mittal on 27 Sep 2023
Hi Carlos,
Using SoC Blockset's Task Manager to simulate event-driven tasks that trigger the execution of independent function-call subsystems within a model is possible.
To simulate two tasks with different triggering and execution characteristics, please follow these steps:
  1. Set up the "Task Manager" block to define the tasks and their characteristics. Specify the task periods, execution times, and task functions.
  2. Create a function-call subsystem that represents the first task. This subsystem should contain the algorithm or logic you want to execute for the first task. Connect the output of this subsystem to the appropriate output port.
  3. Similarly, create another function-call subsystem that represents the second task. Connect its inputs and outputs accordingly.
  4. Set up the triggering conditions for the second task to be triggered immediately after the first task. This can be done by connecting the output of the first task subsystem to the appropriate input of the second task subsystem.
  5. Run the simulation and observe the execution times of the tasks using the Task Execution Time Plot block. This block will show the execution times of each task over time.
Please refer to the followwing documentation link for more information on Event-Driven Tasks:
Hope this helps!

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!