Student_Cafeteria_V2_Bahria

Student_Cafeteria_V2_Bahria preview image

1 collaborator

Default-person wasiq khan (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.3 • Viewed 184 times • Downloaded 22 times • Run 0 times
Download the 'Student_Cafeteria_V2_Bahria' 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?

(Purpose: This model simulate the Student in Cafeteria at bahria University Islamabad.Student Come in the cafeteria and sit on tables. Male and female students can not sit on the same tables. student sitting on the table will stay on it for random choosen time and then leave the cafeteria. in this model, we try to show the table and student (male and female))

State Variables and Scales

(The model comprises three hierarchical levels: students, Tables, path among the tables and location of the students. Students are characterized by the Students variables: Location and gender, males with blue color and females with red color. Tables have two variables: one is location and second is color. And in the end we describe each parameter location either table or students with distinct entities.)

Process Overview and Scheduling

(First we created breeds of male and female students. Female students are represented by red color and male students are represented by blue color. Four tables are created at different location. student initially are present at the door and only from their they can enter. from that point they move straight forward between the tables. if the table in their left or right is empty they move to that table. Color of the turtle is changed to white showing the turtle as eating in the cafy.student stay on the table until random choosen time is completed. when time is completed the student is moved to out of the cafy at a specific point and color is changed to yellow. Number of male and female student is manage by sliders. waiting time for each student is also managed by slider. )

Design Concepts

(we can adjust the numbers of students and the time, here time has two invariants one is average time to wait and second is average time for students to sit around the table. We add sliders to manage these variables and put some plots to generate report.)

Initialization

(according to the design of this Simulation, Table remain at their position. Students come in the cafeteria and decide to sit on their side according to gender division and wait for their turn. student can change their location according to avalability of the table.)

EXTENDING THE MODEL

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

Emergence:

(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

patches-own [
  table-number   ;; number (1, 2, or 3) to identify the food sources
]
globals[
  rtable-one
  rtable-two
  ltable-one
  ltable-two
  total-customer

]

turtles-own [fwd
  num
  i
  head
  ctimer
  servtime
]

breed [male maless]
breed [female femaless]
breed [servers servess]

to setup
clear-all
  create-female females
  [
     set shape "person"
    set color red
    setxy 2  -10
    set heading 0
    set fwd 1
  ]
  ;;students
  create-male males
  [
     set shape "person"
     set color blue
     set heading 0
     setxy -1 -10
     set fwd 1

  ]

  ask patches[
  creat-tables

  ]

  ask  turtles[
  set num 0
  set i 19
  set head 0
  set heading 0

  ]
  ask patch -5 14 [ set pcolor white
  ]
  ask patch -2.5 14 [ set pcolor white
  ]
  ask patch 2 14 [ set pcolor white
  ]

  reset-ticks
end 

to go

  check-customer
  ask turtles with [color = blue][

    ask one-of  turtles [

      ifelse (color = white)[eatattable]  [ifelse (color = pink)[ wait-atserving][fd 0.5]]
  if(pycor = -4 )[
      ifelse ( rtable-one != 1)[
         move-to patch -10 -3
        set color white
        set pcolor green + 1

         set rtable-one rtable-one + 1
        set ctimer wait-at-table
      ]


      [ if ( ltable-one != 1)[

        set ltable-one ltable-one + 1
         move-to patch 10 -3
         set pcolor red + 4
        set color white
        set ctimer wait-at-table

      ] ]

    ]


    ];;one of turtles

  ];;color blue
     ask turtles  with [color = red][

    ask one-of turtles with [color = red][
     if(pycor = 4 )[

        ifelse ( ltable-two != 1)[
          set ltable-two ltable-two + 1
          set color white
          move-to patch 10 5

          set pcolor green
          set ctimer wait-at-table
      ]

       [if (rtable-two != 1)[
        set color white
          move-to patch -10 5

          set pcolor red + 2
        set rtable-two rtable-two + 1
        set ctimer wait-at-table
      ]
      ]
    ]

    ]
    if (pcolor = red)[
    set color pink

    ]
    ask turtles with [color = pink]
    [
    move-to patch 2 12
     set servtime perc_boywaiting
    wait-atserving
    ]

  ]


  ask turtles[
   If (color = white)[eatattable]
    if (color = yellow)[move-to patch 0 -14
    ]

  ]

  table-zero
  check-customer
 tick

  if ticks >= 19000 [stop]
end 

to  check-customer
set total-customer females + males

  if (count turtles with [color = yellow] = total-customer)[
   STOP
  ]
end 

to table-zero
  ifelse any? turtles with [color = white] [ ][set rtable-two 0
  set ltable-two 0
  set rtable-one 0
  set ltable-one 0]
end 

to creat-tables ;; patch procedure

  if(pxcor > -9 and pycor > 12 and pxcor < 6 and pycor < 18) [set pcolor red]

  ;; setup Table one on the right

  if (distancexy (0.6 * max-pxcor) 4) < 0.6
  [ set table-number 3
   set pcolor blue
   set ltable-two 0
  ]

    if (distancexy (0.6 * max-pxcor) -4) < 0.6
  [ set table-number 1
  set pcolor gray
    set ltable-one 0
  ]



  if (distancexy (-0.6 * max-pxcor) 4) < 0.6
  [ set table-number 7
   set pcolor red
     set rtable-two 0
 ]

  if (distancexy (-0.6 * max-pxcor) -4) < 0.6
  [ set table-number 5
  set pcolor green
    set rtable-one 0
  ]
end 

to eatattable
  set ctimer ctimer - 1   ;decrement-timer
  set label ctimer
  if ctimer = 0
    [
      set label ""
      set pcolor black
      move-home
    ]
end 

to wait-atserving
  set servtime servtime - 1   ;decrement-timer

  set label "waiting"
  if servtime = 0
    [
      set color red
      set label "order_Received"
      set heading 180
    ]
end 


 To move-home

  fd 6
  set color yellow
  move-to patch 0 -14
end 

There is only one version of this model, created over 7 years ago by wasiq khan.

Attached files

File Type Description Last updated
Student_Cafeteria_V2_Bahria.png preview Preview for 'Student_Cafeteria_V2_Bahria' over 7 years ago, by wasiq khan Download

This model does not have any ancestors.

This model does not have any descendants.