question

Vns avatar image
0 Likes"
Vns asked Felix Möhlmann commented

Generating token based on probability and distribution

Hi -

im not quite sure if there is a way to generate tokens based on the following conditions:

Set a probability for token creation for each hourly slot. In the event a token where to be created set a randomize quantity distribution to be generated.

Time interval Probability Qty
0600 - 0659 20% 1 - 4 (2)
0700 - 0759
50% 1 - 4 (1)
0800 - 0859
10% 1 - 4 (4)


Thanks in advance.




FlexSim 22.0.8
tokendistributionsprobability
5 |100000

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

1 Answer

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

To use different expressions for the hours of the day, it would be best to use the "Date Time Source".

One way to either create no tokens or a random number is to just multiply two distributions together. "bernoulli" can be set up to either return 1 or 0 with the given probability. So only if it returns 1 will the quantity be something other than 0. The second distribution controls the quantity if it does return 1.

1675009684625.png


1675009684625.png (29.5 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.

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·
bernoulli takes a percentage value not probability - so bernoulli(20,1,0) gives 20% chance of returning 1.
1 Like 1 ·
Felix Möhlmann avatar image Felix Möhlmann Jason Lightfoot ♦ commented ·
Right, that's an oversight on my part. Thanks for the correction.
0 Likes 0 ·
Vns avatar image Vns commented ·

Thanks @Felix Möhlmann / @Jason Lightfoot for sharing the inputs.

I can't seems to get the model to run to generate the tokens based on this setup. Is there a step that i missed? probability and distribution.fsm

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Vns commented ·

Put the expression into the Arrival field at the bottom that appears when you have a table cell selected, not into the table directly. (Writing it into the cell directly interprets it as text, not FlexScript).

1675061928943.png

In your case the resulting table should look like this:

1675061949963.png

You only see the first row of the code that gets auto-generated when you type in the expression. This was changed in version 22.2 which my screenshot above is from.

Sorry for the confusion.

0 Likes 0 ·
1675061928943.png (6.0 KiB)
1675061949963.png (6.0 KiB)

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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