Triggered subsystems at time t=0

10 visualizaciones (últimos 30 días)
Ubaldo Tiberi
Ubaldo Tiberi el 14 de Abr. de 2011
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?

Respuestas (3)

Jonathan
Jonathan el 23 de Abr. de 2013
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.

Fangjun Jiang
Fangjun Jiang el 15 de Abr. de 2011
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.

MarkB
MarkB el 21 de Abr. de 2011
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.

Categorías

Más información sobre Schedule Model Components en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by