Enable block vs atomic block
조회 수: 2 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Schedule Model Components에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!