question

Andrea B9 avatar image
0 Likes"
Andrea B9 asked Joerg Vogel commented

decide by percentage inaccuracy

decide_inaccuracy_problem.fsm
I do the decide by percentage and I have 56 and 44 % for connector 1 and 2 but over 200, 115 go to 1 and 85 to 2. I don't get why not 112 and 88.

Thanks in advance

 
               
FlexSim 20.0.0
processflowflexsim 20.0.0decide by percentage
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

tannerp avatar image tannerp commented ·

Hi @Andrea B9, was Matthew Gillespie's or tanner.p's or Jörg Vogel's answer helpful? If so, please click the red "Accept" button on one of their answers. Thanks!

0 Likes 0 ·

1 Answer

Matthew Gillespie avatar image
3 Likes"
Matthew Gillespie answered Joerg Vogel commented

That's just how probability works. You will rarely get the exact percentage you specify, although the more things you put through those connectors the more likely it is to even out.

Here's an example taken from this site that does a good job explaining probablity https://seeing-theory.brown.edu/basic-probability/index.html.

Say we flip a coin 100 times. A coin flip has a 50% chance of being heads (H) and 50% chance of being tails (T) as shown on the right with blue bars. However, you'll rarely get that outcome with 100 flips. Here's what I got after clicking the flip 100 times button, 56 of the 100 were Tails.

I clicked the button 4 more times (500 flips) and got this result:

251/500 is much closer


1592419481337.png (1.3 MiB)
1592419489036.png (19.3 KiB)
1592419722804.png (1.1 MiB)
1592419730152.png (9.4 KiB)
· 7
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

tannerp avatar image tannerp commented ·

@Andrea B9,

There's a handful of ways that you could assign these labels. I've modified your model to include a Global Table that's used to calculate and assign the labels. The first 112 tokens are assigned a "Connector" label value of 1 and they are counted in the Global Table. When the Global Table count exceeds 112, the remaining 88 tokens are then assigned a "Connector" label value of 2. Hope this helps!

decide-inaccuracy-problem (1)_1.fsm

1 Like 1 ·
Andrea B9 avatar image Andrea B9 commented ·

ok, so if I want exactly 112 to port 1 and 88 to port 2?

how can I do?

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel commented ·

If you have a fixed ratio and count the items leaving through a distinct port, you can decide for the next item which port the item has to leave to keep the ratio balanced by a table query.

The column "basePort" defines the items to release through a port. The column "output" counts the items exiting through this port. The Table query divides output by basePort value and order them ascendingly. The row number of original table is then the result, which is also the port number the items is going to.

Output_by_ratio.fsm

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Joerg Vogel commented ·

A primitive approach, you might think about, uses two sources. Both sources have a constant interarrival time, but the interarrival time is different in the ratio of the two types.

0 Likes 0 ·
Show more comments