Generate multiple entities at a time step with fixed intergeneration time

3 ビュー (過去 30 日間)
Mehwish Ahmed
Mehwish Ahmed 2018 年 9 月 29 日
回答済み: Krishna Akella 2018 年 12 月 4 日
I have two entity generators, production and demand, with both a schedule for every day. This schedule is specified in a workspace variable (or spreadsheet). I want that multiple entities are generated at a time step, with a fixed intergeneration time of 1. The number of entities to be generated at each time step of 1 is specified in the variable. How could I implement this?
Is it also possible to specify that the production should happen before demand every day?
For example I have two workspace variables: ProductionSchedule and DemandSchedule. ProductionSchedule occurs at t = 0, 1, 2, 3, 4, 5, etc. with number of entities generated: N = 10, 15, 30, 25, 20, etc. So at time 0, 10 entities are generated, at time 1, 15 entities are generated. The same for DemandSchedule but then on time 0.5, 1.5, 2.5 etc to ensure that production happens before demand every day.
Thanks!

回答 (1 件)

Krishna Akella
Krishna Akella 2018 年 12 月 4 日
Hi Mehwish,
Yes this can be done. You can set the Entity Generator's 'Time source' to 'MATLAB action'. In the action method you can access the workspace variables and set the value of dt (intergeneration time) to be 0 for N times, then set it back to the next IGT. For example:
persistent idx;
if isempty(idx)
idx = 1;
end
N = 5; % Read from workspace
IGT = 1; % Read from workspace
if idx < N
dt = 0;
idx = idx + 1;
else
dt = IGT; % Set equal to next IGT
% Reset idx
idx = 1;
end
You can see the example 'seExampleEstimatingAssemblyLineThroughput' that reads the generation schedule from an excel sheet. Although the batch size is always 1.
Hope that helps!
- Krishna

カテゴリ

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