フィルターのクリア

Getting the current simulation time in Simulink

14 ビュー (過去 30 日間)
Ketan
Ketan 2012 年 5 月 2 日
コメント済み: Gabriele Gualandi 2021 年 4 月 18 日
Hi,
I am building a discrete event simulation in Simulink using the SimEvents toolbox. In the simulation model, I am using several matlab function blocks that need to access the current simulation time.
Currently I am doing this by using the clock attached to timed to event signal block and providing this as the input to each of the Matlab function blocks. Is there a way to access the current simulation time globally from each of the matlab function blocks without having to have the clock as an input parameter to each of the function blocks?
I appreciate your help
  2 件のコメント
Wolfgang Garn
Wolfgang Garn 2013 年 5 月 24 日
In general this highlights the need of the current simulation time for SimEvents being easily accessible for MATLAB Function blocks, where the current simulation is the time the input signal was created. The SimEvents debugger contains a function ( t=simtime;), which might be useful. Unfortunately its use within a Matlab function block is not straight forward (or possible!?).
By the way there is an interesting page about deriving custom statistics. The "Compute a Time Average of a Signal" example suggests that a Digital Clock could be used, which would avoid the "time to event signal" block. Unfortunately it does not work. Using a "clock" plus a "time to event signal" instead does not generate the desired timings and signal values.
How can the "current signal simulation time" be fed (or read within) a Matlab Function block?
Gabriele Gualandi
Gabriele Gualandi 2021 年 4 月 18 日
Use getCurrentTime(obj)

サインインしてコメントする。

回答 (1 件)

TAB
TAB 2012 年 5 月 3 日
Go through below links to see below, how to share a variable globally in different Embedded matlab function blocks.
  1 件のコメント
Kaustubha Govind
Kaustubha Govind 2012 年 5 月 3 日
Unlike in S-functions, where you can use ssGetT, I don't think there is a good alternative for MATLAB Function block other than what TAB suggested.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDiscrete-Event Simulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by