VANET-shell
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This is the shell of a very crude VANET - Vehicle Ad-Hoc Network. Ten cars wander around randomly establishing links when close, sending messages down the links, and breaking links when they move far apart. The number of undelivered messages on each link is reflected by the link thickness.
HOW IT WORKS
Ten cars wander around randomly. When two cars are close to each other they establish a link and start sending message packets to each other. The packets take some number of ticks to make it down the link and if they survive that long they get received and removed from the link. If the cars move more than some distance apart the link breaks and all undelivered messages on it are lost.
The "messages" in this case are simply the time-stamp of the tick in which the message was created.
HOW TO USE IT
The usual setup, one-step, and go buttons are all the user interface controls.
THINGS TO NOTICE
You can watch links formed, growing thicker as they have more undelivered messages, turning red and breaking if they get stretched too long.
Someone wanted to see how messsage counts could be acquired and displayed on a real-time plot so that is included.
The world is usual-sized and does not wrap-around.
THINGS TO TRY
EXTENDING THE MODEL
The vehicles could be all travelling down a road and informing each other of some road condition such as stopped traffic ahead. That would require CHAINING message paths, such as a caravan of vehicles each informing the one behind it that a turn or slowdown is approaching and maybe following distance should be increased.
More interesting things than a message per tick could generate messages.
NETLOGO FEATURES
The cars rotate around when they come up to a wall so they don't get stuck on the wall. The maximum random turning angle is 170 degrees so the cars can't simply ping-pong back and forth between two walls.
RELATED MODELS
At this writing there are no other VANET models in the Modeling Commons.
CREDITS AND REFERENCES
Original Creation date: March 13 2021
Copyright 2021 R. Wade Schuette.
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Comments and Questions
globals [ SP distance-make distance-break packet-transit-time LostPackets SuccessfulPackets SuccessRate] breed [ cars car ] links-own [ messagelist ] cars-own [ speed] ;; speed is float, measured in PATCHES per TICK to set-up clear-all set distance-make 3 set distance-break 12 set packet-transit-time 2 set LostPackets 0 set SuccessfulPackets 0 ;; no-display ;; display on and off doesn't work if this is run via the web but ;; it's nice if you are urnning it locally ask patches [ set pcolor white] ;; display ;; create a swarm, world doesn't wrap around create-cars 10 [ set size 2 setxy random-pxcor random-pycor set shape "car" set speed (0.5 + random-float 2.5 ) ] reset-ticks end to go move-one-step break-long-links connect-nearby ping-everyone summarize tick end to ping-everyone ask links [ if messagelist = 0 [ set messagelist [] ]] ask links [ set messagelist lput ticks messagelist set thickness ( 0.1 * length messagelist)] ask links [ if ( item 0 messagelist < ( ticks - packet-transit-time ) ) [ ;;print " receiving packet and removing from link " set messagelist butfirst messagelist set SuccessfulPackets SuccessfulPackets + 1] ] ;; ask links [ show messagelist ] end to summarize let time ticks if (time = 0) [ set time 1] ;; avoid division by zero set SuccessRate ( SuccessfulPackets / time ) end to connect-nearby ask cars [ create-links-to other cars with [ distance myself < distance-make ]] end to break-long-links ask links with [ link-length > distance-break] [ ;; lose all packets on the link let losing-count length messagelist set color red ;; print (word "link is losing this many packets " losing-count) set LostPackets LostPackets + losing-count die ] end to move-one-step ask cars [ let aimed-at patch-at-heading-and-distance heading speed ifelse aimed-at != nobody [ face aimed-at move-to aimed-at ] [ while [aimed-at = nobody ] [ set heading heading + random 170 set aimed-at patch-at-heading-and-distance heading speed ] face aimed-at move-to aimed-at ] ] end
There is only one version of this model, created almost 4 years ago by R. Wade Schuette.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
VANET-shell.png | preview | Preview for 'VANET-shell' | almost 4 years ago, by R. Wade Schuette | Download |
This model does not have any ancestors.
This model does not have any descendants.