How can I generate an output pulse in Simulink every time a function-call trigger occurs?
Show older comments
I have an existing Simulink model from a customer that uses function-call semantics as event triggers on Stateflow charts, amongst other things.
For our current purposes, I need to be able to generate a simple output pulse when a function-call trigger occurs, such that:
-> At the function call trigger, we set the output to value 1
-> After a fixed period of time (e.g. 1ms), the output value is set to 0.
And this then repeats whenever the function call trigger next occurs.
I tried setting up a stateflow chart as follows:

And although this does generate a pulse, the transition from High to Low state only occurs when the E event occurs, rather than 1ms after when the initial E event occurred. That is, it is obvious that the chart is going to sleep in between the E function-call events.
The E events are around 200ms apart, and each pulse of 'y' is also the same width - when I want it to only be 1ms wide when y=1.
Is there a way to change the chart settings so that it stays awake until the transition from High back to Low has occurred?
Or could I acheive the same behaviour using a Function-call subsytem instead of a Stateflow chart? Either is fine for me.
(The overall model uses a Variable solver, as the block generating the function-call pulses requires it.)
Answers (1)
Danny S
on 4 Mar 2022
0 votes
Categories
Find more on Decision Logic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
