Introduction

Mechanical Ventilation is the process used to provide breathing support to patients with difficulty in natural breathing. It is primarily used in the Intensive Care Unit (ICU) to mimic the natural breathing purposes for the patients. It regulates air and gas flow, pressure, and volume to a patient’s lungs. The main aim of mechanical ventilation is to control the oxygen delivery and remove carbon dioxide. The process should be done with care because minute mistakes can lead to the serious event for the patient and will be fatal. For instance, the operation of the ventilator can be risky for the handler during the case of pandemic COVID 19. The paper focuses on the design and the control of the economical ventilator based on the inputs from the clinicians. The simulation of the model designed and the works are validated for the proposed design. The results show promising fallouts in the application of the ventilator-designed compared to the models in the previous studies1. The paper2 proposes the strategies for the mechanical ventilation in COPD and bronchial asthma based on the review. It discusses the influence of overcoming expiratory flow limitation in COPD patients and also the inspiratory muscle fatigue development. The non-invasive positive-pressure ventilation is used as the first line treatment and invasive treatment can be used in the severe conditions. The paper mentions the goals of improving the mechanical ventilation by improving gas exchange in the pulmonary circulation and resting of the compromised respiratory muscle. In another work3 two step model is used with the first step comprising of deployment of Machine Learning algorithm on a non-COVID-19 MIMIC-III database and the second step is the application of the transfer leaning to enhance and adapt the model to small COVID-19 cohort. XGBoost algorithm was trained on the dataset and yields AUC of 83% and 91% in ICU and COVID-19 patients.

The paper gives the computational model to simulate the interaction between the human lung and the mechanical ventilator. The model mimics the hardware and the software design of the actual ventilator4. This paper uses the data that are collected from patients with mechanical ventilation admitted to a hospital in Taiwan. Three machine learning model such as logistic regression, random forest, support vector machine are deployed and random forest has the best algorithmic performance with accuracy of 94% and AUC of 0.9765. This paper developed a prototype to operate in regulated volume-controlled mode with parameters such as tidal volume, respiratory rate, Positive End Expiratory Pressure (PEEP), I:E ratio and FiO2. The accuracy and the precision are within the range of the International Standard6. The two different cohorts such as COVID-19 and hospitalized patients are used for the prediction of mechanical ventilation performance and in-hospital mortality. XGBoost algorithm is deployed and the prediction for the mechanical ventilation shows the highest accuracy of 86.2%7. The paper focuses on use of ventilators for COPD and Acute Respiratory Distress Syndrome (ARDS). It also features the notable aspects of recognizing factors that diminish the workload and increase the work of breathing in COPD patients. It also discusses the pros and cons of using higher positive end-expiratory pressure in ARDS patients8. This paper an inverse mapping of artificial neural networks for predicting mechanical ventilation for lung health using the Graded Particle Swarm optimizer is incorporated. The machine learning model predicts the values that are close to the target value9. The paper used a One-Dimensional Convolutional Neural Network (1D CNN) to predict weak inspiratory efforts. The CNN is trained using a threshold of 50 cmH2O*s/min to visualize the weak events. The model shows a sensitivity of 88%, and specificity of 72%10. The paper provides the modeling approach for simulating mechanical ventilators for Intensive Care Units (ICUs) which allows accurate prediction of fundamental parameters. The predicted values for parameters are consistent with the values specified by the guidelines11. The paper aimed to design a portable controlled mechanical ventilator with the feature of bioinspired mechanism with finger like actuator and flow-rate based control. The performance gives accurate airflow provision, and the experiments presented were compared with performance of alternative sytems. The system also had a tracking error and no significant fluctuation in flow rate were reflected12. The paper proposes to simulate pressure and volume-controlled mechanical ventilation modes for severe acute respiratory failure patients in ICUs. The simulation results of both modes are compared with the previous studies in terms of pressure, tidal volume, inspired and expired flow. The prediction has a percentage error of less than 10 in most of the comparisons13. The paper used seven different machine learning models such as Decision Tree, XGBoost, Neural network, k-Nearest Neighbors, Support Vector Machine, Random Forest, Extreme Gradient Boosting to build the cohorts. XGBoosts has the Root Mean Square Error of 5.57 which shows the best performance than other algorithms14. Recurrent Neural Network is used to predict the mechanically ventilated patients based on the standard parameters for the VENTILA dataset. The model shows higher performance with Area Under the Receiver Operating Characteristic curve of 0.72 and average precision of 0.5715. Two different ventilator concepts are proposed, such that the ventilator can be operated in case of a pressurized air-oxygen mixtures availability and wise versa. In this work the Simulation of the process was carried out with the help of MATLAB (Simulink) environment to observe results and prevent risks. The results show different responses for different support modes proposed and the Alarm System is to declare any issues. An adaptive control algorithm to cope with parameter variation and non-linearity is also handled. Automatic system identification for fault detection and maintenance is verified. The display is in form of compatible screen with the mechanism to get a graphical response for the output. The overall scheme of the mechanical ventilator is depicted in Fig. 1.

Fig. 1
figure 1

Depiction of the Mechanical Ventilator.

Results and discussion

The three parameters are considered for the variation of the ventilator for the normal and the abnormal conditions. In order to ventilate a patient, all care parameters and specifics such as tidal volume (VT), the respiratory rate, and inspiration-to-expiration (I: E) ratio should be defined and controlled well since they are the re-epithelialization parameters that help in lung-ventilator interface management while minimizing lung micromorphological alteration particularly in mechanically ventilated critically ill patients16. Tidal Volume (VT): VT gives the mean amount of air that the lung carries on each of its ebbs and flows. Respiratory Frequency: The rate of respiration must change to maintain a minute volume and CO2 levels. If the rate of respiration is higher than normal it can cause problems like intrinsic PEEP. I: E Ratio:- Now taking a closer look at the I: E ratio it’s obvious that its purpose is to balance the time to inhale and the time to exhale. There’s a claim that if the ratio is well set, there will be adequate ventilation and no intrinsic PEEP. Appropriate recommendations in the management of the patient on artificial mechanical ventilation are focused in this case on strategies aiming at optimization of VT, respiratory rate and I: E ratio as major factors with all other mechanical parameters and outputs as target control mechanisms in a strategy. Table 1 depicts the control parameters values for Normal, COPD and the Pneumonia these parameters are crucial for determining ventilator performance. The effects of respiratory force and elasticity are implicitly accounted for via compliance and resistance terms in the model17. The data in Table 1 is concordant with clinically acceptable measurements related to normal condition, COPD as well as pneumonia.

Table 1 Control parameters for normal and abnormal conditions.
Fig. 2
figure 2

Mechanical ventilator system with transfer function for normal condition.

The Transfer function in Fig. 2 is the normal response expected for the normal individuals. To add on these transfer functions (Eqs. 510) are allocated for the COPD and pneumonia conditions to cater for the structural and physiological changes which occur with the conditions.

$$\:\text{T}\text{r}\text{a}\text{n}\text{s}\text{f}\text{e}\text{r}\:\text{f}\text{u}\text{n}\text{c}\text{t}\text{i}\text{o}\text{n}\:\text{Y}\left(\text{s}\right)=\frac{G\left(s\right)}{1+\left(\text{G}\left(\text{s}\right)\right)\left(\text{H}\left(\text{s}\right)\right)}$$
(1)

The transfer function for the normal state is given by

$$\:\text{V}\text{o}\text{l}\text{u}\text{m}\text{e}\text{t}\text{r}\text{i}\text{c}\:\text{F}\text{l}\text{o}\text{w}\:\text{r}\text{a}\text{t}\text{e}\:\text{H}\left(\text{s}\right)=\left[\left(0.5\right)\left(\frac{1}{0.1\text{s}+1}\right)\right]$$
(2)
$$\:\text{M}\text{a}\text{x}\:\text{V}\text{a}\text{l}\text{v}\text{e}\:\text{A}\text{r}\text{e}\text{a}\:\text{G}\left(\text{s}\right)=\frac{7.854\text{*}{10}^{-5}}{0.2\text{s}+1}$$
(3)
$$\:\text{T}\text{r}\text{a}\text{n}\text{s}\text{f}\text{e}\text{r}\:\text{f}\text{u}\text{n}\text{c}\text{t}\text{i}\text{o}\text{n}\:\text{Y}\left(\text{s}\right)=\frac{0.00007854(0.1{s}^{2}+s)}{(0.2\text{s}+1)+\left(0.1{\text{s}}^{2}+\text{s}\right)\left(0.00003927(1-{e}^{-\text{s}})\right)}$$
(4)

The transfer function for the COPD state is given by

$$\:\text{V}\text{o}\text{l}\text{u}\text{m}\text{e}\text{t}\text{r}\text{i}\text{c}\:\text{F}\text{l}\text{o}\text{w}\:\text{r}\text{a}\text{t}\text{e}\:\text{H}\left(\text{s}\right)=\left[\left(1.1431\right)\left(\frac{1}{0.1\text{s}+1}\right)\right]$$
(5)
$$\:\text{M}\text{a}\text{x}\:\text{V}\text{a}\text{l}\text{v}\text{e}\:\text{A}\text{r}\text{e}\text{a}\:\text{G}\left(\text{s}\right)=\frac{7.854\text{*}{10}^{-5}}{0.2\text{s}+1}$$
(6)
$$\:\text{T}\text{r}\text{a}\text{n}\text{s}\text{f}\text{e}\text{r}\:\text{f}\text{u}\text{n}\text{c}\text{t}\text{i}\text{o}\text{n}\:\text{Y}\left(\text{s}\right)=\frac{0.00007854(0.1{s}^{2}+s)}{0.02{\text{s}}^{3}+\left(0.3{\text{s}}^{2}+\text{s}\right)\left(0.00008977(1-{e}^{-\text{s}})\right)}$$
(7)

The transfer function for the pneumonia state is given by

$$\:\text{V}\text{o}\text{l}\text{u}\text{m}\text{e}\text{t}\text{r}\text{i}\text{c}\:\text{F}\text{l}\text{o}\text{w}\:\text{r}\text{a}\text{t}\text{e}\:\text{H}\left(\text{s}\right)=\left[\left(0.46652\right)\left(\frac{1}{0.1\text{s}+1}\right)\right]$$
(8)
$$\:\text{M}\text{a}\text{x}\:\text{V}\text{a}\text{l}\text{v}\text{e}\:\text{A}\text{r}\text{e}\text{a}\:\text{G}\left(\text{s}\right)=\frac{7.854\text{*}{10}^{-5}}{0.2\text{s}+1}$$
(9)
$$\:\text{T}\text{r}\text{a}\text{n}\text{s}\text{f}\text{e}\text{r}\:\text{f}\text{u}\text{n}\text{c}\text{t}\text{i}\text{o}\text{n}\:\text{Y}\left(\text{s}\right)=\frac{0.00007854(0.1{s}^{2}+s)}{0.02{\text{s}}^{3}+\left(0.3{\text{s}}^{2}+\text{s}\right)\left(0.00003663(1-{e}^{-\text{s}})\right)}$$
(10)
Fig. 3
figure 3

Pole-Zero map for the transfer function.

The Pole-Zero map for the above transfer function of the system shown in the Fig. 3. Y(S) is depicted in the above Fig. 3. Two poles and a zero lies in the left half of the plane and one pole and zero lies on the axis so the mechanical system is marginally stable. The unit ‘seconds-1’ indicates the inverse of time and is considered a unit for frequency in this design.

Fig. 4
figure 4

Plot of Flow, Volume, Pressure in ventilator.

The Tidal volume influences the flow rate and volume exchanged during each breath which is shown in the Fig. 4. The respiratory rate affects the frequency of breaths during shorter inspiratory and expiratory times. Higher respiratory rates can lead to an increase in the flow rates, while lower respiratory rates provide longer expiratory times. The I: E ratio influences the distribution of ventilation and the balance between inspiration and expiration. Higher I: E ratios provide longer inspiratory times, which affects flow, pressure, and mean airway pressure.

The temperature and the humidity levels are controlled by separate components and settings which are shown in Fig. 5. It includes humidifier and temperature control unit. These blocks are responsible for adjusting and maintaining appropriate levels of humidity and temperature in the inspired air. The settings for temperature and humidity are typically less dependent on the tidal volume, respiratory rate, Inspiration to Expiration ratio.

The temperature and the pressure of the check valve are controlled and maintained through specific design characteristics and settings within the ventilator system and are shown in the Fig. 6. The airflow rate mostly depends on temperature and humidity. For example, the airflow rates supplied by the ventilator may be affected by dense air which is a result of high humidity. This is important to take into consideration when the ventilator parameters are being set and the efficiency of ventilation and gas exchange might be altered. Patients on MV ventilation rely on air with set temperature and humidity so that the prescribed three or more ventilatory flow rates are achieved and at the same time complications can be prevented during the intervention of cold or dry air16. It ensures the proper direction of airflow and prevents the backflow of gases. It also keeps maintaining the integrity and functionality of the system. The settings for temperature and pressure regulation within the ventilator system are usually less dependent on the parameters.

Fig. 5
figure 5

Temperature & Humidity in ventilator tubes.

Fig. 6
figure 6

Pressure & Temperature in Check Valve 1.

The tidal volume indirectly affects the pressure by influencing the flow of gases. Respiratory rate inturn affects the pressure by determining the frequency of breaths and the time spent in inspiration and expiration which is depicted in Fig. 7. The I: E ratio therefore influences the pressure by affecting the balance between inspiration and expiration.

Fig. 7
figure 7

Pressure to area in check valve 2.

Fig. 8
figure 8

Area & volume per unit time in Control signal.

Alternatively the tidal volume directly affects the volume of air exchanged with each breath. The control signal needs to be adjusted to deliver the desired tidal volume which is depicted in Fig. 8. Increasing the respiratory rate will result in more breaths being delivered per minute. The control system of the ventilator calculates and adjusts the control signal to achieve the desired I: E ratio of inspiration and expiration.

Higher tidal volumes may result in increased gas flow through the humidifier, potentially requiring modifications to ensure adequate humidification. Higher respiratory rates may require increased water vapor output from the humidifier to maintain optimal humidity levels as shown in Fig. 9. They can indirectly impact the humidifier’s operation by affecting the gas flow and humidity requirements.

Fig. 9
figure 9

Approximation Evaporation Formula in Humidifier.

Fig. 10
figure 10

Volumetric flow rate of sensor.

Fig. 11
figure 11

Translational motion sensor of Volume Data.

The tidal volume, respiratory rate, and inspiration to expiration ratio can influence the volumetric flow rate measurement which can be visualized from Fig. 10. The volume of air exchanged with each breath, the frequency of breaths, and the timing of inspiration and expiration affect the changes in volume over time, which are used to calculate the volumetric flow rate. The ideal translational motion sensor is primarily responsible for measuring the pressure and volume of the gas flow within the ventilator circuit shown on Fig. 11. It detects the changes in pressure and volume to provide feedback and control the ventilation process. Subsequently they do not directly impact the measurements taken by the sensor.

Fig. 12
figure 12

Temperature & Power of Lung Heat transfer.

Altering the parameters requires more energy for the ventilator to deliver the larger volume of air, to work at a faster pace potentially increasing the power consumption of the system which is depicted in Fig. 12. Ventilating with higher tidal volumes may disrupt natural heat exchange mechanisms. Increased respiratory rate may lead to reduced time for heat exchange, it may affect the heat exchange dynamics within the lungs potentially leading to a deviation in the temperature of lung heat transfer. The architectural of Neural Network is shown in Fig. 13 and corresponding algorithm flow is given in Fig. 14. The hyperparameters for the designed low intricate mechanical ventilator confines itself with the volume, pressure and flow data present in the check valve 1 and 2.

Fig. 13
figure 13

Architectural diagram of neural network.

These parameters are tunned with the help of neural networks which is in feed-forward template. The feed-forward neural network is fit for the hidden layers of 20 and the optimal performance is checked for the classification of COPD, pneumonia and normal conditions.

Fig. 14
figure 14

Algorithm of neural network.

Fig. 15
figure 15

Performance of Neural Networks.

Fig. 16
figure 16

Training and testing plot of the Neural Networks.

The training state plot, performance metrics, error histogram and the regression plot are shown below in Figs. 15 and 16. The classification by FFNN is compared and contrast with CNN model. The testing accuracy of FFNN is 84% and the error loss is comparatively low for different ranges of epochs despite of the fact that CNN model training provides an accuracy approaching 99.99% the model becomes a overfit design. A overfit CNN model will be an non appreciated design in clinical sectors and is non adaptable to the nonlinear changes incurred by the patients.

Conclusion

The proposed work concerns the design, simulation, and development of a mechanical ventilator to ventilate the patients suffering from any normal and abnormal lung conditions like chronic obstructive pulmonary disease (COPD), pneumonia. The specific ventilator is designed to optimise key ventilatory parameters namely tidal volume, respiratory rate, and inspiratory to expiratory i.e. I: E ratio which are crucial in assuring smooth and efficient mechanisms of ventilation. The use of control parameter validation offer a comprehensive and practical approach in modeling various ventilatory conditions to enhance ventilation precision and control ventilatory pressure. This proposed ventilator is coupled with a feed forward neural network (FFNN), which enhances system performance by suggesting and modifying control parameters which offers personalized patient care. The training and testing of FFNN demonstrated is efficient thereby, providing optimal level of ventilation while stabilizing the patient. These simulated circumstances indicate that by employing these machine learning techniques, the system has a great chance to change the performance of ventilators by enhancing the degree of control during the interventions. The simulated test results affirms that the ventilator can control the airflow, pressure, temperature, and humidity in acceptable volumes. Furthermore, the model can be adjusted to lung compliance and airway resistance, therefore increasing it span of applications to wider range of respiratory complications. Further the work can be extended by incorporating instantaneous respiratory force and lung elasticity as an intrinsic component during changes in lung compliance and resistance. The optimal parameters results in design of ventilator system that is easy to use during different degrees of respiratory support at a very minimal cost. Its innovative, practical, and effective features suggest that it could be a useful tool in intensive care.

Simulink model

The Simulink model18 act as a bridge between the mechanical ventilator and the lung compliance which is shown in Fig. 17. Resistances (R) and compliances (C) define specific lung functions and the siting mechanics of each within the Canadian ventilator-lung system.– appreciate that R and C will be strategically located within the system. It mimics the natural activity of the lung and hence builds the ventilator according to the need of the patient. The mechanical ventilator consists of mask with the three ports and has the chamber volume of 2e-4 m3, cross-sectional area of 0. 01m2.The block parameters of trachea depends on the pipe length, hydraulic diameter and the cross-sectional area. 2e-4 m3 specifies chamber volume, used as the volume components dervived from the relations of the block parameters to the volumetric flow rates and gas exchanges. The lung subsystem parameters rely on the mechanical orientation, interface displacement, dead volume, and the cross-sectional area. The volumetric supply is determined by the pressure, temperature, humidity, and cross-sectional area. The inspiratory and expiratory tube depends on the pipe length, diameter, and cross-sectional area. The expiratory valve relies on the minimum and maximum restriction area, laminar flow pressure, discharge coefficient. The check valve consists of pressure & temperature sensor, where pressure is exponential decreasing and the area is an exponential increasing curves. The delay is prevalent and depends on the time constant, and initial output. The valve which controls the flow of the ventilator relies on the laminar pressure flow, cross-sectional area and minimum and maximum restriction area. The control signal consists of the pulse generator which depends on the pulse width and period. The period of the pulse generator depends on the respiratory rate and the pulse width depends on the Inspiration to Expiration ratio. Humidifier depends on the temperature, water surface area, air volume. The humidifier consists of Volumetric Flow Rate sensors that cascades with the Moist Air Volume which rely on the chamber volume, condensation time, cross-sectional area.

Fig. 17
figure 17

Simulink model of the Mechanical Ventilator.

The output of the moist air passes through the water heat transfer chamber and is connected with the controlled moisture source through the Approximation Evaporation formula to the humidity & trace gas sensor. Approximation Evaporation Formula consists of four inputs that passes through the flow area, empirical factor and water surface area. The system consists of the humidity & trace sensor cascaded with the volumetric flow sensor and the pressure & temperature sensor is also cascaded. It gives two output - the volume and pressure of the lung. This subsystem provides lung volume and comprises of Ideal Translational Motion Sensor.