Effacer les filtres
Effacer les filtres

Structure a complex calculation in boxes rather than in states

1 vue (au cours des 30 derniers jours)
Bastian
Bastian le 28 Mar 2022
Réponse apportée : TecBen le 30 Mar 2022
A complex calculation is structured in small steps inside Stateflow states. As each of these states defines one timestep in simulation, the execution may be accelerated using boxes instead of states.
In this simple example, counters are incremented inside states and boxes, respectively. The states path increments by one per timestep (exept State3, which imitates the implementation of boxes and is highlighted yellow as "unreachable state"), the boxes path takes all incrementations in one single time step.
So, acceleration of calculations works as expected.
But is there more to consider in using boxes for strcuturing complex calculations? Might there occure problems when it comes to code generation?

Réponse acceptée

TecBen
TecBen le 30 Mar 2022
A box is a graphical object that defines a namespace that you can use to organize objects in your chart, such as states, functions, and data. Boxes allow you to quickly glance at your chart and recognize which states or functions work together to perform certain tasks. Doc page https://www.mathworks.com/help/releases/R2022a/stateflow/ug/grouping-chart-objects-with-boxes.html
The generated C/C++ code from the chart corresponds to the Stateflow chart simulation results after building auto code from model.

Plus de réponses (0)

Catégories

En savoir plus sur Stateflow dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by