# question

4 Likes"

## How can we break the off schedule of a location in case of a late arrival into an outpatient clinic model ?

The problem is how to manage the late arrival in case of an outpatient clinic. If I put the off schedule more late ((to assure that all patient can be treated) it will disort my dashboard and KPI. Especially the %utilisation of the Xray area for exemple.

FlexSim HC 5.0.12

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

·
2 Likes"

This is one of those real-life situations that is particularly hard to simulate. For example, after closing time, if patients remain to be seen, how do you decide how many staff members need to stay on? Also, depending on how you've set up your patient arrivals it can be difficult to determine when the last patient has left.

The simplest solution is to take advantage of the dashboard's ability to report utilization by hour of the day. Rather than sending the staff off schedule at closing time, keep them on and look at the dashboard charts to see how long the staff had to stay after. If there were still patients after closing time then you will see that reflected in the utilization chart in the hours after closing time.

Another approach would be to use code to set your objects (either all of them or a few that you don't hook up to a shift schedule) to off schedule. Here's some code that can be used in an OnEntry trigger of a PatientExit object to set everything to an OffSchedule state if the last patient in the model is leaving and its after 5 PM.

```double startminutes = get(node("/totalstartminutes", StartTime));
double minute = time() + startminutes;

int year = minute / 524160;  //a year is made up of 7*52 = 364 days, a will begin with the number 1 and continue indefinately
minute -= year * 524160;
year += 1;

int week = minute / 10080; //a week is made up of 7 days, and will have the numbers 1 through 52 within every year
minute -= week * 10080;
week += 1;

int day = minute / 1440; //a day is made up of 24 hours, and will have the numbers 1 through 7 within each week
minute -= day * 1440;
day += 1;

double hour = minute / 60; //an hour is made up of 60 minutes, and will have the numbers 0 through 23 within each day

if(!(getcensus(model)-1) && hour > 17)
{	forobjecttreeunder(model())
{
if(getobjecttype(a) == OBJECT_Staff)
setobjectstate(a, STAT_OffSchedule);
if(getobjecttype(a) == OBJECT_PatientProcessing)
setobjectstate(a, STAT_OffSchedule);
if(getobjecttype(a) == OBJECT_PatientQueuing)
setobjectstate(a, STAT_OffSchedule);
}
}
```
· 6

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

·

Thanks a lot for your answer. You solution with the dashboard seems to be really usefull also for other utilisation (I ama bit scared with the code haha). But how can you report utilization by hour ? I tried different things but I have to say that the possibility per widget and graph are a bit poor... or maybe I don't know where I can change those settings... @Matthew Gillespie

PS: does I need to creat a new question for that type of follow up question ? sorry, I'm new here :)

0 Likes 0 ·
Christophe Compondu ·

We recommend asking a new question if it is unrelated to the original question or if the new question is something that people might come to this site looking for an answer to. I'm going to create a new question about making Hour of the Day dashboard widgets since I anticipate that being a common question.

0 Likes 0 ·
Matthew Gillespie ♦♦ ·

The new question is posted here.

0 Likes 0 ·
·

Is it possible to create the same type of code to set my object and my staff to off schedule only when the last patient leave the model each day ? without set an hour as in your exemple ? @Matthew Gillespie

0 Likes 0 ·
Christophe Compondu ·

As I mentioned in my answer, it can be difficult to know which patient is the last patient, especially if you're using any distributions in the arrival patterns. The code above checks both the model census and the time to determine when the last patient leaves. It's necessary to check the time because there could be times when all the patients leave in the middle of the day, but more patients will be coming later. If you don't want to check the time you'll need to come up with some other way to tell when the last patient leaves the model. This is very dependent on how you've set up your arrivals.

0 Likes 0 ·
Matthew Gillespie ♦♦ ·

Okay, thanks you a lot for those explanation! it really helps me to understand more how flexsim works.

0 Likes 0 ·
1 Like"

I like Matthew's first suggestion: don't force the staff to go Off Schedule at any particular time (or any particular event, such as the last patient leaving), but simply evaluate how long the staff actually did work each day by observing the staff utilization figures reported by our hour-of-day box plots.

On the other hand, for those times when you would like a little more information reported on actual hours worked in order to accurately calculate the number of overtime hours for example, you may need to do a little more. A modeling question posed to me recently by another user recently addresses these issues:

The clinic model needs to run 30 days using a 2-day repeating appointment schedule The standard hours for the clinic to be opened is from 8 a.m. to 6 p.m. each day. However, because the patient appointment schedule is fairly packed and there's the chance that some patient are late to their appointments, the clinic rarely closes its doors at 6 p.m. What I want to do is:
1. Have the clinic automatically remain open until the last patient leaves each day.
2. Record and display in a widget, the amount of overtime hours the clinic stays open for each day.
3. Record and display statistics (average, standard deviation, confidence intervals, etc.) for the daily overtime experienced by the clinic over the 30 day model run.
4. Collect stats on total work hours each day as well.
5. Display the patient census in the clinic over time.

To answer his questions, I built a small example model (see attachment) that demonstrates how to record, calculate and display statistics for a clinic's operating hours. The main points of the model are as follows:

1. I repeat a 2-day appointment schedule every 2880 minutes (2 days worth) and I've defined the simulation stop time to be 31:00:00 in order to stop the model after running 30 days. I applied a "variance" to the appointment arrivals of -10 + triangular(-5,20,12) in an effort to simulate patients who are told to come 10 minutes early, but some come earlier and most come later.
2. I used three global variables in the model:
• GV_ClosingTime_String (used to display the previous day's closing time in hh:mm format in a Display object on the screen)
• GV_TotWork_Hours (used to record the total hours worked in the previous day)
• GV_Overtime_Hours (used to record the overtime hours worked in the previous day)
3. I use the Activity Finished Trigger of activity 30_Exit to set the global variables when the last patient leaves the model each day. After setting the global variables, the trigger calls the FireDelegate(DELEGATE_CUSTOM) command which triggers an event on the data collectors.
4. I created a data collector in the Toolbox which I named OT_DataCollector. With "Custom" selected as the "Recording Event" for the data collector, it will record data for the two "Columns" I defined every time the FireDelegate(DELEGATE_CUSTOM) command is called in the model. I specified that columns 1 and 2 should record the values for the GV_Overtime_Hours and GV_TotWork_Hours global variables respectively.
5. All the widgets except the Model Census widget in the dashboard were created with the User Defined widget at the bottom of the Dashboard Library named "Using Data Collectors". Nothing special was done to set up the graphs and charts. I simply, chose OT_DataCollector as the "Data Collector", checked the box for the desired "Reporting Columns" and made sure I added a "Sample Set" (even though the custom sample set has no filters defined for it).

· 4

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

·

Thanks for this exemple. I will try to use this into my outpatient model too. By the way, it could be interesting to have more time possibilities into the box plot. The hours are often by 30 min (08:30 am - 17:30 pm).

0 Likes 0 ·
·

Hi ! I was really interested by the overtime indicators for my model. I tried to set up as yours @cliff.king. But it seems that I have a problem, I can't display any data into my overtime widget but I don't have any Errors... How can I manage it if I have more than one patient track ? (I use the Activity finished Trigger on each last activity ...). I've attached my model to give a better idea. In my case the clinic open at 08:30 and finish at 17:00. Thnaks in Advance !

pain-center-clinic-model-overtime-problem.fsm

0 Likes 0 ·
·

Hi, I am also using different tracks in my model, and I have exactly the same problem as @Christophe Compondu, did you finally find a solution to display data in the widget ? Thanks a lot, Eloïse

0 Likes 0 ·
Eloïse Martin ·

@Eloïse Martin @Christophe Compondu I've reposted this question here, since it's different from the original question. That also makes it easier for us to see which questions still need to be answered.

0 Likes 0 ·
0 Likes"

Similar concepts are also discussed in relation to the question here, if you are interested.

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