How to extract entity attributes to use as inputs to either a Matlab or Simulink function?

1 回表示 (過去 30 日間)
Sundar Aditya
Sundar Aditya 2019 年 8 月 10 日
コメント済み: Renato SL 2019 年 8 月 14 日
I want to plot the minimum delay of an entity over time in a M/M/1 queueing system. This is how I have set up my simulation
My entities have 2 attributes, start_time and rtt. The start_time is initialized (using the start_timer() function) to the current simulation time when entity is generated. Upon service completion, the rtt is computed as the difference between the current simulation time and start time (using the total_delay() function). I am then using a readily available block to extract the rtt attribute, after which I am keeping a running minimum of the rtt using this feedback mechanism (initial condition for the running minimum is inf). However, the probe always shows a 0 signal. Where am I making a mistake? In general, how do I extract entity attributes to either (a) use as inputs to any generic simulink or matlab function, or (b) save to the workspace? Thanks.
  6 件のコメント
Sundar Aditya
Sundar Aditya 2019 年 8 月 13 日
I believe I've figured out the souce of the error. As @Renato SL said, the problem was with my implementation of the running minimum in the fixed_delay() simulink function. The block to extract the entity attribute sets the attribute value to 0 before the first entity is generated. Since my attribute value is never negative, the running minimum is always 0.
Renato SL
Renato SL 2019 年 8 月 14 日
Good to hear that you have figured out what is the cause of the problem.
Anyway, if you want to share your model, you can either attach it to your question or to a comment like this.
There should be an Attachments button on the INSERT Tab when you are writing a question or a comment.

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

回答 (0 件)

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by