Azzera filtri
Azzera filtri

Stretch an For-Iterator Subsystem over multiple timesteps

1 visualizzazione (ultimi 30 giorni)
Hello,
I would like to know if there is an convinient solution to stretch an For-Iterator Subsystem over multiple timesteps. As of right now all of the 5 Iterations are calculated within one timestep. Is it possible to assign that 3 of those Iterations are done in one timestep and the other 2 in the next timestep?
I hope it is possible to understand what i am trying to achieve.
Thanks in advance.

Risposte (1)

Jonas
Jonas il 27 Mag 2021
That is not possible within the functionality of a for-loop (which is what a For-Iterator is). If it would be possible, the execution of the whole for-loop would not be deterministic, and that's bad.
What you can do, is execute the For-Iterator Subsystem in a lower sample rate, for example one which is twice as slow. Then, the results will only be ready after two iterations of your main loop. Then you will need to use Rate Transition blocks to make handle reading and writing of signals in between the two sample rate tasks.
  2 Commenti
julius
julius il 27 Mag 2021
Thank you for your answer! How exactly can i execute the Subsystem at a lower sample rate? Inside the Subsystem only const. or inherited sample rates are possible...
Jonas
Jonas il 28 Mag 2021
There are a few ways.
You can create two Function Call Subsystems, and call them with a Function Call Generator block where you set the sample time.
https://nl.mathworks.com/help/simulink/ug/using-function-call-subsystems.html
If you have Stateflow, you can trigger the Function Call Subsystems with an inherit sample time, where Stateflow triggers the one subsystem each time, but the second every other sample (using a counter for example). The Stateflow needs to output an 'event', it is a function call.

Accedi per commentare.

Categorie

Scopri di più su Subsystems in Help Center e File Exchange

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by