public class Lane extends CrossSectionElement implements Serializable, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR
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-08-30 01:31:13 +0200 (Sun, 30 Aug 2015) $, @version $Revision: 1342 $, by $Author: averbraeck $,
initial version Aug 19, 2014
org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Acceleration, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.AnglePlane, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.AngleSlope, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.AngleSolid, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Area, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Density, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.ElectricalCharge, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.ElectricalCurrent, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.ElectricalPotential, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.ElectricalResistance, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Energy, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Length, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Speed, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.TimebeginWidth, designLineOffsetAtBegin, designLineOffsetAtEnd, endWidth, length, parentLinkABAMPERE, ABCOULOMB, ABVOLT, ACRE, AMPERE, ARCMINUTE, ARCSECOND, ARE, ATOMIC_UNIT, BTU_ISO, BTU_IT, CALORIE_IT, CENTESIMAL_ARCMINUTE, CENTESIMAL_ARCSECOND, CENTIMETER, CM, CM_2, COULOMB, DAM, DAY, DECIMETER, DEG, DEGREE, DEKAMETER, DM, ELECTRONVOLT, EMU, ERG, ESU, EXA_ELECTRONVOLT, FARADAY, FOOT, FOOT_PER_SECOND, FOOT_PER_SECOND_2, FOOT_POUND_FORCE, FRANKLIN, FT, FT_2, FTPS, FTPS_2, G, GAL, GIGA_ELECTRONVOLT, GIGAWATT_HOUR, GRAD, GRAM_PER_CENTIMETER_3, HECTARE, HECTOMETER, HM, HOUR, HR, IN, IN_2, INCH, INCH_PER_SECOND_2, INCH_POUND_FORCE, INPS_2, JOULE, KG_PER_METER_3, KILO_ELECTRONVOLT, KILOAMPERE, KILOCALORIE, KILOMETER, KILOOHM, KILOVOLT, KILOWATT_HOUR, KM, KM_PER_HOUR, KM_PER_HOUR_2, KMPH, KMPH_2, KNOT, KNOT_PER_SECOND, M, M_2, MEGA_ELECTRONVOLT, MEGAOHM, MEGAVOLT, MEGAWATT_HOUR, METER, METER_PER_SECOND, METER_PER_SECOND_2, MI, MI_2, MICROAMPERE, MICROVOLT, MICROWATT_HOUR, MILE, MILE_PER_HOUR, MILE_PER_HOUR_2, MILE_PER_HOUR_PER_SECOND, MILLI_ELECTRONVOLT, MILLIAMPERE, MILLIAMPERE_HOUR, MILLIMETER, MILLIOHM, MILLISECOND, MILLIVOLT, MILLIWATT_HOUR, MIN, MINUTE, MM, MM_2, MPH, MPH_2, MPHPS, MPS, MPS_2, MS, NANOAMPERE, NAUTICAL_MILE, NM, OHM, PETA_ELECTRONVOLT, RAD, RADIAN, S, SECOND, SLOPE_ARCMINUTE, SLOPE_ARCSECOND, SLOPE_CENTESIMAL_ARCMINUTE, SLOPE_CENTESIMAL_ARCSECOND, SLOPE_DEGREE, SLOPE_GRAD, SLOPE_RADIAN, SQUARE_CENTIMETER, SQUARE_DEGREE, SQUARE_FOOT, SQUARE_INCH, SQUARE_METER, SQUARE_MILE, SQUARE_MILLIMETER, SQUARE_YARD, STANDARD_GRAVITY, STATAMPERE, STATCOULOMB, STATVOLT, STERADIAN, STHENE_METER, TERA_ELECTRONVOLT, TERAWATT_HOUR, VOLT, WATT_HOUR, WEEK, WK, YARD, YD, YD_2| Constructor and Description |
|---|
Lane(CrossSectionLink parentLink,
String id,
org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> lateralOffsetAtStart,
org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> lateralOffsetAtEnd,
org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> beginWidth,
org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> endWidth,
LaneType laneType,
LongitudinalDirectionality directionality,
org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.SpeedUnit> speedLimit) |
Lane(CrossSectionLink parentLink,
String id,
org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> lateralOffsetAtStart,
org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> lateralOffsetAtEnd,
org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> beginWidth,
org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> endWidth,
LaneType laneType,
Map<GTUType,LongitudinalDirectionality> directionalityMap,
Map<GTUType,org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.SpeedUnit>> speedLimitMap) |
| 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.
|
int |
addGTU(LaneBasedGTU gtu,
double fractionalPosition)
Add a LaneBasedGTU to the list of this Lane.
|
int |
addGTU(LaneBasedGTU gtu,
org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.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,
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.DoubleScalar.Rel<org.djunits.unit.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.
|
LongitudinalDirectionality |
getDirectionality(GTUType gtuType) |
LaneBasedGTU |
getGtuAfter(org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> position,
RelativePosition.TYPE relativePosition,
org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.TimeUnit> when) |
LaneBasedGTU |
getGtuBefore(org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> position,
RelativePosition.TYPE relativePosition,
org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.TimeUnit> when) |
List<LaneBasedGTU> |
getGtuList() |
LaneType |
getLaneType() |
List<Sensor> |
getSensors(org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> minimumPosition,
org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> maximumPosition,
GTUType gtuType)
Retrieve the list of Sensors of this Lane in the specified distance range for the given GTUType.
|
SortedMap<Double,List<Sensor>> |
getSensors(GTUType gtuType)
Retrieve the list of Sensors of this Lane for the given GTUType.
|
org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.SpeedUnit> |
getSpeedLimit(GTUType gtuType) |
protected double |
getZ() |
int |
hashCode() |
Set<Lane> |
nextLanes(GTUType gtuType)
The next lane(s) are cached, as it is too expensive to make the calculation every time.
|
org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.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(GTUType gtuType)
The previous lane(s) are cached, as it is too expensive to make the calculation every time.
|
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.
|
String |
toString() |
getBeginWidth, getBounds, getCenterLine, getContour, getDesignLineOffsetAtBegin, getDesignLineOffsetAtEnd, getEndWidth, getId, getLateralBoundaryPosition, getLateralBoundaryPosition, getLateralCenterPosition, getLateralCenterPosition, getLength, getLocation, getParentLink, getWidth, getWidthpublic Lane(CrossSectionLink parentLink, String id, org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> lateralOffsetAtStart, org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> lateralOffsetAtEnd, org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> beginWidth, org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> endWidth, LaneType laneType, Map<GTUType,LongitudinalDirectionality> directionalityMap, Map<GTUType,org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.SpeedUnit>> speedLimitMap) throws OTSGeometryException, 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 TypeOTSGeometryException - when creation of the center line or contour geometry failsNetworkException - when id equal to null or not uniquepublic Lane(CrossSectionLink parentLink, String id, org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> lateralOffsetAtStart, org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> lateralOffsetAtEnd, org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> beginWidth, org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> endWidth, LaneType laneType, LongitudinalDirectionality directionality, org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.SpeedUnit> speedLimit) throws OTSGeometryException, 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 laneOTSGeometryException - when creation of the center line or contour geometry failsNetworkException - when id equal to null or not uniquepublic final void addSensor(Sensor sensor, GTUType gtuType) throws NetworkException
sensor - the sensor to addgtuType - the GTU type that triggers this sensor; use GTUType.ALL is all GTUs trigger itNetworkException - 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(org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> minimumPosition, org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> maximumPosition, GTUType gtuType)
minimumPosition - DoubleScalar.Rel<LengthUnit>; the minimum distance on the LanemaximumPosition - DoubleScalar.Rel<LengthUnit>; the maximum distance on the LanegtuType - the GTU type to provide the sensors forpublic final SortedMap<Double,List<Sensor>> getSensors(GTUType gtuType)
gtuType - the GTU type to provide the sensors forpublic final void scheduleTriggers(LaneBasedGTU gtu, double referenceStartSI, double referenceMoveSI) throws RemoteException, NetworkException, 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.SimRuntimeException - when method cannot be scheduled.public final org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.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(org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.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, org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.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(org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> position, RelativePosition.TYPE relativePosition, org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.TimeUnit> when) throws NetworkException, RemoteException
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.RemoteException - on communications failurepublic final LaneBasedGTU getGtuBefore(org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> position, RelativePosition.TYPE relativePosition, org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.TimeUnit> when) throws NetworkException, RemoteException
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.RemoteException - on communications failurepublic final Set<Lane> nextLanes(GTUType gtuType)
gtuType - the GTU type for which we return the next lanes.public final Set<Lane> prevLanes(GTUType gtuType)
gtuType - the GTU type for which we return the next lanes.public final Set<Lane> accessibleAdjacentLanes(LateralDirectionality lateralDirection, 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 RemoteException, NetworkException
gtu - AbstractLaneBasedGTU; the GTU to sampleNetworkException - on network inconsistencyRemoteException - on communications failurepublic final org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.SpeedUnit> getSpeedLimit(GTUType gtuType)
gtuType - the GTU type to provide the speed limit forpublic final LaneType getLaneType()
public final LongitudinalDirectionality getDirectionality(GTUType gtuType)
gtuType - the GTU type to provide the directionality forpublic final List<LaneBasedGTU> getGtuList()
protected double getZ()
getZ in class CrossSectionElementpublic final String toString()
toString in class CrossSectionElementpublic int hashCode()
hashCode in class CrossSectionElementpublic boolean equals(Object obj)
equals in class CrossSectionElementCopyright © 2014–2015 Delft University of Technology. All rights reserved.