Sleep-Wake_Regulation-Model 01_01

Sleep-Wake_Regulation-Model 01_01 preview image

1 collaborator


sleep, sleep regulation 

Tagged by Victor Iapascurta 21 days ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.1 • Viewed 77 times • Downloaded 0 times • Run 0 times
Download the 'Sleep-Wake_Regulation-Model 01_01' modelDownload this modelEmbed this model

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


This model represents an abstract conceptual model of sleep regulation. Main mechanisms presented in the model include Circadian Rhythm and Homeostatic mechanism/component.

Actual model simulates how different mechanisms participate in sleep regulation. It integrates two classical models: (a) Two-Process model and (b) Sleep/wake flip-flop model.

The main question to be solved by the model is visualization of how the cycling of sleep/wake phases occurs. These phases are triggered by particular processes and controlled by specific brain-level mechanisms (e.g. adenosine level).


The brain physiologically functions in two distinct states: wake and sleep. These states have their unique importance for the human body as a whole and regularly alternate. This alternation is governed by complex physiological mechanisms generally referred to as "sleep-regulation".

A simple version of the conceptual model of sleep regulation includes two systems (Circadian and Homeostatic) that interact as a flip-flop mechanism. The result of this interaction can be seen in the observed subject as either being awake during the day or sleeping during the night.

This model includes:

* Neurons (as agents) that are assembled in different centers/structures:

(a) wake-promoting (LC, DR, LDT/PPT, Thalamus, Orexin System, Cortical);

(b) sleep-promoting (VLPO and Pineal Gland).

As a result of neuron activity, adenosine is generated in the brain (a product of ATP decay).

* Neurons are connected in networks (within the structures and between the structures) by links. Neurons and links are visualized on the projection of a brain image approximating their anatomical location (i.e. spatial environment).

* Processes generating two distinct states: Wake and Sleep. Adenosine level increases during wake state and play an important role in initiating sleep state in conjunction with certain elements of circadian mechanism. In this model adenosine level over a set threshold switches the wake phase to sleep.

Thus, neurons act as agents, which are represented by turtles of different shapes (mainly circles) and color connected by links of different breeds (directed and un-directed). Neurons produce adenosine which is diffused by patches serving as main trigger for state switch. During sleep state adenosine is cleared out and a minimum threshold level contributes to switching the state back to "awake", ensuring the cycling nature of the wake-sleep transition phenomenon.

During a tick neurons produce adenosine which is being diffused by patches - (during the wake state) or cleared (during sleep state). This can be observed on plots and by the color changes in patches depending on the system state/phase. Links dynamics (formation, alternation, disappearance) simulates neuronal activity characteristic for a certain stage (e.g. green color links simulate VLPO depressing influence on ARAS during the sleep-state)


ARAS - ascending reticular activating system

LC - locus coeruleus

DR - dorsal raphe nucleus

LDT/PPT - pedunculopontine and laterodorsal tegmental nuclei

VLPO - ventrolateral preoptic nucleus


(1) Setup: Clears the world and creates respective spatial physiological environment and agents. A brain image is imported (the file with the image should be located in the same folder with Netlogo file).

(2) Go: Runs the model, usually starting with the wake state.

(3) Scenario chooser: select one of the two scenarios, “Normal” or “Sleep-deprivation"

(4) Upper plot - represents the circadian rhythm.

(5) Bottom plot - red color curve shows adenosine level over time, which is increasing exponentially during wake phase and decreasing during sleep phase. The green line represents a threshold level which, once reached, contributes to initiation of sleep phase.

(6) Bottom reporter shows abs value of adenosine (in nM with a physiological range between 25 and 300 nM)

1 tick is equivalent to approximately 15 minutes of real time.

To run the model: Press "Setup" then "Go" button.

Scenario can be selected either before Setup and Go or during the model run irrespective of the running scenario.


* Basic/Normal scenario: starts with a wake phase during which wake-promoting neurons/structures are active showing complex interactions and producing adenosine. This is also visualized by change in color (from black to red) of the space surrounding neurons. A specified adenosine threshold level triggers transition to sleep phase.

During sleep phase VLPO neurons (of green color) become active and suppress wake-promoting neurons activity, especially the ones which are part of ARAS. During this phase the environment is cleared of adenosine (visualized by change in color from red back to black). Activity of most of the structures is dramatically decreased or stopped. A specified 'lower-threshold' adenosine level transitions the system back to wake phase.

Phasic variations of adenosine level and respective curve on the bottom plot are approximately synchronous with the circadian rhythm on the upper plot. Synchronization is better observed after 300 ticks from the model start.

Extrapolating the adenosine curve to circadian one: adenosine level starts to increase during waking and then at some point when it hits this upper threshold of the circadian rhythm, sleep occurs and then adenosine level starts to decrease. And when it reaches the lower threshold set by the circadian curve, then waking occurs.

* Running "Sleep-deprivation" scenario will cause an increase in adenosine level over "upper-threshold" leading to a lengthening of the duration of both phases. The duration of sleep deprivation (i.e. wake phase) is set to represent approximately 32 hours without sleep. Following sleep-phase duration in this case will be approximately 14 hours.


When selecting and running "Sleep-deprivation" scenario pay attention to what happens once the 'elongated cycle' is over.


The model can be extended/improved by better synchronization between adenosine curve plotting and circadian rhythm or even placing all three curves on the same plot.

By adjusting the procedures for adenosine generation and clearance, the duration of sleep/wake phases and their ratio can be tuned more precisely.

Adding supplementary mechanisms that can participate in sleep/wake regulation (orexin, melatonin, etc.) as well as REM/NREM aspects would be a challenge.


Although a global close similarity with existing NetLogo models is difficult to identify, elements used to build this model are present in a number of models in the library:

* Network Example

* Artificial Neural Net - Multilayer

* Peppered Moths

* Diffuse Off Edges Example

* Link-Walking Turtles Example


This simple abstract model was developed by Victor Iapascurta, MD. At time of development he was in the Department of Anesthesia and Intensive Care at University of Medicine and Pharmacy in Chisinau, Moldova / ICU at City Emergency Hospital in Chisinau. Please email any questions or comments to

The model was created in NetLogo 6.0.1, Wilensky, U. (1999). NetLogo. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

Re. concerning neurophysiological/medical aspects:

* Amar K. Pani et al, Neurochemical Measurement of Adenosine in Discrete Brain Regions of Five Strains of Inbred Mice Published: March 18, 2014

* Rempe et al, A mathematical model of the sleep­wake cycle, J Math Biol, 2010

* D. Riemann et al, The neurobiology, investigation, and treatment of chronic insomnia, The Lancet Neurology, May 2015 doi:10.1016/S1474-4422(15)00021-6

Comments and Questions

How to make the model run

It looks like import-drawing primitive is not supported. In order to run the model without the brain image the code should be changed and recompiled. After activating "Run in NetLogo Web" and "Click to Run the Model" the line # 48 in the code should be erased/deactivated and the code recompiled by pressing the respective button. After this the model can be run. Sorry for inconvenience. Author of the model

Posted 21 days ago

Click to Run Model

globals [


breed [fc-neurons fc-neuron]
breed [mc-neurons mc-neuron]
breed [pc-neurons pc-neuron]
breed [lc-neurons lc-neuron]
breed [vlpo-neurons vlpo-neuron]
breed [th-neurons th-neuron]
breed [dr-neurons dr-neuron]
breed [ldt-ppt-neurons ldt-ppt-neuron]
breed [ox-neurons ox-neuron]

breed [nodes node]
breed [impulses impulse]
breed [spinners spinner]

undirected-link-breed [rf-links rf-link]
undirected-link-breed [slinks slink]
directed-link-breed [red-links red-link]
directed-link-breed [green-links green-link]

patches-own [ adenozin ]
impulses-own [location]

to setup


 import-drawing "Sleep-Wake_Regulation-M01_01.png"


 ask turtles [ set adenozin random 0.1 ]

 ask patches at-points [[7 -11] [0 0] [2 3] [2 -16] [8 -21]]
  [ sprout-nodes 1
    set shape "circle"
    set size 3

  ask nodes [
    create-rf-link-with one-of other nodes

  create-impulses 5 [
    set shape "circle"
    set size 1
    set color yellow
    set location one-of nodes
    move-to location
  set edge-patches patches with [count neighbors != 8]
  set main-patches patches with [count neighbors = 8]

   ask spinners [setxy -40 -40]


to create-fc-network
   create-fc-neurons  20 [
      set shape "circle"
      set color yellow
    set size 1.5
  set fc-network patches with [
        pxcor > ( - 38 ) and
        pxcor <  ( - 27 ) and
        pycor > 0 and
        pycor < 27

  ask fc-neurons [move-to one-of fc-network

to create-mc-network
   create-mc-neurons  30 [
      set shape "circle"
      set color yellow
    set size 1.5
  ask one-of mc-neurons [ set label "Cortex" ]

  set mc-network patches with [
        pxcor > ( - 20 ) and
        pxcor < 20 and
        pycor > 20 and
        pycor < 37

   ask mc-neurons [move-to one-of mc-network]

to create-pc-network
   create-pc-neurons  40 [
      set shape "circle"
      set color yellow
    set size 1.5

  set pc-network patches with [
        pxcor > 18 and
        pxcor < 38 and
        pycor > ( - 2) and
        pycor < 24

   ask pc-neurons [move-to one-of pc-network]

to create-lc-network
   create-lc-neurons 1 [
      set shape "elipce"
      set color violet
      set size 7
      set heading (- 10)
      set label "LC"

  set lc-network patches with [
        pxcor >  6  and
        pxcor < 9 and
        pycor > ( - 20 ) and
        pycor < ( - 18)

   ask lc-neurons [move-to one-of lc-network]

to create-vlpo-network
      create-vlpo-neurons 2 [
      set shape "circle"
      set color green
      set size 3
     ask one-of vlpo-neurons [ set label "VLPO" ]

  set vlpo-network patches with [
        pxcor > ( - 8 ) and
        pxcor < ( - 6 ) and
        pycor > ( - 5 ) and
        pycor < 0

   ask vlpo-neurons [move-to one-of vlpo-network]

to create-th-network
   create-th-neurons 7 [
      set shape "circle"
      set color orange
    set size 2
   ask one-of th-neurons [ set label "Thalamus" ]

  set th-network patches with [
        pxcor > ( - 6 ) and
        pxcor < 8 and
        pycor > 2 and
        pycor < 12

   ask th-neurons [move-to one-of th-network]

to create-dr-network
   create-dr-neurons  1 [
      set shape "circle"
      set color magenta
      set size 2.5
      set label "DR"
  set dr-network patches with [
        pxcor > 1 and
        pxcor <  3 and
        pycor > (-17) and
        pycor < (-15 )

  ask dr-neurons [ move-to one-of dr-network ]

to create-ldt-ppt-network
   create-ldt-ppt-neurons  1 [
      set shape "circle"
      set color pink
      set size 2.5
      set label "LDT/PPT"
  set ldt-ppt-network patches with [
        pxcor > 6 and
        pxcor <  8 and
        pycor > ( - 12 ) and
        pycor < ( - 10 )

  ask ldt-ppt-neurons [move-to one-of ldt-ppt-network

to create-ox-network
   create-ox-neurons 3
    set shape "pentagon"
    set color yellow
    set size 2
    set label "Orexin"
  set ox-network patches with [
        pxcor > 1 and
        pxcor < 2 and
        pycor > 3 and
        pycor < 4

to go

  diffuse adenozin 0.7

to run-wake-state

   if not any? fc-neurons [stop]
   ask one-of fc-neurons [
    create-slink-with one-of other fc-neurons
  while [ count slinks > 30 ]
  [ ask one-of slinks [ die ]

    if not any? mc-neurons [stop]
   ask one-of mc-neurons [
    create-slink-with one-of other mc-neurons
  while [ count slinks > 50 ]
  [ ask one-of slinks [ die ]

    if not any? pc-neurons [stop]
   ask one-of pc-neurons [
    create-slink-with one-of other pc-neurons
  while [ count slinks > 60 ]
  [ ask one-of slinks [ die ]

   if not any? th-neurons [stop]
   ask one-of th-neurons [
    create-slink-with one-of other th-neurons
  while [ count slinks > 15 ]
  [ ask one-of slinks [ die ]

   ask one-of th-neurons [
    create-red-link-to one-of pc-neurons
  ask red-links [
    set color red
    set thickness 0.2

  while [ count red-links > 3 ]
  [ ask one-of red-links [ die ]
   ask one-of th-neurons [
  create-red-link-to one-of mc-neurons
  ask red-links [
    set color red
    set thickness 0.2

  while [ count red-links > 3 ]
  [ ask one-of red-links [ die ]
    ask one-of th-neurons [
    create-red-link-to one-of fc-neurons
    ask red-links [
    set color red
    set thickness 0.2

  while [ count red-links > 3 ]
  [ ask one-of red-links [ die ]

  ask green-links [die]

  ask turtles [
    set adenozin random 0.1 + 0.5  ]

  ask rf-links [ set thickness 0
                 set color yellow]
  ask impulses [
                 let new-location one-of [rf-link-neighbors] of location
                 ask [rf-link-with new-location] of location [ set thickness 1 ]
                 face new-location
                 move-to new-location
                 set location new-location

 if (scenario = "Normal") and ( round sum [adenozin] of patches ) >= 1000
    [ set sleep-propencity? true]

 if (scenario = "Sleep-deprivation") and (( round sum [adenozin] of patches ) >= 1500)
    [ set sleep-propencity? true
      set scenario  "Normal" ]

to recolor-patches

  ask patches [ set pcolor scale-color red adenozin 0 1 ]

to run-sleep-state

  ask turtles [set adenozin adenozin - 0.2]
  ask impulses [stop]

  ask rf-links [set thickness 0]
  ask slinks [die]
  ask red-links [die]

  if not any? vlpo-neurons [stop]
  ask one-of vlpo-neurons [
  create-green-link-to one-of lc-neurons

  ask one-of vlpo-neurons [
                           create-green-link-to one-of DR-neurons

  ask one-of vlpo-neurons [
                           create-green-link-to one-of ldt-ppt-neurons

  ask one-of vlpo-neurons [
                           create-green-link-to one-of ox-neurons

    ask green-links [
    set color green
    set thickness 0.7 ]
    while [ count green-links > 3 ]
    [ ask one-of green-links [ die ]

  ask edge-patches [ set adenozin 0 ]
  repeat 100 [ ask edge-patches [ set adenozin 0 ]]
  ifelse round sum [adenozin] of patches <= 0
  [set sleep-propencity? false]
  [set sleep-propencity? true]

to cycle-s-propencity
   ifelse (sleep-propencity? = false) [

to create-spinner
  create-spinners 1 [
    set shape "clock"
    set color gray - 1.5
    set size 15
    set heading -0
    set label 0
    set label-color green

to update-spinner
    ask spinners [
    set heading ticks * 10
    set label ticks
    set adenozin adenozin - 0.3

There is only one version of this model, created 22 days ago by Victor Iapascurta.

Attached files

File Type Description Last updated
Sleep-Wake_Regulation-Model 01_01.png preview preview file 21 days ago, by Victor Iapascurta Download
SM_RM2.jpg jpeg preview 21 days ago, by Victor Iapascurta Download

This model does not have any ancestors.

This model does not have any descendants.