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 Center および File ExchangeDiscrete-Event Simulation についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by