1

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.

  • 1
    Show us your code so we can help you. – Kalle Richter May 08 '18 at 08:33
  • 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 output. Before the entity is terminated I give the entry action: elapsedTime = readTimer(entity.timer); the readTimer function is simply subtracting the previous measured simualtion time from the new simulation time to get the interval simulation time. – Noud Erents May 08 '18 at 08:38
  • You really need to show the code by editing your question rather than describing it in a comment. – Kalle Richter May 08 '18 at 08:41
  • I am really new to simulink and simevents, but there is no code as far as I know. I simply created the model by drag and drop. Or is there some underlying code which I can view somehow? – Noud Erents May 08 '18 at 08:43
  • I see the point. This site is about programming questions, maybe there's a stackexchange site which fits you better (I didn't dive into the link and don't get what it's about (electronic design?)). However the question "Does anybody have any idea what the problem is with my model?" is too broad to answer with the given information. – Kalle Richter May 08 '18 at 08:47
  • Okay, thank you still for the effort :) – Noud Erents May 08 '18 at 08:49

0 Answers0