HubNet Shell model

No preview image

1 collaborator

Screen_shot_2021-10-29_at_8.40.47_am Corey Brady (Author)

Tags

hubnet 

Tagged by Reuven M. Lerner over 12 years ago

Model group SingaporeSST | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0RC10 • Viewed 626 times • Downloaded 50 times • Run 0 times
Download the 'HubNet Shell model' 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?

(a general understanding of what the model is trying to show or explain)

HOW IT WORKS

(what rules the agents use to create the overall behavior of the model)

HOW TO USE IT

(how to use the model, including a description of each of the items in the Interface tab)

THINGS TO NOTICE

(suggested things for the user to notice while running the model)

THINGS TO TRY

(suggested things for the user to try to do (move sliders, switches, etc.) with the model)

EXTENDING THE MODEL

(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)

NETLOGO FEATURES

(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)

RELATED MODELS

(models in the NetLogo Models Library and elsewhere which are of related interest)

CREDITS AND REFERENCES

(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)

Comments and Questions

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

Click to Run Model

breed [ students student ]

students-own [ user-id ]

to setup
  clear-all
  hubnet-reset
  reset-ticks
end 

to go
  every .1
  [
    listen-clients
    tick
  ]
end 

to listen-clients 
  while [ hubnet-message-waiting? ]
  [
   hubnet-fetch-message
   
   ifelse ( hubnet-enter-message? ) 
   [ ;it's an enter message
     create-new-student-turtle
   ]
   [
     ifelse (hubnet-exit-message?)
     [ ;it's an exit message
       ask students with [ user-id = hubnet-message-source ][ die ]
     ]
     [
       ;it's not either an enter or exit message...
       ;just show what it is...
       show ( word "Message from " hubnet-message-source " with tag = " hubnet-message-tag " and contents " hubnet-message )
       output-print ( word "Message from " hubnet-message-source " with tag = " hubnet-message-tag " and contents " hubnet-message )
     ]
   ]
  ]
end 

to create-new-student-turtle
  create-students 1
  [
   setxy random-xcor random-ycor 
   set user-id hubnet-message-source
  ]
end 

to send-data-to [ a-user a-widget a-value ]
  show a-user
  show count students with [ user-id = a-user ]
  ask students with [ user-id = a-user ]
  [
    hubnet-send user-id a-widget a-value
  ]
end 

There is only one version of this model, created about 13 years ago by Corey Brady.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.