2

I would like to know how to measure the throughput rate of the production line on Anylogic.

Question: Are there any methods to measure the Time Between Departure of the agent at the sink block? >>(I will calculate the throughput rate by inverting the time between departure value.)

At the moment, I just simply calculated the throughput based on Little's law, which I use the average lead time and WIP level of the line. I am not sure that whether the throughput value based on this calculation will be equal to the inverted value of the time between departure or not?

I hope you guys could help me figure it out. Thanks in advance!

Carlzeriss
  • 33
  • 4
  • Unfortunately, it is not quite clear now what the time you need to measure. Could you please provide an example? Probably, you will be able to do the required measurements after completing step-be-step tutorial Bank Office included in AnyLogic (https://help.anylogic.com/nav/1_3). It teaches how to measure the time a customer spends waiting in the queue and the whole time he spends in the bank. – Tatiana Gomzina Oct 05 '17 at 11:44
  • @TatianaGomzina Thank you for the comment. – Carlzeriss Oct 05 '17 at 11:47
  • @TatianaGomzina I want to measure the time between each agent that leaves the system. For example, the first agent left the system (Flowed into the sink block) at 5 second(model time). Then, the next agent left the system at 8 second, So the time interval between these two agent that left the system is 3 second. Then, the third agent left the system at 15 second, which means that the second time between departure is 7 second. Is there anyway to measure that? – Carlzeriss Oct 05 '17 at 11:56
  • Thank you for your example! – Tatiana Gomzina Oct 05 '17 at 13:46

2 Answers2

2

There is a function "time()" that returns the current model time in model time units. Using this function, you may know the times when agent A and agent B left the system, and calculate the difference between these times. You can do this by writing the code like below in the "On exit" field of the "sink" block:

statistic.add(time() - TimeOfPreviousAgent);
TimeOfPreviousAgent = time();

"TimeOfPreviousAgent" is a variable of "double" type; "statistic" is a "Statistic" element used to collect the measurements

This approach of measuring time in the process flow is described in the tutorial Bank Office.

As an alternative, you can store leaving time of each agent into a collection. Then, you will need to iterate over the samples stored in the collection to find the difference between each pair of samples.

Tatiana Gomzina
  • 274
  • 1
  • 4
0

Not sure if this will help but it stems off Tatiana's answer. In the agents state chart you can create variables TimeIn, TimeOut, and TimeInSystem. Then at the Statechart Entry Point have,

TimeIn = time();

And at the Final state have,

TimeOut = time();
TimeInSystem = TimeOut - TimeIn; 

To observe these times for each individual agent you can use the following code,

System.out.println("I came in at " + TimeIn + " and exited at " TimeOut + " and spent " + TimeInSystem + " seconds in the system";

Then for statistical analysis you can calculate the min, avg, and max throughputs of all agents by creating in Main variables, TotalTime, TotalAgentsServiced, AvgServiceTime, MaxServiceTime, MinServiceTime and then add a function call it say TrackAvgTimeInSystem ... within the function add argument NextAgent with type double. In the function body have,

TotalTime += NextAgent;
TotalAgentsServiced += 1;
AverageServiceTime = TotalTime/TotalCarsServiced;

if(MinServiceTimeReported == 0)
{
    MinServiceTime = NextAgent;
}
else if(NextAgent < MinServiceTime)
{
    MinServiceTime = NextAgent;
}
if(NextAgent > MaxServiceTime)
{
    MaxServiceTime = NextAgent;
}

Then within your agent's state charts, in the Final State call the function

get_Main().TrackAvgTimeInSystem(TimeInSystem);

This then calculates the min, max, and average throughput of all agents.