Modelización del uso de anticonceptivos en el sistema hormonal (glucosa, insulina y glucagón) de mujeres con y sin diabetes basada en datos reales

Modelización del uso de anticonceptivos en el sistema hormonal (glucosa, insulina y glucagón) de mujeres con y sin diabetes basada en datos reales preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.4.0 • Viewed 3 times • Downloaded 0 times • Run 0 times
Download the 'Modelización del uso de anticonceptivos en el sistema hormonal (glucosa, insulina y glucagón) de mujeres con y sin diabetes basada en datos reales' modelDownload this modelEmbed this model

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


WHAT IS IT?

This is an agent-based model of blood glucose regulation by the liver and pancreas through the production of the hormones insulin and glucagon.

This model represents cells as square patches which are either brown (liver cells) or yellow (pancreatic cells), aligning with typical textbook depictions of these organs. These two tissues work together to regulate the levels of the signal molecules glucose (white dots), insulin (blue dots), and glucagon (red dots) in the bloodstream. For simplicity, the model does not explicitly show blood vessels, instead representing molecule motion through diffusion.

The model demonstrates how glucose homeostasis is maintained in the body through feedback loops even without direction from a central regulator. It also demonstrates how a variety of conditions like physical activity, eating, or metabolic disorders can affect this homeostasis. Under each of these conditions, the blood sugar level emerges from the interactions between cells and signal molecules.

HOW IT WORKS

This model uses two broad classes of agents. The first is cells, and the second is signal molecules.

Liver cells (brown squares) and pancreatic cells (yellow squares) are arranged into a body. In response to low glucose levels, pancreatic cells produce glucagon (red dots). In response to high glucose levels, they produce insulin (blue dots). Liver cells detect the levels of insulin and glucagon and either sequester glucose (white dots) from the bloodstream or release stored glucose depending on the balance of the hormones. Liver cells also begin with a store of glycogen within themselves which can provision the body for several days. This system relies on feedback loops between the liver and the pancreas to regulate the level of glucose in the blood. This creates a dynamic equilibrium which has minor fluctuations but will generally maintain a constant amount of glucose in the bloodstream.

The behavior of the cells is also dependent on their sensitivity to the different signal molecules. When the cells are not very sensitive to a particular signal, they are not very good at detecting the presence of those signal molecules. This means it will typically take more of those signal molecules to produce a particular response from the cell.

The signal molecules produced by the cells move through the world by a random walk that simulates their diffusion through the body in the bloodstream.

Over time, the body's metabolism will burn through the glucose in the blood and the glycogen stored in the liver cells. This glucose can be replenished using the EAT button, which simulates nutrients being absorbed by the digestive system after a meal. This means that glucose will be added in small amounts over time, like in the real world. Eating several meals all in a row will not add glucose any more quickly, but it will increase the amount of time over which glucose is added. This mirrors how people take longer to digest after eating more food.

The model has some unavoidable differences from the real world. For example, real bodies will also have some blood sugar fluctuations, but the fluctuation in this model is mainly because it is has a higher grain size than a real body. Single ticks in the model correspond to a fairly long time (about 400 seconds), meaning that adjustments in the model take much longer than they would in a real body. Also, because there are fewer molecules in the model than there are in a body, differences of only one or two molecules can have a much larger impact in the model than they would in a body.

HOW TO USE IT

This model can be used to examine the effects of a variety of factors on glucose homeostasis. One of the most common factors that might affect this is activity level or exercise. You can simulate changes in this by adjusting the METABOLIC-RATE slider. Another common factor that influences homeostasis is eating, which can be simulated by pressing the EAT button.

Other interesting factors that can be simulated include metabolic disorders. These can be simulated by adjusting the GLUCOSE-SENSITIVITY, INSULIN-SENSITIVITY, and GLUCAGON-SENSITIVITY sliders.

This model makes it easy to explore how different factors affect the body's homeostasis and how the body responds to food. The best way to observe these changes is by looking at the SIGNAL MOLECULES plot in the bottom left corner. Anything you change will affect this plot, which shows the amount of glucose, insulin, and glucagon in the blood over time.

Buttons

SETUP: Initializes variables and creates the initial cells and molecules. GO: Runs the model. EAT: Simulates eating by adding glucose to the bloodstream over a short period.

FOLLOW-GLUCOSE: Highlights a glucose molecule until it is consumed or sequestered. FOLLOW-INSULIN: Highlights an insulin molecule until it is broken down. FOLLOW-GLUCAGON: Highlights a glucagon molecule until it is broken down.

Sliders

METABOLIC-RATE: The number of glucose molecules consumed by the body on each tick. GLUCOSE-SENSITIVITY: The probability that pancreatic cells will detect a glucose molecule that is present. INSULIN-SENSITIVITY: The probability that liver cells will detect an insulin molecule that is present. GLUCAGON-SENSITIVITY: The probability that liver cells will detect a glucagon molecule that is present.

Monitors

INSULIN: Shows the number of insulin molecules in the bloodstream. GLUCAGON: Shows the number of glucagon molecules in the bloodstream. BLOOD GLUCOSE: Shows the number of glucose molecules in the bloodstream. STORED GLUCOSE: Shows the number of glucose molecules stored in the liver.

Plots

SIGNAL MOLECULES: Shows the counts of glucose, insulin, and glucagon in the bloodstream.

THINGS TO NOTICE

Look at the SIGNAL MOLECULES plot while the model runs. This plot shows the amount of glucose, insulin, and glucagon in the bloodstream over time. Do the levels of these molecules change very much over time?

The monitors just above this plot show the current level of each signal molecule in the bloodstream precisely. The rightmost monitor shows the current amount of glucose stored in the liver. How does this glucose reserve change over time? How is this reserve affected by the metabolic rate? How is it affected by eating? How does this compare with your real world experience?

Eating can affect several parts of the body. When you click the EAT button, do the glucose, insulin, and glucagon levels in the blood increase or decrease? How big is this change compared to the baseline levels? How long does it take before they return to their baseline levels? Why do you think the levels of these molecules change in this specific way?

What happens if the body goes too long without eating?

Normal blood insulin levels are around 68 pmol/L and normal blood glucagon levels are around 22 pmol/L. How does this compare to what you see in the model? Can you explain any differences you observe?

THINGS TO TRY

The default sensitivity values are meant to mimic a healthy metabolism. Try to model type 2 diabetes, where the body's ability to detect insulin is dramatically reduced, by changing the sensitivity sliders. What do you notice about the baseline glucose and hormone levels? Are they higher or lower than in a healthy metabolism? How much higher or lower are they? Why do you think this happens?

When you eat there is a small spike in blood glucose. How big is the spike compared to the baseline glucose level? What changes about this spike in a diabetic metabolism as compared to a healthy metabolism? Is the spike taller in a healthy metabolism or in a diabetic metabolism? How long does each metabolism take to get back to a normal blood glucose level?

EXTENDING THE MODEL

In this model all pancreatic cells are identical and release both hormones, but in the body they are differentiated into several types which each release only one hormone. Does this change the model's behavior?

The sliders in this model can effectively simulate type 2 diabetes, which results from low insulin sensitivity. How could you model type 1 diabetes, which results from insufficient production of insulin?

There are many other hormones which also play a role in metabolism. For example, GLP-1 promotes insulin release, cortisol antagonizes insulin, and somatostatin suppresses the release of several hormones including insulin and glucagon. Does adding more signal molecules noticeably change the regulation of blood glucose?

The bloodstream also carries other nutrients like amino acids or fatty acids, which are regulated and interconverted based on the concentrations of these hormones. How do these nutrients affect the hormone and glucose levels? How does the composition of food intake affect hormone and glucose levels?

NETLOGO FEATURES

NetLogo buttons typically cause a procedure to occur exactly once when the button is pressed or 'forever', meaning once each tick until the button is pressed a second time. The EAT button in conjunction with the add-glucose procedure allows a button to run a procedure once every tick for the next N ticks.

This model also implements a new function random-binomial in the style of the NetLogo primitives random-normal, random-poisson, etc. which takes in the defining parameters n and p and outputs a binomial-distributed random number. This method of combining random number generators to define a new random number generator can be applied generally to form many distributions beyond NetLogo's built in capabilities.

RELATED MODELS

Checkout some of the other Biology models in the Models Library for similar models of other biological phenomenon.

HOW TO CITE

If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:

COPYRIGHT AND LICENSE

Copyright 2017 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

Comments and Questions

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

Click to Run Model

; All initialization / setup values are derived from real-world figures.
; I arrived at these values using estimates of resting blood sugar levels
; (80 mg/dL), post-meal blood sugar levels (120 mg/dL), human blood volume
; (5L), daily caloric intake (2000 kcal), average nutrient absorption period
; after a meal (2 hours), and starvation time (3 weeks).  Starting with the
; observations that the model's resting blood sugar level is about 4000 and
; adding glucoses at about 400 per tick raises the stable blood sugar by
; about 1.5 times, it is possible to derive the correspondence between
; glucose particles and mg glucose as well as reasonable meal sizes, the
; correspondence between ticks and seconds, meal lengths, metabolic rates,
; and initial glucose reserves. However, this ideal correspondence results
; in an enormous initial glucose store (10.5 million) and time to starvation
; in the model (105k ticks), so I have scaled the glucose energy density
; correspondence by about 1/25. This means that one tick represents about
; 7 minutes, and one glucose represents about 25 mg of real glucose,
; equivalent to 0.1 kcal. This is a fairly high grain size for both time and
; energy.  This also means that the blood sugar levels in the model are
; unusually high if scaled up to a real person, but most other times,
; relationships, and rates correspond properly to the real world within an
; order of magnitude. Most of the inaccuracies help to mitigate the negative
; effects of the high grain size noted earlier. I also accelerated starvation
; for ease of observation by reducing the initial store of glucose.

globals [
  molecule-size     ; display scaling constant
  hormone-half-life
  hormone-mean-life
  eating?           ; keep track of meal state based on EAT button presses
  eat-time          ; keep track of ongoing meal duration
  total-glucose     ; storage variable to record combined blood and stored glucose
  glucose-baseline  ; average 'normal' number of glucoses in the blood per cell
  meal-size
  meal-length
  estradiol ; valor de estradiol
  progesterona ; valor de progesterona
  ciclo-menstrual
  efecto-insulina
  día-ciclo
  hormonal-factor
]

; Set up different cell breeds.
; We need different cell types to behave differently.
; This is why cells are turtles rather than patches.
breed [ liver-cells liver-cell ]
breed [ pancreatic-cells pancreatic-cell ]

; Set up different molecule breeds
breed [ glucoses glucose ]
breed [ insulins insulin ]
breed [ glucagons glucagon ]

liver-cells-own [ glucose-store ]
insulins-own [ lifetime ]
glucagons-own [ lifetime ]

to setup
  clear-all

  set-default-shape turtles "circle outline"
  set molecule-size 0.25
  set eat-time 0
  set eating? false

  ; These values are calibrated to establish a reasonable correspondence for
  ; energy density and time between the model and the real world system.
  ; See the comment at the top of the file for more information.
  set glucose-baseline 3 ; Controls the normal blood glucose level.
  set hormone-half-life 2 ; Corresponds to 14 minutes, roughly twice insulin.
  set hormone-mean-life hormone-half-life / ln 2 ; From exponential distribution.
  set meal-size 7000 ; Corresponds to about 1/3 of daily caloric intake.
  set meal-length 17 ; Nutrient absorption period. Corresponds to about 2 hours.

  ; Ciclo menstrual
  set fase-ciclo "Folicular" ; Empieza por defecto en fase folicular (día 1 al 15)
  set ciclo-menstrual 1 ; El ciclo empieza en el día 1

  ; Modificación del "switch"
  if anticonceptivos? = "no" [
    ; Si se selecciona "off" (FALSE), se establecen determinados parámetros
    set estradiol 117 ; Estradiol en fase folicular con anticonceptivos
    set progesterona 1.4 ; Progesterona en fase folicular con anticonceptivos
    set sensibilidad-insulina 0.30 ; Sensibilidad a la insulina con anticonceptivos
    set sensibilidad-glucosa 1 ; Sensibilidad a la glucosa con anticonceptivos
  ]
  if anticonceptivos? = "yes" [
    ; Si se selecciona "on" (TRUE), se establecen determinados parámetros
    set estradiol 27.5463 ; Estradiol en fase folicular sin anticonceptivos
    set progesterona 0.101 ; Progesterone in follicular phase (without contraceptives)
    set sensibilidad-insulina 0.40 ; Insulin sensitivity (without contraceptives)
    set sensibilidad-glucosa 1 ; Glucose sensitivity (without contraceptives)
  ]

  ; Ajuste de sensibilidad según fase del ciclo
  if (ciclo-menstrual >= 1 and ciclo-menstrual <= 15) [
    ; Fase folicular (día 1 al 15)
    set sensibilidad-insulina 0.30
    set sensibilidad-glucosa 1
  ]
  if (ciclo-menstrual > 15 and ciclo-menstrual <= 28) [
    ; Fase lútea (día 16 al 28)
    set sensibilidad-insulina 0.25
    set sensibilidad-glucosa 0.9
  ]

  ;Iniciar el ciclo menstrual según el "chooser" (Folicular: 1-15, Lútea: 16-28)
  ifelse (fase-ciclo = "Folicular") [
    set ciclo-menstrual 1
  ][
      ifelse (fase-ciclo = "Lútea") [
        set ciclo-menstrual 16
       ][
          set ciclo-menstrual 1 ; Fase Folicular por defecto
         ]
        ]

  ; Set up organs
  make-liver
  make-pancreas

  let world-area (2 * max-pxcor + 1) * (2 * max-pycor + 1)

  ; Make initial molecules at approximately their stable concentrations.
  create-glucoses world-area * (glucose-baseline + 1) [
    random-position
    set color white
    set size molecule-size
  ]

  ; Hormones typically follow exponential decay, so their lifetimes
  ; are randomly drawn from an exponential distribution. This also
  ; makes the least assumptions, since the exponential distribution
  ; is the maximum-entropy distribution for a fixed, positive mean.
  create-insulins round (world-area / 3) [
    random-position
    set color sky
    set size molecule-size * 2
    set lifetime random-exponential hormone-mean-life
  ]
  create-glucagons round (world-area / 3) [
    random-position
    set color red
    set size molecule-size * 2
    set lifetime random-exponential hormone-mean-life
  ]

  ; keep track of the body's fuel
  set total-glucose (count glucoses) + sum ([glucose-store] of liver-cells)

  reset-ticks
  display
end 

to go

  if (total-glucose = 0) [
    user-message "The body ran out of glucose."
    stop
  ]
  every 1 [
    avanzar-ciclo
    metabolizar-señal
    mover-señal
    tick
  ]

  ; Hormonal and sensitivity adjustments must happen within specific turtles
  ask pancreatic-cells [
    adjust-hormones
  ]

  ask turtles [
    adjust-sensibilidad-insulina
  ]

  ; Keep track of the body's fuel
  set total-glucose (count glucoses) + sum ([glucose-store] of liver-cells)
end 

to metabolizar-señal
; Hígado detecta hormonas y absorbe/ libera glucosa
  ask liver-cells [
    adjust-glucose
  ]

  ; Pancreas detects glucose and maybe releases insulin / glucagon
  ask pancreatic-cells [
    adjust-hormones
  ]

  metabolize-glucose
  signal-degradation
end 

to mover-señal
; Ask signals to move
  ask insulins [ move ]
  ask glucagons [ move ]
  ask glucoses [ move ]
end 

to avanzar-ciclo
 ; Avanza el ciclo menstrual
  set ciclo-menstrual (ciclo-menstrual + 1) mod 28
  if (ciclo-menstrual = 0) [
    set ciclo-menstrual 1
  ] ; El día del ciclo nunca puede ser 0
end 

to adjust-sensibilidad-insulina
  ; Ajuste de la sensibilidad a la insulina basado en la fase del ciclo y consumo de anticonceptivos

  ; Iniciar factor de sensibilidad a la insulina
  let sensibilidad-insulina-factor 1

  ; Ajustar la sensibilidad a la insulina y glucosa en función de la fase del ciclo y consumo de anticonceptivos
  if anticonceptivos? = "no" [
    if (ciclo-menstrual >= 1 and ciclo-menstrual <= 15) [
    ; Fase folicular (día 1-15) sin anticonceptivos
      set sensibilidad-insulina 0.30
      set sensibilidad-glucosa 1
      set sensibilidad-insulina-factor 1 ; Factor sensibilidad base
    ]
  ]
    if (ciclo-menstrual > 15 and ciclo-menstrual >= 28) [
    ; Fase lútea (día 16-28) sin anticonceptivos
      set sensibilidad-insulina 0.25
      set sensibilidad-glucosa 0.9
      set sensibilidad-insulina-factor 0.833 ; Disminución leve del factor de sensibilidad
    ]

    if anticonceptivos? = "yes" [
      if (ciclo-menstrual >= 1 and ciclo-menstrual <= 15) [
      ; Fase folicular (día 1-15) con anticonceptivos
        set sensibilidad-insulina 0.40
        set sensibilidad-glucosa 1
        set sensibilidad-insulina-factor 1 ; Factor sensibilidad base
      ]
      if (ciclo-menstrual > 15 and ciclo-menstrual <= 28) [
      ; Fase lútea (día 16-28) con anticonceptivos
        set sensibilidad-insulina 0.35
        set sensibilidad-glucosa 0.9
        set sensibilidad-insulina-factor 0.875 ; Disminución leve del factor de sensibilidad
      ]
  ]

 ; Aplicar la sensibilidad a la insulina en relación tamaño moléculas de la interfaz
  ask insulins [
    set efecto-insulina efecto-insulina * sensibilidad-insulina-factor
  ]
end 

to adjust-tasa-metabólica
 if anticonceptivos? = "no" [
   set tasa-metabólica 50
  ]

 if anticonceptivos? = "yes" [
   set tasa-metabólica 60
  ]
end 

;----------- eat button ---------------
; Adds one meal's worth of glucose over the course of the defined meal time.

; Button procedure
; Either starts a new meal or extends a current meal.

to eat
  set eating? true
  set eat-time eat-time + meal-length
end 

; Implements eating process. Adds one meal's worth of glucose at
; a constant rate, spread across the whole length of a meal.

to add-glucose
  create-glucoses (meal-size / meal-length) [
    random-position
    set color white
    set size molecule-size
  ]
  set eat-time eat-time - 1
  if eat-time < 1 [ set eating? false ]
end 

;------------ setup helpers ---------------

; Particle procedure
; Place molecule at random location

to random-position
  setxy (min-pxcor + random-float (max-pxcor * 2))
        (min-pycor + random-float (max-pycor * 2))
end 

; Sets up liver cells

to make-liver
  ask patches with [ pxcor < round (max-pxcor / 2) ] [
    sprout-liver-cells 1 [
      set shape "square 2"
      set color brown + 2
      set glucose-store random-poisson 150 ; Enough to survive for about a week.
    ]
  ]
end 

; Sets up pancreatic cells

to make-pancreas
  ask patches with [ pxcor >= round (max-pxcor / 2) ] [
    sprout-pancreatic-cells 1 [
      set shape "square 2"
      set color yellow - 1
    ]
  ]
end 

; ----------- signal procedures ------------

; Molecule procedure

to move
  rt random 90
  lt random 90
  fd 1
end 

; Observer procedure

to signal-degradation
  ask insulins [
    set lifetime lifetime - 1
    if (lifetime <= 0) [ die ]
  ]
  ask glucagons [
    set lifetime lifetime - 1
    if (lifetime <= 0) [ die ]
  ]
end 

; Observer procedure

to metabolize-glucose
  ifelse (count glucoses >= tasa-metabólica) [
    ask n-of tasa-metabólica glucoses [ die ]
  ] [
    ask glucoses [ die ]
  ]
end 

;---------------- cell procedures ---------------
; Both cell types implement signal sensitivity using the binomial distribution.
; In this context, each signal's sensitivity slider directly governs the
; probability that a cell will detect the presence of that signal when it is
; present. Lowering the sensitivity makes cells more likely to miss signals.
; The binomial distribution gives the probability that a cell will detect k signals
; when n signals are present, given a detection probability p for each signal.
; This can be used to produce likely signal counts (or k's) for a cell with n
; signal molecules present and a given signal sensitivity.

; Liver procedure
; Releases or sequesters glucose based on the local hormone concentrations.

to adjust-glucose
  ; Detect hormones according to a binomial distribution based on their sensitivities.
  let insulin-count random-binomial (count insulins-here) sensibilidad-insulina
  let glucagon-count random-binomial (count glucagons-here) sensibilidad-glucagón

  ; A positive net signal means we release glucose.
  ; The stronger the signal (the larger the absolute value),
  ; the more glucose is released or sequestered.
  let net-signal glucagon-count - insulin-count

  ; If there is more glucagon signal than insulin signal, release glucose.
  if net-signal > 0 [
    ifelse (glucose-store >= net-signal) [
      ; If there is a lot of glucose stored in the cell, hatch new glucose molecules.
      hatch-glucoses net-signal [
        random-position
        set color white
        set size molecule-size
      ]
      ; Account for the change in stored glucose (net-signal > 0).
      set glucose-store glucose-store - net-signal
    ] [
      ; If there is not enough glucose stored in the cell, release as much as possible.
      hatch-glucoses glucose-store [
        random-position
        set color white
        set size molecule-size
      ]
      set glucose-store 0
    ]
  ]
  ; If there is more insulin signal than glucagon signal, sequester glucose.
  if net-signal < 0 [
    ifelse (count glucoses >= abs net-signal) [
      ; If there's a lot of blood glucose, sequester what you need (net-signal < 0).
      set glucose-store glucose-store - net-signal
      ask n-of abs net-signal glucoses [ die ]
    ] [
      ; If there's not ehough blood glucose, sequester as much as possible.
      set glucose-store glucose-store + count glucoses
      ask glucoses [ die ]
    ]
  ]
end 

; Pancreas procedure
; Produces hormones according to the local glucose concentration.

; Hormones typically follow exponential decay, so their lifetimes
; are randomly drawn from an exponential distribution. This also
; makes the least assumptions, since the exponential distribution
; is the maximum-entropy distribution for a fixed, positive mean.

to adjust-hormones

   ; Ajuste de hormonas según la fase del ciclo y el no consumo de anticonceptivos
  if anticonceptivos? = "no" [
    ; En fase folicular (día 1-15)
    if (ciclo-menstrual >= 1 and ciclo-menstrual <= 15) [
      set estradiol 117
      set progesterona 1.4
    ]
    ; En fase lútea
    if (ciclo-menstrual > 15 and ciclo-menstrual <= 28) [
      set estradiol 497.5
      set progesterona 28.9
    ]
  ]

  ; Ajuste de hormonas según la fase del ciclo y consumo de anticonceptivos
  if anticonceptivos? = "yes" [
    ; En fase folicular (día 1-15)
    if (ciclo-menstrual >= 1 and ciclo-menstrual <= 15) [
      set estradiol 27.5463
      set progesterona 0.101
    ]
    ; En fase lútea (día 16-28)
    if (ciclo-menstrual > 15 and ciclo-menstrual <= 28) [
      set estradiol 117.054
      set progesterona 2.099
    ]
  ]

  ; Detect glucose according to a binomial distribution based on the sensitivity.
  let glucose-count random-binomial (count glucoses-here) sensibilidad-glucosa
  ; Signal strength is determined by the difference in concentration from normal.
  let signal-count abs (glucose-baseline - glucose-count)

  ; Ajuste de hormonas según la fase del ciclo
  if anticonceptivos? = "no" [
      if (ciclo-menstrual >= 1 and ciclo-menstrual <= 15) [ ; Fase folicular (día 1-15)
        set hormonal-factor hormonal-factor * 0.1415 ; Factor hormonal normalizado
      ]
      if (ciclo-menstrual > 15 and ciclo-menstrual <= 28) [ ; Fase lútea (día 16-28)
        set hormonal-factor hormonal-factor * 1 ; Factor hormonal normalizado
      ]
  ]

  if anticonceptivos? = "yes" [
    if (ciclo-menstrual >= 1 and ciclo-menstrual <= 15) [ ; Fase folicular
      set hormonal-factor hormonal-factor * 0.0314 ; Factor hormonal normalizado
    ]
    if (ciclo-menstrual > 15 and ciclo-menstrual <= 28) [ ; Fase lútea
      set hormonal-factor hormonal-factor * 0.0951 ; Factor hormonal normalizado
    ]
  ]

  ; If there are too few glucoses...
  if (glucose-count < glucose-baseline) [
    ; ...release glucagon molecules.
    hatch-glucagons signal-count [
      random-position
      set color red
      set size molecule-size * 2
      set lifetime random-exponential hormone-mean-life
    ]
  ]
  ; If there are too many glucoses...
  if (glucose-count > glucose-baseline) [
    ; ...release insulin molecules.
    hatch-insulins signal-count [
      random-position
      set color sky
      set size molecule-size * 2
      set lifetime random-exponential hormone-mean-life
    ]
  ]
end 

;------------- follow procedures -------------

to follow-glucose
  watch one-of glucoses
end 

to follow-insulin
  watch one-of insulins
end 

to follow-glucagon
  watch one-of glucagons
end 

;---------------- math helpers ----------------

; Returns the outcome of a Bernoulli trial with success probability p.
; Successes are reported as 1 and failures are reported as 0.

to-report random-bernoulli [ p ]
  report ifelse-value random-float 1 < p [1] [0]
end 

; Returns a random number according to the binomial distribution with parameters n and p
; where n is the number of trials and p is the probability of success in each trial.

to-report random-binomial [n p]
  if (n < 0) or not (int n = n) [
    error "Input n must be a non-negative integer."
  ]
  if (p < 0) or (p > 1) [
    error "Probability p must be between 0 and 1."
  ]

  ; Sum the number of successes in n Bernoulli trials with success probability p.
  report sum n-values n [random-bernoulli p]
end 


; Copyright 2017 Uri Wilensky.
; See Info tab for full copyright and license.

There is only one version of this model, created 1 day ago by IB EIBiología2025.

Attached files

File Type Description Last updated
Modelización del uso de anticonceptivos en el sistema hormonal (glucosa, insulina y glucagón) de mujeres con y sin diabetes basada en datos reales.png preview Preview for 'Modelización del uso de anticonceptivos en el sistema hormonal (glucosa, insulina y glucagón) de mujeres con y sin diabetes basada en datos reales' 1 day ago, by IB EIBiología2025 Download

This model does not have any ancestors.

This model does not have any descendants.