Drones - Target Convergence

No preview image

1 collaborator



Tagged by Carlos Pedro S. Gonçalves over 3 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.1.1 • Viewed 262 times • Downloaded 15 times • Run 0 times
Download the 'Drones - Target Convergence' modelDownload this modelEmbed this model

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

Info tab cannot be displayed because of an encoding error

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

breed [drones drone]

breed [targets target]

drones-own [see_target signal at_site]

targets-own [drones_here]

to setup
  ask patches [ set pcolor white ]
  set-default-shape targets "circle"
  create-targets 1
  ask patch max-pxcor max-pycor [sprout-drones num_drones]
  ask drones [ set color blue
               set see_target False
               set signal "Inactive"
               set at_site False
  ask targets [ set color green ]

to go

  ; Each drone that is not at the target's site starts by scanning the environment within its sight range cone,
  ; if it sees the target, then, it changes the internal variable see_target from False to True
  ; if the communication is active then the drone activates the signal
  ask drones with [at_site = False] [ if any? targets in-cone sight_range amplitude_sight
                                        [ set see_target True
                                         if communication = True [set signal "Active"] ]

  ; If a drone that is not at the target's site sees the target, then, it implements the "seek"
  ; method of moving otherwise it  implements the "wander method of moving
  ask drones with [at_site = False] [ifelse see_target = True [seek] [wander]]

  ; The target counts the drones that have arrived at its location
  ask target 0 [set drones_here count drones-here]

  ; Plot the number of drones that have arrived at the target


  ; If all the drones have arrived stop the game
  if [drones_here] of target 0 = num_drones [stop]

to wander
  ; Wander is the method for drones who do not have the target in sight

  ; When the communication is set to active...
  ifelse communication = True
  ;... then if there are any drones with an active signal
  ; move to the place of one of these drones, otherwise move around
  [ ifelse any? drones with [signal = "Active"] [ move-to one-of drones with [signal = "Active"] ] [ move_around ] ]
  ; When the communication is not set to active, the drone moves around
  [ move_around ]

to move_around
  ; Move randomly on the world to search for the target
  ; future versions will change this method
  rt random 180
  fd max_step

to seek
  ; The seek method expresses the seeking behavior where
  ; the drone has found the target location and moves to the target
  move-to target 0

to do_plot
  set-current-plot "Number of Drones on Target"
  plot [drones_here] of target 0

There is only one version of this model, created over 3 years ago by Carlos Pedro S. Gonçalves.

Attached files

File Type Description Last updated
view.jpg jpeg View over 3 years ago, by Carlos Pedro S. Gonçalves Download

This model does not have any ancestors.

This model does not have any descendants.