Pulmonary Edema w/image

No preview image

1 collaborator

Tags

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.2 • Viewed 441 times • Downloaded 40 times • Run 0 times
Download the 'Pulmonary Edema w/image' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

extensions [ vid ]
Globals [ Normal
         Cardiogenic-Pulmonary-Edema
         ] ;; setting two states of the world - scenarios: (1) for Normal lung physiology and (2) for Pulmonary Edema formation

                               ;; setting agent breeds:
breed [ wmolecules wmolecule ] ;; water molecules, which are the ones who will extravasate and flood ACM and alveoli
breed [ fmolecules fmolecule ] ;; fluid molecules wich are to stay in the capillary
breed [ macromolecules macromolecule ] ;; macromolecules (albumine) which physiological keep wmolecules in the capillary
breed [ erythrocytes erythrocyte ] ;; Red Blood Cells which are to stay in the capillary
breed [ spinners spinner ]

patches-own ;; property of patches to form physiological space zones
[
  capillary
  ACM-alveoli
]

wmolecules-own [extravasated?] ;; property for water molecules to move outside capillary and to flood ACM and alveoli

to setup
  ca
  import-drawing "A11.png"
  create-spinner

  if (scenario = "Normal") ;; setting parameters for "Normal" scenario
  [
    set hydrostatic-pressure 18
    set oncotic-pressure 25
  ]
  if (scenario = "Cardiogenic-Pulmonary-Edema") ;; setting parameters for "Cardiogenic Pulmonary Edema" scenario
  [
    set hydrostatic-pressure 22
    set oncotic-pressure 24
  ]

  create-erythrocytes 5 ;; creating RBC with respective properties
   ask erythrocytes
  [
   set xcor random-xcor
   set color pink
   set size 3
   set shape "erythrocyte"
    set heading 90
  ]

  create-wmolecules 700 ;; creating water molecules with respective properties and which are to extravasate
  ask wmolecules
  [
   set extravasated? false
   set xcor random-xcor
   set color blue
   set shape "circle 2_w"
    set heading 0
  ]

   create-fmolecules 300 ;; creating fluid molecules with respective properties wich are to move along capillary
   ask fmolecules
  [
   set xcor random-xcor
   set color blue
    set size 1.1
   set shape "circle 2_w"
    set heading 90
  ]

   create-macromolecules 10 ;; creating macromolecules with respective properties wich are to move along capillary
   ask macromolecules
  [
   set xcor random-xcor
   set color yellow
   set size 1.5
   set shape "circle"
    set heading 90
  ]

  ask patches [ set pcolor white ] ;; setting preliminary conditions for the setup of 'extravascular space'
  ask patches [ setup-capillary ]
  ask patches [ setup-ACM-alveoli ]

   ask turtles [move-to one-of patches with [pycor < 5 and pycor > 1]] ;; moving created agents to their orginal
                                                                       ;; position (i.e. in the capillary)
  ask spinners [setxy 13 29]
  reset-ticks
  if vid:recorder-status = "recording" [ vid:record-interface ]
end 

to setup-capillary ;; setting the capillary zone of pink color anf its walls of red color
  if (pycor < 6) and (pycor > 0) [set pcolor pink]
   ask patches with [ pycor = min-pycor]
    [ set pcolor red ]
   ask patches with [ pycor = 6 ]
    [ set pcolor red ]
end 

to setup-ACM-alveoli ;; setting the extravascular space with ACM of grey color and alveola of white color
  if (pycor < 10) and (pycor > 6) [ set pcolor grey ]
  if (pycor < 22) and (pycor > 10) [ set pcolor white ]
end 

to go

  let acm-patches patches with [pycor < 10 and pycor > 6] ;; procedure simulating water extravasation under
  ask one-of acm-patches                                  ;; physiological condition. This water is then removed
  [                                                       ;; by lymph drainage mechanism
    sprout 7
  ask turtles-here
    [
    set shape "circle 2_w"
    set color blue
    ]
  ]
  ask turtles-on patches with [pycor < 10 and pycor > 6] ;; initiation of the lymph drainage machanism
  [drain-acm]

  ask wmolecules [  ;; procedure for water molecules extravasation
  extravasate
  ]
  ask macromolecules ;; procedures that simulate blood movement along the capillary
   [ fd 3]
  ask fmolecules
   [ fd 10 ]
  ask erythrocytes
   [ fd 1 ]

  if count wmolecules with [ not extravasated?] < 50   ;; procedure for stopping the model when a certain number of
   [                                                   ;; water molecules extravasated
    stop ]

  if  (scenario = "Cardiogenic-Pulmonary-Edema") and oncotic-pressure >= 25 ;; procedure for stopping the model when
  [                                                                         ;; OP value is above normal range
    stop ]

   tick
  update-spinner
  if vid:recorder-status = "recording" [ vid:record-interface ]
end 

to extravasate   ;; extravasation based on HP and OP values
  if ( random-float 25 > oncotic-pressure and random-float -6 < ( hydrostatic-pressure - oncotic-pressure))
  [
    set extravasated? true
    ask wmolecules [                                          ;; procedure simulating extravasation consisting on
      move-to one-of patches with [pycor < 12 and pycor > 6]  ;; movement of water molecules out of the capillary -
    ]                                                         ;; to ACM and alveoli
  ]
end 

to drain-acm ;; procedure for simulation of lymph drainage mechanism
  if count turtles-on patches with [pycor < 10 and pycor > 6] > 200
  [ask turtles-here
    [ die ]
  ]
end 

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

to update-spinner
  ask spinners [
    set heading ticks * 30
    set label ticks
  ]
end 

to start-recorder
  carefully [ vid:start-recorder ] [ user-message error-message ]
end 

to reset-recorder
  let message (word
    "If you reset the recorder, the current recording will be lost."
    "Are you sure you want to reset the recorder?")
  if vid:recorder-status = "inactive" or user-yes-or-no? message [
    vid:reset-recorder
  ]
end 

to save-recording
  if vid:recorder-status = "inactive" [
    user-message "The recorder is inactive. There is nothing to save."
    stop
  ]
  ; prompt user for movie location
  user-message (word
    "Choose a name for your movie file (the "
    ".mp4 extension will be automatically added).")
  let path user-new-file
  if not is-string? path [ stop ]  ; stop if user canceled
  ; export the movie
  carefully [
    vid:save-recording path
    user-message (word "Exported movie to " path ".")
  ] [
    user-message error-message
  ]
end 

;; There are no procedures in this model.
;; All of the code is in the buttons in
;; the interface tab.


; Public Domain:
; To the extent possible under law, Uri Wilensky has waived all
; copyright and related or neighboring rights to this model.

There is only one version of this model, created over 6 years ago by Victor Iapascurta.

Attached files

File Type Description Last updated
A11.png png this image is to be imported by the model Pulmonary Edema w/image over 6 years ago, by Victor Iapascurta Download
PE_image.jpg jpeg this is a preview image for Pulmonary Edema w/image over 6 years ago, by Victor Iapascurta Download

Parent: Pulmonary_Edema_01_2

This model does not have any descendants.

Graph of models related to 'Pulmonary Edema w/image'