MATLAB Answers

0

Access current simulation time in SimEvents blocks

Asked by Alexander Poets on 29 Jun 2016
Latest activity Commented on by Alexander Poets on 14 Jul 2016
I'd like to access the current simulation time in a SimEvents block like the Entity Server to set attributes accordingly. The use case is to obtain the elapsed time an entity stayed in the Entity Queue in order to set an entity's waiting time attribute. Do SimEvents blocks provide a way to get the current simtime as a parameter without having to specify a Discrete-Event System? Thanks in advance, I appreciate any help you can provide!!

  0 Comments

Sign in to comment.

1 Answer

Answer by Devdatt Lad on 13 Jul 2016
 Accepted Answer

You can create a Simulink Function t = getTime() which contains a Digital Clock block and then call this function from any event action from a SimEvents block to get the current time.

  1 Comment

That worked for me, thank you very much!

Sign in to comment.