Message Send Block Sample Interval

1 次查看(过去 30 天)
Andy Reynolds
Andy Reynolds 2022-2-27
回答: Vidip 2024-1-17
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.

回答(1 个)

Vidip
Vidip 2024-1-17
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:

类别

Help CenterFile Exchange 中查找有关 Discrete-Event Simulation 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by