Computer simulation of a patient end tidal CO2 controller system

Computer simulation of a patient end tidal CO2 controller system

Computer Methods and Programs in Biomedicine, 28 (1989) 243-248 Elsevier 243 CPB 00980 Section I. Methodology Computer simulation of a patient end...

405KB Sizes 0 Downloads 16 Views

Computer Methods and Programs in Biomedicine, 28 (1989) 243-248 Elsevier


CPB 00980

Section I. Methodology

Computer simulation of a patient end tidal CO 2 controller system R. Rudowski 1, C. Spanne 2 and G. Matell 3 i Institute of Biocybernetics and Biomedical Engineering Polish Academy of Sciences, 00-818 Warsaw, Polana~ and Department of Medical Informatics, Linki~ping University, S-581 83 LinkSping, Sweden, 20P1AB, Teknik AB, S-104 30 Stockholm, Sweden, and 3 South Hospital, Medical Intensive Care Unit, S-IO0 64 Stockholm, Sweden

A computer model of the patient end tidal CO 2 controller system has been developed and tested in simulation trials. It is intended to aid in finding the appropriate PI (proportional-integral) controller settings by means of computer simulation instead of real experiments with the system. The latter approach is costly, time consuming and sometimes impossible to perform. The simulator consists of two equations: the patient equation and the PI controller equation. The software has been written in the C language and can be run on an IBM-PC/XT. Some examples of the simulation trials, illustrating the choice of controller settings, are given. End tidal C02; Feedback controller; Computer model; Mechanical ventilation

!. Introduction There is an increasing number of publications on end tidal CO~ feedback controllers for mechanical ventilation [1--3]. The work is still in the animal experimentation phase, but an expansion to clinical experiments is likely. One of the basic problems associated with closed-loop mechanical ventilation is finding the controller settings which ensure both the stability of the system and a satisfactory response in terms of overshoot and regulation time. The initial controller settings are usually found with the aid of experiments preceding the main experimentation phase in which controller function is tested. Such an approach is impossible to carry out in clinical experiments. In this paper we will present a method for finding the controller settings based on computer simulation of the patient end tidal CO2 controller system. We hope

Correspondence: R. Rudowski, Institute of Biocybernetics and Biomedical Engineering, Polish Academy of Sciences, ul. KRN 55, 00-818 Warszawa, Poland. Supported by the KUSIN-MED project.

that this method will find application in the field of automatic mechanical ventilation of the lungs.

2. Model description - theory

2.1. The patient equation The computer model of the patient end tidal C O 2 controller system (Fig. 1) consists of two differential or difference equations. One describes the dynamics of the patient and the second the dynam:.cs of the controller. Based on clinical experiments, Nunn [4] had proposed a first-order differential equation describing patient dynamics:

r(dCETcoJdt)+CETcO2=rn. MV +b

Fig. 1. The patient end tidal CO 2 controller system.

0169-2607/89/$03.50 © 1989 Elsevier Science Publishers B.V. (Biomedical Division)


244 CETC02

respiratory cycle. The expression ACETcO2 is the end tidal CO2 difference in two consecutive samples, sample (k) and sample ( k - 1):


A C E . r c o 2 = C E . r c o ~ ( k ) - C E . r c o 2 ( k - 1)

(C co l b=const

The substitution of (4) into (3) yields the solution for CETCo~(k):







(MVIo MV { I/rnin) Fig. 2. The linear (1) and nonlinear (2) static characteristics of a patient.

where ~'[s] - time constant of the patient, longer for CO 2 accumulation ('rA) and shorter for CO 2 washout (~'w); CEa-c02 [%] - end tidal CO 2 concentration; K n [%/l/mini - patient gain (sensitivity) < 0; MV [l/min] - minute volume. Equation (1) reflects the process of CO2 accumulation and CO 2 washout from the CO 2 stores in the body. The time constants depend on the capacity of these stores. It is assumed that the end tidal CO2 fraction is representative of the alveolar CO 2 fraction. To obtain the static characteristics of the patient we assume ( d C E r c o , / d t ) = O. The equation (1) becomes (Fig. 2): CETCO, = K n • MV + b


Equation (2) is linear and is obtained by the linearization of an originally nonlinear equation, the so-called metabolic hyperbola. It should be borne in mind that the controller output should not exceed the range M V = ( M V ) 0 + A M V (see Fig. 2), beyond which the linear static characteris. tic is not valid. Equation (1) has a continuous form. The transition to a discrete form is necessary for coding it in a computer program. The equation describing patient dynamics in a discrete form is: ' r ( A C E T c o J T ) = CETCo:(k -- 1) --Kn'MV(k-1)+b


where the sampling period T is equal to the

CEa'Co2(k ) = ( T / ~ " ) ( K n • M V ( k - 1) + b) +O -


which is the value of end tidal CO 2 concentration in the current sample when the value for CO2 concentration in the previous sample CETCo,(k1) and the previous value for minute volume MV(k - 1) are known. 2.2. The procedure for finding unknown patient parameters

The procedure for parameter identification is based on the assumption that the CO 2 production of the patient is approximately constant. There would otherwise be no single relationship between minute volume and end tidal CO 2 concentration. The unknown parameters of the patient are obtained by means of the following experimental procedure: (1) the equilibrium point (see Fig. 2) is found after the patient stabilizes at the (MV) 0 ventilator setting; (2) a stepwise increment in minute volume AMV is introduced to obtain ACETcO2, the decrement of end tidal CO2; (3) the time constant for CO2 washout ~'w can be obtained from the CO2 transient; (4) the patient gain K H = ACETco2/AMV can be calculated; (5) the constant b can be calculated from Eqn. (2): b = (CETcO2)0 -- K n • (MV)0; (6) the stepwise decrement of minute volume A MV is introduced in order to reach the starting point (MV)0; (7) the time constant for CO2 accumulation ~'a can be obtained from the CO 2 transient. The last point completes the patient parameter identification.

245 2.3. The controller equation

I w

We used a PI (proportional-integral) controller in the model structure, though other more complex types can be introduced. This PI type of controller has been used and described previously [3]. The controller equation in discrete form is: M V ( k ) = MV(k - 1 ) + K p ( E ( k ) - E ( k -

Start condition

I I "lc°°tr°"er 4, plOtting

L 2estar2_ J


[ areak

.... n


I Patient

I equation J I


New MV


Fig. 3. The flowchartof the program,

E ( k ) = CETCo2(k) -- (CETcO2) setpoint k=l,2







where - proportional gain; - integration constant; K, - sampling period (respiratory cycle); T MV(k) - current controller output; MV(k - 1) - previous controller output; E(k) - current error; E ( k - 1) - previous error. According to equation (6) the current controller output is calculated once per sampling period (respiratory cycle) using previous controller output and current and previous error. We finally arrive at a set of difference equations, (5) and (6), describing the model. To assure a constant sampling period T equal to the respiratory cycle time it is desirable to operate the model at an arbitrarily chosen constant frequency of breathing. The changes in minute volume are then accomplished by making changes in tidal volume.

3. S y s t e m d e s c r i p t i o n

The model described in Section 2 has been implemented in the C language (Lattice v. 3.00) on a standard I B M / P C - X T microcomputer including a C G A graphic card. A n HP7475-compatible Hitachi plotter has been added to the system to allow plotting of results from simulation trials. A simple flow chart of the program structure is shown in Fig. 3 and a short description follows.

Before simulation begins, start conditions and values for the different constants must be entered manually via the keyboard. Values for the following parameters are entered: - minute volume, end tidal CO 2 concentration and respiratory rate (start condition); - patient gain and time constant; - proportional gain and integration constant for PI controller; - desired end tidal CO 2 concentration. Then the simulation starts with a call to a PI control routine. A new minute volume is calculated from the controller equation and transferred to the patient equation (k becomes k - 1), where a new value for end tidal CO 2 concentration is obtained. At the start of the next breath a new call is made to the PI control routine, this time with a new actual end tidal CO2 concentration. The simulation continues like this until it is manually interrupted. Calculated values for end tidal CO2 concentration and minute volume are plotted on the screen a n d / o r plotter during simulation. The simulation can be stopped at any time to change controller constants or other parameters.

4. E x a m p l e s o f s i m u l a t o r trials

In order to test the model, several simulation trials were performed. The sequence of the controller settings is shown in Table 1. The starting point for the simulation were the ventilator settings MV = 10 l / m i n , f = 20 b.p.m., the patient parameters

246 RR=20.O ETcoz=4.00% Mv=12.00 I//min New MV :12.00 I/rain KP--'0.800 KI=O.030

RR=20.0 ETco2=3.98% Mv=11.97 I/rain New MV = 11.97 I/rain KP=0.200 KI=0.030 15 14 13 ~12 11 10 c






15 14 13 12 11 10 9 c

U La 3

5 4 3 2 1 0

2 1 I









Time (rain)

RR=20.O ETco2=3.98% Mv=11.73 l / r a i n New MV=11.71 I / m i n KP=0.200 K1=0.120

RR=20.0 ETco2=3.99% Mv=11.82 l/rain New MV=11.821 rain KP=O.050 KI=0.030 15 1/, 13 12 11 10~ 9


5 - ' - - ' - , ~ , ~ . E T C O 2 u

3 2 1


Time ( rain )



5 "6








4 6

5 ~


'7, hi

2 1







Time ( rain )

RR=200 ETco2=4.17%






Time (min)

Mv=11.79 I/'min

New MV=11.791/min KP=0.200 KI=0.007 8









15 14 13 12 I


~ 4 "

6 "6

3 2 1


I 1 Time (rain)

3 2 1

K n = - 0 . 5 % / l / m i n , "r= 30 s (the same time constant was used for CO2 accumulation and washout) and the initial desired end tidal CO2 concentration CETCO=----5%. Then the new desired CETCO2= 4% was introduced. The system response to that step change in the desired value was recorded. The results are presented in Fig. 4 a - e . The heading of each figure shows respiratory rate, current value

Fig. 4. The simulation trial. (a) Initial controller settings. (b, c) Changes in proportional gain Kp. (d, e) Changes in integration constant K,.

of end tidal CO2 concentration, minute volume in two consecutive iterations and the controller settings. The horizontal line is the desired value of end tidal CO 2 concentration. The following comments can be made regarding different controller settings. A Kp, K i mismatch is seen in Fig. 4a which manifests itself by too sharp an increase in minute volume at the

247 TABLE 1 The sequenceof controller settings Kp 0.2 0.8 0.05 0.2 0.2

Ki 0.03 0.03 0.03 0.12 0.0075

Comment-. Starting point 4-fold increasein Kp 4-fold decreasein Kp 4-fold increasein K~ 4-fold decreasein K~

beginning of the transient state. The value of the proportional gain constant Kp is too high. The 4-fold increase in Kp (Fig. 4b) obviously makes the situation worse. The 4-fold decrease in Kp (Fig. 4c) led to the most favorable transient, with no rapid changes in minute volume. The 4-fold increase in Ki (Fig. 4 d ) produced the oscillatory state. Such states should be avoided in the control system, as it may be harmful to subject the patient to such rapid changes in minute volume or tidal volume if the frequency of breathing is kept constant. Finally, the situation in Fig. 4e is similar to that in Fig. 4a, with a Kp, K~ mismatch, but the regulation time (the time at which the new desired value is reached) is longer. The best transient from the patient point of view is the one which produces 'soft' changes in minute volume (see Fig. 4c). The regulation time is of less importance. Regulation times shorter than 2 min are feasible in the clinical practice of mechanical ventilation.

models, listed in Table 2, make the results difficult to compare. However, Henneberg et al. [5] observed that a shorter period of time was needed to reach CO 2 production steady state after a ventilation increase, and a longer period of time was needed after a ventilation decrease, in contrast to Nunn's findings related to end tidal CO 2 concentration. The reason for this discrepancy may be the different values which were used for step change in the input variable (see Table 2). The different output responses to different input values would indicate a nonlinearity of the CO 2 system and thus the necessity of investigating the whole range of change in the input variable. The patient model used in our study can naturally be modified according to the results of such an investigation. The PI controller settings Kp = 0.05, K, = 0.03 obtained in the simulation for the most favorable transient state (Fig. 4c) are similar to the settings Kp = 0.04, K~ = 0.02, K d = 0.005 determined empirically by Ohlson et al. [11 for the PID controller. It is difficult, however, to compare the present results with the work of the other authors, because the equipment gains, which influence the overall gain of the system, are not reported in their studies. In this study the gain attributed to the respirator and the CO 2 concentration sensor wa:~ assumed to be unity. TABLE 2 A comparison of two models describing patient CO2 dynamics Nunn [4]

Henneberg et al. 151

5. D i s c u s s i o n

The model was tested in simulation trials. The next step should be validation in animal experiments, prior to its application in clinical practice. The patient equation proposed by N u n n [4] was used in our work. In a more recent paper, Henneberg et al. [5] adapted a model of Fahri and Rahn [6] in order to use computer simulation for studying CO2 dynamics in different clinical situations. The differences between the N u n n and Henneberg

Number of compartments Step change in input variable (minute volume) Output variable Patients




End tidal CO2 concentration Patients under general anesthesia

CO2 production Intensivecare unit patients

248 Since there are time delays in the system, a PI controller might not be sufficient. A PID controller would speed up the system and compensate for the time delay. On the other hand pure time •delays are always difficult to handle and the derivative (D) action would also tend to make the system less stable. The possible source of the time delay in our system is the CO 2 concentration -sensor. However, the estimated time delay of the sensor (0.5 s) is small in comparison to the patient time constant chosen for the simulation (30 s). Should a PID controller be necessary, then the model presented here can be developed for derivative action of the controller, The advantage of the PI over the PID controller in clinical conditions may be the smaller number of settings, and consequently the simpler tuning. A problem which can be encountered in a real situation with any type of controller is due to the nonlinear static characteristics of the patient (Fig. 2). The repeated identification procedure may be necessary for the estimation of patient gain and controller settings when a significantly different equilibrium point (MV) 0, (CErco:) 0 is desired. The PID and PI controllers described elsewhere [1-3] maintained end tidal CO 2 concentration in animal experimentation with good accuracy and stability throughout a range of operating conditions. The main problem was not associated with the controller type, but with the fact that when large changes in ventilation-perfusion ratios were introduced and physiological dead space was increased, the end tidal CO2 became a poor representative of arterial CO 2 concentration. The latter was then not maintained at a desired level. That problem can be solved by introducing transcutaneous CO 2 measurement in addition to end tidal CO2 measurement [3].

6. Conclusion Computer simulation of a patient end tidal CO 2 controller system can be a helpful tool in finding the appropriate controller settings.

Acknowledgements The authors wish to thank Professor O. Wigertz, Head of the Department of Medical Informatics at LinkiSping University, for his valuable comments, and Mrs. S. Hjalmarsson, Mrs. B. Ossmer and Ms. A. Bokliden from the Medical Intensive Care Unit, South Hospital, Stockholm, for their help in the preparation of the manuscript.

References [1] K.B. Ohlson. D.R. Westenskowand W.S. Jordan, A microprocessor based feedbackcontroller for mechanicalventilation, Ann. Biomed. Eng. I0 (1982) 35-48. [2] T.D. East, D.R. Westenskow,N.L. Pace and L.D. Nelson, A microcomputer based differential lung ventilation system, IEEE Trans. Biomed. Eng. BME-29 (1982) 736-740. [3] F.W. Chapman, J.C. Newell and R.J. Roy, A feedback controller for ventilatory therapy, Ann. Biomed. Eng. 13 (1985) 359-372. [4] J.F. Nunn, Carbon dioxide stores and the unsteady state. in: Applied Respiratory Physiology,2nd edn., pp. 354-358 (Butterworths, London, 1978). [5] S. Henneberg, D. S~Sderberg,T. Groth, H. Stjernstri~mand L. Wiklund, Carbon dioxide production during mechanical ventilation, Crit. Care Med. 1 (1987) 8-13. [6] L.E. Fahri and H, Rahn, Dynamics of changes in i~arbon dioxide stores, Anesthesiology21 (1960) 604.