Smith Predictor Sliding Mode Closed-loop Glucose Controller in Type 1 Diabetes ★

Type 1 diabetic patients depend on external insulin delivery to keep their blood glucose within near-normal ranges. In this work, two robust closed-loop controllers for blood glucose regulation are developed to prevent the life-threatening hypoglycemia, as well as to avoid extended hyperglycemia. The proposed controllers are designed by using the sliding mode control technique in a Smith predictor structure. To improve meal disturbance rejection, a simple feedforward controller is added to inject meal-time insulin bolus. Simulations scenarios were used to test the controllers, and showed the controllers ability to maintain the glucose levels within the safe limits in the presence of errors in measurements, modeling and meal estimation.


INTRODUCTION
Type 1 diabetes mellitus (T1DM) is a metabolic disease characterized by the pancreas inability to produce the glucose-regulating hormone, the insulin.Therefore, T1DM treatment consists mainly in administrating exogenous insulin to achieve near-normal glucose levels.If glucose is not carefully controlled within a tight range, chronic (e.g.cardiovascular diseases, nephropathy, and retinopathy), and acute (e.g.hypoglycemic coma) complications can occur.The progress in insulin pumps and continuous glucose monitoring (CGM) systems has encouraged the development of the artificial pancreas (Bequette [2005]).The artificial pancreas consists of a CGM, a closed-loop controller, and an insulin pump.The closed-loop artificial pancreas will improve the patients' quality of life (e.g.greater flexibility in meal times, carbohydrate (CHO) quantities, and physical activities), and will reduce the risk of T1DM complications.
A wide range of control algorithms was proposed to close the loop (extensive reviews are given in Bequette [2005], Chee and Fernando [2007], Takahashi et al. [2008]).However, there exist many physiological and technical factors that make it very difficult to find a general and reliable controller for the blood glucose (BG) control problem.These factors include the limitations of the subcutaneous (SC) route used for glucose sensing and insulin delivery (e.g.time delays and CGM measurement errors), system nonlinearity, and uncertainty in insulin-glucose system modeling.Such problems in the BG control highlight the need for an advanced controller.A controller that shows a level of robustness sufficient to deal with modeling errors and other sources of disturbance and uncertainty, and ★ The work was supported by a (BR) research grant to the first author from the University of Girona at the same time, has a predictive nature to deal with physiological and measurements delay, and to provide a proactive control action to avoid high fluctuations in BG.
In this work, a controller that uses a combination of the robust sliding mode control (SMC) and the Smith predictor (SP) structures, is proposed as a competitive candidate to achieve the required performance.The SP's prediction and time delay compensation virtues, and the robustness of SMC are merged in one structure (SP-SMC controller).To avoid the limitation of purely reactive control, and to improve the controller response against meal disturbance, a static feedforward control (i.e.meal announcement) is added to inject meal-time insulin bolus.

PATIENT MODELING
Different models with different structures and degrees of complexity are being used to describe the glucoregulatory system (see for instance Bergman et al. [1979], Hovorka et al. [2004], Dalla Man et al. [2007]) .In this work, two nonlinear models have been used to represent the diabetic patient (virtual subject).

The Meal Model
The Meal model developed by Dalla Man and coworkers in Dalla Man et al. [2007] incorporates a complex network of compartments.The model considers that the glucose and insulin subsystems are interconnected by the control of insulin on glucose utilization and endogenous production.The glucose subsystem is described by a two-compartment model as is the insulin subsystem.Endogenous glucose production, glucose rate of appearance, and glucose utilization are the most important model unit processes.The model was modified to adapt for T1DM subjects, SC glucose measurements, and exogenous insulin delivery.
The modified model was implemented in the UVa/Padova metabolic simulator (Kovatchev et al. [2009]), designed to support the development of closed-loop artificial pancreas.In addition to the patient model, the simulator incorporates a sensor-related errors model to account for sensor noise and measurements errors (Kovatchev et al. [2009]).

The Hovorka Model
The second model was developed by Hovorka and coworkers in Hovorka et al. [2002Hovorka et al. [ , 2004]].It is a physiological model validated with experimental data.It consists of three subsystems: the CHO absorption, the subcutaneous insulin absorption, and the glucose-insulin kinetics.The insulin actions describe the effect of insulin on glucose transport, removal and endogenous production.The model shows a good trade-off between simplicity and accuracy.

Subcutaneous glucose measurements
The output of the model above is the glucose level in blood, ( ).Therefore, due to our interest in using the SC route, it is necessary to consider the glucose level in SC tissue, and the CGM errors.The CGM signal, ( ) is modeled with added errors and time delay ( = 10 min): The model in Breton and Kovatchev [2008] is used to describe the sensor-related errors, and is given by: ( ) = 0.7( ( − 1) + ( )) (3) where ( ) is a non-white, non-Gaussian sensor error., , and are the parameters of the Johnson distribution.( ) is white noise and (3) is the autocorrelation function.

Model Identification
The two models are used for controllers design and testing; data obtained from the nonlinear models are used in the identification of lower order linear models for controllers design, then, the designed controllers are tested with the nonlinear models.Although the Meal model has a more complex structure, the Hovorka model exhibits a more nonlinear behavior -due to the activation/deactivation nature of some model parameters.Also, the Hovorka model has a higher dynamic.Based on the results of the identification procedure and previous experience with the used models, the identified linear models have different orders and time delays.For the Meal model, a first order plus time delay (FOPTD) is used to represent the insulin-BG system: For the Hovorka model, a second order plus time delay (SOPTD) is identified to approximate the insulin-BG system: where ( ) and ( ) are deviations of glucose level and insulin infusion from the chosen basal point ( 0 , 0 ).1,2 are the models gains, 1,2,3 are the time constants and 0 1,2 are the time delays.

The SMC & SP components
SMC is a simple procedure to synthesize robust controllers for linear and nonlinear processes based on principles of variable structure control (VSC).The design problem consists of selecting the parameters of each controller structure and defining the switching logic.The first step in SMC is to define a sliding surface ( ), along which the process can slide to its desired final value.The sliding surface divides the phase plane into regions where the switching function ( ) has different signs.The structure of the controller is intentionally altered as its state crosses the surface in accordance with a prescribed control law.SMC controller exhibits good robustness against parameter variations (Garcia-Gabin et al. [2010]), and has been used to design controllers based on its robustness against modeling errors and disturbances.
The SP scheme is a type of predictive controller for systems with pure time delay, that needs a model of the system dynamics and an estimate of its time delay 0 .In the SP structure, the control signal passes through two parallel paths (Figure 1); one passing through the real system (the patient), and the other through the identified model, ( ).The parallel path containing the model is used to generate the difference ( ) between the actual system output ( ) and an estimation (modelbased prediction) of the control signal effect on the system output ( ).The SP scheme uses the model to predict the delay-free response of the system − ( ).Then, it compares this prediction to the desired setpoint to decide the required control action.To avoid drifting and reject external disturbances, the SP also compares the actual system output with a prediction that takes the time delay into account.The overall error signal ( ) is delivered to the controller to calculate the needed adjustments.

SP-SMC Controller design
The main components of the proposed closed-loop controllers (e.g.feedback SMC, SP structure, and feedforward loop), and the variables used throughout the work are given in Figure 1.
First order SMC To design the first SP-SMC controller, the FOPTD transfer function in (4) is used.Given the model ( 4), it can be factorized in the following way: The first factor + 1 ( ) corresponds to terms of the model 1 ( ) that lead to instability and realisability problems (e.g. term containing time-delay).The second one, − 1 ( ), corresponds to terms of the model that can be used to design the controller.This procedure eliminates all elements in the process model that can produce an unrealisable controller.− 1 ( ) eliminates the time-delay term from the model (4), and + 1 ( ) and − 1 ( ) are defined as This factorization facilitates the SMC design because developing a SMC for systems with time delay requires using approximations for time delay (Camacho et al. [1999]).The first step to design a SMC is to define the surface ( ).In general, the sliding surface represents the system behavior during the transient period, therefore, it must be designed to represent the desired system dynamics, for instance stability and tracking performance.In this work, the sliding surface presented in Camacho et al. [1999] is used: where is the system order, ( ) is the tracking error and is a tuning parameter, which helps to shape ( ).This term is selected by the designer.This surface, consisting of the integral-differential error function, is frequently used because it provides a good performance in practical applications of SMC (Garcia-Gabin et al. [2010]).For the first-order system in (8), the sliding surface (9) will be: where the error ( ) = ( ) − ( ( ) − 1 ( )) − − 1 ( ), ( ) is the glucose reference.
1 ( ) is the glucose estimation using (4), − 1 ( ) is the glucose estimation using (8), and both are deviations variables from the basal point ( 0 ).The SMC control law contains two parts: a continuous part ( ), and a discontinuous part ( ), so that The first of these is responsible for maintaining the controlled system dynamics on the sliding surface, which represents the desired closed-loop behavior.The method normally used to generate the equivalent SMC law ( ) is Filipov construction of the equivalent dynamics.It consists of satisfying the sliding condition and substituting it into the system dynamic equations; the control law is thereby obtained.The control objective is to ensure that the controlled variable is driven to its reference value.It means that, in the stationary state, ( ) and its derivatives must be zero.This condition is satisfied when: Once the sliding surface has been selected, attention must be drawn to the design of the control law that drives the controlled variable to its reference value and satisfies (12).Applying the sliding condition ( 12) to (10): and solving for the first derivative and considering the nominal case ( ( ) − 1 ( ) = 0), we obtain Then substituting ( 14) in the equivalent differential equation of the model ( 8), which is and solving for 1 ( ) to obtain the continuous part of the controller (Garcia-Gabin et al. [2010]): The expression for 1 ( ) can be simplified making zero the derivatives of the reference.
The derivative computation in many controller implementations should be based on the value of the process variable itself.Because when setpoint changes (step changes), derivative on setpoint results in an undesirable control action called derivative kick (Smith and Corripio [1997]).Also, concerning practical implementation issues, a natural continuous approximation of the signum function is used for the discontinuous part ( ), to avoid the chattering problem (Garcia-Gabin et al. [2010]).This is the sigmoid-like function: where is a tuning parameter used to reduce the chattering problem (a non-decreasing oscillatory component of finite amplitude and frequency).Finally, the resulting control law is given as: Second order SMC To design the second controller, the SOPTD model in ( 5) is used.First, the model is factorized as follows: The next step is to formulate the sliding surface.For the second order model in ( 21), the second order ( ) is (Camacho et al. [1999]): where 1 and 2 are tuning parameters of ( ).The next step is to formulate the control law for the second order SMC.From the sliding condition in ( 12): then solving for the highest derivative, and considering the nominal case ( ( ) − 2 ( ) = 0): Now, substituting (24) in the equivalent differential equation of the model ( 21): and solving for 2 ( ), gives the continuous part of the control signal: ( 2 ( ) ) Since a constant ( ) is used, the first and second derivatives are equal to zero, and 2 ( ) can be further simplified.The final formulation of the control law of the second order SMC is: Following Camacho et al. [1999] and Garcia-Gabin et al.
[2010], the following initial tuning parameters can be used to adjust the designed controllers: For the discontinuous part of the controllers, the gain will be selected so that > 0. This value must be high enough to cancel the disturbances.The initial values for 1,2 were selected as in (Garcia-Gabin et al. [2010]): Feedforward controller Meals usually lead to a significant glucose flux into the blood.To achieve a better postprandial performance (i.e.avoid high glucose excursions after meal intakes), the SP-SMC is provided with a feedforward loop for meal announcement.Feedforward control is a well-known control technique to eliminate the effect of measurable sources of disturbance.In the BG problem, the meal CHO is considered as a known disturbance, and feedforward control can be used.The benefit of meal announcement in improving the postprandial performance has been verified in different studies (see for example Marchetti et al. [2008], Abu-Rmileh et al. [2010a,b]).To design a feedforward controller, the effect of meal CHO on BG level should be known or approximated.Two FOPTD models are identified to represent the CHO-BG system in the Meal and Hovorka models, 1 ( ) and 2 ( ) respectively.The general formula of the obtained transfer functions is given by: where ( ) is the glucose increment caused by the meal, ( ) is the CHO amount in the meal, , and 0 are the model parameters.The objective of the feedforward controller ( ) is to eliminate the effect of ( ); Where ( ) is the transfer function of the feedforward element.For the Meal model, which is represented by another FOPTD model in the insulin-BG system (4), 1 ( ) is given by Where 1 = − 1 / 1 , and 0 1 = 0 1 − 0 1 .Another formula that can be used is the static feedforward, which does not consider the dynamic behavior of 1 ( ) and 1 ( ).Using static feedforward, 1 ( ) and 1 ( ) are limited to their constant gain values, and the obtained static feedforward element will be a simple gain ratio multiplier: The feedforward action is given by: For the Hovorka model, which is approximated by a SOPTD model in the insulin-BG system (5), 2 ( ) will be: where 2 = − 2 / 2 , and 0 2 = 0 2 − 0 2 .The transfer function in ( 35) is unrealizable, and it should be approximated.When there are uncertainties in the lead-time constant and lag-time constant, then a better performance is obtained by using a static feedforward, since the performance of dynamic feedforward is affected by uncertainties in the time constants obtained by approximation (Smith and Corripio [1997]).Therefore, the static 2 ( ) and the static 2 ( ) will be: When feedforward is performed as a static bolus, the entire calculated insulin dose can be delivered into the blood stream with the least possible delay.It was found that both dynamic and static feedforward improves the meal disturbance rejection, with the latter being superior (Abu-Rmileh et al. [2010a]).Thus, the static feedforward is adopted in this work.Finally, the total insulin dose delivered to the patient will be (as shown in Figure 1): 4. RESULTS

In silico testing
To explore the applicability of the designed controllers, they have been tested with the nonlinear patient models, while the identified models served as internal models for the controllers.The simulations considered a 2-days testing period.For the first day, the meals were 55, 85, and 75 g of CHO at 9:30 AM, 1:30 PM, and 7:30 PM, respectively.In the second day, 60, 90, 85, and 55 g CHO were taken at 7:00 AM, 12:30 PM, 7:00 PM, and 10:00 PM, respectively.A constant target BG value of 120 mg/dl is used.The CGM signal is used to drive the controllers, while the BG level is used to evaluate their performance.The models and controllers parameters used in the simulations are given in Table 1.
To evaluate the controllers performance in the presence of different sources of noise, disturbance and uncertainty, the simulation results are analyzed using the Percentage within ranges metrics.These metrics give the percentage of the testing period during which the patient's BG is within the acceptable (70-180 mg/dL), hypoglycemic (< 70 mg/dL), and hyperglycemic (> 180 mg/dL) ranges.To study the feasibility of the proposed controllers, two controllers' modes (fully automatic and semi-automatic) have been tested and compared.The fully automatic system (i.e.feedback-alone controller) does not need any input from the patient, and depends on the CGM signal only.The semi-automatic system needs the patient intervention to tell that a meal is coming up and the control algorithm needs to change (i.e.feedforward-feedback controller).The feedforward action is performed by injecting an insulin bolus (0-20) min before the meal.The feedback-alone setup is tested as a possible case where the SP-SMC should operate out of the nominal conditions (i.e.no meal announcement).From the results shown in Figure 2 and Table 2, a better performance is obtained when the feedforward control is active.Since the feedforward action starts to deliver insulin before the meals effect appears in the CGM feedback loop, lower hyperglycemic peaks and lower fluctuations in BG levels are observed.Without meal announcement, the feedback-alone controller is still able to achieve acceptable performance; no hypoglycemic events are detected, and only short periods of hyperglycemia are observed.Numerical results in Table 2 indicate that the semi-automatic feedforward-feedback SP-SMC shows a superior performance over the fully automatic feedbackalone configuration, highlighting the limitations of purely reactive controllers.Meal announcement provides better results, however, it is not uncommon that patients forget to activate the meal bolus.Therefore, meal detection algorithms are developed to improve the control outcomes without requiring patient intervention (Lee et al. [2009]).

Meal estimation errors
Although the meal announcement is important to calculate the required feedforward control signal, the announcement may contain erroneous information about the meal contents.Therefore, the controller should have a good level of robustness against errors in estimating the meal CHO.The designed SP-SMC controllers have been tested with random over-and underestimation errors up to 30% in meal announcement (the error is included in the controllers announcement while the correct meal is given to patient).Figure 3 shows the glucose levels obtained for the patients with the ±30% errors.For the three scenarios (nominal meal, overestimation, and underestimation), the controllers are able to keep the BG level within the safe glycemic range during the testing period (See Table 2).The controllers performance is not affected by small and moderate estimation errors, while only minimum degradation is noticed near the boundaries of ±30% errors.

CONCLUSION
This study presented a closed-loop control approach for insulin delivery in T1DM based on SP-SMC methodology applied to virtual diabetic subjects.The proposed SP-SMC strategy is as simple as a PID controller in its formulation and implementation but has some advantages over it such as accuracy and robustness, insensitivity to internal and external disturbances, and finite time convergence.Such features make SP-SMC suitable for the BG control problem which incorporates many sources of uncertainty and disturbances, and imposes some specific time requirements to avoid hypo-and hyperglycemia.
Another important feature of SP-SMC that is not common in other glucose controllers, is the direct relation between the controller structure and the model parameters.Such explicit relation facilitates the tuning of the controller.
The conducted simulations indicate that, with a good lower-order approximation of the nonlinear model, the SP-SMC achieves tight glycemic control with no hypoglycemic events.Future work aims at testing the controllers' ability to deal with other sources of errors and uncertainty that exist in the glucose control problem.

Table 1 .
Models and controllers parameters.