question

Aditya Kamath avatar image
0 Likes"
Aditya Kamath asked Jacob Gillespie commented

How to create items from source by percentage?

I want to be able to create 3 different item types from a source such that each item type has a fixed percentage of being created (All percentages add to 100%). How can I do this in the source object?

FlexSim 16.0.2
sourcecreate by percentagesource percent
· 2
5 |100000

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

Stephanie Y avatar image Stephanie Y commented ·

How do you create or edit the table?

0 Likes 0 ·
Jacob Gillespie avatar image Jacob Gillespie ♦ Stephanie Y commented ·
@Stephanie Y

Create the table by opening the tool box, clicking the + button and selecting Global Table.

If you have any more questions then please create a new question instead of a comment on an old question.

0 Likes 0 ·
Regan Blackett avatar image
5 Likes"
Regan Blackett answered Aditya Kamath commented

The easiest way to do this would probably be the use of a dempirical() distribution in the "Set ItemType and Color" option under the OnCreation Trigger of the Source. demprical takes the name of a Global Table as it's parameter that is formatted such that you have a row for each value you want returned by the distribution and two columns. Column one should have the percentages and column two should have the associated values as show below:

So the value in column 2, row 3 will occur 50% of the time.

In your Source triggers, you could have something like this:

The Item Type field would then use the values and percentages defined in the table.


oncreation.png (6.9 KiB)
· 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.

Aditya Kamath avatar image Aditya Kamath commented ·

@regan.blackett This is exactly what I was looking for. Thank you!

0 Likes 0 ·
Michael Kramer avatar image
2 Likes"
Michael Kramer answered Aditya Kamath commented

When I need to use percentages I usually use an "Assign Labels" right below the "Source," then use the "Assign Labels" to create the percentages.


percentage3.png (87.3 KiB)
· 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.

Aditya Kamath avatar image Aditya Kamath commented ·

@Michael Kramer THanks for youe help!

0 Likes 0 ·
Jeff Nordgren avatar image
2 Likes"
Jeff Nordgren answered Marcello Rosadini commented

@Aditya Kamath

Aditya,

An alternative to the global table method referenced by Regan, you can just select the "By Percentage" dropdown option from the Inter-Arrivaltime field.

Then you can just add the number of percentage breakdowns that you want, totaling 100%. In the dropdown option where you specify the percentages, the second field title is "Time". Ignore that, that should be changed. It should read something like the popup that says "Enter value or expression" (right arrow). Other than that, just make sure that the percentages add up to 100.


percent1.png (33.8 KiB)
percent2.png (40.9 KiB)
· 4
5 |100000

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

Aditya Kamath avatar image Aditya Kamath commented ·

@Jeff Nordgren Thanks for sharing this! I did explore this option, however it looks like I am assigning percentages to the inter-arrival time and not the itemType or numbers of each item type. Is that right?

0 Likes 0 ·
Jeff Nordgren avatar image Jeff Nordgren Aditya Kamath commented ·
@Aditya Kamath

Aditya,

As you have discovered, the answer given by Regan is the best answer for your situation.

0 Likes 0 ·
Victor RV avatar image Victor RV commented ·

I am trying to use the function of Item type by percentage, but I do not have the proper output.

I have a source that delivers 4 items (Arrival schedule at time 0, and the items are pallets). I need that each item has 25% (one item of each time and if I increase from 4 to 8 items, then 2 items of each).

I've added a trigger on creation, Set Item Type by Percentage, and create four positions, with a percentage of 25% for each item type

item-type-by-percentage-task.fsm

My problem is at the end, I have 4 items, two for type 1, and one for type 2 and 3, but i don't have any item 4. (also if I increase the delivery to 8 items, I obtain 4 type 1, 2 type 2 and 2 type 3, but none item 4

Which is my error?

0 Likes 0 ·
Marcello Rosadini avatar image Marcello Rosadini Victor RV commented ·

Hi Victor,

If you cannot find the answer to your question on the site, please create a new question.

There is no error. When you choose that option, what you are stating is, that you want a distribution of items in those percentages. The larger the sample, the closer those values will fit.
Take a coin flip as an example: There is a 50% chance that you will get a head and a 50% chance you will get a tail.

That doesn't mean that if you toss the coin 2 times you will get 1 head and 1 tail. You could get also 2 tails or 2 heads.

If you flip it 1 million times it is very likely that you will have approximately 50-50

In your example in such a small sample it could be possible that you get all 4 items of just 1 item type.

Depending on what you need, probably assigning the item type by percentage is not the best option and you should set a fixed value from the beginning,

0 Likes 0 ·