question

Jose_andres Ca avatar image
0 Likes"
Jose_andres Ca asked Felix Möhlmann commented

Gather data only for staff on shift

I have a model in which I calculate discharge rates per hour for physicians. To calculate this I am doing total discharges/model.time(). This takes into account even when they are off schedule. I wanted to know if there is a way to check how much time a staff member spends off schedule or in different down behaviors and divide it by that. I also want to know if there is a better way to do this, for example, filtering out the data when staff is not on shift.


Thank you.

FlexSim 21.2.4
flexscriptstatistics collectorcalculated table
5 |100000

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

1 Answer

·
Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Felix Möhlmann commented

The healthcare environment automatically tracks how much time each object (including staff) spend in each state in a "people table".

1636531680834.png

To get the active time you can subtract the "OffSchedule" value from the "TotalTime" value. To do this you could set up a calculated table or use the same query that calculated table uses directly in code.

Both methods are demonstrated in the attached model. (Code in script console returns the "OnSchedule" time of MD1)

HealthcareActiveTime.fsm


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

Jose_andres Ca avatar image Jose_andres Ca commented ·

I need to code this calculation inside a statistics collector. What I tried is instance.stats.state().getTotalTimeAt("OffSchedule"); but it is not working. I dont know what specific code I can write to acess that number.

0 Likes 0 ·
Jose_andres Ca avatar image Jose_andres Ca Jose_andres Ca commented ·

code.jpg

This is a picture of what I am trying to do.

0 Likes 0 ·
code.jpg (56.9 KiB)
Felix Möhlmann avatar image Felix Möhlmann Jose_andres Ca commented ·

"OffSchedule" is part of the HC state profile, which you have to signify in the "state()" command. Otherwise the default profile is used.

instance.stats.state(2).getTotalTimeAt("OffSchedule");

The code in the script console at the bottom in my attached model should also work. Only the reference to the staff member needs to be adjusted.

Table.query("SELECT [OffSchedule] FROM [StaffStates.StatisticsCollector] WHERE Staff == $1", StatisticsCollector.getID(staffReference))[1][1];
1 Like 1 ·

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.