
Microsimulation of Traffic Flow (traffic-simulation.de)
752 points by social_quotient on Apr 16, 2019 | hide | past | web | favorite | 159 comments

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.

Here's a real world example of a traffic wave due to one person's sudden break


It's incredible to watch the emergent behavior out of real world systems. Completely counterintuitive, and yet there it is - a clear backward propagating compression wave, whose speed probably mostly depends on human physiology (e.g. reaction time, personal comfort level with distance to next vehicle, etc.) Fascinating.


I think it has more to do with the suddenness of the stop; each car behind it has to stop suddenly in response, as the change only spreads locally. I’m pretty sure all you need to modify is deceleration speed for braking and acceleration speed to catch back up, to see like 90% of the effect

I’d test it with the simulation but it was too difficult to setup on mobile :-)

> each car behind it has to stop suddenly in response

Yes. And simply maintaining good following distance gives you a buffer that can absorb this sudden change and prevent the tailback. This is one of the reasons that I long for the day that humans don't pilot cars on the highway.

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.

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.

"40 - Queue ahead" by a junction about an hour after the traffic has cleared. A couple of weekends ago I drove past 3 lane closure warnings and low speed limit signs on a motorway with, you guessed it, no lanes closed.

To some extent this is my confirmation bias, but certainly as often as not the signage is spurious and that's why people don't pay any attention to them. I suspect most people agree with the principal of the things, but every time they obey a sign whilst everyone else flies past, only to discover it was inaccurate it does affect the amount of credence future signs are given.

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.

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.

And human psychology is an important factor here as well. Less stop-&-go means fewer temper flares & physical opportunities for collision.


I respect the idea, but the actual implementation feels a bit half hearted to me. They need to kick in a lot quicker and be more severe, all they seem to do is make a minor improvement and slow people down perhaps a half mile from the actual congestion.

We have variable speed signs in the US, but where I live, they aren't followed, to the point that it seems unsafe to obey them and go 30mph when the flow of traffic is 60mph

Those variable speed limit signs are meant to be enforced by average speed checks with cameras. I'm not sure what's going on with that, I know there are delays, but there's signage that says there are regular speed cameras.

So if the cameras work, we'll have to do exactly what they say or get fined for speeding.

On the new 'Smart Motorways' there is built in enforcement via cameras. On those, the speed limit signs are actually speed limits, with the red ring around them.

The ones I was referring to are advisory and look like this [0].

[0] https://www.drivingtesttips.biz/images/motorway-advisory-spe...

I got hit by this a while ago. Was driving down an empty freeway at night and there must have been road works off the side of the road during the day but I didn't see it until the second sign but the speed camera was after the first sign and I got hit with an $800 fine :/

Mostly the latter, in my experience. Germany has dynamic signage on several highways, but if the sign says 80 (even with a secondary sign notifying of traffic jams), most people will still drive 160 if it doesn't look congested yet.

That’s simply not true. Most people don’t even drive 160kph to begin with.

In some parts of the highway is very plausible. Even 200km/hour and more

People seem to have some terrible difficulty of understanding the difference b/w “Most people don’t do <x>”, and “It’s theoretically possible to do <x>”.

People seem to have some terrible difficulty ...

All / most / some people? Or just the person you responded to?

There are multiple reason why the way people communicate is important, one of which is the limited logical reasoning capability of most people.

Just look at politics / marketing / dark patterns / mortgage contracts.

I successfully changed my sister's mind from variable rate mortgage to fixed mortgage, as the language of the contract doesn't explicitly write how bad the worst case option can be 10 years from now for variable rate mortgage.

In unrestricted areas, this link says the average speed of cars is in the 140-150kph range, and about 20% of all vehicles above 160kph, so while you're right, it's not as extreme a difference as one may infer from your tone.


That depends on what country you live in. Some areas in Germany, 200 km/h is no problem for hours straight.

I live in Germany. And what you’re saying is (a) wrong, and (b) not even incompatible what I said.

"Some areas in Germany, 200 km/h is no problem for hours straight."

Please tell me of one road/route in Germany where you can drive '200 km/h for hours straight". I'll settle for tiny values of 'hours', as long as they're >= 1.

This ofcourse depends on time of day. An early morning somewhere around 2 am - 5 em we were driving from Sweden down to south-west germany, somewhere after Hamburg. We have a small car, top speed is about 200 km/h in downhill, wind in the back. I had the gas pedal to the bottom for several hours, most of the time it was four lanes and the only thing you saw was a truck every few kilometers. This was a few years ago so not certain if this has changed. Last time we drove down we ended up on the wrong highway and stuck behind a heavy transport for the same ammount of hours doing 70 km/h tops, when we weren't standing still. Friends told me the heavy transports blocking the whole roads have gotten a lot worse in the nights, the last years.

From experience this is rare. 20kph above the limit is standard (and probably expected by the system setting speed limits), 80 over would cost your license for several months.

Admittedly, 160 was exaggerated. But on stretches where there's no speed limit and you suddenly get this 80 km/h along with Stau signs, people tend to still drive 120 if there's no visible congestion. Since those dynamic limits are not really enforced (most speed cameras tend to be in places where there's a fixed limit at all times) there's rarely a downside to drivers. Same as with driving 80 in construction sites instead of the 60 that's signed.

This is starting to change now that the polizei have started leaving mobile panzerblitzers in place for several days at a time. I've noticed in the last few months significantly more respect for changes in speed limits from the folks with local license plates.

The ones still driving 160 are mostly foreign drivers in my experience. Most German drivers obey the speed limits. Note I'm not German but often drive through it.

As somebody who was using the Autobahn quite a lot I’d say most people go between 120 and 160 when there is no speed limit. But it depend on the conditions

Admittedly, the 160 was exaggerated. But as a German who does obey the speed limit, my experience seems to be that most drivers don't.

Because you never notice all the other cars that do. They travel as fast as you, so their distance remains constant. You only notice cars going slower or faster than you.

The thing that makes me most excited about self-driving cars is what with a little bit of coordination these kind of smoothing techniques could be applied with even a modest percent of cars with the capability.

Sure, as long as the rushed buggy insecure software doesn't accelerate all the cars into the traffic jam.

Wow, works like magic ! Actually Swedish drivers are somewhat more obedient and indeed traffic problems are due to road hazards are on average less severe.

For example when Swedes sees a lower speed sign or even just a warning before a road block they will slow and stay in one long lane, while in the mid eastern country I live in until recently everyone just speeds up trying to be first to pass the blocking. The results ? smoother flow and shorter queues, guess where ?

Swedish drivers are indeed obedient. Overly so, at times. I live in a heavily touristed part of Denmark - we get a lot of Swedish and German cars in the summerish half of the year. And I have long since learned to stay well clear of the Swedes whenever possible. They're too often going that extra bit too slow, adhering slightly too rigorously to every rule, not getting into the flow, too often being front Volvo going 70, the rest of us lined up behind, wanting to go home at 80 like the sign says.

In supercomputers, there are such mechanisms for reactive congestion management: messages are sent to emitters to temporarily reduce flow. It works at small network scale but doesn't scale up, because congestion can happen often and for short times, and the latency of reaction is similar to the latency of events means you are not reacting to congestion anymore, you're just reducing global bandwidth. To this day the best practical mitigation strategies are great deterministic load balancing, QoS through virtual channels and fine-tuned adaptive routing. The analogy with traffic doesn't really hold though, because we can theoretically propagate throttling instructions faster than the vehicles involved, and the problem lies more with getting instructions applied at all. Just thought giving some overview of a similar problem would give some food for thought.

In a sense this sort of adaptive throttling does exist in traffic flow via ramp metering. Upstream sensors detect the traffic density and the signal at the ramp is adjusted to allow only enough traffic to bring the freeway up to capacity.

This solution doesn’t work if the number of vehicles has met the road’s carrying capacity. There is no avoiding traffic once the upper limit is reach, due to the differences in every vehicle’s acceleration/deceleration, as well has inclines and declines in the road. At a certain number of lanes and a certain speed, each vehicle needs a certain amount of space at a specific point in time to pass through a specific point on the road. Once this has been exceeded, the vehicles must start slowing down, and this will cause a ripple effect backwards until this congestion has cleared.

We can try to smooth out this ripple, but if the congestion situation exists for long distances, all it will do is push back the ripple to the end of the congestion.

This only works if you are way under capacity on the road. Once there is enough traffic, no amount of tricks like this will fix the problem.

I have seen highway patrol officers doing what I assume is this in California. They turn on their lights and zigzag across all lanes, preventing anyone from passing them. Then they gradually slow down to a moderate speed, maintain that speed for a while, and at some point turn off their lights and drive off at high speed.

I've only seen it done to stop traffic to pick up a hazard on the road. I'll have to pay more attention now and see if I can see them do it for moderating traffic flow.

This is what's known as a "traffic break", and I see it on the 405 pretty frequently. Definitely threw me off the first time I encountered it.


"and because people don't adhere to the speed limit."

If people can't follow the process maybe the process is wrong.

People can follow the process. Many people (most?) won't follow the process.

In the U.S., at least, it has been observed that roughly 10% of drivers adhere strictly to the limit. The rest drive the speed they find comfortable.

<England> Clearly the solution is to add Orwellian levels of automated ticketing</England>

Sarcasm or wishful thinking?

Both are valid points one could argue for, depending on underlying values that are not necessarily rational.

That's what the UK has done with their "Smart Motorways".

It works surprisingly well, both through modulating the speed of traffic and by allowing the hard shoulder to be used at peak times.

On the circular road, did you try clicking a single vehicle to slow it down just a tad? I did that (just one vehicle) and watched in horror as a phantom jam developed. Just 2 slow vehicles and there arose a bumper-to-bumper, wave of stationary cars.

This is why keeping distance and decelerating slowly is important (also saves your brakes and uses less fuel)

Alternatively, this is why not being that person going slower than the rest of the traffic is important.

This is a slippery slope. At least this puts pressure onto people to match the speed of people going faster. So this might lead to massively increased average speeds risking an increase in accidents.

Wouldn't it?

No, because average speed doesn't increase the number of collisions as much as speed differential does.

If everyone is going 70 mph, it's quite safe. It's the one moron going 50 mph or the one asshole going 90 mph that will cause the crash.

If you drive 100 and the limit is 100 you are perfectly fine. Anybody who goes over the limit has to live with the fact that many people stay within the limit.

I always do this but my mechanic is complaining that I have to use the breaks, they rust fast if not.

I am no mechanic so I don't make money from selling you new brake rotors, but I think coming to a complete stop a few times each drive should be more than enough to brush any rust away.

Depends on local weather conditions. Anywhere that road salt is used in winter, some hard braking regularly is extremely beneficial. Road salt is not only corrosive, it's also hygroscopic, so you really want to clean that shit off.

As for wearing out brake rotors prematurely - even with aggressive braking they last more than 50k miles. So on average you'd replace them less often than every 5 years, and they cost around around $250 for a set of four. Doesn't seem like a very good get-rich-scheme for the mechanic.

This. No mater how minimally you try and use them brake rust will not be a problem on a car that's driven at least weekly.

This depends largely on where you live. Salted roads are ready break-killers. If the car stands still a month and the breaks wasn't clean, there might be holes when you want to use the car again. I know, tried it a few times with my cars over the last 30 years. Repairing that can be expensive depending on car :-)

[CGP Grey did a video on this](https://www.youtube.com/watch?v=iHzzSao6ypE). Your goal, as a driver, should be to try to maintain equivalent distance between your car and cars in front of you and behind you.

reddit link syntax doesn't work on HN, btw.

Nevermind, raw markdown is good enough for this forum.

Next, increase following distance to improve the situation.

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.

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.

>/reducing/ comf(ortable?) deceleration keeps things running smoother than higher values

This is basically what the dynamic speed limits do on motorways in the UK - if there's congestion, the speed limit is reduced on the section of road leading up to the congestion. It reduces the number of cars flowing into the traffic jam temporarily, which helps to smooth out the overall flow.

Lowering the max speed limit also had a massive effect on stopping the stopped waves.

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...

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.

Try SUMO (https://sumo.dlr.de/index.html). Microscopic traffic simulator just like VISSIM but free and open source. The dev team is very active on their mailing lists. There is a Python API called TRACI that allows you to change the simulation while it's running. There is also a deep RL framework called Flow (https://flow-project.github.io) that builds on top of SUMO that shows how autonomous vehicles could potentially eliminate shockwaves in traffic

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.

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.

Yes, Vissim is expensive. It is professional software for a niche market. I don't know the exact cost we pay off the top of my head but it is in the multiple thousands a year for a single seat network license.

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

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.

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.

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

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.

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.

I noticed the same thing re: high acceleration, but that + decreased distance between cars in real world would lead to increased collisions, I'd assume.

Simulators like this (and seeing ideal simulation behavior deviate from correct real-world behavior) concern me re: the coming mix of AV and human drivers.

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.

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

Having literally just coming back from India after two weeks there, turning the politeness to zero perfectly described the traffic flows (and lack there-of) I saw there.

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

My personally favorite "roundabout" is this one here:


It was built about 20 years ago, and I was living in the area back then.

Before the "roundabout" was built, being a traditional intersection it used to be a major accident hotspot, despite having a speed limit of just 50km/h. Crossing the main road was nightmare, I can tell you that.

With the new topology, which is a very elongated roundabout, the speed limit on the main axis could actually be raised to 80km/h yet accidents now rarely happen there and traffic flow is much improved

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.

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.

> Always remember that 50% of drivers are below average intelligence.

Well...technically not in this case, no.

It's usually misleading to use the median instead of arithmetic mean for measuring averages in population, because you can wind up with situations where, say, 90% of people are "above average."

That being said, IQ is specifically calibrated to follow a normal distribution. Ordinarily that would mean you're correct, and we can just call the arithmetic mean and median the same thing.

However! The normal distribution of IQ - average 100, standard deviation 15 - includes the bottom percentiles of the population who are severely mentally impaired. These people aren't usually drivers. It follows that when you're driving, the population of drivers around you will actually skew higher in percentile. In fact, it's probably more likely that the modal driver has intelligence equal to or greater than average.

Personally, I think safe driving, polite driving and technically skilled driving are all orthogonal with respect to each other and to overall intelligence. After a very serious accident years ago, I became the kind of person who will only drive at or below the speed limit. But I know several people at least as - and probably much more - intelligent than me who drive "erratically", to put it nicely. I don't think raw intelligence captures enough information to really dictate behavior here.


Besides that, many after-the-fact roundabouts are so small in diameter that the indicators on almost every car model are invisible, so there is essentially no way to actually tell if someone is taking an exit until they do it. Lots of unnecessary stopping and waiting due to that.

Another great thing is having a zebra crossing (preferably combined with a cyclist crossing) on each approach/exit, but planting a bunch of bushes such that it is practically impossible to see people there when approaching the exit, forcing people to crawl speed before exiting, and conversely forcing everyone behind them in the roundabout to brake as well.

I'm not sure if stuff like that is intentional or just accidentally stupid.

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.

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.

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.

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.

Given that there's more distance to traverse if you leave gaps, it might turn out that it takes the same amount of time.

I haven't done the maths, but it wouldn't surprise me if they're about the same.

Self Driving Cars have two advantages:

Data Transfer allows for instant start/stop so the car can actually stop before the light turns, allowing the cars on the other side to go quicker and go immediately.

In the future, we may not even see self driving cars stopping at red lights (think of all intersections as four way roads)

https://youtu.be/HO2zVYB1TMc is some fun research, simulating an intersection where autonomous vehicles self-synchronize their paths.


Will not work. The safe distance between cars is negligible in traffic lights but a lot more in moving traffic. At least two seconds is considered reasonable although in reality much lower distances are seen.

The "rolling together" would only work if the queue to the traffic light would copy the distance needed by moving cars.

That is, the cars would be spaced 10-40 meters apart while waiting for green. Only then all cars could floor it and accelerate together without having to wait for the first units to run away first.


Almost...as if...they were mechanically linked...

I disagree.

Let's say we are in an area with a 60km/h speed limit.

Going 60 km/h you do need a wide gape between cars.

But once you stop at a traffic light you should leave enough of a gap to see where the types car in front of you touch the road. That way you are not too close to get around the car if it gets stuck.

When the light goes green, lets say the first car accelerates slowly and only reaches 30km/h by the time they cross the traffic light. If every car behind waited until there was 1.5 car length gap, then only half the cars would get through compared to if they all accelerated at the same speed at the same time, maintaining a smaller gap until they cross the traffic light.

You only need the large gap once you've accelerated up to a much higher speed.


Going from small gap while standing in lights to large gap at a higher speed cannot be reached in unison.

The later cars must inevitably accelerate slower or the first cars must accelerate faster in order for the larger gaps to appear. So even if all cars did in fact start rolling at the exact same time when the light turns green the acceleration of any tailing car is bounded by some safety margin as a function of speed.


I agree. But my point is that people can maintain the small gap at lower speeds until they cross to the other side of the traffic lights. (So that more people can get through) then they can spread out.

Any extra space you leave between you and the car in front of you is artificial traffic you're creating. That's space that could be used by more cars. Ideally, at a traffic stop every car would sit literally bumper-to-bumper to maximize throughput but that's obviously not reasonable.

You can see clearly from the simulation that having the opportunity to move around an obstruction doesn't stop the ensuing slow down from occurring because you have to slow down and reduce the bandwidth of the road to move around the obstruction.

Waiting for cars in front of you is for safety and would be the case even with fully automated nationally adopted self driving electric cars.

When you're stopped you don't need a buffer so much for when things go wrong, but at higher speeds you need a bigger buffer, and having space helps avoid mass catastrophes when some freak storm knocks a tree branch onto the road or a car malfunctions or mechanical failure/wear and tear.

Scania, and probably others, are working on platooning trucks. From what I know it is not trivial, for example most of communication methods we have have too long round trip delays and are not 100% reliable so a backup is needed maybe in the form of autonomous breaking system.



Could probably be solved with a direct connection, like antennas touching each other.

touching ? those are fast moving vehicles that can be a few meters to many meters from each other, and possibly have some other vehicle in between

If they are too far away they will not get the lower fuel consumption (due to air resitence), and they wouldn't need micro-second latency response times. So they could use the current radio technology if the antennas are too far away to touch. There could also be sensors in the antennas to feel if the vehicles are out of sync. And alert the driver when they are disconnected.

Just replace cars with giant ants.

> When an intersection light turns green - all cars should begin rolling together.

Agreed. I've always suspected/known this. Just play with the acceleration settings in the simulation for proof.

I hate when the light goes green and people wait for a gap before driving. Just go, you are barely going 20km/h at this stage.

If everyone accelerated quickly until they were on the other side of the traffic light, you could get double the amount of cars through. No need to break the speed limit.

I stopped doing that after I bumped into the guy ahead, who didn't notice the light had gone green.

You didn't do that then. If you had been accelerating at the same speed as the person in front of you, and started at the exact same time as them, you would never have bumped into them.

If they didn't move, then obviously it's retarded to jsut start driving.

My point is when the car in front of you _does_ start moving, you need to move too, at the same speed/acceleration. Not wait.

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.

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

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.

After even a slight slowdown, I was unable to ever restore the vehicles to steady traffic again. Adding lanes, quick stop lights to ease the flow. It was maddening (like real traffic I guess...)

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.

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

The problem with scrambles is that people hate waiting and get tempted to jaywalk because the cycle times get really high. Hence why they tend only to be used at places with more than 4 ways intersecting.

New York uses Leading Pedestrian Intervals, which give pedestrians the green before the cars can turn right; by the time a driver starts turning pedestrians are actively crossing the street and no longer in the blind spot. Another good way to increase pedestrian safety is just to ban right-on-red altogether.

I'm currently studying traffic with using reinforcement learning with:

- Microscopic simulator: https://sumo.dlr.de/index.html

- Flow (abstraction of RLlib and Sumo): https://flow-project.github.io/

Have a look at Sumo, its free, open source, and comprehensive. Also Aimsun [1] but I've never used it and don't think it's free although I'm unsure about that.

[1] https://www.aimsun.com/aimsun-next/

Not a simulation, but I have observed that some of the intersections around UCLA are set up like this, so it makes sense to at least one traffic engineer in the world.

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.

There's a big roundabout in my city that's in construction so some lanes are closed, when there's no traffic cops, people entering it cut you off, creating deadlocks, I've been stuck in that roundabout for >15min some times.

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

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


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

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.

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

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

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.

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.

Went through their Git but couldn’t deduce much.

Do they use Poisson distribution, by any chance?

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

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

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

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.

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.

In the US we call this ramp metering. It is usually a dynamic system that monitors the upstream traffic density and only allows as many vehicles as can be added to reach a maximum density. We usually allow only 1 car per green signal. There have been some attempts to use them on roundabouts too.

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.

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


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


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...

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!

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.

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.

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

This reminds me of this great video: https://www.youtube.com/watch?v=iHzzSao6ypE

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.

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

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.

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.

brother, where is the tweet button?

Watching this frustrates me tremendously.

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

There are designs like platooning [1] which, in theory, would allow self-driving cars to drive bumper-to-bumper at high speeds, accelerating and braking together like the carriages of a train.

Of course, for that to work every car has to trust the data it gets from every other car, so there's no place for bugs or user-modifiable software in such a system. And the stopping distance is the worst of any car in the platoon.

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

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.

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)

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. :)
