Abstract
Background:
Bolus calculators help patients with type 1 diabetes to mitigate the effect of meals on their blood glucose by administering a large amount of insulin at mealtime. Intraindividual changes in patients physiology and nonlinearity in insulin-glucose dynamics pose a challenge to the accuracy of such calculators.
Method:
We propose a method based on a continuous-discrete unscented Kalman filter to continuously track the postprandial glucose dynamics and the insulin sensitivity. We augment the Medtronic Virtual Patient (MVP) model to simulate noise-corrupted data from a continuous glucose monitor (CGM). The basal rate is determined by calculating the steady state of the model and is adjusted once a day before breakfast. The bolus size is determined by optimizing the postprandial glucose values based on an estimate of the insulin sensitivity and states, as well as the announced meal size. Following meal announcements, the meal compartment and the meal time constant are estimated, otherwise insulin sensitivity is estimated.
Results:
We compare the performance of a conventional linear bolus calculator with the proposed bolus calculator. The proposed basal-bolus calculator significantly improves the time spent in glucose target (P < .01) compared to the conventional bolus calculator.
Conclusion:
An adaptive nonlinear basal-bolus calculator can efficiently compensate for physiological changes. Further clinical studies will be needed to validate the results.
Meals represent one of the main challenges for patients with type 1 diabetes (T1D) due to the high nonlinearity of the insulin-glucose dynamics, the difficulty to accurately estimate the carbohydrates (CHO) content, and the slower action of insulin compared to most meal intakes. Furthermore, a number of factors, such as physical activity, 1 alcohol consumption, 2 or the Circadian cycle, 3 affect the insulin requirements throughout the day. It would require adjusted basal insulin and bolus insulin settings for injection pen treatments and in insulin pumps to be handled properly.
The fear of hypoglycemia is a major concern in patients with T1D. 4 In most cases, patients therefore tend to be conservative in their insulin therapy and administer less insulin than required to avoid hypoglycemia. This may lead to avoidable hyperglycemic events and in the longer run to an increased risk of diabetes-related clinical complications. A study showed for example that a large majority of T1D patients underestimate their meal size to avoid insulin overdoses. 5
Bolus calculators have recently been developed for multiple daily injections (MDI) patients 6 and has been successfully been implemented in most insulin pumps since 2002. 7 They decreased the risk of error in the determination of the insulin dosage, and are usually preferred by patients with T1D compared to manual bolus calculation. 6 ,8-10 In the current bolus calculators, the bolus size is proportional to the CHO in the meals, and possibly corrected depending on the current glucose level and the estimated insulin on board. Typical bolus calculators are in the form 11
in which
This article presents a nonlinear and adaptive basal-bolus calculator based on a continuous-discrete unscented Kalman filter (CDUKF). The CDUKF estimates the current states and the insulin sensitivity based on data from a continuous glucose monitor (CGM). The state and insulin sensitivity estimates are used to adjust the basal insulin infusion rate provided by the pump once a day and to determine the optimal bolus at mealtimes. We propose a switching strategy, such that we estimate the meal information at mealtimes, and the insulin sensitivity outside of meals. To validate the filtering procedure, we test our calculator on a virtual population of 9 patients with T1D. We furthermore test the ability of the basal-bolus calculator to handle sudden variations in the model parameters and to track variations in insulin sensitivity.
Methods
Basal-Bolus Calculator
Figure 1 illustrates the principle of the nonlinear and adaptive basal-bolus calculator presented in this article. This calculator uses CGM measurements. These measurements, the desired glucose level, and a physiological model of T1D are used to estimate the basal insulin infusion rate. The basal rate is updated once a day before breakfast. These data and the meal information announced at mealtime are used to compute the optimal bolus. Basal and bolus insulin amounts are sent to an insulin pump and administered to the patient.

The bolus calculator.
Physiological Model
In this article, we use the Medtronic Virtual Patient (MVP) model to design the basal-bolus calculator and to simulate a virtual population of patients with T1D.
13
This model is derived from the Bergman minimal model,
14
but has an improved identifiability.
15
It comprises 6 compartments in total: 1 compartment for subcutaneous insulin absorption,
where
For the purpose of simulating realistic CGM data for testing the basal-bolus calculator, we augment the MVP model with an extra compartment representing the interstitial glucose level and the noise-corrupted CGM model from Facchinetti and colleagues. 18 Figure 2 illustrates the MVP model augmented with the CGM model. Further information about the models and the model parameter values can be found in the literature.13,18,19

The Medtronic Virtual Patient (MVP) model.
Continuous-Discrete Unscented Kalman Filtering
The Kalman filter is used to estimate the states that are not directly accessible using a linear discrete-time model. 20 The extended Kalman filter (EKF) and the unscented Kalman filter (UKF) have been developed for state estimation in nonlinear discrete-time models. 21 In most applications, the UKF shows a better performance than the EKF. The UKF propagates the state and covariance estimates for a selected set of points (also called sigma points) spread around the mean value of the current state estimate such that the nonlinearities are more accurately propagated than for the EKF. The sigma points are chosen such that their propagation through the CDUKF gives more accurate predictions of the mean-covariance pair than the predictions of the mean-covariance pair through the EKF. The EKF and the UKF have been applied to diabetes, for instance to estimate plasma insulin based on glucose measurements, 22 for detection and bolus calculation of unannounced meals, 23 and more generally for estimation and prediction of insulin and blood glucose concentrations.24,25 Figure 3 illustrates the difference between the EKF and the UKF for computing the 1-step prediction of the state mean and covariance.

Illustration of the EKF and the UKF. The red circles represent the mean and the green circles depict the sigma points. The ellipses represent the 95% confidence intervals.
The UKF was initially designed for discrete-time systems. Sarkka presents a continuous-time and continuous-discrete unscented Kalman filter (CDUKF). 26 This section recalls the principle and the implementation of the CDUKF and describes its application for state and parameter estimation.
The CDUKF estimates the states of the system given a stochastic differential equation (SDE) continuous-time model and measurements at discrete times 27
in which
Parameter and Meal Size Estimation
We perform an online estimation of the parameters of the MVP model by augmenting our state vector with the insulin sensitivity,
where
Nevertheless, the insulin sensitivity and the meal size cannot be simultaneously estimated. For instance, if a sudden increase in blood glucose level occurs, it can be either attributed to a change in patient’s physiology (eg, an increased resistance to insulin) or to a meal intake. We use the following switching strategy to estimate these 2 states:
If no meal has been announced to the controller within the 3 previous hours, the filter will only estimate the insulin sensitivity,
If a meal has been announced to the controller within the 3 previous hours, the filter will only estimate the second meal compartment,
Computation of Basal and Bolus Insulin
Meals are the main factors for increase in blood glucose in patients with T1D. Therefore, a possible approach is to handle them in a different way than basal insulin administration. For instance, control strategies based on feedforward-feedback assume that the patient announces an estimate of the meal size to the controller.29,30 In this approach, the insulin administration can be separated between basal insulin and insulin boluses. Basal insulin compensates for the endogenous glucose production. It is determined by computing the steady state of the model, and is adjusted once per day to reflect the intrapatient variability. Insulin boluses are used to mitigate the postprandial glucose excursion. The bolus size is determined by the state estimate and the meal size announced by the patient.
At each time sample, the basal insulin infusion rate
for the glucose level
When a meal is announced to the controller at a given time
In this case, the predictions on the future states of the system are made using the continuous-time nonlinear model. The parameter
Results
We compare different bolus administration strategies in 3-day simulations. The scenario of the simulation is as follows:
Each day comprises 3 meals: 70g CHO at 6
The CDUKF is initialized at midnight the first day of the simulation.
The basal-bolus calculator is started at 6
From the second day, 1 mismatch in 1 of the model parameters is introduced. This mismatch consists of an increase or a decrease by 30% of 1 of the model parameters.
We use 9 of the 10 patients identified in Kanderian et al. 13 Since the simulated meal sizes are not consistent with a low-carbohydrates diet, patient 2, who was following a low-carbohydrates diet at the time of the study, is excluded from the simulations. We use the CGM model described in Facchinetti et al 18 to generate a population of patients with T1D. We use the same CGM noise sequence for all patients and all simulations for comparison purposes.
In the simulations, we test whether our basal-bolus calculator can handle the intrapatient variability in model parameters. Although a sudden change in the model parameters of 30% would not be observed in reality, this allows us to assess the basal-bolus ability to address extreme variations in physiology and mismatches between the model and the patient. We compare the performance of the basal-bolus calculator described in this article with a conventional bolus calculator described by (1). In the conventional bolus calculator, the insulin to CHO ratio,
Insulin-to-CHO Ratio and Correction Factor for a Conventional Bolus Calculator.
Tracking of Model Parameter Variations
Table 2 shows the median and interquartile time spent in range (70 < BG < 144 mg/dL) for the 9 simulated patients in the case where 1 model parameter varies. For every modified parameter, the nonlinear adaptive basal-bolus calculator shows a significant improvement compared to the conventional bolus calculator (P < .01). No hypoglycemia (BG < 70 mg/dL) has been reported in these simulations.
Comparison of Time Spent in Glucose Target (70 < G < 144 mg/dL) Between a Conventional Bolus Calculator and the Nonlinear Adaptive Basal-Bolus Calculator.
The numbers represent the median [interquartile range] percentage of time when 1 model parameter is modified. P values are computed using a paired t-test.
The total median time for all the considered scenarios is 51.0% [40.7% 64.9%] for the conventional bolus calculator and 60.8% [54.8% 72.5%] for the basal-bolus calculator. Overall, the CDUKF used in the basal-bolus calculator is able to handle variations in all model parameters by adjusting the insulin sensitivity only.
Tracking of Insulin Sensitivity Variations
Figure 4 shows the glucose and insulin traces (mean + interquartile ranges) in the case where the insulin sensitivity changes from the second day. Figure 4a depicts the case where the insulin sensitivity decreases by 30% and Figure 4b depicts the case where the insulin sensitivity increases by 30%. The glucose traces illustrate the ability of the basal-bolus calculator (red shaded area) to gradually adapt the basal insulin infusion rate to the new insulin sensitivity. Furthermore, the basal-bolus calculator provides a tighter glucose regulation than the conventional bolus calculator (blue shaded area).

Median glucose and insulin traces for the conventional bolus calculator (blue) and the nonlinear adaptive basal-bolus calculator (red). The shaded areas show the interquartile range. (a) Insulin sensitivity decreased by 30%. (b) Insulin sensitivity increased by 30%.
Figure 5 illustrates the ability of the CDUKF to track a step change in insulin sensitivity. The filter is able to track the change within a few hours and to correct the basal and bolus insulin accordingly. The tracking of insulin sensitivity also modifies the steady state solution of (5). As a consequence, the basal-bolus calculator can adapt the basal insulin to the patient needs.

Estimation of the insulin sensitivity for a patient in the case where it is decreased by 30% (top) and increased by 30% (bottom). The blue line represents the parameter estimate generated by the CDUKF. The red dashed line represents the actual parameter value.
Discussion
Usually, it has been shown that the CDUKF provides a faster and more accurate tracking of states and parameters than the continuous-discrete extended Kalman filter (CDEKF). Another popular filter is the particle filter. The particle filter requires a much larger computation time, and therefore may not be suitable for mobile platforms and fast sampling times. 32
The basal-bolus calculator can handle various sizes of meals. We tried very large meal intakes (up to 150g CHO at breakfast, lunch, and dinner) and got a similar improvement compared to the conventional bolus calculator (data not shown).
One of the major challenges of the basal-bolus calculator is the estimation of model parameters. As shown in the numerical simulations, the augmented model including a time-varying insulin sensitivity and the switching strategy between insulin sensitivity and meal content tracking allows to address most of the mismatches between the model and the actual glucose-insulin dynamics. In a more realistic clinical setup, the parameter estimation can be done at a lesser frequency, for example once a day, using maximum likelihood estimation or maximum a posteriori estimation.33-35 A previous work showed the feasibility of model identification using CGM data only. 35 The parameter estimation also allows to quantify the degree of uncertainty of the states, σ, which is then used in the CDUKF. Numerical simulations and replays of clinical studies can help to fine tune the parameter estimation procedure. Parameter estimation can be combined with the basal-bolus calculator presented in this article.
We have focused on the computation of the basal and bolus insulin. The presented basal-bolus calculator may be used as a part of an artificial pancreas (AP). Current prototypes of AP comprise a CGM, a control algorithm implemented on a mobile platform and an insulin pump. A large majority of clinical studies established a significant improvement of blood glucose regulation in patients with T1D when using an AP compared to an open-loop administration of insulin, regardless of the choice in the control algorithm (MPC, fuzzy logic, or proportional integral derivative).36-39 The control algorithm in the AP can be used in complement with the basal-bolus calculator to stabilize the blood glucose during the night and to suspend the administration of insulin in case of predicted hypoglycemia. 40 Moreover, the basal-bolus calculator can be used to estimate individualized patient information (total daily insulin, insulin sensitivity factor, insulin action time), such that adaptive tuning of AP control algorithms is possible.36,41,42
These simulations did not cover hyperglycemic events outside mealtimes or a prolonged postprandial hyperglycemia. The basal-bolus calculator can mitigate the hyperglycemia induced for instance by the dawn effect 3 or the Somogyi effect. 43 In case of hyperglycemia or predicted hyperglycemia, the basal-bolus can suggest the patient to administer a correction bolus. The size of the correction bolus can be determined in the same way as the prandial bolus by solving the optimization problem (6).
In the clinical studies, AP prototypes that include meal announcements globally provide a better performance in closed-loop than AP prototypes that do not have any meal announcement. 44 In case of an unannounced meal, a meal detector has the ability to detect the announced meal and to suggest a late bolus administration using the same calculator as the one presented in this article. Previously published articles demonstrated that nonlinear Kalman filters can also be used to detect unannounced meals or to compute the optimal bolus after the meal has been ingested.23,45 Nevertheless, the optimal time to administer the insulin bolus is usually at mealtime or even 10-15 minutes before, except for meals with high fat contents. 46
Conclusion
We used a continuous-discrete unscented Kalman filter on a nonlinear physiological model to design a basal-bolus calculator. The switching strategy between meal and insulin sensitivity estimation allows for a correct tracking of insulin sensitivity. The results show the potential of the method compared to conventional bolus calculators. Further studies on other models and replays of clinical studies will be required before the basal-bolus calculator can be considered as a part of an AP and tested in a clinical study.
Footnotes
Abbreviations
AP, artificial pancreas; CDEKF, continuous-discrete extended Kalman filter; CDUKF, continuous-discrete unscented Kalman filter; CGM, continuous glucose monitor; CHO, carbohydrates; EKF, extended Kalman filter; MDI, multiple daily injections; MPC, model predictive control; MVP, Medtronic Virtual Patient; T1D, type 1 diabetes; UKF, unscented Kalman filter.
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 has been funded by the Danish Diabetes Academy supported by the Novo Nordisk Foundation.
