Blood sugar regulation by the liver

Blood sugar regulation by the liver preview image

1 collaborator

Screen_shot_2018-02-02_at_12.53.50_pm lin xiang (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.2.0 • Viewed 165 times • Downloaded 34 times • Run 0 times
Download the 'Blood sugar regulation by the liver' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

;;
;; This model is developed by Dr. Lin Xiang at the University of Kentucky. Contact: lin.xiang@uky.edu
;;
;; If you see this page rather than a "download" button when downloading the model, click the "download" icon
;; in your browser to download this model file.
;;
;; This model is free for classroom or virtual learning or teacher professional development related to STEM education.
;; You are asked to provide citations when using this model in any published work.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


breed [insulins insulin]
breed [glucose a-glucose]
breed [gluts glut]
breed [I-receptors I-receptor]
breed [G-receptors G-receptor]
breed [lipids lipid]
breed [glucagons glucagon]
breed [legends legend]

insulins-own [bonding]
patches-own[protein]
gluts-own[bonding]
glucose-own [bonding cyto glycogen]
I-receptors-own [bonding]
G-receptors-own [bonding]
glucagons-own [bonding]

globals[clock]

to-report blood-sugar
  report count glucose with [ycor > 2 and color = white and bonding = 0]
end 

to-report cyto-glucose
  report count glucose with [ycor < 2 and color = white and bonding = 0 and glycogen = 0]
end 

to-report glycogen-level
  report count glucose with [glycogen = 1 and color = 138]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                           ;;
;;         Main Procedures (SETUP and GO)                                    ;;
;;                                                                           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to setup
 ;clear-turtles
 ;clear-patches
ca
 setup-legend     ; must be the first line
 setup-membrane-IR
 setup-glucose
 check-glucose-location
 setup-glut
 setup-g-receptors
 set-insulin-sensitivity

reset-ticks
end 

to go
  if blood-sugar < 54 [user-message "The blood sugar level is dangerously low." Stop]


check-glucose-location
food-intake
set-insulin-sensitivity
setup-insulin
setup-glucagon
glucose-movement
insulin-movement
glucagon-movement
glycolysis
glycogenesis-glycogenolysis
plot-levels

tick
end 



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                           ;;
;;         Sub-procedures of SETUP                                           ;;
;;                                                                           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to setup-membrane-IR

;make the membrane
  ask patches with [pycor = 2] [set pcolor 49 ]

; make boundary for the system
  ask patches with [abs pxcor = max-pxcor or abs pycor = max-pycor] [set pcolor 2]
  ask patches with [pycor <= min-pycor + 4 ] [set pcolor 2]

;add Insulin receptors (I-R) into the membrane
  ask patches with [pcolor = 49] [
    if  pxcor = -2 or
        pxcor = 6
    [set pcolor 123]
  ]

 ask patches with [pcolor = 123]
     [sprout-I-receptors 1
        [set color yellow - 2
        set size 2.5
        set shape "I-R"
        set bonding 0 ]
     ]

  ; add bilayer
   ask patches with [ pycor = 2 and pcolor = 49] [sprout-lipids 1 [set color 7 set shape "lipid-1" set size 1 set heading 0 set ycor 2]]
end 

to setup-glucose
  create-glucose Starting-Blood-sugar-level
  [set color white
    set shape "glucose"
    set size 0.75
    set bonding 0
    set glycogen 0
    setxy (max-pxcor - 1) - random-float ((max-pxcor - 1) * 2) 2.5 + random-float 5]

  create-glucose Starting-cytoplasmic-glucose
  [set color white
    set shape "glucose"
    set size 0.75
    set bonding 0
    set glycogen 0
    setxy (max-pxcor - 1) - random-float ((max-pxcor - 1) * 2) 1 + random-float -4]

  create-glucose 200        ;set glycogen
  [set color 138
    set shape "glucose"
    set size 0.75
    set bonding 0
    set glycogen 1
    setxy (max-pxcor - 1) - random-float ((max-pxcor - 1) * 2) min-pycor + 5 + random-float 0.5]
end 

to setup-glut
 ask patches with [(pxcor = 2 or pxcor = -10 or pxcor = 10)  and pycor = 2 and pcolor = 49]
[if any? lipids-here
[ask lipids-here [die]
sprout-gluts 1 [set shape "glut" set color 86.5 set size 1.25 set heading 0 set bonding 0]
]]
end 

to setup-insulin

 if blood-sugar > 140 and can-produce-insulin?     ;only produce insulin when blood sugar level is high and capable of producing insulin
  [if not any? insulins with [ycor > 2] [
    create-insulins 10
    [ set bonding 0
    set shape "insulin"
    set size 2
    set color 95
      setxy -6 + random-float 16 2.5 + random-float 5]]]

  if blood-sugar < 120
  [if count insulins != 0
    [ask insulins with [ycor > 2] [die]]
  ]
end 

to setup-g-receptors
 ask patches with [pxcor = -6 and pycor = 2 and pcolor = 49]
  [if any? lipids-here
    [ask lipids-here [die]
   sprout-G-receptors 1 [set shape "g-r" set color 26 set size 3 set heading 0 set bonding 0 setxy -6 2.35]
]]
end 

to setup-glucagon

 if blood-sugar < 98
  [if not any? glucagons with [ycor > 1] [
    create-glucagons 10
    [ set bonding 0
    set shape "glucagon"
    set size 1.75
    set color 64
      setxy -10 + random 5 2.5 + random-float 5]]]

  if blood-sugar > 103
  [if count glucagons != 0
    [ask glucagons with [ycor > 0] [die]]
  ]
end 

to setup-legend
 create-legends 10
  [set shape "legend"]

 ask legend 0
  [set label "lipids"
    setxy -8 -4.75 ]

  create-lipids 1
  [set color 7
    set shape "lipid-1"
    set size 0.75
    set heading 0
    setxy -8 -4.25 ]

  ask legend 1
  [set label "Glucose"
    setxy -2.75 -4.75]

  Create-glucose 1
  [set color white
    set shape "glucose"
    set size 1.25
    set heading 0
    set glycogen 2
    setxy -3 -4.25]

  ask legend 2
  [set label "Glycogen"
    setxy 2.75 -4.75 ]

  Create-glucose 2
  [set color 138
    set shape "glucose"
    set size 1.25
    set glycogen 2
    setxy 2 + random-float 0.5 -4.25]

  ask legend 3
  [ set label "Glucose Transporter 2"
    setxy 10 -4.75 ]

  create-gluts 1
  [set shape "glut"
    set color 86.5
    set size 0.75
    set heading 0
    set bonding 2
    setxy 8 -4.25]

 ask legend 4
  [set label "Insulin"
    setxy -7.8 -7.25 ]

 create-insulins 1
  [ set bonding 0
    set shape "insulin"
    set size 1.25
    set color 95
    setxy -8 -6.75]

  ask legend 5
  [set label "Insulin"
    setxy  -2.8 -7.15 ]

ask legend 6
  [set label "Receptor"
    setxy  -2.5 -7.65 ]

  create-I-receptors 1
       [set color yellow
        set size 0.75
        set shape "I-R"
        setxy -3 -6.75]

ask legend 7
  [set label "Glucagon"
    setxy  2.75 -7.25 ]

create-Glucagons 1
  [set color 64
    set shape "Glucagon"
    set size 1.25
    set heading 90
    setxy 2.25 -6.75
  ]

 ask legend 8
  [set label "Glucagon"
    setxy  8.5 -7.15 ]

ask legend 9
  [set label "Receptor"
    setxy  8.5 -7.65 ]

 create-G-receptors 1
  [set color 26
    set shape "g-r"
    set size 0.75
    set heading 90
    setxy 8 -6.75
  ]

  create-lipids 1
  [set color 7
    set shape "line"
    set size 22
    set heading 90
    setxy 0 -5.75
  ]
end 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                           ;;
;;         Sub-procedures of GO                                              ;;
;;                                                                           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to glucose-movement
  ask glucose with [glycogen = 0] [
  ifelse bonding = 0
  [ if pcolor = 0
      [right random 90 left random 90   ;wiggle
         if [pcolor] of patch-at dx dy = 0 [fd 0.2]   ;If nothing is ahead, move forward
    ]
    if any? gluts-on patch-ahead 1 [
      let my-channel one-of gluts-on patch-ahead 1
      if [bonding] of my-channel = 0 [
       set color red move-to my-channel set bonding 1

        ask my-channel [set bonding 1 set color 85]]]]
  [
    ifelse blood-sugar > cyto-glucose
      [set heading 180 fd 0.1] [set heading 0 fd 0.1]
      if pcolor = 0 [set bonding 0 set color white]
        ]
  ]

  ask gluts with [bonding = 1] [if count glucose-here = 0 [set bonding 0 set color 86.5]]
end 

to check-glucose-location ;detemine glucose location
  ask glucose [ifelse ycor > 2 [set cyto 0][set cyto 1]]
end 

to insulin-movement
  ask insulins with [ycor > 2]
  [if bonding = 0
    [
      if pcolor = 0
      [right random 90 left random 90   ;wiggle
         if [pcolor] of patch-at dx dy = 0 [fd 0.2]
      ]

      if any? I-receptors in-radius 2 with [bonding = 0] [
      let my-receptor one-of I-receptors in-radius 2 with [bonding = 0]
        set heading 0 move-to my-receptor set ycor ycor + 1.2  set bonding 1

        ask my-receptor [set bonding 1 set color yellow]]]
      ]

  ask I-receptors with [bonding = 1]
  [if count insulins with [ycor > 2] = 0 [set bonding 0 set color yellow - 2]]
end 

to glucagon-movement
  ask glucagons with [ycor > 2]
  [if bonding = 0
    [
      if pcolor = 0
      [right random 90 left random 90   ;wiggle
         if [pcolor] of patch-at dx dy = 0 [fd 0.2]
      ]

      if any? G-receptors in-radius 2 with [bonding = 0] [
      let my-receptor one-of G-receptors in-radius 2 with [bonding = 0]
        set heading 0 move-to my-receptor set xcor xcor - 0.3 set ycor ycor + 0.95 set bonding 1

        ask my-receptor [set bonding 1 set color 27]]]
      ]

  ask G-receptors with
    [bonding = 1] [if count glucagons with [ycor > 2] = 0 [set bonding 0 set color 26]]
end 

to glycolysis
  ask glucose with [glycogen = 0 and cyto = 1] [
    if random 1000000 < metabolic-rate  [die]
  ]
end 

to glycogenesis-glycogenolysis

  if glycogen-level = 0
   [if count glucose with [cyto = 1] != nobody
     [ask one-of glucose with [cyto = 1]    ;set a starter
        [set glycogen 1
         set color 138
         setxy (max-pxcor - 1) - random-float ((max-pxcor - 1) * 2) -2 + random-float -1 ]]]

  if glycogen-level < 800 [       ;glycogenesis set a max glycogen
  ask glucose with [cyto = 1 and glycogen = 0]
     [if any? other glucose-here with [glycogen = 1]
      [if random 100 < (1 + (count insulins with [bonding = 1])* 45)
        [ set glycogen 1 set color 138]
  ]]]

  if any? G-receptors with [bonding = 1]              ;glycogenolysis
    [ask glucose with [cyto = 1 and glycogen = 1]
     [if random 1000 < 5
      [set glycogen 0 set color white
       set heading 45 - random 90
          fd 0.5]]
    ]
end 

to set-insulin-sensitivity
  ask I-receptors with [ycor > 0]
    [ifelse Insulin-resistance?
      [set bonding 2 set color yellow - 2]
      [ifelse color = yellow [set bonding 1][set bonding 0]]
      ]
end 

to food-intake
  set clock clock + 1
  if clock = 1200 [
    if eat-every-4-hrs?
  [create-glucose 100
  [set color white
    set shape "glucose"
    set size 1
    set bonding 0
    set glycogen 0
    setxy (max-pxcor - 1) - random-float ((max-pxcor - 1) * 2) 2.5 + random-float 5]

 ask glucose with [ycor > -4]
  [if pcolor = 2 [ifelse random 2 = 0 [set xcor xcor + 1 ][set xcor xcor - 1 ]]]
  ]
    set clock 0]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                           ;;
;;         Supporting-procedures                                             ;;
;;                                                                           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to plot-levels ;; this creates creates the bar graph
    set-current-plot "Glucose Gradient"
    clear-plot
    plot-pen-down
    set-current-plot-pen "Blood stream glucose"
    plotxy 1 blood-sugar
    set-current-plot-pen "Cytoplasm glucose"
    plotxy 2 cyto-glucose
    set-current-plot-pen "Glycogen"
    plotxy 3 glycogen-level
end 

There are 7 versions of this model.

Uploaded by When Description Download
lin xiang about 3 years ago Adjust the glut actions Download this version
lin xiang about 3 years ago Adjust the parameters Download this version
lin xiang about 3 years ago Adjust regular food intake Download this version
lin xiang about 3 years ago Adjust the parameters Download this version
lin xiang about 3 years ago Adjust the parameters Download this version
lin xiang about 3 years ago Adjust the parameters Download this version
lin xiang about 3 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Blood sugar regulation by the liver.png preview Preview for 'Blood sugar regulation by the liver' about 3 years ago, by lin xiang Download

This model does not have any ancestors.

This model does not have any descendants.