question

Tee Hiett avatar image
0 Likes"
Tee Hiett asked Tee Hiett edited

How do I clear a Global List as patients leave?

In List.jpg

InUse.jpg

Covid19 vaccinations auditorium_9.fsm

@Matthew Gillespie, @jason.lightfoot

In this model, when patients receives the vaccine, they are given a buzzer set for 15 minutes to carry with them. They enter the Observation Area, take the last available seat on a row and,when the buzzer sounds, they leave, dropping the buzzer off near the Exit, and are observed by a nurse.

When a patient takes a seat a label, InUse, on the seat is set to 1 and that seat is added to the list SeatsInUse. Whe a patient leaves a seat that label keeps the value 1 until the last patient on the row leaves then the labels for all seats on that row is set to 0 and all the seats are removed from the List SeatsInUse. This is so incoming patients are not stepping over patient already in the Observation Area.

This model seems to run correctly when the Repeat Random Streams is turned on. But when the Repeat Random Streams is turned off, the program will produce an entire row where all the seats have a InUse label of 1 and a Owner label of 0X0 and will remain on the List SeatsInUse.

This occurrence seems to be random and not repeatable. I have tried everything I could think of to identify the cause of the problem in the logic but have been unable to identify the real cause.

As always, thanks for the help.


FlexSim 20.1.0
FlexSim 20.2.1
healthcareflexsim 20.1.0custom codeglobal list
in-list.jpg (152.1 KiB)
inuse.jpg (226.2 KiB)
· 4
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 ·

I can't reproduce this - when the whole row is free it's removed from the list.

Can you see if you can find the time it happens and look for it in the case where random streams are repeating? If it only happens without repeating streams (unlikely) then we'll have trouble trying to debug i.

0 Likes 0 ·
Tee Hiett avatar image Tee Hiett Jason Lightfoot ♦ commented ·

Run1.jpgRun2.jpgRun3.jpg

Run4.jpgRun5.jpg

Here are the some results with the list. All run with Repeat Random Streams unchecked.

Run 1 was terminated early you can see that for row_4 the age column indicates that the the seats have been in use for 140 or so minutes when they should have been no longer than 20 minutes or so.

Run 2 the run was completed but one row was left on the list.

Run 3 was also stopped early for the same reason as Run 1

Run 4 completed with no records left on the list

Run 4 completed with seats for 3 rows left on the list

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Tee Hiett commented ·

Thanks - I couldn't see the pictures but I've determined that row 2 is left on the list in replication 2 with repeat streams on, so at least we can debug it.

0 Likes 0 ·
Show more comments

1 Answer

·
Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered Tee Hiett edited

The issue is that in some of these runs the last two people in a row get up and leave at almost the exact same time. So for both tokens that make it to the Clear Row? activity the census is 2 and not 1. This is because it takes a few seconds for a person to get out of their chair after you tell them to walk somewhere else.

In the attached model I put an ExitLocation activity between the Release Seat and Clear Row? activities. This just makes the patient stand up and exit the chair. In the original model I gave you a few weeks ago I had the patient walk to the Exit Spot before trying to clear the row, but you didn't like the few seconds of delay between the person standing up and walking to the exit spot. So the ExitLocation activity will just do the animation of the person standing up and by the end the person will be standing in front of the chair, but no longer in it. Then I changed the ClearRow? condition to be getcensus(row) == 0 since no one will be in the chairs at that point.

covid19-vaccinations-auditorium-9_fixed.fsm

Also, this is a good case for why you should use the Experimenter to run replications of the model and not uncheck the Repeat Random Streams option. Without repeating random streams it is extremely difficult to debug issues that only occur some times.


· 3
5 |100000

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

Tee Hiett avatar image Tee Hiett commented ·

thanks, @Matthew Gillespie for the solution and, especially, for the explanation.

Have a great weekend.

Tee

PS: Where do I find the Exit Location Activity?

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Tee Hiett commented ·

@Tee Hiett I opened the Inner Flow of a Walk activity and copied it out of there. We don't include the Enter/Exit Location activities in the library because you don't really need to use them in most models. They get used automatically by using the Walk or Escort Person, etc. activities. I only used it in this case because the model logic requires waiting until the person is out of the chair, but you also didn't like the lag time between the person standing and walking to the exit spot before clearing the row.

0 Likes 0 ·
Tee Hiett avatar image Tee Hiett Matthew Gillespie ♦♦ commented ·

That is a neat solution. I spent some time trying to find a way to do something like that. I didn't want to put an exit spot beside each chair.

I also looked at your suggestion of using the Experimenter to find a replication with an error and use that replication to debug. Works well and will save me time in the future.

Thanks

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.