question

Visakh Sakulan avatar image
1 Like"
Visakh Sakulan asked Visakh Sakulan commented

How to release patients in batches?

How do I release patients in batches of 10 from a waiting area to a waiting room area (having 2 waiting rooms, each with a capacity of 10) only when one of the waiting rooms is empty?

FlexSim HC 5.0.12
flexsim hc 5.0batchingwaiting roomwating area
· 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.

Visakh Sakulan avatar image Visakh Sakulan commented ·

I have build a model using "user event". But at 8 min mark even though there is seat available in "WaitingRoom2" the patients wait till "WaitingRoom1" is vacant.bkb-2.fsmbatch.jpg

0 Likes 0 ·
bkb-2.fsm (75.7 KiB)
batch.jpg (298.5 KiB)
Adrian Haws avatar image
3 Likes"
Adrian Haws answered Adrian Haws edited

@Visakh Sakulan We were able to work out a solution for your model as you described. Overall the concepts of this are fairly simple, but the execution can be more difficult.

The idea is to have the travel activities from the Waiting Area to the Waiting Rooms only occur once two conditions are true: that 10 patients are in the Waiting Area, and that a Waiting Room is empty. Since I set up two Waiting Rooms, there are two travel activities that will be started once those conditions are met (they have no Predecessors).

Here are the steps to setting this up:

1. In the "Activity Finished Trigger" of activity 10_Arrivals, execute code that will first check to see if there are 10 patients in the Waiting Area, then will check to see if either of the Waiting Rooms is empty. Then, if the conditions are met, the corresponding travel activity will be started. Another very important this to note is that the "startactivity" command must be executed on all of the patient in the Waiting Area by using a loop, not just on the patient that allowed the conditions to be met. Here is the code, 20 and 30 being the names of the travel activities to the Waiting Rooms.
if(getcensus(WaitingArea1, 0, CENSUS_OCCUPY) == 10)
{ 
    if(getcensus(WaitingRoom1) == 0)
    { 
        for(int j = 1; j <= 10; j++) 
	{
	    treenode curPt = rank(WaitingArea1, j); 
	    startactivity(curPt, torownum(curPt, 20), 0.01); 
	} 
    } 
    else if(getcensus(WaitingRoom2) == 0) 
    { 
	for(int j = 1; j <= 10; j++)
	{ 
	    treenode curPt = rank(WaitingArea1, j); 
	    startactivity(curPt, torownum(curPt, 30), 0.01); 
	} 
    }
}
2. The previous code will work until the Waiting Area is full when one of the Waiting Rooms becomes empty. Then the trigger will not be fired. For that reason we need to set another trigger in the "On Entry" of the location after the Waiting Rooms (in this case, the Registration desk). The code will be the same as the code above, with an exception for the first line, as follows:
if(content(WaitingArea1) == 10)
Please see attached model and let us know if you need clarification on anything.

batching-exp-4.fsm (70.7 KiB)
5 |100000

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

Adrian Haws avatar image
0 Likes"
Adrian Haws answered Visakh Sakulan commented

Hi @Visakh Sakulan,

FlexSim HC doesn't have a built-in method of sending groups of patients at a time, but there is a roundabout way to accomplish this without the need for using code.

  1. Create an activity called "Process > Send Item" to place an item in the "Queuing" item object after patients travel to the Waiting Area.
  2. Have the "Queuing" object perform batching of 10 items and connect it to an "Exit" item object.
  3. Create an on entry trigger in the "Exit" object called "Start an Activity" and reference "Patient" and the specific Activity ID for traveling to the Waiting Room Area.
  4. Then in your activity to travel to the Waiting Room Area remove the "Use Predecessors" checkbox so that it only uses the on entry trigger in the "Exit" object. For the Patient Destination choose "Based on destination status" to select the FirstAvailable between each of the waiting rooms.

Sample model attached below.


· 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.

Visakh Sakulan avatar image Visakh Sakulan commented ·

Thankyou @Adrian Haws

The model is working fine, but I want the patients to move only if the waiting room is empty(Here once the Waiting area reaches 10 and if there is only one seat is available in the waiting room then 1 patient will move there, which it should not do). In my model the patients should move in batches of 10 and only if 10 seats are available in the waiting room.

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.