Generate multiple entities at a time step with fixed intergeneration time
2 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Discrete-Event Simulation 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!