Access current simulation time in SimEvents blocks

조회 수: 6 (최근 30일)
Alexander Poets
Alexander Poets 2016년 6월 29일
댓글: Abdolkarim Mohammadi 2021년 3월 22일
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!!

채택된 답변

Devdatt Lad
Devdatt Lad 2016년 7월 13일
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.
  댓글 수: 2
Alexander Poets
Alexander Poets 2016년 7월 14일
That worked for me, thank you very much!
Abdolkarim Mohammadi
Abdolkarim Mohammadi 2021년 3월 22일
Please notice that the sample time of the Digital Clock must be set to inherited (-1).

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete-Event Simulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by