How to make Simulink blocks like delay (z^-1) inherit input sample time from Entity generators?
6 次查看(过去 30 天)
显示 更早的评论
As in the attached image,
I have a time-based Entity generator in my Simulink model (period 1.3 seconds). I want to use one of its statistics port for some computation in the model, using computation blocks like z^-1 (single sample delay), sum block, multiply by constant blocks and so on. But the problem is that after connecting to the delay block, the output of the delay block gets assigned a sample time period of 0.2 seconds. The output connection of the delay block is colored red and the Timing legend says that the output of the delay block has Discrete sample time type. Since the delay block is configured to inherit the input sample time (-1), I was hoping that the output of the delay block would have Event based output sample time (in purple color). Can someone please help me understand what is going on and how can I get my desired behavior?
I have a time-based Entity generator in my Simulink model (period 1.3 seconds). I want to use one of its statistics port for some computation in the model, using computation blocks like z^-1 (single sample delay), sum block, multiply by constant blocks and so on. But the problem is that after connecting to the delay block, the output of the delay block gets assigned a sample time period of 0.2 seconds. The output connection of the delay block is colored red and the Timing legend says that the output of the delay block has Discrete sample time type. Since the delay block is configured to inherit the input sample time (-1), I was hoping that the output of the delay block would have Event based output sample time (in purple color). Can someone please help me understand what is going on and how can I get my desired behavior?Additionally, is there a way to have a sum block that can accept input1 coming in at period T1 (Event-based), input2 coming in at period T2 (Event-based) and output sampled at period T2 (Event-based)?
0 个评论
回答(1 个)
Riya
2025-6-3
Hi John,
I understand you are facing an issue where blocks like “z⁻¹”, “Sum”, and “Gain” do not inherit the event-based sample time from a “SimEvents Entity Generator”. This happens because these standard Simulink blocks are designed for “time-based” signals and are not compatible with “event-based” inputs (purple lines).
To resolve this issue, you can refer to one of the following workarounds:
1. Use a “Discrete-Event Subsystem” - Place your logic inside a “Discrete-Event Subsystem”, which is designed to handle “event-based” signals.
2. Use “Triggered Subsystem” - Convert event arrivals into scalar signals and then use them to trigger regular Simulink logic using a “Triggered Subsystem”.
3. Store Values as Attributes - Instead of using “z⁻¹”, store and manipulate previous values using “entity” attributes in “SimEvents blocks”.
Do note that setting the sample time to “-1” works for discrete time inheritance, not event-based. Hence, event signals need to be handled using event-compatible blocks or subsystems.
For more reference, refer to the following official documentation:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!