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
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 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