Does the use of latency in statflow state work as expected?

Hi, I have a problem with stateflow, which is if I use a delay function in the state to execute two sentences, does that delay function work?
Because the compilation prompted me to delete, so I hope you help me,thanks!
This temporal logic expression has no side-effect. It either needs to be used in an expression, or removed if deemed unnecessary. State 'init' in Chart 'BLDDPM_cpu1_CCP_V1_0_20190818/extraControl/Protect_Logic': after(1,sec)
aftersec.png

 採用された回答

Jonas
Jonas 2019 年 8 月 19 日
編集済み: Jonas 2019 年 8 月 19 日

0 投票

Your state expression will not work indeed. You will need to create an additional state where ProtectStartBit = uint16(1); which has a state transition leading towards it with the condition after(1,sec);.

5 件のコメント

Xu Liu
Xu Liu 2019 年 8 月 19 日
This should be mentioned in the compilation information, but why is this necessary? Thank you very much
Jonas
Jonas 2019 年 8 月 19 日
Each sample time step of the controller, it can execute only one state execution or one state transition. If you define a delay of 1 seconds inside such a state expression, the controller will need to wait for one second to finish the calculation which should fit inside one sample time step. If your sample time is for example 1 ms, your controller will be stuck for 1000 samples. When using the temporal logic on a state transition, the controller will remain in the first state and will just check if a counter has exceeded 1 seconds, which it can execute within the one sample time step.
You might want to dive deeper into how stateflow with its states, conditions and transitions work.
Xu Liu
Xu Liu 2019 年 8 月 19 日
hi, Jonas
If my stateflow sample time is 1hz, does it execute the first sentence, then the controller can do something else, and then when the next second comes it executes the third sentence?
thanks
Jonas
Jonas 2019 年 8 月 19 日
Stateflow does not work that way, all expressions within one state are executed each sample time when active. You need to separate the expressions in separate states.
Xu Liu
Xu Liu 2019 年 8 月 19 日
I got it, thanks a lot

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStateflow についてさらに検索

製品

リリース

R2019a

質問済み:

2019 年 8 月 19 日

コメント済み:

2019 年 8 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by