Preempt tokens in zone except tokens with resources.

Preempt tokens in zone except tokens with resources.

kari_payton
Not applicable
35 Views
2 Replies
Message 1 of 3

Preempt tokens in zone except tokens with resources.

kari_payton
Not applicable

[ FlexSim 21.2.4 ]

I am using preemption to send tokens in a zone to a different area after some time. However I don't want to send the tokens to a different area if they have acquired equipment resources. How can I make a flow that checks for equipment used and not preempt the token until after the resource is released? I don't think this is really possible because preemption is already doing some complex things, but maybe someone knows a better way to approach this.

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

moehlmann_fe
Explorer
Explorer
Accepted solution

You could do this by keeping an array of tokens that are eligible for preemption somewhere. For example an array label on the process flow itself.

The tokens would push themselves to the array when they enter the zone, remove themselves when they acquire a resource and get readded after they release the resource.

releasetokens_fm.fsm

0 Likes
Message 3 of 3

jason_lightfootVL7B4
Autodesk
Autodesk

You can use gettokens() to find the tokens with the shared assets just the same as you can to find those tokens in the zone.

Object activity=getactivity("ProcessFlow","Resource");
Array resourceTokens=gettokens(NULL,activity);

If you need to just find those of a particular process flow instance then pass the instance as the first parameter instead of NULL.

With those two you can just check if

resourceTokens.indexOf(zoneToken)==-1

To know that the zoneToken does not have that shared asset.

0 Likes