Message Send Block Sample Interval

2 visualizaciones (últimos 30 días)
Andy Reynolds
Andy Reynolds el 27 de Feb. de 2022
Respondida: Vidip el 17 de En. de 2024
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.

Respuestas (1)

Vidip
Vidip el 17 de En. de 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:

Categorías

Más información sobre Discrete-Event Simulation en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by