Tuning of Digital PID Controller for Blood Glucose level of Diabetic Patient Rohit Sharma
Sumit Mohanty
Amlan Basu
Research Scholar (M.Tech) Department of Electronics and Communication Engineering ITM University Gwalior, Madhya Pradesh 474001, India
[email protected]
Assistant Professor Department of Electronics and Communication Engineering ITM University Gwalior, Madhya Pradesh 474001, India
[email protected]
Research Scholar (M.Tech) Department of Electronics and Communication Engineering ITM University Gwalior, Madhya Pradesh 474001, India
[email protected]
Abstract – This paper is based on designing of digital Proportional-integral derivative (PID) controller which controls the blood glucose level of diabetic patient. The main objective is to design a digital PID controller using tuning rules like Ziegler-Nichols and Cohen-Coon method. The responses are studied & parameters are compared. Best response given by the PID is converted into Digital PID. Different transformation methods are also studied to convert the conventional PID into the digital PID controller. Keywords- Digital PID controller, diabetic patients, Blood Glucose, Ziegler-Nichol, Cohen-Coon, MATLAB simulation.
I.
INTRODUCTION
In present scenario, diabetes affects millions of people all around the world. Because of diabetes most of the people are facing a lots of problem like weakness, hypertension, coronary heart disease, polyneureopathy, kidney problem, increase chances of secondary infection, blindness and so on. Basically diabetes or diabetes mellitus is a systematic disorder characterized by high blood glucose above normal range (normal range is 60mg/dl to 120mg/dl). Diagnostic criteria of diabetes mellitus isa)oral glucose tolerance test –more than 200mg/dl b)fast blood glucose level-more than 126mg/dl c)random blood sugar –more than 200mg/dl d)hbA1c-more than 6.8%, it is the best parameter to know about diabetic control[1]. There are two types of diabetes are commonly occur Type 1 diabetes and Type 2 diabetes. Type 1 diabetes normally occurs to the below 40 years age of people. Diabetes has autoimmune condition and this autoimmune condition generates the antibodies .These antibodies destroys the beta cell so that the insulin is not produce in appropriate
amount which body requires .Due to insufficient production of insulin these type of person suffer from type 1 diabetes. Hence we can externally apply the insulin in the form of injection and by using digital proportion-integral derivative (PID) controller[1][3]. Type 2 diabetes generally occurs among people of 40 years above .It occurs due to the insulin receptors down regulation so that resistance of insulin occur, it generally happen in those person having heavy weight as body weight is inversely proportional to the no. of receptors[1]. Gestational diabetes generally occurs in pregnant woman. During pregnancy hyperglycemia increases so that it affects the offspring (babies). Hyperglycemia is another disease ,it is due to high blood glucose level (above 180 mg/dl) on the other hand Hypoglycemia is opposite to hyperglycemia it occur due to low blood glucose level(less than 60 mg/dl)[2]. Digital PID controller which is used to externally apply insulin in appropriate amount to diabetic patient. Basically this digital PID controller is a automatic device which can work according to the set point which is at normal range of blood glucose level. If diabetic patient has blood glucose level is above or below the set point so that this digital PID controller first sense the blood glucose level, if it is above or below blood glucose level than it automatically controls the blood glucose level in normal range by giving the appropriate amount of external insulin. II.
MATHEMATICAL MODELING OF BLOOD GLUCOSE LEVEL FROM DIFFERENTIAL EQUATION
Consider the blood glucose equation by obtained of differential equation. The differential equation of blood glucose equation as given below [4]r(t)=
𝑑3𝑐 𝑑𝑡
3 +6
𝑑2𝑐 𝑑𝑡
2 +5
2 1.5 1
𝑑𝑐
(1)
𝑑𝑡
Now we convert this differential equation into laplace domain by using forward laplace transform. This transform can be applied as-
0.5 0 -0.5 -1 -1.5
𝐶(𝑠) → 𝐿{𝑐 𝑡 ; 𝑡 → 𝑠}
-2 -5
𝑅(𝑠) → 𝐿{𝑟 𝑡 ; 𝑡 → 𝑠}
-4.5
-4
-3.5
-3
-2.5
-2
-1.5
-1
-0.5
0
Figure 2. Input step stability response of blood glucose level of diabetic patient.
By applying above this substitution, we get
Bode Diagram
𝑅 𝑠 = 𝑠 𝐶(𝑠) + 6𝑠 𝐶(𝑠) + 5𝑠𝐶(𝑠)
(2)
Simplifying this above equation in transfer function form, we get𝐺𝑐 𝑠 =
𝑅(𝑆) 𝐶(𝑆)
=
1
5
Amplitude
4
3
2
1
5
10
15 Time [sec]
-200
-135 -180
-270 -4
10
-2
10
0
10 Frequency
6
0
-100
-225
(3)
𝑆 3 +6𝑆 2 +5S
This equation (3) shows the transfer function of blood glucose level of diabetic patient. Simulating this equation (3) in matlab, we get step response of blood glucose level of diabetic patient as shown in figure 1.This figure shows the blood glucose insulin system has taken more settling time to settle down to steady state ,it means that system takes more time to reach steady state of the system is more also the steady state error value is high, so we can use digital PID controller to overcome the steady state error and we can also get accurate step response with less rise time.
0
0
-300 -90
Phase (deg)
2
Magnitude (dB)
100
3
20
25
30
Figure 1. Input step response of blood glucose level of diabetic patient.
We also seen the stability plot in figure (2) and bode plot in figure (3) of blood glucose level of diabetic patient. The stability plot shows the system is stable so we can improvise the system performance so we can apply PID controller with various tunning method like ziegler-nichols and cohen-coon method.
2
10
4
10
(rad/sec)
Figure 3. Bode plot of input step response of blood glucose level of diabetic patient.
III.
DESIGNING OF CONTROLLER
To designing the digital PID controller for determining the error where the error is difference between glucose sensors measured value and desired value of glucose. The equation for PID controller is[4]𝑡 𝑑 𝑢 𝑡 = 𝐾𝑝 𝑒 𝑡 + 𝐾𝑖 0 𝑒 𝜏 𝑑𝜏 + 𝐾𝑑 𝑒(𝑡) (4) 𝑑𝑡
Where, u(t) is output response, t is instantaneous time,𝜏 is the integration variable vary from 0 to t and e is the error which is SP-MV where SP is set point of glucose and MV is measured value of glucose. Kp is proportional gain and it depends on the present value of system. Ki is integral gain and it depends on past accumulate value of system. Kd is derivative gain and it depends on future or expected value. For equation (4), the transfer function of PID controller is1 𝐺𝑐 𝑠 = 𝑘𝑝 1 + + 𝑠𝑇𝑑 (5) 𝑠𝑇𝑖 Where, Ti is integral time and Td is derivative time. The approximate modeling blood glucose insulin system by using PID controller equation (3) as shown in the figure 4.
Disadvantage of this tuning process is to take more time for doing experiment and system become uncontrollable when it adventure into unstable region while testing the P controller[5].
. Figure 4. Block diagram of blood glucose insulin system with Digital PID controller
For finding the gain parameters like Kp, Ki and Kd the tuning methods like Ziegler –Nichols and Cohencoon method are used than best response parameter performance between them is compared. IV.
ZIEGLER-NICHOLS METHOD
Ziegler-Nichols is the method which is based on determines experimentally the marginal stability point. This method is also used for determining the PID controller parameters. For determining these parameter in the year of 1940, we use two empirical methods are[5]a) It was used non-first order plus dead time situations. b) It was involved in intense manual calculations. Ziegler-Nichols tuning process for closed loop system or feedback system. This method is used the ultimate gain value ku to determine the value of kp. These are following procedure to determine the PID controller parameters. a) For determining the value of k( proportional gain) than we must set the integral time (Ti) at 999 or infinity and derivate time (Td) must be zero. b) Whenever changing the set point it create a small disturbance in the feedback loop. Untill the oscillation have constant amplitude, we adjust the value of proportional gain. c) Finally we record the ultimate gain value ku and ultimate period of oscillation Tu. d) Put these values in closed loop equation of Ziegler-nichols for necessary setting of controller[5][6]. TABLE I.
PI P PID
CLOSED LOOP CALCULATION OF Kp, Ti, Td[5].
KP KU/2.2 KU/2 KU/1.7
Ti PU/1.2
Td
PU/2
PU/8
Ziegler Nichols tuning process for open loop system. This process is also known as process reaction method .Using this techniques we should follow some steps area) To perform open loop test. b) By using the process reaction curve, we should calculate the dead time (τdead) or transportation lag, time response, time constant (τ) and for step change of X0, we get ultimate value of system response of steady state (Mu). 𝑋 τ 𝐾0 = 0 ∗ (6) 𝑀𝑢
c)
TABLE II.
PI P PID
OPEN LOOP CALCULATION VALUE OF Kp,Ti ,T d. KP 0.9K0 K0 1.2K0
Ti 3.3 τdead
Td
2 τdead
0.5 τdead
Advantage of this tuning process reaction method is easy to implement in other method, least disruptive, robust and very popular method. Disadvantage of this above method is that it depend on pure proportional measurement to estimate the I and D controller. The tuning parameters of controller value is not accurate for different system,it doesnot hold the D,I and PD controller[5]. A. Tuning of PID controller by using ZieglerNichols method By using the above blood glucose equation (3) we apply in the equation of PID controller by using the Ziegler-Nichols tuning method we get the value of controller parameters as given below Kp=3.25316, Ki=0.882044, Kd=2.99957 Now we solve the equation (3) and equation (5) we get the expression is𝐺𝑐 𝑠 =
Advantage of this tuning process is to determine controller parameter by doing easy experiment ,in this experiment we need to change the P controller and for more accurate behaving of the system we include the dynamics of complete process.
τ 𝑑𝑒𝑎𝑑
To determine the controller gain parameters, put the reaction time and lag rate in the open loop equation of Ziegler Nichols[5][6].
𝑘𝑑s 2 + kps + ki 𝑠 4 + 6𝑠 3 + 5 + 𝑘𝑑 𝑠 2 + kps + ki
(7)
Putting the value of Kp, Ki, Kd, we obtain the Ziegler-Nichols equation for blood glucose level,after that we convert the equation into discrete domain by using Triangle approximation (modified first order hold) with sampling time is 0.1sec we get Gz(z) –
0.0004436z 4 + 0.007341z 3 − 0.02238z 2 + 0.007553z + 0.003113 (8) z 4 − 3.488z 3 + 4.527z 2 − 2.588z + 0.5488
These parameter shows it improvise the settling time, it also show the overshoot value is little bit large but the performance of the system is efficient. [6] V.
TABLE III. RECOMMENDED EQUATION USED TO OPTIMIZE COHEN-COON PREDICTIONS[6].
P PID
A. Tuning of PID controller by using Cohencoon method
COHEN-COON METHOD
Cohen-coon method is another tuning method of PID controller where using this tuning method the steady state response is minimum as given according to Ziegler Nichols method. This method is exclusively for first order system/model which having the time delay .Because of time delay controller doesn’t respond the disturbance in the response. Cohen coon method is also referred as offline method which means that it is steady state which introduce the step change in the input .Based on time constant and time delay the output response can be determined. This output response decide the initial controller parameters. For getting standard decay ratio and minimum offset thereare set of predetermined settings. This pre-determined setting are shown in table 3[6].
PI
Whereas the disadvantage of this method is that it is valid for first order system ,another is offline method and closed loop system which is unstable in this method[6].
KP (P/NL)*(0.9+ (R/12)) (P/NL)*(1+(R/3)) (P/NL)*(1.33+(R/4))
Ti L*(30+3R)/(9+20R)
Td
L*(30+3R)/(9+20R)
4l/(11+2R)
Where, P is percentage change of input ,N is percentage change of output, L is dead time and R is the ratio of dead time and τ. Steps the process of Cohen- coon method are-
By apply this Cohen-coon tuning method on PID controller equation (2) of blood glucose; we obtain the controller parameters like kp, ki, kd. These parameter values are- Kp=3.66987, Ki=0.798213, Kd=2.49714 Now solve the equation (3) and equation (5) we get the expression as shown below𝐺𝑐 𝑠 =
𝑘𝑑s 2 + kps + ki 𝑠 4 + 6𝑠 3 + 5 + 𝑘𝑑 𝑠 2 + kps + ki
(9)
Putting the value of Kp, Ki, Kd, we obtain the Coohen-Coon equation for blood glucose level,after that we convert the equation into discrete domain by using Triangle approximation (modified first order hold) with sampling time is 0.1sec we get Gz(z) – 0.003729z 4 + 0.006431z 3 − 0.01868z 2 + 0.006009z + 0.002567 (10) z 4 − 3.491z 3 + 4.534z 2 − 2.592z + 0.5488
Finally we get accurate step response which has less setting time and steady state time is also less by using this tuning method. The step response is shown in figure 8. This figure shows the less time to settle down the response, it is also show zero steady error and its show quick output response for better performance of the system. VI. RESULT A. By using Ziegler-Nichols method results 1.4
a)
Advantage of cohen-coon method is that it is used the system having time delay and get fast response time.
1.2
Amplitude
1
0.8
0.6
0.4
0.2
0
0
10
20
30
40
50 Time[sec]
60
70
80
90
100
Figure 5. Step response of blood glucose insulin system by using Ziegler-Nichols method. Bode Diagram
Magnitude (dB)
200
100
0
-100
-200 -90
Phase (deg)
First step - We should wait until the process reaches steady state. b) Second step - To preface the step change in the input. c) When the step change in input is introduced an approximate first order process having time delay which is based on output is obtained. d) Recording the time instance we obtain the value of dead time (τdead) and τ,time instance are-T0= input step point time ,T2=half point reached time, T3=time at reaches 63.4%. e) To determine the process parameter kp .τ, τdead by using the value of T 0,T2,T3. f) Finally determine the controller parameter which is based on kp .τ, τdead [6].
-120
-150
-180 -5
10
0
10 Frequency
5
10
(rad/sec)
Figure 6. Open loop bode plot of blood glucose system by using Ziegler-Nichols method.
VII.
Bode Diagram 120
DISCUSSION
Magnitude (dB)
100 80
From fig. 13, we can deduce that the values of overshoot and settling time when the conventional techniques was used, for Ziegler-Nichols (ZN) is 26.67% and 17.9192 seconds and for Cohen-Coon (CC) is 25.30% and 11.2416 seconds respectively.
60 40 20 0 90
Phase (deg)
45 0 -45 -90 -5
0
10
5
10 Frequency
10
(rad/sec)
Figure 7. Continuous- time approximation bode plot of blood glucose insulin system by using Ziegler Nichols method. Bode Diagram 40
Magnitude (dB)
35 30 25 20 15 10 90
Parameters Ziegler-Nichols Cohen-coon 26.67 25.30 Overshoot (in percent) 17.9192 11.2416 Settling time (in second) 2.3229 2.1708 Rise time(in second) Figure 13. Table showing the comparison between the outputs of Ziegler-Nichols and Cohen-coon tuning techniques parameters.
Phase (deg)
45
VIII.
0 -45
CONCLUSION
-90 -2
-1
10
0
10 Frequency
10
(rad/sec)
Figure 8. Discrete- time approximation bode plot of blood glucose insulin system by using Ziegler Nichols method.
B. By using Cohen-Coon method results 1.4
1.2
Amplitude
1
0.8
0.6
0.4
0.2
0
0
10
20
30
40
50 Time[sec]
60
70
80
90
100
Figure 9. Step response of blood glucose insulin system by using Cohen-coon method. Bode Diagram
Magnitude (dB)
200
100
0
Thus the PID controller was tuned for Blood Glucose level of Diabetic Patient using both Ziegler Nicholas & Cohen Coon method. The parameters value Kp=3.25316, Ki=0.882044, Kd=2.99957 is tuned by Ziegler Nicholas and the Cohen coon method tuned parameters value is Kp=3.66987, Ki=0.798213, Kd=2.49714. The traditional Ziegler Nicholas method caused a very high overshoot but a very swift response. But the best response was exhibited by PID which was tuned using Cohen Coon method with a zero overshoot & a comparatively low settling time. As the overshoot in insulin injection may endanger the life of parent, therefore PID designed with Cohen coon is implemented here & converted into digital domain using various transformation techniques. It can further be implemented on FPGA or any other Programmable Logic Device.
-100
REFERENCES
Phase (deg)
-200 -120
[1]
-150
-180 -5
0
10
5
10 Frequency
10
(rad/sec)
Figure 10. Open loop bode plot of blood glucose system by using Cohen-coon method.
[2]
Bode Diagram 120
Magnitude (dB)
100 80
[3]
60 40 20 0 90
Phase (deg)
45 0 -45 -90 -5
0
10
5
10 Frequency
10
[4]
(rad/sec)
Figure 11. Continuous- time approximation bode plot of blood glucose insulin system by using Cohen-coon method. Bode Diagram 60
[5]
Magnitude (dB)
50 40 30
[6]
20 10 90
Phase (deg)
45 0 -45 -90 -2
10
-1
10
0
1
10
Frequency
10
2
10
(rad/sec)
Figure 12. Discrete- time approximation bode plot of blood glucose insulin system by using Cohen-coon method.
Dan L.Longo, Anthony S. Fauci, Dennis L. Kasper,Stephen L.Hauser,J.Larry Jamenson,Joseph Loscalzo,“Harrison’s principle of Internal Medicine”,18th Edition textbook. Kaveh Parisa, Shtessel Yuri, “Higher Order Sliding Mode Control for Blood Glucose Regulation,”Proceedings of the 2006 International Workshop on Variable Structure Systems,2006,12-16. Pinky Dua, Francis J .Doyle, and Pistikopoulos ,“Model-Based Blood Glucose Control for Type 1 Diabetes via Parametric Programming,”IEEE Transactions on Biomedical Engineering, vol.53, pp.1478-1491,August 2006. Anil kumar , Rekha Phadke, “Design of digital PID controller for Blood Glucose monitoring system”, International Journal of Engineering Research &Technology(IJERT) ,VOL.3 Issue 12, December2014. Article: Ziegler-Nichls’ open loop method, Finn Haugen Tech Tech, 17th july 2010. Amit kumar and K.K Garg, “Comparison of ZieglerNichols, Cohen-Coon and fuzzy logic controllers for heat exchanger model”, International Journal of Science, Engineering and Technology Research (IJSETR), Volume 4, Issue 6, June 2015.