public class Lane extends CrossSectionElement implements Serializable
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.
$LastChangedDate: 2015-09-24 14:17:07 +0200 (Thu, 24 Sep 2015) $, @version $Revision: 1407 $, by $Author: averbraeck $,
initial version Aug 19, 2014
Modifier and Type | Field and Description |
---|---|
(package private) static org.djunits.value.vdouble.scalar.Length.Rel |
ADJACENT_MARGIN
Lateral alignment margin for longitudinally connected Lanes.
|
(package private) static org.djunits.value.vdouble.scalar.Length.Rel |
LATERAL_MARGIN
Lateral alignment margin for longitudinally connected Lanes.
|
beginWidth, designLineOffsetAtBegin, designLineOffsetAtEnd, endWidth, length, parentLink
Constructor and Description |
---|
Lane(CrossSectionLink parentLink,
String id,
org.djunits.value.vdouble.scalar.Length.Rel lateralOffsetAtStart,
org.djunits.value.vdouble.scalar.Length.Rel lateralOffsetAtEnd,
org.djunits.value.vdouble.scalar.Length.Rel beginWidth,
org.djunits.value.vdouble.scalar.Length.Rel endWidth,
LaneType laneType,
org.opentrafficsim.core.network.LongitudinalDirectionality directionality,
org.djunits.value.vdouble.scalar.Speed speedLimit,
OvertakingConditions overtakingConditions) |
Lane(CrossSectionLink parentLink,
String id,
org.djunits.value.vdouble.scalar.Length.Rel lateralOffsetAtStart,
org.djunits.value.vdouble.scalar.Length.Rel lateralOffsetAtEnd,
org.djunits.value.vdouble.scalar.Length.Rel beginWidth,
org.djunits.value.vdouble.scalar.Length.Rel endWidth,
LaneType laneType,
Map<org.opentrafficsim.core.gtu.GTUType,org.opentrafficsim.core.network.LongitudinalDirectionality> directionalityMap,
Map<org.opentrafficsim.core.gtu.GTUType,org.djunits.value.vdouble.scalar.Speed> speedLimitMap,
OvertakingConditions overtakingConditions) |
Modifier and Type | Method and Description |
---|---|
Set<Lane> |
accessibleAdjacentLanes(org.opentrafficsim.core.network.LateralDirectionality lateralDirection,
org.opentrafficsim.core.gtu.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 |
addDirectionality(org.opentrafficsim.core.gtu.GTUType gtuType,
org.opentrafficsim.core.network.LongitudinalDirectionality directionality)
This method sets the directionality of the lane for a GTU type.
|
int |
addGTU(LaneBasedGTU gtu,
double fractionalPosition)
Add a LaneBasedGTU to the list of this Lane.
|
int |
addGTU(LaneBasedGTU gtu,
org.djunits.value.vdouble.scalar.Length.Rel longitudinalPosition)
Add a LaneBasedGTU to the list of this Lane.
|
void |
addSampler(LaneBasedGTUSampler sampler)
Register a LaneBasedGTUSampler on this Lane.
|
void |
addSensor(Sensor sensor,
org.opentrafficsim.core.gtu.GTUType gtuType)
Insert the sensor at the right place in the sensor list of this lane.
|
boolean |
equals(Object obj) |
double |
fraction(org.djunits.value.vdouble.scalar.Length.Rel 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.
|
org.opentrafficsim.core.network.LongitudinalDirectionality |
getDirectionality(org.opentrafficsim.core.gtu.GTUType gtuType)
The direction in which vehicles can drive, i.e., in direction of geometry, reverse, or both.
|
LaneBasedGTU |
getGtuAfter(org.djunits.value.vdouble.scalar.Length.Rel position,
org.opentrafficsim.core.gtu.RelativePosition.TYPE relativePosition,
org.djunits.value.vdouble.scalar.Time.Abs when) |
LaneBasedGTU |
getGtuBefore(org.djunits.value.vdouble.scalar.Length.Rel position,
org.opentrafficsim.core.gtu.RelativePosition.TYPE relativePosition,
org.djunits.value.vdouble.scalar.Time.Abs when) |
List<LaneBasedGTU> |
getGtuList() |
LaneType |
getLaneType() |
OvertakingConditions |
getOvertakingConditions() |
SortedMap<Double,List<Sensor>> |
getSensorMap(org.opentrafficsim.core.gtu.GTUType gtuType)
Retrieve the list of Sensors of this Lane for the given GTUType.
|
List<Sensor> |
getSensors()
Retrieve the list of all Sensors of this Lane.
|
List<Sensor> |
getSensors(org.opentrafficsim.core.gtu.GTUType gtuType)
Retrieve the list of Sensors of this Lane that are triggered by the given GTUType.
|
List<Sensor> |
getSensors(org.djunits.value.vdouble.scalar.Length.Rel minimumPosition,
org.djunits.value.vdouble.scalar.Length.Rel maximumPosition,
org.opentrafficsim.core.gtu.GTUType gtuType)
Retrieve the list of Sensors of this Lane in the specified distance range for the given GTUType.
|
org.djunits.value.vdouble.scalar.Speed |
getSpeedLimit(org.opentrafficsim.core.gtu.GTUType gtuType)
Get the speed limit of this lane, which can differ per GTU type.
|
protected double |
getZ() |
int |
hashCode() |
Set<Lane> |
nextLanes(org.opentrafficsim.core.gtu.GTUType gtuType)
The next lane(s) are cached, as it is too expensive to make the calculation every time.
|
org.djunits.value.vdouble.scalar.Length.Rel |
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(org.opentrafficsim.core.gtu.GTUType gtuType)
The previous lane(s) are cached, as it is too expensive to make the calculation every time.
|
void |
removeDirectionality(org.opentrafficsim.core.gtu.GTUType gtuType)
This method removes an earlier provided directionality of the lane for a given GTU type, 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 |
removeSpeedLimit(org.opentrafficsim.core.gtu.GTUType gtuType)
Remove the set speed limit for a GTUType.
|
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 |
setSpeedLimit(org.opentrafficsim.core.gtu.GTUType gtuType,
org.djunits.value.vdouble.scalar.Speed speedLimit)
Set the speed limit of this lane, which can differ per GTU type.
|
String |
toString() |
constructContour, getBeginWidth, getBounds, getCenterLine, getContour, getDesignLineOffsetAtBegin, getDesignLineOffsetAtEnd, getEndWidth, getId, getLateralBoundaryPosition, getLateralBoundaryPosition, getLateralCenterPosition, getLateralCenterPosition, getLength, getLocation, getParentLink, getWidth, getWidth
static final org.djunits.value.vdouble.scalar.Length.Rel ADJACENT_MARGIN
static final org.djunits.value.vdouble.scalar.Length.Rel LATERAL_MARGIN
public Lane(CrossSectionLink parentLink, String id, org.djunits.value.vdouble.scalar.Length.Rel lateralOffsetAtStart, org.djunits.value.vdouble.scalar.Length.Rel lateralOffsetAtEnd, org.djunits.value.vdouble.scalar.Length.Rel beginWidth, org.djunits.value.vdouble.scalar.Length.Rel endWidth, LaneType laneType, Map<org.opentrafficsim.core.gtu.GTUType,org.opentrafficsim.core.network.LongitudinalDirectionality> directionalityMap, Map<org.opentrafficsim.core.gtu.GTUType,org.djunits.value.vdouble.scalar.Speed> speedLimitMap, OvertakingConditions overtakingConditions) throws org.opentrafficsim.core.geometry.OTSGeometryException, org.opentrafficsim.core.network.NetworkException
parentLink
- Cross Section Link to which the element belongs.id
- the id of this lane within the link; should be unique within the link.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 typesdirectionalityMap
- in direction of geometry, reverse, or both, specified per GTU TypespeedLimitMap
- speed limit on this lane, specified per GTU TypeovertakingConditions
- the conditions for overtaking another GTU, viewed from this laneorg.opentrafficsim.core.geometry.OTSGeometryException
- when creation of the center line or contour geometry failsorg.opentrafficsim.core.network.NetworkException
- when id equal to null or not uniquepublic Lane(CrossSectionLink parentLink, String id, org.djunits.value.vdouble.scalar.Length.Rel lateralOffsetAtStart, org.djunits.value.vdouble.scalar.Length.Rel lateralOffsetAtEnd, org.djunits.value.vdouble.scalar.Length.Rel beginWidth, org.djunits.value.vdouble.scalar.Length.Rel endWidth, LaneType laneType, org.opentrafficsim.core.network.LongitudinalDirectionality directionality, org.djunits.value.vdouble.scalar.Speed speedLimit, OvertakingConditions overtakingConditions) throws org.opentrafficsim.core.geometry.OTSGeometryException, org.opentrafficsim.core.network.NetworkException
parentLink
- Cross Section Link to which the element belongs.id
- the id of this lane within the link; should be unique within the link.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 bothspeedLimit
- speed limit on this laneovertakingConditions
- the conditions for overtaking another GTU, viewed from this laneorg.opentrafficsim.core.geometry.OTSGeometryException
- when creation of the center line or contour geometry failsorg.opentrafficsim.core.network.NetworkException
- when id equal to null or not uniquepublic final void addSensor(Sensor sensor, org.opentrafficsim.core.gtu.GTUType gtuType) throws org.opentrafficsim.core.network.NetworkException
sensor
- the sensor to addgtuType
- the GTU type that triggers this sensor; use GTUType.ALL is all GTUs trigger itorg.opentrafficsim.core.network.NetworkException
- when the position of the sensor is beyond (or before) the range of this Lanepublic final void removeSensor(Sensor sensor) throws org.opentrafficsim.core.network.NetworkException
sensor
- the sensor to remove.org.opentrafficsim.core.network.NetworkException
- when the sensor was not found on this Lanepublic final List<Sensor> getSensors(org.djunits.value.vdouble.scalar.Length.Rel minimumPosition, org.djunits.value.vdouble.scalar.Length.Rel maximumPosition, org.opentrafficsim.core.gtu.GTUType gtuType)
minimumPosition
- DoubleScalar.Rel<LengthUnit>; the minimum distance on the Lane (exclusive)maximumPosition
- DoubleScalar.Rel<LengthUnit>; the maximum distance on the Lane (inclusive)gtuType
- the GTU type to provide the sensors forpublic final List<Sensor> getSensors(org.opentrafficsim.core.gtu.GTUType gtuType)
gtuType
- the GTU type to provide the sensors forpublic final List<Sensor> getSensors()
public final SortedMap<Double,List<Sensor>> getSensorMap(org.opentrafficsim.core.gtu.GTUType gtuType)
gtuType
- the GTU type to provide the sensors forpublic final void scheduleTriggers(LaneBasedGTU gtu, double referenceStartSI, double referenceMoveSI) throws org.opentrafficsim.core.network.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.org.opentrafficsim.core.network.NetworkException
- when GTU not on this lane.nl.tudelft.simulation.dsol.SimRuntimeException
- when method cannot be scheduled.public final org.djunits.value.vdouble.scalar.Length.Rel 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(org.djunits.value.vdouble.scalar.Length.Rel 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 org.opentrafficsim.core.network.NetworkException
gtu
- LaneBasedGTU; the GTU to addfractionalPosition
- double; the fractional position that the newly added GTU will have on this Laneorg.opentrafficsim.core.network.NetworkException
- when the fractionalPosition is outside the range 0..1, or the GTU is already registered on this
Lanepublic final int addGTU(LaneBasedGTU gtu, org.djunits.value.vdouble.scalar.Length.Rel longitudinalPosition) throws org.opentrafficsim.core.network.NetworkException
gtu
- LaneBasedGTU; the GTU to addlongitudinalPosition
- DoubleScalar.Rel<LengthUnit>; the longitudinal position that the newly added GTU will
have on this Laneorg.opentrafficsim.core.network.NetworkException
- 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(org.djunits.value.vdouble.scalar.Length.Rel position, org.opentrafficsim.core.gtu.RelativePosition.TYPE relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws org.opentrafficsim.core.network.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.org.opentrafficsim.core.network.NetworkException
- when there is a problem with the position of the GTUs on the lane.public final LaneBasedGTU getGtuBefore(org.djunits.value.vdouble.scalar.Length.Rel position, org.opentrafficsim.core.gtu.RelativePosition.TYPE relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws org.opentrafficsim.core.network.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.org.opentrafficsim.core.network.NetworkException
- when there is a problem with the position of the GTUs on the lane.public final Set<Lane> nextLanes(org.opentrafficsim.core.gtu.GTUType gtuType)
gtuType
- the GTU type for which we return the next lanes.public final Set<Lane> prevLanes(org.opentrafficsim.core.gtu.GTUType gtuType)
gtuType
- the GTU type for which we return the next lanes.public final Set<Lane> accessibleAdjacentLanes(org.opentrafficsim.core.network.LateralDirectionality lateralDirection, org.opentrafficsim.core.gtu.GTUType gtuType)
lateralDirection
- LEFT or RIGHT.gtuType
- the type of GTU for which to return the adjacent lanes.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 org.opentrafficsim.core.network.NetworkException
gtu
- AbstractLaneBasedGTU; the GTU to sampleorg.opentrafficsim.core.network.NetworkException
- on network inconsistencypublic final org.djunits.value.vdouble.scalar.Speed getSpeedLimit(org.opentrafficsim.core.gtu.GTUType gtuType) throws org.opentrafficsim.core.network.NetworkException
gtuType
- the GTU type to provide the speed limit fororg.opentrafficsim.core.network.NetworkException
public final void setSpeedLimit(org.opentrafficsim.core.gtu.GTUType gtuType, org.djunits.value.vdouble.scalar.Speed speedLimit)
gtuType
- the GTU type to provide the speed limit forspeedLimit
- the speed limit for this gtu typepublic final void removeSpeedLimit(org.opentrafficsim.core.gtu.GTUType gtuType)
gtuType
- the GTU type to provide the speed limit forpublic final LaneType getLaneType()
public final org.opentrafficsim.core.network.LongitudinalDirectionality getDirectionality(org.opentrafficsim.core.gtu.GTUType gtuType)
gtuType
- the GTU type to provide the directionality forpublic void addDirectionality(org.opentrafficsim.core.gtu.GTUType gtuType, org.opentrafficsim.core.network.LongitudinalDirectionality directionality) throws org.opentrafficsim.core.network.NetworkException
gtuType
- the GTU type to set the directionality for.directionality
- the longitudinal directionality of the link (FORWARD, BACKWARD, BOTH or NONE) for the given GTU
type.org.opentrafficsim.core.network.NetworkException
- when the lane directionality for the given GTUType is inconsistent with the Link directionality
to which the lane belongs.public void removeDirectionality(org.opentrafficsim.core.gtu.GTUType gtuType)
gtuType
- the GTU type to remove the directionality for on this lane.public final List<LaneBasedGTU> getGtuList()
protected double getZ()
getZ
in class CrossSectionElement
public final OvertakingConditions getOvertakingConditions()
public final String toString()
toString
in class CrossSectionElement
public int hashCode()
hashCode
in class CrossSectionElement
public boolean equals(Object obj)
equals
in class CrossSectionElement
Copyright © 2014–2015 Delft University of Technology. All rights reserved.