Class LaneBasedGtu
- All Implemented Interfaces:
Serializable
,Remote
,nl.tudelft.simulation.dsol.animation.Locatable
,org.djutils.base.Identifiable
,org.djutils.event.EventProducer
,org.opentrafficsim.base.geometry.OtsLocatable
,org.opentrafficsim.base.HierarchicallyTyped<GtuType,
,Gtu> Drawable
,DynamicSpatialObject
,SpatialObject
The starting point of a LaneBasedTU is that it can be in multiple lanes at the same time. This can be due to a lane change (lateral), or due to crossing a link (front of the GTU is on another Lane than rear of the GTU). If a Lane is shorter than the length of the GTU (e.g. when we do node expansion on a crossing, this is very well possible), a GTU could occupy dozens of Lanes at the same time.
When calculating a headway, the GTU has to look in successive lanes. When Lanes (or underlying CrossSectionLinks) diverge, the headway algorithms have to look at multiple Lanes and return the minimum headway in each of the Lanes. When the Lanes (or underlying CrossSectionLinks) converge, "parallel" traffic is not taken into account in the headway calculation. Instead, gap acceptance algorithms or their equivalent should guide the merging behavior.
To decide its movement, an AbstractLaneBasedGtu applies its car following algorithm and lane change algorithm to set the acceleration and any lane change operation to perform. It then schedules the triggers that will add it to subsequent lanes and remove it from current lanes as needed during the time step that is has committed to. Finally, it re-schedules its next movement evaluation with the simulator.
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 TypeFieldDescriptionstatic int
cached position count.static boolean
Caching on or off.static org.djunits.value.vdouble.scalar.Length
Margin to add to plan to check of the path will enter the next section.static org.djunits.value.vdouble.scalar.Length
The threshold distance for differences between initial locations of the GTU on different lanes.static org.djutils.event.EventType
The event type for pub/sub indicating that the GTU change lane.static org.djutils.event.EventType
The event type for pub/sub indicating that the GTU entered a new lane (with the FRONT position if driving forward; REAR if driving backward).static org.djutils.event.EventType
The event type for pub/sub indicating that the GTU exited a lane (with the REAR position if driving forward; FRONT if driving backward).static org.djutils.event.EventType
The lane-based event type for pub/sub indicating destruction of the GTU.static org.djutils.event.EventType
The lane-based event type for pub/sub indicating a move.static int
cached position count.Fields inherited from class org.opentrafficsim.core.gtu.Gtu
ALIGN_COUNT, ALIGNED, DESTROY_EVENT, MOVE_EVENT
Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITION
-
Constructor Summary
ConstructorDescriptionLaneBasedGtu
(String id, GtuType gtuType, org.djunits.value.vdouble.scalar.Length length, org.djunits.value.vdouble.scalar.Length width, org.djunits.value.vdouble.scalar.Speed maximumSpeed, org.djunits.value.vdouble.scalar.Length front, RoadNetwork network) Construct a Lane Based GTU. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addTrigger
(Lane lane, nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<org.djunits.value.vdouble.scalar.Duration> event) Add an event to the list of lane triggers scheduled for this GTU.void
changeLaneInstantaneously
(LateralDirectionality laneChangeDirection) Change lanes instantaneously.void
destroy()
protected void
Appends a new cross-section at the downstream end.protected void
finalizeLaneChange
(LateralDirectionality laneChangeDirection) Performs the finalization of a lane change by leaving the from lanes.final double
fractionalPosition
(Lane lane, RelativePosition relativePosition) Return the longitudinal position of a point relative to this GTU, relative to the center line of the Lane, as a fraction of the length of the lane.final double
fractionalPosition
(Lane lane, RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time when) Return the longitudinal position of a point relative to this GTU, relative to the center line of the Lane, as a fraction of the length of the lane.fractionalPositions
(RelativePosition relativePosition) Return the longitudinal positions of a point relative to this GTU, relative to the center line of the Lanes in which the vehicle is registered, as fractions of the length of the lane.fractionalPositions
(RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time when) Return the longitudinal positions of a point relative to this GTU, relative to the center line of the Lanes in which the vehicle is registered, as fractions of the length of the lane.org.djunits.value.vdouble.scalar.Acceleration
This method returns the current car-following acceleration of the GTU.org.djunits.value.vdouble.scalar.Speed
This method returns the current desired speed of the GTU.org.djunits.value.vdouble.scalar.Length
getLateralPosition
(Lane lane) Returns the lateral position of the GTU relative to the lane center line.final Lane
getNextLaneForRoute
(Lane lane) Returns the next lane for a given lane to stay on the route.getNextLanesForRoute
(Lane lane) Returns a set ofLane
s that can be followed considering the route.org.djunits.value.vdouble.scalar.Length
getProjectedLength
(Lane lane) Get projected length on the lane.Return the current Lane, position and directionality of the GTU.getStrategicalPlanner
(org.djunits.value.vdouble.scalar.Time time) getTacticalPlanner
(org.djunits.value.vdouble.scalar.Time time) final TurnIndicatorStatus
final TurnIndicatorStatus
getTurnIndicatorStatus
(org.djunits.value.vdouble.scalar.Time time) Returns the vehicle model.void
init
(LaneBasedStrategicalPlanner strategicalPlanner, LanePosition longitudinalPosition, org.djunits.value.vdouble.scalar.Speed initialSpeed) void
initLaneChange
(LateralDirectionality laneChangeDirection) Register on lanes in target lane.boolean
The default implementation returnstrue
if the deceleration is larger than a speed-dependent threshold given by:
c0 * g(v) + c1 + c3*v^2
where c0 = 0.2, c1 = 0.15 and c3 = 0.00025 (with c2 = 0 implicit) are empirically derived averages, and g(v) is 0 below 25 km/h or 1 otherwise, representing that the engine is disengaged at low speeds.boolean
isBrakingLightsOn
(org.djunits.value.vdouble.scalar.Time when) The default implementation returnstrue
if the deceleration is larger than a speed-dependent threshold given by:
c0 * g(v) + c1 + c3*v^2
where c0 = 0.2, c1 = 0.15 and c3 = 0.00025 (with c2 = 0 implicit) are empirically derived averages, and g(v) is 0 below 25 km/h or 1 otherwise, representing that the engine is disengaged at low speeds.boolean
Returns whether the GTU perform lane changes instantaneously or not.final boolean
Returns whether a lane change is allowed.protected void
Removes registration between the GTU and the lanes in the most upstream cross-section.protected boolean
move
(org.djutils.draw.point.OrientedPoint2d fromLocation) final org.djunits.value.vdouble.scalar.Length
position
(Lane lane, RelativePosition relativePosition) Return the longitudinal position of a point relative to this GTU, relative to the center line of the Lane at the current simulation time.org.djunits.value.vdouble.scalar.Length
position
(Lane lane, RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time when) Return the longitudinal position of a point relative to this GTU, relative to the center line of the Lane.positions
(RelativePosition relativePosition) Return the longitudinal positions of a point relative to this GTU, relative to the center line of the Lanes in which the vehicle is registered.positions
(RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time when) Return the longitudinal positions of a point relative to this GTU, relative to the center line of the Lanes in which the vehicle is registered.void
reinit
(LanePosition initialLongitudinalPosition) Reinitializes the GTU on the network using the existing strategical planner and zero speed.protected void
Checks whether the GTU will enter a next cross-section during the (remainder of) the tactical plan.protected void
Checks whether the GTU will leave a cross-section during the (remainder of) the tactical plan.protected void
scheduleTriggers
(Lane lane) Schedules all trigger events during the current operational plan on the lane.void
setFinalizeLaneChangeEvent
(nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<org.djunits.value.vdouble.scalar.Duration> event) Sets event to finalize lane change.void
setInstantaneousLaneChange
(boolean instantaneous) Sets whether the GTU perform lane changes instantaneously or not.final void
setNoLaneChangeDistance
(org.djunits.value.vdouble.scalar.Length distance) Set distance over which the GTU should not change lane after being created.void
All lanes the GTU is on will be left.final void
setTurnIndicatorStatus
(TurnIndicatorStatus turnIndicatorStatus) Set the status of the turn indicator.void
setVehicleModel
(VehicleModel vehicleModel) Sets a vehicle model.toString()
Methods inherited from class org.opentrafficsim.core.gtu.Gtu
addGtu, equals, getAcceleration, getAcceleration, getBounds, getCenter, getChildren, getContourPoints, getErrorHandler, getFront, getId, getLength, getLocation, getMaximumAcceleration, getMaximumDeceleration, getMaximumSpeed, getNextMoveEvent, getOdometer, getOdometer, getOperationalPlan, getOperationalPlan, getParameters, getParent, getPerceivableContext, getRear, getReference, getRelativePositions, getShape, getShape, getSimulator, getSpeed, getSpeed, getTag, getType, getWidth, hashCode, init, interruptMove, isDestroyed, removeGtu, setErrorHandler, setMaximumAcceleration, setMaximumDeceleration, setOperationalPlan, setParameters, setTag
Methods inherited from class org.djutils.event.LocalEventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventListenerMap, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opentrafficsim.core.DynamicSpatialObject
transformShape
Methods inherited from interface org.opentrafficsim.base.HierarchicallyTyped
isOfType
Methods inherited from interface nl.tudelft.simulation.dsol.animation.Locatable
getDirZ, getZ
-
Field Details
-
initialLocationThresholdDifference
public static org.djunits.value.vdouble.scalar.Length initialLocationThresholdDifferenceThe threshold distance for differences between initial locations of the GTU on different lanes. -
eventMargin
public static org.djunits.value.vdouble.scalar.Length eventMarginMargin to add to plan to check of the path will enter the next section. -
CACHING
public static boolean CACHINGCaching on or off. -
CACHED_POSITION
public static int CACHED_POSITIONcached position count. -
NON_CACHED_POSITION
public static int NON_CACHED_POSITIONcached position count. -
LANEBASED_MOVE_EVENT
public static org.djutils.event.EventType LANEBASED_MOVE_EVENTThe lane-based event type for pub/sub indicating a move.
Payload: [String gtuId, PositionVector currentPosition, Direction currentDirection, Speed speed, Acceleration acceleration, TurnIndicatorStatus turnIndicatorStatus, Length odometer, Link id of referenceLane, Lane id of referenceLane, Length positionOnReferenceLane] -
LANEBASED_DESTROY_EVENT
public static org.djutils.event.EventType LANEBASED_DESTROY_EVENTThe lane-based event type for pub/sub indicating destruction of the GTU.
Payload: [String gtuId, PositionVector finalPosition, Direction finalDirection, Length finalOdometer, Link referenceLink, Lane referenceLane, Length positionOnReferenceLane] -
LANE_ENTER_EVENT
public static org.djutils.event.EventType LANE_ENTER_EVENTThe event type for pub/sub indicating that the GTU entered a new lane (with the FRONT position if driving forward; REAR if driving backward).
Payload: [String gtuId, String link id, String lane id] -
LANE_EXIT_EVENT
public static org.djutils.event.EventType LANE_EXIT_EVENTThe event type for pub/sub indicating that the GTU exited a lane (with the REAR position if driving forward; FRONT if driving backward).
Payload: [String gtuId, String link id, String lane id] -
LANE_CHANGE_EVENT
public static org.djutils.event.EventType LANE_CHANGE_EVENTThe event type for pub/sub indicating that the GTU change lane.
Payload: [String gtuId, LateralDirectionality direction, String fromLaneId, Length position]
-
-
Constructor Details
-
LaneBasedGtu
public LaneBasedGtu(String id, GtuType gtuType, org.djunits.value.vdouble.scalar.Length length, org.djunits.value.vdouble.scalar.Length width, org.djunits.value.vdouble.scalar.Speed maximumSpeed, org.djunits.value.vdouble.scalar.Length front, RoadNetwork network) throws GtuException Construct a Lane Based GTU.- Parameters:
id
- String; the id of the GTUgtuType
- GtuType; the type of GTU, e.g. TruckType, CarType, BusTypelength
- Length; the maximum length of the GTU (parallel with driving direction)width
- Length; the maximum width of the GTU (perpendicular to driving direction)maximumSpeed
- Speed;the maximum speed of the GTU (in the driving direction)front
- Length; front distance relative to the reference positionnetwork
- RoadNetwork; the network that the GTU is initially registered in- Throws:
GtuException
- when initial values are not correct
-
-
Method Details
-
init
public void init(LaneBasedStrategicalPlanner strategicalPlanner, LanePosition longitudinalPosition, org.djunits.value.vdouble.scalar.Speed initialSpeed) throws NetworkException, nl.tudelft.simulation.dsol.SimRuntimeException, GtuException, OtsGeometryException - Parameters:
strategicalPlanner
- LaneBasedStrategicalPlanner; the strategical planner (e.g., route determination) to uselongitudinalPosition
- LanePosition; the initial position of the GTUinitialSpeed
- Speed; the initial speed of the car on the lane- Throws:
NetworkException
- when the GTU cannot be placed on the given lanenl.tudelft.simulation.dsol.SimRuntimeException
- when the move method cannot be scheduledGtuException
- when initial values are not correctOtsGeometryException
- when the initial path is wrong
-
setParent
All lanes the GTU is on will be left.- Overrides:
setParent
in classGtu
- Throws:
GtuException
-
reinit
public void reinit(LanePosition initialLongitudinalPosition) throws NetworkException, nl.tudelft.simulation.dsol.SimRuntimeException, GtuException, OtsGeometryException Reinitializes the GTU on the network using the existing strategical planner and zero speed.- Parameters:
initialLongitudinalPosition
- LanePosition; initial position- Throws:
NetworkException
- when the GTU cannot be placed on the given lanenl.tudelft.simulation.dsol.SimRuntimeException
- when the move method cannot be scheduledGtuException
- when initial values are not correctOtsGeometryException
- when the initial path is wrong
-
changeLaneInstantaneously
public void changeLaneInstantaneously(LateralDirectionality laneChangeDirection) throws GtuException Change lanes instantaneously.- Parameters:
laneChangeDirection
- LateralDirectionality; the direction to change to- Throws:
GtuException
- in case lane change fails
-
initLaneChange
Register on lanes in target lane.- Parameters:
laneChangeDirection
- LateralDirectionality; direction of lane change- Throws:
GtuException
- exception
-
finalizeLaneChange
Performs the finalization of a lane change by leaving the from lanes.- Parameters:
laneChangeDirection
- LateralDirectionality; direction of lane change- Throws:
GtuException
- if position or direction could not be obtained
-
setFinalizeLaneChangeEvent
public void setFinalizeLaneChangeEvent(nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<org.djunits.value.vdouble.scalar.Duration> event) Sets event to finalize lane change.- Parameters:
event
- SimEventInterface<SimTimeDoubleUnit>; event
-
move
protected boolean move(org.djutils.draw.point.OrientedPoint2d fromLocation) throws nl.tudelft.simulation.dsol.SimRuntimeException, GtuException, OperationalPlanException, NetworkException, org.opentrafficsim.base.parameters.ParameterException - Overrides:
move
in classGtu
- Throws:
nl.tudelft.simulation.dsol.SimRuntimeException
GtuException
OperationalPlanException
NetworkException
org.opentrafficsim.base.parameters.ParameterException
-
scheduleEnterEvent
protected void scheduleEnterEvent() throws GtuException, OperationalPlanException, nl.tudelft.simulation.dsol.SimRuntimeExceptionChecks whether the GTU will enter a next cross-section during the (remainder of) the tactical plan. Only one event will be scheduled. Possible additional events are scheduled upon entering the cross-section.- Throws:
GtuException
- exceptionOperationalPlanException
- exceptionnl.tudelft.simulation.dsol.SimRuntimeException
- exception
-
enterCrossSection
protected void enterCrossSection() throws GtuException, OperationalPlanException, nl.tudelft.simulation.dsol.SimRuntimeExceptionAppends a new cross-section at the downstream end. Possibly schedules a next enter event.- Throws:
GtuException
- exceptionOperationalPlanException
- exceptionnl.tudelft.simulation.dsol.SimRuntimeException
- exception
-
scheduleLeaveEvent
protected void scheduleLeaveEvent() throws GtuException, OperationalPlanException, nl.tudelft.simulation.dsol.SimRuntimeExceptionChecks whether the GTU will leave a cross-section during the (remainder of) the tactical plan. Only one event will be scheduled. Possible additional events are scheduled upon leaving the cross-section.- Throws:
GtuException
- exceptionOperationalPlanException
- exceptionnl.tudelft.simulation.dsol.SimRuntimeException
- exception
-
leaveCrossSection
protected void leaveCrossSection() throws GtuException, OperationalPlanException, nl.tudelft.simulation.dsol.SimRuntimeExceptionRemoves registration between the GTU and the lanes in the most upstream cross-section. Possibly schedules a next leave event.- Throws:
GtuException
- exceptionOperationalPlanException
- exceptionnl.tudelft.simulation.dsol.SimRuntimeException
- exception
-
scheduleTriggers
protected void scheduleTriggers(Lane lane) throws GtuException, OperationalPlanException, nl.tudelft.simulation.dsol.SimRuntimeException Schedules all trigger events during the current operational plan on the lane.- Parameters:
lane
- Lane; lane- Throws:
GtuException
- exceptionOperationalPlanException
- exceptionnl.tudelft.simulation.dsol.SimRuntimeException
- exception
-
getNextLaneForRoute
Returns the next lane for a given lane to stay on the route.- Parameters:
lane
- Lane; the lane for which we want to know the next Lane- Returns:
- Lane; next lane,
null
if none
-
getNextLanesForRoute
Returns a set ofLane
s that can be followed considering the route.- Parameters:
lane
- Lane; the lane for which we want to know the next Lane- Returns:
- set of
Lane
s that can be followed considering the route
-
positions
public final Map<Lane,org.djunits.value.vdouble.scalar.Length> positions(RelativePosition relativePosition) throws GtuException Return the longitudinal positions of a point relative to this GTU, relative to the center line of the Lanes in which the vehicle is registered.
Note: If a GTU is registered in multiple parallel lanes, the lateralLaneChangeModel is used to determine the center line of the vehicle at this point in time. Otherwise, the average of the center positions of the lines will be taken.- Parameters:
relativePosition
- RelativePosition; the position on the vehicle relative to the reference point.- Returns:
- the lanes and the position on the lanes where the GTU is currently registered, for the given position of the GTU.
- Throws:
GtuException
- when the vehicle is not on one of the lanes on which it is registered.
-
positions
public final Map<Lane,org.djunits.value.vdouble.scalar.Length> positions(RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time when) throws GtuException Return the longitudinal positions of a point relative to this GTU, relative to the center line of the Lanes in which the vehicle is registered.- Parameters:
relativePosition
- RelativePosition; the position on the vehicle relative to the reference point.when
- Time; the future time for which to calculate the positions.- Returns:
- the lanes and the position on the lanes where the GTU will be registered at the time, for the given position of the GTU.
- Throws:
GtuException
- when the vehicle is not on one of the lanes on which it is registered.
-
position
public final org.djunits.value.vdouble.scalar.Length position(Lane lane, RelativePosition relativePosition) throws GtuException Return the longitudinal position of a point relative to this GTU, relative to the center line of the Lane at the current simulation time.- Parameters:
lane
- Lane; the position on this lane will be returned.relativePosition
- RelativePosition; the position on the vehicle relative to the reference point.- Returns:
- DoubleScalarAbs<LengthUnit>; the position, relative to the center line of the Lane.
- Throws:
GtuException
- when the vehicle is not on the given lane.
-
position
public org.djunits.value.vdouble.scalar.Length position(Lane lane, RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time when) throws GtuException Return the longitudinal position of a point relative to this GTU, relative to the center line of the Lane.- Parameters:
lane
- Lane; the position on this lane will be returned.relativePosition
- RelativePosition; the position on the vehicle relative to the reference point.when
- Time; the future time for which to calculate the positions.- Returns:
- DoubleScalarAbs<LengthUnit>; the position, relative to the center line of the Lane.
- Throws:
GtuException
- when the vehicle is not on the given lane.
-
getReferencePosition
Return the current Lane, position and directionality of the GTU.- Returns:
- LanePosition; the current Lane, position and directionality of the GTU
- Throws:
GtuException
- in case the reference position of the GTU cannot be found on the lanes in its current path
-
fractionalPositions
public final Map<Lane,Double> fractionalPositions(RelativePosition relativePosition) throws GtuException Return the longitudinal positions of a point relative to this GTU, relative to the center line of the Lanes in which the vehicle is registered, as fractions of the length of the lane. This is important when we want to see if two vehicles are next to each other and we compare an 'inner' and 'outer' curve.- Parameters:
relativePosition
- RelativePosition; the position on the vehicle relative to the reference point.- Returns:
- the lanes and the position on the lanes where the GTU is currently registered, for the given position of the GTU.
- Throws:
GtuException
- when the vehicle is not on one of the lanes on which it is registered.
-
fractionalPositions
public final Map<Lane,Double> fractionalPositions(RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time when) throws GtuException Return the longitudinal positions of a point relative to this GTU, relative to the center line of the Lanes in which the vehicle is registered, as fractions of the length of the lane. This is important when we want to see if two vehicles are next to each other and we compare an 'inner' and 'outer' curve.- Parameters:
relativePosition
- RelativePosition; the position on the vehicle relative to the reference point.when
- Time; the future time for which to calculate the positions.- Returns:
- the lanes and the position on the lanes where the GTU will be registered at the time, for the given position of the GTU.
- Throws:
GtuException
- when the vehicle is not on one of the lanes on which it is registered.
-
fractionalPosition
public final double fractionalPosition(Lane lane, RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time when) throws GtuException Return the longitudinal position of a point relative to this GTU, relative to the center line of the Lane, as a fraction of the length of the lane. This is important when we want to see if two vehicles are next to each other and we compare an 'inner' and 'outer' curve.- Parameters:
lane
- Lane; the position on this lane will be returned.relativePosition
- RelativePosition; the position on the vehicle relative to the reference point.when
- Time; the future time for which to calculate the positions.- Returns:
- the fractional relative position on the lane at the given time.
- Throws:
GtuException
- when the vehicle is not on the given lane.
-
fractionalPosition
public final double fractionalPosition(Lane lane, RelativePosition relativePosition) throws GtuException Return the longitudinal position of a point relative to this GTU, relative to the center line of the Lane, as a fraction of the length of the lane. This is important when we want to see if two vehicles are next to each other and we compare an 'inner' and 'outer' curve.- Parameters:
lane
- Lane; the position on this lane will be returned.relativePosition
- RelativePosition; the position on the vehicle relative to the reference point.- Returns:
- the fractional relative position on the lane at the given time.
- Throws:
GtuException
- when the vehicle is not on the given lane.
-
addTrigger
public final void addTrigger(Lane lane, nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface<org.djunits.value.vdouble.scalar.Duration> event) Add an event to the list of lane triggers scheduled for this GTU.- Parameters:
lane
- Lane; the lane on which the event occursevent
- SimEventInterface<SimTimeDoubleUnit>; SimeEvent<SimTimeDoubleUnit> the event
-
setVehicleModel
Sets a vehicle model.- Parameters:
vehicleModel
- VehicleModel; vehicle model
-
getVehicleModel
Returns the vehicle model.- Returns:
- VehicleModel; vehicle model
-
destroy
public void destroy() -
getStrategicalPlanner
- Overrides:
getStrategicalPlanner
in classGtu
-
getStrategicalPlanner
public final LaneBasedStrategicalPlanner getStrategicalPlanner(org.djunits.value.vdouble.scalar.Time time) - Overrides:
getStrategicalPlanner
in classGtu
-
getNetwork
- Returns:
- the road network to which the LaneBasedGtu belongs
-
getDesiredSpeed
public org.djunits.value.vdouble.scalar.Speed getDesiredSpeed()This method returns the current desired speed of the GTU. This value is required often, so implementations can cache it.- Returns:
- Speed; current desired speed
-
getCarFollowingAcceleration
public org.djunits.value.vdouble.scalar.Acceleration getCarFollowingAcceleration()This method returns the current car-following acceleration of the GTU. This value is required often, so implementations can cache it.- Returns:
- Acceleration; current car-following acceleration
-
getTurnIndicatorStatus
- Returns:
- the status of the turn indicator
-
getTurnIndicatorStatus
- Parameters:
time
- Time; time to obtain the turn indicator status at- Returns:
- the status of the turn indicator at the given time
-
setTurnIndicatorStatus
Set the status of the turn indicator.- Parameters:
turnIndicatorStatus
- TurnIndicatorStatus; the new status of the turn indicator.
-
getLateralPosition
Returns the lateral position of the GTU relative to the lane center line. Negative values are towards the right.- Parameters:
lane
- Lane; lane to consider (most important regarding left/right, not upstream downstream)- Returns:
- Length; lateral position of the GTU relative to the lane center line
- Throws:
GtuException
- when the vehicle is not on the given lane.
-
setInstantaneousLaneChange
public void setInstantaneousLaneChange(boolean instantaneous) Sets whether the GTU perform lane changes instantaneously or not.- Parameters:
instantaneous
- boolean; whether the GTU perform lane changes instantaneously or not
-
isInstantaneousLaneChange
public boolean isInstantaneousLaneChange()Returns whether the GTU perform lane changes instantaneously or not.- Returns:
- boolean; whether the GTU perform lane changes instantaneously or not
-
getTacticalPlanner
- Overrides:
getTacticalPlanner
in classGtu
-
getTacticalPlanner
- Overrides:
getTacticalPlanner
in classGtu
-
setNoLaneChangeDistance
public final void setNoLaneChangeDistance(org.djunits.value.vdouble.scalar.Length distance) Set distance over which the GTU should not change lane after being created.- Parameters:
distance
- Length; distance over which the GTU should not change lane after being created
-
laneChangeAllowed
public final boolean laneChangeAllowed()Returns whether a lane change is allowed.- Returns:
- whether a lane change is allowed
-
isBrakingLightsOn
public boolean isBrakingLightsOn()The default implementation returnstrue
if the deceleration is larger than a speed-dependent threshold given by:
c0 * g(v) + c1 + c3*v^2
where c0 = 0.2, c1 = 0.15 and c3 = 0.00025 (with c2 = 0 implicit) are empirically derived averages, and g(v) is 0 below 25 km/h or 1 otherwise, representing that the engine is disengaged at low speeds.- Returns:
- boolean; whether the braking lights are on
-
isBrakingLightsOn
public boolean isBrakingLightsOn(org.djunits.value.vdouble.scalar.Time when) The default implementation returnstrue
if the deceleration is larger than a speed-dependent threshold given by:
c0 * g(v) + c1 + c3*v^2
where c0 = 0.2, c1 = 0.15 and c3 = 0.00025 (with c2 = 0 implicit) are empirically derived averages, and g(v) is 0 below 25 km/h or 1 otherwise, representing that the engine is disengaged at low speeds.- Parameters:
when
- Time; time- Returns:
- boolean; whether the braking lights are on
-
getProjectedLength
Get projected length on the lane.- Parameters:
lane
- Lane; lane to project the vehicle on- Returns:
- Length; the length on the lane, which is different from the actual length during deviative tactical plans
- Throws:
GtuException
- when the vehicle is not on the given lane
-
toString
-