public abstract class AbstractTrafficLight extends 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.
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.Dimensionless, 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.FlowMass, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.FlowVolume, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Force, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Frequency, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Length, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.LinearDensity, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Mass, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Power, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Pressure, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Speed, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Temperature, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Time, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Torque, org.djunits.value.vdouble.scalar.DOUBLE_SCALAR.Volume| Modifier and Type | Field and Description |
|---|---|
static GTUType |
BLOCK_GTU
blocking GTU type.
|
ABAMPERE, ABCOULOMB, ABVOLT, ACRE, AMPERE, ARCMINUTE, ARCSECOND, ARE, ATMOSPHERE_STANDARD, ATMOSPHERE_TECHNICAL, ATOMIC_UNIT, BAR, BARYE, BTU_ISO, BTU_IT, CALORIE_IT, CENTESIMAL_ARCMINUTE, CENTESIMAL_ARCSECOND, CENTIMETER, CENTIMETER_MERCURY, COULOMB, CUBIC_CENTIMETER, CUBIC_DECIMETER, CUBIC_FEET_PER_MINUTE, CUBIC_FEET_PER_SECOND, CUBIC_FOOT, CUBIC_INCH, CUBIC_INCH_PER_MINUTE, CUBIC_INCH_PER_SECOND, CUBIC_KM, CUBIC_METER, CUBIC_METER_PER_DAY, CUBIC_METER_PER_HOUR, CUBIC_METER_PER_MINUTE, CUBIC_METER_PER_SECOND, CUBIC_MILE, CUBIC_YARD, DALTON, DAY, DECIMETER, DEG, DEGREE, DEGREE_CELSIUS, DEGREE_FAHRENHEIT, DEGREE_RANKINE, DEGREE_REAUMUR, DEKAMETER, DYNE, ELECTRONVOLT, EMU, ERG, ERG_PER_SECOND, ESU, EXA_ELECTRONVOLT, FARADAY, FOOT, FOOT_MERCURY, FOOT_PER_SECOND, FOOT_PER_SECOND_2, FOOT_POUND_FORCE, FOOT_POUND_FORCE_PER_HOUR, FOOT_POUND_FORCE_PER_MINUTE, FOOT_POUND_FORCE_PER_SECOND, FRANKLIN, GAL, GALLON_IMP, GALLON_PER_DAY, GALLON_PER_HOUR, GALLON_PER_MINUTE, GALLON_PER_SECOND, GALLON_US_FLUID, GIGA_ELECTRONVOLT, GIGAHERTZ, GIGAWATT, GIGAWATT_HOUR, GRAD, GRAM, GRAM_PER_CENTIMETER_3, HECTARE, HECTOMETER, HECTOPASCAL, HERTZ, HORSEPOWER_METRIC, HOUR, INCH, INCH_MERCURY, INCH_PER_SECOND_2, INCH_POUND_FORCE, JOULE, KELVIN, KG_PER_METER_3, KGF_PER_SQUARE_MM, KILO_ELECTRONVOLT, KILOAMPERE, KILOCALORIE, KILOGRAM, KILOGRAM_FORCE, KILOGRAM_PER_SECOND, KILOHERTZ, KILOMETER, KILOOHM, KILOPASCAL, KILOVOLT, KILOWATT, KILOWATT_HOUR, KM_PER_HOUR, KM_PER_HOUR_2, KNOT, KNOT_PER_SECOND, LITER, LITER_PER_DAY, LITER_PER_HOUR, LITER_PER_MINUTE, LITER_PER_SECOND, MEGA_ELECTRONVOLT, MEGAHERTZ, MEGAOHM, MEGAVOLT, MEGAWATT, MEGAWATT_HOUR, METER, METER_KILOGRAM_FORCE, METER_PER_SECOND, METER_PER_SECOND_2, MICROAMPERE, MICROVOLT, MICROWATT_HOUR, MILE, MILE_PER_HOUR, MILE_PER_HOUR_2, MILE_PER_HOUR_PER_SECOND, MILLI_ELECTRONVOLT, MILLIAMPERE, MILLIAMPERE_HOUR, MILLIBAR, MILLIMETER, MILLIMETER_MERCURY, MILLIOHM, MILLISECOND, MILLIVOLT, MILLIWATT_HOUR, MINUTE, NANOAMPERE, NAUTICAL_MILE, NEWTON, NEWTON_METER, OHM, OUNCE, OUNCE_FORCE, OUNCE_IMP_FLUID, OUNCE_US_FLUID, PASCAL, PER_CENTIMETER, PER_DAY, PER_DECIMETER, PER_DEKAMETER, PER_FOOT, PER_HECTOMETER, PER_HOUR, PER_INCH, PER_KILOMETER, PER_METER, PER_MILE, PER_MILLIMETER, PER_MILLISECOND, PER_MINUTE, PER_NAUTICAL_MILE, PER_SECOND, PER_WEEK, PER_YARD, PETA_ELECTRONVOLT, PIEZE, PINT_IMP, PINT_US_FLUID, POUND, POUND_FOOT, POUND_FORCE, POUND_INCH, POUND_PER_SECOND, POUND_PER_SQUARE_FOOT, POUND_PER_SQUARE_INCH, QUART_IMP, QUART_US_FLUID, RAD, RADIAN, RPM, 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, STHENE_METER, STHENE_METER_PER_SECOND, TERA_ELECTRONVOLT, TERAHERTZ, TERAWATT_HOUR, TON_FORCE, TON_LONG, TON_METRIC, TON_SHORT, TONNE, TORR, VOLT, WATT, WATT_HOUR, WEEK, YARD| Constructor and Description |
|---|
AbstractTrafficLight(String name,
Lane lane,
org.djunits.value.vdouble.scalar.Length.Rel position,
OTSDEVSSimulatorInterface simulator) |
| Modifier and Type | Method and Description |
|---|---|
Lane |
bestAccessibleAdjacentLane(Lane currentLane,
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()
destroy the vehicle from the simulation and animation.
|
void |
enterLane(Lane lane,
org.djunits.value.vdouble.scalar.Length.Rel position)
insert GTU at a certain position.
|
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,
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(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,
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.Abs |
getAcceleration() |
org.djunits.value.vdouble.scalar.Acceleration.Abs |
getAcceleration(org.djunits.value.vdouble.scalar.Time.Abs when) |
Bounds |
getBounds() |
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.Abs |
getLateralVelocity() |
org.djunits.value.vdouble.scalar.Length.Rel |
getLength() |
DirectedPoint |
getLocation() |
org.djunits.value.vdouble.scalar.Speed.Abs |
getLongitudinalVelocity()
v(t) = v0 + (t - t0) * a.
|
org.djunits.value.vdouble.scalar.Speed.Abs |
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.Abs |
getMaximumVelocity() |
org.djunits.value.vdouble.scalar.Time.Abs |
getNextEvaluationTime() |
org.djunits.value.vdouble.scalar.Length.Abs |
getOdometer() |
RelativePosition |
getRear() |
Map<RelativePosition.TYPE,RelativePosition> |
getRelativePositions() |
OTSDEVSSimulatorInterface |
getSimulator() |
org.djunits.value.vdouble.scalar.Speed.Abs |
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.
|
boolean |
isBlocked() |
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(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,
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,
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(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(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,
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.
|
void |
setBlocked(boolean blocked) |
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, setRouteNavigatorclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetGTUType, getId, getReferencepublic static final GTUType BLOCK_GTU
public AbstractTrafficLight(String name, Lane lane, org.djunits.value.vdouble.scalar.Length.Rel position, OTSDEVSSimulatorInterface simulator) throws GTUException, NetworkException, NamingException
name - the name or id of the traffic lightlane - The lane where the block has to be putposition - the position on the lane as a lengthsimulator - the simulator to avoid NullPointerExceptionsGTUException - when GTU cannot be created.NamingException - if an error occurs when adding the animation handlerNetworkException - when the GTU cannot be placed on the given lanepublic final void setBlocked(boolean blocked)
blocked - set blockedpublic final boolean isBlocked()
public final Lane getLane()
public final org.djunits.value.vdouble.scalar.Length.Rel getLength()
public final org.djunits.value.vdouble.scalar.Length.Rel getWidth()
public final org.djunits.value.vdouble.scalar.Speed.Abs getMaximumVelocity()
getMaximumVelocity in interface GTUpublic final OTSDEVSSimulatorInterface getSimulator()
getSimulator in interface GTUpublic final RelativePosition getFront()
public final RelativePosition getRear()
public final org.djunits.value.vdouble.scalar.Speed.Abs getVelocity()
getVelocity in interface GTUpublic final Map<RelativePosition.TYPE,RelativePosition> getRelativePositions()
getRelativePositions in interface GTUpublic final void destroy()
public final org.djunits.value.vdouble.scalar.Acceleration.Abs getAcceleration()
getAcceleration in interface GTUgetAcceleration in interface LaneBasedGTUpublic final DirectedPoint getLocation()
getLocation in interface LocatableInterfacegetLocation in interface GTUpublic final Bounds getBounds()
getBounds in interface LocatableInterfacegetBounds in interface GTUpublic final org.djunits.value.vdouble.scalar.Length.Abs getOdometer()
getOdometer in interface GTUpublic final org.djunits.value.vdouble.scalar.Speed.Abs getLongitudinalVelocity()
getLongitudinalVelocity in interface LaneBasedGTUpublic final org.djunits.value.vdouble.scalar.Speed.Abs getLongitudinalVelocity(org.djunits.value.vdouble.scalar.Time.Abs when)
getLongitudinalVelocity in interface LaneBasedGTUwhen - time for which the speed must be returnedpublic final org.djunits.value.vdouble.scalar.Acceleration.Abs getAcceleration(org.djunits.value.vdouble.scalar.Time.Abs when)
getAcceleration in interface LaneBasedGTUwhen - time for which the speed must be returnedpublic final org.djunits.value.vdouble.scalar.Speed.Abs getLateralVelocity()
getLateralVelocity in interface LaneBasedGTUpublic final org.djunits.value.vdouble.scalar.Time.Abs getLastEvaluationTime()
getLastEvaluationTime in interface LaneBasedGTUpublic final org.djunits.value.vdouble.scalar.Time.Abs getNextEvaluationTime()
getNextEvaluationTime in interface LaneBasedGTUpublic final void enterLane(Lane lane, org.djunits.value.vdouble.scalar.Length.Rel position) throws NetworkException
enterLane in interface LaneBasedGTUlane - the lane to add to the list of lanes on which the GTU is registered.position - the position on the lane.NetworkException - on network inconsistencypublic final void leaveLane(Lane lane)
leaveLane in interface LaneBasedGTUlane - 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(RelativePosition relativePosition) throws NetworkException
positions in interface LaneBasedGTUrelativePosition - 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.public final Map<Lane,org.djunits.value.vdouble.scalar.Length.Rel> positions(RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws NetworkException
positions in interface LaneBasedGTUrelativePosition - 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 org.djunits.value.vdouble.scalar.Length.Rel position(Lane lane, RelativePosition relativePosition) throws NetworkException
position in interface LaneBasedGTUlane - 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.public final org.djunits.value.vdouble.scalar.Length.Rel position(Lane lane, RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws NetworkException
position in interface LaneBasedGTUlane - 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
fractionalPositions in interface LaneBasedGTUrelativePosition - 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.public Map<Lane,Double> fractionalPositions(RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws NetworkException
fractionalPositions in interface LaneBasedGTUrelativePosition - 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 double fractionalPosition(Lane lane, RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws NetworkException
fractionalPosition in interface LaneBasedGTUlane - 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 double fractionalPosition(Lane lane, RelativePosition relativePosition) throws NetworkException
fractionalPosition in interface LaneBasedGTUlane - 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.public org.djunits.value.vdouble.scalar.Length.Rel projectedPosition(Lane projectionLane, RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws NetworkException
projectedPosition in interface LaneBasedGTUprojectionLane - 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 HeadwayGTU headway(org.djunits.value.vdouble.scalar.Length.Rel maxDistance) throws NetworkException
headway in interface LaneBasedGTUmaxDistance - the maximum distance to look for the nearest GTU; positive values search forwards; negative values
search backwardsNetworkException - 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 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 LaneBasedGTUlane - the lane to look for another GTUmaxDistance - the maximum distance to look for; if positive, the search is forwards; if negative, the search is
backwardsNetworkException - 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 NetworkException
parallel in interface LaneBasedGTUlane - the lane to look for parallel (partial or full overlapping) GTUs.when - the future time for which to calculate the headwayNetworkException - 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(LateralDirectionality lateralDirection, org.djunits.value.vdouble.scalar.Time.Abs when) throws NetworkException
parallel in interface LaneBasedGTUlateralDirection - 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 headwayNetworkException - 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, LateralDirectionality lateralDirection, org.djunits.value.vdouble.scalar.Length.Rel longitudinalPosition)
bestAccessibleAdjacentLane in interface LaneBasedGTUcurrentLane - 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 LaneBasedGTUdistance - DoubleScalar.Rel<LengthUnit>; the distancepublic org.djunits.value.vdouble.scalar.Time.Rel deltaTimeForDistance(org.djunits.value.vdouble.scalar.Length.Rel distance)
deltaTimeForDistance in interface LaneBasedGTUdistance - DoubleScalar.Rel<LengthUnit>; the distancepublic GTUFollowingModel getGTUFollowingModel()
getGTUFollowingModel in interface LaneBasedGTUpublic LaneChangeUrgeGTUColorer.LaneChangeDistanceAndDirection getLaneChangeDistanceAndDirection()
getLaneChangeDistanceAndDirection in interface LaneBasedGTUCopyright © 2014–2015 Delft University of Technology. All rights reserved.