Self-adjusting ventilator control strategy based on PID

: The ventilator is a life-saving artifact for respiratory diseases. The ventilator control strategy affects the patient's condition and treatment effect. This paper designs a new adaptive ventilator control strategy, which retaining the traditional PID control method, and can quickly and effectively track the control signals. At the same time, the flow pressure sensor is added using to monitor the patient's breathing condition. The pressure of the ventilator is adjusted adaptively. The volume and the breathing time interval also make real-time adjustments accordingly. It has been proved by experiments that the control strategy can effectively control and adjust the parameters of the ventilator according to the patient's breathing state.


Introduction
The ventilator is one of the three clinical routine treatment devices. Mechanical ventilation is the use of a ventilator to treat patients with ventilation. The development of ventilator can be traced back to the 1940s [1]. Since the 1980s, mechanical ventilation technology has developed rapidly, mainly divided into development at the technology level and development at the application level. Different types of mathematical models have been considered for describing the mechanisms of pulmonary ventilation [2], [3], [4]. They make the mechanical ventilation technology more in line with the human physiological state, increase the synchronization with people, and reduce the adverse effects caused by mechanical ventilation.
At the technical level, the closed-loop theory is mainly used for the design of mechanical ventilation mode for several years [5], and the closed-loop theory is also called the closed-loop control system. The current mainstream control method is the PID control mode.
The previous exhalation trigger technology was set by the ventilator and its mode fixed is not adjustable. Fixed expiratory triggering methods often cause problems such as Man-machine uncoordinated problem, and different diseases need to adjust different inhalation time. Adjustable inspiratory triggers allow for more precise adjustment of breathing time in conjunction with patient time constants.
At the clinical application level, The main development is the introduction of a new ventilation strategy. In recent years, a large number of clinical practices have proposed protective ventilation strategies, mainly in the following: a. small tidal volume ventilation [6] b. the application of PEEP c. pressure target ventilation In addition, there are techniques to improve the interaction between the ventilator and the patient. One of the problems facing medical doctors during the setting of the ventilator in everyday clinical practice is the frequent emergence of Acute Respiratory Distress Syndrome (ARDS) [7][8][9][10][11]. The doctor needs to adjust the relationship between ventilation and pressure, and the pressure should not be too high when the ventilation is sufficient. Efforts to prevent or control ventilator induced lung injury (VILI) have evolved over several decades. During this evolution, attention has centered on several ventilation variables or phenomena in turn including: plateau pressure (addressing the risk of 'barotrauma') [12,13], tidal volume (to prevent 'volutrauma') [14][15][16], positive end-expiratory pressure (PEEP; to minimize 'atelectrauma' caused by the cyclic collapse and reinflation of alveoli) [17][18][19][20], and 'driving pressure' (to prevent over-inflation) [21].
Chiew et al use the iterative airway pressure reconstruction (IPR) method to simulate the normal breathing cycle, detecting the amplitude of the asynchronous breathing, and improving the patient's condition and ventilator interaction [22]. Henry et al explored the feasibility of coupling electrical impedance tomography (EIT) with a pulmonary function model to restore lung function parameters and provide a basis for mechanical ventilation control [23]. Milos et al. used a genetic algorithm to estimate the tracheal pressure model under the High Frequency Impact Ventilation Strategy (HFPV), which is more accurate than the most advanced baseline model elaborated by human experts [24]. Zhu Hui et al use the fuzzy expansion controller to control the dual pressure and flow, and realize the intelligent switch between volume control and pressure control based on the extended dual control mode in mechanical ventilation, which is conducive to dealing with contradictory and unpredictable unknown problem [25]. This paper designs a new adaptive ventilation control strategy, using PID as the control method, automatically adjusts the pressure and the inspiratory duration under a given tidal volume adjustment, and the strategy uses a single lung model as an example to verify the control results using an STM32 microcontroller.
The second part of the article is modeling. The third part is the Self-adjusting ventilator control method. The fourth part is the experimental results of single-chip program and the fifth part is the conclusions and deficiencies.

Single lung model establishment
To facilitate validation and study the effects of the breathing strategy, a single lung model was established. This allows you to use fewer resources without compromising the results of the final experiment. In this model, we see the lung as a separate part with a constant compliance (C), a constant airway (R) in the airway and incompressible.to facilitate research, the following assumption are made: a. Air of the system follows all ideal gas laws; b. The dynamic process is a quasi-balanced process; Palv Pmou Percw c. There is no air leakage during the working process. Continuous breathing model can be established as： shows that the gas flow is equal to the derivation of gas volume to time. Equation 2 shows that the gas flow is equal to the ratio of difference between the oral pressure and the lung pressure to the air resistance. Equation 3 shows that the lung pressure is equal to the sum of the ratio of the current inspiratory volume to the compliance and the lung elastic pressure. Equation 4 indicates that the elastic pressure of the lung is given by the ratio of the residual gas volume of the lungs to the compliance and the spontaneous breathing of the person.
We assume that the pressure at the mouth is an exogenous variable that can be controlled and measured, and that the gas flow Q(t) can be detected in real time, and that the respiratory drift of the patient due to spontaneous breathing is an unmeasurable sinusoidal variable. Before solving the control problem, we assume that our output is volume V(t) and we can get the gas flow Q(t) by deriving the volume V(t), so we can detect the volume by detecting the flow. The following equation can be obtained from Equations (1)- (4): is the amount of spontaneous breathing drift of the patient, which is usually not available. U(t) is the output pressure of the ventilator, which is the input variable we can control. The problem that we need to solve is how to control the volume of each indrawing gas of a patient with spontaneous breathing by controlling U(t). Although it cannot be accurately controlled, it can be controlled within a certain range.

Self-adjusting ventilator control method
In this section, we will describe an adaptive ventilator control method. Combined with the model established above, we can automatically adjust the breathing time and ventilator supply pressure through the patient's willingness to breathe. The basis of this method is the volumetric control method. But for different patients with different conditions, the required tidal volume and supply pressure are different. However, for the same individual, the required tidal volume is almost constant. We can first calibrate the tidal volume V F $G$ (L) required by the patient through other techniques, assuming that the patient's expiratory rate is Q(t), and The amount of tidal volume obtained during each breathing cycle is: where the Q + is: In a breathing cycle, the F (L) is the integral of Q + , which is the amount of actual tidal volume we give to the patient for each breath. Our goal is to design a strategy that can control 4IC ( ) at all times and finally let F (L) keep approaching a preset tidal volume V F $G$ . Moreover We should make the ventilation volume of each cycle close to V F $G$ in a short time.. But it can't change too fast, because too fast changes can easily cause a patient to have a barotrauma. The basic element of this control strategy is a pulse function, but the function has a gradient on the rising edges. This function is defined as: (8) is used as a curve of the input pressure. The input pressure for each cycle is the peak pressure of the cycle multiplied by the pulse function. The rising edge and the falling edge are set to have a gradient. On the one hand, it is better to achieve tracking during the experiment, and it can also avoid the air pressure injury caused by the sudden increase of pressure, which is beneficial to the rehabilitation of the patient.
Under normal circumstances, we divide the ventilation method into two types: Assisted ventilation: The patient has spontaneous breathing, but the tidal volume is insufficient due to lung disease.
Controlled ventilation: The patient does not have spontaneous breathing who Breathes fully supplied by the ventilator.
According to the above, for each ventilation control cycle, we can obtain the tidal volume of a cycle by integrating the forward ventilation flow. When controlling the tidal volume to change toward the ideal tidal volume V F $G$ , it is appropriate to reach the ideal tidal volume within 2-3 breathing cycles as described above. We can know the amount of tidal volume in a breathing cycle: Then we can define the peak output pressure P 4IC 456 of the next breathing cycle according to the tidal volume and the ideal tidal volume in one cycle, thus forming a closed-loop control system: Because there is an agnostic variable W(t) in the control process, in order to achieve precise control as much as possible, we changed the previous pulse function and turned it into a function of the ventilation time that can be changed according to the amount of tidal volume: Determine whether to continue to output pressure to the lungs by judging whether the tidal volume reaches the ideal tidal volume. When the tidal volume reaches the ideal tidal volume, P(t) begins to decrease. Since the lung pressure is greater than the ventilator pressure, it begins to enter the expiratory step, and there is not much tidal volume input. Even if there is an error, it can be corrected by the above equations: After a closed loop control, we can control the exhalation time, the ventilator input pressure, and the amount of tidal volume based on the amount of tidal volume detected. And the patient's willingness to breathe is also taken into account.

Simulation and experiments
In this section, we will simulate and experimentally verify the previous models and control strategies. Since the human's spontaneous breathing is not measurable, in the simulation phase, we only performed simulations of controlled ventilation. Through simulation, we can know that the pressure can be stabilized after several cycles. According to the literature, the normal person's tidal volume is about 0.4L-0.5L. Since we are doing a single lung model, we assume that a lung has a tidal volume of 0.22L. Other parameters are found in the table below:   Figure 2 is the tidal volume of each cycle, which is cleared at the beginning of the new cycle. Figure 3 is the flow curve. Figure 4 is the pressure curve. Finally, the pressure is stable at 8.7 CmH 1 O.  Figure 5 is the tidal volume of each cycle. During the first cycle, the tidal volume will be affected by spontaneous respiration, and then the tidal volume changes tend to be stable. Figure 6 is the flow curve and Figure 7 is the pressure curve.  Figure 8 that the tidal volume remains basically unchanged during the simulation time, with an error of ±0.004L. Figure 10 is a pressure curve with large changes and is periodic. Figure 11. Tidal Volume (interference, spontaneous breathing) Figure 12. Cycle Time (interference, spontaneous breathing)  shows a simulated model with tidal volume interference used to simulate a patient's sudden, rapid breathing. There will be a 0.04L tidal volume surge during the 15th respiratory cycle. After the ventilator automatically adjusts the breathing cycle, the final error of the tidal volume is controlled to about 0.005L, and the cycle time is restored in the next cycle. Figure 11 is a tidal volume curve. Figure 12 shows the cycle time curve. It can be seen that the cycle time can be adjusted automatically.
In the simulation experiment, we will not consider the control error of the ventilator. Therefore, an experimental platform needs to be established for the verification of the simulation results. Since we use the blower to simulate the output of the ventilator, we need to control the blower by the single-chip microcomputer. The control algorithm we used is PID. Figure 13. Physical model Figure 13 is the physical model: (1) is a blower for simulating a ventilator. (2) is a tube used to simulate the airway between the ventilator and the lungs. (3) is an artificial lung. (4) is a single-chip microcomputer for processing sensor data and controlling the ventilator. (5) is a pressure flow sensor. In the experiment we used a single lung model, so the preset tidal volume was 0.22L. Because the pipeline is long and the air resistance is large, the ventilator output pressure will be higher than the simulation result when it is stable. After many experiments, a better set of PID coefficients was obtained for P = 0.115, I = 0.00001, and D = 0.007. We are conducting experiments on this basis.  We slightly reduced lung compliance, and the experimental results obtained are shown in Figure 15. The steady pressure is larger than that of Figure 14, but the tidal volume is same. Figure 15 Experimental result (interference, no spontaneous breathing) When the breathing is stable, external interference is applied to the lungs, which can be regarded as a change in lung compliance. As shown in Figure 16, there is an external disturbance in the 4th cycle, and the ventilator automatically adjusts the pressure and period according to the algorithm to ensure that the value of tidal volume does not change. The tidal volume is stabilized at the preset value 0.22L after two cycles. The cycle is continuously adjusted until the preset cycle time is restored.

Conclusions and deficiencies
As can be seen from the above results: a. PID control strategy allows the ventilator output pressure to track the theoretical pressure curve.
b. The adaptive control strategy can automatically adjust the ventilator output pressure and ventilation time according to the amount of tidal volume change.
Due to the lungs' low compliance of and insufficient rigidity, accurate tracking is not (4)single-chip microcomputer possible. The vibration of the flow curve is due to the large flow variation and insufficient sensor accuracy, but it does not affect the experimental results. However, our control strategy still has some deficiencies. For example, after the pressure becomes larger, the tidal volume can be controlled by reducing the ventilation time, but the pressure cannot be reduced. Only when the tidal volume is still greater than the ideal tidal volume during the minimum ventilation time, will it have a lower output pressure. This is also our goal for further research.