Projects:2019s1-158 Artificial Pancreas System for People with Type 1 Diabetes
Contents
Introduction
Background
For type1 diabetes patients, their pancreas can supply very little or no insulin because the beta cells in their pancreas are damaged. Insulin is a hormone made by the pancreas, which can convert the sugar to energy. If the patients don’t have the insulin, they can not convert the sugar to energy, which will increase the blood sugar lever. It will cause some diabetes complications such as it will affect patient’s eye, brain, kidney, heart, neuropathy and extremities.. The treatment is insulin replacement therapy. The earliest treatment is multiple daily injection (MDI) which is defined as the administration of three or more insulin injections per day. This includes one injection of long-acting insulin in the evening and an injection of rapid or short-acting before each meal. Then there is a more advanced method called conventional insulin pump which allows the user to set different pre-programmed basal rates of insulin delivery to match the individual’s changing insulin needs. Moreover, insulin pumps allow for meal insulin to be delivered in different amount, to suit meals of different nutrient composition and absorption. And the insulin can either be delivered immediately or over several hours. These features make the amount of insulin delivery more accurate. Furthermore, most insulin pump devices have alarms to alert the user in case of the blood glucose level is too low or some technical malfunctions, which means this treatment is safer than multiple daily injection. And then the insulin pump can be used with CGM (continuous glucose monitoring) This approach is called sensor-augmented pump (SAP). In this approach, the glucose level is measured every 1 to 5 minutes, and the glucose values are sent to pump, then the user can adjust insulin pump delivery based on CGM. This treatment can make the amount of insulin delivery more accurate and increase the safety.
Aim
The aim of this project is to implement a closed loop pump control system which can autonomously and gradually adjust the rate of insulin delivery of insulin pump according to real-time sensor glucose levels. The system model has been published into academic literature and the algorithms will be implemented in Android Artificial Pancreas System (AndroidAPS) which is used by about hundreds of type 1 diabetes patients worldwide.
Motivation
The motivation for this project is that it can affect the lives of many type 1 diabetes patients positively. In the previous treatments like multiple daily injections, conventional insulin pump and sensor-augmented pump which will be introduced below, the patients do not know or only know the value of their glucose level. They have no idea how much insulin they need to deliver in order to maintain their glucose level in a target range. However, the closed loop pump control system can adjust the rate of insulin delivery autonomously and gradually according to real-time sensor glucose level, which means it is more accurate and safer.
Objectives
1. Find the appropriate type 1 diabetes simulator
2. Decide which part of AndriodAPS algorithm need to be improved
3. Find the appropriate system model
4. Program the chosen model
5. Add the algorithm into AndriodAPS algorithm
6. Add the function of meal detection in the algorithm
Literature reviews
Treatment
Type 1 diabetes cannot be cured. The only treatment for type 1 diabetes is insulin replacement therapy. The earliest treatment is multiple daily injections (MDI) defined as accepting several times (usually four times) of insulin injections every day. There are mainly two types of insulin applied in MDI. One is long-acting insulin, which is injected in the evening, the other is rapid-acting insulin which is injected before each meal. For long-acting insulin, the absorption rate is slow and lasts long, and there is no obvious peak effect, so it is used to instead the basal insulin secretion. For rapid-acting insulin, the absorption rate is quick, and the peak effect happens around one hour after the injection, so it is used to instead the insulin secretion for the mealtime. Then there is a more advanced treatment called conventional insulin pump which is also known as continuous subcutaneous insulin infusion. It allows the user to set different basal rates of insulin delivery to match the individual’s changing basal insulin needs. Furthermore, the insulin pump can supply meal insulin in different bolus profiles to suit different meal since different meal has different composition and absorption rate. There are three types of bolus profiles. It can be either immediate, or several hours, or a combination of two types. Moreover, most of the insulin pump have alarms device to alert the user in cases of the blood glucose level is too low or some technical malfunctions. Compared with the treatment of multiple daily injections, conventional insulin pump can deliver a more accurate amount of insulin and prevent hypoglycemia better which means safer. The insulin pump can be used with continuous glucose monitoring (CGM) sensor, and this treatment is called sensor-augmented pump (SAP). The CGM sensor can measure the glucose level every 5 minutes, and then the data is sent to the insulin pump, and then the user can adjust insulin delivery based on CGM data. Since the user can adjust the amount of insulin delivery according to the real-time glucose value, this approach is much more accurate and safer than the conventional insulin pump. Closed-loop control system which is known as artificial pancreas system is more advanced than a sensor-augmented pump. Although the sensor-augmented pump user can get glucose data from CGM sensor, they still do not know how much insulin is required. The closed-loop control system can solve this problem. The components of the closed-loop control system are a CGM sensor, an insulin pump and a control algorithm embedded in pump or a device. Firstly, the CGM will measure the blood glucose level, then the glucose values will be sent to the device, and the algorithm will process the data and output a command to the pump to deliver an appropriate amount of insulin. The artificial pancreas system can autonomously and gradually adjust the rate of insulin delivery of insulin pump according to the real-time CGM data, so it is more accurate and convenient than sensor-augmented pump.
OpenAPS
OpenAPS is a simplified artificial pancreas system. It is open source which means anyone can modify the algorithm and use it. Android artificial pancreas system (AndroidAPS) uses the OpenAPS algorithm to allow the user to use android application to control their blood glucose level. There are two algorithms in OpenAPS. One is OpenAPS Reference Design Zero (oref0) which is a basic algorithm. The other is OpenAPS Reference Design One (oref1) which is an advanced algorithm. In algorithm oref0, the insulin can be delivered in two ways, bolus and basal. The logic of algorithm oref0 is to use the duration of insulin action (DIA), the history of bolus and basal, and insulin on board (IOB) curve to calculate the current IOB. Then use current IOB, insulin sensitivity factor (ISF) and current blood glucose (BG) to predict the eventual BG. The equation of eventual BG calculation is shown below. Then the algorithm will add or reduce or cancel the basal according to the eventual BG, target BG and the change of current BG. Furthermore, the bolus must be implemented manually to counteract the meal effect. This increase safety.
current BG – (ISF * IOB) = eventual BG
The algorithm oref1 is based on oref0. The major difference is that oref1 use supermicroboluses (SMB) of insulin to counteract the increase of glucose level due to the meal. This method can better control the use of amount of insulin which can prevent the excess insulin, control the blood glucose level better and increase safety.
Three widely used models
Bergman Model
The Bergman model is a measurement model which is designed to describe the intravenous glucose tolerance so there is no subcutaneous insulin absorption model and carbohydrate absorption model. The algorithm for insulin action model is shown below.
(X(t)) ̇=-p_2 X(t)+p_3 (I(t)-I_b)
The algorithm for glucose metabolism model is shown below.
(G(t)) ̇=-(p_1+X(t))G(t)+p_1 G_b+(U_G (t))/V_G )
I(t) is the concentration of insulin in blood, G(t) is the concentration of glucose in blood, I_b is the concentration of basal insulin, p_1 G_b is the constant hepatic glucose production, (U_G (t))/V_G is the intravenous glucose infusion, p_1,p_2 and p_3 are kinetic parameters.
Hovorka Model
The algorithm for subcutaneous insulin absorption model is shown below
(S_1 (t) ) ̇=U_SC (t)-(S_1 (t))/t_maxl
(S_2 (t) ) ̇=(S_1 (t))/t_maxl -(S_2 (t))/t_maxl
(I(t) ) ̇=(S_2 (t))/(t_maxl V_I )-k_e I(t)
S_1 (t) and S_2 (t) are the insulin in subcutaneous, t_maxl is time constant, V_I is the volume of insulin distribution, k_e is the rate of fractional elimination. After applying the Laplace transform and inverse Laplace transform. The equation becomes
I(t)=(U_SC (t))/〖t_maxl〗^2 e^((-2/t_maxG -k_e)t)
The subcutaneous insulin absorption model has the same structure as the carbohydrate absorption model. The algorithm for insulin action model is shown below
(X_1 (t) ) ̇=-k_a1 X_1 (t)+k_b1 I(t)
(X_2 (t) ) ̇=-k_a2 X_1 (t)+k_b2 I(t)
(X_3 (t) ) ̇=-k_a3 X_1 (t)+k_b3 I(t)
X_1 (t), X_2 (t), X_3 (t) are effects of insulin on glucose transport, glucose disposal and endogenous glucose production respectively, k_a1, k_a2, k_a3 are kinetic constants and k_b1, k_b2, k_b3 are insulin sensitivities multiply the kinetic constants. The algorithm for glucose metabolism is shown below
(Q_1 (t) ) ̇=-X_1 Q_1 (t)+k_12 Q_2 (t)-F_01^C (t)-F_R (t)+U_G (t)+〖EGP〗_0 (1-X_3 (t))
(Q_2 (t) ) ̇=X_1 Q_1 (t)-k_12 Q_2 (t)-X_2 (t)Q_2 (t)
G(t)=(Q_1 (t))/V_G
Q_1 (t) and Q_2 (t) are glucose in blood and tissue respectively, k_12 is the rate of transport, U_G (t) is the meal glucose, 〖EGP〗_0 (1-X_3 (t)) is the production of hepatic glucose, F_01^C (t) is the consumption of insulin, F_R (t) is the elimination of renal glucose, V_G is the volume of glucose distribution
Identifiable Virtual Patient Model
The Identifiable Virtual Patient Model is based on Bergman model. The glucose metabolism model and insulin action model in Identifiable Virtual Patient Model are equivalent to Bergman model. The carbohydrate absorption model in Identifiable Virtual Patient Model is almost the same as Hovorka model. The only difference is that the Identifiable Virtual Patient Model replaces the mass rate by concentration rate through dividing by the volume of glucose distribution V_G. The algorithm for carbohydrate absorption model is shown below
R_A (t)=(D_G A_G te^(-t/t_maxG ))/(V_G 〖t_maxG〗^2 )
The algorithm for subcutaneous insulin absorption model is shown below
(I_SC (t)) ̇=-(I_SC (t))/τ_1 +(u_SC (t))/(τ_1 K_cl )
I(t)=-I(t)/τ_2 +(I_SC (t))/τ_2
After applying the Laplace transform and inverse Laplace transform, the equations can be expressed like a Two-Compartmental Model. The equations are shown below
(dq_1 (t))/dt=u_sc (t)-1/τ_1 q_1 (t)
(dq_2 (t))/dt=1/τ_1 q_1 (t)-1/τ_2 q_2 (t)
I(t)=1/(τ_2 K_cl ) q_2 (t)
q_1 (t) and q_2 (t) are the insulin mass in subcutaneous and blood respectively. K_cl is the insulin clearance. The algorithm for insulin action model is shown below
(I_E (t)) ̇=-p_2 I_E (t)+p_2 S_I I(t)
The algorithm for glucose metabolism model is shown below.
(G(t)) ̇=-(GEZI+I_E (t))G(t)+EGP+R_A (t)
Method
Base artificial pancreas system
The first choice of base artificial pancreas system is OpenAPS because it is open source which allow people to improve the algorithm of it. Furthermore, the AndroidAPS is based on an Android application, which use the algorithm of OpenAPS to build its artificial pancreas system. Therefore, it is necessary to choose one between OpenAPS and AndroidAPS. Finally, AndroidAPS is determined to be the base artificial pancreas system of our project. There are two main reasons why AndroidAPS is better than OpenAPS. Firstly, OpenAPS requires rig hardware like Edison board. However, AndroidAPS do not require any hardware and it can operate on virtual android device which means it is not necessary to get an actual Android device. Secondly, AndroidAPS has three algorithms while OpenAPS only has two algorithms. AndroidAPS has an extra advanced algorithm called SSMB. After AndroidAPS is determined, it is necessary to determine the integrated development environment and programming language. Android Studio is chosen as the integrated development environment in this project because it is used to develop Android application and has the function of virtual android device. Furthermore, JavaScript is determined to be the programming language in this project because the programming language used in AndroidAPS is JavaScript.
Carbohydrate effect on blood glucose level
After determining the base artificial pancreas system and type 1 diabetes simulator, it is necessary to determine which part of the algorithm in base artificial pancreas system should be improved. After reading a lot of literature reviews, we decide to improve the part of the algorithm that carbohydrate effect on glucose level in this project. The main reason is that there are many different models describing the carbohydrate effect on blood glucose level. All these models have different algorithm which result the curve of the change of blood glucose level due to carbohydrate intake are different. To determine the best model implemented in AndroidAPS, the blood glucose level change due to carbohydrates in different model is investigated. Three model algorithms were tested. The first one is SSMB in AndriodAPS, the second one is Two-Compartmental Model and the third one is Hovorka Model.
Result
For Two-Compartmental Model, the blood glucose level change due to carbohydrate intake with the change of time is shown in Figure 11. The blue line represents the case of carbohydrate intake amount is 10g. The red line represents the case of carbohydrate intake amount is 20g. The orange line represents the case of carbohydrate intake is 30g. From Figure 11, it can be found the blood glucose increases fast firstly, and then decreases slowly. The change is not linear. With the increase of carbohydrate intake, the higher blood glucose level it will reach.
For Hovorka Model, the blood glucose level change due to carbohydrate intake with the change of time is shown in Figure 12. The blue line represents the case of carbohydrate intake amount is 10g. The red line represents the case of carbohydrate intake amount is 20g. The orange line represents the case of carbohydrate intake is 30g. From Figure 12, it can be found the blood glucose level increases linearly firstly, and then decrease. The rate of decrease is large firstly and then become small. With the increase of carbohydrate intake, the higher blood glucose level it will reach.
Conclusion
These two models provide alternative methods of glucose control. As the insulin sensitivity and effect of carb vary with different patient, these two models might be more suitable for some patients.
Project team
Project students
- Yuxiang Lin
- Shuochun Zhang
Supervisors
- Mathias Baumert
Advisors
- Cheng-Chew Lim
Definitions and Abbreviations
- MDI
- SAP
- CGM
- APS