Simulink/Simevents entity time in system

791 views Asked by At

I am trying to measure the time an entity is in a system using SimEvents. For this I have followed the exact same reasoning as in this mathworks documentation: https://nl.mathworks.com/help/simevents/ug/measure-point-to-point-delays.html

However, I keep receiving the same error: 'untitled/startTimer/Clock' has sample time 0. Only constant (inf) or inherited (-1) sample times are allowed in function call subsystem 'untitled/startTimer'.

Does anybody have any idea what the error is trying to tell me or what I should do differently? I already tried using the digital clock as well, which gives the same error.

P.S. My end goal is to record the exact time a entity is in the system. My overall system has large variabilities in cycle times and if entities pass each other during the whole sequence, it becomes interesting. Hence, I need to know the exact start and end time for each entity in the system.

Model description: I have created a simple model to try some stuff out, but I simply create an entity with a timer attribute such that this is recorded.

Once the entity reaches the server I give the entry action: entity.timer = startTimer();

the startTimer function is simply a clock which provides the simulation time as output.

Before the entity is terminated I give the entry action: elapsedTime = readTimer(entity.timer);

the readTimer function is simply subtracting the previous measured simulation time from the new simulation time to get the interval simulation time.

0

There are 0 answers