Parking with information
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
Globals [ticks1 z1 w1 t1 walk avgwalk] turtles-own [parktimer distparked diststart disttraveled parked] ;;parked is a boolean indicating whether a car is parked or not ;;parktimer is a counter that counts down to when a parked car departs ;;ticks2 is a counter that resets every time a new car is created ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ to setup clear-all setup-patches setup-turtles reset-ticks set w1 list "null" "Walking Distance" set t1 list "null" "Walking Distance" set z1 round(random-exponential arrival_headway) end ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ to setup-patches ask patch 0 1 [ set pcolor 75] ask patches with [ pycor = -1] [ set pcolor green if (pxcor mod 2 = 0) [ set pcolor green + 2 ] ] ask patches with [pycor = 0] [ set pcolor gray ] end ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ to setup-turtles ask n-of 1 patches with [pycor = -1] [ sprout 1 [set parktimer round((random-exponential depart_headway))] ] ;print max [count turtles-here] of patches ask turtles with [who > 0] [ set color blue set shape "car" set heading 90 set pcolor red ] Ask turtle 0 [ set color orange set shape "car" set heading 90 set xcor (- startposition) ;;This xcor indicates the spot where someone will start searching set ycor 0 ;;ycor of 0 indicates this car is on the road set diststart abs(xcor) set parked false ] end ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ to advance ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ifelse ticks = 0 [] [ ;;This is the arrival rate/creation of new cars searching for parking ifelse (ticks1 >= z1 and (not any? turtles-on patches with [(pycor = 0) and (pxcor = (- startposition))])) [ create-turtles 1 [ set color orange - 2 set shape "car" set heading 90 set xcor (- startposition) set diststart xcor set parked false set parktimer round(random-exponential depart_headway) ] set ticks1 0 set z1 round(random-exponential arrival_headway) ] [ set ticks1 ticks1 + 1 ] ] ask turtles with [ (color = orange) and (ycor = 0)] [ ifelse( any? turtles-on patch-at 0 -1) [ forward 1 ] [ right 90 forward 1 set pcolor red set distparked abs(xcor) set disttraveled (xcor + startposition) set w1 lput (abs(distparked)) w1 set t1 lput (disttraveled) t1 set parked true let walk1 but-first w1 set walk but-first walk1 set avgwalk (sum walk / length walk) ] ] ask turtles with [ (color = orange - 2) and (ycor = 0)] [ set color orange ] ask turtles with [color = yellow] [ forward 1 ] ask turtles with [ycor = -1] ;;Departure code-- Cars will depart when their parktimer is 0. Parktimer is set randomly (exponentially) upon creation. [ ifelse (parktimer <= 0 and (not any? turtles-on patch-at 0 1 )) [ depart ] [ set parktimer (parktimer - 1) ] ] ask turtles with [ (xcor = max-pxcor) and (color = yellow)] [ die ] tick end ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ to depart set pcolor blue set ycor 0 set heading 90 set color yellow end ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There is only one version of this model, created about 10 years ago by zhibin chen.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Parking with information.png | preview | Preview for 'Parking with information' | about 10 years ago, by zhibin chen | Download |
This model does not have any ancestors.
This model does not have any descendants.