question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Displaced lane support in traffic light simulation

See original GitHub issue

Note - This issue has been completely rewritten, and so some comments before 27-March-2022 may be outdated and irrelevant. A more extensive discussion of this issue can be found at https://github.com/CitiesSkylinesMods/TMPE/discussions/1428

Description

Detect lanes that run in a nonstandard direction, and use them as a basis for traffic light grouping.

There are three use cases already identified for displaced lanes: Continuous Flow Intersections and Turnaround Lanes (both pictured below), and also Contraflow Interchanges. Diverging Diamond Interchanges are not an example of displaced lanes, because they involve only lane reversal, not a complex mixture of lane directions.

Entry into and exit from displaced lanes needs separate traffic light regulation for these scenarios:

  • In advance of a Continuous Flow Intersection, traffic crossing over into the displaced far turn lane needs separate control from traffic remaining in standard lanes. This divides forward-moving traffic among multiple lights.
  • After a Continuous Flow Intersection, traffic going straight starts out displaced and crosses back to the standard side, for which it needs separate control from the near-turn slip lane. This divides forward-moving traffic among multiple lights.
  • At an intersection with a turnaround lane, the turns into and out of the displaced (turnaround) lane need separate control from the standard far turns. This divides “far”-turning traffic among multiple lights.

A theoretical condition exists where near-turning traffic turns into or out of a displaced lane. However, there seem to be no real-world use cases for this, so it is being omitted to avoid strange traffic light groupings that would be difficult to represent clearly in the UI.

Definitions

Forward Lane - A lane for which the value of Lane.m_direction is Forward, Both, or AvoidBackward. This is represented in the asset editor by the Direction field.

Backward Lane - A lane for which the value of Lane.m_direction is Backward, Both, or AvoidForward. This is represented in the asset editor by the Direction field.

Standard Road - A road that is either one-way or that has exactly two sets of lanes, one forward and the other backward. Forward and backward may be reversed, and for the purposes of lane displacement that is still a standard road.

Complex Road - A road that has three or more sets of lanes in alternating directions.

Standard Lane - Any lane on a Standard Road. On a complex road, any lane that exists in the standard position in relation to opposing traffic. If there is only one set of lanes going in a given direction, they are always Standard lanes.

Displaced Lane - On a complex road, any lane that exists in a nonstandard position in relation to opposing traffic, when other lanes going the same direction are in the standard position. If there is only one set of lanes going in a given direction, they are never Displaced Lanes.

Cross Left - A traffic light lane grouping for forward-moving traffic that crosses into a displaced lane (out of a displaced lane in LHT).

Cross Right - A traffic light lane grouping for forward-moving traffic that crosses out of a displaced lane (into a displaced lane in LHT).

Forward Displaced - A traffic light lane grouping for forward-moving traffic that is in a displaced lane both before and after the node.

Turn Into Displaced - A traffic light lane grouping for far-turning traffic that enters a displaced lane.

Turn Out of Displaced – A traffic light lane grouping for far-turning traffic that leaves a displaced lane.

Examples

Continuous Flow Intersection

Sometimes called a Displaced Left Turn image

Turnaround Lane

A slip lane that connects pairs of one-way roads to facilitate U-turns image

Displaced Lane Identification

Conceptually, lane displacement is based on identifying sets of lanes that run in opposing directions, and that is how they are described here and covered in unit tests. The implementation will be mathematical.

One-way and simple two-way roads

If only one or two sets of lanes exist, they are always Standard Lanes, even if they are reversed as in the case of a Diverging Diamond Interchange.

Roads with three sets of lanes in alternating directions

In this scenario, one direction will have two sets of lanes, and the other direction will have only one. In the direction with two sets of lanes, the set that is in a nonstandard position in relation to opposing traffic are considered displaced lanes.

Roads with four sets of lanes in alternating directions.

In this scenario, each direction has two distinct sets of lanes. They may be configured in one of two ways:

  • If the outer lanes run in the standard direction (i.e., in the asset editor the leftmost lane is backward and the rightmost lane is forward), then the two inner sets of lanes are displaced. This is the configuration for a standard Continuous Flow Intersection.
  • If the outer lanes run in the reverse direction (i.e., in the asset editor the leftmost lane is forward and the rightmost lane is backward), then the two outer sets of lanes are displaced. This is the configuration for Turnaround Lanes.

More than four sets of lanes

This implementation will not support more than four sets of lanes on a single prefab.

Traffic Light Grouping

Traffic light grouping for displaced lanes will be based on the Lane Connector tool. This is based on the assumption that this type of intersection always involves the intentional assignment of lane connections. In the future, we could explore basing these lane groupings on the traffic AI’s default behavior in the absence of explicit lane connections.

The traffic light simulation will attempt to eliminate groupings based on displaced lanes when they do not represent a distinct movement. For example, at the central node of a Continuous Flow Intersection, the left turns are Turn Out of Displaced, but since this applies to all of the left-turning lanes on a segment, the distinct grouping would not add functionality but would only make the UI more confusing.

Lane Transitions

At a node where the Lane Connector tool has not been used, lane transitions between displaced and non-displaced lanes will be disallowed for all vehicle types when the node has only two segments AND the segments have matching displaced lane layouts. The number of lanes does not have to match, only the overall pattern of standard and displaced lanes.

Graphics

CrossLeft, CrossRight image image

TurnOutOfDisplaced (RHT, LHT) image image

TurnIntoDisplaced (RHT, LHT) image image

ForwardDisplaced (RHT, LHT) image image

Tasks

  • NetInfo extensions
    • Displaced lane detection
  • LaneConnectionManager
    • Raise an event when connections on a lane end change.
    • Raise an event when the lane connection feature is enabled/disabled.
  • Identification and flagging of lane connections involving displaced lanes, in LaneEndManager. Also listens for LaneConnectionManager events to reset its cached data.
  • Removal of unmaintainable and unused public traffic light API. This needs a rollout plan in case there are unknown/surprise dependencies.
  • CustomSegmentLights groups lights by both ExtVehicleInfo and NetLaneFlags. Displacement-based groupings are folded into the main group if they don’t conflict.
  • Tool enhancements:
    • Show infosigns for displaced lane connections
    • When displaced lane lights have the same vehicle types as the main light, hide the vehicle type infosigns.
  • Persistence
    • Merge from xml-persistence branch
    • Rework CustomSegmentLightModel to include NetLaneFlags
  • LaneConnectionManager
    • Allow LaneConnectionManager to be queried during load regardless of enabled state
  • TTL Copy/Paste
  • RoutingManager
  • Lane Connector stay-in-lane
    • Try to be smart about crossovers
  • TTL Quick Setup
    • Continuous Flow Intersection
      • Two-way node with inner displaced lanes on one segment
      • Three- or four-way node with inner displaced lanes on one or more segments
    • Contraflow Interchange
      • To be addressed separately
    • Diamond Interchange with Turnaround Lane
      • To be addressed separately

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
Elesbaan70commented, Feb 13, 2022

I have added definitions for Position, Forward Lane, and Backward Lane.

1reaction
krzychu124commented, Feb 13, 2022

I would create at least simplified version of overlaymanager mentioned in other issue. Btw, I’ve been experimenting with animated shader texture (scrollable texture that follows shape of path) to display custom animated thingy as we see entering into traffic routes view (or via Traffic Report mod)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Traffic simulation of continuous flow intersection with ...
An innovative solution of continuous flow intersection with displaced left turn was implemented to alleviate congestion and high vehicle delay.
Read more >
(PDF) Traffic simulation of continuous flow intersection with ...
An innovative solution of continuous flow intersection with displaced left turn was implemented to alleviate congestion and high vehicle delay. The displaced ......
Read more >
Evaluation of Sign and Marking Alternatives for Displaced Left ...
Two-phase signals are enabled by having left-turning traffic cross over opposing lanes to the left side of the roadway in advance of the...
Read more >
Modeling the Case of Split-Phase for Two Displaced T ...
This case study shows an intersection with offset approaches. The traffic signal operates on one controller, providing a split-phase scheme that prevents ...
Read more >
DISPLACED LEFT TURN INTERSECTION
The left-turn movements for the minor road continue to take place at the main intersection. There are five junctions with traffic signal control...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found