Need help with Batch Process

Need help with Batch Process

brandon_tondreault
Not applicable
340 Views
4 Replies
Message 1 of 5

Need help with Batch Process

brandon_tondreault
Not applicable

[ FlexSim 7.7.4 ]

I am trying to figure out how to create a batch process where 15% of the time , the batch goes to Port 2 and the rest of the time goes to Port 1. By doing 'By Percentage' it only moves part of the batch to Port 2 and not the whole batch. Can you help?

0 Likes
Accepted solutions (1)
341 Views
4 Replies
Replies (4)
Message 2 of 5

philip_diem
Not applicable
Accepted solution

Maybe you could try this. It`s not elegant but it works:

Put a numlabel on the queue that produces the batch and call it e.g. "path"

On the OnEndCollection Trigger you just write this:

// Produce a uniform distributed random number between 0 an 100 
double randomNumber = uniform(0,100);

// Write the path for the batch accoring to the randomnumber you got
if (randomNumber < 15) setlabel(current,"path",1);
else if (randomNumber >= 15) setlabel(current,"path",2);

This sends the batch in 15% of the cases to port 1 and in 85% to port 2.

To make this work you just use the label at the the Send To Port trigger

6330-sendtoport.png

0 Likes
Message 3 of 5

mischa_spelt
Advisor
Advisor

Actually you can replace your whole code with

setlabel(current, "path", bernoulli(15, 1, 2));
0 Likes
Message 4 of 5

philip_diem
Not applicable

Oh yes you`re absolutely right. Thanks! The more you know 🙂

0 Likes
Message 5 of 5

brandon_tondreault
Not applicable

Thanks guys. This worked in my simulation. It saved me some time trying to figure this one out.

0 Likes