question

Maryam H2 avatar image
0 Likes"
Maryam H2 asked Ryan Clark commented

Force patients leave the model during off-schedule hours

Hi,

Is there any way to force the patients to leave the model after 5 PM other than creating several decide activities and locate them before/after some set of activities with this code in it:

Model.dateTime.hour<8 || Model.dateTime.hour> 16

The problem with this method is that tokens are stuck in the activity during the transition to off-schedule hours and will not leave the model. I was looking for an approach to trigger "left without being seen" unless the patient is in the process of MD visitation.

Thanks!


FlexSim 21.2.3
decide activityleft without being seenmodel time hour
· 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.

Ryan Clark avatar image Ryan Clark commented ·

Hi @Maryam H2, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Maryam H2 commented

You can use the "Release Token" activity to achieve this. 1634624875870.png

In the attached example, each patient token creates a child token. This child token will wait for its parent token to acquire an MD. Before it enters the "Wait for Event" activity, it is assigned a label that is used as the maximum wait time in the activity and coincides with the start of the off-schedule hours. In the example that time is 9:00AM.

If no staff has been acquired at that time, the child token will be released through the second connector and enter the "Release Token" activity. This is set to release the parent from whereever it is (in the example this will be the acquire activity) to the last two activities in the main flow (walk and remove patient).

1634625045013.gif

If the parent token that gets released might have already acquired some resource (staff/location/equipment), you would have to check for the respective label and route it through the corresponding release activity before removing the patient.

In the example model, the wait time also could have been used in the "Acquire Staff" activity directly, with a second connector leading to the end of the main flow. The advantage of using the "Release Token" activity is that the parent token can be moved regardless of its current position in the flow.

ReleaseWaitingPatients.fsm


· 6
5 |100000

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

Maryam H2 avatar image Maryam H2 commented ·

Thanks, @Felix Möhlmann Somewhere you mentioned that:" If the parent token that gets released might have already acquired some resource (staff/location/equipment), you would have to check for the respective label and route it through the corresponding release activity before removing the patient." How can I do that? I see some tokens stuck in the "Acquire Staff" activity?

Also why the event should be "On Exit"?

0 Likes 0 ·
Maryam H2 avatar image Maryam H2 commented ·
@Felix Möhlmann Also, what if I want to do this when people are in different stages of care process in the clinic not just in the waiting area?
0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Maryam H2 commented ·

@Maryam H2

It's normal for tokens to accumulate in the "Acquire Staff" activity, since the example model was purposefully build that way to showcase the "Release Tokens" activity. (More patients arrive than can be processed)

What I meant with the highlighted text is that, if you send a token to the end of the flow, potentially skipping activities that would release resources (staff, equipment, location), that resource would stay acquired forever and eventually the model would become stuck. You can check whether the label of a given name exists with "patient.labelname?".

By using this in a decide activity, you can check for any acquired resources, and route the token through the respective "Release" activity to free it up again, before removing the patient.

I altered the example by expanding the process a bit and releasing tokens from a second acquire activity as well. To do this I simply create a new child token, before the main token enters that second acquire activity. I also added a second event to the "Wait for Event" to listen for the exit out of the second acquire activity.

I chose "On Exit" because the token child token waits for one of two possibilities: Either the wait time elapses and the parent token is moved to the end of the process flow. Or the parent token has reached a position in the flow, where a premature release is no longer wanted/needed. This is the case once the parent token has acquired a resource (thus "On Exit") and is now being processed.

Releasing them from an ongoing process is more difficult, because you would have to manually delete any pending events associated with the process. Otherwise FlexSim will show errors when those events come due and the corresponding patient doesn't exist anymore. I would recommend against releasing the tokens from anything but an acquire activity.

Instead of reusing the same flow, you can of course also make copies of the "Release by schedule" flow for each position you want to release tokens from.

releasewaitingpatients_1.fsm

1 Like 1 ·
Maryam H2 avatar image Maryam H2 Felix Möhlmann commented ·
@Felix Möhlmann I got how to release resources as you did in the sample model. but for some reason it doesn't work for me, either the patient is stuck with the nurse escorting them or they just do not move, Is there any way to share the model with you? Can you share your email? Or if I send the model through a private question will you be able to check that?
0 Likes 0 ·
Show more comments