Polling

Polling preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0beta1 • Viewed 184 times • Downloaded 14 times • Run 0 times
Download the 'Polling' 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 model can be used to poll data from a set of students using HubNet Clients. The teacher can input questions to ask and then the students can input their choice in response to the question. The collective data can then be plotted.

For further documentation, see the Participatory Simulations Guide found at http://ccl.northwestern.edu/ps/

HOW TO USE IT

Quickstart Instructions:

Teacher: Follow these directions to run the HubNet activity. Optional: Zoom In (see Tools in the Menu Bar) Teacher: Open up the HubNet Control Center (see Tools in the Menu Bar). This will show you the IP Address of this computer. Press the GO button and tell the students to login. Everyone: Open up a HubNet Client on your machine and input the IP Address of this computer, type your user name in the user name box and press ENTER.

Teacher: If you don't want to allow students to change their mind, switch ALLOW-CHANGE? off. If you don't want to show the current data in the plot as it's being collected, switch SHOW-PLOT? off. You can turn it back on at any time to see the data.

Teacher: Press the NEW QUESTION button to input a question for everyone to answer. Everyone: Once you see the question, move your CHOICE slider to the value you want to choose and press the CHOOSE button. Once you have chosen, your choice will appear in your CURRENT CHOICE monitor, and your turtle in NetLogo will get brighter.

Teacher: To input another question, press NEW QUESTION again. The data and CURRENT QUESTION will be saved and then the question will change to your new question and everyone will be able to make their choices on the new question. To return to a previous question, use the <<>> buttons to cycle through the questions.

Teacher: To rerun the activity with the same group, press the CLEAR QUESTIONS button to erase all the questions and data.

Teacher: To start the simulation over with a new group but reuse the same questions, stop the model by pressing the NetLogo GO button, if it is on, and press the CLEAR CLIENTS button.

Teacher: To start the simulation over with a new group but with new questions, stop the GO button, if it is on, and press the SETUP button.

Follow these instructions from the beginning.

Buttons:

SETUP - clears everything including logged in clients. This should only be pressed when starting out with a new group of users since all data and questions are lost. GO - runs the simulation processing data from the clients. CLEAR CURRENT DATA - clears everyone's answers on the current question allowing them to re-choose. NEW QUESTION - allows you to write a new question to be asked. CLEAR CLIENTS - removes all the clients and clears the data, but leaves the questions intact. This should be used to start over with a new group but with the same set of questions. CLEAR QUESTIONS - erase all the questions and the data associated with them. This should be used if you want to start over with the same group or don't want clients to have to log back in. NEXT QUESTION>>> - changes the current question to the next question. <<>> - advances the quick start instructions. <<

Switches:

ALLOW-CHANGE? - controls whether clients are able to change their choices after they've chosen. Can be changed at any time. SHOW-PLOT? - controls whether the data collected are shown in the plot. Can be changed at any time.

Monitors:

MEAN - shows the mean of the current data (aka average) MEDIAN - shows the median of the current data (the central value) CURRENT QUESTION - shows the current question being voted on by the clients

Plots:

DATA - shows a histogram of all the clients' votes as well as the mean, median, and modes of the data.

Client Information:

CURRENT QUESTION - A monitor showing the current question to input a guess on. CHOICE - A slider for inputing your choice in answer to the current question. CHOOSE - A button which tells the server what your choice is. CURRENT CHOICE - Shows the value that the server currently has as your choice for the current question. It will be blank if you have not yet made a choice for the current question. DATA - Identical to the plot of the same name in NetLogo.

EXTENDING THE MODEL

Currently, this activity only allows numeric data to be entered by the client. Try adding in support for yes/no or true/false answers to questions.

Right now the activity allows you to clear all the questions, clear all the clients and questions, and clear the data for one question. However, it does not allow you to clear all the data for all the questions. Make it do so.

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Wilensky, U. and Stroup, W. (2000). NetLogo HubNet Polling model. http://ccl.northwestern.edu/netlogo/models/HubNetPolling. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

COPYRIGHT AND LICENSE

Copyright 2000 Uri Wilensky and Walter Stroup.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

This activity and associated models and materials were created as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227.

Comments and Questions

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

Click to Run Model

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Variable and Breed declarations ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

globals
[
  current-question  ;; index of the current question in the question list
  question-list     ;; list of all the questions
  voted?-color      ;; color of turtles which have voted
  not-voted?-color  ;; color of turtles which haven't voted

  ;; quick start instructions variables
  quick-start  ;; current quickstart instruction displayed in the quickstart monitor
  qs-item      ;; index of the current quickstart instruction
  qs-items     ;; list of quickstart instructions
]

turtles-own
[
  user-id       ;; unique id, input by the client when they log in, to identify each student turtle
  slider-value  ;; the value of the client's choice slider
  my-choices    ;; list of my choices for each question
]


;;;;;;;;;;;;;;;;;;;;;
;; Setup Functions ;;
;;;;;;;;;;;;;;;;;;;;;

to startup
  hubnet-reset
  setup
end 

;; Initializes the display, and creates a list that contains the names of the shapes
;; used by turtles in this activity.  The placement of the shape names in the last
;; corresponds to the numbers sent by calculators.  Also initializes the data lists.

to setup
  ca
  clear-output
  setup-vars
  setup-quick-start
end 

;; initialize global variables

to setup-vars
  set not-voted?-color violet - 2
  set voted?-color violet + 2
  clear-all-data-and-questions
end 

to clear-clients
  clear-plot
  cp ct
  clear-output
end 

to clear-all-data-and-questions
  clear-plot
  hubnet-broadcast "Current Question" ""
  hubnet-broadcast "Current Choice" ""
  set current-question 0
  set question-list [""]
  ask turtles [ clear-my-data ]
end 

to clear-my-data  ;; turtle procedure
  set color not-voted?-color
  set my-choices []
  repeat length question-list
  [ set my-choices lput false my-choices ]
end 

;; give the user some information about what the setup button does so they can
;; know whether they want to proceed before actually doing the setup

to setup-prompt
  if user-yes-or-no? (word "The SETUP button should only be used when starting "
              "over with a new group (such as a new set of students) since "
              "all data is lost.\n"
              "Are you sure you want to SETUP?")
  [ setup ]
end 

to clear-current-data
  clear-plot
  ask turtles
  [
    set color not-voted?-color
    set my-choices replace-item current-question my-choices false
    hubnet-send user-id "Current Choice" ""
  ]
end 


;;;;;;;;;;;;;;;;;;;;;;;;
;; Runtime Procedures ;;
;;;;;;;;;;;;;;;;;;;;;;;;

to go
  listen-clients
  every 0.5
  [
    ask turtles [ wander ]
    do-plot
  ]
  display
end 

to wander  ;; turtle procedure
  face one-of neighbors4
  if not any? turtles-on patch-ahead 1
    [ fd 1 ]
end 

to add-question
  if question-list = [""]
  [ set question-list [] ]
  set question-list lput user-input "Input new question?" question-list
  set-current-question (length question-list - 1)
  clear-current-data
end 

to set-current-question [n]
  if n >= 0 and n < length question-list
  [
    set current-question n
    ask turtles
    [
      while [length my-choices < current-question + 1]
      [ set my-choices lput false my-choices ]
      ifelse (item current-question my-choices) = false
      [
        set color not-voted?-color
        hubnet-send user-id "Current Choice" ""
      ]
      [
        set color voted?-color
        hubnet-send user-id "Current Choice" (item current-question my-choices)
      ]
    ]
    do-plot
    hubnet-broadcast "Current Question" (item current-question question-list)
  ]
end 

to prev-question
  if current-question > 0
  [ set-current-question current-question - 1]
end 

to next-question
  if current-question + 1 < length question-list
  [ set-current-question current-question + 1]
end 

;;
;; HubNet Procedures
;;

to listen-clients
  while [hubnet-message-waiting?]
  [
    hubnet-fetch-message
    ifelse hubnet-enter-message?
    [ execute-create ]
    [
      ifelse hubnet-exit-message?
      [
        ask turtles with [user-id = hubnet-message-source] [ die ]
        do-plot
      ]
      [
        if hubnet-message-tag = "Choose"
        [ execute-choose ]
        if hubnet-message-tag = "Choice"
        [ change-choice ]
      ]
    ]
  ]
end 

to execute-create
  crt 1
  [
    let pos one-of patches with [not any? turtles-here]
    ifelse pos != nobody
    [ move-to pos ]
    [ user-message "Too many students. Make a bigger view." ]
    set user-id hubnet-message-source
    set label word user-id "   "
    set slider-value 0
    clear-my-data
    hubnet-send user-id "Current Question" (item current-question question-list)
  ]
end 

to execute-choose
  ask turtles with [user-id = hubnet-message-source]
  [
    if allow-change? or color = not-voted?-color
    [
      set color voted?-color
      set my-choices replace-item current-question my-choices slider-value
      hubnet-send hubnet-message-source "Current Choice" slider-value
    ]
  ]
  do-plot
end 

to change-choice
  ask turtles with [user-id = hubnet-message-source]
  [ set slider-value hubnet-message ]
end 


;;
;; Plotting Procedures
;;

to do-plot
  clear-plot
  if show-plot?
  [
    let current-data [item current-question my-choices] of turtles
    set current-data remove false current-data
    if not empty? current-data
    [
      set-current-plot-pen "data"
      histogram current-data
      set-current-plot-pen "mean"
      plot-vline mean current-data
      set-current-plot-pen "median"
      plot-vline median current-data
      set-current-plot-pen "mode"
      plot-modes current-data
    ]
  ]
end 

to plot-vline [value]
  plotxy value 0
  plotxy value plot-y-max
end 

to plot-modes [lst]
  set lst remove false lst
  let values remove-duplicates lst
  ifelse length values = length lst
  [ histogram lst ]  ;; no duplicates so all items are modes
  [
    let counts []
    let i 0
    repeat length values
    [
      set counts lput ((length lst) - (length remove (item i values) lst)) counts
      set i i + 1
    ]
    let n max counts  ;; how many votes for the most frequent choice(s)?
    while [member? n counts]
    [
      set values (replace-item (position n counts) values false)
      set counts (replace-item (position n counts) counts 0)
    ]
    set values remove false values
    set i 0
    repeat length values
    [
      set lst (remove (item i values) lst)
      set i i + 1
    ]
    histogram lst
  ]
end 

;;
;; Quick Start Instruction Procedures
;;

to setup-quick-start
  set qs-item 0
  set qs-items
  [
    "Teacher: Follow these directions to run the HubNet activity."
    "Optional: Zoom In (see Tools in the Menu Bar)"
    "Teacher: Open up the HubNet Control Center (see Tools in the Menu Bar)."
      "This will show you the IP Address of this computer."
      "Press the GO button and tell the students to login."
    "Everyone: Open up a HubNet Client on your machine and..."
      "type your user name, select this activity and press ENTER."

    "Teacher: If you don't want to allow students to change their mind,..."
      "switch ALLOW-CHANGE? off."
        "If you don't want to show the current data in the plot as..."
          "it's being collected, switch SHOW-DATA? off."
            "You can turn it back on at any time to see the data."

    "Teacher: Press the NEW QUESTION button to input a question for everyone to answer."
    "Everyone: Once you see the question, move your CHOICE slider to the value..."
      "you want to choose and press the CHOOSE button."
        "Once you have chosen, your choice will appear in your CURRENT CHOICE monitor,..."
          "and your turtle in NetLogo will get brighter."

    "Teacher: To input another question, press NEW QUESTION again."
      "The data and CURRENT QUESTION will be saved and then the question will change..."
        "to your new question and everyone will be able to make their choices on the new question."
          "To return to a previous question, use the <<>> buttons to cycle through the questions."

    "Teacher: To rerun the activity with the same group, press..."
      "the CLEAR QUESTIONS button to erase all the questions and data."

    "Teacher: To start the simulation over with a new group but reuse the same questions..."
      "stop the model by pressing the NetLogo GO button, if it is on..."
        "and press the CLEAR CLIENTS button."

    "Teacher: To start the simulation over with a new group but with new questions..."
      "stop the GO button, if it is on, and press the SETUP button."

    "Follow these instructions from the beginning."
  ]
  set quick-start (item qs-item qs-items)
end 

;; view the next item in the quickstart monitor

to view-next-quick-start
  set qs-item qs-item + 1
  if qs-item >= length qs-items
  [ set qs-item length qs-items - 1 ]
  set quick-start (item qs-item qs-items)
end 

;; view the previous item in the quickstart monitor

to view-prev-quick-start
  set qs-item qs-item - 1
  if qs-item < 0
  [ set qs-item 0 ]
  set quick-start (item qs-item qs-items)
end 


; Copyright 2000 Uri Wilensky and Walter Stroup.
; See Info tab for full copyright and license.

There are 7 versions of this model.

Uploaded by When Description Download
Uri Wilensky almost 8 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky over 8 years ago Updated version tag Download this version
Uri Wilensky over 8 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky about 9 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky almost 11 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 11 years ago Polling Download this version
Uri Wilensky almost 11 years ago Polling Download this version

Attached files

File Type Description Last updated
Polling.png preview Preview for 'Polling' about 8 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.