Triggered subsystems at time t=0
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi all,
I'm dealing with a simulink model, in which I have several blocks that are triggered on their rising edge by a pulse generator block. Everything works fine, except for the first pulse. The subsystem is not triggered at the very beginning of the simulation, but I want it to be triggered. The only way to solve this problem is to slightly delay the pulse generator of some ms, but I cannot do that, since there are several S-Functions with aperiodic NextVarHitTime, for which I cannot add an offset. How can I solve such problem?
댓글 수: 0
답변 (3개)
Jonathan
2013년 4월 23일
The answer is to use an enabled subsystem. Use a detect increase block going to the enable, and then set the initial output as 1.
댓글 수: 0
Fangjun Jiang
2011년 4월 15일
Would a function-call generator block solve your problem?
If you have a pulse generator with a periodic time of 4s and your subsystem is triggered by the rising edge, you can achieve the same by using a function-call generator block with sample time as 4s. Change the trigger type of your subsystem to be function-call.
The subsystem will be triggered every 4s and it is first triggered at t=0.
댓글 수: 0
MarkB
2011년 4월 21일
Unfortunately, this sort of behavior is definitely impossible using only a triggered subsystem. Since the "edge" that triggers the subsystem is, by definition, two samples (either a high followed by a low, or a low followed by a high), it really can't execute on the first simulation step.
I would second Fangjun's recommendation that you use a function-call subsystem with a minor modification: Instead of just having a function-call generator drive the block, you could have a Stateflow chart that outputs function calls drive the block instead. The Stateflow chart allows much more complicated outputs that could allow you to always call the subsystem on the first step, and then have subsequent function calls occur based on more complicated criteria.
댓글 수: 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!