cancel
Showing results for 
Search instead for 
Did you mean: 

Customizing Simulation Results to get Length of Stay for Patients

Hello,

 

I am working on an Emergency Department model, and I need to get the results of the average length of stay of patients inside the emergency department which means in my model: (average time the entity spends during its workflow from source to drain). I thought at the beggining that this is the mean life time, but it turns out to be completely different.

Do I need to write a code to get the length of stay? and how can I customize my simulation results?

 

Thanks in advance

Mohamed Elshal

10 REPLIES

Re: Customizing Simulation Results to get Length of Stay for Patients

Legend
Legend
You can sumarry the time information in a table and then get the average and also draw it.
When you create a patient, update your table like this

Tab["Patient",index] := @ ;
Tab["T_initial",index] := EventController.Simtime ;

and the update again when your patient leaves.

Tab["T_initial",@] := EventController.Simtime ;

Then you record the whole time information about your clients.

I hope it helps
O.C

Re: Customizing Simulation Results to get Length of Stay for Patients

Thanks for the information. I beleive it is all I need, but do I have to do it through a method and can you help me with the method outline and table format. I am sorry I am not proficient in software.

 

Mohamed

Re: Customizing Simulation Results to get Length of Stay for Patients

Legend
Legend

You should create a table like this : 

 

 Capture.JPG

Create a method call Update_Tab_Entrance :

 

is
do
    local myPatient : string := to_str(@) ; 
    local index : integer := tab.indexydim + 1 ; 

tab["Patient",index] := myPatient ; 
tab["Entrance_Time",index] := EventController.Simtime ; 


end;

 

and an other method called Update_Tab_Exit : 

 

is
do
    local myPatient : string := to_str(@) ; 
    
tab["Exit_Time",myPatient ] := EventController.Simtime ; 

tab["DT",myPatient ] := tab["Exit_Time",myPatient ] - tab["Entrance_Time",myPatient ] ; 


end;

Now with this you record the time every patient spend between t0 and t1. 

 

Then you can geat the meanvalue of the column DT easily ! 

Good luck 

O.C

Re: Customizing Simulation Results to get Length of Stay for Patients

Thanks for Information

but the code is not working I tried several times. Should I define the entity name or any other variable in this code? and Is there any thing missing?

 

I am sorry not much proficient with the software

Re: Customizing Simulation Results to get Length of Stay for Patients

I created a new model for testing the code. It is still not working

Please see the attached file in Plant Simulation 11

Re: Customizing Simulation Results to get Length of Stay for Patients

Legend
Legend
I'll have a look ....

Re: Customizing Simulation Results to get Length of Stay for Patients

Legend
Legend

I can't open your model (because of a non commercial licence problem). 
Anyway, I created a new model the works like I explained before. 

There you go. When you click on the button " Waiting Time" you get how long a patient was waiting. 

 

Re: Customizing Simulation Results to get Length of Stay for Patients

Thanks, It works perfectly now. I just forgot to add entrance and exit controls

Re: Customizing Simulation Results to get Length of Stay for Patients

Legend
Legend
Cool !

BR
O.C