Advertisement
rodolpheg

Untitled

Nov 19th, 2020
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. // Nom du modèle
  2. model trafic
  3.  
  4. // Méthode globale définissant l'environnement.
  5. global {
  6. file shp_bati <- file("../includes/bati.shp");
  7. file shp_rue <- file("../includes/rues_vm.shp");
  8. geometry shape <- envelope(shp_rue);
  9. graph reseau;
  10.  
  11. int min_deb_trav <- 6;
  12. int max_deb_trav <- 8;
  13.  
  14. float step <- 1 #mn;
  15.  
  16. init {
  17. create bati from: shp_bati;
  18. create rue from: shp_rue;
  19. reseau <- as_edge_graph(shp_rue);
  20.  
  21. create resident number: 10 {
  22. debut_trav <- rnd (min_deb_trav, max_deb_trav);
  23. fin_trav <- debut_trav + rnd(7, 9);
  24. residence <- one_of (list<bati>(bati));
  25. travail <- one_of (list<bati>(bati));
  26. objectif <- "repos";
  27. location <- residence;
  28. }
  29. }
  30. }
  31.  
  32. // Agent "bati"
  33. species bati {
  34. aspect base {
  35. draw shape color: #darkgrey ;
  36. }
  37. }
  38.  
  39. // Agent "rue"
  40. species rue {
  41. rgb color <- #grey ;
  42. aspect base {
  43. draw shape color: color;
  44. }
  45. }
  46.  
  47. // Agents "résidents"
  48. species resident skills: [moving] {
  49. rgb color <- rgb(243, 214, 72);
  50. bati residence <- nil;
  51. bati travail <- nil;
  52. int debut_trav;
  53. int fin_trav;
  54. string objectif;
  55. point target <- nil;
  56.  
  57. aspect base {
  58. draw circle(20) color: color;
  59. }
  60. }
  61.  
  62. // Définition de la simulaiton et de ses affichages
  63. experiment trafic type: gui {
  64. output {
  65. display ville_marie type:opengl background: rgb(50, 50, 50) {
  66. species bati aspect: base ;
  67. species rue aspect: base ;
  68. species resident aspect: base ;
  69. }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement