question

Rara Hasna avatar image
0 Likes"
Rara Hasna asked Jeanette F commented

Define or divide item label by statistical distributions

Hello, if I use Inter-Arrival Time on Source with statistical distributions and want to divide or define the items into 3 types by another statistical distribution, what should I use? I know that if I want to define it by percentage, then it works with Triggers - Set Label by Percentage, but is it possible to define it by statistical distributions?


It will be easier if there is any way to solve that without using Process Flow because my model is already complex and it will take much time to revise it all as process flow, but if there is any example of how to use it I will really appreciate it, thank you.

FlexSim 22.2.0
statistical distributionitem labeldefine
· 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.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Rara Hasna, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

You can use the "Code Snippet" option (or write code directly in the code editor window) to write any code you want into a trigger function. This includes assigning the return value to a label.

Most statistical distributions will return a decimal number. To get an integer (if that's the goal) you'd have to round the result. For example:

item.LabelName = Math.round(gamma(0, 5, 10, getstream(current)), 0);

(This requires item to be a variable declared in the header of the trigger code. Essentially any trigger that normally let's you set labels on an item will have that.)

5 |100000

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