question

Kari Payton avatar image
0 Likes"
Kari Payton asked Jason Lightfoot edited

Preempt tokens in zone except tokens with resources.

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.

FlexSim 21.2.4
process flow preemption
5 |100000

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

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

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


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
0 Likes"
Jason Lightfoot answered Jason Lightfoot edited

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.

5 |100000

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

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.