![RandomLotSize.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/207983/RandomLotSize.png)
Non-constant Batch Size
조회 수: 3 (최근 30일)
이전 댓글 표시
I am creating a DES and I want the number of entities generated at each unit of time to be the output of a user defined function (the function will be stochastic). I have not been able to replicate this process yet and I am unsure which enity creator block to use.
댓글 수: 0
답변 (1개)
Krishna Akella
2019년 3월 12일
Hi Alex,
In an entity generator you can set the 'Time source' to be 'MATLAB action' and then manipulate the output value 'dt' (the delta to the next generation time). For example, the following would generate a random number of entites very 2.0 seconds (interGenerationTime). You can make 'interGenerationTime' to be random too. So you would have a random number of entities being generated at random times.
![RandomLotSize.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/207983/RandomLotSize.png)
- Krishna
댓글 수: 2
Krishna Akella
2019년 3월 13일
In the above example, 'dt' stands for the delta time to next entity generation. By setting the value of 'dt' to 0, we are essentially asking the entity generator to generate another entity after 0 time units. By repeatedly setting the value of 'dt' to 0 until we reach the required 'count', we are making the generator generate as many entities. Upon reaching the target 'count', we are setting 'dt' equal to 2.0. Which would then make the generator wait for 2 units of time before it generates the next entity.
Best,
Krishna
Robert Kugler
2021년 8월 9일
편집: Robert Kugler
2021년 8월 9일
Instead of generating a random number of entities in the entity generator, is it also possible to create ramdomly sized batches with entity batcher block? For instance, a generator generates an entity every single time unit, the entities go into a queue and a batcher block creates randomly sized batches from the queue (i.e. the batch size is randomized anew after a single batch has been created). This would mean that the batcher decides a batch size at random, waits until enough entities have come from the queue for the batch size to be filled, creates the batch and sends it out, decides a new randomized batch number, and does the whole thing again. How could this be implemented?
참고 항목
카테고리
Help Center 및 File Exchange에서 Messages에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!