ID
- The type of ID, e.g., String or Integerpublic abstract class AbstractLaneBasedGTU<ID> extends AbstractGTU<ID> implements LaneBasedGTU<ID>
Copyright (c) 2013-2014 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Constructor and Description |
---|
AbstractLaneBasedGTU(ID id,
GTUType<?> gtuType,
GTUFollowingModel gtuFollowingModel,
LaneChangeModel laneChangeModel,
Map<Lane,DoubleScalar.Rel<LengthUnit>> initialLongitudinalPositions,
DoubleScalar.Abs<SpeedUnit> initialSpeed,
OTSDEVSSimulatorInterface simulator)
Construct a Lane Based GTU.
|
Modifier and Type | Method and Description |
---|---|
void |
addFrontToSubsequentLane(Lane lane)
Register the lane with a GTU, at the start of the lane.
|
void |
addLane(Lane lane,
DoubleScalar.Rel<LengthUnit> position)
insert GTU at a certain position.
|
DoubleScalar.Rel<TimeUnit> |
deltaTimeForDistance(DoubleScalar.Rel<LengthUnit> 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()
destroy the vehicle from the simulation and animation.
|
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,
DoubleScalar.Abs<TimeUnit> 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,
DoubleScalar.Abs<TimeUnit> 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.
|
DoubleScalar.Abs<AccelerationUnit> |
getAcceleration() |
DoubleScalar.Abs<AccelerationUnit> |
getAcceleration(DoubleScalar.Abs<TimeUnit> when) |
javax.media.j3d.Bounds |
getBounds() |
GTUFollowingModel |
getGTUFollowingModel()
Retrieve the GTUFollowingModel of this GTU.
|
List<Lane> |
getLanes() |
DoubleScalar.Abs<TimeUnit> |
getLastEvaluationTime() |
DoubleScalar.Abs<SpeedUnit> |
getLateralVelocity() |
nl.tudelft.simulation.language.d3.DirectedPoint |
getLocation() |
DoubleScalar.Abs<SpeedUnit> |
getLongitudinalVelocity()
v(t) = v0 + (t - t0) * a.
|
DoubleScalar.Abs<SpeedUnit> |
getLongitudinalVelocity(DoubleScalar.Abs<TimeUnit> when)
Return the speed of this GTU at the specified time.
|
DoubleScalar.Abs<TimeUnit> |
getNextEvaluationTime() |
HeadwayGTU |
headway(DoubleScalar.Rel<LengthUnit> maxDistance)
Determine which GTU in front of this GTU, or behind this GTU.
|
HeadwayGTU |
headway(Lane lane,
DoubleScalar.Rel<LengthUnit> 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.
|
protected void |
move() |
Set<LaneBasedGTU<?>> |
parallel(Lane lane,
DoubleScalar.Abs<TimeUnit> when)
Determine which GTUs are parallel with us on another lane, based on fractional positions.
|
Set<LaneBasedGTU<?>> |
parallel(LateralDirectionality lateralDirection,
DoubleScalar.Abs<TimeUnit> when)
Determine which GTUs are parallel with us in a certain lateral direction, based on fractional positions.
|
DoubleScalar.Rel<LengthUnit> |
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.
|
DoubleScalar.Rel<LengthUnit> |
position(Lane lane,
RelativePosition relativePosition,
DoubleScalar.Abs<TimeUnit> when)
Return the longitudinal position of a point relative to this GTU, relative to the center line of the Lane.
|
Map<Lane,DoubleScalar.Rel<LengthUnit>> |
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,DoubleScalar.Rel<LengthUnit>> |
positions(RelativePosition relativePosition,
DoubleScalar.Abs<TimeUnit> 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.
|
DoubleScalar.Rel<LengthUnit> |
projectedPosition(Lane projectionLane,
RelativePosition relativePosition,
DoubleScalar.Abs<TimeUnit> when)
Return the longitudinal position that this GTU would have if it were to change to another Lane with a/the current
CrossSectionLink.
|
void |
removeLane(Lane lane)
Unregister the GTU from a lane.
|
DoubleScalar.Abs<TimeUnit> |
timeAtDistance(DoubleScalar.Rel<LengthUnit> distance)
Determine the time when this GTU will have covered the specified distance from the position of the last evaluation time.
|
String |
toString(Lane lane,
DoubleScalar.Abs<TimeUnit> when)
Description of Car at specified time.
|
getGTUType, getId, getReference, getRoute, setRoute
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFront, getGTUType, getId, getLength, getMaximumVelocity, getRear, getReference, getRelativePositions, getSimulator, getWidth
public AbstractLaneBasedGTU(ID id, GTUType<?> gtuType, GTUFollowingModel gtuFollowingModel, LaneChangeModel laneChangeModel, Map<Lane,DoubleScalar.Rel<LengthUnit>> initialLongitudinalPositions, DoubleScalar.Abs<SpeedUnit> initialSpeed, OTSDEVSSimulatorInterface simulator) throws RemoteException, NetworkException, nl.tudelft.simulation.dsol.SimRuntimeException
id
- the id of the GTU, could be String or IntegergtuType
- the type of GTU, e.g. TruckType, CarType, BusTypegtuFollowingModel
- the following model, including a reference to the simulator.laneChangeModel
- LaneChangeModel; the lane change modelinitialLongitudinalPositions
- the initial positions of the car on one or more lanesinitialSpeed
- the initial speed of the car on the lanesimulator
- to initialize the move method and to get the current timeRemoteException
- when the simulator cannot be reachedNetworkException
- when the GTU cannot be placed on the given lanenl.tudelft.simulation.dsol.SimRuntimeException
- when the move method cannot be scheduledpublic final DoubleScalar.Abs<SpeedUnit> getLongitudinalVelocity(DoubleScalar.Abs<TimeUnit> when)
getLongitudinalVelocity
in interface LaneBasedGTU<ID>
when
- time for which the speed must be returnedpublic final DoubleScalar.Abs<SpeedUnit> getLongitudinalVelocity() throws RemoteException
getLongitudinalVelocity
in interface LaneBasedGTU<ID>
RemoteException
- in case of problems getting the simulation time.public final DoubleScalar.Abs<TimeUnit> getLastEvaluationTime()
getLastEvaluationTime
in interface LaneBasedGTU<ID>
public final DoubleScalar.Abs<TimeUnit> getNextEvaluationTime()
getNextEvaluationTime
in interface LaneBasedGTU<ID>
public final DoubleScalar.Abs<AccelerationUnit> getAcceleration(DoubleScalar.Abs<TimeUnit> when)
getAcceleration
in interface LaneBasedGTU<ID>
when
- time for which the speed must be returnedpublic final DoubleScalar.Abs<AccelerationUnit> getAcceleration() throws RemoteException
getAcceleration
in interface LaneBasedGTU<ID>
RemoteException
- in case of problems getting the simulation time.public final DoubleScalar.Abs<SpeedUnit> getLateralVelocity()
getLateralVelocity
in interface LaneBasedGTU<ID>
public final void addFrontToSubsequentLane(Lane lane) throws RemoteException, NetworkException
LaneBasedGTU
addFrontToSubsequentLane
in interface LaneBasedGTU<ID>
lane
- the lane to add to the list of lanes on which the GTU is registered.RemoteException
NetworkException
public final void addLane(Lane lane, DoubleScalar.Rel<LengthUnit> position) throws NetworkException
addLane
in interface LaneBasedGTU<ID>
lane
- the lane to add to the list of lanes on which the GTU is registered.position
- the position on the lane.NetworkException
public final void removeLane(Lane lane)
removeLane
in interface LaneBasedGTU<ID>
lane
- the lane to remove from the list of lanes on which the GTU is registered.protected final void move() throws RemoteException, NamingException, NetworkException, GTUException, nl.tudelft.simulation.dsol.SimRuntimeException
RemoteException
- RemoteExceptionNamingException
- on ???NetworkException
- on network inconsistencynl.tudelft.simulation.dsol.SimRuntimeException
- on not being able to reschedule the move() method.GTUException
public final Map<Lane,DoubleScalar.Rel<LengthUnit>> positions(RelativePosition relativePosition) throws NetworkException, RemoteException
positions
in interface LaneBasedGTU<ID>
relativePosition
- the position on the vehicle relative to the reference point.NetworkException
- when the vehicle is not on one of the lanes on which it is registered.RemoteException
- when simulator time cannot be retrieved.public final Map<Lane,DoubleScalar.Rel<LengthUnit>> positions(RelativePosition relativePosition, DoubleScalar.Abs<TimeUnit> when) throws NetworkException
positions
in interface LaneBasedGTU<ID>
relativePosition
- the position on the vehicle relative to the reference point.when
- the future time for which to calculate the positions.NetworkException
- when the vehicle is not on one of the lanes on which it is registered.public final DoubleScalar.Rel<LengthUnit> position(Lane lane, RelativePosition relativePosition) throws NetworkException, RemoteException
position
in interface LaneBasedGTU<ID>
lane
- the position on this lane will be returned.relativePosition
- the position on the vehicle relative to the reference point.NetworkException
- when the vehicle is not on the given lane.RemoteException
- when simulator time cannot be retrieved.public final DoubleScalar.Rel<LengthUnit> projectedPosition(Lane projectionLane, RelativePosition relativePosition, DoubleScalar.Abs<TimeUnit> when) throws NetworkException
projectedPosition
in interface LaneBasedGTU<ID>
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 GTUNetworkException
- when projectionLane it not in any of the CrossSectionLink that the GTU is onpublic final DoubleScalar.Rel<LengthUnit> position(Lane lane, RelativePosition relativePosition, DoubleScalar.Abs<TimeUnit> when) throws NetworkException
position
in interface LaneBasedGTU<ID>
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.NetworkException
- when the vehicle is not on the given lane.public final Map<Lane,Double> fractionalPositions(RelativePosition relativePosition) throws NetworkException, RemoteException
fractionalPositions
in interface LaneBasedGTU<ID>
relativePosition
- the position on the vehicle relative to the reference point.NetworkException
- when the vehicle is not on one of the lanes on which it is registered.RemoteException
- when simulator time cannot be retrieved.public final Map<Lane,Double> fractionalPositions(RelativePosition relativePosition, DoubleScalar.Abs<TimeUnit> when) throws NetworkException
fractionalPositions
in interface LaneBasedGTU<ID>
relativePosition
- the position on the vehicle relative to the reference point.when
- the future time for which to calculate the positions.NetworkException
- when the vehicle is not on one of the lanes on which it is registered.public final double fractionalPosition(Lane lane, RelativePosition relativePosition, DoubleScalar.Abs<TimeUnit> when) throws NetworkException
fractionalPosition
in interface LaneBasedGTU<ID>
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.NetworkException
- when the vehicle is not on the given lane.public final double fractionalPosition(Lane lane, RelativePosition relativePosition) throws NetworkException, RemoteException
fractionalPosition
in interface LaneBasedGTU<ID>
lane
- the position on this lane will be returned.relativePosition
- the position on the vehicle relative to the reference point.NetworkException
- when the vehicle is not on the given lane.RemoteException
- when simulator time cannot be retrieved.public final HeadwayGTU headway(DoubleScalar.Rel<LengthUnit> maxDistance) throws RemoteException, NetworkException
headway
in interface LaneBasedGTU<ID>
maxDistance
- the maximum distance to look for the nearest GTU; positive values search forwards; negative values
search backwardsRemoteException
- when simulator time cannot be retrieved.NetworkException
- when there is an error with the next lanes in the network.public final HeadwayGTU headway(Lane lane, DoubleScalar.Rel<LengthUnit> maxDistance) throws RemoteException, NetworkException
new DoubleScalar.Rel(Double.MAX_VALUE, LengthUnit.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<ID>
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
backwardsRemoteException
- when simulator time cannot be retrievedNetworkException
- when the vehicle's route is inconclusive or vehicles are not registered correctly on their lanespublic final Set<LaneBasedGTU<?>> parallel(Lane lane, DoubleScalar.Abs<TimeUnit> when) throws RemoteException, NetworkException
parallel
in interface LaneBasedGTU<ID>
lane
- the lane to look for parallel (partial or full overlapping) GTUs.when
- the future time for which to calculate the headwayRemoteException
- when simulator time cannot be retrieved.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 final Set<LaneBasedGTU<?>> parallel(LateralDirectionality lateralDirection, DoubleScalar.Abs<TimeUnit> when) throws RemoteException, NetworkException
parallel
in interface LaneBasedGTU<ID>
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 headwayRemoteException
- when simulator time cannot be retrieved.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 final DoubleScalar.Abs<TimeUnit> timeAtDistance(DoubleScalar.Rel<LengthUnit> distance)
timeAtDistance
in interface LaneBasedGTU<ID>
distance
- DoubleScalar.Rel<LengthUnit>; the distancepublic final DoubleScalar.Rel<TimeUnit> deltaTimeForDistance(DoubleScalar.Rel<LengthUnit> distance)
deltaTimeForDistance
in interface LaneBasedGTU<ID>
distance
- DoubleScalar.Rel<LengthUnit>; the distancepublic void destroy()
public final GTUFollowingModel getGTUFollowingModel()
getGTUFollowingModel
in interface LaneBasedGTU<ID>
public final nl.tudelft.simulation.language.d3.DirectedPoint getLocation() throws RemoteException
getLocation
in interface nl.tudelft.simulation.dsol.animation.LocatableInterface
RemoteException
public final javax.media.j3d.Bounds getBounds() throws RemoteException
getBounds
in interface nl.tudelft.simulation.dsol.animation.LocatableInterface
RemoteException
public final String toString(Lane lane, DoubleScalar.Abs<TimeUnit> when)
lane
- the position on this lane will be returned.when
- DoubleScalarAbs<TimeUnit>; the timeCopyright © 2014–2015 Delft University of Technology. All rights reserved.