Globally, life expectancy has increased during the last two decades which causes an increase in the elderly population1. One of the consequences of aging phenomenon is the increased prevalence of cardiovascular diseases (CVDs)2,3. According to the World Health Organization report, about 18 million deaths were attributed to CVDs in the year 2019, accounting for 32% of all global deaths4. Coronary artery disease (CAD), as the most common type of CVD, is one of the primary causes of disability and mortality worldwide5,6,7,8,9,10. Coronary artery bypass grafting (CABG) surgery is one of the most common procedures which is traditionally used to treat CADs around the world11,12,13. It has been reported patients who underwent CABG have longer survival compared with medically treated patients14. Also, It has been estimated that the number of CABG surgeries in the United States reaches to four hundred thousand annually15. The length of stay (LOS) and the bed occupancy rate (BOR) are the most important measures for evaluating the performance of hospital systems16. Intensive care units (ICUs), as a bottleneck after operating room, play an important role in spending recovery period of patients after surgery in hospitals, and there are expensive advanced medical equipment and specialized staff working there17,18. In the United States, about 6 million admissions to ICU occur in each year and it has been reported that the ICU costs accounted for approximately 15% of the total hospital costs17. Nowadays, managers, especially in the field of healthcare systems, are facing with serious challenges due to lack of enough resources, limited budget, shortage of equipment (e.g. beds) and professional manpower (e.g. nurse, surgeon etc.). So, they are seeking operational methods to reduce costs, increase efficiency and improve the quality of care in order to facilitate and timely access to services as well as enhancing patient satisfaction in the community19,20.

Hospital beds are one of the most valuable resources and optimizing use of them has been received more attention among researchers21. Based on a report in 2013, approximately 36,000 patients have been undergone cardiac surgery in the United Kingdom along with cost of about £300 million annually22. On the other hand, it has been reported that the scarcity of surgical and fiscal resources can lead to prolonged waiting times before operation particularly among patients who were candidate for CABG surgery. Lastly, it may increase the risk of death23,24. It is an interesting idea to view the behavior of the cardiac surgery department (CSD) as a dynamic system. Hence, in order to improve the throughput of patients, we can consider the system as a complex queueing system in which the servers are the beds in the post-operative ward (POW) and ICU. When examining these complex systems, it usually is very difficult and at times even impossible to obtain an analytical closed-form solution. So, one of the most common alternative methods to study this system is using the Monte Carlo simulation technique25,26,27. Due to complexity of systems and growing power of computers especially over the last two decades, the application of simulation models and queueing systems in healthcare area and real-world studies is increasing28,29,30,31. Several studies have been conducted in this field, for example, Muer Yang et al. used the queueing and simulation models simultaneously, to study the relationship between ICU beds and operating room in a cardiothoracic surgical ICU29. Bahadori et al. applied queuing theory and simulation technique to optimize the management of an outpatient pharmacy32. Saville et al. applied computer simulation to optimize the number of nursing staff allocated to each hospital ward33. Belciug and Gorunescu applied queueing modeling and simulation to a geriatric department of a hospital to improve hospital bed occupancy and resource utilization34. Marcon et al. proposed a computer simulation flow model to determine the minimum number of beds required in the post-anesthesia care unit35. Saadouli et al. used a stochastic optimization and simulation approach in order to optimize the resources in an orthopedic surgery department36. Azari-Rad et al. used discrete event simulation to reduce elective general surgery cancellations37. Also, El‐Darzi et al. used a discrete event simulation to model the flow of patients in an hospital geriatric department38. At last, Mahjub and Cox applied a computer program for Monte-Carlo simulation of a CSD25. Given the literature review, it is clear now why efficient management of cardiac surgery facilities is so important.

The BOR in Iranian hospitals was estimated at 57.8 percent in 2008, which has a significant difference with the global standard index (85–90 percent)39. On the other hand, a CSD is one of the most important parts of a hospital that is very expensive to equip and maintain. So, we chose a hospital, Farshchian Hospital as one of the most equipped heart hospitals in Iran, and focused on its heart surgery department. We were interested to know its maximum capacity via a simulation study to find out if there is any extra capacity to increase its performance.

So, the main objective of the present study is to observe the behavior of the system using a Monte Carlo queuing simulation to determine optimum number of beds in ICU and ward in a CSD.

Material and methods

Data and patients

This study was approved by the ethics committee of Hamadan University of Medical Sciences (Approved ethical code: IR.UMSHA.REC.1398.396), and all methods were carried out in accordance with relevant guidelines and regulations. Prior written informed consent was obtained from all the participants.

In this study, we collected data from computerized (electronic) medical records of 1999 patients who underwent cardiac surgery, including three categories: 1. CABG, 2. Aortic Valve Replacement, Mitral Valve Replacement and Tricuspid Valve Replacement and 3. Heart Septal Defects: Ventricular Septal Defect and Atrial Septal Defect, at the Farshchian Heart center in Hamadan, Iran, during a 26—month period, 800 days, from 22 December 2017 to 29 February 2020.

The patients who did not respond to conventional therapeutic procedures, in order to surgical consultation were referred to a cardiac surgeon by a cardiologist. After examination and observation of medical evidence by surgeons, eventually they may become candidates for cardiac surgery. The patients were generally classified into emergency (non-elective) and elective groups according to their clinical conditions. Emergency patients were operated earlier than elective patients without being discharged from the hospital. The elective patients entered into cardiac surgical waiting list to call for surgery according to turn schedule. In this center, there were four on-call surgeons to do cardiac surgery on their duties. Also, at present, the CSD act with 10 beds in ICU and 16 beds in POW. The general flow of patients and the possible events that occur in the CSD are as follows: First, patients arrive to a preoperative ward from the waiting list, then go to the operating room for operation, and afterward are transferred to the ICU for recovery, then move to POW, and finally discharged. This situation is portrayed in Fig. 1.

Figure 1
figure 1

Demonstration of patient flow in the cardiac surgery department (CSD).

Each patient normally stays one or two days in preoperative ward; if there is an empty bed in ICU, she/he undergoes surgery and stays in ICU for at least one day. Depending on the patient’s clinical conditions, she/he has a different LOS in ICU and POW. Due to the fact that the number of deaths that occurred during and after surgery was very small and insignificant, we did not consider it in the simulation program. Since the unit of time is a day, and the events occur sequentially at discrete points of time, also, the simulation time is advanced simultaneously along with occurrence time of events, therefore, the system under study can be seen as a discrete-event system. Hence, we considered this type of simulation approach as discrete event simulation.

In some epidemic conditions such as coronavirus disease 2019 (COVID-19), in order to isolate patients, the admission of patients in CSD was affected and the POW was usually closed. Therefore, patients were discharged from the ICU after surgery. In system simulation, these conditions can be considered by keeping and prolonging each patient's stay in the ICU until discharge and zeroing the POW LOS. This situation can be implemented by adding a module (subroutine) to the simulation program.

In the simulation program, the exact path of Patients’ movements within the system and the LOS in each ward is kept tracked and controlled on a daily period. In the following, we list the details of the basic assumptions that were considered when developing the simulation program:

  • 1. The LOS in the ICU and the POW was defined as the number of nights that a bed is occupied by each patient.

  • 2. There are always some patients on the waiting list. In other words, there is an infinite supply of patients waiting to have cardiac surgery.

  • 3. Elective patients were operated in order of admission times. (Known as the first-come, first-served rule in queueing theory).

  • 4. Patients surgery and admission is performed on all weekdays, except Fridays and public holidays.

  • 5. Patients can be discharged on any day of the week.

  • 6. During a year, about 20% of the days were holidays (about 14% on Fridays and 6% on other public holidays). In fact, rather than actual dates of holidays, each day was simulated to be a holiday with a probability of 0.2.

  • 7. In the queueing system, beds were the servers and patients were considered as the customers.

  • 8. The order in which events are simulated in the system is for: a. A discharged patient, b. A patient who is leaving ICU to POW, c. A patient who is arriving from preoperative ward to ICU, d. Finally, admission of a new patient from waiting list.

In the Monte Carlo- based simulation method40,41, the first important step is finding the distribution functions of LOS (service time) in ICU and POW. In this study, at first, some common parametric distributions including Lognormal, Gamma, Weibull and Loglogistic were fitted to the LOS data in ICU and POW by using “actuar”42 and “fitdistrplus”43 packages in R software version 4.1.2, then, based on the highest log likelihood statistics, the best distributions for LOS in ICU and POW were chosen.

The bed blocking probability (BBP) was considered as the probability of a ready patient is not able to move from ICU to POW due lack of empty beds in POW. This probability was computed as the ratio of the number of patients who are not able to move from ICU to POW due lack of empty beds in POW to the total number of patients who are ready to move from ICU to POW.

The parameters for the fitted LOS distributions in the ICU and POW, the number of simulation days, and the number of beds in ICU and POW were given as input into the simulation program. After initialization, the system was simulated with 500 replications. The average and standard deviation (SD) of desired performance measures were calculated. The desired performance measures of our simulation study were, estimation of average BOR, LOS in ICU, throughput of patients in the system, and BBP. The simulation program code was written in Python programming software, version 3.9.5, along with installing and importing all necessary libraries44. GraphPad Prism software (version 6.0, GraphPad, San Diego, CA, USA) was also used.


Descriptive results

The mean (SD) of LOS in ICU and POW were 2.62 (0.94) and 2.78 (1.01) days, respectively. Figures 2 and 3 show visually empirical LOS distribution based on the real data and some fitted parametric distributions to LOS (days) in ICU and POW, respectively. As can be seen, most patients spend two (48.9% and 36.8%) or three (36.6% and 37.4%) days in ICU and POW, respectively. Based on the highest log-likelihood values, the best fitted distribution for LOS in ICU was the Log logistic distribution (shape parameter β = 5.55 and scale parameter α = 2.46) and for POW was the Gamma distribution (shape parameter β = 7.53 and scale parameter α = 0.37).

Figure 2
figure 2

Length of Stay (LOS) in the ICU after operation based on empirical LOS distribution and fitted parametric distributions.

Figure 3
figure 3

Length of Stay (LOS) in the post operative ward (POW) based on empirical LOS distribution and fitted parametric distributions.

Simulation results

Tables 1 and 2, report results of the simulation study regarding how BOR in POW and patient throughput vary as a function of number of beds in ICU and beds in POW. Also, the trends of BBP and LOS in ICU for different numbers of beds in ICU and POW are shown in Figs. 4 and 5, respectively.

Table 1 Bed occupancy rate (%) in post operative ward (POW) for different number of beds in ICU and POW.
Table 2 The throughput of patients during 800 days for different number of beds in ICU and post operative ward (POW).
Figure 4
figure 4

The bed blocking probability (BBP) at post operative ward (POW) for different number of beds in ICU and POW.

Figure 5
figure 5

Length of Stay (LOS) in ICU after operation for different number of beds in ICU and post operative ward (POW).

A summary of findings from the simulation study are as follows:

  1. 1.

    For a fixed number of beds in ICU, BOR in POW decreases as the number of beds in POW increases.

  2. 2.

    For a fixed number of beds in ICU, LOS in ICU increases as the number of beds in POW decreases.

  3. 3.

    The throughput of patients increases as the number beds in ICU and POW increases.

  4. 4.

    The BBP decreases as the number of beds in POW increases.

As Fig. 4 shows when there are 10 beds in ICU and 5 beds in POW the BBP is 0.73 which approaches zero when the number of beds in POW exceeds 11. Finally, as Fig. 5 demonstrate, as the number of POW in beds increases, the LOS in ICU stabilized at 2.6 days which is compatible with the empirical average of LOS in ICU that was 2.66 days.

Table 3 shows the simulation results when there are several months of COVID-19 restrictions throughout the year. For example, if the restriction is applied for a quarter of the days of the year, three months, with 10 beds in the ICU and 16 beds in the POW, the patient throughput drops from 2839 to 2251. In general, as the percentage of COVID-19 restrictions increases, fewer patients undergo surgery during the 800 study days.

Table 3 The throughput of patients during 800 days for 16 beds in POW and different number of beds in ICU during pandemic restrictions.


The application of simulation models is broadly common in healthcare systems to improve hospital resources management. Hospitals as one of the most important units of the healthcare systems, accounting for 50 to 80 percent of total health care costs. Because of that, their optimal and efficient management has become one of the challenges of governments and health sector managers in recent decades45. Many studies have used analytical and simulation methods to solve some of the problems in this field20,30,32,36,38,46,47. Whatever the complexity of the systems increases, analytical models are not responsive because they fail to capture the details. For this reason, one of the basic strategies for overcoming these limitations in the study of dynamic and complex systems is use of very flexible simulation methods44. In this study, we have developed a discrete-event simulation model of a CSD of a hospital in Iran. Therefore, we used a Monte Carlo simulation approach to mimic the behavior of patients in a CSD as a dynamic system; So, some of the performance measures including, the mean BOR, LOS, throughput of patients, and BBP under different number of beds in ICU and POW were estimated. The findings of our study showed, as the number of beds in POW increases, so does the throughput and also decreases queueing time in the ICU. Mahjub and Cox also used a computer program based on Monte Carlo simulation to estimate the BOR and throughput of patients in a CSD in England25; There are some similarities and differences between our research with their work; In both, the beds in ward and ICU were the servers and patients are considered as the customers. In their study, only BOR and throughput of patients were calculated, but we also estimated the mean LOS in ICU and probability of being blocked (BBP) in POW. They computed the mean required time for throughput of 500 patients for varying numbers of beds in ward and ICU, but we estimated the mean (SD) of number of discharged patients (throughput) during 800 days for different number of beds in ICU and POW. So, from a managerial and Cost-effectiveness view, the average throughput with 8 beds in ICU and 11 beds in POW is approximately the same as 10 beds in ICU and 8 beds in POW.

We used Python programming due to some of its key advantages, including easy expansion, code readability, ease of use, high flexibility, user friendly, object-oriented capability, high computational speed and etc.48. Gorunescu et al. used a classical queueing theory to determine the optimal number of beds, in which hospital beds had the role of servers and LOS as service time using phase-type distributions; however, no simulation methods were used in their study49. In the present study, we used Log logistic and Gamma distributions for LOS (service times) in ICU and POW, respectively. Also, according to simulation findings, when the number of beds in POW exceeds a certain limit, the BBP begins to converge to zero, and as a result, patients will not have to wait in ICU.

In this study, beds play the role of servers, so the main purpose was to determine the optimal number of beds, especially in ICU, because the cost of providing and adding a bed in ICU, as a bottleneck resource, is much higher than in POW. Since financial resources are limited, it is important to be able to justify and satisfy hospital managers before spending money and purchasing new equipment. They are also convinced that the new changes, the optimal allocation of resources and beds will lead to long-term financial profits; and also, an increase in hospital revenue in the future.

One of the advantages of this study is use of very powerful and popular programming software, Python44. In many simulation studies, the application of Python software is expanding due to its high flexibility in modeling complex systems and its ability to consider real-world scenarios. Although various simulation software is now designed and readily available in academic and industrial settings50,51, however, choosing the appropriate one is a difficult task because many of them are not suitable or even applicable in some complex situations. Also, it is practically impossible for researchers to develop them in new situations. Another main strength of our study is considering annual holidays in the simulation program, so that about 20% of the days of the year, including 14% Fridays and 6% of public holidays, no surgery was performed. In general, our simulation program is precisely set up based on the realities that occur in the CSD.

To check the accuracy of the results of LOS modeling (Log logistic and gamma distributions), the empirical distributions of LOS were also used for simulation. Since the results of the two approaches were close to each other, it can be concluded that the models were chosen correctly and the simulation results are valid.

There are some limitations in this study. As mentioned earlier, a number of assumptions were taken into account during modeling and programming. We implicitly assumed that there was no limit on number of surgeons or operating rooms. So, as soon as an empty bed is in ICU, a patient would undergo surgery. However, not only the number of surgeons is limited, four surgeons in this study, the number of surgeries performed by each surgeon is also limited maximum of two surgeries per day.

In future studies, this limitation can be addressed by considering the surgeons and beds in the role of servers as well. Furthermore, taking into account average total cost of staying in the system may also help to study this system more precisely.

In the present study, deaths were not considered in simulation program; this is not a disadvantage of the study, because the number of deaths occurring during or after the operation was very low; but for future research, if the percentage of postoperative deaths is high, it is a good idea to consider different scenarios of deaths in simulation program to better understand the behavior of the system.

In this research, patients who were candidates for cardiac surgery, were grouped into two classes; non-emergency and emergency, and priority must be given to the latter group, but we have assumed that all patients have the same priority and undergo surgery in the order of admission. According to a report of Iranian hospitals affiliated to the Ministry of Health and Medical Education of Iran, the BOR in Iranian hospitals in 2008 was estimated at 57.8 percent, which shows a significant difference with the global standard index (85–90 percent)39. This in line with our study that confirms with the current facilities, equipment, and medical personnel of investigated system, i.e. 10 and 16 beds (sometimes plus two extra beds) in ICU and POW, respectively, 1999 cardiac surgeries were performed during 800 days. But the results of the simulation program showed that with the same conditions, 2839 patients are expected to undergo surgery. In other words, the hospital system, with its current facilities, equipment and manpower, operates approximately 43% less than its actual efficiency. As already mentioned, the empirical average LOS in ICU was 2.66 days, and the simulation results also confirm that, as the number of POW beds increased, the LOS in ICU stabilized at 2.6 days.

The simulation program we have extended in this study can also be applied in other areas.

If during the year, the admission of patients is affected by the restrictions of the COVID-19 or other epidemics, these conditions can be considered in the simulation program. In our study, as previously mentioned, this situation is allowed by prolonging each patient’s ICU stay until discharge and setting POW LOS to zero in the simulation program. For instance, based on the simulation results, with 10 beds in the ICU and 16 beds in the POW, if we assume 4 months of restrictions per year, the throughput of patients is reduced from 2839 to 2114 during 800 days, a 25.5% reduction. On the other hand, based on the raw data, the average number of monthly surgeries before and after the covid epidemic was 66.78 and 51.26, respectively, which means it has decreased by about 23%. Therefore, the hospital's performance also confirmed that after the COVID-19 epidemic, patient admissions have decreased by almost the same proportion.

Since this simulation program depends on the LOS distribution of patients in the POW and ICU, it can be used for other diseases where patients are admitted to one or two consecutive wards. However, this program can also be extended to three or more consecutive sections.

Improving the efficiency, throughput, optimization of hospital system facilities, balancing between the supply of services by the hospital and also the demand for services by patients is a win–win approach. If waiting times would be shorter, patients will be able to access services faster. So, hospitals with proper planning for the future, have a strategy for optimal use of resources and its allocation; therefore, it would prevent the pressure of congestion and increasing demand.

In conclusion, the results of this simulation study were able to show behavior and performance measures of the system by considering different numbers of beds in ICU and ward clearly. Therefore, according to the simulation results, hospital managers can not only make optimal use of available resources and increase system efficiency, but would also be able to provide accurate planning for the future.