Class AbstractLaneBasedTacticalPlanner
java.lang.Object
org.opentrafficsim.road.gtu.lane.tactical.AbstractLaneBasedTacticalPlanner
- All Implemented Interfaces:
Serializable
,TacticalPlanner<LaneBasedGtu,
,LanePerception> LaneBasedTacticalPlanner
- Direct Known Subclasses:
AbstractIncentivesTacticalPlanner
,LaneBasedCfLcTacticalPlanner
,LaneBasedGtuFollowingTacticalPlanner
,Toledo
public abstract class AbstractLaneBasedTacticalPlanner
extends Object
implements LaneBasedTacticalPlanner, Serializable
A lane-based tactical planner generates an operational plan for the lane-based GTU. It can ask the strategic planner for
assistance on the route to take when the network splits. This abstract class contains a number of helper methods that make it
easy to implement a tactical planner.
Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final org.opentrafficsim.base.parameters.ParameterTypeDuration
Time step parameter type.protected static final org.opentrafficsim.base.parameters.ParameterTypeLength
Look ahead parameter type.static final org.opentrafficsim.base.parameters.ParameterTypeClass<LaneBasedTacticalPlanner>
Tactical planner parameter. -
Constructor Summary
ConstructorDescriptionAbstractLaneBasedTacticalPlanner
(CarFollowingModel carFollowingModel, LaneBasedGtu gtu, LanePerception lanePerception) Instantiates a tactical planner. -
Method Summary
Modifier and TypeMethodDescriptionstatic LanePathInfo
buildLanePathInfo
(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxHeadway) Build a list of lanes forward, with a maximum headway relative to the reference point of the GTU.static LanePathInfo
buildLanePathInfo
(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxHeadway, Lane startLane, org.djunits.value.vdouble.scalar.Length position) Build a list of lanes forward, with a maximum headway relative to the reference point of the GTU.buildLinkListForward
(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxHeadway) Make a list of links on which to drive next, with a maximum headway relative to the reference point of the GTU.static OtsLine2d
concatenateNull
(OtsLine2d path, OtsLine2d centerLine) Concatenate two paths, where the first may benull
.protected static boolean
connectsToPath
(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxHeadway, Lane startLane, org.djunits.value.vdouble.scalar.Length startLanePosition, Link linkAfterSplit) Determine whether the lane is directly connected to our route, in other words: if we would (continue to) drive on the given lane, can we take the right branch at the nextSplitNode without switching lanes?static NextSplitInfo
determineNextSplit
(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxHeadway) Calculate the next location where the network splits, with a maximum headway relative to the reference point of the GTU.final CarFollowingModel
Returns the car-following model.final LaneBasedGtu
getGtu()
final LanePerception
protected static boolean
noLaneDrop
(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxHeadway, Lane startLane, org.djunits.value.vdouble.scalar.Length startLanePosition) Determine whether the lane does not drop, in other words: if we would (continue to) drive on the given lane, can we continue to drive at the nextSplitNode without switching lanes?final void
setCarFollowingModel
(CarFollowingModel carFollowingModel) Sets the car-following model.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opentrafficsim.road.gtu.lane.tactical.LaneBasedTacticalPlanner
chooseLaneAtSplit, okDistance
Methods inherited from interface org.opentrafficsim.core.gtu.plan.tactical.TacticalPlanner
generateOperationalPlan
-
Field Details
-
TACTICAL_PLANNER
public static final org.opentrafficsim.base.parameters.ParameterTypeClass<LaneBasedTacticalPlanner> TACTICAL_PLANNERTactical planner parameter. -
LOOKAHEAD
protected static final org.opentrafficsim.base.parameters.ParameterTypeLength LOOKAHEADLook ahead parameter type. -
DT
protected static final org.opentrafficsim.base.parameters.ParameterTypeDuration DTTime step parameter type.
-
-
Constructor Details
-
AbstractLaneBasedTacticalPlanner
public AbstractLaneBasedTacticalPlanner(CarFollowingModel carFollowingModel, LaneBasedGtu gtu, LanePerception lanePerception) Instantiates a tactical planner.- Parameters:
carFollowingModel
- CarFollowingModel; car-following modelgtu
- LaneBasedGtu; GTUlanePerception
- LanePerception; perception
-
-
Method Details
-
getGtu
- Specified by:
getGtu
in interfaceTacticalPlanner<LaneBasedGtu,
LanePerception>
-
buildLanePathInfo
public static LanePathInfo buildLanePathInfo(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxHeadway) throws GtuException, NetworkException Build a list of lanes forward, with a maximum headway relative to the reference point of the GTU.- Parameters:
gtu
- LaneBasedGtu; the GTU for which to calculate the lane listmaxHeadway
- Length; the maximum length for which lanes should be returned- Returns:
- LanePathInfo; an instance that provides the following information for an operational plan: the lanes to follow, and the path to follow when staying on the same lane.
- Throws:
GtuException
- when the vehicle is not on one of the lanes on which it is registeredNetworkException
- when the strategic planner is not able to return a next node in the route
-
buildLanePathInfo
public static LanePathInfo buildLanePathInfo(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxHeadway, Lane startLane, org.djunits.value.vdouble.scalar.Length position) throws GtuException, NetworkException Build a list of lanes forward, with a maximum headway relative to the reference point of the GTU.- Parameters:
gtu
- LaneBasedGtu; the GTU for which to calculate the lane listmaxHeadway
- Length; the maximum length for which lanes should be returnedstartLane
- Lane; the lane in which the path startsposition
- Length; the position on the start lane- Returns:
- LanePathInfo; an instance that provides the following information for an operational plan: the lanes to follow, and the path to follow when staying on the same lane.
- Throws:
GtuException
- when the vehicle is not on one of the lanes on which it is registeredNetworkException
- when the strategic planner is not able to return a next node in the routeGtuException
- when the vehicle is not on one of the lanes on which it is registeredNetworkException
- when the strategic planner is not able to return a next node in the route
-
concatenateNull
public static OtsLine2d concatenateNull(OtsLine2d path, OtsLine2d centerLine) throws OtsGeometryException Concatenate two paths, where the first may benull
.- Parameters:
path
- OtsLine2d; path, may benull
centerLine
- OtsLine2d; center line of lane to add- Returns:
- concatenated line
- Throws:
OtsGeometryException
- when lines are degenerate or too distant
-
determineNextSplit
public static NextSplitInfo determineNextSplit(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxHeadway) throws GtuException, NetworkException Calculate the next location where the network splits, with a maximum headway relative to the reference point of the GTU. Note: a lane drop is also considered a split (!).- Parameters:
gtu
- LaneBasedGtu; the GTU for which to calculate the lane listmaxHeadway
- Length; the maximum length for which lanes should be returned- Returns:
- NextSplitInfo; an instance that provides the following information for an operational plan: whether the network splits, the node where it splits, and the current lanes that lead to the right node after the split node.
- Throws:
GtuException
- when the vehicle is not on one of the lanes on which it is registeredNetworkException
- when the strategic planner is not able to return a next node in the route
-
connectsToPath
protected static boolean connectsToPath(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxHeadway, Lane startLane, org.djunits.value.vdouble.scalar.Length startLanePosition, Link linkAfterSplit) throws GtuException, NetworkException Determine whether the lane is directly connected to our route, in other words: if we would (continue to) drive on the given lane, can we take the right branch at the nextSplitNode without switching lanes?- Parameters:
gtu
- LaneBasedGtu; the GTU for which we have to determine the lane suitabilitymaxHeadway
- Length; the maximum length for use in the calculationstartLane
- Lane; the first lane in the liststartLanePosition
- Length; the position on the start lanelinkAfterSplit
- Link; the link after the split to which we should connect- Returns:
- boolean; true if the lane (XXXXX which lane?) is connected to our path
- Throws:
GtuException
- when the vehicle is not on one of the lanes on which it is registeredNetworkException
- when the strategic planner is not able to return a next node in the route
-
noLaneDrop
protected static boolean noLaneDrop(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxHeadway, Lane startLane, org.djunits.value.vdouble.scalar.Length startLanePosition) throws GtuException, NetworkException Determine whether the lane does not drop, in other words: if we would (continue to) drive on the given lane, can we continue to drive at the nextSplitNode without switching lanes?- Parameters:
gtu
- LaneBasedGtu; the GTU for which we have to determine the lane suitabilitymaxHeadway
- Length; the maximum length for use in the calculationstartLane
- Lane; the first lane in the liststartLanePosition
- Length; the position on the start lane- Returns:
- boolean; true if the lane (XXX which lane?) is connected to our path
- Throws:
GtuException
- when the vehicle is not on one of the lanes on which it is registeredNetworkException
- when the strategic planner is not able to return a next node in the route
-
buildLinkListForward
protected static List<Link> buildLinkListForward(LaneBasedGtu gtu, org.djunits.value.vdouble.scalar.Length maxHeadway) throws GtuException, NetworkException Make a list of links on which to drive next, with a maximum headway relative to the reference point of the GTU.- Parameters:
gtu
- LaneBasedGtu; the GTU for which to calculate the link listmaxHeadway
- Length; the maximum length for which links should be returned- Returns:
- List<Link>; a list of links on which to drive next
- Throws:
GtuException
- when the vehicle is not on one of the lanes on which it is registeredNetworkException
- when the strategic planner is not able to return a next node in the route
-
getCarFollowingModel
Returns the car-following model.- Specified by:
getCarFollowingModel
in interfaceLaneBasedTacticalPlanner
- Returns:
- car following model
-
setCarFollowingModel
Sets the car-following model.- Parameters:
carFollowingModel
- CarFollowingModel; Car-following model to set.
-
getPerception
- Specified by:
getPerception
in interfaceTacticalPlanner<LaneBasedGtu,
LanePerception>
-