1 Introduction

Mechanical ventilation (MV) is the use of breath-designed devices that support patients with respiratory disorders, such as acute respiratory distress syndrome (ARDS) in breathing, until their natural body immune system and treatment administered by a clinician or physician clear the infection and the lung function is restored to its normal lung operation [1, 2, 3, 4]. MV has got different control variables for the breath, that is, volume/flow-controlled mode and pressure-controlled mode [5]. The MV breathe control variables can be interchanged during one breath and the operator changes the parameters manually for the conventional MV. For the case of the intelligent MV, the parameters change with respect to signals from the patients, which can be the pressure in the airway or diaphragmatic signal and a mathematical model changes some parameters according to the patient’s requirements. The conventional and intelligent MV systems still need the operators to change some parameters. Assist mode and proportional mode MV may not need full operator’s intervention, that is to say, assist modes use the fixed parameter, such as airway pressure target, that will be delivered when the patient initiates the breath; proportional modes do not use pressure target, rather, they synchronize with the patient’s pressure demand during the breathe inspiration, increasing comfort during the ventilation. Furthermore, the difference comes in with proportional modes, in that, the patient has to initiate the MV by contributing enough pressure to trigger the ventilator, while the assist mode, uses the pressure target that is initially set by the operator. Assist modes like pressure support ventilators (PSV) that use airway pressure have been developed to respond to the patient’s requirements, but the signal used is not accurate as it does not come from the brain stem. They use preset pressure and volume changes or preset volume and the pressure changes, according to the patient’s demand. Proportional modes, like proportional assist ventilation (PAV) and neurally adjust ventilatory assist (NAVA), adjust both the pressure and volume according to the patient’s need with no need of the operator setting the parameters. These, however, need further adjustments to be done by the physicians; since for assist modes, the operator is still needed to initially set the parameter(s), and for proportional modes, in case the patient has apnea breathing disease or ARDS, the MV will not be initiated.

There has been a developed procedure on ventilating the patients with ARDS; it is called the ARDS Berlin definition.

1.1 Berlin Definition

Berlin definition of acute respiratory distress syndrome (ARDS) was defined from Berlin, as ARDS that is discovered one week after respiratory failure, bilateral opacities on chest scans. The Berlin definition protocols are the guidelines to the physician on what adjustments to make on the ventilator system while ventilating a patient with ARDS. The severity of the ARDS is a big factor when determining the deviation from the studied 6-ml/ kg tidal volume [6, 7, 8]; the ARDS Berlin definition of ARDS severity is shown in Table 1 [9, 10].

Table 1 Severity of ARDS [9]

The severity of ARDS depends on the degree of the hypoxemia that is calculated based on the ratio of arterial oxygen tension to fraction of inspired oxygen (PaO2/ FiO2). Table 1 classifies the severity of ARDS and Ferguson et al. [9] note that for all classifications of ARDS, positive end-expiratory pressure (PEEP) is ≥ 5 cm H2O. More authors also confirm that there is no significant relation between the high or low PEEP with mortality for patients with ARDS [11] and without ARDS [12]. Briel et al. [13] however say that there is no significant change for mortality but the higher the PEEP levels the higher the chances of survival of patients with ARDS; although, for lung protective methods, higher PEEP levels damage the lungs. Therefore, there is need of a fuzzy system that is able to determine the negative and positive deviations from the recommended levels, which in turn reduces on the complications needed in taking measurements by the physicians based on the ARDS Berlin definition. The fuzzy system can act as a guide/ alarm for the physicians.

1.2 Related Work and Paper Contribution

Nguyen et al. in [14] and [15] use three input parameters; that is, PEEP, peak airway pressure (PAP), and arterial oxygen saturation (SaO2) as input measurements to the fuzzy inference system and use two output parameters; that is, change in tidal volume (\(\Delta V_t\)) and change in PEEP (ΔPEEP) as output readings in form of deviation from the original readings, by calculating the difference between the fuzzy reading and original reading.

More studies show that the ventilator settings manually put by the nurses or ventilator operators produce errors due to lack of knowledge about the ventilator settings for the different patients [16].

This study focuses on PEEP, potential of Hydrogen (pH), respiratory rate, and tidal volume adjustment. The ARDS Berlin definition on PEEP adjustments with respect to the FiO2 is shown in Table 2. The designed fuzzy algorithm is able to achieve the PaO2 goal of 55–80% or oxygen saturation (SpO2) goal of 88–96% with high accuracy; that is, reduction on the human errors during especially in situations of emergency and overwhelmed limited physicians, due to the big number of patients who need the physicians’ attention during the ventilation; the time spent by physicians on deciding what parameters to adjust and to what extent is reduced.

Table 2 ARDS Berlin definition PEEP adjustments [17, 18]

1.3 Research Questions

  • What triggers the change in mechanical ventilator parameters?

  • How best can fuzzy logic be used in increasing the accuracy of parameter settings while protecting the lungs?

2 Materials and Methods

Fuzzy logic algorithm is implemented in the adjustments of the parameter settings using the ARDS Berlin definition. The following sections discuss in details the patient MV settings and then the detailed matrix laboratory (MATLAB) fuzzy logic toolbox used in this research for training the algorithm and graphical simulations.

2.1 Fuzzy Logic System Architecture

The architecture of the designed fuzzy logic system is shown in Fig. 1. Fuzzy logic [19] system uses fuzzy sets [20, 21, 22, 23] to represent knowledge and decision-making that could have been represented using mathematical formulas using degrees of membership [24, 25, 26]. Defining a fuzzy set, it is a pair of elements with fuzzy boundaries. If we assume X is the universe of the discourse containing x elements, a fuzzy set A in X is defined by its membership function:

Fig. 1
figure 1

The proposed ventilator parameter fuzzy switching system

$$\begin{aligned} \mu _{A}(x): X \rightarrow [0,1] \end{aligned},$$
(1)

that is, \(\mu _{A}(x)\) is the degree of membership of element x in fuzzy set A for each \(x \in A\).

2.1.1 Crisp Inputs [27]

x\(_1\), x\(_2\),... x\(_{i}\) in Fig. 1 stand for general crisp inputs. Four crisp inputs were used in this research as shown in Eqs. 2 and 3, that is, positive end-expiratory pressure (PEEP) which is an important factor when treating the patients with ARDS [172829], in this paper, it is defined as B; fraction of inspired oxygen (FiO2) estimates the oxygen administered to the patient [30, 31], defined as C; peripheral oxygen saturation (SpO2) that determines the amount of oxygen in the blood [32, 33], defined as D; and severity of acute respiratory distress syndrome (ARDS) based on medical imaging condition defined as E to be fuzzified.

Equations 2 and 3 are used in building the rules of the fuzzy system. Equation 2 uses the “or” fuzzy operator, and Eq. 3 uses the “and” fuzzy operator in setting the “If-then” fuzzy rules by combining the inputs for fuzzification.

$$\begin{aligned} B \cup C \cup D \cup E = \{x, max(\mu _{B}(x),\mu _{C}(y), \mu _{D}(z), \mu _{E}(q) ) \} \end{aligned}$$
(2)

for \(x \in X, y \in Y, z \in Z, q \in Q,\)

$$\begin{aligned} B \, \cap \, C \, \cap \, D \, \cap \, E = \{x, min(\mu _{B}(x),\mu _{C}(y), \mu _{D}(z), \mu _{E}(q)) \} \end{aligned}$$
(3)

for \(x \in X, y \in Y, z \in Z, q \in Q.\)

A general fuzzy rule is as shown below:

“If \(x_i\) is B and/or \(y_i\) is C and/or \(z_i\) is D and/or \(q_i\) is E then \(m_i\) is F and/or \(n_i\) is G”

where \(x \in X, y \in Y, z \in Z, q \in Q, m \in M, n \in N\), F, and G are the output fuzzy sets, \(i = 1... n,\) where n represents the number of linguistic values of the respective linguistic variables/fuzzy sets.

2.1.2 Fuzzification and Membership Functions [34, 35, 36, 37, 38]

The fuzzification maps crisp input values x \(\in\) X to fuzzy set A \(\in\) X. The fuzzy input values are then applied in the rule base. In the mapping process for this study, two membership functions were used: triangular and trapezoidal membership functions as they provide accurate and fast response in mapping of inputs to outputs [39, 40, 41]. Since they are fast, they will help in reducing the time needed to make a decision during the ventilation parameter adjustment. From Fig. 1, the triangular membership function is defined by Eq. 4, where a is the lower limit, b is the upper limit, and m is the peak value.

The trapezoidal membership function is defined by Eq. 5, where a is the lower limit, b is the lower support limit, c is the upper support limit, and d is the upper limit.

$$\begin{aligned} \mu _A(x) = {\left\{ \begin{array}{ll} 0 \quad \quad \quad \,\, x \le a \\ \frac{x-a}{m-a} \quad \,\, a< x \le m \\ \frac{b-x}{b-m} \quad \,\, m < x \le b \\ 0 \quad \quad \quad \,\, x \ge b \\ \end{array}\right. } \end{aligned},$$
(4)
$$\begin{aligned} \mu _A(x) = {\left\{ \begin{array}{ll} 0 \quad \quad \,\, (x < a) \,or\, (x > b) \\ \frac{x-a}{b-a} \quad \,\, a \le x \le b \\ 1 \quad \quad \,\, b \le x \le c \\ \frac{d-x}{d-c} \quad \,\, c \le x \le d \\ \end{array}\right. } \end{aligned}.$$
(5)

2.1.3 Rule Base and Fuzzy Inference System

Tables 3 and 4 show the different rules (RULE 1, RULE 2,..., RULE m; as per Fig. 1) used to convert the fuzzy inputs from the fuzzification process into fuzzy outputs. The fuzzy output values are then subjected for defuzzification.

Parameters of the FiO2 linguistic terms ranging from F1 to F10 for a 0.1–1 scale of FiO2. Parameters of the high-PEEP linguistic terms ranging from HP1 to HP8 for a 0–24 scale is shown in Table 2, respectively.

The rules in Tables 3 and 4 are combined using the fuzzy operators and the triangular and trapezoidal membership functions are proposed. The Mamdani fuzzy inference system is used for this research due to its accuracy while using the min-max operations [42, 43, 44].

Table 3 Fuzzy set rules used in this study for patients that require high PEEP
Table 4 Fuzzy set rules used in this study for pH adjustments

2.1.4 Defuzzification and Membership Functions [34, 37]

The centroid defuzzification method was used; it determines the center of the area of the fuzzy set and returns the crisp value (Z) [45, 46]. The centroid method maps a continuous and smooth change of the input crisp values to the crisp outputs, hence accurate for fuzzy reasoning [1]. The centroid defuzzification method is helpful in this study to increase the accuracy of the ventilator parameter adjustments. The expression that mathematically describes the centroid method in Fig. 6 is shown in Eq. 

$$\begin{aligned} Crisp\,\,\, output, Z = \frac{\sum _{i} x_i \mu (x_i)}{\sum _{i} \mu (x_i)} \end{aligned}$$
(6)

where \(\mu (x_i)\) is the membership value for the element \(x_i\) in the universe of the discourse [47]. The centroid method considers the fact that if a body is balancing perfectly, then its concentrated mass is at the center of gravity or center of mass. This is attained by dividing the summation of the product of each element in the universe of the discourse and its membership value (\(\sum _{i} x_i \mu (x_i)\)) by the summation of its membership value alone (\(\sum _{i} \mu (x_i)\)). In the process, the center of area of the fuzzy set is converted into the correlating crisp output.

2.1.5 Crisp Outputs [27]

The crisp outputs are the values that control the switching and changing of the ventilator settings. The crisp outputs are values that are precise unlike the fuzzy values that are approximate. From Fig. 1, the crisp outputs are \(\Delta V_t\) and \(\Delta PEEP\), which are displayed for the physician’s guidance on how to adjust the ventilator parameters based on the patient’s demand (process under control). The process repeats continuously using the feedback loop to help the algorithms to adjust parameter settings.

Figure 2 summarizes the implementation of the fuzzy-based lung protective medical ventilator management for patients with corona virus disease 2019 (COVID-19) ARDS and ARDS from other origins basing on the Berlin definition of ARDS.

2.2 The Flowchart

Fig. 2
figure 2

ARDS Berlin definition flowchart

The ventilation of patients with ARDS according to Berlin definition as shown in Fig. 2 starts with ensuring ventilation synchrony, and then titrates the PEEP. The Plateau pressure, \(P_{plat}\) is measured with inspiratory pause, and the PEEP is gradually increased; then, \(P_{plat}\) is re-measured after 20 s; if the driving pressure reduces, the lowest PEEP is captured; otherwise, the previous PEEP is recorded. \(P_{plat}\) is again measured, and if it is less than 30 mm Hg, potential of hydrogen (pH) is recorded and respiratory rate (RR) and tidal volume (V\(_T\)) parameters are adjusted until pH is greater than 7.2. If P\(_{plat}\) is greater than 30 mm Hg, V\(_T\) is reduced upto 4 cc/kg, and if \(P_{plat}\) remains less than 30 mm Hg, then call for a physician is passed on as an alarm. If the goals PaO\(_2\) = 60–80 mm Hg, SpO\(_2\) = 90–94 percent, V\(_T\) = 6 cc/ kg, \(P_{plat}\) is less than 30 mm Hg, and pH is greater than 7.2, then the FiO\(_2\) is titrated down until when the patient can successfully wean off the ventilator.

3 Results and Discussion

The MATLAB R2021b software was used to obtain the experimental results. The Fuzzy Logic Designer toolbox in MATLAB was used to design the fuzzy-based High-PEEP adjustments and to view the results using the rule viewer and surface viewer.

3.1 Results in MATLAB (Rule Viewer)

The results attained in this paper are not in comparison with another algorithm but rather a new development by applying automated decision-making in MV, which will guide the physicians when making decisions. Fuzzy logic method has not been used so far in decision-making of ARDS Berlin definition. These results therefore are a new development in ARDS Berlin definition decision-making.

3.1.1 Minimizing Driving Pressure

The first step will be to first measure the plateau pressure, \(P_{plat}\) with inspiratory pause. Figure 3 shows the initial settings for ventilator adjustments in ARDS, and the result shows that the positive end-expiratory pressure changes by positive two (2), which is recommended by acute respiratory distress syndrome Berlin definition. This can also be seen in Table 2; for \(FiO_2\) being set to 1, the PEEP is incrementally added until the PaO\(_2\) goal of 55–80% or SpO2 goal of 88–96% is reached.

Fig. 3
figure 3

Initial ventilator settings in rule viewer

At this point, a code runs to re-measure the \(P_{plat}\) after 20 s. If driving pressure given by Eq. 7 decreases, then the loop from the first step is repeated until a minimum driving pressure is achieved and if the driving pressure increases, the prior PEEP is considered.

$$\begin{aligned} Driving \, \, pressure = P_{plat} - PEEP \end{aligned}.$$
(7)

The next step is to read the \(P_{plat}\); if it is not less than 30 mm Hg, then the Berlin instructions of ventilator synchrony: lower tidal volume and repeat of inspiratory pause are considered; otherwise, the next step is the pH reading.

3.1.2 pH Setting

The pH reading is then read and according to the rule viewer for pH adjustments in Fig. 4, rules increase the respiratory rate and increase the tidal volume when the pH is less than 7.2; rules in Fig. 5 keep the respiratory rate and the tidal volume maintained when the pH is between 7.2 and 7.4; and finally, rules in Fig. 6 decrease the respiratory rate and maintain the tidal volume when the pH is greater than 7.4.

Fig. 4
figure 4

Rule viewer showing low pH with increase in respiratory rate and increase in tidal volume

Fig. 5
figure 5

Rule viewer showing moderate pH with respiratory rate and tidal volume maintained

Fig. 6
figure 6

Rule viewer showing high pH with decrease in respiratory rate and tidal volume maintained

3.2 Results in MATLAB (Surface View)

3.2.1 Minimizing Driving Pressure

Figure 7 shows the surface view with the settings starting with the set positive end-expiratory pressure (10 cm H2O) and 100 percent of inspired fraction of oxygen (FiO\(_2\)). As FiO\(_2\) decreases, there is a negative change in PEEP for respective FiO\(_2\), as shown in acute respiratory distress syndrome clinical network (ARDSNet) PEEP tables.

Fig. 7
figure 7

Initiation of the ventilator settings in surface view

3.2.2 pH Setting

The surface view for the pH setting in Fig. 8 relates the pH readings with change in tidal volume. For pH less than 7.15, the tidal volume increases by 1.5; pH between 7.15 and 7.3, the tidal volume gradually decreases in incremental adjustments until when it is maintained at pH greater than 7.3.

Figure 9 relates the pH readings with change in respiratory rate. For pH less than 7.15, the respiratory rate increases by 1.5; for pH between 7.15 and 7.3, the respiratory rate stochastically reduces in incremental adjustments until when it is maintained at pH greater than 7.3.

Fig. 8
figure 8

Surface view relating pH with change in tidal volume

Fig. 9
figure 9

Surface view relating pH with change in respiratory rate

Table 5 shows the comparison between the physician-based MV protocol using the original high levels of PEEP [18] and the fuzzy-based Berlin definition of ARDS (system designed in this research paper). The physician-based PEEP adjustments for MV protocol as shown in Table 2 [17] have exact values (whole numbers) for PEEP adjustments; as for the fuzzified system of this research paper, PEEP adjustments have detailed variation in change of the PEEP. This implies that the fuzzy-based Berlin definition of ARDS system is more accurate and fast, improving the speed and accuracy of the decision-making during the MV.

The triangular and trapezoidal membership functions were found fit for the fuzzy system since they are based on linear fit function capability; that is, they were appropriate to define the ventilator setting values and represent the ARDS Berlin definition parameter ranges.

Table 5 Comparison between physician-based High-PEEP definition and fuzzified Berlin High-PEEP definition [17, 18]

In comparison with the non-linear membership functions, such as Gaussian function and sigmoidal function, the linear fit functions need less computational power and time, making it convenient to adjust the ventilator parameters in shortest time possible, as well as having accurate crisp outputs during the emergency ventilation intervention.

4 Conclusion

The use of the existing fuzzy logic method is not new but the application of the fuzzy logic method in adjustment of the ventilator parameters is new, with a purpose of reducing the physician’s time spent in thinking on what parameters to control/adjust on the ventilator, especially during an emergency; the algorithms also decrease the possibility of having ventilator inevitable human errors, hence ensuring lung protection [48, 49, 50].

The limitations of this research are as follows: it focused on the High-PEEP adjustments with respect to the FiO\(_2\) readings and used Fuzzy Logic Designer toolbox to design the system which shows better outputs, but a better toolbox such as fuzzy neural network can be used to increase on the accuracy of the output results based on the new parameters, such as the medical image.

For future work, authors can design an algorithm based on neural network that considers all procedures, that is, the driving pressure calculation, respiratory rate, and tidal volume, in the ARDS Berlin definition and includes the medical image analysis to detect the bilateral opacities such that the PaO\(_2\) goal of 55–80% or SpO\(_2\) goal of 88-96% is reached.