Stateflow while-logic dead loop

27 ビュー (過去 30 日間)
Dingxin Wang
Dingxin Wang 2024 年 3 月 28 日 6:51
編集済み: Fangjun Jiang 2024 年 3 月 29 日 19:13
I'am using stateflow to model a system.
With this logic i am expecting if the input is 1, the output should be 1. If the input is not 1, do nothing (it'a one-time logic, if the input is once not 1, the output will be none from then).
I used a step signal from 1 to 2 as an input. But the simulation can't proceed since its a dead loop at first time step. Why is that and how to solve this?
  2 件のコメント
VBBV
VBBV 2024 年 3 月 28 日 7:42
Try using a continuous signal instead of step signal
Dingxin Wang
Dingxin Wang 2024 年 3 月 28 日 8:11
yes i tried to use a signal builder to build a continuous signal but it still didnt work

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

採用された回答

Fangjun Jiang
Fangjun Jiang 2024 年 3 月 28 日 15:04
When input==1, you do have an infinite loop, right?
Connecting the feedback transition to the bottom junction would resolve it.
  2 件のコメント
Dingxin Wang
Dingxin Wang 2024 年 3 月 29 日 2:09
hi, i dont really understand the infinite loop here. In the loop there is a precondition (input == 1), when the input changes to 2, it should jump out of the loop. How can i understand this?
Fangjun Jiang
Fangjun Jiang 2024 年 3 月 29 日 19:12
編集済み: Fangjun Jiang 2024 年 3 月 29 日 19:13
See this for Stateflow while-loop. You don't have anything to change the condition. Any time when input==1, it will fall to the infinite loop trap.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComplex Logic についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by