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!