Skip to content
BY-NC-ND 3.0 license Open Access Published by De Gruyter September 12, 2015

A java based simulator with user interface to simulate ventilated patients

P. Stehle , T. Lehmann , D. Redmond , K. Möller and J. Kretschmer EMAIL logo


Mechanical ventilation is a life-saving intervention, which despite its use on a routine basis, poses the risk of inflicting further damage to the lung tissue if ventilator settings are chosen inappropriately. Medical decision support systems may help to prevent such injuries while providing the optimal settings to reach a defined clinical goal. In order to develop and verify decision support algorithms, a test bench simulating a patient’s behaviour is needed. We propose a Java based system that allows simulation of respiratory mechanics, gas exchange and cardiovascular dynamics of a mechanically ventilated patient. The implemented models are allowed to interact and are interchangeable enabling the simulation of various clinical scenarios. Model simulations are running in real-time and show physiologically plausible results.

1 Introduction

Mechanical ventilation is a commonly used treatment in intensive care. The aim is to support the gas exchange of patients that are unable to maintain sufficient oxygenation and carbon dioxide removal because of surgical interventions or traumata.

Clinicians adjust the ventilator settings based on their knowledge of the pathophysiology of the patient’s lung and the current clinical condition of the patient as well as his past medical history [1]. By applying inappropriate parameters for mechanical ventilation it is possible to inflict further damage to the lung tissue e.g. high ventilation pressures can lead to harmful barotrauma of the alveoli [2]. Patients with decreased lung compliance and impaired gas exchange (e.g. patients suffering from ARDS) are especially difficult to find optimal ventilator settings for, as conflicting goals might exist (high airway pressure to recruit alveoli versus low airway pressure to protect healthy lung tissue). To prevent those so called ”ventilator induced lung injuries” (VILI), medical decision support systems may be used. Those systems optimize therapy either based on expert knowledge and gold-standard procedures (knowledge-based systems) [3, 4] or on mathematical models representing the physiology of an individual patient (model-based systems) [5, 6].

In order to develop and test such algorithms before implementing them into commercially available systems, they must be tested with either animal trials, clinical (i.e. human) trials or with the help of patient simulators. Various patient simulators are available commercially or are described in literature. Mannequin simulators focused on training ICU nurses and clinicians such as HPS (CAE Healthcare, Saint-Laurent, Canada) or SimMan® 3G (Laerdal Medical, Stavanger, Norway) lack sufficient interfaces to communicate with decision support systems and thus are not useful for the evaluation of those. Along with other software simulators intended for internal use such as SmartPatient (Dräger Medical, Lübeck, Germany) [7] the mechanical and/or mathematical models used to simulate the patient are not fully disclosed, thus there is no knowledge on how the simulated data was created. Simulators described in literature provide detailed information about the implemented mathematical models, but focus on only a limited number of physiological compartments [1, 8].

Mechanical ventilation mostly affects three areas of the human physiology: respiratory mechanics, gas exchange and cardiovascular dynamics. To provide a realistic simulation of a patient’s reaction to mechanical ventilation, all of those areas should be implemented in the simulation. A previously developed system allows combining models of respiratory mechanics, gas exchange and cardiovascular dynamics to form a complex patient model [9].

The goal of this work aims to provide a user interface that allows simulating a mechanically ventilated patient with different disease scenarios. It should be able to run in real-time on a standard PC and implement sufficient interfaces to save simulated data and to allow communication with decision support systems.

2 Methods

2.1 Model system

The system of models considered in this paper consists of three main model families each comprising models of different complexity and simulation focus [9]. The implemented models will be described in short below.

To enable communication between the models and thus allow simulating physiological interactions a set of interfaces has been defined: Intrathoracic pressure (Pth) influences cardiovascular dynamics, which in turn influences gas exchange through cardiac output (CO). Additionally, alveolar volume (VA) and alveolar gas flow (VA) computed in respiratory mechanics influence gas exchange [9]. Figure 1 gives a schematic overview of the interfaces.

The model family of respiratory mechanics comprises five models of 1st and 2nd order including one to seven model parameters. The implemented models are a first order model with one resistance and one compliance, a model with two resistances and two compliances to simulate viscoelastic behaviour in the inspiratory pause [10], a model as proposed by Khoo to simulate effects of gas compressibility [11], and two recruitment models of which one comprises viscoelastic characteristics [12, 13]. All models have been extended to include a separate chest wall compliance to compute intrathoracic pressure.

The family of gas exchange models is divided mainly into two types. The first and less complex types assume constant and laminar flow of gas. Therefore, no inspiration and expiration is considered. They model lung gas exchange either with a single alveolar compartment with shunt [14] or dual alveolar compartments to include ffV/Q mismatch [15]. The second type of gas exchange models considers tidal flow of gas. Here, a dead space compartment is added as described by Benallal et al. [16].

The implemented cardiovascular dynamics models range from a simple three-compartment model with a singular cardiac compartment [17] to a serially arranged model with 14-compartments [18] and a parallel structured 19-compartment model [19]. This model family also includes a discrete beat-to-beat model for discontinuous simulation of blood pressure. The beat-to-beat model as well as the 14- and 19-compartment models have been extended to react to intrathoracic pressure changes [20].

2.2 Disease simulation

In order to use the different model combinations as a training tool for clinicians and as a test bench for decision support algorithms, it is necessary to be able to simulate different lung diseases and pathophysiological symptoms. We have thus implemented the possibility to select the models that should be combined to form the patient model and to change model parameters for the respiratory mechanics, the gas exchange and the cardiovascular dynamics during simulation. Additionally, the user is enabled to save specific parameter sets and to import previously created artificial patients.

Figure 1 Interactions between the three models and the ventilator simulation. FiO2 – oxygen content in inspired air, Paw – airway pressure,  – air flow.
Figure 1

Interactions between the three models and the ventilator simulation. FiO2 – oxygen content in inspired air, Paw – airway pressure, – air flow.

2.3 Software implementation

All models as well as a separate ventilator simulation have been coded in Java (1.7.0_51, Oracle, Corporation, Redwood Shores, USA) and have been tested separately to ensure operability within physiological limits. Each model is represented by a class. Complex models in each family (e.g. the 19-compartment cardiovascular model) are derived from less complex models by inheriting and extending their attributes and methods. Java does not allow inheritance from multiple parent classes, thus in models derived from multiple models in the family (e.g. the viscoelastic recruitment model) inheritance was limited to one class/model. A separate class describes the ventilator simulating volume or pressure controlled ventilation.

The differential equations of the selected models were solved employing a simple Euler solver with a fixed step size of 0.0001s. After each simulation step, the interface parameters are exchanged between models. The user interface was created using NetBeans IDE 8.0.2 (Oracle Corporation). Graphical representation of the vital parameters was realized employing the JFreeChart library distributed under the GNU lesser general public license.

3 Results

The user interface consists out of two main panes as shown in Figure 2. The pane located on the left side of the frame acts as a display panel for different graphs which show the vital data of the simulated patient. It is possible to monitor six vital parameters at the same time. In the presented example, these are the airway pressure (Paw), the arterial blood pressure, the air flow, the alveolar volume and the arterial partial pressure of oxygen (PaO2) and carbon dioxide (PaCO2). The user can choose which vital parameters should be visible by selecting them in the menu.

The second pane on the right of the user interface is the control panel for the simulation settings which is divided into three tabs. The first tab allows selecting the mathematical models to simulate respiratory mechanics, gas exchange and cardiovascular dynamics as described in the methods section. As all models incorporate the same interfaces, models can be swapped without stopping the simulation. In the second tab ventilator settings can be adjusted via slider or textbox input. The settings depend on whether ventilation is selected to be pressure or volume controlled. The maximum and minimum values of all sliders have been set to reasonable physiological limits to prevent irrational settings. During runtime it is possible to change the settings; they become valid after finishing the actual breath. In the third tab the user has the possibility to save the displayed data in the graphs into a text file (.txt). The text file can be used to reproduce and analyze the gathered data e.g. in MATLAB (The Mathworks, Natick, USA) or Excel (Microsoft Corporation, Redmond, USA).

The menu bar of the user interface provides the opportunity to change patient specific parameters by either adjusting them manually for each of the implemented models or by importing predefined parameters from a text file. Figure 3 provides an overview of the manually adjustable parameters.

The graphs in Figure 2 show results for a patient model consisting of the viscoelastic respiratory mechanics model, the dual alveolar gas exchange model with dead space and the 19-compartment model of cardiovascular dynamics ventilated in pressure controlled mode with a respiration frequency of 14/min, a maximum airway pressure of 35 mmHg, a PEEP of 5 mmHg, and FiO2 set to 40%. Arterial pressure exhibits superimposed oscillations with a frequency equal to the simulated respiration rate. Gas exchange results (PaO2, PaCO2) show two superimposed variations with different frequencies, one being equal to the respiration rate, one being in agreement with the simulated heart rate (i.e. 60/min).

4 Discussion

This work describes a patient simulator that allows simulating a mechanically ventilated patient. The implemented user interface enables the user to dynamically select various models to be combined and form a complex patient model. Additionally, it allows to select ventilator settings and to simulate different clinical scenarios by adapting model parameters or importing predefined parameter sets.

The implemented models have either been validated by their respective authors through comparison with data found in literature [14, 18, 19] and experimental data [10, 12, 13, 15, 16] or have been verified by others [10, 21]. Simulation results show influence of respiratory mechanics on cardiovascular dynamics visible as superimposed pressure variations. Similar findings have been reported in literature [22]. Changes in blood flow also show to influence PaO2 and PaCO2 where minor oscillations are observable. Both exhibit additional periodic variations in inspiration and expiration caused by changes in alveolar volume and flow. Analogous findings in animals are reported by Purves [23].

A goal of the presented work was to provide a real-time simulation of a ventilated patient. Previously published implementations of the presented model combinations in MATLAB showed to be computationally expensive, thus impeding the use as a tool for both clinical training and evaluation of decision support algorithms [24]. The presented implementation is JAVA based and is able to run in real-time on a standard PC for all possible model combinations.

Model-based decision support systems need to be adapted to a patient’s individual physiology, usually by identifying the values of free model parameters using previously recorded clinical data. To obtain those data, various ventilation manoeuvres need to be applied, preferably triggered by the decision support system on an as-needed basis. To provide a realistic patient simulation, decision support algorithms need be able to trigger such manoeuvres externally. Adding the necessary interfaces along with the implementation of additional physiological models is planned for future work.

Figure 2 The user interface with graphs showing the current simulation results.
Figure 2

The user interface with graphs showing the current simulation results.

Figure 3 Menu to manually adjust model parameters.
Figure 3

Menu to manually adjust model parameters.

J. Kretschmer: Institute of Technical Medicine, Furtwangen University, Villingen-Schwenningen, Germany, phone: +49 7720 307 4370, fax: +49 7720 307 4616

Author’s Statement

  1. Conflict of interest: Authors state no conflict of interest. Material and Methods: Informed consent: Informed consent has been obtained from all individuals included in this study. Ethical approval: The research related to human use has been complied with all the relevant national regulations, institutional policies and in accordance the tenets of the Helsinki Declaration, and has been approved by the authors’ institutional review board or equivalent committee.


[1] H. F. Kowk, M. Mahfouf, K. M. Goode, G. H. Mills, and D. A. Linkens, ”The use of a patient simulator for knowledge acquisition from the clinicians,”Int J Simulation, vol. 4 (1&2), pp. 50-61, 2003.Search in Google Scholar

[2] D. Dreyfuss and G. Saumon, ”From ventilator-induced lung injury to multiple organ dysfunction,”Intensive Care Med, vol. 24 (2), pp. 102-104, 1998.10.1007/s001340050529Search in Google Scholar

[3] C. Spreckelsen and K. Spitzer, Wissensbasen und Expertensysteme in der Medizin. Wiesbaden: Vieweg+Teubner, 2008.10.1007/978-3-8348-9294-2Search in Google Scholar

[4] R. S. Campbell, R. D. Branson, and J. A. Johannigman, ”Adaptive support ventilation,”Respir Care Clin N Am, vol. 7 (3), pp. 425-40, ix, 2001.10.1016/S1078-5337(05)70049-6Search in Google Scholar

[5] G. W. Rutledge, G. E. Thomsen, B. R. Farr, M. A. Tovar, J. X. Polaschek, I. A. Beinlich, L. B. Sheiner, and L. M. Fagan, ”The design and implementation of a ventilator-management advisor,”Artif Intell Med, vol. 5 (1), pp. 67-82, 1993.10.1016/0933-3657(93)90006-OSearch in Google Scholar

[6] F. T. Tehrani and S. Abbasi, ”A model-based decision support system for critiquing mechanical ventilation treatments,”J Clin Monit Comput, vol. 26 (3), pp. 207-15, 2012.10.1007/s10877-012-9362-0Search in Google Scholar PubMed

[7] F. Galia, ”Supervision automatique de la ventilation artifi-cielle en soins intensifs: investigation d’un syst[ccaron]me existant et propositions d’extensions.,” PhD Thesis, Engineering Sciences, Université Paris-Est, Paris, 2010.Search in Google Scholar

[8] T. Heldt, R. Mukkamala, G. B. Moody, and R. G. Mark, ”CVSimml: An Open-Source Cardiovascular Simulator for Teaching and Research,”Open Pacing Electrophysiol Ther J, vol. 3, pp. 45-54, 2010.Search in Google Scholar

[9] J. Kretschmer, A. Wahl, and K. Moller, ”Dynamically generated models for medical decision support systems,”Comput Biol Med, vol. 41 (10), pp. 899-907, 2011.10.1016/j.compbiomed.2011.08.001Search in Google Scholar PubMed

[10] C. Schranz, P. D. Docherty, Y. S. Chiew, K. Moller, and J. G. Chase, ”Iterative integral parameter identification of a respiratory mechanics model,”Biomed Eng Online, vol. 11, p. 38, 2012.10.1186/1475-925X-11-38Search in Google Scholar PubMed PubMed Central

[11] M. C. K. Khoo, Physiological control systems: Analysis, simulation, and estimation vol. 3. Hoboken, New Jersey: John Wiley & Sons, 1999.10.1109/9780470545515Search in Google Scholar

[12] C. Schranz, P. D. Docherty, Y. S. Chiew, J. G. Chase, and K. Möller, ”Structural Identifiability and Practical Applicability of an Alveolar Recruitment Model for ARDS Patients,”IEEE Trans Biomed Eng., vol. 59 (12), pp. 3396-404, 2012.10.1109/TBME.2012.2216526Search in Google Scholar PubMed

[13] C. Schranz, J. Kretschmer, and K. Moller, ”Hierarchical individualization of a recruitment model with a viscoelastic component for ARDS patients,”Conf Proc IEEE Eng Med Biol Soc, vol. 2013, pp. 5220-3, 2013.10.1109/EMBC.2013.6610725Search in Google Scholar PubMed

[14] L. Chiari, G. Avanzolini, and M. Ursino, ”A comprehensive simulator of the human respiratory systemml: validation with experimental and simulated data,”Ann Biomed Eng, vol. 25 (6), pp. 985-99, 1997.10.1007/BF02684134Search in Google Scholar

[15] M. F. V. Melo, J. A. Loeppky, A. Caprihan, and U. C. Luft, ”Alveolar ventilation to perfusion heterogeneity and diffusion impairment in a mathematical model of gas exchange,”Comput Biomed Res, vol. 26 (2), pp. 103-120, 1993.10.1006/cbmr.1993.1007Search in Google Scholar

[16] H. Benallal, C. Denis, F. Prieur, and T. Busso, ”Modeling of end-tidal and arterial PCO2 gradient: comparison with experimental data,”Med Sci Sports Exerc, vol. 34 (4), pp. 622-9, 2002.10.1249/00005768-200204000-00010Search in Google Scholar

[17] T. Parlikar and G. Verghese, ”A simple cycle-averaged model for cardiovascular dynamics,”Conf Proc IEEE Eng Med Biol Soc, vol. 5, pp. 5490-4, 2005.10.1109/IEMBS.2005.1615726Search in Google Scholar

[18] M. Danielsen and J. T. Ottesen, ”A cardiovascular model,” in Applied mathematical models in human physiology, J. T. Ottesen,et al., Eds., ed Philadelphia: Society for Industrial and Applied Mathematics, 2004, pp. 113-126.10.1137/1.9780898718287.ch6Search in Google Scholar

[19] M. S. Leaning, H. E. Pullen, E. R. Carson, and L. Finkelstein, ”Modelling a complex biological systemml: the human cardiovascular system — 1. Methodology and model description,”T I Meas Control, vol. 5 (2), pp. 71-86, 1983.10.1177/014233128300500202Search in Google Scholar

[20] J. Kretschmer, T. Haunsberger, E. Drost, E. Koch, and K. Moller, ”Simulating physiological interactions in a hybrid system of mathematical models,”J Clin Monit Comput, vol. 28 (6), pp. 513-23, 2014.10.1007/s10877-013-9502-1Search in Google Scholar

[21] C. Schranz, J. Guttmann, and K. Möller, ”An Approach towards Parameter Identification in Hierarchical Models of Respiratory Mechanics,”Biomed Tech., vol. 55 (Suppl. 1) 2010.Search in Google Scholar

[22] D. Laude, M. Goldman, P. Escourrou, and J. L. Elghozi, ”Effect of breathing pattern on blood pressure and heart rate oscillations in humans,”Clin Exp Pharmacol Physiol, vol. 20 (10), pp. 619-26, 1993.10.1111/j.1440-1681.1993.tb01643.xSearch in Google Scholar

[23] M. J. Purves, ”Fluctuations of arterial oxygen tension which have the same period as respiration,”Respir Physiol, vol. 1 (3), pp. 281-96, 1966.10.1016/0034-5687(66)90047-8Search in Google Scholar

[24] Kretschmer, J., Schranz, C., Knöbel, C., Wingender, J., Koch, E., and Möller, K. (2013). Eflcient Computation Of Interacting Model Systems. J Biomed Inform, vol. 46 (3), pp. 401-9.10.1016/j.jbi.2013.01.004Search in Google Scholar PubMed

Published Online: 2015-9-12
Published in Print: 2015-9-1

© 2015 by Walter de Gruyter GmbH, Berlin/Boston

This article is distributed under the terms of the Creative Commons Attribution Non-Commercial License, which permits unrestricted non-commercial use, distribution, and reproduction in any medium, provided the original work is properly cited.

Downloaded on 10.12.2022 from
Scroll Up Arrow