Message Send Block Sample Interval
1 view (last 30 days)
Show older comments
When using a Message Send block to generate a SimEvents entity, why does a constant input with inf sample time generate a message every 0.1 timesteps? How can I prevent this behaviour and only generate a message when the input signal updates?
If I put the message send inside a Simulink function, then it only sends when the function is called. But I can't port the message into an atomic subsystem: I want to use the signal to cross the subsystem boundary and trigger entity generation inside it.
0 Comments
Answers (1)
Vidip
on 17 Jan 2024
In Simulink and SimEvents, the behaviour you're observing with the Message Send block generating an entity every 0.1 timesteps despite having an input with inf sample time is likely due to the default discrete event simulation settings in SimEvents.
To prevent this behaviour and ensure that a message is only generated when the input signal updates, you can use an Event-Based trigger which means instead of relying on the sample time of the input signal, use an event-based mechanism to trigger the Message Send block. For example, you can use a "Function-Call Generator" block to generate an event when your conditions are met.
If you want to use the signal to cross the subsystem boundary and trigger entity generation inside it, consider using a "Function-Call Subsystem" with the enable signal tied to the condition that indicates when the input signal updates. This way, the subsystem will only execute when the condition is true.
For further information, refer to the documentation links below:
0 Comments
See Also
Categories
Find more on Discrete-Event Simulation 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!