Class AbstractLaneBasedGTU2
- java.lang.Object
-
- org.djutils.event.EventProducer
-
- org.opentrafficsim.core.gtu.AbstractGTU
-
- org.opentrafficsim.road.gtu.lane.AbstractLaneBasedGTU2
-
- All Implemented Interfaces:
Serializable
,Locatable
,EventProducerInterface
,Identifiable
,Drawable
,GTU
,LaneBasedGTU
- Direct Known Subclasses:
AbstractLaneBasedIndividualGTU
public abstract class AbstractLaneBasedGTU2 extends AbstractGTU implements LaneBasedGTU
This class contains most of the code that is needed to run a lane based GTU.
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-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision: 1408 $, $LastChangedDate: 2015-09-24 15:17:25 +0200 (Thu, 24 Sep 2015) $, by $Author: pknoppers $,
initial version Oct 22, 2014
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
CACHED_POSITION
cached position count.static boolean
CACHING
Caching on or off.static Length
eventMargin
Margin to add to plan to check of the path will enter the next section.static Length
initialLocationThresholdDifference
The threshold distance for differences between initial locations of the GTU on different lanes.static int
NON_CACHED_POSITION
cached position count.-
Fields inherited from class org.opentrafficsim.core.gtu.AbstractGTU
ALIGN_COUNT, ALIGNED, operationalPlan
-
Fields inherited from class org.djutils.event.EventProducer
eventProducerImpl
-
Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
-
Fields inherited from interface org.opentrafficsim.core.gtu.GTU
DESTROY_EVENT, INIT_EVENT, MOVE_EVENT
-
Fields inherited from interface org.opentrafficsim.road.gtu.lane.LaneBasedGTU
LANE_CHANGE_EVENT, LANE_ENTER_EVENT, LANE_EXIT_EVENT, LANEBASED_DESTROY_EVENT, LANEBASED_INIT_EVENT, LANEBASED_MOVE_EVENT
-
-
Constructor Summary
Constructors Constructor Description AbstractLaneBasedGTU2(String id, GTUType gtuType, OTSRoadNetwork network)
Construct a Lane Based GTU.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTrigger(Lane lane, SimEventInterface<SimTimeDoubleUnit> 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
enterCrossSection()
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.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.double
fractionalPosition(Lane lane, RelativePosition relativePosition, 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.Map<Lane,Double>
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.Map<Lane,Double>
fractionalPositions(RelativePosition relativePosition, 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.javax.media.j3d.Bounds
getBounds()
Acceleration
getCarFollowingAcceleration()
This method returns the current car-following acceleration of the GTU.Speed
getDesiredSpeed()
This method returns the current desired speed of the GTU.GTUDirectionality
getDirection(Lane lane)
Return the directionality of a lane on which the GTU is registered for its current operational plan.Length
getLateralPosition(Lane lane)
Returns the lateral position of the GTU relative to the lane center line.RoadNetwork
getNetwork()
DirectedLanePosition
getReferencePosition()
Return the current Lane, position and directionality of the GTU.LaneBasedStrategicalPlanner
getStrategicalPlanner()
LaneBasedStrategicalPlanner
getStrategicalPlanner(Time time)
TurnIndicatorStatus
getTurnIndicatorStatus()
TurnIndicatorStatus
getTurnIndicatorStatus(Time time)
VehicleModel
getVehicleModel()
Returns the vehicle model.void
init(LaneBasedStrategicalPlanner strategicalPlanner, Set<DirectedLanePosition> initialLongitudinalPositions, Speed initialSpeed)
void
initLaneChange(LateralDirectionality laneChangeDirection)
Register on lanes in target lane.boolean
isInstantaneousLaneChange()
Returns whether the GTU perform lane changes instantaneously or not.protected void
leaveCrossSection()
Removes registration between the GTU and the lanes in the most upstream cross-section.protected boolean
move(DirectedPoint fromLocation)
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.Length
position(Lane lane, RelativePosition relativePosition, Time when)
Return the longitudinal position of a point relative to this GTU, relative to the center line of the Lane.Map<Lane,Length>
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.Map<Lane,Length>
positions(RelativePosition relativePosition, 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(Set<DirectedLanePosition> initialLongitudinalPositions)
Reinitializes the GTU on the network using the existing strategical planner and zero speed.protected void
scheduleEnterEvent()
Checks whether the GTU will enter a next cross-section during the (remainder of) the tactical plan.protected void
scheduleLeaveEvent()
Checks whether the GTU will leave a cross-section during the (remainder of) the tactical plan.protected void
scheduleTriggers(Lane lane, GTUDirectionality direction)
Schedules all trigger events during the current operational plan on the lane.void
setFinalizeLaneChangeEvent(SimEventInterface<SimTimeDoubleUnit> event)
Sets event to finalize lane change.void
setInstantaneousLaneChange(boolean instantaneous)
Sets whether the GTU perform lane changes instantaneously or not.void
setParent(GTU gtu)
All lanes the GTU is on will be left.void
setTurnIndicatorStatus(TurnIndicatorStatus turnIndicatorStatus)
Set the status of the turn indicator.void
setVehicleModel(VehicleModel vehicleModel)
Sets a vehicle model.String
toString()
-
Methods inherited from class org.opentrafficsim.core.gtu.AbstractGTU
addGtu, equals, getAcceleration, getAcceleration, getChildren, getErrorHandler, getGTUType, getId, getLocation, getMaximumAcceleration, getMaximumDeceleration, getNextMoveEvent, getOdometer, getOdometer, getOperationalPlan, getOperationalPlan, getParameters, getParent, getPerceivableContext, getReference, getSimulator, getSourceId, getSpeed, getSpeed, hashCode, init, interruptMove, isDestroyed, removeGtu, setErrorHandler, setMaximumAcceleration, setMaximumDeceleration, setParameters
-
Methods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, 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.djutils.event.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypesWithListeners, getSourceId, hasListeners, numberOfListeners, removeListener
-
Methods inherited from interface org.opentrafficsim.core.gtu.GTU
addGtu, getAcceleration, getAcceleration, getCenter, getChildren, getContourPoints, getFront, getGTUType, getId, getLength, getMaximumAcceleration, getMaximumDeceleration, getMaximumSpeed, getOdometer, getOdometer, getOperationalPlan, getOperationalPlan, getParameters, getParent, getPerceivableContext, getRear, getReference, getRelativePositions, getSimulator, getSpeed, getSpeed, getWidth, isDestroyed, removeGtu, setErrorHandler, setParameters
-
Methods inherited from interface org.opentrafficsim.road.gtu.lane.LaneBasedGTU
getLocation, getProjectedLength, getTacticalPlanner, getTacticalPlanner, isBrakingLightsOn, isBrakingLightsOn, laneChangeAllowed, setNoLaneChangeDistance
-
-
-
-
Field Detail
-
initialLocationThresholdDifference
public static Length initialLocationThresholdDifference
The threshold distance for differences between initial locations of the GTU on different lanes.
-
eventMargin
public static Length eventMargin
Margin to add to plan to check of the path will enter the next section.
-
CACHING
public static boolean CACHING
Caching on or off.
-
CACHED_POSITION
public static int CACHED_POSITION
cached position count.
-
NON_CACHED_POSITION
public static int NON_CACHED_POSITION
cached position count.
-
-
Constructor Detail
-
AbstractLaneBasedGTU2
public AbstractLaneBasedGTU2(String id, GTUType gtuType, OTSRoadNetwork 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, BusTypenetwork
- OTSRoadNetwork; the network that the GTU is initially registered in- Throws:
GTUException
- when initial values are not correct
-
-
Method Detail
-
init
public void init(LaneBasedStrategicalPlanner strategicalPlanner, Set<DirectedLanePosition> initialLongitudinalPositions, Speed initialSpeed) throws NetworkException, SimRuntimeException, GTUException, OTSGeometryException
- Parameters:
strategicalPlanner
- LaneBasedStrategicalPlanner; the strategical planner (e.g., route determination) to useinitialLongitudinalPositions
- Set<DirectedLanePosition>; the initial positions of the car on one or more lanes with their directionsinitialSpeed
- Speed; the initial speed of the car on the lane- Throws:
NetworkException
- when the GTU cannot be placed on the given laneSimRuntimeException
- when the move method cannot be scheduledGTUException
- when initial values are not correctOTSGeometryException
- when the initial path is wrong
-
setParent
public void setParent(GTU gtu) throws GTUException
All lanes the GTU is on will be left.- Specified by:
setParent
in interfaceGTU
- Overrides:
setParent
in classAbstractGTU
- Throws:
GTUException
-
reinit
public void reinit(Set<DirectedLanePosition> initialLongitudinalPositions) throws NetworkException, SimRuntimeException, GTUException, OTSGeometryException
Reinitializes the GTU on the network using the existing strategical planner and zero speed.- Parameters:
initialLongitudinalPositions
- Set<DirectedLanePosition>; initial position- Throws:
NetworkException
- when the GTU cannot be placed on the given laneSimRuntimeException
- 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.- Specified by:
changeLaneInstantaneously
in interfaceLaneBasedGTU
- Parameters:
laneChangeDirection
- LateralDirectionality; the direction to change to- Throws:
GTUException
- in case lane change fails
-
initLaneChange
public void initLaneChange(LateralDirectionality laneChangeDirection) throws GTUException
Register on lanes in target lane.- Specified by:
initLaneChange
in interfaceLaneBasedGTU
- Parameters:
laneChangeDirection
- LateralDirectionality; direction of lane change- Throws:
GTUException
- exception
-
finalizeLaneChange
protected void finalizeLaneChange(LateralDirectionality laneChangeDirection) throws GTUException
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(SimEventInterface<SimTimeDoubleUnit> event)
Sets event to finalize lane change.- Specified by:
setFinalizeLaneChangeEvent
in interfaceLaneBasedGTU
- Parameters:
event
- SimEventInterface<SimTimeDoubleUnit>; event
-
getDirection
public final GTUDirectionality getDirection(Lane lane) throws GTUException
Return the directionality of a lane on which the GTU is registered for its current operational plan.- Specified by:
getDirection
in interfaceLaneBasedGTU
- Parameters:
lane
- Lane; the lane for which we want to know the direction- Returns:
- GTUDirectionality; the direction on the given lane
- Throws:
GTUException
- in case the GTU is not registered on the Lane
-
move
protected boolean move(DirectedPoint fromLocation) throws SimRuntimeException, GTUException, OperationalPlanException, NetworkException, ParameterException
- Overrides:
move
in classAbstractGTU
- Throws:
SimRuntimeException
GTUException
OperationalPlanException
NetworkException
ParameterException
-
scheduleEnterEvent
protected void scheduleEnterEvent() throws GTUException, OperationalPlanException, SimRuntimeException
Checks 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
- exceptionSimRuntimeException
- exception
-
enterCrossSection
protected void enterCrossSection() throws GTUException, OperationalPlanException, SimRuntimeException
Appends a new cross-section at the downstream end. Possibly schedules a next enter event.- Throws:
GTUException
- exceptionOperationalPlanException
- exceptionSimRuntimeException
- exception
-
scheduleLeaveEvent
protected void scheduleLeaveEvent() throws GTUException, OperationalPlanException, SimRuntimeException
Checks 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
- exceptionSimRuntimeException
- exception
-
leaveCrossSection
protected void leaveCrossSection() throws GTUException, OperationalPlanException, SimRuntimeException
Removes registration between the GTU and the lanes in the most upstream cross-section. Possibly schedules a next leave event.- Throws:
GTUException
- exceptionOperationalPlanException
- exceptionSimRuntimeException
- exception
-
scheduleTriggers
protected void scheduleTriggers(Lane lane, GTUDirectionality direction) throws GTUException, OperationalPlanException, SimRuntimeException
Schedules all trigger events during the current operational plan on the lane.- Parameters:
lane
- Lane; lanedirection
- GTUDirectionality; direction- Throws:
GTUException
- exceptionOperationalPlanException
- exceptionSimRuntimeException
- exception
-
positions
public final Map<Lane,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.- Specified by:
positions
in interfaceLaneBasedGTU
- 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,Length> positions(RelativePosition relativePosition, 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.- Specified by:
positions
in interfaceLaneBasedGTU
- 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 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.- Specified by:
position
in interfaceLaneBasedGTU
- 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 Length position(Lane lane, RelativePosition relativePosition, Time when) throws GTUException
Return the longitudinal position of a point relative to this GTU, relative to the center line of the Lane.- Specified by:
position
in interfaceLaneBasedGTU
- 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
public DirectedLanePosition getReferencePosition() throws GTUException
Return the current Lane, position and directionality of the GTU.- Specified by:
getReferencePosition
in interfaceLaneBasedGTU
- Returns:
- DirectedLanePosition; 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.- Specified by:
fractionalPositions
in interfaceLaneBasedGTU
- 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, 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.- Specified by:
fractionalPositions
in interfaceLaneBasedGTU
- 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, 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.- Specified by:
fractionalPosition
in interfaceLaneBasedGTU
- 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.- Specified by:
fractionalPosition
in interfaceLaneBasedGTU
- 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, SimEventInterface<SimTimeDoubleUnit> event)
Add an event to the list of lane triggers scheduled for this GTU.- Specified by:
addTrigger
in interfaceLaneBasedGTU
- Parameters:
lane
- Lane; the lane on which the event occursevent
- SimEventInterface<SimTimeDoubleUnit>; SimeEvent<SimTimeDoubleUnit> the event
-
setVehicleModel
public void setVehicleModel(VehicleModel vehicleModel)
Sets a vehicle model.- Parameters:
vehicleModel
- VehicleModel; vehicle model
-
getVehicleModel
public VehicleModel getVehicleModel()
Returns the vehicle model.- Specified by:
getVehicleModel
in interfaceLaneBasedGTU
- Returns:
- VehicleModel; vehicle model
-
destroy
public void destroy()
- Specified by:
destroy
in interfaceGTU
- Overrides:
destroy
in classAbstractGTU
-
getBounds
public final javax.media.j3d.Bounds getBounds()
-
getStrategicalPlanner
public final LaneBasedStrategicalPlanner getStrategicalPlanner()
- Specified by:
getStrategicalPlanner
in interfaceGTU
- Specified by:
getStrategicalPlanner
in interfaceLaneBasedGTU
- Overrides:
getStrategicalPlanner
in classAbstractGTU
-
getStrategicalPlanner
public final LaneBasedStrategicalPlanner getStrategicalPlanner(Time time)
- Specified by:
getStrategicalPlanner
in interfaceGTU
- Specified by:
getStrategicalPlanner
in interfaceLaneBasedGTU
- Overrides:
getStrategicalPlanner
in classAbstractGTU
-
getNetwork
public RoadNetwork getNetwork()
- Specified by:
getNetwork
in interfaceLaneBasedGTU
- Returns:
- the road network to which the LaneBasedGTU belongs
-
getDesiredSpeed
public Speed getDesiredSpeed()
This method returns the current desired speed of the GTU. This value is required often, so implementations can cache it.- Specified by:
getDesiredSpeed
in interfaceLaneBasedGTU
- Returns:
- Speed; current desired speed
-
getCarFollowingAcceleration
public Acceleration getCarFollowingAcceleration()
This method returns the current car-following acceleration of the GTU. This value is required often, so implementations can cache it.- Specified by:
getCarFollowingAcceleration
in interfaceLaneBasedGTU
- Returns:
- Acceleration; current car-following acceleration
-
getTurnIndicatorStatus
public final TurnIndicatorStatus getTurnIndicatorStatus()
- Specified by:
getTurnIndicatorStatus
in interfaceLaneBasedGTU
- Returns:
- the status of the turn indicator
-
getTurnIndicatorStatus
public final TurnIndicatorStatus getTurnIndicatorStatus(Time time)
- Specified by:
getTurnIndicatorStatus
in interfaceLaneBasedGTU
- Parameters:
time
- Time; time to obtain the turn indicator status at- Returns:
- the status of the turn indicator at the given time
-
setTurnIndicatorStatus
public final void setTurnIndicatorStatus(TurnIndicatorStatus turnIndicatorStatus)
Set the status of the turn indicator.- Specified by:
setTurnIndicatorStatus
in interfaceLaneBasedGTU
- Parameters:
turnIndicatorStatus
- TurnIndicatorStatus; the new status of the turn indicator.
-
getLateralPosition
public Length getLateralPosition(Lane lane) throws GTUException
Returns the lateral position of the GTU relative to the lane center line. Negative values are towards the right.- Specified by:
getLateralPosition
in interfaceLaneBasedGTU
- 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.- Specified by:
setInstantaneousLaneChange
in interfaceLaneBasedGTU
- 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.- Specified by:
isInstantaneousLaneChange
in interfaceLaneBasedGTU
- Returns:
- boolean; whether the GTU perform lane changes instantaneously or not
-
-