Possible to run Stateflow at 'same' speed as Simulink?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello!
Basis:
- Simulink-model runs with discrete solver (ode3) at solverstep = 0.1 second
- Stateflow-chart with about 20 transitions
- For testing, I implemented the same decision-logic from Stateflow as simple Simulink-blocks.
Now, if I run the simulation and scope the Stateflow-decisions (blue) versus the Simulink-decisions, Simulink (red) runs always faster.
For better understanding, I attached this scope.
I watched Stateflow stepping through the states and observed that it takes not only one step for the whole diagram but multiple steps to move through. Eventually this produces large errors.
One solution would be to take smaller solversteps. If I take steps like 0.01 instead of 0.1, it gets much better - but at the expense of calculation time.
Is there any possibility to force Stateflow to go through the chart within one solverstep, or is this a conceptual thing, or depending on the chart's construction? I already searched the preferences but did not find an appropriate seeting.
Thanks for your time and for any approach to a solution.
AL
0 件のコメント
採用された回答
goerk
2015 年 12 月 15 日
In Stateflow you design a state-machine and to change from one state to another you need one tick (sampletime step). If you don't want this behavior you must avoid the state. You can use junctions (the small circles).
I assume you use states/substates, but without your model (or a sample model), it is difficult to give a better answer.
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!