You are here

Spatial modelling

Land-use dynamics - demonstration model

ModelId: 
landuse1
SimileVersion: 
3.1+

 This model illustrates one approach to modeling land-use dynamics. In this case, individal units of land ("patches") can be in one of two states: forest or crop. Each patch can switch from one state to the other, depending on various factors including the current state of the forest or crop in the patch.

Results: 

 The following sequence of screen shots shows how the cropping area on the left (yellow) gradually encroaches into the forest. It is then replaced by young forest (light green), until eventually it in turn is cut down and the cycle continues.

 

     

 

Spatial diffsion over a hexagonal grid

ModelId: 
hexagon
SimileVersion: 
3.1+

 This model shows how it is possible with Simile to disaggregate a land area into a grid of hexagons instead of the squares normally used, and display results using a polygon diagram. Hexagons have many advantages, including being better able to model lateral diffusion because all the neighbours of a cell are at the same proximity. This model has an inter-cell flow in one direction only, representing the movement of biomass in a situation where seed dispersal happens only in one direction.

Results: 

Spatial diffsion over a grid: using an array to handle interactions between cells

ModelId: 
gridspread1
SimileVersion: 
3.1+

 This simulates diffusion over a grid of cells. We use a multiple-instance submodel to represent the set of cells. Each cell has a unique (row,column) attribute. The amount of substance flowing out of each cell is held outside the submodel in an array (with as many elements as there are cells), and this is used to calculate the amount flowing into neighbouring cells.

 

 

Drainage pattern

ModelId: 
drainage1
SimileVersion: 
4.0

 A classic spatial problem is calculating the drainage pattern for a given land area. If the land is divided in to cells in a grid with the altitude of the land in each cell being known the law the drainage direction for each cell can be found by finding the neighbour with the lowest altitude.

Equations: 

 Equations in drainage1

Variable h : Height array
h = [height]
Where:
[height]=cell/height
Comments:
Outside the cell submodel to provide an array of heights the elements of which are addressable from inside /cell and "/cell/neighbours and self" . (Inside a submodel only values for the current instance is accessible.)

Equations in cell

Variable col
col = index(1)-(row-1)*3

Variable flow direction : Bearing from north to lower neighbour (degrees)
flow direction = if nid_min==1 then 225 elseif nid_min==2 then 180 elseif nid_min==3 then 135 elseif nid_min==4 then 270 elseif nid_min==6 then 90 elseif nid_min==7 then 315 elseif nid_min==8 then 0 elseif nid_min==9 then 45 else-1
Comments:
-1 if no lower neighbour

Variable id
id = index(1)

Variable nid_min : Neighbour ID of the lowest neighbour
nid_min = posleast([h])
Where:
[h]=neighbours and self/h
Comments:
If there is no lower neighbour the value will be the the Neighbour ID of itself, i.e. 5. The Neighbour ID is the index of the "neighbours and self" submodel instances.

Variable row
row = int((index(1)-1)/3)+1

Equations in neighbours and self

Variable col : Column of the cells neighbour's and itself
col = col+element([-1,0,1,-1,0,1,-1,0,1],index(1))
Where:
col=../col
Comments:
If the cell is at the edge of the grid some of the "neighbours" will be outside the grid.

Variable h : Height of the cell's neighbours and itself
h = if col>=1 and col<=3 and row>=1 and row<=3 then element([h],nid)else 1.0E+300
Where:
[h]=../../h
Comments:
Height is assigned the value 1.0E+300 if the "neighbours" will be outside the grid.

Variable nid : ID of the cell's neighbours and itself
nid = 3*(row-1)+col
Comments:
If the cell is at the edge of the grid some of the "neighbours" will be outside the grid

Variable row : Row of the cells neighbour's and itself
row = row+element([-1,-1,-1,0,0,0,1,1,1],index(1))
Where:
row=../row
Comments:
If the cell is at the edge of the grid some of the "neighbours" will be outside the grid.

 

 

 

Results: 

 Height map

Drainagemap

 

 

Representing links between a number of countries, using an association submodel

ModelId: 
country_links1
SimileVersion: 
3.1+

  This model is an example of setting up an association between objects using a data file. The file consists of pairs of IDs, with each pair specifying one instnace of the association. In this case, we specify which countries share a trading association (i.e. which country can export to another country). The data file which specifies the country trading pairs also contains information on the volume of trade between each country pair. This is totalled for both the exporting country and the importing country.  

Animal movement and interaction with their environment

ModelId: 
antsworld
SimileVersion: 
5.9

 In this model, a population of animals (called ants) is created and the individuals move around at random. The area in which they move is represented by a grid of hexagons.

An association model is created to relate each individual to the hexagon it currently occupies. The technique of one-sided enumeration is used to make this association; it is vital that it happens efficiently, because it changes each time step. In this case the position of each ant is used to determine the index of the submodel instance for the hexagon containing it.

Equations: 

 Equations in antsworld

Variable n
n = int(sqrt(size(World)))

Variable neighbour offsets a
neighbour offsets a = [0,1,1,0,-1,-1]

Variable neighbour offsets b
neighbour offsets b = [1,0,-1,-1,0,1]

Variable neighbour offsets c
neighbour offsets c = [-1,-1,0,1,1,0]

Equations in Ants

Immigration im1
im1 = 0.1

Variable Pheromone output
Pheromone output = 1

Variable my body size
my body size = 2

Variable my direction
my direction = ceil(rand_var(0,6))

Variable my head size
my head size = 1

Variable my space
my space = infront=element(last([neighbour_spaces]),my_direction),if time()==init_time() then 5102 elseif infront>0 then infront else prev(1)
Where:
my_direction=my direction
[neighbour_spaces]=neighbour spaces

Variable neighbour spaces
neighbour spaces = [neighbours_at]
Where:
[neighbours_at]= ../location/neighbours (to Ants in at)

Variable x
x = x_at
Where:
x_at= ../location/x (to Ants in at)

Variable y
y = y_at
Where:
y_at= ../location/y (to Ants in at)

Equations in location

Condition cond1
cond1 = index(1) is my_space_at
Where:
my_space_at= ../Ants/my space (from Ants in at)

Variable Pheromone
Pheromone = Pheromone_output_at
Where:
Pheromone_output_at= ../Ants/Pheromone output (from Ants in at)

Variable neighbours
neighbours = [their_ids_has]
Where:

[their_ids_has]= ../World/neighbours/their ids (from World in has)

Variable x
x = x_has
Where:
x_has= ../World/x (from World in has)

Variable y
y = y_has
Where:
y_has= ../World/y (from World in has)

Equations in World

Compartment Pheromone
Initial value = 0
Rate of change = + Addition

Flow Addition
Addition = sum({Pheromone_has})
Where:
{Pheromone_has}= ../location/Pheromone (to World in has)

Variable a
a = ceil(index(1)/n)-ceil(n/2)
Where:
n= ../n

Variable b
b = index(1)-n*a-ceil(n*n/2)
Where:
n= ../n

Variable c
c = -a-b

Variable my id
my id = index(1)

Variable x
x = 50+(a-c)* 0.866

Variable y
y = 50+b* 1.5

Equations in borders

Variable x
x = off=sqrt(3/4),x+element([0,off,off,0,-off,-off],index(1))
Where:
x= ../x

Variable y
y = y+element([1, 0.5, -0.5,-1, -0.5, 0.5],index(1))
Where:
y= ../y

Equations in neighbours

Variable a
a = a+element([neighbour_offsets_a],index(1))
Where:
a= ../a
[neighbour_offsets_a]= ../../neighbour offsets a

Variable b
b = b+element([neighbour_offsets_b],index(1))
Where:
b= ../b
[neighbour_offsets_b]= ../../neighbour offsets b

Variable c
c = c+element([neighbour_offsets_c],index(1))
Where:
c= ../c
[neighbour_offsets_c]= ../../neighbour offsets c

Variable their ids
their ids = if all([a,b,c]> - (n/2)) and all([a,b,c]

 

 

Results: 

 This image shows the distribution of pheromone over the grid are after 3000 time units:

Ants model hexagon map

Subscribe to RSS - Spatial modelling