+ All Categories
Home > Documents > Control System Deisgn Project Glucose Control in Type i Diabetes

Control System Deisgn Project Glucose Control in Type i Diabetes

Date post: 28-Apr-2015
Category:
Upload: kousha-talebian
View: 23 times
Download: 0 times
Share this document with a friend
Description:
Type I Diabetes, also known as insulin-dependent diabetes, cause the pancreas1 not to function properly. In a healthy body, carbohydrates are released into the blood after each meal, causing blood sugar to increase. In response to this increase in blood sugar, the beta cell in pancreas produces insulin, allowing cells to absorb glucose (sugar).The purpose of this report is to design an artificial pancreas - a controller that measures the glucose level of the blood and injects insulin to keep the glucose level at appropriate bounds.
25
1 CONTROL SYSTEM DEISGN PROJECT GLUCOSE CONTROL IN TYPE I DIABETES Babak Amini (60335064) Kousha Talebian (67314062) EECE 460 Electrical Engineering and Computer Engineering The University of British Columbia April 09, 2011
Transcript
Page 1: Control System Deisgn Project Glucose Control in Type i Diabetes

  1  

     

 

 

 

 

 

 

 

 

CONTROL  SYSTEM  DEISGN  PROJECT  GLUCOSE  CONTROL  IN  TYPE  I  DIABETES  

             

Babak  Amini  (60335064)  Kousha  Talebian  (67314062)  

 EECE  460  

Electrical  Engineering  and  Computer  Engineering  The  University  of  British  Columbia  

April  09,  2011      

 

Page 2: Control System Deisgn Project Glucose Control in Type i Diabetes

  2  

Characteristics  of  Type  I  Diabetes:  Type  I  Diabetes,  also  known  as  insulin-­‐dependent  diabetes,  cause  the  pancreas1  not  to  function  properly.  In  a  healthy  body,  carbohydrates  are  released  into  the  blood  after  each  meal,  causing  blood  sugar  to   increase.   In  response  to  this   increase   in  blood  sugar,   the  beta  cell   in  pancreas  produces  insulin,  allowing  cells  to  absorb  glucose  (sugar).    

The  effect  of  each  factor  on  glucose  level  is  shown  below:    

 

 

 

 

There  are  other  factors  that  influence  the  glucose  level  such  as  exercise  and  stress,  but  they  are  not  considered  in  this  project.  

Artificial  Pancreas:  

The  device   that  we  want   to  design  a   controller   for   is   an  artificial  pancreas   that  monitors   the  level  of  blood  sugar  and  continuously  infuses  insulin  to  the  body  to  maintain  the  recommended  level   of   glucose   in   blood.   The   difficultly   is   that   there   is   a   time   delay   of   about   27   minutes  between  the  time  of  insulin  injection  to  when  its  effect  is  seen  in  the  glucose  concentration  of  blood.  Also,  insulin  delivery  introduces  a  delay  of  about  one  hour  that  further  complicates  the  control  design.  

 

 

 

 

 

 

                                                                                                                         1  An  organ  that  is  responsible  for  producing  insulin  

Glucose  Level  

Insulin  Food     - +

Page 3: Control System Deisgn Project Glucose Control in Type i Diabetes

  3  

Note:  This  section  of  the  report  describes  the  overall  design.  The  more  specific  description  is  found  on  page  12,  and  it  discusses  the  values  of  the  PID  control,  as  well  as  the  algorithm  for  optimizing  the  program.  

Model  of  the  System:  

The  simplified  model  of  the  system  is  given  by:  

 

Where   UM   (in   units   of   grams)   is   the   carbohydrate   input   from   the   food   consumption   which  represents  the  output  disturbance,  UI     (in  units  of  mU/min)   is  the  insulin   input   infused  by  the  artificial   pancreas   that   represents   controller’s   output,   and   Y   is   the   glucose   concentration   in  units  of  mg/dl.    

The   transfer   functions   behind   UM   and   UI   model   bodies   reactions   to   food   and   insulin  respectively.  

The  values  of  the  parameters  used  in  given  in  the  following  table:  

KM  (mg/dl)   τM  (min)   τDM  (min)   KI  (mg/dl  per  mU/min)   τI  (min)   τDI  (min)  4.2   53   12   -­‐0.075   146   27  

 

Food  Pattern:  

The  pattern  of  food  consumption  that  the  patient  follows  in  a  24-­‐hour  period  (starting  from  6am)  is  described  below:  

Meal   Time  of  consumption   Amount  of  CHO  (g)   Duration  (min)  Breakfast   7  AM   25     10    Lunch   1  PM   40   15  Dinner   7  PM   60   20  

 

Intrinsic  Uncertainties:    

Due   to   physiological   differences   between   the   patients,   the   control   parameters   vary   among  individuals.   Also,   there   might   be   some   uncertainties   in   the   amount   and   time   of   food  consumption.  The  intrinsic  uncertainties  are  listed  below:  

I. ±25%  Variation  in  KI  II. ±25%  Variation  in  Meal  Size  III. ±15  min  in  meal  time  

The  controller  should  be  robust  under  all  of  above  uncertainties.    

Page 4: Control System Deisgn Project Glucose Control in Type i Diabetes

  4  

System  Requirements:  

The   desired   blood   glucose   concentration   is   between   70   to   180   mg/dl.   The   set   point   of   the  system   should   be   set   to   100  mg/dl.   It   is  much  more   dangerous   if   the   glucose   concentration  drops   below   70   mg/dl   as   it   can   cause   the   patient   to   enter   the   state   of   hypoglycaemia.  Hypoglycaemia  should  be  avoided  particularly  during  the  night  when  the  subject  is  asleep.  

Also,   the  maximum   insulin   infusion   rate   is   166  mU/min.   This   requirement   sets   a   limit   to   the  controller  output  that  should  be  modelled  using  an  anti-­‐windup  technique.    

Control  Design:  

Our   control   design   is   based  on   Simulink;   however,  we  use   a  Matlab  M-­‐script   to   initialize   the  parameter  and  add  uncertainties  to  the  parameters  that  require  variation   in  their  values.  The  design  is  described  in  subsections  listed  below:  

1) Simulation  of  food  consumption  2) Smith  Predictor  3) Controller    4) Anti-­‐Windup  5) Setpoint  Weighting    6) Pre-­‐filtering  

1)  Simulation  of  Food  Consumption:  

Food  intake  is  simulated  by  a  series  of  square  pulses  imposed  at  specified  time  for  each  meal.  The  width   of   the   pulse   is   given   by   the   duration   of   each  meal   and   the   area   under   the   pulse  determines  the  amount  of  food  intake.  Since  the  amount  of  food  intake  in  each  meal  is  given  to  us,  we  can  determine  the  height  of  the  pulses  by  dividing  the  amount  of  food  by  the  duration  of  the  meal.  The  diagram  below  shows  the  Simulink  model  of  the  food  intake:    

Page 5: Control System Deisgn Project Glucose Control in Type i Diabetes

  5  

 

The  Boolean  constants,  which  are  multiplied  by  each  of   the   impulses,  are   implanted  there  so  that  we  have  control  over  switching  on  and  off  any  of  the  meals  we  desire  in  the  Matlab  script  without   the   need   to   change   the  wiring   in   Simulink  model.   Therefore,   if   we  want   to   see   the  effect   of   not   having   the   breakfast   meal   on   the   system,   for   example,   we   set   the   breakfast  constant  to  0  and  leave  the  other  two  constants  for  lunch  and  dinner  as  1.    

The  Matlab  script  used  for  simulation  of  food  intake  is  shown  below:  

   The  rd(lower  bound,  upper  bound)  function  is  used  to  generate  a  random  number  between  the  the  lower  and  upper  limits,  satisfying  the  required  variation  in  the  amount  of  food  and  the  meal  time  as  specified  by  the  question.  The  values  of  the  peaks  are  taken  as   inputs   in  the  Simulink  model  for  setting  the  height  of  each  impulse.      

Page 6: Control System Deisgn Project Glucose Control in Type i Diabetes

  6  

Next,  this  food   intake  will  enter  a  transfer  function,  which  simulates  the  body  reaction  to  the  food  and  how   it   affects   the  glucose   level  of   the  blood.     The   complete  Simulink  model  of   the  disturbance  caused  by  food  consumption  is  show  below:  

             Where  the  transfer  function  constants  are  set  in  the  Matlab  script  as:    %%  Model  Parameters  DistK    =  4.2;    DistT    =  53;  DistTD  =  12;    The  entire  food  consumption  is  enclosed  in  a  subsystem  called  food  block.  

   

Page 7: Control System Deisgn Project Glucose Control in Type i Diabetes

  7  

Some  of  the  values  such  as  food  intake  and  the  output  disturbance  (dg)  are  sent  back  to  the  workspace  to  be  plotted  later.      2)  Smith  Predictor:    

Since   there   is   a   time  delay  of   27  minutes   in   the  plant,  we   incorporated   a   smith  predictor   to  subtract  the  time  delay  from  the  plant.  The  Simulink  schematic  of  the  smith  predictor  used  in  our  design  is  shown  below:  

 

 

 

 

 

 

 

 

Note  that  the  plant  model  has  some   intrinsic  uncertainties   in   its  parameters  according  to  the  description   of   the   project.   However,   the   model   of   the   plant   (i.e.   G0)   does   not   have   any  uncertainty.  Using  smith  predictor  technique,  we  subtract  the  delay  from  the  system  model  and  feedback  the  un-­‐delayed  transfer  back  to  the  controller.    

3)  Controller:  

To  design  the  controller,  we  used  Q-­‐design  technique.    

               Q(s)  =  FQ*𝐺!! (s)    

Our  plant  model  is  given  by  

G0  =  !!

!(!!!!!)  

Since   the   plant   has   an   integrator,   we   use   the   integrating   model   for   the   Q-­‐design.   We   first  choose    

𝐺!! (s)  =  !(!!!!!)

!!    

We  need  to  enforce  an  integrator  into  the  controller  (to  have  zero  step  response  steady  state  error),  we  have    

FQ  =  !!!!!

!!!!!!!!!!!!!!!  

Disturbance  

Feedback  

Page 8: Control System Deisgn Project Glucose Control in Type i Diabetes

  8  

In  this  case,  the  controller  becomes:  

C(s)  =   !!!! !!! !!!!! !!!

!!!(!!!!!!)  

We  first  divide  FQ  into  two  parts:  a  quadratic  equation  for  FQ  and  a  first  order  term.  

𝛼!𝑠! + 𝛼!𝑠! + 𝛼!𝑠 + 1  =  (𝑠! + 2𝜔!𝜁𝑠 + 𝜔!!)(s+α)  

To  solve  the  α  coefficients,  we  use  Matlab  command:  conv()  

   4)  Anti  Wind-­‐up  

The  maximum  insulin  infusion  rate  of  166  mU/min  sets  a  limit  on  the  controller’s  output.  Hence,  we  have  to  use  anti  wind-­‐up  scheme  to  introduce  this  limitation  into  our  controller.  The  Simulink  model  of  our  controller  with  anti  wind-­‐up  is  shown  below:  

 

The  value  of  Tt  is  set  to  be  Tt  =   𝑇!𝑇!    

Matlab  Code  for  Anti  windup  calculation  is  given  below:  

   

Page 9: Control System Deisgn Project Glucose Control in Type i Diabetes

  9  

We  cast  this  model  into  a  subsystem  under  the  name.    

 

5)  Setpoint  Weighting:  

To  avoid  initial  overshoot  of  the  system,  we  included  a  set  point  weighting  scheme.  The  Simulink  model  of  the  setpoint  weighting  is  shown  here.  

 

As  advised  in  literature,  we  set  ed  (the  weight  of  differential  error)  to  zero  and  ep  close  to  zero  in  order  to  reduce  the  overshoot  on  the  setpoint  changes.  We  cast  the  setpoint  weighting  into  a  subsystem:  

 

6)  Pre-­‐Filtering:  

Inverting  the  plant  introduces  two  zeroes  into  the  controller.  However,  one  of  these  two  zeroes  is  considerably  slower  than  the  other  one.  We  first  find  the  slowest  zero  of  the  controller  and  then  use  a  pre-­‐filter  to  eliminate  the  effect  of  this  slow  zero.  The  Matlab  Script  used  to  find  the  zeroes  and  then  single  out  the  slower  of  the  two  is  shown  below:  

Page 10: Control System Deisgn Project Glucose Control in Type i Diabetes

  10  

 

The  entire  Simulink  model  is  show  below:  

Page 11: Control System Deisgn Project Glucose Control in Type i Diabetes

  11  

 

 

Page 12: Control System Deisgn Project Glucose Control in Type i Diabetes

  12  

Control  Design  and  Specification  

The  PID  control  design  used  is  a  Q-­‐Design  method.  To  enforce  an  integrator  into  the  system,  we  define  the  F-­‐Function  as  

𝐹! =𝛼! + 1

𝛼!𝑠! + 𝛼!𝑠! + 𝛼!𝑠! + 1  

To   calculate   the  alpha   coefficients,  we   first   expand   𝑠! + 2𝜁𝜔𝑠 + 𝜔! (𝑠 + 𝛽)  with  ß  defined  later  on.  To  calculate  the  frequency,  we  simply  use  the  equation  𝑇! =

!!".  

Here,  we  use  a  damping   constant  of  0.7.   The   time  between  each  meal   is   about  6  hours.  We  therefore  assumed  a  settling  time  of  3  hours,  or  180min,  giving  us  a  frequency  of  0.0317  rad/s.  We  later  would  optimize  these  values,  and  the  final  values  would  be  provided.  

After  expanding  the  polynomial  above,  we  can  then  factor  out  the  constant  coefficient  to  get  the  alpha  values.  Then  the  PID  controller  becomes  the  format  of  

𝐶 𝑠 =  𝜏!𝛼!𝑠! + 𝜏! + 𝛼! 𝑠 + 1

𝐾!𝑠(𝛼!𝑠 + 𝛼!)  

Next,   we   divide   the   controller   above   into   a   parallel   version   to   allow   us   to   implement   anti-­‐windup   as  well   as   set   point  weighting   adjustment.   For   the   set   point  weighting,  we   guess   an  initial  value  of  0  for  derivative  error,  and  0.5  for  the  proportion  error.  

To  optimize  the  parameters,  we  simply  changed  the  value  from  a  lower  to  a  higher  bound  value  and   iterated   each   value   10,000   and   picked   the   parameter   that   had   least   amount   of   failure;  failure   is   defined  when   the   glucose   level   falls   below   70   at   the   end   of   the   day.  We   chose   to  optimize   the  system  for   this,   since   if   the  glucose   level  does   fall  below  70  during   the  day,   the  person  is  awake  and  they  can  simply  eat  something;  during  night-­‐time,  however,  this  can  cause  them   to   go   into   coma.   The   parameters   optimized   are:   W,   pre-­‐filter   zero,   differential   and  proportional   set  point  weighting,  as  well   as   the  ß   (the   last  pole  of   the  F-­‐Function).   The   table  below  summarizes  our  guess  v.s.  optimized  values:  

  Our  Estimation   Optimized  Settling  Time   195  min   175.4  min  𝝎   0.0293  rad/min   0.0326  rad/min  Control  Gain   -­‐13.3333   -­‐2.00  Pre-­‐filter  zero   -­‐0.0229   -­‐0.0623  Differential  set  point   0.0   0.15  Proportional  set  point   0.50   0.50  Beta   6   1.6  

Before  the  optimization,  the  system  failed  about  40%  of  the  times  (that  is,  the  glucose  level  at  night-­‐time  would   fall  below  70).  After  optimization,  however,   the  system’s   failure   is  only  9%.  The  images  below  show  the  system  response  for  the  nominal  case,  as  well  as  3  randomly  varied  parameters  (the  uncertainty  in  body  system  gain,  as  well  as  the  meal  time  and  size):  

Page 13: Control System Deisgn Project Glucose Control in Type i Diabetes

  13  

 

Figure  1:  System  action  for  the  nominal  case  

 

Figure  2:  The  Gang  of  Four  for  the  nominal  case  

Page 14: Control System Deisgn Project Glucose Control in Type i Diabetes

  14  

 

 

 

Page 15: Control System Deisgn Project Glucose Control in Type i Diabetes

  15  

 

 

 

 

Page 16: Control System Deisgn Project Glucose Control in Type i Diabetes

  16  

 

 

We   note   that   the   system   is   robust   for   all   of   these   random   variations.  We   like   to   emphasize  again  that  the  undershoot  of  around  time  =  800min  is  not  as  significant  as  keeping  the  glucose  

Page 17: Control System Deisgn Project Glucose Control in Type i Diabetes

  17  

level   above   the  minimum   level   at   nighttime.   A   simple   snack   between   lunch   and   dinnertime  would  easily  fix  this.  

The  three  variations  in  the  systems  are:  the  system  gain  of  the  body,  the  food  size,  and  the  time  of  eating.  With  the  exception  of  the  first  one  (it’s  the  biology  of  the  body),  the  other  two  can  be  controlled.  We   therefore  wanted   to  do  a   sensitivity   test  and  see  how  system   is   to   these   two  variations.   For   each   variable,   we   did   three   simulations   (for   three   fixed   value   of   the   other  parameter),   calculating   the   percent   error   as   the   function   of   the   variable   being   changed.   The  graphs  below  summarize  our  results:  

 

Page 18: Control System Deisgn Project Glucose Control in Type i Diabetes

  18  

 

 

 

It  is  very  interesting  to  note  that  the  system  is  very  robust  under  the  variation  in  the  time  the  person  eats.  Even  at  an  hour  time  difference,  the  percent  error  barely  changes!  

We  also  see  how  sensitive  system  is  to  the  meal  size.  Note  that  a  simple  change  of  going  from  25%  variation  to  only  15%  variation  drops  out  percent  error  from  9%  down  to  0.6%.  So   if  the  user  is  willing  to  eat  with  such  accuracy,  the  system  becomes  extremely  robust!  

This   analysis   also   shows   why   the   feed-­‐forward   was   not   very   effective;   the   system   is   not  responsive  to  the  time  variance,  and  therefore  getting  rid  of  the  time  delay  in  the  good  is  not  going  to  have  much  of  an  effect  anyways.  

Lastly,   we   wanted   to   see   how   stable   the   system   is   for   longer   simulation   periods.  We   did   a  simulation  for  one  week  of  the  person’s  body,  and  the  results  are  shown  below  (again  for  the  nominal  case,  as  well  as  3  random  variables):  

Page 19: Control System Deisgn Project Glucose Control in Type i Diabetes

  19  

 

 

 

 

Page 20: Control System Deisgn Project Glucose Control in Type i Diabetes

  20  

 

 

 

 

Page 21: Control System Deisgn Project Glucose Control in Type i Diabetes

  21  

 

 

 

 

Page 22: Control System Deisgn Project Glucose Control in Type i Diabetes

  22  

 

 

 

 

Page 23: Control System Deisgn Project Glucose Control in Type i Diabetes

  23  

 

So  we  see  that  the  system  is  very  stable  even  for  longer  periods  of  times!  Finally,  even  during  a  failure,  the  overnight  glucose  level  just  falls  below  the  70  mg/dl  allowed  level  for  the  last  hour:  

 

Page 24: Control System Deisgn Project Glucose Control in Type i Diabetes

  24  

The  simple  act  of  varying  the  setpoint  (exponential  decay  for  values  above  100,  and  a  constant  0  for  values  below  100)  should  fix  this  minor  issue.  

Page 25: Control System Deisgn Project Glucose Control in Type i Diabetes

  25  

References:  

http://www.mayoclinic.com/health/type-­‐1-­‐diabetes/DS00329  

http://www.endocrineweb.com/conditions/diabetes/diabetes-­‐what-­‐insulin  

 


Recommended