How to use stateflow inside a simulink closed loop?

1 回表示 (過去 30 日間)
Moritz Ischebeck
Moritz Ischebeck 2021 年 6 月 16 日
コメント済み: Moritz Ischebeck 2021 年 7 月 12 日
In my simulink project, I replaced SUM blocks with stateflow and equivalent additions inside. And then the simulation got stuck without error messages. (My plan was to add logic later, after that stateflow is working.)
I tried to replicate the error in a small example.
What causes the difference in the example? (maybe extrapolating?)
How to fix it and still using stateflow?

採用された回答

Yoshi Minagawa
Yoshi Minagawa 2021 年 7 月 2 日
Hi Moritz,
I understood that your question is about the cause of the difference output between the two logics in attached model.
I think that the difference of these output are caused by the solver. (I think it is because there might be a difference in the calculation of the Jacobian matrix when calculating the value of the next step in Simulink. In this case, there may be a difference in the result with the variable step setting.)
However, the essential result of calculation is the same even if it is made with stateflow. Try changing the maximum step size to small (ex. 0.01s). The two outputs are almost the same as shown below. Therefore, by making the step size sufficiently small, it is possible to implement the expected processing even when using stateflow.
I hope this will help.
  1 件のコメント
Moritz Ischebeck
Moritz Ischebeck 2021 年 7 月 12 日
yes, that helped me, thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by