Vehicles
Cars, motorcycles and bicycles drive on drawn lanes beside the walkers. Each vehicle keeps to the centreline of its lane and chooses how fast to go and, where the lane has a neighbour, whether to change lanes. Speed follows the Intelligent Driver Model (IDM) of Treiber, Hennecke and Helbing (Physical Review E 62, 2000). Lane changes follow MOBIL (Kesting, Treiber and Helbing, Transportation Research Record no. 1999, 2007). Vehicles may stop at a drop-off kerb or park in a lot on the way (see Kerbs and parking). The lanes, sources, sinks, signals, kerbs and lots are in elements.
Walkers keep off the carriageway because it is not walkable floor. They meet vehicles in two places: at a crossing that names the lanes it crosses, where vehicles stop for them (see Crossings), and at a kerb or lot linked to a portal, where people get out of and into vehicles (see Coupling with walkers). Elsewhere vehicles drive straight over the floor where a lane crosses it.
Following
A vehicle's acceleration is
where is its speed, its desired speed, the bumper-to-bumper gap to the leader and how much faster it is going than the leader. With no leader within 200 m the last term is dropped. The result is clamped to between −9 m/s² (emergency braking) and .
| Mode | Length | Top speed | Critical gap | People aboard (1 / 2 / 3 / 4) | ||||
|---|---|---|---|---|---|---|---|---|
| Car | 4.5 m | 120 km/h | 2.0 m | 1.2 s | 1.4 m/s² | 2.0 m/s² | 4.0 s | 50 / 30 / 12 / 8 % |
| Motorcycle | 2.0 m | 100 km/h | 1.2 m | 0.9 s | 2.0 m/s² | 2.5 m/s² | 3.0 s | 70 / 30 % |
| Bicycle | 1.8 m | 18 km/h | 1.0 m | 1.0 s | 0.8 m/s² | 1.5 m/s² | 5.0 s | 1 |
Car values are the usual urban IDM set. Motorcycles keep shorter gaps and pull away harder. Bicycles are slow and gentle. The critical gap is used when giving way (see Junctions). Bicycles need the longest because they take longest to clear. Occupants are drawn at spawn and reported, ready for passengers stepping out at a kerb.
The leader is the nearest of these along the route:
- the vehicle ahead on the same lane, or the rearmost vehicle on a lane further along the route, skipping any it filters past;
- a hold, a point that acts as a stopped leader for one step: the near edge of a crossing that walkers are on or about to step onto (see Crossings);
- the vehicle's own stops: a red or amber stop line, the give-way point of a junction it is waiting at, the end of a lane it must change out of, and, while bound for a kerb or lot, the head of its queue or the mouth of its bay (see Kerbs and parking);
- a vehicle it follows through a junction.
In steady following at speed , the gap settles at . The tests check this, and check that a held queue never overlaps.
Desired speed
is the lane's limit, capped by the mode's top speed, times the driver's pace. The pace is drawn at spawn, uniform within ±8 %. Before a slower lane on the route, is lowered to , where is the next limit and the distance to it. So the driver brakes comfortably to the next limit by the start of that lane instead of overshooting it. A filtering motorcycle keeps to 4 m/s. never drops below 0.5 m/s.
Integration
Speed and position use the ballistic update. A vehicle that would reverse in a step stops where its speed reaches zero. After the step, any vehicle left closer than 0.2 m behind its leader is pulled back to 0.2 m and its speed capped at the leader's. Lanes are settled front first. A vehicle slower than 1 m/s with a leader or stop within 6 m is reported as queued, or as yielding when that stop is a give-way point or a crossing hold.
Routes
Each vehicle drives one lane sequence, the quickest from its source's lane to its target's lane. The cost of a lane is its length divided by its limit, using only lanes that allow the vehicle's mode. A change to a left or right neighbour costs 3 s and puts the vehicle on the neighbour at the same point. The route is drawn at spawn and redrawn from the new lane after a voluntary lane change.
Junctions
At load, every pair of lanes on a floor is traced in 0.25 m steps. Wherever their centrelines pass within 2.2 m of each other, that stretch of each lane is a conflict zone: two car half-widths and a margin. Two kinds of pair are left out: a lane and the lane it runs onto, and side-by-side neighbours. Zones come in three kinds:
- merge: both lanes end in the zone and feed a shared next lane. Lanes that feed a shared lane but never come within 2.2 m still form a merge, with the zone at their ends;
- diverge: both lanes start at one point;
- cross: anywhere else.
Every vehicle still to clear a zone is ordered by its distance to it. That distance is measured to the merge point for a merge, and to the zone entry otherwise. Each vehicle follows the projection of every vehicle ahead of it on the other lane, as if both drove one lane. Through a merge, that gap is the follower's distance to the merge point, less the leader's distance, less the leader's length. Elsewhere, the follower may reach its zone entry only once the leader's rear has left the zone. The merge lane's rearmost vehicle is seen from both lanes as usual. So two bodies never overlap at a merge, a crossing, or just past a fork.
A lane that lists the other in yield_to gives way there, unless the other lists it back. Nobody gives way at a diverge. A driver giving way stops at its zone entry, where its front is 2.2 m from the other centreline. Within 30 m of that point it judges the gap. It goes when every priority vehicle still to clear the zone is:
- outside the zone;
- at least the critical gap of the driver's mode, after the driver's own arrival, from reaching its zone entry. The driver's arrival counts as now when it is slower than 1 m/s, else its distance over its speed. The priority vehicle's arrival is its distance over its speed, or 0.1 m/s if slower;
- far enough back to follow the driver through at its own standstill gap.
A driver kept standing there grows impatient. After 10 s at the give-way (PATIENCE_S), its critical gap shrinks steadily over the next 20 s (IMPATIENT_S) to half its mode's (IMPATIENT_SHARE), and goes back to the full value once it is through. So a side road onto a steady stream with no gap as long as the critical one still gets out, as drivers do in practice. The other two conditions do not relax.
Once it accepts a gap, it keeps it until it is through, and priority traffic behind it follows it. Until then, priority traffic ignores it. A driver already past its entry goes regardless.
The same test, without a zone, tells a vehicle at rest whether it may pull out onto a lane: no body within its standstill gap ahead, nobody beside it or within their standstill gap behind, and everyone coming up behind at least the critical gap away. Where its body would stand in a conflict zone, the same must hold on the other lane, measured to that lane's zone entry and exit, so a car leaving a bay at a fork does not land on someone taking the other branch. Kerbs and bays use it.
Signals
A vsignal is a fixed-time plan of green, amber and red. Its line is a stop line on every lane it crosses. On red, every vehicle short of the line treats it as a stopped leader. On amber, each vehicle decides once whether it can stop at comfortable braking: it stops if is no more than its distance to the line, and goes through otherwise. That choice holds until the vehicle is past the line or the next green. A driver who chose to go is not stopped by the red that follows.
Lane changes
A vehicle on a lane with a left or right neighbour weighs a change by MOBIL every step. Lane changes are instant on the model; the drawn body slides across at 1.5 m/s. A change is safe when the gap to the new leader and from the new follower are both at least 1 m, and the new follower would brake no harder than 4 m/s². A voluntary change also needs
where is acceleration now and after the change, for the changer , its new follower and its old follower . Politeness is 0.3 and the threshold is 0.2 m/s². Both sides use the vehicles and holds ahead. A slow car with nobody ahead still moves over for a faster one behind it, through the politeness term. There are 4 s between one vehicle's voluntary changes. A vehicle does not change lanes while filtering, or while crossing a junction where it gave way. A voluntary change is taken only to a lane whose route goes on without another change.
When the route itself changes to a neighbour, the change is forced within 60 m of the lane's end. It is taken as soon as it is safe, with no gain needed and no wait between changes. Until then, the vehicle stops at the end of the lane.
Motorcycle filtering
On a lane wider than 3.2 m, a motorcycle passes cars that are slower than 2 m/s, or already beside it, instead of following them. A car on a lane further along the route is passed only once its rear is on that lane, so a motorcycle on a narrow lane does not run into a car just turning onto a wide one. It is filtering while its body overlaps a car's. It keeps filtering until no car's front is within 2 m behind its rear. While filtering, it rides at most 4 m/s on a line 0.5 m inside the lane edge, on the right neighbour's side, or the left one's if only that exists, else the right. Cars and bicycles do not follow a filtering motorcycle. Other motorcycles do, so they filter in single file. Stops, holds and junctions apply as usual, so a filtering motorcycle waits at the stop line beside the first car. Where its wide lane runs onto a narrow one, it stops at the end of the wide lane until it is no longer beside a car, then follows on, so it never cuts in just ahead of one.
Spawning and leaving
A source accrues rate_per_min / 60 vehicles per second, up to a backlog of 20. It emits one when at least one is due and its entry is clear: no vehicle's front in the 8 m behind the source point, and no vehicle's rear within 6.5 m ahead of it (the longest body plus 2 m). Vehicles on the lanes leading onto the source lane, or on the lanes it runs onto, count by where they stand in the source lane's distance, so one about to drive past the source point, or one just past the end of a short source lane, blocks the entry too. It then draws, in order, the mode from mix (modes the lane does not allow are skipped), the target from targets (a sink, a kerb or a lot; those that do not take the mode are skipped), the people aboard, and the pace. A mode with no route to that target is dropped and not retried. The new vehicle's rear is on the source point. Its speed is its desired speed, or the speed of the first vehicle ahead along its route if that is lower.
A vehicle is removed, and counted as arrived, when its front passes its sink on the last lane of its route. One bound for a kerb or lot gets a sink when it pulls out (see below).
A vehicle's delay is the time it loses against driving at its desired speed: each step in the stream adds , with the lane limit capped by the mode's top speed, times its pace. Steps spent crawling into or out of a bay, at gate service, or standing in a bay add nothing. The mean delay over vehicles that reached a sink is reported.
Kerbs and parking
A kerb (dropoff) is a stretch beside one lane, split into equal bays, bay 0 at the downstream end. A lot (parking) is a set of bays off an entry lane, each with a mouth on the entry lane and on the exit lane. Each bay holds one vehicle. A bay's state is not stored. Each step it is read off the vehicles that hold it, so a bay is free as soon as its vehicle has pulled out.
A vehicle bound for a kerb or lot drives as usual until it has a bay. Without one it stops at the head of the queue: for a kerb, with its front at the kerb's upstream end; for a lot, at the gate, 6 m before the first bay mouth (or the start of the entry lane). Everyone behind queues behind it as usual, back up the route. Each step, waiting vehicles are taken nearest first:
- at a kerb, a vehicle gets the free bay furthest downstream that it can still stop for at comfortable braking (bay front at least ahead);
- at a lot without a gate (
gate_s0), it gets the free bay whose mouth is nearest along the entry lane among those it can still stop for; - at a lot with a gate, only a vehicle at rest within 1 m of the gate, while nobody else is being served, gets a bay. It then stands
gate_sseconds before driving on. The gate is a single server.
A vehicle with a bay drives to it and stops with its front at the bay mouth (the bay front for a kerb). It then crawls in at 1.5 m/s, for at least 1 s, over the distance from the lane to the bay middle. It stays on the lane while crawling, so traffic behind waits. Once in, it leaves the stream. At a kerb or lot linked to a portal, it stands until its people are done with it (see Coupling with walkers), and a pick-up stands at most pickup_s. Without a portal, a kerb stand lasts dwell_s and a parked vehicle stays park_s. When the time is up, it waits in the bay until it may pull out at the bay's exit mouth, and until no crossing hold lies across the lane between its rear and a standstill gap ahead of the mouth, then crawls out on the lane, back to its body's place on the lane, and drives to the quickest sink from there. A vehicle that is more than 1 m past the head of its queue without a bay (the kerb's start or the gate; for example after a patch moves them) gives up and drives to the quickest sink instead.
A kerb is spilling back while any vehicle queued for it, still without a bay, has its rear behind the start of the kerb's lane. The share of the run spent spilling, the mean stand (from the start of the crawl in to pulling out), a lot's mean bay search (from the end of gate service, or from getting a bay at a lot with no gate, to being parked) and its occupancy are reported (see outputs).
Coupling with walkers
A kerb or lot with a portal hands its vehicles' people to the walkers. Queueing, docking and pulling out are as above; only the end of the stand changes.
- Getting out. When a vehicle docks there, its occupants step out of the portal one after another, as soon as each has clear floor: the first anywhere in the portal, the rest beside the first, as one walking group. While the portal has no clear floor, the rest try again every 0.5 s. Each walker knows the vehicle it came in and its mode. A vehicle at a kerb stands until the last is out, then 3 s more (
BOARD_S) before it may pull out. A parked vehicle stands until its people come back. - Coming back to a parked car. People out of a parked vehicle walk to the portal their target names. On reaching it they leave the floor; the party is counted there. When the first of them has been gone that portal's
stay_s, they all step out of the same portal as one group again and walk back to the lot's portal. The car is released once every one of them has reached it, and pulls out 3 s later. - Pick-up. People set down at a kerb come back the same way after their stay, but walk to the kerb's portal and wait there for a pick-up. So do walkers from a portal whose
mode_sharedrew pick-up. The first of a group to arrive calls a vehicle: the kerb's first mode of car, motorcycle, bicycle; from a running source (rate_per_minabove 0) that reaches the kerb in that mode, drawn by source rate. It joins the road as soon as that source's entry is clear, ahead of the source's own vehicles, drives to the kerb and takes a bay like any other. Everyone waiting for it gets in once it is docked, and it leaves 3 s after the last. If it gives up (itspickup_sruns out, or it misses the kerb), whoever is still waiting calls another. If no running source can reach the kerb, they leave on foot from the portal. - Departing visitors. A portal with
mode_sharesends each walker it spawns, by weight, to walk off as drawn fromtargets, to a lot portal to drive off in a car parked before the run, or to a kerb portal for a pick-up. Lots and kerbs are drawn by bay count. A car parked before the run is not a vehicle in the lot: the walker just leaves at the lot's portal.
A vehicle whose people are all gone without coming back (for instance after a patch retargets them) is released in the same way. Without a portal the timers stay.
Crossings
A crossing that lists lanes stops vehicles on those lanes for walkers. Each named lane crosses it over a stretch, from where its centreline enters the polygon to where it leaves. A crossing holds its lanes when any walker is on it, or is walking (faster than 0.3 m/s) toward it, not held at the curb, with its path stepping onto it within 1.5 m. A signalled crossing also holds them from 3 s before walk shows until walk ends, so the box is clear when walkers step off the curb. A hold is a stopped leader at the stretch's entry: vehicles brake for it as for a stopped car, and one already past the entry drives on.
A crossing with lanes and no signal timing (none of green_s, flash_s, red_s) is a zebra. Walkers have priority on it, but step on only when every vehicle coming toward it on its lanes could stop: no vehicle's body is on the stretch, and each one coming has
where is the distance from its front to the stretch's entry and its mode's comfortable braking. Otherwise they wait at the curb as at a red signal (see behaviours). Once someone is on, the hold stops every vehicle that can still stop, and the stretch is clear of bodies by the rule above. A busy zebra can hold its lanes for a long time.
Crossings without lanes affect walkers only.
Determinism
A walker's mode_share draw, and the lot or kerb it is sent to, come from the walkers' generator; a called pick-up's source comes from the vehicles'. Vehicles draw from their own generator, the same LCG as the walkers, seeded from the scenario seed. Adding vehicles does not shift the walkers' random stream, and the same seed gives the same vehicles. Every vehicle has an id that is unique for the run and does not change, so a host can match a vehicle across frames.