NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".(The run link is disabled for this model because it was made in a version prior to NetLogo 6.0, which NetLogo Web requires.)


HIVSIM is an agent-based simulation of HIV immunodynamics that is currently being developped in NetLogo. It allows users to investigate dependencies between various components of the cellular and humoral immune responses to HIV. Users can interactively manipulate simulation parameters (e.g., the number of Th, Tc, and B cells, and the infectivity of viral particles) and, in real-time, observe graphical plots of the results. Additionally, users can simulate antibody and anti-retroviral therapies at various stages of infection (e.g., the user can introduce into the simulation antibodies with affinity for the dominant HIV epitope). HIVSIM is still a work in progress. As time permits, the underlying model will be further calibrated against experimental data to make it robust and applicable to the qualitative evaluation of hypotheses on HIV immunodynamics.


The simulation
HIVSIM simulates the interactions of five major cell types - B, T helper, T cytotoxic, epithelial, and antigen-presenting cells - and four non-cellular entities - antibodies, cytokines, HIV, and anti-retroviral agents. The interactions occur in a cellular matrix consisting of 1681 (41 * 41) sites. During each time step, all entities at a given site are allowed to interact. After the interactions, other processes such as cell division, apoptosis or decay, antibody and cytokine production, necrosis, and HIV infection of target cells are allowed to proceed. The completion of these processes marks the end of a time step, after which all entities, except epithelial cells, are allowed to diffuse into neighboring sites. HIV particles, antibodies and anti-retroviral agents can be introduced from the outside at any time. The simulation ends when one of the following occurs (1) the number of healthy epithelial cells drops to below 50% of its original value, (2) the viral load exceeds the combined total of all non-viral entities, or (3) the viral load falls to 0.

Described below are some of the entities, interactions, and biological processes implemented in HIVSIM. Except where otherwise noted, information regarding the various interactions and processes came from [1]. Also, some of the parameters used in the simulation were adapted from [2]. For detailed information about the simulation, please see comments within the code.

Let us first of all discuss the prerequisites for a "successul interaction" between two entities. Note that except for nonspecifc interactions such as those involving APCs and cell-free HIV, the outcome (e.g., successful formation of a bond) of most interactions depends on the receptors (or epitopes and paratopes) of the entities involved. Each cellular entity possesses a receptor, represented by a randomly chosen integer belonging to the closed-open interval [0, maxspec), where the upper bound maxspec is determined by the user. Cellular entities also possess HLA1 (human leukocyte antigen type 1) with similar numeric values as their receptors. In additon to HLA1, APCs and B cells also have HLA2. Among the non-cellular entities, viruses have epitopes while antibodies have paratopes. When two entities A and B, say, with receptors x and y, respectively, interact, the probability that their interaction will be successful is given by exp(|x-y|). The closer the numeric values of the interacting entities' receptors, the higher their affinities for each other and, hence, the higher the probability of a successful interaction.

Entities and interactions
B cells: B cells are components of the humoral immune response to HIV. When a naive B cell encounters an HIV particle, it attempts to bind to it. Successful binding of a B cell to HIV results in the former ingesting the latter. After ingestion, the B cell digests the HIV into small peptides, 11 to 20 amino acids long, and inserts these into molecules called human leukocyte antigen type II (HLA2), forming HLA2-peptide complexes. It then transports these HLA2-peptide complexes to its surface. Th cells, which will be described later, can recognize and bind to the HLA2-peptide complexes. Such binding activates B and Th cells and induces these cells to divide (see "Cell Division" below). The division of B cells yields memory and effector (or plasma) cells. The long-lived memory B cells confer long-term protection against previously encountered HIV particles. When a memory B cell becomes activated (e.g. via a successful interaction with an APC-activated Th cell or by-stander, cytokine-induced activation), it undergoes cell division, increasing the population of plasma and memory B cells with affinity for the HIV. The short-lived and terminally differentiated plasma cells continuously produce antibodies which can recognize and bind to cell-free HIV. Such binding can neutralize the HIV, rendering it incapable of infecting target cells in the body.

T helper (Th) cells: Also known as CD4+ T cells, these cells are the orchestrators of the adaptive immune response to HIV. When a naive Th cell binds to HIV peptides presented on HLA2 surface molecules of antigen presenting cells (APCs) they become activated. Activated Th cells divide to produce memory and effector Th cells (see "Cell Division" below). The short-lived effector Th cells continuously secrete cytokines which participate in the activation of other immune system components including B cells and Tc cells (see below). Upon activation, the long-lived memory Th cells divide, as described below, producing more memory and effector Th cells. Th cells also facilitate the lysis of infected cells by natural killer (NK) cells in a process called antibody dependent cell-mediated cytotoxicity. The gradual depletion of Th cells, a hallmark of HIV pathogenesis, is thought to arise not only from direct hiv-mediated killing of infected Th cells but also from indirect killing of Th cells or activation-induced cell death (AICD) [3]. It is assumed here that this indirect killing of Th cells is a function of the number of infected cells and virions in the vicinity of a Th cell. The parameter AICD is used to simulate this increased susceptibility of Th cells to HIV.

T cytotoxic (Tc) cells: Tc cells are very important in the control of HIV infection. They are activated either by direct contact with APC-activated Th cells or by cytokines. Once activated, they divide and produce memory and effector Tc cells. Effector Tc cells recognize HIV peptides, 9 to 11 nucleotides in length, bound to molecules called human leukocyte antigens type 1 (HLA1) found on most human cell types. Effector Tc cells bind to and kill infected cells displaying such HLA1-peptide complexes on their surfaces, at a rate that is determined by the ctl-rate parameter.Memory Tc cells, on the other hand, afford long-term protection against infection. Upon activation (see naive Tc cell activation) the memory cells divide, as described below.

Antigen-presenting cells (APCs): These include macrophages, dendrites and lymphocytes. All APCs possess HLA2 molecules. Note that if Th cell activation was exclusively dependent on B cell activation, the primary response to HIV would be very slow due to the initial low numbers of B and T cells with affinity for the HIV pathogens. Fortunately, that is not the case; APCs other than B cells can bind non-specifically to HIV. After binding, the APCs ingest, digest and present HLA2-peptide complexes on their surfaces. The binding of Th cells to these complexes activates the Th cells and causes them to divide.

Biological processes
Apoptosis/decay: Each entity has a half-life, halfL. During each time step, this half-life is used to determine the probability, exp(-ln2/halfL), that a cellular entity undergoes apoptosis [2]. The probability of decay of non-cellular entities such as antibodies and cytokines is computed in a similar manner. Once an entity (cellular or non-cellular) undergoes apoptotic death, it is immediately removed from the simulation.

Resupply: To maintain a relatively constant population of all lymphocytes, these cells are continuously produced by the bone marrow and thymus to make up for those lost through apoptosis. During each time step, the half-life and original population size of each class of lymphocytes are used to determine the number of new cells of the given class to be added to the simulation.

Necrosis: During each time step, an infected cell undergoes necrosis or lysis if the number of intracellular viral particles it contains exceeds the viral burst size (i.e., the threshold of viral particles needed to elicit the lysis of an infected cell). Following necrosis, the cell releases new viral particles and is immediately removed from the simulation.

Cell Division: Only stimulated B, Th and Tc cells undergo cell division. A stimulated B cell divides over two time steps producing 4 new cells with the same receptors/specificity as the parent B cell. Fifty percent of the new cells become memory cells while the remaining 50% become plasma cells. The division of a stimulated Th (or Tc) cell follows similar rules with the difference being that 50% of the new cells become long-lived memory Th (or Tc) cells while the remaining 50% become effector Th (or Tc) cells. Note that dividing B cells may undergo hypermutation at a rate determined by the bMut parameter.

HIV infection: During a time step, each un-bound HIV particle is allowed to infect a randomly chosen neighboring cell. The probability of infection is determined by the infectivity of the HIV epitope. If infection occurs, the HIV disappears into the cytoplasm of the infected cell where it integrates its RNA into the cell's DNA. Infected cells present viral peptides on their surface, complexed with HLA1 molecules.

Viral replication: During each time step, HIV particles, found in infected cells, are allowed to replicate - each HIV divides once, producing two new viruses. Each new virus may mutate (i.e., it can be assigned a new randomly chosen (numerical) epitope and peptide). The probability of such mutation is determined by the vMut parameter.

CTL: This denotes the killing of infected cells by Tc cells. During each time step, a Tc cell is allowed to randomly kill one infected cell in its neighborhood/vicinity. The probability that a Tc cell will kill an infected cell on contact is determined by the parameter ctl-rate.


The interface contains 10 sliders, two switches, six monitors, three plots, and the buttons "Setup" and "Run".

Click the "Setup" button to initialize a new simulation and click "Run" to run the simulation.

The following information is reported during a simulation:
The number of (1) non-viral entities (2) infected cells (3) viruses in the cytoplasms of productively infected cells, (5) neutralized HIV, and (6) infected cells killed by CTL. Also, the population size of the dominant HIV epitope and number of antibodies with high affinity (>70%) for this epitope is reported. This information can be used to determine what kind of therapeutic strategy (antibody or anti-retroviral) to simulate. In addition, the dynamics of antibodies, cytokines, B cells (naive, memory and plasma cells), Th cells (naive, memory and effector cells), Tc cells (naive, memory and effector cells), and HIV is plotted in real-time.

While running a simulation, you can use the Command Center to perform the following:
1) Simulate infection
Simple type "infect specificity leth bsize repRate number," where "specificity" is the numerical value of each new virion's receptor and peptide, "leth" is the infectivity of each virion, "bsize" is the viral burst size, "repRate" is the viral replication rate, and "number" is the number of new virions you want to introduce into the simulation.

2) Simulate antibody therapy
Simply type "Simulate-ABT specificity number" to introduce "number" new antibodies into the simulation. The value of "specificity" will be assigned to each antibody's paratope.

3) Simulate anti-retroviral therapy
Simply type "Simulate-ART efficacy number" to introduce "number" new anti-retroviral agents (ara's) into the simulation. During each time step, the ara's thus introduced will be allowed to interact with a randomly chosen, neighboring virion and, if successful, inactivate the virion. The probability that an ara will inactivate a virion on contact is determined by the "efficacy" parameter.

The Sliders:
1) numTh - the initial number of Th cells
2) numB - the initial number of B cells
3) numTc - the initial number of Tc cells
4) numHIV - the initial number of HIV
5) numApc - the initial number of APCs
6) numEp - the initial number of epithelial cells
7) infectivity - the represents the default infectivity of HIV - the probability that a virion will infect an cell on contact. Virions introduced after the simulation has begun can be assigned different infectivity.
8) AICD - the rate of indirect killing of Th cells by HIV
9) ctlRate - the probability that a Tc cell will kill an infected cell on contact. CTL rate is crucial to the control of HIV infection. However, it has been hypothesized that some Tc cells may be defective, suggesting that CTL rate is less that 1.0 (or 100%).
10) neutRate - the rate at which an antibody neutralizes a virion, on contact.

Also, the values of about 30 global variables can be manipulated from the Procedures Tab.

The Switches:
1) plots - use this to turn on/off real-time plots
2) monitors - use this to turn/off updates to the monitors

The Plots:
1) Antibodies - shows changes in the number of antibodies
2) Cytokines - show changes in the number of cytokines
3) Bcells - depicts the dynamics of B cells (includes naive, memory and effector or plasma cells)
4) HIV/Th/Tc - depicts the dynamics of cell-free HIV, Th cells (includes naive, memory and effector cells), and Tc cells (includes naive, memory and effector cells). KEY: Red - HIV, Green - Tc, and Black - Th.


Try to determine an optimal choice of parameter values for which each of the following occurs:
1) Rapid (resp. slow) viral clearance.
2) Rapid Th and Tc cell turnover.
3) High/low antibody production.
4) viral blips (periodic bursts of viraemia). (Hints: Decrease the value of pdissociation - follicular dendrytic cells, APCs in this case, may serve as viral reservoirs that help perpetuate chronic viraemia via occasional dissociation and the concomitant release of new virions [4]. Also, advanced users may want to implement anergic states for B, Th, and Tc cells)
5) Depletion of Th cells (Hint: Manipulate the value of the AICD parameter)

Based on your observations, suggest putative critical parameters (e.g., viral infectivity) for the immune response to HIV.


HIVSIM is still far from being a comprehensive simulation of HIV immunodynamics. A number of other components of the immune response to HIV are yet to be implemented. Listed below are a few of them:
1) B, Th, and Tc anergy
2) Antibody-dependent cell-mediated cytotoxicity
3) A better implementation of activation-induced cell death
4) A better implementation of by-stander (cytokine-mediated) stimulation of B and Tc cells

In addition, further calibration with experimental data is necessary in order to make the simulation more robust and less sensitive to small changes in the values of some parameters.


1. McMichael A. J. and S. L. Rowland-Jones, 2001. "Cellular immune responses to HIV," Nature, 410:980-987.
2. Kleinstein, S. H. and P. E. Seiden, 2000. "Simulating the immune system," Computing in Science and Engineering, pp.69-77.
3. Silvestri, G. and M. B. Feinberg, 2003. "Turnover of lymphocytes and conceptual paradigms in HIV infection," J. Clin. Invest., 112:821824.
4. Hlavacek, W. S., N. I. Stilianakis, D. W. Notermansi, S. A. Danner, and A. S. Perelson, 2000. "Influence of follicular dendritic cells on decay of HIV during antiretroviral therapy," PNAS, 97(20):10966-10971.

Comments and suggestions should be sent to the author, Wilfred Ndifon, at

(back to the NetLogo User Community Models)