Missed ticks meaning in Simulink Desktop Real-Time

24 views (last 30 days)
Hi,
I have a really simple question. In all the Simulink Desktop Real-Time library I can find the word "tick", but I can't find an official explanation of its meaning.
I assume that a tick is the time length of the discrete solver, but for my real-time application I just want to be sure it is, because I need to evaluate the lag in millisecond the software could reach. So if it's correct I would just multiply the number of missed ticks lagging for the step length.
Thanks in advance.

Accepted Answer

Jan Houska
Jan Houska on 21 Jun 2021
Hi Federico,
yes, your understanding is almost correct. A "tick" is an event when the real-time kernel tells a block that the time to execute is now. That is, if you miss one tick, the block is one sample period behind. But please note that this is related to the sample time of the particular block that provides the Missed Ticks output, not to the per-model discrete solver time step length. Although these are the same in many cases, this is by no means a rule and they can be and often are different.
Good Luck, Jan
  4 Comments
Khalid Hersafril
Khalid Hersafril on 6 Jan 2024
Edited: Khalid Hersafril on 6 Jan 2024
I have a general question just to understand the general idea behind ticks. So I am currently using Normal mode for Simulink Desktop Real time, and as seen in the figure above, there is some missed ticks. For this scenario, as far as I understand, it falls under the following condition:
Process Contention — The model generally executes faster than required to keep up with the kernel. Process contention or some random operating system condition prevents Simulink from executing the model over some time period. In this case, the number of missed ticks jumps to some number, then missed ticks decreases to zero as Simulink catches up with the kernel. You can identify this situation by a sawtooth-like shape on a Scope connected to the Missed Ticks port. (Source: Simulink Real time Connected Mode)
So, since my model executes faster, it "stops" for a moment which led to a huge step occuring here. It then gradually decreases to zero which means that the simulink catches up with the kernel.
In terms of calculation, since the missed tick here is 2, and if my time-step is 0.005s, does that mean my block is behind the kernel by 2*0.005s=0.01s for that particular time-step?
Is it also safe to assume that the model is also behind the kernel by 0.01s as well since the block would still be executed in the same time loop as the model?
Jan Houska
Jan Houska on 16 Jan 2024
Hi Khalid,
yes, your computations are correct. 2 missed ticks mean that you are 0.01s behind the kernel if your sampling period is 0.005s.
As to the block vs. model question, the answer is generally yes - if the block is 0.01s behind the model, we can generlly say that the whole model is.
This does not account for the situation where part of the model has been already executed before Simulink has been temporarily suspended by the OS, so actually portions of the model may not be that much behind. However this situation would typically only affect internal states of the model anyway and would not visible to external observer, so I think it can be safely ignored.
Good Luck, Jan

Sign in to comment.

More Answers (0)

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!