public class Lane extends CrossSectionElement
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 |
---|
Lane(CrossSectionLink<?,?> parentLink,
DoubleScalar.Rel<LengthUnit> lateralOffsetAtStart,
DoubleScalar.Rel<LengthUnit> lateralOffsetAtEnd,
DoubleScalar.Rel<LengthUnit> beginWidth,
DoubleScalar.Rel<LengthUnit> endWidth,
LaneType<?> laneType,
LongitudinalDirectionality directionality,
DoubleScalar.Abs<FrequencyUnit> capacity) |
Modifier and Type | Method and Description |
---|---|
Set<Lane> |
accessibleAdjacentLanes(LateralDirectionality lateralDirection,
GTUType<?> gtuType)
Determine the set of lanes to the left or to the right of this lane, which are accessible from this lane, or an
empty set if no lane could be found.
|
void |
addAccessibleAdjacentLane(Lane adjacentLane,
LateralDirectionality direction)
Indicate that a Lane is adjacent to this Lane.
|
int |
addGTU(LaneBasedGTU<?> gtu,
double fractionalPosition)
Add a LaneBasedGTU<?> to the list of this Lane.
|
int |
addGTU(LaneBasedGTU<?> gtu,
DoubleScalar.Rel<LengthUnit> longitudinalPosition)
Add a LaneBasedGTU<?> to the list of this Lane.
|
void |
addSampler(LaneBasedGTUSampler sampler)
Register a LaneBasedGTUSampler on this Lane.
|
void |
addSensor(Sensor sensor)
Insert the sensor at the right place in the sensor list of this lane.
|
Lane |
bestAccessibleAdjacentLane(LateralDirectionality lateralDirection,
DoubleScalar.Rel<LengthUnit> longitudinalPosition,
GTUType<?> gtuType)
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.
|
double |
fraction(DoubleScalar.Rel<LengthUnit> position)
Transform a position on the lane (can be less than zero or larger than the lane length) to a fraction.
|
double |
fractionSI(double positionSI)
Transform a position on the lane in SI units (can be less than zero or larger than the lane length) to a
fraction.
|
DoubleScalar.Abs<FrequencyUnit> |
getCapacity() |
LongitudinalDirectionality |
getDirectionality() |
LaneBasedGTU<?> |
getGtuAfter(DoubleScalar.Rel<LengthUnit> position,
RelativePosition.TYPE relativePosition,
DoubleScalar.Abs<TimeUnit> when) |
LaneBasedGTU<?> |
getGtuBefore(DoubleScalar.Rel<LengthUnit> position,
RelativePosition.TYPE relativePosition,
DoubleScalar.Abs<TimeUnit> when) |
List<LaneBasedGTU<?>> |
getGtuList() |
LaneType<?> |
getLaneType() |
protected SortedMap<Double,List<Sensor>> |
getSensors() |
List<Sensor> |
getSensors(DoubleScalar.Rel<LengthUnit> minimumPosition,
DoubleScalar.Rel<LengthUnit> maximumPosition)
Retrieve the list of Sensors of this Lane in the specified distance range.
|
protected double |
getZ() |
Set<Lane> |
nextLanes()
The next lane(s) are cached, as it is too expensive to make the calculation every time.
|
DoubleScalar.Rel<LengthUnit> |
position(double fraction)
Transform a fraction on the lane to a relative length (can be less than zero or larger than the lane length).
|
double |
positionSI(double fraction)
Transform a fraction on the lane to a relative length in SI units (can be less than zero or larger than the lane
length).
|
Set<Lane> |
prevLanes()
The previous lane(s) are cached, as it is too expensive to make the calculation every time.
|
void |
removeAccessibleAdjacentLane(Lane adjacentLane,
LateralDirectionality direction)
Indicate that a Lane is no longer adjacent to this Lane (may be useful for lanes that are sometimes closed, e.g.
|
void |
removeGTU(LaneBasedGTU<?> gtu)
Remove a GTU from the GTU list of this lane.
|
void |
removeSampler(LaneBasedGTUSampler sampler)
Unregister a LaneBasedGTUSampler from this Lane.
|
void |
removeSensor(Sensor sensor)
Remove a sensor from the sensor list of this lane.
|
void |
sample(AbstractLaneBasedGTU<?> gtu)
Add the movement of a GTU to all graphs that sample this Lane.
|
void |
scheduleTriggers(LaneBasedGTU<?> gtu,
double referenceStartSI,
double referenceMoveSI)
Trigger the sensors for a certain time step; from now until the nextEvaluationTime of the GTU.
|
void |
setCapacity(DoubleScalar.Abs<FrequencyUnit> capacity) |
String |
toString() |
getBounds, getCenterLine, getContour, getLateralBoundaryPosition, getLateralBoundaryPosition, getLateralCenterPosition, getLateralCenterPosition, getLength, getLocation, getParentLink, getWidth, getWidth, printCoordinate, printCoordinates, printCoordinates, printCoordinates, printCoordinates
public Lane(CrossSectionLink<?,?> parentLink, DoubleScalar.Rel<LengthUnit> lateralOffsetAtStart, DoubleScalar.Rel<LengthUnit> lateralOffsetAtEnd, DoubleScalar.Rel<LengthUnit> beginWidth, DoubleScalar.Rel<LengthUnit> endWidth, LaneType<?> laneType, LongitudinalDirectionality directionality, DoubleScalar.Abs<FrequencyUnit> capacity) throws NetworkException
parentLink
- Cross Section Link to which the element belongs.lateralOffsetAtStart
- DoubleScalar.Rel<LengthUnit>; the lateral offset of the design line of the new
CrossSectionLink with respect to the design line of the parent Link at the start of the parent LinklateralOffsetAtEnd
- DoubleScalar.Rel<LengthUnit>; the lateral offset of the design line of the new
CrossSectionLink with respect to the design line of the parent Link at the end of the parent LinkbeginWidth
- DoubleScalar.Rel<LengthUnit>; start width, positioned symmetrically around the
design lineendWidth
- DoubleScalar.Rel<LengthUnit>; end width, positioned symmetrically around the design
linelaneType
- type of lane to deduce compatibility with GTU typesdirectionality
- in direction of geometry, reverse, or bothcapacity
- Lane capacity in vehicles per time unit. This is a mutable property (e.g., blockage)NetworkException
- when creation of the geometry failspublic final void addAccessibleAdjacentLane(Lane adjacentLane, LateralDirectionality direction)
adjacentLane
- Lane; the adjacent Lanedirection
- LateralDirectionality; the direction in which the Lane is adjacent to this Lanepublic final void removeAccessibleAdjacentLane(Lane adjacentLane, LateralDirectionality direction) throws NetworkException
adjacentLane
- Lane; the adjacent Lane that must be unregistereddirection
- LateralDirectionality; the direction in which the Lane was adjacent to this LaneNetworkException
- when the adjacentLane was not registered as adjacent in the indicated directionpublic final void addSensor(Sensor sensor) throws NetworkException
sensor
- the sensor to addNetworkException
- when the position of the sensor is beyond (or before) the range of this Lanepublic final void removeSensor(Sensor sensor) throws NetworkException
sensor
- the sensor to remove.NetworkException
- when the sensor was not found on this Lanepublic final List<Sensor> getSensors(DoubleScalar.Rel<LengthUnit> minimumPosition, DoubleScalar.Rel<LengthUnit> maximumPosition)
minimumPosition
- DoubleScalar.Rel<LengthUnit>; the minimum distance on the LanemaximumPosition
- DoubleScalar.Rel<LengthUnit>; the maximum distance on the Lanepublic final void scheduleTriggers(LaneBasedGTU<?> gtu, double referenceStartSI, double referenceMoveSI) throws RemoteException, NetworkException, nl.tudelft.simulation.dsol.SimRuntimeException
gtu
- the LaneBasedGTU for which to trigger the sensors.referenceStartSI
- the SI distance of the GTU reference point on the lane at the current timereferenceMoveSI
- the SI distance traveled in the next time step.RemoteException
- when simulation time cannot be retrieved.NetworkException
- when GTU not on this lane.nl.tudelft.simulation.dsol.SimRuntimeException
- when method cannot be scheduled.public final DoubleScalar.Rel<LengthUnit> position(double fraction)
fraction
- fraction relative to the lane length.public final double positionSI(double fraction)
fraction
- fraction relative to the lane length.public final double fraction(DoubleScalar.Rel<LengthUnit> position)
position
- relative length on the lane (may be less than zero or larger than the lane length).public final double fractionSI(double positionSI)
positionSI
- relative length on the lane in SI units (may be less than zero or larger than the lane length).public final int addGTU(LaneBasedGTU<?> gtu, double fractionalPosition) throws RemoteException, NetworkException
gtu
- LaneBasedGTU<?>; the GTU to addfractionalPosition
- double; the fractional position that the newly added GTU will have on this LaneRemoteException
- on communication failureNetworkException
- when the fractionalPosition is outside the range 0..1, or the GTU is already registered
on this Lanepublic final int addGTU(LaneBasedGTU<?> gtu, DoubleScalar.Rel<LengthUnit> longitudinalPosition) throws RemoteException, NetworkException
gtu
- LaneBasedGTU<?>; the GTU to addlongitudinalPosition
- DoubleScalar.Rel<LengthUnit>; the longitudinal position that the newly added
GTU will have on this LaneRemoteException
- on communication failureNetworkException
- when longitudinalPosition is negative or exceeds the length of this Lanepublic final void removeGTU(LaneBasedGTU<?> gtu)
gtu
- the GTU to remove.public final LaneBasedGTU<?> getGtuAfter(DoubleScalar.Rel<LengthUnit> position, RelativePosition.TYPE relativePosition, DoubleScalar.Abs<TimeUnit> when) throws NetworkException
position
- the front position after which the relative position of a GTU will be searched.relativePosition
- the relative position of the GTU we are looking for.when
- the time for which to evaluate the positions.NetworkException
- when there is a problem with the position of the GTUs on the lane.public final LaneBasedGTU<?> getGtuBefore(DoubleScalar.Rel<LengthUnit> position, RelativePosition.TYPE relativePosition, DoubleScalar.Abs<TimeUnit> when) throws NetworkException
position
- the front position before which the relative position of a GTU will be searched.relativePosition
- the relative position of the GTU we are looking for.when
- the time for which to evaluate the positions.NetworkException
- when there is a problem with the position of the GTUs on the lane.public final Set<Lane> nextLanes()
public final Set<Lane> prevLanes()
public final Set<Lane> accessibleAdjacentLanes(LateralDirectionality lateralDirection, GTUType<?> gtuType)
lateralDirection
- LEFT or RIGHT.gtuType
- the type of GTU for which this an adjacent lane.public final Lane bestAccessibleAdjacentLane(LateralDirectionality lateralDirection, DoubleScalar.Rel<LengthUnit> longitudinalPosition, GTUType<?> gtuType)
lateralDirection
- LEFT or RIGHT.longitudinalPosition
- DoubleScalar.Rel<LengthUnit>; the position of the GTU along this LanegtuType
- the type of GTU for which this an adjacent lane.public final void addSampler(LaneBasedGTUSampler sampler)
sampler
- LaneBasedGTUSampler; the sampler to registerpublic final void removeSampler(LaneBasedGTUSampler sampler)
sampler
- LaneBasedGTUSampler; the sampler to unregisterpublic final void sample(AbstractLaneBasedGTU<?> gtu) throws RemoteException, NetworkException
gtu
- AbstractLaneBasedGTU<?>; the GTU to sampleNetworkException
- on network inconsistencyRemoteException
- on communications failurepublic final DoubleScalar.Abs<FrequencyUnit> getCapacity()
public final void setCapacity(DoubleScalar.Abs<FrequencyUnit> capacity)
capacity
- set capacity.public final LaneType<?> getLaneType()
public final LongitudinalDirectionality getDirectionality()
public final List<LaneBasedGTU<?>> getGtuList()
protected double getZ()
getZ
in class CrossSectionElement
public final String toString()
toString
in class CrossSectionElement
Copyright © 2014–2015 Delft University of Technology. All rights reserved.