Enabling a subsystem in a multi rate Simulink model at specific time or with a delay

11 views (last 30 days)
I have a multi rate model in Simulink with 3 rates. A (0.1), B (0.2) and C (0.8). This is meant to run in real-time and the rates are specified based on how long each the Subsystems take to execute.
The base rate of the model is 0.1. I have 3 subsystems, each running at the separate rates. I am using Enabled Subsystems to control when I execute each one. I have a drawing of what I am attempting to do.
A has a pulse that is sampled at 0.1, 1 sample wide and 12 samples long with 0 delay. This lets it execute once every 1.0 seconds.
B takes 0.2 seconds to complete and I use a pulse that is sampled at 0.2, 1 sample wide and 6 samples long.
The problem is with C. I can't figure a way to enable C to start at 0.2. I want the periodic rate of C to be delayed by 0.2. So I tried using a pulse sampled at 0.1, 8 samples wide, 10 samples long, 2 sample delay. The pulse works but the system doesn't get enabled correctly. It enables at 0.8.
So the question is how do I get Subsystem C to execute with a delayed start?

Answers (1)

Richard Zappulla
Richard Zappulla on 30 Mar 2017
To me, it sounds like you are trying to use the enabled sub-systems and pulse generators as a "scheduler" of sorts. I am not sure if this is an option, but you could try making the appropriate blocks in your model "atomic blocks", specify the sample time for each system, and then add rate transition blocks as appropriate. From there, the Simulink "scheduler" will take care of the rest.
Have you explored this option?

Categories

Find more on Schedule Model Components 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!