Class TrafficLightUtil
java.lang.Object
org.opentrafficsim.road.gtu.tactical.util.TrafficLightUtil
Static methods regarding traffic lights for composition in tactical planners.
Copyright (c) 2013-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Wouter Schakel
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ParameterTypeAccelerationMaximum deceleration for stopping for yellow traffic light.static final ParameterTypeLengthCar-following stopping distance. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.djunits.value.vdouble.scalar.AccelerationrespondToTrafficLight(TacticalContextEgo context, PerceivedTrafficLight headwayTrafficLight) Returns an acceleration as response to a traffic light, being positive infinity if ignored.static org.djunits.value.vdouble.scalar.AccelerationrespondToTrafficLights(TacticalContextEgo context, RelativeLane lane, org.djunits.value.vdouble.scalar.Length mergeDistance, boolean onRoute) Returns an acceleration as response to a set of traffic lights, being positive infinity if ignored.
-
Field Details
-
BCRIT
Maximum deceleration for stopping for yellow traffic light. -
S0
Car-following stopping distance.
-
-
Method Details
-
respondToTrafficLights
public static org.djunits.value.vdouble.scalar.Acceleration respondToTrafficLights(TacticalContextEgo context, RelativeLane lane, org.djunits.value.vdouble.scalar.Length mergeDistance, boolean onRoute) throws ParameterException, OperationalPlanException Returns an acceleration as response to a set of traffic lights, being positive infinity if ignored. The response is governed by the car-following model in case a traffic light is yellow or red. A constant deceleration to stop is also calculated, and the highest acceleration of both is used. If this value is below -bYellow (B_YELLOW), the traffic light is ignored, which usually occurs only during the yellow phase. By using the highest acceleration of the car-following model and the constant deceleration, it is ensured that comfortable deceleration is applied if approaching a red traffic light from far away, while strong deceleration is only applied if required and appropriately represents stopping for yellow.- Parameters:
context- tactical information such as parameters and car-following modellane- lanemergeDistance- distance along which no lane changes can be performed towards the laneonRoute- filter conflicts to only include conflict on the route- Returns:
- acceleration as response to a traffic light, being positive infinity if ignored
- Throws:
ParameterException- if a parameter is not definedOperationalPlanException- if intersection perception category does not existNullPointerException- if any input isnullIllegalArgumentException- if the traffic light is not downstream
-
respondToTrafficLight
public static org.djunits.value.vdouble.scalar.Acceleration respondToTrafficLight(TacticalContextEgo context, PerceivedTrafficLight headwayTrafficLight) throws ParameterException Returns an acceleration as response to a traffic light, being positive infinity if ignored. The response is governed by the car-following model in case the traffic light is yellow or red. A constant deceleration to stop is also calculated, and the highest acceleration of both is used. If this value is below -bYellow (B_YELLOW), the traffic light is ignored, which usually occurs only during the yellow phase. By using the highest acceleration of the car-following model and the constant deceleration, it is ensured that comfortable deceleration is applied if approaching a red traffic light from far away, while strong deceleration is only applied if required and appropriately represents stopping for yellow.- Parameters:
context- tactical information such as parameters and car-following modelheadwayTrafficLight- headway traffic light- Returns:
- acceleration as response to a traffic light, being positive infinity if ignored
- Throws:
ParameterException- if a parameter is not definedNullPointerException- if any input isnullIllegalArgumentException- if the traffic light is not downstream
-