next up previous contents index
Next: Parallel Execution Up: The Eco Lab Model Previous: forall   Contents   Index

Spatial Variation

The ecolab model can run in multicellular mode by calling ecolab.set_grid from TCL, specifying the dimensions of the grid.. See ecolab_spatial.tcl for an example.

Only population density varies between the cells -- all other variables are members of the ecolab variable so can be set or queried in the usual way.

The usual ecolab model methods (generate, mutate, condense and lifetimes) can now be called, but operate on the entire grid. A new migrate is defined to handle migration between cells. You can also call a method of the ecolab cell on all cells using the forall command. For instance, to set all cells to same initial density, use:

ecolab.forall ecolab.density [constant $nsp 100]

Access to the individual cells can obtain by creating a TCL_obj to refer to it by using the ecolab.get method, which creates commands like ecolab(x,y) to refer to the cell. These can be fed to visualisers in the usual way.


Russell Standish 2016-09-02