フィルターのクリア

Enable block vs atomic block

3 ビュー (過去 30 日間)
alessandro mutasci
alessandro mutasci 2022 年 10 月 20 日
編集済み: Fangjun Jiang 2022 年 10 月 21 日
Good evening,I have a doubt regarding how the enable block and atomic block interact with each other. I'm attaching a small project to let you understand better my problem. I have a clock that enable a subsystem after 9 seconds, image: systemLevel0.png. When the block is enabled, an atomic subsystem with a period of 4 seconds, starts a recursive sum, image: systemLevel1.png, image: systemLevel2.png.
My problem, is that the first sum is at 12 seconds and not as I thought at 13 seconds; it doesn't start when the block is enabled. Could you give me an insight regarding how to solve this problem without using a trigger. In order to have a easier code generation?

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2022 年 10 月 21 日
編集済み: Fangjun Jiang 2022 年 10 月 21 日
The atomic subsystem is executed at 4s, 8s, 12s, etc. if enabled.
It is not "after it is enabled (regard this as time 0), then execut at time after 4s, 8s, 12s, etc" as you probably imagined.
Change the threshold value for enable flag to be 1,2,3 and see the effect.
To get what you want, you need to have some time related blocks inside the enabled subsystem. For example, a Pulse generator with period of 4 and pulse width 25%, to enable the atomic subsystem. You will get the desired output, once you set the threshold value to be 13 seconds.

カテゴリ

Help Center および File ExchangeIterator Subsystems についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by