public class LaneBlock extends org.opentrafficsim.core.gtu.AbstractGTU implements LaneBasedGTU
Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Field and Description |
---|---|
static org.opentrafficsim.core.gtu.GTUType |
BLOCK_GTU
blocking GTU type.
|
Constructor and Description |
---|
LaneBlock(Lane lane,
org.djunits.value.vdouble.scalar.Length.Rel position,
org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface simulator,
Class<? extends nl.tudelft.simulation.dsol.animation.D2.Renderable2D> animationClass) |
Modifier and Type | Method and Description |
---|---|
Lane |
bestAccessibleAdjacentLane(Lane currentLane,
org.opentrafficsim.core.network.LateralDirectionality lateralDirection,
org.djunits.value.vdouble.scalar.Length.Rel longitudinalPosition)
Determine whether there is a lane to the left or to the right of this lane, which is accessible from this lane, or null
if no lane could be found.
|
org.djunits.value.vdouble.scalar.Time.Rel |
deltaTimeForDistance(org.djunits.value.vdouble.scalar.Length.Rel distance)
Determine the time since last evaluation when this GTU has covered the specified distance from the position of the last
evaluation time.
|
void |
destroy() |
void |
enterLane(Lane lane,
org.djunits.value.vdouble.scalar.Length.Rel position)
insert GTU at a certain position.
|
double |
fractionalPosition(Lane lane,
org.opentrafficsim.core.gtu.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,
org.opentrafficsim.core.gtu.RelativePosition relativePosition,
org.djunits.value.vdouble.scalar.Time.Abs 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(org.opentrafficsim.core.gtu.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(org.opentrafficsim.core.gtu.RelativePosition relativePosition,
org.djunits.value.vdouble.scalar.Time.Abs 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 |
getAcceleration() |
org.djunits.value.vdouble.scalar.Acceleration |
getAcceleration(org.djunits.value.vdouble.scalar.Time.Abs when) |
javax.media.j3d.Bounds |
getBounds() |
org.opentrafficsim.core.gtu.RelativePosition |
getFront() |
GTUFollowingModel |
getGTUFollowingModel()
Retrieve the GTU following model of this LaneBasedGTU.
|
Lane |
getLane() |
LaneChangeUrgeGTUColorer.LaneChangeDistanceAndDirection |
getLaneChangeDistanceAndDirection()
Return the distance available for the next needed lane change and the lateral direction of that lane change.
|
org.djunits.value.vdouble.scalar.Time.Abs |
getLastEvaluationTime() |
org.djunits.value.vdouble.scalar.Speed |
getLateralVelocity() |
org.djunits.value.vdouble.scalar.Length.Rel |
getLength() |
nl.tudelft.simulation.language.d3.DirectedPoint |
getLocation() |
org.djunits.value.vdouble.scalar.Speed |
getLongitudinalVelocity()
v(t) = v0 + (t - t0) * a.
|
org.djunits.value.vdouble.scalar.Speed |
getLongitudinalVelocity(org.djunits.value.vdouble.scalar.Time.Abs when)
Return the speed of this GTU at the specified time.
|
org.djunits.value.vdouble.scalar.Speed |
getMaximumVelocity() |
org.djunits.value.vdouble.scalar.Time.Abs |
getNextEvaluationTime() |
org.djunits.value.vdouble.scalar.Length.Abs |
getOdometer() |
org.opentrafficsim.core.gtu.RelativePosition |
getRear() |
Map<org.opentrafficsim.core.gtu.RelativePosition.TYPE,org.opentrafficsim.core.gtu.RelativePosition> |
getRelativePositions() |
org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface |
getSimulator() |
org.djunits.value.vdouble.scalar.Speed |
getVelocity() |
org.djunits.value.vdouble.scalar.Length.Rel |
getWidth() |
HeadwayGTU |
headway(Lane lane,
org.djunits.value.vdouble.scalar.Length.Rel maxDistance)
Determine by what distance the front of this GTU is behind the rear an other GTU, or the rear of this GTU is ahead of the
front of an other GTU.
|
HeadwayGTU |
headway(org.djunits.value.vdouble.scalar.Length.Rel maxDistance)
Determine which GTU in front of this GTU, or behind this GTU.
|
void |
leaveLane(Lane lane)
Unregister the GTU from a lane.
|
Set<LaneBasedGTU> |
parallel(Lane lane,
org.djunits.value.vdouble.scalar.Time.Abs when)
Determine which GTUs are parallel with us on another lane, based on fractional positions.
|
Set<LaneBasedGTU> |
parallel(org.opentrafficsim.core.network.LateralDirectionality lateralDirection,
org.djunits.value.vdouble.scalar.Time.Abs when)
Determine which GTUs are parallel with us in a certain lateral direction, based on fractional positions.
|
org.djunits.value.vdouble.scalar.Length.Rel |
position(Lane lane,
org.opentrafficsim.core.gtu.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.Rel |
position(Lane lane,
org.opentrafficsim.core.gtu.RelativePosition relativePosition,
org.djunits.value.vdouble.scalar.Time.Abs when)
Return the longitudinal position of a point relative to this GTU, relative to the center line of the Lane.
|
Map<Lane,org.djunits.value.vdouble.scalar.Length.Rel> |
positions(org.opentrafficsim.core.gtu.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,org.djunits.value.vdouble.scalar.Length.Rel> |
positions(org.opentrafficsim.core.gtu.RelativePosition relativePosition,
org.djunits.value.vdouble.scalar.Time.Abs 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.
|
org.djunits.value.vdouble.scalar.Length.Rel |
projectedPosition(Lane projectionLane,
org.opentrafficsim.core.gtu.RelativePosition relativePosition,
org.djunits.value.vdouble.scalar.Time.Abs when)
Return the longitudinal position that this GTU would have if it were to change to another Lane with a/the current
CrossSectionLink.
|
org.djunits.value.vdouble.scalar.Time.Abs |
timeAtDistance(org.djunits.value.vdouble.scalar.Length.Rel distance)
Determine the time when this GTU will have covered the specified distance from the position of the last evaluation time.
|
String |
toString() |
getGTUType, getId, getReference, getRouteNavigator, setRouteNavigator
public static final org.opentrafficsim.core.gtu.GTUType BLOCK_GTU
public LaneBlock(Lane lane, org.djunits.value.vdouble.scalar.Length.Rel position, org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface simulator, Class<? extends nl.tudelft.simulation.dsol.animation.D2.Renderable2D> animationClass) throws org.opentrafficsim.core.gtu.GTUException, org.opentrafficsim.core.network.NetworkException, NamingException
lane
- The lane where the block has to be putposition
- the position on the lane as a lengthsimulator
- the simulator to avoid NullPointerExceptionsanimationClass
- Class<? extends Renderable2D>; the class for animation or null if no animationorg.opentrafficsim.core.gtu.GTUException
- when GTU cannot be created.NamingException
- if an error occurs when adding the animation handlerorg.opentrafficsim.core.network.NetworkException
- when the GTU cannot be placed on the given lanepublic final Lane getLane()
public final org.djunits.value.vdouble.scalar.Length.Rel getLength()
getLength
in interface org.opentrafficsim.core.gtu.GTU
public final org.djunits.value.vdouble.scalar.Length.Rel getWidth()
getWidth
in interface org.opentrafficsim.core.gtu.GTU
public final org.djunits.value.vdouble.scalar.Speed getMaximumVelocity()
getMaximumVelocity
in interface org.opentrafficsim.core.gtu.GTU
public final org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface getSimulator()
getSimulator
in interface org.opentrafficsim.core.gtu.GTU
public final org.opentrafficsim.core.gtu.RelativePosition getFront()
getFront
in interface org.opentrafficsim.core.gtu.GTU
public final org.opentrafficsim.core.gtu.RelativePosition getRear()
getRear
in interface org.opentrafficsim.core.gtu.GTU
public final org.djunits.value.vdouble.scalar.Speed getVelocity()
getVelocity
in interface org.opentrafficsim.core.gtu.GTU
public final Map<org.opentrafficsim.core.gtu.RelativePosition.TYPE,org.opentrafficsim.core.gtu.RelativePosition> getRelativePositions()
getRelativePositions
in interface org.opentrafficsim.core.gtu.GTU
public final void destroy()
destroy
in interface org.opentrafficsim.core.gtu.GTU
public final org.djunits.value.vdouble.scalar.Acceleration getAcceleration()
getAcceleration
in interface org.opentrafficsim.core.gtu.GTU
getAcceleration
in interface LaneBasedGTU
public final nl.tudelft.simulation.language.d3.DirectedPoint getLocation()
getLocation
in interface nl.tudelft.simulation.dsol.animation.LocatableInterface
getLocation
in interface org.opentrafficsim.core.gtu.GTU
public final javax.media.j3d.Bounds getBounds()
getBounds
in interface nl.tudelft.simulation.dsol.animation.LocatableInterface
getBounds
in interface org.opentrafficsim.core.gtu.GTU
public final org.djunits.value.vdouble.scalar.Length.Abs getOdometer()
getOdometer
in interface org.opentrafficsim.core.gtu.GTU
public final org.djunits.value.vdouble.scalar.Speed getLongitudinalVelocity()
getLongitudinalVelocity
in interface LaneBasedGTU
public final org.djunits.value.vdouble.scalar.Speed getLongitudinalVelocity(org.djunits.value.vdouble.scalar.Time.Abs when)
getLongitudinalVelocity
in interface LaneBasedGTU
when
- time for which the speed must be returnedpublic final org.djunits.value.vdouble.scalar.Acceleration getAcceleration(org.djunits.value.vdouble.scalar.Time.Abs when)
getAcceleration
in interface LaneBasedGTU
when
- time for which the speed must be returnedpublic final org.djunits.value.vdouble.scalar.Speed getLateralVelocity()
getLateralVelocity
in interface LaneBasedGTU
public final org.djunits.value.vdouble.scalar.Time.Abs getLastEvaluationTime()
getLastEvaluationTime
in interface LaneBasedGTU
public final org.djunits.value.vdouble.scalar.Time.Abs getNextEvaluationTime()
getNextEvaluationTime
in interface LaneBasedGTU
public final void enterLane(Lane lane, org.djunits.value.vdouble.scalar.Length.Rel position) throws org.opentrafficsim.core.network.NetworkException
enterLane
in interface LaneBasedGTU
lane
- the lane to add to the list of lanes on which the GTU is registered.position
- the position on the lane.org.opentrafficsim.core.network.NetworkException
- on network inconsistencypublic final void leaveLane(Lane lane)
leaveLane
in interface LaneBasedGTU
lane
- the lane to remove from the list of lanes on which the GTU is registered.public final Map<Lane,org.djunits.value.vdouble.scalar.Length.Rel> positions(org.opentrafficsim.core.gtu.RelativePosition relativePosition) throws org.opentrafficsim.core.network.NetworkException
positions
in interface LaneBasedGTU
relativePosition
- the position on the vehicle relative to the reference point.org.opentrafficsim.core.network.NetworkException
- when the vehicle is not on one of the lanes on which it is registered.public final Map<Lane,org.djunits.value.vdouble.scalar.Length.Rel> positions(org.opentrafficsim.core.gtu.RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws org.opentrafficsim.core.network.NetworkException
positions
in interface LaneBasedGTU
relativePosition
- the position on the vehicle relative to the reference point.when
- the future time for which to calculate the positions.org.opentrafficsim.core.network.NetworkException
- when the vehicle is not on one of the lanes on which it is registered.public final org.djunits.value.vdouble.scalar.Length.Rel position(Lane lane, org.opentrafficsim.core.gtu.RelativePosition relativePosition) throws org.opentrafficsim.core.network.NetworkException
position
in interface LaneBasedGTU
lane
- the position on this lane will be returned.relativePosition
- the position on the vehicle relative to the reference point.org.opentrafficsim.core.network.NetworkException
- when the vehicle is not on the given lane.public final org.djunits.value.vdouble.scalar.Length.Rel position(Lane lane, org.opentrafficsim.core.gtu.RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws org.opentrafficsim.core.network.NetworkException
position
in interface LaneBasedGTU
lane
- the position on this lane will be returned.relativePosition
- the position on the vehicle relative to the reference point.when
- the future time for which to calculate the positions.org.opentrafficsim.core.network.NetworkException
- when the vehicle is not on the given lane.public final Map<Lane,Double> fractionalPositions(org.opentrafficsim.core.gtu.RelativePosition relativePosition) throws org.opentrafficsim.core.network.NetworkException
fractionalPositions
in interface LaneBasedGTU
relativePosition
- the position on the vehicle relative to the reference point.org.opentrafficsim.core.network.NetworkException
- when the vehicle is not on one of the lanes on which it is registered.public Map<Lane,Double> fractionalPositions(org.opentrafficsim.core.gtu.RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws org.opentrafficsim.core.network.NetworkException
fractionalPositions
in interface LaneBasedGTU
relativePosition
- the position on the vehicle relative to the reference point.when
- the future time for which to calculate the positions.org.opentrafficsim.core.network.NetworkException
- when the vehicle is not on one of the lanes on which it is registered.public double fractionalPosition(Lane lane, org.opentrafficsim.core.gtu.RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws org.opentrafficsim.core.network.NetworkException
fractionalPosition
in interface LaneBasedGTU
lane
- the position on this lane will be returned.relativePosition
- the position on the vehicle relative to the reference point.when
- the future time for which to calculate the positions.org.opentrafficsim.core.network.NetworkException
- when the vehicle is not on the given lane.public double fractionalPosition(Lane lane, org.opentrafficsim.core.gtu.RelativePosition relativePosition) throws org.opentrafficsim.core.network.NetworkException
fractionalPosition
in interface LaneBasedGTU
lane
- the position on this lane will be returned.relativePosition
- the position on the vehicle relative to the reference point.org.opentrafficsim.core.network.NetworkException
- when the vehicle is not on the given lane.public org.djunits.value.vdouble.scalar.Length.Rel projectedPosition(Lane projectionLane, org.opentrafficsim.core.gtu.RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws org.opentrafficsim.core.network.NetworkException
projectedPosition
in interface LaneBasedGTU
projectionLane
- Lane; the lane onto which the position of this GTU must be projectedrelativePosition
- RelativePosition; the point on this GTU that must be projectedwhen
- DoubleScalar.Abs<TimeUnit>; the time for which to project the position of this GTUorg.opentrafficsim.core.network.NetworkException
- when projectionLane it not in any of the CrossSectionLink that the GTU is onpublic HeadwayGTU headway(org.djunits.value.vdouble.scalar.Length.Rel maxDistance) throws org.opentrafficsim.core.network.NetworkException
headway
in interface LaneBasedGTU
maxDistance
- the maximum distance to look for the nearest GTU; positive values search forwards; negative values
search backwardsorg.opentrafficsim.core.network.NetworkException
- when there is an error with the next lanes in the network.public HeadwayGTU headway(Lane lane, org.djunits.value.vdouble.scalar.Length.Rel maxDistance) throws org.opentrafficsim.core.network.NetworkException
new DoubleScalar.Rel<LengthUnit>(Double.MAX_VALUE, METER)
is returned. The search will extend into
successive lanes if the maxDistance is larger than the length of the lane.headway
in interface LaneBasedGTU
lane
- the lane to look for another GTUmaxDistance
- the maximum distance to look for; if positive, the search is forwards; if negative, the search is
backwardsorg.opentrafficsim.core.network.NetworkException
- when the vehicle's route is inconclusive or vehicles are not registered correctly on their lanespublic Set<LaneBasedGTU> parallel(Lane lane, org.djunits.value.vdouble.scalar.Time.Abs when) throws org.opentrafficsim.core.network.NetworkException
parallel
in interface LaneBasedGTU
lane
- the lane to look for parallel (partial or full overlapping) GTUs.when
- the future time for which to calculate the headwayorg.opentrafficsim.core.network.NetworkException
- when the vehicle's route is inconclusive, when vehicles are not registered correctly on their
lanes, or when the given lane is not parallel to one of the lanes where we are registered.public Set<LaneBasedGTU> parallel(org.opentrafficsim.core.network.LateralDirectionality lateralDirection, org.djunits.value.vdouble.scalar.Time.Abs when) throws org.opentrafficsim.core.network.NetworkException
parallel
in interface LaneBasedGTU
lateralDirection
- the direction of the adjacent lane(s) to look for parallel (partial or full overlapping) GTUs.when
- the future time for which to calculate the headwayorg.opentrafficsim.core.network.NetworkException
- when the vehicle's route is inconclusive, when vehicles are not registered correctly on their
lanes, or when there are no lanes parallel to one of the lanes where we are registered in the given
direction.public Lane bestAccessibleAdjacentLane(Lane currentLane, org.opentrafficsim.core.network.LateralDirectionality lateralDirection, org.djunits.value.vdouble.scalar.Length.Rel longitudinalPosition)
bestAccessibleAdjacentLane
in interface LaneBasedGTU
currentLane
- the lane to look for the best accessible adjacent lanelateralDirection
- the direction (LEFT, RIGHT) to look atlongitudinalPosition
- DoubleScalar.Rel<LengthUnit>; the position of the GTU along this Lanepublic org.djunits.value.vdouble.scalar.Time.Abs timeAtDistance(org.djunits.value.vdouble.scalar.Length.Rel distance)
timeAtDistance
in interface LaneBasedGTU
distance
- DoubleScalar.Rel<LengthUnit>; the distancepublic org.djunits.value.vdouble.scalar.Time.Rel deltaTimeForDistance(org.djunits.value.vdouble.scalar.Length.Rel distance)
deltaTimeForDistance
in interface LaneBasedGTU
distance
- DoubleScalar.Rel<LengthUnit>; the distancepublic GTUFollowingModel getGTUFollowingModel()
getGTUFollowingModel
in interface LaneBasedGTU
public LaneChangeUrgeGTUColorer.LaneChangeDistanceAndDirection getLaneChangeDistanceAndDirection()
getLaneChangeDistanceAndDirection
in interface LaneBasedGTU
Copyright © 2014–2015 Delft University of Technology. All rights reserved.