question

Nathaniel W avatar image
0 Likes"
Nathaniel W asked Nathaniel W commented

Event-Triggered Source OnRelease Creates 2 Tokens instead of 1

I have created a process flow called "Scope Cleaning" which is called every time a scope is dropped off at a "Drop Off" location. The process starts when the drop off location is released, which is the "Release Drop Off" event below. As seen below, there is only one token moving down to the Release Drop Off event.

However, as seen below, 2 tokens are being created, and I don't know why. The location is only being released once, so why is the source being triggered twice? Any help would be much appreciated. Thank you!

The full model can be found here: NewCleaning.fsm

FlexSim 21.0.2
processflowflexsim 21.0.2tokenevent source
1614977229722.png (39.9 KiB)
1614977556635.png (34.4 KiB)
newcleaning.fsm (973.5 KiB)
· 1
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 ·

Can you fix the exceptions in your model first?

time: 0.000000 exception: FlexScript exception: Invalid row number: 0 in <no path> at MODEL:/Tools/ProcessFlow/Arrivals/Create Patient>variables/labelSet
time: 0.000000 exception: Exception caught in evaluation of /Tools/ProcessFlow/Arrivals/Create Patient>stats/instances/Arrivals/onPersonCreated
time: 1900.818605 exception: Error: Resource Move to Prep Room/RN has not been acquired at Colonoscopy/Colonoscopy in process flow "Patient Flow".
time: 3708.571008 exception: Label property Patient retrieved on token "id:122". Label does not exist. At activity Cleaning Process/Acquire Equipment in process flow "Scope Cleaning".
time: 3708.571008 exception: Label property Patient retrieved on token "id:126". Label does not exist. At activity Cleaning Process/Acquire Equipment in process flow "Scope Cleaning".
0 Likes 0 ·

1 Answer

·
Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered Nathaniel W commented

Locations, by default, are released twice. First when you use a Release Resource, and second when the patient physically leaves the location and, if doing maintenance, maintenance is finished. This is because all locations are attached to the Location object flow and in that flow the location effectively acquires itself to make sure it's not reacquired before the patient physically leaves and/or maintenance is finished. Then the location releases itself once those two conditions are met. You can see that logic if you click on a location object and then press the Open Process Flow View button in Properties.

The locations's OnRelease has a second event parameter called Releasing Self which you can use to filter out one or the other of the two releases. In the screenshot below I set the Wait for Event activity to match value of 1 for the Releasing Self parameter so that I'm listening to the 2nd release.

newcleaning_releasingSelf.fsm


· 1
5 |100000

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

Nathaniel W avatar image Nathaniel W commented ·

Thank you so much Matthew! This is perfect.

0 Likes 0 ·

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.