drafting2_alonosnat_project

No preview image

1 collaborator

Default-person osnat gal (Author)

Tags

(This model has yet to be categorized with any tags)
Model group uhaifa-modeling-11 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 4.1.2 • Viewed 136 times • Downloaded 22 times • Run 1 time
Download the 'drafting2_alonosnat_project' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This section could give a general understanding of what the model is trying to show or explain.

HOW IT WORKS

This section could explain what rules the agents use to create the overall behavior of the model.

HOW TO USE IT

This section could explain how to use the model, including a description of each of the items in the interface tab.

THINGS TO NOTICE

This section could give some ideas of things for the user to notice while running the model.

THINGS TO TRY

This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.

EXTENDING THE MODEL

This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.

NETLOGO FEATURES

This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.

RELATED MODELS

This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.

CREDITS AND REFERENCES

This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.

Comments and Questions

כיצד לגרום לרוכבים להתקרב (Question)

הי. עד כה זה מה שהצלחנו לעשות. למרות שחלק מהמודל כבר רץ, הרוכבים לא מתקרבים אחד אל השני. נשמח לשמוע מה הטעות שלנו, או מה מומלץ לעשות כדי לפתור את זה. תודה

Posted almost 13 years ago

התקרבות בהתלהקות (Question)

ראשית - המודל מודיע לי שהוא בכלל לא מסכים לרוץ כי nothing named max-align-turn has been defined האם העתקתם את הקוד של ההתלהקות קומפלט? באופן עקרוני, הקוד שמקרב את הציפורים הוא cohere flock find-flockmates שרונה

Posted almost 13 years ago

Click to Run Model

globals [
tick-delta                ;; how much we advance the tick counter this time through
max-tick-delta            ;; the largest tick-delta is allowed to be
]
breed [riders rider]  ;; 
breed [particles particle ]

riders-own
 [energy
  speed
  flockmates         ;; agentset of nearby turtles
  nearest-neighbor   ;; closest one of our flockmates
  ]
particles-own 
  [speed
    mass]

to setup
  ca
  ask patches [ setup-road ]
  setup-riders
  setup-particles
;  do-plots
end  

to setup-road  ;; patch procedure
  ifelse ( pycor < 18) and ( pycor > -18 ) [ set pcolor red - 3 ]
         [set pcolor black]
end 

to setup-riders
  create-riders number-cyclists 
  [ set color yellow
      set size 4  ;; easier to see
      setxy -69 random-ycor
      fd 3
      rt random 360
      fd 3 ]
end 

to setup-particles
  create-particles number-of-particles
   set-default-shape particles "circle"
   ask particles
   [ set color 8
     set size .5
     set max-tick-delta 0.1073
  setxy random-xcor random-ycor]
;  update-variables
;  set init-avg-speed avg-speed
;  set init-avg-energy avg-energy
end 
   

;to do-plots
;  set-current-plot "cyclist-energy"
;  plot count 
;end

to go
  ask riders
  [ flock ]
  ;; the following line is used to make the turtles
  ;; animate more smoothly.
  repeat 5 [ ask turtles [ fd 0.2 ] display ]
  ;; for greater efficiency, at the expense of smooth
  ;; animation, substitute the following line instead:
  ;;   ask turtles [ fd 1 ]
  tick
end 

to flock  ;; turtle procedure
  find-flockmates
  if any? flockmates
    [ find-nearest-neighbor
      ifelse distance nearest-neighbor < minimum-separation
        [ separate ]
        [ align
          cohere ] ]
end 

to find-flockmates  ;; turtle procedure
  set flockmates other turtles in-radius vision
end 

to find-nearest-neighbor ;; turtle procedure
  set nearest-neighbor min-one-of flockmates [distance myself]
end 

;;; SEPARATE

to separate  ;; turtle procedure
  turn-away ([heading] of nearest-neighbor) max-separate-turn
end 

;;; ALIGN

to align  ;; turtle procedure
  turn-towards average-flockmate-heading max-align-turn
end 

to-report average-flockmate-heading  ;; turtle procedure
  ;; We can't just average the heading variables here.
  ;; For example, the average of 1 and 359 should be 0,
  ;; not 180.  So we have to use trigonometry.
  let x-component sum [sin heading] of flockmates
  let y-component sum [cos heading] of flockmates
  ifelse x-component = 0 and y-component = 0
    [ report heading ]
    [ report atan x-component y-component ]
end 

;;; COHERE

to cohere  ;; turtle procedure
  turn-towards average-heading-towards-flockmates max-cohere-turn
end 

to-report average-heading-towards-flockmates  ;; turtle procedure
  ;; "towards myself" gives us the heading from the other turtle
  ;; to me, but we want the heading from me to the other turtle,
  ;; so we add 180
  let x-component mean [sin (towards myself + 180)] of flockmates
  let y-component mean [cos (towards myself + 180)] of flockmates
  ifelse x-component = 0 and y-component = 0
    [ report heading ]
    [ report atan x-component y-component ]
end 

;;; HELPER PROCEDURES

to turn-towards [new-heading max-turn]  ;; turtle procedure
  turn-at-most (subtract-headings new-heading heading) max-turn
end 

to turn-away [new-heading max-turn]  ;; turtle procedure
  turn-at-most (subtract-headings heading new-heading) max-turn
end 

;; turn right by "turn" degrees (or left if "turn" is negative),
;; but never turn more than "max-turn" degrees

to turn-at-most [turn max-turn]  ;; turtle procedure
  ifelse abs turn > max-turn
    [ ifelse turn > 0
        [ rt max-turn ]
        [ lt max-turn ] ]
    [ rt turn ]
end 

There is only one version of this model, created almost 13 years ago by osnat gal.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.