Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Nom du modèle
- model trafic
- // Méthode globale définissant l'environnement.
- global {
- file shp_bati <- file("../includes/bati.shp");
- file shp_rue <- file("../includes/rues_vm.shp");
- geometry shape <- envelope(shp_rue);
- graph reseau;
- int min_deb_trav <- 6;
- int max_deb_trav <- 8;
- float step <- 1 #mn;
- init {
- create bati from: shp_bati;
- create rue from: shp_rue;
- reseau <- as_edge_graph(shp_rue);
- create resident number: 10 {
- debut_trav <- rnd (min_deb_trav, max_deb_trav);
- fin_trav <- debut_trav + rnd(7, 9);
- residence <- one_of (list<bati>(bati));
- travail <- one_of (list<bati>(bati));
- objectif <- "repos";
- location <- residence;
- }
- }
- }
- // Agent "bati"
- species bati {
- aspect base {
- draw shape color: #darkgrey ;
- }
- }
- // Agent "rue"
- species rue {
- rgb color <- #grey ;
- aspect base {
- draw shape color: color;
- }
- }
- // Agents "résidents"
- species resident skills: [moving] {
- rgb color <- rgb(243, 214, 72);
- bati residence <- nil;
- bati travail <- nil;
- int debut_trav;
- int fin_trav;
- string objectif;
- point target <- nil;
- aspect base {
- draw circle(20) color: color;
- }
- }
- // Définition de la simulaiton et de ses affichages
- experiment trafic type: gui {
- output {
- display ville_marie type:opengl background: rgb(50, 50, 50) {
- species bati aspect: base ;
- species rue aspect: base ;
- species resident aspect: base ;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement