public abstract class AbstractSensor extends AbstractLaneBasedObject implements SingleSensor
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2015-09-14 01:33:02 +0200 (Mon, 14 Sep 2015) $, @version $Revision: 1401 $, by $Author: averbraeck $,
initial version Dec 31, 2014
DEFAULT_SENSOR_ELEVATION, SENSOR_TRIGGER_EVENTFIRST_POSITION, LAST_POSITIONEVERYTHING, MINUS, PLUS| Constructor and Description |
|---|
AbstractSensor(String id,
Lane lane,
Length longitudinalPosition,
RelativePosition.TYPE positionType,
nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeDoubleUnit simulator,
Compatible detectedGTUTypes)
Create a new AbstractSensor on a lane at a position on that lane at elevation
Sensor.DEFAULT_SENSOR_ELEVATION and default geometry. |
AbstractSensor(String id,
Lane lane,
Length longitudinalPosition,
RelativePosition.TYPE positionType,
nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeDoubleUnit simulator,
OTSLine3D geometry,
Compatible detectedGTUTypes)
Create a sensor on a lane at a position on that lane at elevation
Sensor.DEFAULT_SENSOR_ELEVATION. |
AbstractSensor(String id,
Lane lane,
Length longitudinalPosition,
RelativePosition.TYPE positionType,
nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeDoubleUnit simulator,
OTSLine3D geometry,
Length elevation,
Compatible detectedGTUTypes)
Create a sensor on a lane at a position on that lane.
|
| Modifier and Type | Method and Description |
|---|---|
abstract AbstractSensor |
clone(CrossSectionElement newCSE,
nl.tudelft.simulation.dsol.simulators.SimulatorInterface.TimeDoubleUnit newSimulator)
Clone the LaneBasedObject for e.g., copying a network.
|
int |
compareTo(SingleSensor o) |
boolean |
equals(Object obj) |
Compatible |
getDetectedGTUTypes()
Retrieve the object that decides if a particular GTU type is detected when passing in a particular direction.
|
RelativePosition.TYPE |
getPositionType() |
nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeDoubleUnit |
getSimulator() |
int |
hashCode() |
boolean |
isCompatible(GTUType gtuType,
GTUDirectionality directionality) |
protected static OTSLine3D |
makeGeometry(Lane lane,
Length longitudinalPosition,
double relativeWidth)
Make a geometry perpendicular to the center line of the lane with a length of 90% of the width of the lane.
|
String |
toString() |
void |
trigger(LaneBasedGTU gtu)
Trigger an action on the GTU.
|
protected abstract void |
triggerResponse(LaneBasedGTU gtu)
Implementation of the response to a trigger of this sensor by a GTU.
|
clone, getDirection, getFullId, getLane, getLocation, getLongitudinalPositiongetBounds, getGeometry, getHeight, getIdaddListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListenerclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetBounds, getDirection, getLane, getLocation, getLongitudinalPosition, makeGeometrygetFullId, getGeometry, getHeightgetIdpublic AbstractSensor(String id, Lane lane, Length longitudinalPosition, RelativePosition.TYPE positionType, nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeDoubleUnit simulator, OTSLine3D geometry, Length elevation, Compatible detectedGTUTypes) throws NetworkException
id - String; the id of the sensor.lane - Lane; the lane for which this is a sensor.longitudinalPosition - Length; the position (between 0.0 and the length of the Lane) of the sensor on the design
line of the lane.positionType - RelativePosition.TYPE; the relative position type (e.g., FRONT, BACK) of the vehicle that triggers
the sensor.simulator - DEVSSimulatorInterface.TimeDoubleUnit; the simulator (needed to generate the animation).geometry - OTSLine3D; the geometry of the object, which provides its location and bounds as wellelevation - Length; elevation of the sensordetectedGTUTypes - Compatible; The GTU types will trigger this sensorNetworkException - when the position on the lane is out of boundspublic AbstractSensor(String id, Lane lane, Length longitudinalPosition, RelativePosition.TYPE positionType, nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeDoubleUnit simulator, OTSLine3D geometry, Compatible detectedGTUTypes) throws NetworkException
Sensor.DEFAULT_SENSOR_ELEVATION.id - String; the id of the sensor.lane - Lane; the lane for which this is a sensor.longitudinalPosition - Length; the position (between 0.0 and the length of the Lane) of the sensor on the design
line of the lane.positionType - RelativePosition.TYPE; the relative position type (e.g., FRONT, BACK) of the vehicle that triggers
the sensor.simulator - DEVSSimulatorInterface.TimeDoubleUnit; the simulator (needed to generate the animation).geometry - OTSLine3D; the geometry of the object, which provides its location and bounds as welldetectedGTUTypes - Compatible; The GTU types will trigger this sensorNetworkException - when the position on the lane is out of boundspublic AbstractSensor(String id, Lane lane, Length longitudinalPosition, RelativePosition.TYPE positionType, nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeDoubleUnit simulator, Compatible detectedGTUTypes) throws NetworkException
Sensor.DEFAULT_SENSOR_ELEVATION and default geometry.id - String; the id of the new AbstractSensorlane - Lane; the lane on which the new AbstractSensor is positionedlongitudinalPosition - Length; the position (between 0.0 and the length of the Lane) of the sensor on the design
line of the lanepositionType - RelativePosition.TYPE; the relative position type (e.g., FRONT, BACK) of the vehicle that triggers
the sensor.simulator - DEVSSimulatorInterface.TimeDoubleUnit; the simulator (needed to generate the animation).detectedGTUTypes - Compatible; The GTU types will trigger this sensorNetworkException - when the position on the lane is out of boundsprotected static OTSLine3D makeGeometry(Lane lane, Length longitudinalPosition, double relativeWidth) throws NetworkException
lane - Lane; the lane for which to make a perpendicular geometrylongitudinalPosition - Length; the position on the lanerelativeWidth - double; lane width to useNetworkException - in case the sensor point on the center line of the lane cannot be foundpublic final void trigger(LaneBasedGTU gtu)
sensor.trigger(this);.trigger in interface SingleSensorgtu - LaneBasedGTU; the GTU for which to carry out the trigger action.protected abstract void triggerResponse(LaneBasedGTU gtu)
gtu - LaneBasedGTU; the lane based GTU that triggered this sensor.public final RelativePosition.TYPE getPositionType()
getPositionType in interface SingleSensorpublic final nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeDoubleUnit getSimulator()
getSimulator in interface SingleSensorpublic int compareTo(SingleSensor o)
compareTo in interface Comparable<SingleSensor>public String toString()
toString in class AbstractLaneBasedObjectpublic abstract AbstractSensor clone(CrossSectionElement newCSE, nl.tudelft.simulation.dsol.simulators.SimulatorInterface.TimeDoubleUnit newSimulator) throws NetworkException
clone in class AbstractLaneBasedObjectnewCSE - CrossSectionElement; the new cross section element to which the clone belongsnewSimulator - SimulatorInterface.TimeDoubleUnit; the new simulator for this networkNetworkException - in case the cloning failspublic final boolean isCompatible(GTUType gtuType, GTUDirectionality directionality)
isCompatible in interface Compatiblepublic final Compatible getDetectedGTUTypes()
Copyright © 2014–2019 Delft University of Technology. All rights reserved.