New datafacer GraphMLExport
allows exporting one or more graphs in a file in GraphML format. Most available software for displaying and manipulating graphs accept this format.
New collection types KeyMap2d, KeyMap3d et OrdKeyMap.
KeyMap2d
allows associating a value with a pair of keys, and KeyMap3d
allows associating a value with a triplet of keys. These tools can be used for building sparse matrices, for example.OrdKeyMap
is equivalent to a KeyMap
but where the order of the keys is preserved. That is, the functions keySet()
and values()
return elements in the order in which they were added.Shapefile : setCrs() cthis new function allows setting a target reference system before using the append()
function to save geographic information data.
csv
files.jar
and command lineWhen a model has been saved in jar
format, and if the model contains parameter definitions in a metadata {...}
bloc, then it is possible run the model with parameter values in command line.
Il faut respecter quelques contraintes :
metadata {...}
. Si le nombre de paramètres donnés sur la ligne de commande est différent, ce sont les valeurs par défaut qui seront utilisés.Boolean
, Byte
, Double
, Float
,Integer
, Long
, Short
, String
String
puis d'effectuer sois-même une conversion du paramètre dans un autre type dans le modèle Ocelet.Prenons un modèle Ocelet Mymodel.oclt
qui est écrit comme ceci :
metadata {
parameter Integer p1 {default 0}
parameter Double p2 {default 0.0}
parameter String p3 {default "rien"}
parameter Boolean p4 {default false}
}
scenario Mymodel {
println("Model Mymodel")
println("p1: "+p1)
println("p2: "+p2)
println("p3: "+p3)
println("p4: "+p4)
println("Done.")
}
que l'on a exporté en mymodel.jar
On peut l'exécuter sans paramètre :
> java -jar mymodel.jar
Model Mymodel
p1: 0
p2: 0.0
p3: rien
p4: false
Done.
On peut lui donner de nouvelles valeurs :
> java -jar mymodel.jar 42 3.14159 demo true
Model Mymodel
p1: 42
p2: 3.14159
p3: demo
p4: true
Done.
Si on veut fournir un texte contenant des espace pour p3 on ajoute des guillements :
> java -jar mymodel.jar 42 3.14159 "Eat at Joe's" true
Model Mymodel
p1: 42
p2: 3.14159
p3: Eat at Joe's
p4: true
Done.
Si on fait une erreur de typage sur un paramètre on obtient un message mais cela n'est pas bloquant :
> java -jar mymodel.jar douze 3.14159 "Eat at Joe's" true
Warning: could not convert the argument "douze" into an Integer value
for the parameter p1. The default value will be used instead.
Model Mymodel
p1: 0
p2: 3.14159
p3: Eat at Joe's
p4: true
Done.
Si on ne met pas le bon nombre de paramètres ils sont ignorés :
> java -jar mymodel.jar 42 3.14159 "Eat at Joe's" true 100
Model Mymodel
p1: 0
p2: 0.0
p3: rien
p4: false
Done.
Sur R on peut utiliser la fonction system()
qui permet d'exécuter une ligne de commande depuis un programme en R.
Il faut d'abord s'assurer que le modèle Ocelet pourra accéder aux dossiers dont il a besoin (le dossier data/
en particulier). Pour cela on peut par exemple placer le dossier d'exécution de R dans le dossier d'un modèle Ocelet (là où se trouvent le fichier .jar
et le dossier data/
). Pour indiquer le dossier de travail c'est la fonction setwd()
.
Par exemple cela donnerait quelque chose comme cela :
setwd("chemin/vers/mon/ocelet/workspace/MyModel")
system("java -jar mymodel.jar 42 3.14159 demo true")
Avec wait=FALSE
on peut lancer une exécution de manière asynchrone (le programme R n'attend pas qu'Ocelet ait fini pour continuer). Et avec paste()
on peut construire des commandes pour intégrer des variables dans les paramètres passés à Ocelet :
for (i in 1:8) {system(paste("java -jar mymodel.jar ",(i*50)," 3.14159 demo true"),wait=FALSE)}
Le principe est le même qu'avec R mais la fonction utilisée est différente:
subprocess.call("java -jar mymodel.jar 42 3.14159 demo true")
on peut y ajouter shell=true
pour exécuter la simulation dans un shell séparé:
subprocess.call("java -jar mymodel.jar 42 3.14159 demo true",shell=true)
New features :
Csvfile
, Shapefile
and Postgis
datafacers.DateTime
expressed in chosen time units: hour, day, month, etc.On December 15, 2015 at Montpellier (France), Mathieu Castets presented his PhD viva (oral defence) : Pavages réguliers et modélisation des dynamiques spatiales à base de graphes d’interaction : conception, implémentation, application
Summary :
The modelling and simulation of spatial dynamics, particularly for studying landscape changes or environmental issues, raises the question of integrating different forms of spatial representations within the same model. Among the various existing spatial dynamics modelling tools (Cormas, Dypal, Netlogo, Seles, GAMA, etc.), Ocelet is a domain-specific language based on the original concept of interaction graph. Such a type of graph covers both the structure of a relation (which can be spatial, functional, hierarchical, social, etc.) between entities of a model and the semantics describing its evolution. The relationships between spatial entities are here translated into interaction graphs and these graphs are made to evolve during a simulation. While it is commonly accepted that space can be modelled with shapes with contours (vector format) or regular grid cells (raster), the concepts on which Ocelet is based can potentially handle both forms of representation. The vector format is already integrated in the first version of Ocelet. The integration of raster and the combination of the two remained to be studied and carried out.
The aim of the thesis is to first study the issues related to the integration of continuous fields and their representation by regular tiling, both in the Ocelet language and in the concepts on which it is based. The dynamic aspects of this integration had to be taken into account and transitions between different forms of geographic data and interaction graphs had to be studied in the light of the concepts formalized. The concepts were then implemented in the Ocelet modelling platform, with the adaptation of both its compiler and runtime. Finally, these new concepts and tools were tested in three very different cases: two models on Reunion Island, the first simulating runoff in Ravine Saint Gilles watershed in the West Coast of the island, the other simulating the spread of invasive plants in the high plains inside the Reunion National Park. The last case describes the spatialisation of a crop model and is applied here to simulate the cereal crop yields in West Africa, in the context of an early warning system for regional crop monitoring.