Demo_Aggregates

Generating spatial aggregates in Cormas 

Demo_Aggregates is a didactic model that allows you to test two different ways to create spatial aggregates with Cormas. This model introduces the operating principles of the aggregate spatial entities. In the inheritance tree of generic spatial entities, the generic compound spatial entity is called "SpatialEntity_Set". It specializes in:
  • SpatialEntityAggregate whose components must be contiguous (the Groves of the model), and
  • SpatialEntityNotConnex whose components may not be contiguous (the FragmentedForests of the model).
spatialEntitiesUML

Les opérations d'agrégation-désagrégation reposent sur l'association "est composée de" entre SpatialEntitySet et SpatialEntity, qui se traduit en deux attributs: les «components» (une collection d'entités spatiales de niveau inférieur) et «theCSE» (l'appartenance éventuelle à des entités spatiales de niveau supérieur).
The aggregation-disaggregation operations are based on the association "is made of" between SpatialEntitySet and SpatialEntity, which is translated in two attributes: "components" (a collection of lower-level spatial entities) and "theCSE" (the possibly belonging to higher level spatial entities).
In Demo_Aggregates, 3 entities are defined: Plot (subclass of SpatialEntityElement), Grove (subclass of SpatialEntityAggregate) and FragmentedForest (subclass of SpatialEntityNotConnex):
classDiag
UML class diag of Demo_Aggregates. The aggregation association is redefined between Grove and Plot ( // stands for this redefinition).

First scenario (initForests - StepForests)

Grove components are defined as sets of contiguous Plots sharing the same condition (tree). The initialization loads a spatial grid consisting of 50 * 50 cells (instances of the Plot class) from a file (3forests.env). Each plot has a #tree attribute (boolean, true or false). The actual instantiation of Grove (SpatialEntityAggregate) is done by selecting the contiguous Plots being #tree, plus an additional constraint on a minimum (fixed to 25) number of contiguous cells satisfying the aggregation condition.
Making several spatial entities defined at different levels coexist in the same model offers a great flexibility to write the dynamics of the model. Some processes are more easily described at the cellular level (newState), when for others, the aggregate level is more appropriate (expand or swell).
StepForest:  offers 2 simultaneous dynamics. In this simple and didactic example, each Plot has a fixed (very low) probability of changing its state. Moreover, at the level of the groves, a spreading process from the edges is written as follows: cells of the surrounded edge are aggregated to the forest (only a given number of cells are selected, corresponding to one hundredth of the total number of cells components of the forestry entity). In order to keep the forest entities compact, priority is given to cells that are surrounded by the highest number of cells already aggregated.
gif1
     

Second scenario (setAggregatesFromRandomSeeds - swellForests)

10 seed cells are randomly chosen in the 50*50 spatial grid. 10 aggregates are intialized with one of these seeds as a single component. The iterative building process of the aggregates relies on the integration, among the cells belonging to the outside edge of each aggregate, of all the one that do not yet belong to another aggregate (swell).
demo2


Third scenario (init2AggregateLevels - step2AggregateLevels)

From the same initial state (loading the 3forests.env file), grove aggregates are created from the plots in forest. Then FragmentedForest aggregates are created from the groves on the size criterion, ie an instance of FragmentedForest contains groves of the same size. In this configuration, we get 7 FragmentedForests (1 of 128 groves of 1 plot,     1 of 49 groves of 2 plots,     1 of 21 groves of 3 plots,    1 of 1 grove of 240 plots,     1 of 1 grove of 80 plots,     1 of 2 groves of 4 plots,    1 of 1 grove of 143 plots).

classDiag3
For dynamic (step2AggregateLevels: t), only the FragmentedForest aggregate composed of the smallest groves is activated. Its components then swell from their outer edge.
demo3
  • You can download the model (zip, 32 ko, Cormas 2017).
  • Contact the autor.

 

 

 


Le Cirad Centre de coopération internationale en recherche agronomique pour le développement
Legal notice © Copyright Cirad 2001-2015 cormas-webmaster@cirad.fr