The Automatic Oxygen Saturation Control System by Adaptive Learning Controller for COVID-19 Patients

This paper proposes an adaptive learning control and monitoring of oxygen for patients with breathing complexities and respiratory diseases. By recording the oxygen saturation levels in real-time, this system uses an adaptive learning controller (ALC) to vary the oxygen delivered to the patient and maintains it in an optimum range. In the presented approach, the PID controller gain is tuned with the learning technique to provide improved response time and a proactive approach to oxygen control for the patient. A case study is performed by monitoring the time varying health vitals across different age groups to gain a better understanding of the relationship between these parameters for COVID-19 patients. This information is then used to improve the standard of care provided to patients and reducing the time to recovery. Results show that ALC controls the oxygen saturation within the target range of 90% to 94% SpO2, 77% and 80.1% of the time in patients of age groups 40-50 years old and 50-60 years old, respectively. It also had faster time to recovery to target SpO2 range when the concentration dropped rapidly or when the patient becomes hypoxic as compared to the manual control of the oxygen saturation by the healthcare staff.


Introduction
T he start of the year 2020 introduced the globe to an unprecedented time of biological turmoil, the likes of which has not been seen since the black plague. SARS-COV-2 is a strain of virus that once infects a patient and results in the disease known as COVID- 19 [1]. COVID-19 was declared as a pandemic by the World Health Organization (WHO) on 11th March 2020 [2]. As of November 2020, around 54 million people have been infected by this virus in the world, out of which 1.3 million people have died [3]. Meanwhile, roughly 350,000 people have been infected in Pakistan, amongst which about 7,000 have died [4].
The reason why COVID-19 is considered so threatening is because currently there are no available vaccines that can provide protection against the strain of virus that causes this disease. It is also highly infectious and affects the lungs, thereby causing acute respiratory failure. Once a person is infected, they experience various symptoms amongst which the prominent ones are loss of taste, high sustained fever, and difficulty to breath. However, out of these symptoms, the shortness of breath is the most problematic as it can lead to the patient experiencing acute hypoxemic respiratory failure or chronic respiratory failure. Due to the lack of antibody vaccines and such deadly symptoms, National Institute of Health (NIH), World Health Organization (WHO) and Centre for Disease Control (CDC) have outlined supportive care guidelines where healthcare providers are required to observe the patient under isolation and provide necessary care to relieve the symptoms as much as possible through pain medication, rest and adequate food supplement.
By monitoring a patient's health vitals such as oxygen saturation (SpO2), body temperature, pulse rate and blood pressure, health care facilities may be able to determine the progress of a patient's recovery. Body temperature is noted to observe the state of fever, while pulse rate and blood pressure are monitored to ensure that the patient is not having trouble in breathing. Lastly, SpO2 is necessary to monitor to ensure that the patient does not become hypoxemic and that the lungs are functioning properly [17]. Oxygen saturation (SpO2) represents the amount of oxygen in blood. The body needs an explicit amount of oxygen in blood to function properly. Oxygen consumption within the body is equal to venous oxygen subtracted from arterial oxygen and multiplied by blood flow. The oxygen-haemoglobin dissociation is a function of the partial pressure of oxygen (PO2). Haemoglobin will be 100% saturated with oxygen if PO2 =100 mmHg. Each gram of haemoglobin is capable of carrying 1.34 mL of oxygen. The solubility coefficient of oxygen in plasma is 0.003. This coefficient represents the volume of oxygen in mL that will dissolve in 100 mL of plasma for each 1 mmHg increment in the PO2, i.e., oxygen content = (0.003 × PO2) + (1.34 × haemoglobin × oxygen saturation) [10].
Currently, health care providers monitor SpO2 and control the supply of oxygen to critical care patients by manually adjusting the supply of oxygen from the cylinder or source [18] [19]. This is not only inefficient, but is also risky, prone to error and in cases of a high number of patients can lead to overloading of the staff and healthcare system. Therefore, to reduce the burden on the healthcare system and facilitate quicker recovery, we propose a system which utilizes an adaptive learning controller that monitors and change the oxygen saturation for patients hospitalised with COVID-19.
Automated systems have been previously shown to have better outcomes on patients as compared to manually controlled systems. This was demonstrated by Joosten et. al. [5] by proving that when a post-surgery patient's anaesthesia is automatically controlled, he not only recovers quicker, but also has fewer postsurgery complications as compared to manual anaesthesia delivery control. In addition, the benefits of the use of automated systems to continuously monitor health vitals of recovering patients was discussed in [6] in which the authors demonstrated that wearable technology can improve the quality of supportive care through continuous monitoring of vitals. These vitals can then be reported to health professionals who will have a more detailed history of their patient resulting in a well-defined and succinct care plan. Furthermore, Kaushal et. al. [5] highlighted the benefits of using automated technology for healthcare in their study. They analysed the impact of information technology and automation on the full spectrum of healthcare delivery -from diagnosis to post-operative care and concluded that IT integration into healthcare systems not only reduces complications, but also reduces the burden on the healthcare staff. Similarly, James et. al. [9] showed that through automation intervention, medical staff's workload can be drastically reduced, resulting in fewer errors and improved work-life balance [8] [9].
In this paper, we adopt the same approach as the previously mentioned works and conduct a study regarding the efficacy of automated oxygen monitoring and saturation-control for COVID-19 patients. An adaptive learning control system is utilized to monitor and control the vital signs, i.e., SpO2, pulse rate and temperature of COVID-19 patients requiring critical care. In such scenarios where patients' condition is rapidly changing in response to the medical treatment or ventilation supportive care, it is risky as well as time consuming for hospital staff to continuously monitor their progress. Moreover, a rapid increase in COVID-19 cases is also leading to overloading the systems and staff leading to a reduction in the quality of supportive care. An adaptive control model could make the monitoring of vital signs more efficient and accurate for staff, while also keeping in consideration the SOPs for COVID-19. This approach could ultimately improve the recovery time of patients, thereby reducing the load on hospitals.

Methodology
The approach to the proposed methodology is twofold: i) to develop a robust control system, and (ii) integrate it with health vitals. This requirs that the adaptive learning controller not only has accurate and reliable control, but it must also be able to intake continuous variable oxygen data and appropriately adjust the output in real-time. Since the controller is responsible for adjusting a sensitive parameter that has a direct impact on the patient's health, it must have the capability for minute adjustments while also being able to learn the oxygen variation to minimize errors. The following sections explain how the controller is developed and combined to monitor and adjust oxygen in real-time.

Adaptive Learning Controller
To achieve the precise results, input must control the optimized values of PID controller's gain. Noise disturbances influence that are not modelled make it complex to maintain the PID control gains at optimal values throughout. It may turn into a serious issue to sustain the quality of controller. To solve this issue, an adaptive learning PID controller is proposed that enhances the controller performance and improve accuracy by its memory feature. (2) Applying Equation 1 in the initial trial shows that the control input is similar as in the PID controller. In the second trial of actual system, responses are not according to the system output values, hence error is integrated with the second input of the system. This is the change analysed between output values. The proposed adaptive learning controller generates control input in this manner just after the second trial. Therefore, the suggested learning control system can be expressed by, This can be clearly seen in Figure 1. Having learning operation based on the previous states, it is expected to achieve the enhanced control results due to the learning based control technique.

ALC Using Recursive Least Square (RLS) Algorithm
The adaptation mechanism is as follows. After the detection of some error between standard and measured SpO2, the controller response decays the transient period. PID controller parameter vector to be tuned in the controller is [θ = K p+ K i+ K d ] given in Equation 1. In Equation 4, y k is the closed-loop response under the controller parameters, and y d is the actual time response of the controlled system. Based on the RLS algorithms, we tune the parameter θ which is the PID gain value, so that the performance index J is minimized as given in Equation 5.
Where N is the number of time-response samples. RLS is an algorithm which recursively finds the optimal estimate k of the controller parameter by using k − 1.

Oxygen Control and Deliverance
Oxygen saturation (SpO2) is monitored via an oximeter designed to take reading with a sampling rate of 500 Hz (reading taken every 2 ms). The oximeter utilizes an IR LED and a photodiode that calculates the difference between the actual concentration and the desired oxygen saturation levels. These decisions are based on the information shown in Table 1. Below an SpO2 of 85%, the patient is hypoxic and requires immediate attention from the healthcare staff. For this reason, the controller is tasked to sound an alarm, call emergency, and maximize the oxygen output to the patient to ensure that the lungs are getting enough oxygen. Between 85% and 90% oxygen saturation levels, the patient is considered to be on the cusp of critical attention which is why an attendant is required to be on-site while the controller maintains maximum oxygen output. Once the SpO2 levels have reached 90% to 94%, the oxygen is said to have been in a safe range where conservative oxygenation shall be employed. In this case, oxygen delivery shall be gradually reduced such that the SpO2 level is maintained at 94% or greater than 94% which is the target [11]. Figure 2 represents the overall integration of the adaptive learning controller with the oxygen deliverance and monitoring system. Upon receiving a reading from the input sensor (oximeter) from the patient, the controller calculates an error value E. This error is determined by comparing the patient's SpO2 levels with the standard required (minimum of 94% oxygen saturation) in a normal patient. Then, on the basis of this error value, the adaptive learning controller provides the oxygen delivery by adjusting its controller gains. This leads to a change in the SpO2 levels of the patient which are then used to calculate the error again and adjust the oxygen delivery until this iterative process results in an error of E = 0. This signifies that the patient's oxygen saturation is above 94% and they  are stable at which point the controller maintains its settings to provide a constant supply oxygen. Adaptive Learning Controller (ALC) is using the Recursive Least Square (RLS) algorithm. RLS algorithm is used to update the PID gains in real time (as system operates) to force the actual system to behave like a desired reference model. It shows that the adaptive learning controller adjusts the PID parameters, i.e., gains of PID controller K p , K i and K d of oxygen regulator to attain the saturated Levels. The error generated is proportionally related to the variation of SpO2 from the target value. In case, SpO2 ¡ 85% or 85% ¡ SpO2 ≤ 90%, the amount of error generated is large which causes K p to increase, thereby increasing the regulating speed of the motor to provide a faster response. Additionally, K d increases to its maximum value to reduce overshoot and maintain the speed of regulating motor. Lastly, K i increases to reduce steady state error and control the overshoot to maintain the stability of valve control and corresponding oxygen levels.

Process Flow Diagram
For oxygen saturation level 90% ¡ SpO2 ¡ 94% minimum gain adjustments will be required and similarly when error is zero and SpO2 = target level, then gains of PID controller will be sustained on their existing values.

Experimental Setup
The designed circuit provides a new and improved respiration system which automatically regulates the fractional inspired oxygen to a patient. The system hardware consists of a microcontroller (Arduino Uno), pulse oximetry sensor (pulse oximeter max 30100), a LCD, a servo motor, a keyboard and other components (sound indication and LED indication). The hardware setup of oxygen control is illustrated in Figure 3. The pulse oximetry sensor measures the oxygen saturation of a patient's blood. This device consists of a red and an infrared light source, photo detectors, and a probe to transmit light through a translucent, pulsating arterial bed, typically a fingertip or earlobe that uses 5V/3.3V serial communication. The dissolved oxygen measurement is triggered by receiving a measurement via the RX port of the Arduino while the motor control is provided by the T X port. The sensor echoes the command and appends the measured oxygen concentration. If the measured oxygen concentration is below a certain threshold, i.e., SpO2 ¡ 94%, a valve is opened which will supply additional oxygen to the patient through a connected oxygen supply.

Results & Analysis
In the presented approach, a comparison between automatic and manual control is used to demonstrate the efficacy of adaptive learning controller for oxygen concentration in COVID-19 patients. It is observed that the automatic mode via ALC control is the better option as it allows the patients, for all age groups, to recover in less amount of time. The automatic mode also takes a conservative oxygenation approach    where only enough oxygen is provided to bring the patient back to 92% -96% SpO2. This approach has been proven to be a better option towards the needs of patients suffering from acute respiratory failure, as it does not overload lungs or blood saturation of the patients. In contrast, a liberal approach that is often taken by manual adjustment of oxygenation, where a high pressure of oxygen is provided when it is unnecessary, can result in detrimental effects on the health of the patient and in some cases even lead to an increased mortality rate [16]. This study comprises of observing and surveying different age groups of 10 high-risk patients, particularly between ages of 40-60, suffering from COVID-19 in 2020. As a result, the percentage of time spent within the target SpO2 range is observed for the aforementioned age groups. Table 2-3 provides a detailed comparison of the percentage of time spent by patients in various oxygen saturation ranges when their oxygenation was controlled manually or via ALC method. It can be observed that for patients aged 40-50, the automatic mode opted for a more liberal oxygenation approach to bring the patient's SpO2 levels within target. Figure 5 shows that the automated oxygenation methodology is a better approach than manual control for a specifically prescribed interval. In this study, the target range for oxygen saturation is defined as 90% to 94% SpO2. The graphs show that for both age groups of 40-50 and 50-60, ALC controller performs significantly better by maintaining the saturation level within the target range 77% and 80.1% of the time. Meanwhile, the manual methodology is only able to keep the patients within target saturation 49.5% and 59.6% of the time for ago groups 40-50 and 50-60 respectively. Additionally, it can also be seen that for patients within 40-50 age group, the manual control by staff takes a more liberal oxygenation approach despite its potential drawbacks. There can be several reasons of this behavior ranging from the severity of the oxygen required by the patient to the fact that the staff is busy and overloaded which is why they prefer to set high pressures to ensure that the patient does not become hypoxic in their absence. On the other hand, automatic controller spends more fraction of time above target range for 50-60 age group, thereby indicating a more liberal approach as compared to manual control. Older patients often struggle with breathing and other respiratory limitations that can be further exacerbated through COVID-19. In this case, the learning behavior of the ALC controller is emphasized, as it uses a proactive approach to maintain high oxygenation to prevent patients from becoming hypoxic. It is also important to note that the fraction of time spent by patients at the saturation level of hypoxia (SpO2 ¡ 85%) or approaching hypoxia (85% ¡ SpO2 ≤ 90%) is significantly lower for automatic control as compared to manual control by staff. Figure 5 also indicates that the patient remains within the target range of oxygen saturation for a longer duration when the oxygen is controlled using the adaptive controller as compared to manual control. This is beneficial for the patient because now they receive the optimal level of oxygen for a longer duration, resulting in less pressure on their lungs and reducing the load. Figure 6 is a time response graph which shows that the automatic controller brings the patient back to the target oxygen saturation in a shorter amount of time as compared to the manual control. This shows that if the oxygen level varies, it quickly returns to the required level, resulting in less effect on the lungs. Less load on the lungs and quicker response time can lead to faster patient recovery. δT= T(O2) -T(O1), where T(O2) is the time at which the oxygen returns to the target range, and T(O1) is the time at which oxygen levels drops/rises from the target range. The automatic control should have lower δT , while the manual control should have higher value of δT , indicating that the automatic control continuously adjusts the oxygen levels resulting in faster response. The step response of adaptive learning controller tuning (Figure 7) shows that the system will reach the stability quicker than the one under the conventional PID controller and when the peak overshoot is decreased, where the system takes smaller time to reach the steady state and that the system gets good response, as shown in Figure 7. The comparison of different techniques, with respect to the accuracy and complexity of the techniques applied, are shown in Table 4.

Conclusion
The proposed system is designed to provide a proactive supportive care to COVID-19 patients instead of reactive care. The key difference between the two types of care is the fact that the former is predictive of the variation in oxygen saturation level of the patient and therefore can make decisions before or instantaneously to prevent any further detriment of the patient's condition. This study focused on the age groups of 40-50 and 50-60, as they are most susceptible to chronic respiratory or acute hypoxic respiratory failure caused by SARS-COV-2. An adaptive learning controller was used to monitor and control the oxygenation of these patients, and the response-to-recovery was recorded and compared with manual control of oxygenation by healthcare staff. The results showed that patients' SpO2 levels were maintained within the target range for 77% and 80.1%, whereas, for manual control the time spent by patients within target range was a mere 49.55% and 50.6% for the age group 40-50 and 50-60, respectively. This is a clear indicator that the automated control technique not only maintains the concentration more consistently, but it also provides fine adjustments to counter any variations that it has experienced in the past through its predictive algorithm. In addition, the controller also achieves a steady state without a high over-shoot which is beneficial for the patient as in the case of rapid health deterioration. It is imperative that the controller be able to meet the accurate demand of the patient as quickly as possible. Finally, the PID approach is not only accurate, but it is also easy to implement as compared to other approaches, thus making it cost-effective and easy to implement in case of emergencies as in the case of the current pandemic. The results demonstrated that the automatic control approach has two major advantages for faster patient recovery. The first advantage is that it is able to prevent patients becoming hypoxic by quickly adjusting oxygenation and predicting their oxygen saturation variation based on their SpO2 variation history. Secondly, the automatic controller is able to maintain the patients in the target range for a greater amount of time, thus ensuring that their oxygen concentration levels remain consistent for greater duration of time. These two combined benefits can be attributed to faster recovery of patients as they help to alleviate stress on patient's lungs.     Step responses of Adaptive Learning PID controller Vs simple PID controller