setting priorities on atomic subsystems

6 visualizaciones (últimos 30 días)
Laurent Dalbies
Laurent Dalbies el 1 de Abr. de 2021
Respondida: Jonas el 1 de Abr. de 2021
hello all,
here is the thing (model in attchments & screenshot below)
  • subsystem test_priorities_R2020b/doThis produces variable C (top right of the screenshot)
  • subsystem test_priorities_R2020b/doThat consumes variable C (bottom right of the screenshot)
  • both subsystems are atomic
  • I want to compute doThis before doThat to avoid a dividsion by 0 in doThat at the first computation step so I set the priorities doThis=105, doThat=110.
  • result : we can see that doThis is indeed executed before doThat thanks to the sorted order (1 vs 2), I'm happy.
now, I duplicate the same subsytems test_priorities_R2020b/SS2/doThis2 and test_priorities_R2020b/SS1/doThat2, the only differences are
  • those subsystems have different parent (SS1 & SS2)
  • doThis2 produces variable A instead of C and doThat2 consumes A
  • priorities are doThis2=5, doThat2=10 (doThis2 is still supposed to be executed before doThat2)
  • result : doThis2 is executed AFTER doThat2 ({4} vs {3} indicated by the sorted order), there's a division by 0 at the first step, I'm NOT happy.
why does simulink respect the priorities when the subSystems share the same parent while it's not the case when they're in separate subsystems ? the structure of the model is not so complicated, I'm surprised to see that simulink overrides the sequensing I specified.
some precisions:
  • the subystems are atomic so I can't use goto/from instead of memories
  • I want ot organize my model functionnaly, hence not having all subsystem them at the same level
  • I'll have more than 1000 subsystem in my model (eventually will be subsystem references) so not putting all of them in a subsystem makes sense
thanks for any ideas you could have.
Laurent

Respuestas (1)

Jonas
Jonas el 1 de Abr. de 2021
When using Data Store Memories, Simulink does not relate execution order from the placement of Data Store Read versus Data Store Write blocks inside subsystems. When using Goto/From signal lines, the execution order is determined by the signal line.
So you need to manually specify the execution order of the Atomic Subsystems or Simulink will have a go at it which can be an unwanted order indeed.
You can specify the execution order by making the Atomic Subsystems Function Call subsystems, and call them in the order you want by using a simple Stateflow. Like showed in the documentation here. The sample rate of the Function Call subsystems will be that of the stateflow chart.
You may also be able to set the priority of subsystems using the Execution Order Viewer.

Categorías

Más información sobre Schedule Model Components en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by