
Microsimulation of Traffic Flow - social_quotient
http://traffic-simulation.de/ring.html
======
siavosh
This is incredible, I put a cone in the middle of the road and realized the
nightmare I had caused, and then quickly removed it. But the nightmare just
continued to ripple through space and time. This explains all those mysterious
traffic jams I've been in that seemed to defy reason.

~~~
systemtest
The solution is simple. Lower the speed limit to 20kph, wait for the ripple to
disappear and slowly raise the limit to 100kph. The reason this doesn't work
in real life is lack of dynamic signage and because people don't adhere to the
speed limit.

~~~
herghost
This gives me a newfound respect for variable speed signs on UK motorways (NB.
not the actual speed limit signs, the black signs with the white matrix of
bulbs giving advisory speeds).

To-date, if you see a sign saying "40", that basically means there's no
traffic flow and you will have to come to a stop very shortly.

If you see a sign saying "60" that means that you probably won't need to stop
but you're going to slow to a crawl.

If everyone just did as it said things would probably improve massively.

~~~
hammock
Lowering your speed will technically resolve the congestion, but your average
speed will still be the same as if you had simply "ridden the wave," that is,
proceeded at normal speed up to the jam, then proceeded thru the jam at slow
speed.

Essentially you are doing a "smoothing" operation if you proactively reduced
your speed ahead of a jam.

~~~
dragontamer
Hmm, stop-and-go is less efficient though. I try to average things out myself
to maximize fuel-economy in those traffic conditions.

Even with regenerative brakes, the regeneration isn't fully efficient. You
lose energy to heat. So smoothly traveling one speed is superior.

------
jdashg
This does a great job of demonstrating how increasing acceleration decreases
traffic. 2m/s/s is 5mph/s, and helps a lot: Cars in front get out of the way
faster. Lazy acceleration, while more accurate to what I see on the road,
causes gridlock and traffic waves.

Perhaps more surprisingly, /reducing/ comf(ortable?) deceleration keeps things
running smoother than higher values.

~~~
jrootabega
My gut tells me that you should just gravitate towards the area of less cars.
If the road ahead is clear or clearer, higher acceleration is better for
everyone. If the road ahead is saturated but clearer behind, lower
acceleration is better. If it's saturated in front and behind, good luck.

------
takk309
This is a neat toy simulation. I do enjoy the depth of the drivers' behavior.
I am a traffic engineer and traffic simulation is a large portion of my job.
Professionally I use PTV Vissim. [1] It allows me to build just about any road
network configuration imaginable.

[1] [http://vision-traffic.ptvgroup.com/en-us/products/ptv-
vissim...](http://vision-traffic.ptvgroup.com/en-us/products/ptv-vissim/)

~~~
jordan801
I've been looking for a decent traffic simulator. Can you modify driver
behavior? I am really curious how much traffic could be reduced by changing
driver behavior, and simple vehicle modifications.

For example, how much time could be saved if at red lights, when the light
changes green, if all cars accelerate at the same time and speed, instead of
the accordion behavior. This is something basic driver AI could handle and
might help with pollution and traffic, while fully autonomous driving is still
underway.

~~~
takk309
Yes, you can change any part of driving behavior you want. Vissim is robust
enough that you can even program your own driving behavior if you are so
inclined. I have even seen demonstration of hardware-in-the-loop simulations
with real autonomous car hardware.

~~~
cr0sh
That actually looks like a fun product, but given that all I saw for finding
the price was essentially "contact us", cost is likely very high, and
discouraging for just playing around.

I wonder why a "SimRoads" hasn't been created?

A mashup of this road microsimulation and something like TORCS might be a fun
thing to play with, both from the "design" and "simulation" perspectives.

~~~
Bjartr
There's a 30 day trial, I might grab that just to play around with.

~~~
takk309
If you do play around with it, make sure to take a look at the examples that
are included in the installation. They can be found under the Help menu.

------
sandworm101
Lol. I really enjoy these online traffic simulators. Specifically, I like
seeing how people manipulate them to suit their own ideas about "proper"
driving.

There is no easy answer. Aggressive driving = bad. Tailgating = bad. But see
what happens when you crank up the acceleration and decrease distance between
cars. Then do the opposite. Simple little simulations like this teach us that
bad driving is actually good for traffic.

One very interesting lesson is that speed seems largely irrelevant to traffic
flow. So long as people don't leave gaps, that they all follow each other
closely and accelerate/brake like racers, net flow is divorced from speed.

~~~
nexuist
There is an easy answer. Put a computer in charge of it (well, okay, we're all
mostly software engineers and we all know it's not that easy - but - you get
the point).

Aggressive driving and tailgating are bad because humans are not capable of
making good choices at those distances/speeds. If you could 10x our reaction
speed, then those actions would not be as looked down upon (going 6-8 over the
speed limit is technically illegal most states, but nobody on the road is
going to think you're some kind of maniac).

Simple little simulations like this teach us that simple little simulations do
not account for reality and the complex nature of the meatbags in control of
each vehicle. A more realistic simulator might be able to roll the dice that a
driver might not notice an obstacle in time, and crash straight into it -
putting more debris and obstacles on the road for every other driver to
avoid/crash into[1]. The gains in net flow from have everyone drive like
madmen would probably immediately be wiped out from the hour(s) spent getting
emergency vehicles onto the scene, redirecting traffic, treating the driver,
towing the vehicle, etc. Not to mention that there would almost certainly be
multiple scenes down the road - as there usually already are during rush hour
- and we already condone this type of behavior!

[1]
[https://en.wikipedia.org/wiki/Rubbernecking](https://en.wikipedia.org/wiki/Rubbernecking)

~~~
sandworm101
I'm not sure that the robots will perform much better than humans in terms of
traffic flow. Drivers drive. They accept g-forces and such without issue
because they are the ones controlling them. But if people aren't doing the
driving, if they are chatting on their phones or trying to sleep, they will
probably demand a 'smoother' ride. So I think AVs will leave greater distances
and accelerate/brake much less aggressively, leading to increased congestion.

Accidents do happen, but are actually a very small part of traffic jams. They
are the rare case that do cause a big onetime backup but don't play a role in
the daily slog. Eliminating every accident would not result in traffic moving
appreciably faster on a daily basis.

~~~
Faark
Sure, passengers usually want smooth rides. Software piloted cars could easily
achieve this due to more cooperative behavior. E.g. distances to other cars
telling you what they intend to do can reduce to that necessary for an
emergency break. Maybe a bit more when someone in front of you has set a less
stringent g-force limit.

This obviously can only work if necessary protocols get adopted. Industry
might do it themselves, otherwise passing such regulation should be quite
doable... little opposition from voters due to AVs mostly owned by big fleets
but a significant prospective quality of life improvement.

------
thestepafter
First, this is awesome. I have always been fascinated by traffic flow and how
it works. This assuages my curiosity in so many ways.

Second, removing all of the politeness has an interesting effect. I think I
can learn some lessons from this, thank you!

Third, they should use this in driver education classes.

~~~
atoav
If this fascinates you check out Sam Bur’s youtube channel, a city planner
playing Cities Skylines with foxus on traffic stuff.

------
olliej
I’ve seen a bunch of things like this that all seem to imply entry to a round
about is governed by stop signs - they’re meant to be governed by “give
way”/yield so that they don’t impede traffic when there isn’t significant
load, so they always end up showing similar characteristics to stop signs (not
quite as bad, but that’s not a high bar)

Personally though I’ve always wanted to make a genetic algorithm
implementation that models this but where card can evolve when and what
signals they give and how they respond to those signals. Fitness function
would be speed to get to destination, crashing would be a failure.

I think it would be interesting to see what happened

~~~
mikhailfranco
In many places, road engineers deliberately obscure visibility of the
roundabout from the approaches. So even if it is legally a 'yield', in
practice, stopping is enforced by unaccountable manipulation.

Yet another example of LCD governance imposed by the crazy minority - in this
case, those who would not yield correctly (see _Skin In The Game_ , NNTaleb).
Always remember that 50% of drivers are below average intelligence.

~~~
takk309
Traffic engineer here. The purpose of the landscaping in the center island of
a roundabout is to block the view across the roundabout and to stop people
from driving directly over the central island.

The purpose to blocking the view is to make traffic flow better. There are
many people that will wait for any vehicle in the circulating lane regardless
of that vehicle blocking their path. By blocking the view across the central
island, those entering the roundabout can only see so far upstream as matters
to their flow.

Stopping people from traversing the central island may not be a large issue in
an urban environment but in rural settings that is different. The state I live
in is very rural and we have some roundabouts that are not near a water supply
for irrigation. As such the state DOT tends to use just a mound of gravel
(roughly 3/4 to 1 inch aggregate.) It is very common to see tracks going right
through the central island, likely lifted trucks thinking it is awesome.
Having landscaping in the central island ads something to hit.

------
teakdust
I think cars should “tug” on each other (communicating to eachother over RF
somehow) and also act as a cushion (braking).

When an intersection light turns green - all cars should begin rolling
together. Waiting for cars in front of you in succession is burning time.

~~~
adrianmonk
I've pondered a similar question: is pulling up right behind the car in front
of you the optimal behavior for a red light? What if you could get everyone to
leave a large gap (on the order of several car lengths)? Could you increase
the number of cars that make it through a light while it's green? Or would it
not matter?

Human nature is to pull as far forward as you can, within certain limits at
least. But is that actually optimal? If not, with self-driving cars or some
other technological assistance, maybe we could increase the efficiency of
intersections that use signals.

~~~
cgriswald
Sure, you can probably optimize for that, but understand that you’re
preventing people from turning on red or getting into the left turn lane in
time for the signal to appear this cycle and you’re also trapping people going
straight on the other side of the previous intersection.

I suspect it might be good for getting through that intersection faster, but
in general I think it’s probably best for all traffic if stopped traffic takes
up as little room as possible.

~~~
adrianmonk
Yeah, if the effect even matters, it wouldn't work well for short blocks.

Even for long blocks, you'd want to figure out that the light will be green
for X seconds, which allows Y cars to get through, so only Y cars (and no
more) would line up with the required spacing between them, and the ones
behind that would pack in more tightly to save space. Then while the light is
right, the next Y cars could get themselves into the correct configuration.

------
techdragon
I’m really impressed with this simulation. It’s an excellent illustration of
the dynamics of traffic flow.

The default examples are good too. The kind of bunching you get due to merging
traffic onto higher speed roads, and the kind you get from traffic slowing
down to exit on a slower speed road, both of these are great examples that
come up in the real world very frequently.

------
amelius
My takeaway from playing with the controls: once you have a traffic jam, no
amount of politeness is making it go away.

~~~
noxToken
Politeness restricts the issue to one lane without making it worse for
everyone else. You and all of your lane mates suffer, but everyone gets to get
to their destination at a normal time.

------
habosa
Anyone know a good traffic simulator for cities that includes pedestrian
behavior?

I always wonder if, at busy pedestrian intersections, it would make more sense
to have the pedestrian flow stages and the vehicle flow stages be totally
separated. Cars waiting to turn right for ~30s as pedestrians walk is kinda
crazy.

~~~
zukzuk
Cities in Motion and its sequel were pretty good and pretty serious transit
simulators
([https://en.wikipedia.org/wiki/Cities_in_Motion_2](https://en.wikipedia.org/wiki/Cities_in_Motion_2))

------
mk89
Roundabouts with arms priority lead to deadlocks, I never thought about this.

Interesting to see this in practice and to just give the rule "ring has
priority" for granted.

~~~
ghostly_s
Aren't you describing the difference between roundabouts and traffic circles?
Maybe this is US-specific terminology.

~~~
Sohcahtoa82
Roundabout and traffic circle are different terms for the same thing.

[https://en.wikipedia.org/wiki/Roundabout#Terminology](https://en.wikipedia.org/wiki/Roundabout#Terminology)

~~~
ghostly_s
As described in the section you've linked to, they are not synonyms as far as
how the USDOT uses them.

------
User23
I'd love to see an addition to this for motorcycle lane-splitting. I assume
that's illegal in Germany though. Still though, if you want to keep your CO2
emissions down in exchange for a somewhat higher risk of death or
dismemberment, motorcycles are a great choice. Oh and they're cool so there's
that.

~~~
s_y_n_t_a_x
It's not a somewhat higher risk of dying, it's 35 times higher.

------
maxtollenaar
Not related, but this is traffic micro simulation Reinforcement learning
framwork that my previous research group started:
[https://m.youtube.com/watch?v=P7xx9uH2i7w](https://m.youtube.com/watch?v=P7xx9uH2i7w)

------
tokyodude
It's a neat simulation and great for seeing traffic ripples. But, I'm finding
putting a cone in a single lane blocks cars forever. That would never happen.
The car at the cone would force their way into an unblocked lane.

~~~
executesorder66
It depends which settings you use. If you turn politeness all the way down,
then the people in the blocked lane will force themselves into an unblocked
lane.

------
godelmachine
Went through their Git but couldn’t deduce much.

Do they use Poisson distribution, by any chance?

~~~
Sohcahtoa82
I'd certainly love to be about to distribute some poison to some of the
drivers out there.

------
poglet
While looking for the 'best' settings, I found that flow and speed are
calculated every 30 in-game seconds. Reducing the timewarp (sim speed) value
increases the flow value (there is also some relationship to the density value
that couldn't figure out).

These are the 'best' settings I could find (almost 500k veh/h):
[https://i.imgur.com/eqM8nbb.jpg](https://i.imgur.com/eqM8nbb.jpg)

To reproduce, set the timewarp to 0.2 and density to 0 then wait for 30 in-
game seconds.

------
herghost
I was curious so I tested the 'on ramp' strategy that seems to be in place on
UK motorways at rush hour - namely that they are traffic light controlled, but
that they always seem to be Green for ~3 cars, Red for ~6 cars.

Always seemed really pointless.

Turns out that was the only way I could get traffic going again on the curved
road with the on-ramp (even though I could only control the main traffic, not
actually the on-ramp). Even dropping the speed limit had no effect on clearing
the congestion at the junction.

~~~
Sohcahtoa82
In all the traffic light controlled on-ramps I've seen in the USA, the lights
specifically only allow 1 car per green (and they have signs indicating such).

They make a lot of sense. Traffic entering an on-ramp will usually come in
bursts from traffic light. A burst of cars will have a much harder time
merging with traffic than a trickle. So rather than creating, for example, a
group of 20 cars every 60 seconds trying to merge at once, the on-ramp traffic
light throttles that to 1 car every 3 seconds. Total throughput is the same,
but the effect on existing highway traffic is significantly reduced.

------
gHosts
Somehow incredibly road rage inducing that you get squanch points forming on
completely steady state unimpeded circuit and everyway I tried altering the
parameters made it worse.

------
dylanwenzlau
Really awesome simulation of this problem. I constantly think about how
traffic would be optimized once full automation is possible and this is a nice
way to play around with the levers the AI would optimize.

As highway-driving AI approaches perfection I'd expect:

\- Acceleration/nausea approaches zero

\- Number of lane changes approaches zero

\- Distance between cars approaches zero (when necessary in crowded areas)

\- Maximum speed approaches physical limit

It will be satisfying to watch these happen over time.

edit: formatting

------
fmduifaheuri
Cool!

I've made something simpler yet similar way back (hit "refresh" after the
initial load, sorry for that bug):

[http://sinelaw.github.io/jammed/src/](http://sinelaw.github.io/jammed/src/)

In my simulation each car has a "personality", which affects lane passing,
following distance/time, speed, acceleration, etc.

Did it as an exercise in JavaScript + HTML Canvas programming...

~~~
mysterydip
I'm working on simple traffic simulation for a game that takes place in a city
so the main link and yours came at a perfect time. Thanks!

------
croisillon
I spent 2 minutes googling for a similar tool I knew from the TU Dresden...
only to understand it _is_ the tool that used to be on the TU Dresden website.

------
dsfyu404ed
Too bad you can't adjust the speed of the in/out flows. I was looking forward
to creating evidence that indicates people who suck at merging and take off
ramps too slow screw it up for everyone else.

Being able to adjust the min/max and standard deviation of traffic speeds
would be nice too.

~~~
AAmarkov
This was my hypothesis as well.

You can set the maximum speed to the max. While this doesn't directly control
on-ramp flows, the cars already on the highway will be moving much faster than
cars on the on-ramp due to acceleration/distance constraints. Then a jam
ensues

------
ya3r
This reminds me of this great video:
[https://www.youtube.com/watch?v=iHzzSao6ypE](https://www.youtube.com/watch?v=iHzzSao6ypE)

------
iamgopal
I made my first ~10 USD making cross road traffic and auto light timing
simulation when I was 14-15 year old for a traffic light manufacturer. Great
memories.

------
artificialidiot
It is fun to watch cars changing lanes like maniacs as if it matters.

~~~
steadicat
Lane change behavior looks completely unrealistic to me. I see cars switching
lanes on deceleration into a traffic jam, which doesn't buy you anything (both
lanes are stopped) and is extremely dangerous (you're cutting off cars
approaching fast from behind and braking at the last minute). Never seen this
happen in real life, except maybe at toll booths.

On the other hand, there is no lane switching when traffic on adjacent lanes
clears up. In real life, drivers will quickly switch if a nearby lane starts
moving. They can't see whether their own lane is also clearing up ahead, and
most people won't take any chances.

~~~
ghostly_s
Huh? I see this happen all the time. If people decide the backup is "shorter"
over there (i.e. the last stopped car is a few car-lengths ahead) they will
absolutely merge into another lane approaching a backup. Same behavior you see
at the grocery store.

------
devaroop
brother, where is the tweet button?

------
rectangleboy
Watching this frustrates me tremendously.

------
dosy
Would self-driving AI cars change these simulations? Seems they could
coordinate to optimize for flow.

~~~
cpeterso
There are major safety concerns if your car is taking anonymous, untrusted
input on how it should drive. People could do anything from telling other cars
to move out of their way to maliciously causing accidents.

~~~
newaccoutnas
Actually there are systems that talk to vehicles from the roadside, sending
info such as when the lights will change. Although I doubt you'll see vehicle
to vehicle systems unless they're in closed CAV (Connected Autonomous Vehicle)
spaces like airports or closed loops (at least it'll be a while until it's a
generally used thing on the roads of the future, if ever)

~~~
cpeterso
That's interesting. I hadn't thought of roadside status messages or closed
networks. Information providers could sign their roadside message broadcasts
with a private key (signed and sent from their HQ, not hardcoded in some
roadside box!). I don't want to say "blockchain" is the solution here. :)

