question

Marco B8 avatar image
0 Likes"
Marco B8 asked Marco B8 commented

Wait for event activity

I have some problem with the "wait for event" activity. In my model I create 2 type of token that I send in 2 different way. In one way I assign a tracked variable "value" to the token (initialized to 0) and send it to "wait for an event" which get free the token when the variable reach the value 2. In the other way I increment the variable. Why when the variable "value" change, the "wait for event" activity do not release the token?

FlexSim 17.2.5
wait for event
provawait.fsm (19.2 KiB)
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

·
Jordan Johnson avatar image
2 Likes"
Jordan Johnson answered Marco B8 commented

Tokens do not have the "OnLabelValueChanged" event. Instead, you need to listen to the TrackedVariable's OnChange event. In the WaitForEvent, sample the OnChange of one of the Tracked Variables in the toolbox. Then change the Object field to say

token.labels["value"]

This will make the Wait For Event listen to the correct event.

However, you will also need to change the value of that token's Tracked Variable. You will need to get a reference to the token that owns the value label, and then set that label value.

Here is an update version of the model that demonstrates this approach.

provawait-fixed.fsm


provawait-fixed.fsm (19.6 KiB)
· 5
5 |100000

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

Marco B8 avatar image Marco B8 commented ·

Ok, it works perfectly. Thank you.

But now I have a new problem: is there a way to fired the token from the "wait for event" activity once at time, after the label changed value?

If I have 3 token on the "wait for event" activity when the label change all 3 tokens are fired. I would like that only one at time is fired by the activity. Is it possible to fix?

0 Likes 0 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ Marco B8 commented ·

Put a Zone or a Resource around the Wait for Event, to restrict access to that activity.

1 Like 1 ·
Marco B8 avatar image Marco B8 Jordan Johnson ♦♦ commented ·

Really thank you for your help and your support.

I have only the last (I hope) question: the "wait for event" now works well in case I have only 1 token in the process flow. If I have more than one that pass in this activity, flexsim send me the "exeption" that there is an error in the trigger event of "wait for event".

I tried to change the object of the "wait for event" from gettokenbyid(1) in gettokenbyid(current) but it is not the right solution.

Can I ask your help again? Really thank you!

I'm attaching the model with the "zone" activity in which only 1 token at time can enter.

wfe-problem.fsm

0 Likes 0 ·
wfe-problem.fsm (21.1 KiB)
Show more comments
Show more comments

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.