Article Text

## Abstract

**Objective** To assess the performance of a novel algorithm for automated oxygen control using a simulation of oxygenation founded on in vivo data from preterm infants.

**Methods** A proportional–integral–derivative (PID) control algorithm was enhanced by (i) compensation for the non-linear SpO_{2}–PaO_{2} relationship, (ii) adaptation to the severity of lung dysfunction and (iii) error attenuation within the target range. Algorithm function with and without enhancements was evaluated by iterative linking with a computerised simulation of oxygenation. Data for this simulation (FiO_{2} and SpO_{2} at 1 Hz) were sourced from extant recordings from preterm infants (n=16), and converted to a datastream of values for ventilation:perfusion ratio and shunt. Combination of this datastream second by second with the FiO_{2} values from the algorithm under test produced a sequence of novel SpO_{2} values, allowing time in the SpO_{2} target range (91%–95%) and in various degrees of hypoxaemia and hyperoxaemia to be determined. A PID algorithm with 30 s lockout after each FiO_{2} adjustment, and a proportional–derivative (PD) algorithm were also evaluated.

**Results** Separate addition of each enhancing feature to the PID algorithm showed a benefit, but not with uniformly positive effects. The fully enhanced algorithm was optimal for the combination of targeting the desired SpO_{2} range and avoiding time in, and episodes of, hypoxaemia and hyperoxaemia. This algorithm performed better than one with a 30 s lockout, and considerably better than PD control.

**Conclusions** An enhanced PID algorithm was very effective for automated oxygen control in a simulation of oxygenation, and deserves clinical evaluation.

- Neonatology
- Respiratory
- Intensive Care

## Statistics from Altmetric.com

### What is already known on this topic?

Current algorithms for automated oxygen control are largely rule based and in some cases not designed for rapid responses to fluctuations in oxygen saturation (SpO

_{2}).These algorithms have shown a modest benefit in SpO

_{2}targeting in preterm infants compared with manual control.An ideal algorithm would be rapidly responsive, and deal with the non-linearity of the SpO

_{2}–PaO_{2}relationship and the variable oxygenation response between infants.

### What this study adds?

A proportional–integral–derivative algorithm could be enhanced to avoid hyperoxaemia and adapt to the severity of lung dysfunction.

In preclinical testing using an oxygenation simulation, the enhanced algorithm was very effective in targeting the desired SpO

_{2}range and avoiding the extremes of oxygenation.This algorithm now requires evaluation in clinical studies.

## Introduction

The conundrum of oxygen therapy in the preterm infant has yet to be resolved. There is, on the one hand, increasing acceptance of the importance of targeting a desired oxygen saturation (SpO_{2}) range1 ,2 and avoiding prolonged hypoxaemic and hyperoxaemic episodes,3 ,4 and on the other, the recognition that such targeting cannot be reliably achieved by bedside caregivers.5–7 Feedback-controlled automatic adjustment of fraction of inspired oxygen (FiO_{2}) clearly has the potential to improve the precision of SpO_{2} targeting,8–17 and is beginning to find its way into clinical practice. Automated oxygen controllers have been incorporated into several commercially available ventilators, which are being used with the hope that more effective SpO_{2} targeting can be achieved with less manual intervention.

Automated oxygen control devices have at their heart an algorithm which measures deviation of SpO_{2} from a setpoint, and computes an updated value of FiO_{2} which is then actuated mechanically.18 ,19 The design of the algorithm is fundamental to the function of the device. Contemporary algorithms each have an element of rule-based control,8 ,9 ,13 ,20 whereby FiO_{2} adjustments to SpO_{2} fluctuations are made based on a decision table developed by clinical experts. This approach offers the reassurance of clinical input to the decision-making, but the rules for FiO_{2} alteration are arbitrary and in some cases limited in scope,9 ,13 ,20 meaning that the algorithm may not serve the needs of all individuals.

In developing an ideal algorithm for automated oxygen delivery in preterm infants, several significant challenges need to be overcome.19 The first of these is that the system under control is prone to rapid and pronounced fluctuations in SpO_{2}.7 ,21 ,22 An ideal control algorithm would be capable of a timely response to these SpO_{2} alterations without inducing instability. Algorithms with a lockout period after each FiO_{2} adjustment9 ,20 may thus fail to respond to a critical SpO_{2} deviation. The algorithm must also be capable of dealing with a protracted SpO_{2} deviation (usually hypoxaemia) that has been refractory to the initial FiO_{2} alterations called for by the algorithm, and also with ‘steady-state’ error that arises when the characteristics of the system under control alter gradually (eg, basal oxygen requirement changes).

Another challenge for automated control is that SpO_{2} as the indicator of oxygenation is limited by the non-linear PaO_{2}–SpO_{2} relationship, with PaO_{2} changing by only 1–2 mm Hg for each 1% step change in SpO_{2} on the linear portion of the sigmoid curve, but by >20 mm Hg further towards the asymptote.23 A control algorithm should take account of this discrepancy, and thus avoid lingering hyperoxaemia because of an insufficient FiO_{2} reduction in response to positive SpO_{2} errors of relatively low magnitude.

A further challenge for automated control of oxygen delivery is that the magnitude of the SpO_{2} response to FiO_{2} adjustments (system gain) varies over time, related in large part to the evolution of lung dysfunction.24 ,25 This calls for a control algorithm that can adapt to the current severity of lung dysfunction, a feature incorporated into only one of the contemporary automated control algorithms.8

Herein, we report the development and preclinical testing of a rapidly responsive and adaptive algorithm for automated control of inspired oxygen in preterm infants. Beginning with proportional–integral–derivative (PID) control logic, we developed an algorithm with optimised coefficients, and investigated enhancements including compensation for the non-linear SpO_{2}–PaO_{2} relationship, and adaptation to the severity of lung dysfunction. In preclinical testing using a simulation of oxygenation disturbances in the preterm infant, we aimed to assess the performance of the algorithm and its enhancements in (a) keeping SpO_{2} within a target range, (b) avoidance of time in hypoxaemia (SpO_{2} <85%) and hyperoxaemia (SpO_{2} >96% in oxygen) and (c) avoiding hypoxaemic and hyperoxaemic episodes.

## Methods

The oxygen control algorithm was developed so as to allow incorporation in a stand-alone device or integration with pre-existing hardware for respiratory support in neonates. For the purpose of preclinical and ultimately initial clinical testing26 the algorithm was housed in a stand-alone device consisting of a processing platform (laptop computer), device inputs and outputs, a servo-controlled air–oxygen blender and a user interface displayed on the computer screen. The algorithm code was written in a graphical programming language (LabVIEW 2010, National Instruments, Austin, Texas, USA) and uploaded in the laptop computer.

### The core PID algorithm

At the core of the algorithm was a PID controller, a popular and versatile form of process control widely used in industry.27 For PID control, an error is defined as the deviation of the process signal from the setpoint, and the value of the manipulated signal output at each moment is proportional to the error, its integral and its derivative, with a different multiplying coefficient in each case (K_{p}, K_{i}, K_{d}). In this case the error (e) was the numerical difference between the incoming value for SpO_{2} (assuming a valid signal) and the midpoint of the selected target range (eg, target range 91%–95%, midpoint 93%). The integrand (edτ) was the sum of all errors (subject to constraints outlined below); the integral term in PID control lends the advantage of overcoming steady-state error.27 The derivative (de/dt) was the SpO_{2} slope by linear regression over the previous 5 s, and in PID control gives a prediction of future error.27 The output of the algorithm at each iteration was ΔFiO_{2}, being the sum of each of the PID terms (equation 1). The FiO_{2} to be delivered (set FiO_{2}) was the sum of ΔFiO_{2} and a reference FiO_{2} value (rFiO_{2}), a representation of the current baseline oxygen requirement (equation 2). Set FiO_{2} was rounded to ±0.5% and coerced to a value between 21% and 100%.
1
2

The PID algorithm code was within a loop iterating each second, allowing FiO_{2} alterations to be made at 1 s intervals if necessary. Value ranges for K_{p}, K_{i} and K_{d}, each of which was negative, were derived from extensive simulation studies. The value of K_{p} could be adapted to the severity of lung dysfunction (see below).

Modifications of the standard PID approach were applied to accommodate some idiosyncrasies of the system under control. The effect of reducing the error related to SpO_{2} values within the target range with a fractional multiplier proportional to distance from the midpoint was investigated (target range attenuation). Further, given the relative imprecision of SpO_{2} monitoring at values <80%,28 negative error was capped at 13%. These error adjustments were applied to calculation of the proportional term only.

Some modifications to handling of the integral term were also implemented. In recognition that the integral term progressively increments FiO_{2} in the event of unremitting hypoxaemia, its magnitude was capped so as to limit the maximum ΔFiO_{2} to 40% above rFiO_{2}. In hyperoxaemia (SpO_{2} above target range when in supplemental oxygen), which can follow a hypoxaemic event as an ‘overshoot’,29 the error at high SpO_{2} values is not proportional to the likely deviation of PaO_{2} from an acceptable value (figure 1). An approach to overcome this was investigated (Severinghaus compensation), whereby during hyperoxaemia, for as long as the integral term remained positive (ie, tending to increase ΔFiO_{2}), an error multiplier was applied to incoming positive errors (table 1).23 This had the effect of rapidly reducing the integral term towards zero, leading to FiO_{2} reduction and thus mitigation of overshoot. When in room air, sequential values of SpO_{2} above the target range were no longer considered to represent unremitting hyperoxaemia, and the integral term was not altered.

The derivative term calculation was also modified in hyperoxaemia, such that negative SpO_{2} slope was nullified (ie, rendered=0) if all of the latest five SpO_{2} values were above the setpoint. Upward pressure on ΔFiO_{2} by the derivative term was thus avoided in hyperoxaemia.

### Adaptive features of the algorithm

Adaptive control is an approach in which the behaviour of an algorithm is adjusted based on varying characteristics of the process and its signals.30 An adaptive approach was investigated in which K_{p} was modified according to the severity of lung dysfunction by applying a scaling factor proportional to current rFiO_{2}. The K_{p} modification was by multiplication of the standing value of K_{p} by a factor in the range 0.5–1.5 for rFiO_{2} 21%–60%. Adaptation of K_{p} in this way acknowledges the inverse proportional relationship between gain and severity of lung disease that has been observed in this population.24 ,25

### Algorithm input and output

The primary input to the algorithm, SpO_{2}, can be sourced from any oximeter having an analogue or digital data output. For algorithm development and preclinical testing, SpO_{2} was derived from a simulation of oxygenation in the preterm infant. The output from the algorithm can be transmitted to any device that can receive and execute a desired value of FiO_{2}, including air–oxygen blenders and mechanical ventilators. For preclinical testing, the output FiO_{2} was linked to the oxygenation simulator.

### Algorithm evaluation

The contribution to algorithm function of three enhancing features was investigated. The performance of all permutations of the PID algorithm with (a) Severinghaus compensation, (b) K_{p} adaptation and (c) target range attenuation was evaluated using a simulation of oxygenation (fully described in the online supplementary text and depicted in online supplementary figure S1). A 1 Hz recording of FiO_{2} and SpO_{2} (∼24 hours duration) from each of 16 preterm infants on continuous positive airway pressure (CPAP)7 was converted to a series of values for ventilation:perfusion () ratio and shunt. The assumptions made in abstracting oxygenation data were subject to a validation outlined in the online supplement. SpO_{2} averaging time of the original recordings was 2–4 s, and was not averaged further during the data abstraction and simulation. The and shunt series was then linked to the algorithm under test within the automated oxygen controller, allowing a sequence of unique values for SpO_{2} to be generated. The SpO_{2} target range was set at 91%–95%. Function of the algorithm without an integral term (ie, proportional–derivative, PD), and of the fully enhanced algorithm with a 30 s lockout after an FiO_{2} adjustment, were also examined. For these latter analyses, multiple permutations of PID coefficients were trialled in an attempt to optimise performance.

### Supplementary text

### Supplementary figures

### Data analysis

For each of the 16 SpO_{2} sequences generated during simulation, proportions of time in the following oxygenation states were calculated: SpO_{2} in target range, eupoxia (SpO_{2} in target range, or above target range when in room air), SpO_{2} <80%, <85%, below and above target range, >96% in oxygen and >98% in oxygen. Frequency of prolonged episodes of hypoxaemia (SpO_{2} <85%) and hyperoxaemia (SpO_{2} >96% in oxygen) were identified, as was frequency of SpO_{2} overshoot, defined as SpO_{2} readings above the target range for at least 60 s over the 2 min following a hypoxaemic event with SpO_{2} <85%.8 ,15 SpO_{2} instability was evaluated using SpO_{2} coefficient of variation (CV), and frequency and mean duration of episodes outside the target range. These data were summarised as median and IQR, other than for SpO_{2} overshoot, where data were pooled and expressed as a single value for each algorithm. Algorithm performance was evaluated by comparison of medians using Friedman non-parametric repeated measures analysis of variance with Dunn's post hoc test. For simplicity the comparisons were limited to the following groupings: (a) core PID with or without one enhancing factor (Severinghaus compensation/K_{p} adaptation/target range attenuation); (b) enhanced PID with or without subtraction of one enhancing factor and (c) comparison of core PID/enhanced PID/PID with 30 s lockout/PD. Summary data regarding SpO_{2} targeting by manual control from the original recordings were also generated, but statistical comparisons not made given the different SpO_{2} target range (88%–92%).

## Results

The recordings using in the simulation came from 16 preterm infants of median gestation at birth 30.5 weeks (IQR 27.5–31 weeks), birth weight 1320 (910–1860) grams and postnatal age 2.0 (0–5.3) days. The infants had a considerable degree of SpO_{2} instability, with hypoxaemic episodes (SpO_{2} <80) occurring with a frequency of 3.1 (1.6–9.9) episodes per 4 hours. At the time of the recording, CPAP pressure level was 7.0 (6.5–8.0) cm H_{2}O and baseline FiO_{2} 0.28 (0.25–0.31), with a baseline FiO_{2} range of 0.21–0.61. After removal of missing SpO_{2} data, the recordings were of duration 22 (20–26) hours.

In simulation testing, the complementary function of the different components of the PID controller was evident. Separate addition of K_{p} adaptation and target range attenuation to the core PID controller improved eupoxia time, whereas addition of Severinghaus compensation decreased episodes of hyperoxaemia, but not without some deleterious effects (tables 2 and 3). Overall, the performance of the PID algorithm with all three enhancements was superior to other combinations, but not for all oxygenation parameters. Without target range attenuation, eupoxia time trended higher than for fully enhanced PID, but conversely time at the extremes of oxygenation was also somewhat higher (table 2). Hypoxaemic and hyperoxaemic episodes were most effectively eliminated without K_{p} adaptation (table 3), but on occasions at the cost of more oscillation around the target range (see online supplementary figure S2C) and thus less effective SpO_{2} targeting overall (table 2). Removal of Severinghaus compensation from the enhanced algorithm minimised hypoxaemia, but predictably led to more time in, and episodes of, hyperoxaemia (tables 2 and 3) (see also online supplementary figure S2D). The enhanced algorithm performed better in all respects than an algorithm with a 30 s lockout period after each FiO_{2} alteration (see online supplementary figure S2E), and considerably better than a PD algorithm (tables 2 and 3).

Stability of the SpO_{2} recording also varied considerably with different permutations of enhancing features (table 4). The SpO_{2} CV values in the recordings overall reflected the instability seen in individual examples (eg, with K_{p} adaptation removed from the enhanced algorithm, see online supplementary figure S2C). SpO_{2} CV was minimised with the enhanced algorithm (and several other combinations) suggesting relative stability under these circumstances. Both PID control with a 30 s lockout and PD control resulted in less SpO_{2} stability, with longer-lasting episodes above and below the target range (table 4).

## Discussion

Effective automated oxygen control for the preterm infant requires an algorithm capable of responses that are emphatic and tempered in equal measure, and take account of the physiological complexities of the oxygenation system and its variability between individuals. We found that a core PID algorithm could be enhanced for automated oxygen control by rapid reaction to iatrogenic hyperoxaemia, adaptation to the severity of lung dysfunction and error attenuation within the SpO_{2} target range. In a simulation of oxygenation derived from in vivo data, the enhanced algorithm had better all-round performance than PID algorithms with fewer enhancements, with an optimal combination of time in the desired SpO_{2} range and avoidance of hypoxaemia and hyperoxaemia.

The enhanced PID algorithm was able to respond rapidly to SpO_{2} deviations, adjusting FiO_{2} up to once per second if necessary. The initial response to a hypoxaemic or hyperoxaemic event was largely the domain of the proportional and derivative terms, with further and more tempered FiO_{2} adjustments dictated by the integral term until normoxia was restored.

At least in simulation, the enhanced PID algorithm was very effective in mitigation of episodes of prolonged hypoxaemia and hyperoxaemia. The addition of Severinghaus compensation to the core PID algorithm was instrumental in overcoming hyperoxaemic events (including overshoot), and removing it from the enhanced algorithm resulted in their reappearance. The core PID algorithm alone was effective at reducing prolonged hypoxaemia, and remained so with enhancing features added.

PID is widely used in industry and known to provide control to systems with a high degree of variability and with a timelag.27 A PID control algorithm has been used previously for automated oxygen control, either alone31 or in combination with feedback control of mechanical ventilation.32 The PID algorithm used in our study differed from that of Tehrani *et al*31 ,32 in two important ways. First, we determined error based on the difference of SpO_{2} values from an accepted setpoint (midpoint of the target range) rather than by conversion to a proximate PaO_{2} value and comparison with an ‘ideal’ PaO_{2}.31 ,32 Second, our PID algorithm was designed to respond to rapid SpO_{2} fluctuations, unlike that previously reported in which a rule-based algorithm was invoked during hypoxaemic events.31 ,32 These differences, along with the additional features in our enhanced algorithm, may have improved its function, and avoided the oscillation in SpO_{2} noted previously before a new steady state was achieved.31

Even with optimised coefficients, the enhanced PID algorithm was less effective at SpO_{2} targeting when each FiO_{2} adjustment was followed by a 30 s lockout. PID algorithms are known to retain function when signal output is further manipulated during the time lag until full system response.27 Based on our own observations we estimate the total delay of the oxygenation system in preterm infants to be at least 30 s.33 Avoiding further FiO_{2} adjustments for such a period seems a suboptimal approach if there is further deviation of SpO_{2} from the target range, and additional manual FiO_{2} adjustments are more likely to be needed. In a recent multicentre study of a rule-based algorithm with a 180 s lockout period, a relatively large number of manual adjustments (2.2/hours) were made by bedside staff during automated control.12

Even with enhanced PID including K_{p} adaptation, the performance of the algorithm was variable in the data recordings sourced from different individuals, with eupoxia time ranging from 86% to 98%. Interindividual variation in the gain of the oxygenation response, which we have recently reported in preterm infants,24 is likely an important contributor to this heterogeneity of performance. Along these lines, there may well be potential to optimise the effectiveness of automated control in a given individual by real-time analysis of algorithm function and tuning of coefficients, in particular adjustment of K_{p} from its adapted value. No form of performance analysis and autotuning is found in any of the algorithms currently incorporated in commercially available ventilators, and its lack may at times results in automated control that is inferior to that achievable manually. Performance analysis software will be evaluated in clinical studies of a future version of our enhanced PID algorithm.

The simulation of oxygenation used for algorithm comparison was an extension of a validated physiological model in the preterm infant.34 ,35 The simulation allowed the oxygenation disturbance to be expressed independent of FiO_{2}, and thus the impact of FiO_{2} values different to the original could be examined. Whether such a simulation can reliably predict the function of an algorithm when directly applied to preterm infants will need further investigation. However, using data from our initial clinical study,26 the assumptions regarding the blend of ratio and shunt were found to produce an SpO_{2} targeting profile in simulation that closely matched actual data during automated oxygen control (see online supplement). Refinement of physiological modelling, possibly including multiple compartments with variable blood flow,36 may further improve the authenticity of the simulation.

## Conclusion

An enhanced PID algorithm was very effective for automated oxygen control in a simulation of oxygenation, and deserves evaluation in clinical studies.

## References

## Footnotes

Contributors PAD: conceived the algorithm (with TJG) and its enhancements (with OSF, KIW and TJG), conceived and developed the simulation (with TJG and RJ), compiled and analysed the simulation data, wrote the first draft of the manuscript and approved the final version. OSF, GKP and KIW: identified enhancements to the function of the algorithm, reviewed and edited the manuscript and approved the final version. KL: collected the original data recordings used for simulation, reviewed and edited the manuscript and approved the final version. RJ: developed the simulation (with PAD), reviewed and edited the manuscript and approved the final version. TJG: conceived the algorithm (with PAD) and its enhancements (with PAD, OSF and KIW), conceived and developed the simulation (with PAD and RJ), reviewed and edited the manuscript and approved the final version.

Funding Supported by a starter grant (12-019) from the Royal Hobart Hospital Research Foundation.

Competing interests The University of Tasmania and Royal Hobart Hospital have jointly lodged a provisional patent application concerning automated control of inspired oxygen concentration in the newborn infant.

Ethics approval University of Tasmania Human Research Ethics Committee.

Provenance and peer review Not commissioned; externally peer reviewed.

Data sharing statement Original data available for sharing on request.