Pulmonary Edema w/image

No preview image

1 collaborator


Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.2 • Viewed 140 times • Downloaded 5 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.)


Pulmonary Edema (PE) is a life threatening medical condition. The pathophysiological mechanism PE is based on represents a complex phenomenon.

This abstract model is intended to visualize PE formation under the influence of Hydrostatic Pressure (HP) and Oncotic Pressure (OP) as main driving forces in Cardiogenic Pulmonary Edema (CPE) progression.

The main question to be solved by the model is visualization of how extravascular lung water can cumulate over time being influenced by HP and OP.

Primary beneficiaries of this model are mainly medical students.


The pathophysiological mechanism of Pulmonary Edema is quite complicated and is partly explained by Starling equation for fluid dynamics ( Q = LpS ([Pc – Pi] – Ϭ[πp – πi] ). In a simplified manner it can be presented like a dynamical situation where the fluid (water) is kept in the vessels due to special mechanisms/forces and does not „flood” the extravascular space. In the lung this is of major importance since an increased volume of ‚extravascular’ water can dramatically impair oxygen diffusion from the lung/alveoli to the blood and subsequently to body tissues.

Although there are many factors/forces which influence fluid dynamics in the lung, for academic purpose these factors can be reduced to two main ones: (a) hydrostatic pressure (HP) in the vessels (i.e. pulmonary capillary), and (b) oncotic pressure (OP), due to the macromolecules, mainly albumin, in the blood. HP forces the fluid out, while OP keeps the fluid in the vessels. In this case the Starling equation can be reduced to the following: Q = k (HP-OP), where ‘k’ is membrane permeability (= const. in this model), and movement of water out of the vessels, leading to pulmonary edema, is greatly dependent on the balance of these two factors (i.e. an increase in HP over a physiologic norm/ threshold and (or) subnormal values of OP can cause fluid extravasation = pulmonary edema).

In the actual model the environment where these forces act is a ’physiological’ space including 3 main zones: capillary (= pink color patches with red patches for capillary walls), alveolar-capillary membrane (ACM) (=grey color patches) and alveoli (white color patches). The latter two zones are presented as ‚extravascular space’.

Main ‚agents/agentsets’ are: (a) fluid/water molecules (sky color) and (b) macromolecules in the vessels (yellow), (c) water molecules which can also be located outside the vessels (sky color). Excessive water expansion to the pulmonary ‘extravascular space’ would be the equivalent of pulmonary edema.

Under physiological condition a certain volume of water ‘extravasates’ anyway, but this usually does not lead to PE because of the lymph drainage mechanism which keeps lung ‘dry’. In case of PE the volume of extravasated water exceeds the lymph drainage capacity flooding the ‘extravascular space’ which volume is approximately 400 ml, and even alveoli.

For better visualization of the phenomenon the model operates under two scenarios:

(1) Normal, when extravasated fluid is effectively cleared by the lymph drainage mechanism, and (2) Cardiogenic Pulmonary Edema (CPE), which is one of the most common forms of Pulmonary Edema, where the volume of extravasated fluid markedly exceeds the volume of the extravascular space and the capacity of the lymph drainage mechanism.

The main controls in the model are HP and OP levels, and their ratio which is responsible for the two distinct states: Normal and CPE formation. The ‚core’ parameter (and main output of the model) is pulmonary ‚extravascular’ water volume.

The ultimate physiological function of the lung is oxygenation of the blood and the main functional characteristic of this process is ‚oxygenation efficiency’, which can be dramatically affected by excessive extravascular lung water. This particular model does not count for ‚oxygenation’ but can be extended by adding more elements/agents. Although Red Blood Cells (RBC - red color/circle shape) in the actual model do not bear any particular functional load they are included in the model for a ’more realistic picture’ from physiological point of view and as a ’bridge’ for future model extensions.


(1) Scenario chooser: select one of the two scenarios, “Normal” or “Cardiogenic Pulmonary Edema”:

(a) Normal - simulates normal physiology at the “Capillary-ACM-Alveoli” level: sets HP and OP values within a ‘normal’ range (i.e. HP = 18 mmHg and OP = 25 mmHg), simulates blood flow along the capillary (i.e. directed movement of fluid/water molecules, RBC and macromolecules) and water extravasation (to ACM only) in a physiological range, lower than extravascular space volume (shown by the red line on the plots) and being effectively cleared by lymph drainage (blue line). Aggregated effects of these processes can be observed on the upper plot.

(b) Cardiogenic Pulmonary Edema - simulates PE progression: sets HP and OP values within a ‘pro-edema’ range (i.e. HP = 22 mmHg and OP = 24 mmHg) and simulates water extravasation to ACM and even Alveoli. The volume of extravascular lung water (extravasated water molecules) exceeds the volume of the extravascular space (red line) and lymph drainage capacity. This is being visualized on bottom plot (i.e. green line = excessive lung water accumulation). This scenario stops automatically once a certain volume of extravascular lung water is reached or after a preset number of ticks.

(2) Setup: Clears the world and creates respective spatial physiological environment and agents, creating basic conditions for the selected scenario run.

(3) Go: runs the selected scenario

(4) and (5) Two sliders controlling HP and OP levels: these levels are preset by the selected scenario. It is recommended not to be changed during first few simulations in order to observe ‘pure scenario run’. After this they can be varied during the run of each of the scenarios, especially decreasing OP level, which has a “pro-edema effect”. HP level change has a less evident effect.

(6) Upper plot - blue line: shows the ‘physiological’ version of extravasation and the effect of the lymph drainage mechanism.

(7) Bottom plot - green line: shows the excessive water extravasation over time in Pulmonary Edema.

The red line on both plots represents the extravascular space volume. Both plots are active during any of the scenario run.


“Normal” Scenario:

• It starts each time after reset de-novo and it takes some time for the extravasated water to reach the lymph drainage capacity (approx. 30 ticks)

• Extravasation occurs only to ACM and does not exceed a certain limit, not jeopardizing the effectiveness of the lymph drainage mechanism.

• The capacity of extravascular space (represented by the red line on plots) is also never reached. Otherwise it would mean PE presence.

• This scenario will run until not terminated by “Go” button.

“Cardiogenic Pulmonary Edema” Scenario:

• This scenario will stop once a certain volume of extravascular water is reached (after approx. 40 ticks).

• The volume of extravasated fluid will be higher than extravascular space volume and will overwhelm the lymph drainage capacity. The latter can be observed on the upper plot which is active during this scenario.

• Extravasation occurs to ACM, and even to Alveoli

• The ‘aggregated flooding picture’ can be observed on the bottom plot.


During any of the scenario run the level of the Oncotic Pressure can be decreased using the respective slider. This would be an “aggravating” measure that will enhance edema progression:

During “Normal” scenario this will cause edema formation reflected on both plots. For better visualization it is recommended to decrease OP level just after first 30 ticks and start with a small decrease in OP (e.g. 2-3 mmHg). This can be considered as an abstract simulation of PE with a “non-increased HP” as seen in Malnutrition, Nephrotic Syndrome, markedly decreased liver synthetic function, etc. In this case model will stop once the volume of extravasated water will reach a certain value like in "CPE" scenario.

During “CPE” scenario a decrease in OP or an increase in HP or both will boost edema formation and the magnitude of respective changes in OP/HP will usually proportionate with edema 'degree' (i.e. volume of extravasated water) and rapidity of edema progression. To better observe this it is also recommended to apply OP/HP changes not later than 10 ticks from the scenario start. The volume of extravasated water will usually be higher than standard CPE scenario run, this being reported by the bottom plot as a sharper slope of extravasation curve.

An increase in OP in the model (i.e. from 24 to 25 mm Hg in CPE scenario) will tray to counteract edema formation, but in this case the model will stop automatically. In fact such a situation does not have a clinical equivalent in case of CPE.

Although PE correction/treatment is out of the scope of this model decreasing the elevated HP to normal values (< 19 mm Hg) while running CPE scenario will simulate the effect of vasodilator drugs and diuretics. It is recommende to do this not later than 10 ticks of the scenario run and the effect to be observed on the bottom plot.


This abstract model can be upgraded to include aspects covering oxygenation of the blood and carbon dioxide removal that is the main function of the lung. As stated above this lung function can be dramatically affected by excessive extravascular lung water. A potential extension of this model would be adding new agents (e.g. O2 and CO2 molecules which are to diffuse trough the ACM) with a possible output counting for the amount of these gases in the blood (i.e. capillaries) and alveoli against the PE ‘degree’.

In the actual model extravasation in “Normal” and “CPE” scenarios are coded as separate processes involving separate agent breeds and procedures. From this point of view a further refinement of the actual model would be using the same breed of water molecules and using better tuned and different sets of rules for extravasation depending of the scenario type.

An option would be adding an aspect concerning variable permeability of ACM. By this the model would cover “Non-Cardiogenic Pulmonary Edema”, an important PE clinical variety.


For setting up the world in order to create the three ‘physiological’ zones (i.e. capillary with its walls/ACM/alveoli) the bottom edge origin of the world is selected. This seems to be less common for NetLogo models in the library.


Elements used to build this model are present in a number of models in the library, although a global close similarity with any of them is difficult to identify.

Of some interest would be the following models:

• DiffusionWithMembraneAsPatch1 by Gary An, MD (http://ccl.northwestern.edu/netlogo/models/community/DiffusionWithMembraneAsPatch1)

• Shock2004_Gut_Epithelial_Barrier by Gary An, MD ( http://ccl.northwestern.edu/netlogo/models/community/Shock2004_Gut_Epithelial_Barrier)

Both models refer to biology/medical field and the first one could be of special interest for extending actual model to cover Non-Cardiogenic PE as well.


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 viapascurta@yahoo.com

The model was created in NetLogo 6.0.1, Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. as a final project for the intro to ABM MOOC 2017 by Bill Rand @ Complexity Explorer (https://www.complexityexplorer.org/courses/76-introduction-to-agent-based-modeling-summer-2017)

Re. concerning medical aspects: Murray J.F., Pulmonary edema: pathophysiology and diagnosis, Int J Tuberc Lung Dis. 2011 Feb;15(2):155-60 (https://www.ncbi.nlm.nih.gov/pubmed/21219673)

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
         ] ;; 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

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

to setup
  import-drawing "A11.png"

  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]
  if vid:recorder-status = "recording" [ vid:record-interface ]

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 ]

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 ]

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

  ask wmolecules [  ;; procedure for water molecules extravasation
  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 ]

  if vid:recorder-status = "recording" [ vid:record-interface ]

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

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 ]

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

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

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

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 [

to save-recording
  if vid:recorder-status = "inactive" [
    user-message "The recorder is inactive. There is nothing to save."
  ; 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

;; 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 11 months 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 11 months ago, by Victor Iapascurta Download
PE_image.jpg jpeg this is a preview image for Pulmonary Edema w/image 11 months 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'