Process flow-create more tokens in the same code

Process flow-create more tokens in the same code

marco_baccalaro
Not applicable
60 Views
2 Replies
Message 1 of 3

Process flow-create more tokens in the same code

marco_baccalaro
Not applicable

[ FlexSim 16.0.1 ]

In the attached model I have created 5 tokens on source OnReset.

This makes the Process Flow not work well:

  • At first, in the Event List I have 5 Delay Activity StepStartActivityEvent (this is the origin of the problem)
  • Then, going on step by step, 5 TimerEvents are created for the 5 tokens and the first StepStartActivityEvent is deleted
  • Then other 4 TimerEvents are created and another StepStartActivityEvent is deleted
  • Another 3 TimerEvents are created and another StepStartActivityEvent is deleted
  • Another 2 TimerEvents are created and another StepStartActivityEvent is deleted
  • Finally another TimerEvent is created and the last StepStartActivityEvent is deleted
This is a simple model but I saw that this problem causes strange things such as that token go to next activity after being pushed to a list and without being pulled.

This problem doesn't happen when I create the 5 tokens in the same time but in different events such as OnExit trigger of 5 different items. But it happen if I create a token OnCreation for 5 items created in the same simulation time. Is it a bug that will be solved or there are some rules to apply on tokens creation through code?

735-tokens-same-time.jpg

0 Likes
Accepted solutions (1)
61 Views
2 Replies
Replies (2)
Message 2 of 3

brenton_king
Not applicable
Accepted solution

You shouldn't be creating tokens on reset, it causes problems. The developers recommend that you use a scheduled source that creates them at time zero. Will this work for you?

Message 3 of 3

marco_baccalaro
Not applicable

Sure, it works. Thank you. I’ll keep in mind this rule: do not create tokens on reset.

Just one thing to notice: if I send a delayed message and I create more than

one token in it I have the same problem.

I solve the problem if I send n messages and create a token in every message event.

So the problem is not on creating tokens on reset but on creating them all

from the same event.

0 Likes