Abstract
Background:
Despite recent advances in closed-loop control of blood glucose concentration (BGC) in people with type 1 diabetes (T1D), online performance assessment and modification of artificial pancreas (AP) control systems remain a challenge as the metabolic characteristics of users change over time.
Methods:
A controller performance assessment and modification system (CPAMS) analyzes the glucose concentration variations and controller behavior, and modifies the parameters of the control system used in the multivariable AP system. Various indices are defined to quantitatively evaluate the controller performance in real time. Controller performance assessment and modification system also incorporates online learning from historical data to anticipate impending disturbances and proactively counteract their effects.
Results:
Using a multivariable simulation platform for T1D, the CPAMS is used to enhance the BGC regulation in people with T1D by means of automated insulin delivery with an adaptive learning predictive controller. Controller performance assessment and modification system increases the percentage of time in the target range (70-180) mg/dL by 52.3% without causing any hypoglycemia and hyperglycemia events.
Conclusions:
The results demonstrate a significant improvement in the multivariable AP controller performance by using CPAMS.
Introduction
Various automated insulin delivery systems, termed the artificial pancreas (AP), are proposed for improving glycemic regulation in people with type 1 diabetes (T1D) by utilizing dynamic glucose-insulin models and predictive controllers.1-15 Despite the proven advantages, fully automated closed-loop control of blood glucose concentration (BGC) using an AP remains challenging because of the needs for (1) reliable models to accurately describe the patient-specific time-varying glucose-insulin dynamics; (2) knowledge of insulin constraints to prevent an overdose and to improve patient safety; (3) efficient predictive control algorithms that regulate BGC in the presence of unknown disturbances like meals and physical activities; and (4) reliable and efficient controller performance assessment and modification systems (CPAMS) to assure that the AP system performs satisfactorily over time under various conditions.
Model predictive control (MPC) has gained significant popularity in various applications ranging from chemical process industries to pharmaceutical production and automated drug delivery systems.16,17 This popularity has led to an increased interest in automated controller performance assessment and modification for MPC. The information gained from the CPAMS can be used to retune or redesign the controller for performance improvement.18,19 Different AP control systems have been designed based on the MPC.9,11,20-29 Due to the complex nature of BGC dynamics in people with T1D, the performance of the MPC techniques developed by using a fixed model or fixed controller parameters for the AP system may not consistently meet the expectations. Model predictive control performance assessment is challenging because degradation in closed-loop performance can arise due to model deficiencies, poor control design parameters, or inappropriate constraints. Complex nonlinear dynamical systems such as the metabolic processes in the human body are particularly challenging to control due to the time-varying characteristics of these systems and their nonlinear behavior, presence of stochastic and unknown disturbances, and uncertain time-varying delays. An example of a system with noteworthy complexities that necessitates a safe and reliable controller integrated with a powerful CPAMS is the regulation of glucose concentrations in people with T1D. Despite advances in glucose control algorithms, the complexity of the glucose regulation problem has challenged the accurate assessment of the controller performance.30,31
In the literature, several approaches have been reported for adapting and individualizing both AP controllers and clinical open-loop therapy. The adaptation is expected to improve controller performance and provide some of the benefits that a CPAMS could provide. A data-driven AP adaptation method based on a two-phase Bayesian optimization assisted parameter learning algorithm was introduced to adapt basal and carbohydrate-ratio profiles and key feedback control parameters. 32 Run-to-run approaches were proposed to update basal rate, meal bolus sizes, and the insulin to carbohydrate ratio profile.33-37 An iterative learning MPC was proposed to adapt the reference trajectory of the closed-loop controller used for glucose regulation.38-40 Individualized MPCs for AP systems were proposed based on patient-specific parameters or historical data for improved glucose regulation performance work.25,41 An adaptive learning algorithm to adjust postprandial basal and premeal bolus insulin was proposed for reducing postprandial hypoglycemia in a hybrid AP. 42 Automatic adaptation of basal insulin using sensor-augmented pump therapy was developed based on a run-to-run control law. 43 A learning algorithm was integrated into a MD-Logic AP system to establish an initial patient profile using open-loop data and then make periodic adjustments during closed-loop operation. 44 A run-to-run control was developed for multiple-daily injection therapy where rapid- and slow-acting insulins were used based on pre- and postprandial glucose measurements. 45
We developed a multivariable AP (mAP) system with a glucose concentration prediction model that is recursively updated with each new continuous glucose monitoring (CGM) information along with physiological variables reported by wearable devices. The measurable disturbances estimated from physiological variables are used both in improving glucose predictions and insulin infusion dose decisions, and in providing warnings for consumption of rescue carbs to prevent hypoglycemia.15,28 The CPAMS is developed to monitor, evaluate, and modify the mAP controller to enhance its performance and safety. 31
In this work, we propose refinements to CPAMS to enhance its performance and improve glucose concentration regulation. We demonstrate that our mAP system can mitigate the effects of unknown disturbances like physical activities and meals efficiently and can control BGC in the target range (70-180) mg/dL with infrequent consumptions of reasonable amounts of rescue carbohydrates. Controller performance assessment and modification system enables these improvements by modulating the desired BGC (set-point) of the controller. Various components of the mAP are outlined below, and references are given to publications that provide the details of the algorithms. In our previous work, we have developed an adaptive MPC-based personalized multivariable, multimodule AP system capable of disturbance rejection without manual announcements for meals and exercise.28,46 To characterize the time-varying glycemic dynamics, a data-driven recursive subspace system identification technique was integrated with a physiological compartmental model to identify adaptive stable models.28,47 Assessing the performance of the recursively identified models is necessary to ensure that the model is able to provide accurate output predictions for the use in MPC algorithms. For this reason, we proposed a performance assessment technique for the recursively identified models to check certain key performance indexes (KPIs), including the risk of underpredicting undesirably high glucose levels, the risk of overpredicting dangerously low glucose levels, and the mean absolute error between predicted and measured outputs. The assessment of the clinical utility of model-based glucose predictions using Clarke error grid analysis has also been proposed. 31 We have also specified the key parameters in the model to be modified through efficient ways if the poor performance of the model is observed over time based on the aforementioned KPIs.
To quantify the insulin in the bloodstream, the plasma insulin concentration (PIC) estimator was designed by using the unscented Kalman filtering technique. The PIC estimator is able to capture the variability in the temporal dynamics of patients by estimating some uncertain model parameters that have significant effects on PIC estimates. The PIC estimator is personalized by initializing the time-varying model parameters using partial least squares regression models. The PIC safety constraints were then defined to assure that a safe amount of insulin is in the body.48,49
An adaptive MPC algorithm was designed based on recursively identified state space models with dynamic adjustments of constraints and objective function weights. A feature extraction method that automatically detects the presence of meals using qualitative descriptions of CGM time-series data was also designed. The key parameters of the MPC optimization problem are modified online using the information that the feature extraction method provides about the rate and shape of variations in output measurements to improve the effectiveness of the controller against meal consumption. These adaptive controller parameters, dynamic safety constraints, and addition of exogenous physiological measurements from wearable devices empowered the control system to efficiently compute the optimal control action over diverse diurnal variations. Various KPIs were defined to evaluate the performance of the closed-loop system to modify the key controller parameters of the adaptive MPC in real time if poor performance was detected. 31
Historical data can be utilized to identify behaviors and patterns of the underlying system. We showed that incorporating online learning of probable times of unknown disturbances from the amassed historical data using a recursive partial least squares model can improve the control performance by proactively mitigating the effects of impending disturbances. Hence, the controller set-point, the weights in the MPC objective functions, and the system constraints are appropriately modified in advance for anticipated periods of the disturbance effects. We have also shown that the proposed CPAMS integrated with the mAP is robust and reliable against unexpected behaviors on atypical (nonregular) days when the daily activities of the users are different from historical data used for learning and modification. 31 A predictive hypoglycemia alarm module was also designed to suggest carbohydrates to be consumed to prevent predicted hypoglycemia. Using a four-step-ahead (20 minutes) prediction of glucose values and considering the presence of physical activities and the amount of active insulin in the bloodstream (PIC), this module suggests fast-acting carbohydrates if the predicted glucose value is less than a safe threshold. In case hypoglycemia is predicted, consumption of 15 to 25 g of fast-acting carbohydrates is suggested by the mAP to avoid low BGC. There is a wait period of 20 and 15 minutes between each suggested fast-acting carbohydrate during fasting time and exercise time, respectively.
In this work, we enhance the CPAMS to further analyze the closed-loop behavior of the mAP and adjust the controller parameters and set-points depending on the current state of the subject, the disturbances to the metabolic system, and the performance of the controller. Our focus is to show that the proposed mAP and the CPAMS can keep the BGC in the target range (70-180) mg/dL over longer periods and mitigate the effects disturbances such as physical activity and meal efficiently without causing any hypoglycemia events and without any manual information. As the controller basal set-point value for regulating BGC has a significant effect on the glycemic results, a subject preferring to avoid consuming rescue carbohydrates during exercise may increase the basal set-point value (for example, from 110 to 140 mg/dL) in order to decrease the likelihood of hypoglycemia treatments while keeping the BGC in the target range during most of the exercise and recovery period.
A multivariable simulation software platform of virtual subjects with T1D 50 is used to illustrate the performance of the mAP with the CPAMS. This multivariable glucose-insulin-physiological variable simulator (mGIPsim) is based on simulation of the glucose-insulin dynamics of virtual patients with T1D by extending Hovorka’s model. Nonlinear models are developed to describe glucose concentration variations based on user-defined scenarios for meal consumption, insulin administration, and physical activities. They compute glucose concentration values and physiological variables, such as heart rate, skin temperature, accelerometer, and energy expenditure, that are indicative of physical activities affecting glucose concentration dynamics as outputs from the simulator. Continuous glucose monitoring time series data, fingerstick BGC measurements, insulin infusion information, meal and exercise scenarios, and physiological variable measurements collected during clinical experiments were used to extend the glucose-insulin dynamics model, develop models for physiological variable predictions, and create the simulator’s virtual subjects.
Methods
In this work, CPAMS is applied to the regulation of glucose concentrations in people with T1D using automated insulin delivery with an adaptive learning MPC. We focus on automatically assessing the performance of different modules of the mAP system using various performance indices. Here, we describe briefly different components of the mAP control system and explain their key parameters. We propose a daily-based performance assessment to guarantee that the whole mAP system is functioning properly. The purpose is to increase the percentage of time in the target range (70-180 mg/dL) without causing any hypoglycemia and hyperglycemia. The proposed controller can keep the BGC in the target range with a minimum number of consumed rescue carbohydrates suggested by the hypoglycemia detection and carbohydrate suggestion module. The controller is able to compute an optimum amount of insulin under various daily conditions. Consuming less rescue carbohydrates during the day reduces the interruption times during exercise and anxiety due to hypoglycemia.
Plasma-Insulin-Cognizant Adaptive MPC
The mAP controller is an adaptive MPC algorithm cognizant of PIC for computing the optimal insulin infusion rate. It also utilizes the glycemic and PIC risk indexes that manipulate the penalty weighting matrices in the objective function. The MPC computes the optimal insulin infusion over a finite horizon using the identified time-varying glycemic models by solving at each sampling instant (
with the objective function
where
A second-order polynomial function
The upper, lower, and desired values of the PIC are a linear function of the CGM values. The initial value of
Adaptive Learning Controller Set-Point Determination and PIC Bounds Definition
An adaptive learning technique is proposed to modify the controller set-point based on historical information during meal and exercise periods. Historical data, including the CGM measurements and physiological variables, are used to deduce the probable times of meals consumption and physical activities. This valuable information on daily behaviors and habits can be used in the mAP system to anticipate and proactively mitigate the effects of disturbances. Therefore, the performance of the control system can be improved if the controller set-point is appropriately modified in advance for the anticipated periods of the disturbance effects. The nominal value of the reference glucose set-point target in the controller is
The adaptive set-point definition is also used to modify the PIC bounds including the
According to the definitions in Equation (3), PIC bounds change beforehand based on the historical data over the prediction/control horizon to better mitigate the effects of the unknown disturbances.
Adaptive Glycemic Risk and Plasma Insulin Risk Indices
An adaptive glycemic risk index (GRI) determines the weighting matrix for penalizing the deviation of the model output from the set-point.
31
At each sampling time, the GRI
where
A plasma insulin risk index is defined to manipulate the weighting matrix for penalizing the amount of input actuation (aggressiveness of insulin dosing) depending on the estimated PIC, thus suppressing the infusion rate if sufficient insulin is present in the bloodstream.
31
At each sampling time, the GRI
where
Controller Performance Assessment and Modification During Postprandial Periods
The PIC constraints of the MPC are modified based on the
where
Controller performance assessment and modification system reduces the values of
The
No hypoglycemia event happens during the PPs.
No rescue carbohydrates are consumed by the user due to the predicted hypoglycemia event via the predictive hypoglycemia alarm module.
However, the CPAMS increases the values of
Hypoglycemia event happens during the PPs.
Rescue carbohydrates are consumed by the patient due to the predicted hypoglycemia event via the predictive hypoglycemia alarm module.
The initial values of
Controller Performance Assessment and Modification During Fasting Period
In this work, we consider three hours of PP period for each detected meal and two hours of recovery period after each detected exercise. The rest of the time on each day is considered as fasting periods. The PIC bounds of the MPC define the aggressiveness/conservativeness of the controller during different conditions. During the fasting period, the
where the
where
Results
The efficacy of the proposed mAP and CPAMS is investigated by using mGIPsim. 50 In addition to the CGM values, the mGIPsim generates physiological variable signals reported by noninvasive wearable devices. Aerobic exercises with treadmill and stationary bicycle are considered for testing the mAP system integrated with the CPAMS. Twenty virtual subjects are simulated for 60 days with varying times and quantities of meals consumed on each day and physical activities with different types, intensities, and durations as detailed in Tables 1 and 2. The meal and physical activity information are not entered manually to the AP system as the AP controller is designed to regulate the BGC in the presence of significant unknown disturbances such as unannounced meals and exercises. In the defined scenario, the maximum amount for the meal consumption is 70 g of carbohydrates though larger amounts can be also tested. The metabolic equivalent task (MET) values computed by the simulator from physiological signal data are used to extract information about the presence and intensity of exercise for the mAP system.
Meal Scenario for 60 Days Closed-Loop Experiment Using the Multivariable Metabolic Simulator.
Exercise Scenario for 60 Days Closed-Loop Experiment Using the Multivariable Metabolic Simulator.
The quantitative evaluation of the closed-loop results based on the proposed algorithms is presented in Tables 3-5, where the meal and exercise specifications are different every day. The purpose of these simulations is to show that the mAP integrated with CPAMS and an adaptive learning technique is robust and reliable in learning and handling users’ habits and activities that vary over time. The average percentage of time spent in the target range (70-180) mg/dL improves significantly from 39.4% to 91.7% for all subjects over time. There are no hypoglycemia events as the BGC is never below 70 mg/dL. The minimum and maximum observed BGC values across all experiments on the last day (day 60) of the simulation are 79 and 245 mg/dL, respectively. There is also a significant improvement in the mean of CGM values from 197.1 to 137.4 mg/dL. The number of treatments for the predicted hypoglycemia events by consuming rescue carbohydrates is also low, which indicates that the whole mAP system can function satisfactorily under various conditions like exercise and meals. Overall, the results demonstrate that the mAP is able to regulate BGC effectively in the presence of significant unknown disturbances caused by the diverse timing and amounts of meals and exercise specifications while mitigating severe hypo- and hyperglycemic excursions. The closed-loop results for all subjects in Figure 1 and for a select subject during all 60 days in Figure 2 indicate that the performance of the mAP improves over time due to CPAMS and by learning from historical data. Since the meal and exercise specifications for each day are randomly selected from Tables 1 and 2, these variations affect the closed-loop behavior of the control system observed in Figure 2. In Figure 3, the controller delivers more insulin to increase the percentage of time spent in the target range. This increase in the total daily infused insulin augments the number of rescue carbohydrates to avoid potential hypoglycemia, particularly during exercise sessions when the CGM values may be low. The variations observed in the performance indices, the total daily infused insulin, and the total number of predicted hypo preventions by rescue carbohydrates for each day over time are due to different meal and exercise scenarios generated for each day. Users may specify their preferences for lower rescue carbohydrates, which cause the CPAMS and MPC to decrease insulin infusion and reduce hypoglycemia risk. This more conservative setting results in lower rescue carbohydrates, though the decreased insulin may cause slightly higher glucose values compared to a controller tuned to increase the time spent in the target range.
Continuous Glucose Monitoring Metrics Percentage of Time Spent in Different Ranges for Day 1, Day 60, and for All Days for Closed-Loop Control Results.
Continuous Glucose Monitoring Metrics for Different Statistics for Day 1, Day 60, and Overall Days and Number of Hypo Treatments Based on Predictive Hypoglycemia Alarms on Day 60 for Closed-Loop Results.
Average represents the mean of each index over all subjects; P includes three postprandial periods for breakfast, lunch, and dinner and each postprandial period is three hours; E includes two exercise sessions (bike and treadmill), each exercise session is one hour on day 60; F includes fasting period excluding P and E periods.
Number of Predicted Hypo Preventions by Rescue Carbohydrates on Day 1, Day 60, and Overall.

Comparison of model predictive control results for the first (gray) and last (white) days of simulation for all 20 subjects. The bottom and top of the boxes are the first and third quartiles and the line inside the box is the median. The whisker’s ends represent the minimum and maximum values and + indicates mean values.

Closed-loop results for a select subject. The top and bottom edges of the boxes are the first and third quartiles, and the line inside the box is the median. The whisker ends represent minimum and maximum values, and plus signs (+) indicate mean values.

Closed-loop results for a select subject. The star signs (*) indicate the total daily infused insulin (U) and the circle signs (o) indicate the total number of predicted hypo preventions by rescue carbohydrates at each day.
Discussion
The rescue carbohydrates intake may not be convenient during an exercise and may lead to weight gain in the long term. However, in a real-life scenario, the person may choose to start a meal early or eat a snack prior to exercise to prevent hypoglycemia which would reduce the number of carbohydrates consumed for the sole purpose of maintaining glycemia. Many people with diabetes consume carbohydrates as part of their management plan for exercise, so the recommended 30 g per session on average for day 60 may match their standard treatment regimen. The combination of increased constraints on PIC during the identified exercise period (ie, reducing insulin administration prior to the start) and recommendation of carbohydrate consumption match the recommendations given to people with T1D.
51
Some people with T1D may also prefer to define their controller basal set-point values instead of the default value of
In Tables 6 and 7, the results for four different cases are presented: case 1:
Continuous Glucose Monitoring Metrics Including the Percentage of Time Spent in Different Ranges for Closed-Loop Results of Four Different Basal Set-Point Values at Day 60.
Continuous Glucose Monitoring Metrics Including Different Statistics for Day 60 and Total Number of Predicted Hypo Preventions by Rescue Carbohydrates for All 60 Days via Predictive Hypoglycemia Alarm Module for Closed-Loop Results of Four Different Basal Set-Point Values.
Average represents the mean of each index over all subjects.
P-values of Statistical Differences Between Day 1 and 60 Continuous Glucose Monitoring Values for Closed-Loop Results of Four Different Basal Set-Point Values.
Abbreviation: CGM, continuous glucose monitoring.
The MET, or simply metabolic equivalent, is a physiological measure expressing the energy cost of physical activity (PA) and is defined as the ratio of metabolic rate (and therefore the rate of energy consumption) during a specific PA to a reference metabolic rate. MET is used as a means of expressing the intensity and energy expenditure of activities in a way that is comparable among people. We have developed a real-time MET estimation algorithm by using noninvasive measurements of physiological variables. In this approach, the MET values are computed by using heart rate, galvanic skin response, skin temperature, blood volume pulse, and accelerometer information streaming in real time from a wristband. 52
The controller set-point for the current time is defined based on the condition of the patient at that sampling time and historical data are used to define the controller set-point for future values over the prediction/control horizon. The controller set-point values for the anticipated meal and exercise disturbance time windows of the new day are calculated by averaging the assigned set-point values for the specific time in the historical data which corresponds with the prediction time. In these results, all historical data are used. For example, if historical data shows that a patient consumes a meal around 12:00
Conclusion
In this work, a CPAMS is proposed for our mAP that uses an adaptive learning MPC. The mAP efficiency is evaluated online by means of different key KPIs. CPAMS can learn the user’s habits and activities over time by utilizing historical data such as CGM data and physiological variables. The proposed adaptive learning mAP system integrated with the CPAMS is evaluated by simulation studies. Different amounts and times for meal consumption and various exercise sessions were used on different days to challenge the mAP system and assess its performance. The results illustrate that a significant improvement can be achieved in controller performance by using CPAMS without causing any hypoglycemia or hyperglycemia episodes.
Footnotes
Declaration of Conflicting Interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work was supported by NIDDK DP3 DK101075-01 and DP3 DK101077-01, and Juvenile Diabetes Research Foundation grant A18-0036-001 made possible through collaboration between the JDRF and The Leona M. and Harry B. Helmsley Charitable Trust.
