Query on Sampling Time Relative to Computation Completion in Simulink

3 views (last 30 days)
I am currently working with a triggered subsystem in Simulink and facing a timing issue related to the sampling and updating of output values. My subsystem is triggered at time T1, and it starts a computation expected to complete within T1 + 1 step. However, I intend to sample the output at T+1 which is before the next simulation step (T1 + 1 step). I am concerned that this might lead to sampling values that have not yet been updated with the results from the computation triggered at T1.
Questions:
  1. If the computation is ongoing and hasn’t completed by T+1, would the sampled output reflect the previous step’s output or some intermediate state?
  2. What strategies can be recommended to ensure that the output sampled at T+1 accurately reflects the computation triggered at T1?

Answers (1)

Hitesh
Hitesh on 16 Sep 2024
Hi Yunchao,
I am assuming that T1 and T+1 are absolute times, T1 is the time when the triggered subsystem starts its computation, and T1+1 is step when the computation expects to finish.
The answer to your queries are as follow:
Q1) Typically, Triggered Subsystem block always hold its output at the value between triggers, so the sampled output reflects the previous step’s output. However, if the T+1 absolute time is greater than the triggered subsystem sample time than it might give the new updated values.
Q2) To ensure the sampled output exactly matches the output from triggered subsystem ensure that the sampling time is less than the time between two consecutive triggers.
You can refer to following documentations to understand more on “Triggered Subsystems” :

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!