public class AbstractTrafficLight extends org.opentrafficsim.core.gtu.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.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
AbstractTrafficLight.DummyStrategicalPlanner
Dummy strategical planner.
|
(package private) static class |
AbstractTrafficLight.DummyTacticalPlanner |
Modifier and Type | Field and Description |
---|---|
static org.opentrafficsim.core.gtu.GTUType |
BLOCK_GTU
Blocking GTU type.
|
static org.opentrafficsim.core.gtu.plan.strategical.StrategicalPlanner |
dummyStrategicalPlanner
The dummy strategical planner.
|
(package private) Lane |
laneTL
The lane of the block.
|
(package private) org.djunits.value.vdouble.scalar.Length.Rel |
positionTL
The position of the block on the lane.
|
static Map<org.opentrafficsim.core.gtu.RelativePosition.TYPE,org.opentrafficsim.core.gtu.RelativePosition> |
RELATIVE_POSITIONS
Relative position (0,0,0).
|
Constructor and Description |
---|
AbstractTrafficLight(String name,
Lane lane,
org.djunits.value.vdouble.scalar.Length.Rel position,
org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface simulator,
org.opentrafficsim.core.network.OTSNetwork network) |
Modifier and Type | Method and Description |
---|---|
void |
addTrigger(Lane lane,
nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEvent<org.opentrafficsim.core.dsol.OTSSimTimeDouble> event)
Add an event to the list of lane triggers scheduled for this GTU.
|
void |
enterLane(Lane lane,
org.djunits.value.vdouble.scalar.Length.Rel position,
org.opentrafficsim.core.gtu.GTUDirectionality gtuDirection)
insert GTU at a certain position.
|
double |
fractionalPosition(Lane lane,
org.opentrafficsim.core.gtu.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,
org.opentrafficsim.core.gtu.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(org.opentrafficsim.core.gtu.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(org.opentrafficsim.core.gtu.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.
|
LaneBasedBehavioralCharacteristics |
getBehavioralCharacteristics() |
javax.media.j3d.Bounds |
getBounds() |
org.opentrafficsim.core.gtu.RelativePosition |
getFront() |
Lane |
getLane() |
Map<Lane,org.opentrafficsim.core.gtu.GTUDirectionality> |
getLanes() |
org.djunits.value.vdouble.scalar.Length.Rel |
getLength() |
org.djunits.value.vdouble.scalar.Speed |
getMaximumVelocity() |
LanePerceptionFull |
getPerception() |
org.opentrafficsim.core.gtu.RelativePosition |
getRear() |
Map<org.opentrafficsim.core.gtu.RelativePosition.TYPE,org.opentrafficsim.core.gtu.RelativePosition> |
getRelativePositions() |
LaneBasedStrategicalPlanner |
getStrategicalPlanner() |
org.djunits.value.vdouble.scalar.Length.Rel |
getWidth() |
boolean |
isBlocked() |
void |
leaveLane(Lane lane)
Unregister the GTU from a lane.
|
org.djunits.value.vdouble.scalar.Length.Rel |
position(Lane lane,
org.opentrafficsim.core.gtu.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,
org.opentrafficsim.core.gtu.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(org.opentrafficsim.core.gtu.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(org.opentrafficsim.core.gtu.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,
org.opentrafficsim.core.gtu.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) |
destroy, getAcceleration, getAcceleration, getGTUType, getId, getLocation, getMaximumAcceleration, getMaximumDeceleration, getOdometer, getOperationalPlan, getPerceivableContext, getReference, getSimulator, getTacticalPlanner, getTurnIndicatorStatus, getVelocity, getVelocity, interruptMove, isDestroyed, move, setMaximumAcceleration, setMaximumDeceleration, setTurnIndicatorStatus
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
destroy, getAcceleration, getAcceleration, getGTUType, getId, getLocation, getMaximumAcceleration, getMaximumDeceleration, getOdometer, getOperationalPlan, getReference, getSimulator, getTacticalPlanner, getTurnIndicatorStatus, getVelocity, getVelocity, setTurnIndicatorStatus
final Lane laneTL
final org.djunits.value.vdouble.scalar.Length.Rel positionTL
public static final org.opentrafficsim.core.gtu.GTUType BLOCK_GTU
public static final org.opentrafficsim.core.gtu.plan.strategical.StrategicalPlanner dummyStrategicalPlanner
public static final Map<org.opentrafficsim.core.gtu.RelativePosition.TYPE,org.opentrafficsim.core.gtu.RelativePosition> RELATIVE_POSITIONS
public AbstractTrafficLight(String name, Lane lane, org.djunits.value.vdouble.scalar.Length.Rel position, org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface simulator, org.opentrafficsim.core.network.OTSNetwork network) throws org.opentrafficsim.core.gtu.GTUException, org.opentrafficsim.core.network.NetworkException, NamingException, nl.tudelft.simulation.dsol.SimRuntimeException, org.opentrafficsim.core.geometry.OTSGeometryException
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 NullPointerExceptionsnetwork
- the network that the GTU is initially registered inorg.opentrafficsim.core.gtu.GTUException
- when GTU cannot be created.NamingException
- if an error occurs when adding the animation handlerorg.opentrafficsim.core.network.NetworkException
- when the GTU cannot be placed on the given laneorg.opentrafficsim.core.geometry.OTSGeometryException
- xnl.tudelft.simulation.dsol.SimRuntimeException
- xpublic final void setBlocked(boolean blocked)
blocked
- set blockedpublic final boolean isBlocked()
public final Lane getLane()
public org.djunits.value.vdouble.scalar.Length.Rel getLength()
getLength
in interface org.opentrafficsim.core.gtu.GTU
public org.djunits.value.vdouble.scalar.Length.Rel getWidth()
getWidth
in interface org.opentrafficsim.core.gtu.GTU
public org.djunits.value.vdouble.scalar.Speed getMaximumVelocity()
getMaximumVelocity
in interface org.opentrafficsim.core.gtu.GTU
public org.opentrafficsim.core.gtu.RelativePosition getFront()
getFront
in interface org.opentrafficsim.core.gtu.GTU
public org.opentrafficsim.core.gtu.RelativePosition getRear()
getRear
in interface org.opentrafficsim.core.gtu.GTU
public Map<org.opentrafficsim.core.gtu.RelativePosition.TYPE,org.opentrafficsim.core.gtu.RelativePosition> getRelativePositions()
getRelativePositions
in interface org.opentrafficsim.core.gtu.GTU
public javax.media.j3d.Bounds getBounds()
getBounds
in interface nl.tudelft.simulation.dsol.animation.LocatableInterface
getBounds
in interface org.opentrafficsim.core.gtu.GTU
public LaneBasedBehavioralCharacteristics getBehavioralCharacteristics()
getBehavioralCharacteristics
in interface org.opentrafficsim.core.gtu.GTU
getBehavioralCharacteristics
in interface LaneBasedGTU
public Map<Lane,org.opentrafficsim.core.gtu.GTUDirectionality> getLanes()
getLanes
in interface LaneBasedGTU
public void enterLane(Lane lane, org.djunits.value.vdouble.scalar.Length.Rel position, org.opentrafficsim.core.gtu.GTUDirectionality gtuDirection) throws org.opentrafficsim.core.gtu.GTUException
enterLane
in interface LaneBasedGTU
lane
- the lane to add to the list of lanes on which the GTU is registered.position
- the position on the lane.gtuDirection
- the direction of the GTU on the lane (which can be bidirectional). If the GTU has a positive
velocity, it is moving in this direction.org.opentrafficsim.core.gtu.GTUException
- when positioning the GTU on the lane causes a problempublic void leaveLane(Lane lane)
leaveLane
in interface LaneBasedGTU
lane
- the lane to remove from the list of lanes on which the GTU is registered.public Map<Lane,org.djunits.value.vdouble.scalar.Length.Rel> positions(org.opentrafficsim.core.gtu.RelativePosition relativePosition) throws org.opentrafficsim.core.gtu.GTUException
positions
in interface LaneBasedGTU
relativePosition
- the position on the vehicle relative to the reference point.org.opentrafficsim.core.gtu.GTUException
- when the vehicle is not on one of the lanes on which it is registered.public Map<Lane,org.djunits.value.vdouble.scalar.Length.Rel> positions(org.opentrafficsim.core.gtu.RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws org.opentrafficsim.core.gtu.GTUException
positions
in interface LaneBasedGTU
relativePosition
- the position on the vehicle relative to the reference point.when
- the future time for which to calculate the positions.org.opentrafficsim.core.gtu.GTUException
- when the vehicle is not on one of the lanes on which it is registered.public org.djunits.value.vdouble.scalar.Length.Rel position(Lane lane, org.opentrafficsim.core.gtu.RelativePosition relativePosition) throws org.opentrafficsim.core.gtu.GTUException
position
in interface LaneBasedGTU
lane
- the position on this lane will be returned.relativePosition
- the position on the vehicle relative to the reference point.org.opentrafficsim.core.gtu.GTUException
- when the vehicle is not on the given lane.public org.djunits.value.vdouble.scalar.Length.Rel position(Lane lane, org.opentrafficsim.core.gtu.RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws org.opentrafficsim.core.gtu.GTUException
position
in interface LaneBasedGTU
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.org.opentrafficsim.core.gtu.GTUException
- when the vehicle is not on the given lane.public Map<Lane,Double> fractionalPositions(org.opentrafficsim.core.gtu.RelativePosition relativePosition) throws org.opentrafficsim.core.gtu.GTUException
fractionalPositions
in interface LaneBasedGTU
relativePosition
- the position on the vehicle relative to the reference point.org.opentrafficsim.core.gtu.GTUException
- when the vehicle is not on one of the lanes on which it is registered.public Map<Lane,Double> fractionalPositions(org.opentrafficsim.core.gtu.RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws org.opentrafficsim.core.gtu.GTUException
fractionalPositions
in interface LaneBasedGTU
relativePosition
- the position on the vehicle relative to the reference point.when
- the future time for which to calculate the positions.org.opentrafficsim.core.gtu.GTUException
- when the vehicle is not on one of the lanes on which it is registered.public double fractionalPosition(Lane lane, org.opentrafficsim.core.gtu.RelativePosition relativePosition) throws org.opentrafficsim.core.gtu.GTUException
fractionalPosition
in interface LaneBasedGTU
lane
- the position on this lane will be returned.relativePosition
- the position on the vehicle relative to the reference point.org.opentrafficsim.core.gtu.GTUException
- when the vehicle is not on the given lane.public double fractionalPosition(Lane lane, org.opentrafficsim.core.gtu.RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws org.opentrafficsim.core.gtu.GTUException
fractionalPosition
in interface LaneBasedGTU
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.org.opentrafficsim.core.gtu.GTUException
- when the vehicle is not on the given lane.public org.djunits.value.vdouble.scalar.Length.Rel projectedPosition(Lane projectionLane, org.opentrafficsim.core.gtu.RelativePosition relativePosition, org.djunits.value.vdouble.scalar.Time.Abs when) throws org.opentrafficsim.core.gtu.GTUException
projectedPosition
in interface LaneBasedGTU
projectionLane
- Lane; the lane onto which the position of this GTU must be projectedrelativePosition
- RelativePosition; the point on this GTU that must be projectedwhen
- Time.Abs; the time for which to project the position of this GTUorg.opentrafficsim.core.gtu.GTUException
- when projectionLane it not in any of the CrossSectionLink that the GTU is onpublic LaneBasedStrategicalPlanner getStrategicalPlanner()
getStrategicalPlanner
in interface org.opentrafficsim.core.gtu.GTU
getStrategicalPlanner
in interface LaneBasedGTU
getStrategicalPlanner
in class org.opentrafficsim.core.gtu.AbstractGTU
public LanePerceptionFull getPerception()
getPerception
in interface org.opentrafficsim.core.gtu.GTU
getPerception
in interface LaneBasedGTU
getPerception
in class org.opentrafficsim.core.gtu.AbstractGTU
public void addTrigger(Lane lane, nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEvent<org.opentrafficsim.core.dsol.OTSSimTimeDouble> event)
addTrigger
in interface LaneBasedGTU
lane
- Lane; the lane on which the event occursevent
- SimeEvent<OTSSimTimeDouble> the eventCopyright © 2014–2016 Delft University of Technology. All rights reserved.