Self-Regulating Adaptive Controller for Oxygen Support to Severe Respiratory Distress Patients and Human Respiratory System Modeling

Uncontrolled breathing is the most critical and challenging situation for a healthcare person to patients. It may be due to simple cough/cold/critical disease to severe respiratory infection of the patients and resulting directly impacts the lungs and damages the alveoli which leads to shortness of breath and also impairs the oxygen exchange. The prolonged respiratory failure in such patients may cause death. In this condition, supportive care of the patients by medicine and a controlled oxygen supply is only the emergency treatment. In this paper, as a part of emergency support, the intelligent set-point modulated fuzzy PI-based model reference adaptive controller (SFPIMRAC) is delineated to control the oxygen supply to uncomforted breathing or respiratory infected patients. The effectiveness of the model reference adaptive controller (MRAC) is enhanced by assimilating the worthiness of fuzzy-based tuning and set-point modulation strategies. Since then, different conventional and intelligent controllers have attempted to regulate the supply of oxygen to respiratory distress patients. To overcome the limitations of previous techniques, researchers created the set-point modulated fuzzy PI-based model reference adaptive controller, which can react instantly to changes in oxygen demand in patients. Nonlinear mathematical formulations of the respiratory system and the exchange of oxygen with time delay are modeled and simulated for study. The efficacy of the proposed SFPIMRAC is tested, with transport delay and set-point variations in the devised respiratory model.


Introduction
At present, respiratory distress may be due to different respiratory tract-infected viruses, which are mainly rhinoviruses and enteroviruses (Picornaviridae), influenza viruses (Orthomyxoviridae), parainfluenza, metapneumoviruses and respiratory syncytial viruses (Paramyxoviridae), coronaviruses (Coronaviridae), several adenoviruses, or maybe some critical medical conditions. Out of the above viruses, adenoviruses have a DNA genome, and all others possess an RNA genome [1]. They are usually transmitted by direct hand-to-surface-to-hand contact or aerosol inhalation and replicate in both the upper and lower airways.
Breathing exercise issues due to any one of the above are one of the most uncontrollable and uncomfortable conditions of humans due to any cause, such as chronic obstructive pulmonary disease(COPD), bronchitis, emphysema, fibrosis, asthma, any medical critical care condition, and so on. There also are other physical conditions with acute respiratory infection symptoms in particular for older people and immune-suppressed patients such as fatigue, reduced alertness, reduced mobility, and many more [2,3]. As a result, there is a probability to reduce the oxygen saturation for the different above conditions of the patients.
A longer duration of this condition may also extend to the end of an individual's life. In the damaged area of the respiratory tract, there is a secretion that is a plasma protein that accumulates on the alveolus wall and thickens the lining. This produces a blockage in the path of oxygen transfer to the red blood cells, resulting in difficulty breathing, which creates a deficiency of oxygen in the internal organs. In this condition, the deficiency of oxygen in the human body, malfunctioning of organs, and also immunity deficiency enhance the present condition, which aggravates the crisis [4,5]. Mehedi, Ibrahim et al. [6] implemented a fuzzy PID controller for mechanical ventilation processes. Tuning a fuzzy controller is a strenuous task due to the substantial number of control parameters involved. But Mehedi, Ibrahim et al. [6] did not tune the controller, which is very much essential for critical processes such as the human respiratory system. Hansen et al. [7] proposed the O2matic ®based closed-loop controlled oxygen supply in COVID time, which has limitations of flow rate and it adjusts flow every second based on 15 s averaging of SpO 2 reading.
To sort out this emergency crisis, a scheme is proposed in this paper to design a modified model-based adaptive controller that can automatically control the oxygen level with a faster response but without overshoot, which is also the most important part of the designed controller to protect the patient from the over-concentration of oxygen. To suppress the above problem, a set-point modulated fuzzy PI-based model reference adaptive controller (SFPIMRAC) is proposed to control the oxygen level of respiratory distress patients without human intervention. The block diagram of the proposed scheme is shown in Figure 1.
Diagnostics 2023, 13, x FOR PEER REVIEW 2 of 21 many more [2,3]. As a result, there is a probability to reduce the oxygen saturation for the different above conditions of the patients. A longer duration of this condition may also extend to the end of an individual's life. In the damaged area of the respiratory tract, there is a secretion that is a plasma protein that accumulates on the alveolus wall and thickens the lining. This produces a blockage in the path of oxygen transfer to the red blood cells, resulting in difficulty breathing, which creates a deficiency of oxygen in the internal organs. In this condition, the deficiency of oxygen in the human body, malfunctioning of organs, and also immunity deficiency enhance the present condition, which aggravates the crisis [4,5]. Mehedi, Ibrahim et al. [6] implemented a fuzzy PID controller for mechanical ventilation processes. Tuning a fuzzy controller is a strenuous task due to the substantial number of control parameters involved. But Mehedi, Ibrahim et al. [6] did not tune the controller, which is very much essential for critical processes such as the human respiratory system. Hansen et al. [7] proposed the O2matic ® -based closed-loop controlled oxygen supply in COVID time, which has limitations of flow rate and it adjusts flow every second based on 15 s averaging of SpO2reading.
To sort out this emergency crisis, a scheme is proposed in this paper to design a modified model-based adaptive controller that can automatically control the oxygen level with a faster response but without overshoot, which is also the most important part of the designed controller to protect the patient from the over-concentration of oxygen. To suppress the above problem, a set-point modulated fuzzy PI-based model reference adaptive controller (SFPIMRAC) is proposed to control the oxygen level of respiratory distress patients without human intervention. The block diagram of the proposed scheme is shown in Figure 1.

Proposed Components of Respiratory Distress Treatments
The basic components of the proposed model to control the oxygen supply to critical respiratory distress patients are briefed in Figure 1. In this critical time, patients with respiratory distress need to be treated with oxygen therapy to restore normal breathing and also receive proper medication support. The proposed model could be an answer to this problem due to its automatic control capability of oxygen supply to patients without much human intervention. Mathematical modeling of the proposed system components, as listed in Figure 1, is derived below for the simulation study.

Oxygen Cylinder/Oxygen Concentrator
Oxygen therapy-related data with signs of severe respiratory distress, hypoxemia (i.e., SpO2 < 90%), or shock are initiated oxygen therapy at 5 L/min and titrated to SpO2 ≥ 90% in non-pregnant adults, and it will be SpO2 ≥ 92-95% in pregnant patients. A pulse oximeter measures the SpO2 level and checks the availability of an oxygen delivery system in the patient care unit [3].
Ideally, in any hospital, oxygen is supplied to the patients from the dedicated oxygen plant only for medical applications with a percentage of O2 (not less than 99.5% v/v of O2) concentration in that hospital through piping as shown in Figure 2, but unfortunately,

Proposed Components of Respiratory Distress Treatments
The basic components of the proposed model to control the oxygen supply to critical respiratory distress patients are briefed in Figure 1. In this critical time, patients with respiratory distress need to be treated with oxygen therapy to restore normal breathing and also receive proper medication support. The proposed model could be an answer to this problem due to its automatic control capability of oxygen supply to patients without much human intervention. Mathematical modeling of the proposed system components, as listed in Figure 1, is derived below for the simulation study.

Oxygen Cylinder/Oxygen Concentrator
Oxygen therapy-related data with signs of severe respiratory distress, hypoxemia (i.e., SpO 2 < 90%), or shock are initiated oxygen therapy at 5 L/min and titrated to SpO 2 ≥ 90% in non-pregnant adults, and it will be SpO 2 ≥ 92-95% in pregnant patients. A pulse oximeter measures the SpO 2 level and checks the availability of an oxygen delivery system in the patient care unit [3].
Ideally, in any hospital, oxygen is supplied to the patients from the dedicated oxygen plant only for medical applications with a percentage of O 2 (not less than 99.5% v/v of O 2 ) concentration in that hospital through piping as shown in Figure 2, but unfortunately, most hospitals and nursing homes do not have this facility, and thus they purchase oxygen cylinders from private vendors for treatment.  In this paper, a typical oxygen cylinder is modeled for the simulation study. In Figure 3, the variables P1, P2, q, R, and C are the input oxygen pressure (from the oxygen cylinder), output oxygen pressure (to the patient), oxygen flow rate, resistance in the flow path (valve resistance), and capacity (patient oxygen requirement) of the system, respectively. Considering the above parameters, the mathematical equation is formed using the electrical analogy.
The transfer function of the oxygen cylinder (TFcy) is derived by the Laplace transform of Equation (1). Equation (2) states that if a patient has severe breathing issues and needs more oxygen, then the C-value will be higher, which will make the R-value lower (i.e., the percentage of valve opening connected to the oxygen cylinder will be higher) or vice versa. In the present work, the value of the time constant (τ = CR) for the simulation study is considered as 0.50 s. and its reason is studied in the result section; however, it can work for other values also. The regulation of oxygen supply is manipulated by the valve opening (here, a change in R-value).
An instant supply of oxygen is very much essential for the treatment of uncontrolled acute breathing problems and thus needs immediate attention to improve and stabilize the SpO2 level. In emergency times, when traditional compressed-oxygen cylinders provide a limited amount of oxygen, it is better to equip each hospital with an oxygen concentrator/oxygen plant. Oxygen concentrators operate by drawing air from the environment to deliver a clean, continuous flow at a concentration of oxygen in the range of In this paper, a typical oxygen cylinder is modeled for the simulation study. In Figure 3, the variables P 1 , P 2 , q, R, and C are the input oxygen pressure (from the oxygen cylinder), output oxygen pressure (to the patient), oxygen flow rate, resistance in the flow path (valve resistance), and capacity (patient oxygen requirement) of the system, respectively. Considering the above parameters, the mathematical equation is formed using the electrical analogy.
most hospitals and nursing homes do not have this facility, and thus they purchase ox-ygen cylinders from private vendors for treatment. In this paper, a typical oxygen cylinder is modeled for the simulation study. In Figure 3, the variables P1, P2, q, R, and C are the input oxygen pressure (from the oxygen cylinder), output oxygen pressure (to the patient), oxygen flow rate, resistance in the flow path (valve resistance), and capacity (patient oxygen requirement) of the system, respectively. Considering the above parameters, the mathematical equation is formed using the electrical analogy.
The transfer function of the oxygen cylinder (TFcy) is derived by the Laplace transform of Equation (1). Equation (2) states that if a patient has severe breathing issues and needs more oxygen, then the C-value will be higher, which will make the R-value lower (i.e., the percentage of valve opening connected to the oxygen cylinder will be higher) or vice versa. In the present work, the value of the time constant (τ = CR) for the simulation study is considered as 0.50 s. and its reason is studied in the result section; however, it can work for other values also. The regulation of oxygen supply is manipulated by the valve opening (here, a change in R-value).
An instant supply of oxygen is very much essential for the treatment of uncontrolled acute breathing problems and thus needs immediate attention to improve and stabilize the SpO2 level. In emergency times, when traditional compressed-oxygen cylinders provide a limited amount of oxygen, it is better to equip each hospital with an oxygen concentrator/oxygen plant. Oxygen concentrators operate by drawing air from the environment to deliver a clean, continuous flow at a concentration of oxygen in the range of The transfer function of the oxygen cylinder (TFcy) is derived by the Laplace transform of Equation (1).
Equation (2) states that if a patient has severe breathing issues and needs more oxygen, then the C-value will be higher, which will make the R-value lower (i.e., the percentage of valve opening connected to the oxygen cylinder will be higher) or vice versa. In the present work, the value of the time constant (τ = CR) for the simulation study is considered as 0.50 s. and its reason is studied in the result section; however, it can work for other values also. The regulation of oxygen supply is manipulated by the valve opening (here, a change in R-value).
An instant supply of oxygen is very much essential for the treatment of uncontrolled acute breathing problems and thus needs immediate attention to improve and stabilize the SpO 2 level. In emergency times, when traditional compressed-oxygen cylinders provide a limited amount of oxygen, it is better to equip each hospital with an oxygen concentrator/oxygen plant. Oxygen concentrators operate by drawing air from the environment to deliver a clean, continuous flow at a concentration of oxygen in the range of 82-96%. It would be better to use a high-efficiency particulate air (HEPA) filter with an oxygen concentrator to create a more protected environment for the patients. The Institute of Environmental Sciences and Technology dictates that a HEPA filter must trap 99.97% of particulates of 0.01 microns or larger, whereas the average size of any virus is not less than around 0.123 microns [3].

Pulse Oximeter
A pulse oximeter is used to measure the oxygen concentration in a patient's blood in a non-invasive manner. The output of the pulse oximeter signal is fed to the comparator to monitor oxygen therapy in this proposed model, as outlined in Figure 1 [3].

Mathematical Model of Respiratory System
The airway of the human respiratory system, comprising the nose, mouth, pharynx, larynx, trachea, bronchi, and alveoli, carries air between the lungs and the body's exterior. In this paper, the human respiratory system is modeled in two halves. In the first part of the model, the flow of oxygen from the oxygen concentrator/cylinder to the alveoli passing through the nasal cavity, trachea, and bronchi is considered [6][7][8]. Gas exchange in the human respiratory system is modeled in the next part [9][10][11]. Moreover, a variable transport delay is included in the model to increase effectiveness.
The critical respiratory infection makes the alveolar sacs in the lungs stiff and thick. This degraded condition of the tissues makes it harder for O 2 -CO 2 exchange to take place through the walls of the alveoli with the bloodstream. Thus, the alveolar sacs stiffen, and as a result, the characteristic compliance of the alveoli decreases [10].

Respiratory Model Part I
The human respiratory system is broadly divided into four subgroups, starting with the nasal cavity, as shown in Figure 4. The next three subgroups, i.e., trachea-bronchial trees, are further subdivided into 24 generations (Table 1) [12][13][14]. In Table 1, generation '0', generation 1 to 19, and generation 20 to 23 correspond to the trachea, bronchi, and alveolar sacs, respectively. In this model, each branch of a given generation is further subdivided into two identical daughters; therefore, generation 'n' has 2 n branches [14,15]. The electrical equivalence of each generation in terms of resistance (R), inertance (L), and compliance (C) is derived as shown in Table 1 [13,16]. 82-96%. It would be better to use a high-efficiency particulate air (HEPA) filter with an oxygen concentrator to create a more protected environment for the patients. The Institute of Environmental Sciences and Technology dictates that a HEPA filter must trap 99.97% of particulates of 0.01 microns or larger, whereas the average size of any virus is not less than around 0.123 microns [3].

Pulse Oximeter
A pulse oximeter is used to measure the oxygen concentration in a patientʹs blood in a non-invasive manner. The output of the pulse oximeter signal is fed to the comparator to monitor oxygen therapy in this proposed model, as outlined in Figure 1 [3].

Mathematical Model of Respiratory System
The airway of the human respiratory system, comprising the nose, mouth, pharynx, larynx, trachea, bronchi, and alveoli, carries air between the lungs and the body's exterior. In this paper, the human respiratory system is modeled in two halves. In the first part of the model, the flow of oxygen from the oxygen concentrator/cylinder to the alveoli passing through the nasal cavity, trachea, and bronchi is considered [6][7][8]. Gas exchange in the human respiratory system is modeled in the next part [9][10][11]. Moreover, a variable transport delay is included in the model to increase effectiveness.
The critical respiratory infection makes the alveolar sacs in the lungs stiff and thick. This degraded condition of the tissues makes it harder for O2-CO2 exchange to take place through the walls of the alveoli with the bloodstream. Thus, the alveolar sacs stiffen, and as a result, the characteristic compliance of the alveoli decreases [10].

Respiratory Model Part I
The human respiratory system is broadly divided into four subgroups, starting with the nasal cavity, as shown in Figure 4. The next three subgroups, i.e., trachea-bronchial trees, are further subdivided into 24 generations (Table 1) [12][13][14]. In Table 1, generation '0', generation 1 to 19, and generation 20 to 23 correspond to the trachea, bronchi, and alveolar sacs, respectively. In this model, each branch of a given generation is further subdivided into two identical daughters; therefore, generation 'n' has 2 n branches [14,15]. The electrical equivalence of each generation in terms of resistance (R), inertance (L), and compliance (C) is derived as shown in Table 1 [13,16].   Table 2 [17][18][19]. Different sub-groups of Figure 4 are then modeled in terms of transfer functions as follows: Abnormality in the alveoli area can be reflected in the developed model in terms of a decrement in the capacitance value of the alveoli by about 100 to 1000 times, which means that the effective impedance Z = R 2 + (X L − X C ) 2 of the circuit will increase. The model of the alveolar section represented by Equation (6) thus gets modified to: where TF A refers to the transfer function of the alveolar section of a respiratory distress patient being affected by any of the above-mentioned viruses/critical medical conditions. The resultant model, TF M is derived from the series of combinations of the individual models, i.e.,

Respiratory Model Part II (Gas Exchange)
From Figure 5, it is seen that the gas exchange takes place in the area of alveolar air space, lung tissue, and capillary blood accordingly. In the case of the diffusion process, the movement of the gas from a high-concentration region to a low-concentration region is followed by the gradient profile [19]. This principle is followed during respiration, where gas exchange occurs between the blood and lungs. During this time, the concentration of oxygen is high and the carbon dioxide concentration is low in the blood, which undergoes the gas exchange with air in the lungs with a higher gradient profile than the blood. This process is the opposite of the expiration process [10,11,20]. Each of the alveoli is surrounded by a network-like structure of very small blood vessels of diameter 5 to 10 µm. For a normal person, under resting conditions, the volume of air available for gas exchange corresponds to the alveolar zone, which sums up to around 2.5 to 3 L, and the volume of blood in the neighborhood of the exchange surface is around 70 mL [21,22].

Partial Pressure Model
The concept of partial pressure is adopted to develop the mathematical model of the gas exchange part of the respiratory system. Mathematically, to find out the individual components' concentration in a mixture of gases, the partial pressure measuring method is used here, and the total pressure is calculated by the sum of the individual components [10,19]. The rate of diffusion of a gas is measured by its partial pressure within the total gas mixture, and they are linearly related. In this gas exchange model, the partial pressures for the alveolar air, lung tissue, and capillary blood are illustrated by , , and respectively [20]. The diffusion of oxygen, as shown in Figure 5, across lung tissue/alveolar air barriers and the lung tissue/capillary blood is modeled as follows: (i) Oxygen diffusion from alveolar air space to lung tissue: (9) (ii) Similarly, oxygen exchange between lung tissue, alveolar air space, and capillary blood is derived by:

Partial Pressure Model
The concept of partial pressure is adopted to develop the mathematical model of the gas exchange part of the respiratory system. Mathematically, to find out the individual components' concentration in a mixture of gases, the partial pressure measuring method is used here, and the total pressure is calculated by the sum of the individual components [10,19]. The rate of diffusion of a gas is measured by its partial pressure within the total gas mixture, and they are linearly related. In this gas exchange model, the partial pressures for the alveolar air, lung tissue, and capillary blood are illustrated by po 2A , po 2T , and po 2B respectively [20]. The diffusion of oxygen, as shown in Figure 5, across lung tissue/alveolar air barriers and the lung tissue/capillary blood is modeled as follows: (i) Oxygen diffusion from alveolar air space to lung tissue: (ii) Similarly, oxygen exchange between lung tissue, alveolar air space, and capillary blood is derived by: (iii) Oxygen transfer between lung tissue and capillary blood: V A , V T , and V B are the respective volumes of alveolar air space, lung tissue, and capillary blood. The parameters σ A , σ T , and σ B are used to convert the partial pressure of oxygen in alveolar air space, lung tissue, and capillary blood regions to their corresponding molar concentrations, respectively. In the model, the diffusion rates for lung tissue to alveolar air and lung tissue to capillary blood are illustrated by D TA and D TB , respectively. The different parameter values of the model are presented in Table 3. The gas exchange with the capillary blood is a very complex process. Ideally, different biological processes are functioning in this process of gas exchange, such as diffusion of oxygen and carbon dioxide, hemoglobin uptake of oxygen, and enzymatic reactions governing carbon dioxide and bicarbonate levels [10,20]. However, to make the model simple, in this work, only the rate of oxygen transfer is assumed, and some assumptions are considered as follows: Table 3. Parameters values of the gas exchange model. Assumptions: (i) Diffusion takes place in only two zones: capillary blood/lung tissue and lung tissue/alveolar air space. (ii) The alveolar air space must be well mixed. (iii) The same diffusion rate is considered here for each section of the gas exchange module (iv) and the continuous supply of oxygen is achieved by the ventilation process that provides fresh oxygen to the lungs, whereas venous blood is periodically pumped onto the exchange zone by the heart.

Electrical Analogy Model
An electrical equivalent circuit of Figure 5 is drawn in Figure 6.  Diffusion rate(L/s) DTA=2.4×10 −12 DTA=(6.7-10)×10 −12 Assumptions: (i) Diffusion takes place in only two zones: capillary blood/lung tissue and lung tissue/alveolar air space. (ii) The alveolar air space must be well mixed. (iii) The same diffusion rate is considered here for each section of the gas exchange module (iv) and the continuous supply of oxygen is achieved by the ventilation process that provides fresh oxygen to the lungs, whereas venous blood is periodically pumped onto the exchange zone by the heart.

Electrical Analogy Model
An electrical equivalent circuit of Figure 5 is drawn in Figure 6.
(ii) Oxygen exchange between lung tissue (LT), alveolar air space (AA), and capillary blood (CB): (iii) Oxygen transfer between LT and CB: The following equation parameters are derived from a careful comparison of Equations (12) to (14) with (9) to (11) and the data in Table 3: The ultimate gas exchange model (TF BO2 ) due to the diffusion of oxygen in the capillary blood is calculated by the Laplace transform of Equations (12) to (14). The transfer function (TF BO2 ) is derived by putting the corresponding resistance and capacitance values in Equation (15).
The ultimate human respiratory system (TP M ) in the infected area of the alveoli of the patient is modeled by a series combination of the models (TF M ) and (TF BO2 ).
The stability of the model is checked by the Bode plot in Figure 7. The positive values of gain margin (G m ) and phase margin (P m ) ensure that the respiratory model is a stable system.

Transport Delay
To make the model more realistic, in this study, a variable transport delay is included between the respiratory model and the gas exchange model. The study is carried out with various transport delays, as the time taken in gas exchange is not fixed in respiratory infected patients; it varies depending on the severity. The ultimate human respiratory system (TPM) in the infected area of the alveoli of the patient is modeled by a series combination of the models (TFM) and (TFBO2). (16) The stability of the model is checked by the Bode plot in Figure 7. The positive values of gain margin (Gm) and phase margin (Pm) ensure that the respiratory model is a

Transport Delay
To make the model more realistic, in this study, a variable transport delay is included between the respiratory model and the gas exchange model. The study is carried out with various transport delays, as the time taken in gas exchange is not fixed in respiratory infected patients; it varies depending on the severity.

Design of the Proposed Controller
In this section, the design part of the proposed set-point modulated fuzzy PI model reference adaptive controller (SFPIMRAC) is elaborated. Initially, the developed respiratory model for the respiratory distress patient is tested with a conventional PID controller and MRAC to control the oxygen supply and later MRAC is modified by incorporating the knowledge of fuzzy logic with a set-point tracking facility.

Design of MRAC
The basic concept of the MIT rule is applied to the design of the MRAC to control the oxygen supply to respiratory distress patients with respiratory infections associated with breathing problems. A basic scheme of MRAC is illustrated in Figure 8.

Design of the Proposed Controller
In this section, the design part of the proposed set-point modulated fuzzy PI model reference adaptive controller (SFPIMRAC) is elaborated. Initially, the developed respiratory model for the respiratory distress patient is tested with a conventional PID controller and MRAC to control the oxygen supply and later MRAC is modified by incorporating the knowledge of fuzzy logic with a set-point tracking facility.

Design of MRAC
The basic concept of the MIT rule is applied to the design of the MRAC to control the oxygen supply to respiratory distress patients with respiratory infections associated with breathing problems. A basic scheme of MRAC is illustrated in Figure 8. Optimization of control parameters to minimize the loss function is very important in any controller development. In this paper, the difference between patients' output (y) (pulse oximeter reading) and the model process output (ym) is measured in terms of error Optimization of control parameters to minimize the loss function is very important in any controller development. In this paper, the difference between patients' output (y) (pulse oximeter reading) and the model process output (y m ) is measured in terms of error (e) as pictured in Figure 8.
In the case of MRAC, there are two parameters: the adaptation gain (γ 1 ) control and adjustable control parameter (θ) is the most important part of the design. A suitable adjustment mechanism of (θ) that makes the measured error (e) to a value zero is also used to minimize the loss function F(θ), as shown in Figure 8 [23][24][25].
Minimization of loss function F(θ) is derived from the variation of the parameter θ in the direction of the negative gradient of F(θ) and adaptation gain (γ 1 ), i.e., where ∂e/∂θ is expressed as the sensitivity of the system. For the large process, there are many numbers of process variables such as (θ 1 , θ 2 , etc.) where Equation (18) can also be applicable. But in that case, output (θ) should be taken as a vector quantity in place of scalar one and mathematically the gradient of the error concerning the parameters concept is used to calculate its partial derivative ∂e/∂θ [24,26]. In Figure 8, the patient and the reference models are represented by KG(s) and K 0 G(s), respectively (where K is an unknown and K 0 is a known parameter). The output of the patient (y) always tracks the reference model output (y m ). From the scheme shown in Figure 8, the process output (y), model output (y m ), and error (e) are derived as follows: From (20): where u is the controller output and r is the input to the reference model. The calculation of ∂e/∂θ is derived by taking a partial derivative of (21).
Finally, the equation for adjusting the parameter variation in (18) is modified by (22).
From Figure 8, it is observed that the final output of the controller, or basically input to the process u [u = rθ] is obtained by the product of the reference input (r) with the adjustable control parameter (θ), which is obtained by integrating (dθ/dt). In Equation (23), the value of adaptation gain (γ 1 ) is a user-defined parameter that is a positive number, and its value depends on the process model [27][28][29][30].
The choice of exact adaptation gain (γ 1 ) is one of the most difficult steps in MRAC. To eliminate this difficulty, a set-point modulated fuzzy PI-based scheme is incorporated with MRAC to control the oxygen supply for respiratory distress patients.

Design of Set-Point Modulated Fuzzy PI-Based MRAC
A hybrid fuzzy PI logic is adopted for automatic gain adjustment of the controller. The two dynamic parameters (error and change of error) are used as the input parameters of the fuzzy system, as shown in Figure 9.
From Figure 8, it is observed that the final output of the controller, or basically input to the process u [u = rθ] is obtained by the product of the reference input (r) with the adjustable control parameter (θ), which is obtained by integrating (dθ/dt). In Equation (23), the value of adaptation gain (γ1) is a user-defined parameter that is a positive number, and its value depends on the process model [27][28][29][30].
The choice of exact adaptation gain (γ1) is one of the most difficult steps in MRAC. To eliminate this difficulty, a set-point modulated fuzzy PI-based scheme is incorporated with MRAC to control the oxygen supply for respiratory distress patients.

Design of Set-Point Modulated Fuzzy PI-based MRAC
A hybrid fuzzy PI logic is adopted for automatic gain adjustment of the controller. The two dynamic parameters (error and change of error) are used as the input parameters of the fuzzy system, as shown in Figure 9.

Fuzzy PI for Adaptive Gain (m) Adjustment
It is seen from Figure 9

Fuzzy PI for Adaptive Gain (m) Adjustment
It is seen from Figure 9   The adaptation gain 'm' as per Equation (24) depends on the input variables (e, Δe and the rule base, which consists of 25 fuzzy linguistic if-then rules shown in Table 4. The control parameter 'θ' is derived by applying Equation (25) [30].   The adaptation gain 'm' as per Equation (24) depends on the input variables (e, Δe and the rule base, which consists of 25 fuzzy linguistic if-then rules shown in Table 4. The control parameter 'θ' is derived by applying Equation (25)   The adaptation gain 'm' as per Equation (24) depends on the input variables (e, ∆e and the rule base, which consists of 25 fuzzy linguistic if-then rules shown in Table 4. The control parameter 'θ' is derived by applying Equation (25) [30]. The analysis of the control surface of fuzzy PI (e, ∆e vs. m) reveals the smoothness of the surface, which is very much essential for the smooth operations of the control equipment present in the loop. The study of Figure 12 and Table 5 discloses that the output (m) of the system depends on the input system parameters (e, ∆e). The capability of the controller is established from the analysis conducted in Table 5. In this design, the adaptation gain (γ 1 ) of MRAC is replaced by m, which auto-tunes the control parameter (θ = −my m ), for the right amount of oxygen supply to the patients. The effectiveness of the proposed controller is further enhanced by incorporating the set-point modulated scheme with fuzzy PI gain adjustment [28,29]. The final control output u, as shown in Figure 11, is derived as the product of control output (θ) and dynamic set-point ŕ (26)

Proposed Scheme (SFPIMRAC)
The final control output u, as shown in Figure 11, is derived as the product of control output (θ) and dynamic set-pointŕ u = r × θ (26) But the dynamic set point In the above Equations (26) and (27), the original set-point and error variables are symbolically represented as 'r' and 'e', respectively. The consequence of the new dynamic set-point on the proposed system is tabulated in Table 6.  (25) and (26), it is seen that due to the dynamic variation of the inputs (e, ∆e) of fuzzy PI, the adaptation gain (m) and final control output (u) are also altered accordingly [28,29]. As the reference set-point (r) is a fixed value, the dynamic set-point (ŕ) is modulated only by the temporary increase or decrease in the process error (e). This mechanism of set-point variation is used to boost the system's performance. It is seen from Table 6 that if the error is zero (steady-state condition), there is no variation in the dynamic set-point becauseŕ = r. In cases of undershooting or at the beginning, when the process variable tries to catch the set-point, the error is positive during that period, which indicates that the system needs more oxygen supply, which can be conducted by increasing the set-point (r = r + e), which in turn increases the control output (u = r × θ).With the same principle, in the case of overshooting, the error is negative, and that helps to decrease the control output.

Results and Discussion
The effectiveness of the proposed controller (SFPIMRAC) is investigated to control oxygen supply to respiratory distress patients. The proposed simulation work is demonstrated using a software tool (MATLAB R2009/SIMULINK) with the following reference (TR M ) and process model (TP M ).
Reference Model : Process Model : TP M = TF M × TF BO 2 As far as patient conditions are concerned, the requirement for oxygen concentration varies from patient to patient, from mild to severe. The SpO 2 reading in the oximeter varies depending on the severity of the infection of the respiratory tract, and the reading in severe respiratory distress patients falls below 90%. In this context, to show the effectiveness of the proposed controller, two set points (90% and 95%) are pondered in this study.
The open-loop step excitation response for both the normal respiratory model and the infected respiratory model is investigated in Figure 13. It is realized that in the case of the developed model, the response never reached the desired level without any control action.
in severe respiratory distress patients falls below 90%. In this context, to show the effectiveness of the proposed controller, two set points (90% and 95%) are pondered in this study.
The open-loop step excitation response for both the normal respiratory model and the infected respiratory model is investigated in Figure 13. It is realized that in the case of the developed model, the response never reached the desired level without any control action. Figure 13. Comparative study of healthy and infected patient with step input at 95%.
The choice of a proper time constant for a process is a difficult task. A comparative study of the different time constants in terms of the RC value of the oxygen cylinder model is highlighted in Figure 14. The study reveals that at a time constant value of 0.50 s, the developed respiratory model performs better compared to other values. Moreover, the performance of MRAC with different adaptive gains (γ1) is investigated in the developed model. The adaptive gain in MRAC and its consequent effects are observed in Figure 15.  Moreover, the performance of MRAC with different adaptive gains (γ 1 ) is investigated in the developed model. The adaptive gain in MRAC and its consequent effects are observed in Figure 15.
A change in adaptation gain in MRAC makes the system highly oscillatory; as a result, it fails to reach the desired value quickly, which could be lethal for respiratory distress patients. Sometimes an excess supply of oxygen may create an unhealthy situation. The exact adjustment of adaptation gain in MRAC is a crucial problem, whereas in the SFPIMRAC, there is no need for any human intervention to control the oxygen concentration properly for the respiratory distress patient. The responses for conventional PID, MRAC, and SFPIMRAC are compared. The analysis of Figure 16 (set point 95% SpO 2 ) and Figure 16a (set point 90% SpO 2 ) reveals that the proposed SFPIMRAC is far more suitable than MRAC and conventional PID in severe respiratory distress patients . The variations in oximeter readings (% SpO 2 ) did not impact the proposed controller performance divulged in Figures 16 and 17. The model's performance with variations in the set point (oximeter reading) and time delay are also depicted in Figures 18 and 19. A PID controller is not suggested here, as over-concentration of oxygen can be lethal to patients considered here.
The SFPIMRAC response is better than the MRAC response in terms of faster response, low settling time, and no overshoot, which is the most desirable condition in respiratory distress treatment. Moreover, the performance of MRAC with different adaptive gains (γ1) is investigated in the developed model. The adaptive gain in MRAC and its consequent effects are observed in Figure 15. A change in adaptation gain in MRAC makes the system highly oscillatory; as a result, it fails to reach the desired value quickly, which could be lethal for respiratory distress patients. Sometimes an excess supply of oxygen may create an unhealthy situation. The exact adjustment of adaptation gain in MRAC is a crucial problem, whereas in the SFPIMRAC, there is no need for any human intervention to control the oxygen concentration properly for the respiratory distress patient. The responses for conventional PID, MRAC, and SFPIMRAC are compared. The analysis of Figure 16 (set point 95% SpO2) and Figure 16a (set point 90% SpO2) reveals that the proposed SFPIMRAC is far more suitable than MRAC and conventional PID in severe respiratory distress patients. The variations in oximeter readings (% SpO2) did not impact the proposed controller performance divulged in Figures 16 and 17. The model's performance with variations in the set point (oximeter reading) and time delay are also depicted in Figures18 and 19. A PID controller is not suggested here, as over-concentration of oxygen can be lethal to patients considered here. The SFPIMRAC response is better than the MRAC response in terms of faster   The parameters of the human respiratory system model may change depending on the types of obstructive and restrictive lung diseases. The effectiveness of the proposed controller is tested with model parameter variations successfully with minimum devia-

SFPIMRAC Response with Time Delay at Input and Set-Point/Load Variations
The effects of time delay and set-point/load variations at the input of the process (respiratory model of a severe patient, TPM) are observed in Figure 19 and Figure 20 , respectively.  Figure 19 revealed that a time delay in patients' treatment is not a good idea, though the proposed controller streamlines the flow within a few seconds. During treatment, if the SpO2 level falls below the desired value (suppose 95% to 80% for 20 s, as shown in Figure 20) for any unwanted reason, the proposed controller can deliver the required oxygen again immediately without any human intervention, even with the presence of a time delay. Figure 21 depicts the proposed controller being tested with the concept of time delay (delay due to gas exchange in infected alveolar conditions) in between primary and secondary respiratory models. The typical time delay for human respiratory gas exchange is 0.75 s at rest (transport delay of 0.30 s for inspiration and 0.45 s for expiration), and during exercise, this value comes down to 0.25 s [10]. Given this different time delay in dif-

SFPIMRAC Response with Time Delay at Input and Set-Point/Load Variations
The effects of time delay and set-point/load variations at the input of the process (respiratory model of a severe patient, TPM) are observed in Figure 19 and Figure 20 , respectively.  Figure 19 revealed that a time delay in patients' treatment is not a good idea, though the proposed controller streamlines the flow within a few seconds. During treatment, if the SpO2 level falls below the desired value (suppose 95% to 80% for 20 s, as shown in Figure 20) for any unwanted reason, the proposed controller can deliver the required oxygen again immediately without any human intervention, even with the presence of a time delay. Figure 21 depicts the proposed controller being tested with the concept of time delay (delay due to gas exchange in infected alveolar conditions) in between primary and secondary respiratory models. The typical time delay for human respiratory gas exchange is 0.75 s at rest (transport delay of 0.30 s for inspiration and 0.45 s for expiration), and during exercise, this value comes down to 0.25 s [10]. Given this different time delay in dif- The parameters of the human respiratory system model may change depending on the types of obstructive and restrictive lung diseases. The effectiveness of the proposed controller is tested with model parameter variations successfully with minimum deviations in responses. The original gas exchange model (TF BO2 ) is expressed in Equation (15):

SFPIMRAC Response with Atime Delay between Two Models and Set-Point/Load Variation
The responses of three different models (model1, model2, and model3) are shown with slight parameter variations in Equation (15), as observed in Figure 18 for a reference value of 95%SpO 2 . The convincingness of the proposed controller is further established even with human respiratory model parameter variations in Figure 18.

SFPIMRAC Response with Time Delay at Input and Set-Point/Load Variations
The effects of time delay and set-point/load variations at the input of the process (respiratory model of a severe patient, TP M ) are observed in Figures 19 and 20 Figure 22.    Figure 19 revealed that a time delay in patients' treatment is not a good idea, though the proposed controller streamlines the flow within a few seconds. During treatment, if the SpO 2 level falls below the desired value (suppose 95% to 80% for 20 s, as shown in Figure 20) for any unwanted reason, the proposed controller can deliver the required oxygen again immediately without any human intervention, even with the presence of a time delay. Figure 21 depicts the proposed controller being tested with the concept of time delay (delay due to gas exchange in infected alveolar conditions) in between primary and secondary respiratory models. The typical time delay for human respiratory gas exchange is 0.75 s at rest (transport delay of 0.30 s for inspiration and 0.45 s for expiration), and during exercise, this value comes down to 0.25 s [10]. Given this different time delay in different conditions, the proposed controller is tested with 0.30 s, 0.50 s, and 0.70 s intermediate time delays. The proposed SFPIMRAC can counteract the gas exchange time variations and even load/set-point variation, as successfully shown in Figure 22.       [29].

SFPIMRAC Response with Atime Delay between Two Models and Set-Point/Load Variation
The control of load pendulation in an overhead crane is a very difficult task. The control strategy for the swing angle control of the overhead crane is implemented and shown in Figure 23 [29]. A comparative study of the set-point modulated fuzzy PD-based model reference adaptive controller (SFMRAC) with the other controllers for the overhead crane model to control swing angle is illustrated in Figure 24 [29].  [29].
The control of load pendulation in an overhead crane is a very difficult task. The control strategy for the swing angle control of the overhead crane is implemented and shown in Figure 23 [29]. A comparative study of the set-point modulated fuzzy PD-based model reference adaptive controller (SFMRAC) with the other controllers for the overhead crane model to control swing angle is illustrated in Figure 24 [29].

Conclusions
An integrated mathematical model of the human respiratory system is presented in this paper for the treatment of a critical patient suffering from respiratory distress. The consideration of inherent time delays caused by the gas exchange between alveolar air space, lung tissue, and capillary blood cells added a new dimension to this study. The efficacy of the mathematical model is verified with model parameter variations, set point changes, inserting different time delays, and stability analysis. The whole study was performed in a MATLAB Simulink environment, and we performed a spirometry test in

Conclusions
An integrated mathematical model of the human respiratory system is presented in this paper for the treatment of a critical patient suffering from respiratory distress. The consideration of inherent time delays caused by the gas exchange between alveolar air space, lung tissue, and capillary blood cells added a new dimension to this study. The efficacy of the mathematical model is verified with model parameter variations, set point changes, inserting different time delays, and stability analysis. The whole study was performed in a MATLAB Simulink environment, and we performed a spirometry test in the laboratory for future studies. The human respiratory system itself exhibits the properties of regulatory control. However, this inherent regulation of the respiratory system sometimes fails due to the attack of various viruses. One of the most popular treatments for patients with lung infections is oxygen support. In this paper, for the proper regulation of external oxygen, a new control strategy is proposed based on the model reference adaptive controller. However, the effective control by MRAC purely depends on the adjustment of the adaptive gain factor. To remove this inherent problem of gain adjustment, a fuzzy knowledge-based system is initiated for the dynamic change of adaptive gain that varies with variations of respiratory system parameters. Two useful concepts are combined to improve controller design: one is a fuzzy-based MRAC scheme, and the other is a dynamic variation of the set-point that is used to automatically track variations in the process parameter. The proposed controller, SFPIMRAC, is tested on different respiratory conditions effectively, and its performance is judged with various time delays and also with load changes. All these advantages of the proposed controller make it suitable for the supplement of oxygen to respiratory distress patients suffering from acute breathing problems. In this context, it is very difficult to conclude about the effectiveness of oxygen therapy and control, but surely it can be used as a supportive treatment. Although respiratory distress of the respiratory system appears to be a complex disease, this research provides some promising avenues for future research.
Author Contributions: All authors have equally contributed in terms of conceptualization, methodology, software, validation, formal analysis, resource, writing and reviewing, and visualization. All authors have read and agreed to the published version of the manuscript.