batch by number or sum of label

batch by number or sum of label

andreas_boehmer
Enthusiast Enthusiast
234 Views
2 Replies
Message 1 of 3

batch by number or sum of label

andreas_boehmer
Enthusiast
Enthusiast

Hi comunity,

i want to batch tokens wich are grouped by "token.Batchlabel" . This is a combination of source and destination.

every token represent a box. The  box has a weight. Typically 3 (quantifier: number of tokens) boxes are loaded at a trailer. But if the sum of weight label (maximum load for trailer) is reached with 2 boxes, the batch should be 2 (quantifier). With every load the sum of weigth is written as object label at the trailer.

every box at the trailer has to have same value in token.Batchlabel

 

FlexSim version 25.2

 

Thank You!

andreas_boehmer_0-1764071583771.png

 

0 Likes
Accepted solutions (1)
235 Views
2 Replies
Replies (2)
Message 2 of 3

FelixMoehlmann
Collaborator
Collaborator
Accepted solution

So the batch is limited by both weight and token quantity?

The only way to build this that comes to mind is to check if there is an existing batch and if it would exceed the limit if the token were to be added before the token enters the batch activity. If this is the case, you can manually release the current batch.

0 Likes
Message 3 of 3

andreas_boehmer
Enthusiast
Enthusiast

Hi Felix,

thank you! I had to look at which place in PF it is correct. It works now. In my case i check the batch after a token entered. So I changed your code in line 18 a little.

A additional token/ item (same start) appears some minutes later, so there is enough time.

 

/**Custom Code*/
Object current = param(1);
treenode activity = param(2);
Token token = param(3);
treenode processFlow = ownerobject(activity);

treenode batchActivity = token.BatchActivity;
treenode batch = getbatch(batchActivity, current, token.Batchlabel);

if( objectexists(batch))
{
		double limit = Model.parameters.AnhaengerSum;
		double sum = 0;
		for (int i=1; i<= batch.subnodes.length; i++)
			{
				sum += batch.subnodes[i].value.as(Token).Gewicht;
			}
			if (sum >= limit)
			{
				releasebatch(batch,0);
			}
}

 

0 Likes