Purpose of the controller
The ventilator controller allows to configure and monitor the ventilation process to provide the required support for the patient's respiratory function. In addition, the controller allows to observe the patient's condition and adapt ventilation parameters according to their needs.
The controller is required to control and regulate the following ventilation parameters:
- Pressure.
- Flow rate.
- Respiratory rate.
In order to ensure the controller operation, it is required to simulate the lung ventilation unit taking into account the mathematical model of the patient's lungs.
Mathematical model description
The lung ventilation unit consists of the following parts:
- Centrifugal pump (fan)
- Air connectors (hoses).
Model of centrifugal pump
The fan pressurizes the ambient air to ventilate the patient's lungs and blows air with a volumetric flow rate Qout and pressure pout. Its source is a control signal pcontrol.
Fan characteristics are assigned for steady state mode. In REPEAT, the fan is simulated as a dynamic system with inertia using the following formula:
\[ B(s) = \frac{p_{\text{out}}(s)}{p_{\text{control}}(s)} = \frac{\omega_n^2}{s^2 + 2 \zeta \omega_n s + \omega_n^2} \]
where \( \omega_n = 2 \pi n, \quad n = 30 \) rpm, and attenuation factor \( \zeta = 1 \), corresponding to actual experimental data,s - complex variable.
In order to implement the centrifugal pump model on REPEAT platform, a transfer function is used with pre-calculated constant coefficients of the numerator and denominator.
Model of air connectors (hoses)
The air exiting the ventilator passes through a hose before entering the patient's lungs. A leak hose ensures that exhaled air can escape from the air connectors under ambient conditions (\( P_{\text{amb}} = 0 \)). Also, the leak hose allows fresh air when breathing in. The pressure at the end of the air connectors, that is, the pressure supplied to the respiratory tract of the lungs, is paw. The volumetric air flow rate to the patient's lungs is \( Q_{\text{pat}} \),and the leakage flow rate is \( Q_{\text{leak}} \).
Hose losses are modeled by linear resistance functions \( R_{\text{hose}} \) and \( R_{\text{leak}} \) for long hose and leak hose, respectively. The pressure drop in these areas is calculated in proportion to the volume flow rate, as given below:
\[ p_{\text{out}} - p_{\text{aw}} = R_{\text{hose}} Q_{\text{out}} \quad p_{\text{aw}} - p_{\text{amb}} = R_{\text{leak}} Q_{\text{leak}} \quad \Rightarrow \quad p_{\text{aw}} = R_{\text{leak}} Q_{\text{leak}} \]
Taking into account the principle of preserving the flow, the output flow \( Q_{\text{out}} \), patient flow \( Q_{\text{pat}} \) and leakage flow \( Q_{\text{leak}} \) related as follows:
\[ Q_{\text{pat}} = Q_{\text{out}} - Q_{\text{leak}} \]
Patient lungs model
The lungs respond to volumetric airflow/output (\( Q_{\text{pat}} \)) due to changes in pulmonary pressure and due to volumetric expansion/contraction.
The patient's lungs model successively consists of the following components:
- Rlung resistance to account for linear viscous losses;
- Clung compliance to account for lung elasticity.
The equations describing the dynamics of the lungs are given below:
\[ p_{\text{aw}} - p_{\text{lung}} = R_{\text{lung}} Q_{\text{pat}} \] \[ C_{\text{lung}} \frac{d}{dt}(p_{\text{lung}} - p_{\text{ext}}) = Q_{\text{pat}} \]
where \( p_{\text{ext}} \) is the external pressure on lungs, which is taken equal to zero. \( C_{\text{lung}} \) calculated by the following formula:
\[ C_{\text{lung}} \frac{d}{dt}(p_{\text{lung}}) = Q_{\text{pat}} \]
Figure 1. Diagram of the ventilation system
The table of data from which values will be calculated and entered is given below (Table 1).
Parameter
|
Value
|
Unit of measurement
|
Target plateau pressure
|
20
|
Mbar
|
Positive pressure at the end of exhalation
|
5
|
Mbar
|
Target growth time
|
0.1
|
s
|
Respiratory cycle time
|
5
|
s
|
Ratio of inspiration and expiration
|
0.35
|
-
|
\( R_{\text{lung}} \)
|
5/1000
|
mbar/( mL/s)
|
\( С_{\text{lung}} \)
|
20
|
mL/mbar
|
\( R_{\text{leak}} \)
|
60/1000
|
mbar/( mL/s)
|
\( R_{\text{hose}} \)
|
4.5/1000
|
mbar/( mL/s)
|
Table 1. Parameters used for simulation
Simulation stage
In order to enter the value of the input pressure on the ventilator, we use the “Constant”, “Simulation Time” and “Jython” blocks (see Figure 2). The target plateau pressure, positive pressure at the end of exhalation, target rise time, respiratory cycle time, and inspiratory/expiratory ratio are set into constants respectively.
Figure 2. Block diagram of the artificial ventilation unit.
The “Jython” block code is given below (see Figure 3):
Figure 3. Block code
In order to simulate the fan, use the “Transfer Function” block with pre-calculated coefficients from the “Automation” library (see Figure 4).
Figure 4. “Transfer function” block
A state space block in an external project is created for the combined model for hose and lungs. In order to simulate it, “Amplifier”, “Summator”, “Integrating link” blocks were used from the “Automation” library (see Figure 5).
Figure 5. Used blocks from "Automation" library
The designed state space block design is given below (see Figure 6). The block parameters are defined from values A, B, C, D, which are calculated as follows:
\[ A = \frac{1}{\frac{1}{R_{\text{hose}}} + \frac{1}{R_{\text{leak}}}} - R_{\text{lung}} C_{\text{lung}} \left( \frac{1}{R_{\text{lung}}} + \frac{1}{R_{\text{hose}}} + \frac{1}{R_{\text{leak}}} \right) \] \[ B = \frac{1}{R_{\text{hose}}} - \frac{1}{R_{\text{lung}} C_{\text{lung}} \left( \frac{1}{R_{\text{lung}}} + \frac{1}{R_{\text{hose}}} + \frac{1}{R_{\text{leak}}} \right)} \] \[ C = \left[ \frac{1}{R_{\text{lung}}} - \frac{1}{R_{\text{hose}}} + \frac{1}{R_{\text{leak}}} \right]^T R_{\text{lung}} \left( \frac{1}{R_{\text{lung}}} + \frac{1}{R_{\text{hose}}} + \frac{1}{R_{\text{leak}}} \right) \] \[ D = \left[ \frac{1}{R_{\text{hose}}} - \frac{1}{R_{\text{hose}}} \right]^T R_{\text{lung}} \left( \frac{1}{R_{\text{lung}}} + \frac{1}{R_{\text{hose}}} + \frac{1}{R_{\text{leak}}} \right) \]
Figure 6. State space block model
A “PID controller” block and unit gain are used for PID control. As a result, we get a complete model on the general diagram (see Figure 7).
Figure 7. Diagram of the controller model for lung ventilation unit on REPEAT platform
Adjustment of the variable gain factor
A strategy for adjustment of the variable gain factor can be developed based on the patient's volumetric air flow rate value \( Q_{\text{pat}} \). ОThe main idea is this: when the flow rate \( Q_{\text{pat}} \) is high (say, above the \( \delta \)threshold — the switching length), a high gain controller can be used. In contrast, when the flow rate is low, it is preferable to use a low gain controller that minimizes fluctuations in flow rate.
The non-linear gain factor of the switch \( \varphi \) can be described by the following equation:
\[ \Phi(Q_{\text{pat}}) = \begin{cases} 0, & \text{if } |Q_{\text{pat}}| \leqslant \delta \\ \alpha, & \text{if } |Q_{\text{pat}}| > \delta \end{cases} \]
where \( \alpha \) — s the high gain factor. The above-mentioned gain factor of switch can be used for error measurement and transmitted to the previously described controller with low gain factor.
ПWe design the non-linear gain factor of the switch \( \varphi \)(\( Q_{\text{pat}} \)) as a new subproject. The diagram is given below (see Figure 10).
Figure 10. Switch circuit
The above mentioned sub-model can now be integrated into our system to realize the circuit of gain factor. The complete diagram is given below (see Figure 11).
Figure 11. A diagram of the controller model for artificial ventilation with variable amplification
As such, the REPEAT software has broad potential for use and promise in medical technology, and we hope that this paper will stimulate further research.
Show