how i can generate multiple entities with same Generator Block (simevents)?

6 ビュー (過去 30 日間)
matteo bartoloni
matteo bartoloni 2018 年 11 月 22 日
コメント済み: Robert Kugler 2020 年 5 月 16 日
Hey, for example i want generate 2 enties every 1 second with same Generator Block ( in 10 second of simulation i want see 20 entities in Entity Terminator) . Can someone help me?

回答 (1 件)

Krishna Akella
Krishna Akella 2018 年 12 月 4 日
Hey Matteo,
You can setup the 'Entity Generator' block so that the 'Time source' is set to 'MATLAB action'. Then you can write the following:
persistent genTwice;
if isempty(genTwice)
genTwice = true;
end
if genTwice
dt = 1;
genTwice = false;
else
dt = 0;
genTwice = true;
end
The value returned by the MATLAB action is 'dt', which is the delta time for the arrival of the next entity or the entity inter-generation time. By flipping the value of dt to be either 1 or 0, you can achieve what you want.
If you have a more complex entity generation pattern, you can read in the values from an excel sheet or a MAT file into your workspace and assign them to dt.
You can see the shipping example seExampleEstimatingAssemblyLineThroughput, that reads from an excel sheet to generate parts as per a pre-defined schedule.
- Krishna
  2 件のコメント
matteo bartoloni
matteo bartoloni 2018 年 12 月 5 日
Thank you so much Krishna!!!!!!!!!
Robert Kugler
Robert Kugler 2020 年 5 月 16 日
Hi Krishna,
What if I want to randomize the number of entites created within one time interval?
For example, if I assume a binominal experiment for the entity generation with 20 trials and probability 0.05. Every time interval the generator should generate a number of entities, based on this probability. How do i do it?

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

カテゴリ

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