public class Detector extends AbstractSensor
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
Detector.CompressionMethod
Defines the compression method for stored data.
|
static interface |
Detector.DetectorMeasurement<C,A>
Interface for what detectors measure.
|
static class |
Detector.PlatoonSizes
Measurement of platoon sizes based on time between previous GTU exit and GTU entry.
|
| Modifier and Type | Field and Description |
|---|---|
static nl.tudelft.simulation.event.EventType |
DETECTOR_AGGREGATE
Aggregation event.
|
static nl.tudelft.simulation.event.EventType |
DETECTOR_TRIGGERED
Trigger event.
|
static Detector.DetectorMeasurement<Double,Speed> |
HARMONIC_MEAN_SPEED
Harmonic mean speed measurement.
|
static Detector.DetectorMeasurement<Double,Speed> |
MEAN_SPEED
Mean speed measurement.
|
static Detector.DetectorMeasurement<Double,Double> |
OCCUPANCY
Occupancy measurement.
|
static Detector.DetectorMeasurement<List<Double>,List<Double>> |
PASSAGES
Passages measurement.
|
DEFAULT_SENSOR_ELEVATION, SENSOR_TRIGGER_EVENTFIRST_POSITION, LAST_POSITIONEVERYTHING, MINUS, PLUS| Constructor and Description |
|---|
Detector(String id,
Lane lane,
Length longitudinalPosition,
nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeDoubleUnit simulator)
Constructor for regular Dutch dual-loop detectors measuring flow and mean speed aggregated over 60s.
|
Detector(String id,
Lane lane,
Length longitudinalPosition,
Length length,
nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeDoubleUnit simulator,
Duration aggregation,
Detector.DetectorMeasurement<?,?>... measurements)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
AbstractSensor |
clone(CrossSectionElement newCSE,
nl.tudelft.simulation.dsol.simulators.SimulatorInterface.TimeDoubleUnit newSimulator)
Clone the LaneBasedObject for e.g., copying a network.
|
Frequency |
getLastFlow()
Returns the last flow.
|
<A> A |
getLastValue(Detector.DetectorMeasurement<?,A> detectorMeasurement)
Returns the last value of the detector measurement.
|
Length |
getLength()
Returns the detector length.
|
boolean |
hasLastValue()
Returns whether the detector has aggregated data available.
|
static String |
printListDouble(List<Double> list,
String format)
Prints a list of doubles in to a formatted string.
|
static String |
removeTrailingZeros(String string)
Remove any trailing zeros.
|
protected void |
triggerResponse(LaneBasedGTU gtu)
Implementation of the response to a trigger of this sensor by a GTU.
|
static void |
writeToFile(OTSRoadNetwork network,
String file,
boolean periodic)
Write the contents of all detectors in to a file.
|
static <C> void |
writeToFile(OTSRoadNetwork network,
String file,
boolean periodic,
String format,
Detector.CompressionMethod compression)
Write the contents of all detectors in to a file.
|
compareTo, equals, getDetectedGTUTypes, getPositionType, getSimulator, hashCode, isCompatible, makeGeometry, toString, triggerclone, 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 static final nl.tudelft.simulation.event.EventType DETECTOR_TRIGGERED
public static final nl.tudelft.simulation.event.EventType DETECTOR_AGGREGATE
public static final Detector.DetectorMeasurement<Double,Speed> MEAN_SPEED
public static final Detector.DetectorMeasurement<Double,Speed> HARMONIC_MEAN_SPEED
public static final Detector.DetectorMeasurement<Double,Double> OCCUPANCY
public static final Detector.DetectorMeasurement<List<Double>,List<Double>> PASSAGES
public Detector(String id, Lane lane, Length longitudinalPosition, nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeDoubleUnit simulator) throws NetworkException
id - String; detector idlane - Lane; lanelongitudinalPosition - Length; positionsimulator - DEVSSimulatorInterface.TimeDoubleUnit; simulatorNetworkException - on network exceptionpublic Detector(String id, Lane lane, Length longitudinalPosition, Length length, nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeDoubleUnit simulator, Duration aggregation, Detector.DetectorMeasurement<?,?>... measurements) throws NetworkException
id - String; detector idlane - Lane; lanelongitudinalPosition - Length; positionlength - Length; lengthsimulator - DEVSSimulatorInterface.TimeDoubleUnit; simulatoraggregation - Duration; aggregation periodmeasurements - DetectorMeasurement<?, ?>...; measurements to obtainNetworkException - on network exceptionpublic Length getLength()
protected void triggerResponse(LaneBasedGTU gtu)
triggerResponse in class AbstractSensorgtu - LaneBasedGTU; the lane based GTU that triggered this sensor.public boolean hasLastValue()
public Frequency getLastFlow()
public <A> A getLastValue(Detector.DetectorMeasurement<?,A> detectorMeasurement)
A - aggregate value type of the detector measurementdetectorMeasurement - DetectorMeasurement<?,A>; detector measurementpublic AbstractSensor clone(CrossSectionElement newCSE, nl.tudelft.simulation.dsol.simulators.SimulatorInterface.TimeDoubleUnit newSimulator) throws NetworkException
clone in class AbstractSensornewCSE - CrossSectionElement; the new cross section element to which the clone belongsnewSimulator - SimulatorInterface.TimeDoubleUnit; the new simulator for this networkNetworkException - in case the cloning failspublic static final void writeToFile(OTSRoadNetwork network, String file, boolean periodic)
network - OTSRoadNetwork; networkfile - String; fileperiodic - boolean; periodic datapublic static final <C> void writeToFile(OTSRoadNetwork network, String file, boolean periodic, String format, Detector.CompressionMethod compression)
C - accumulated typenetwork - OTSRoadNetwork; networkfile - String; fileperiodic - boolean; periodic dataformat - String; number format, as used in String.format()compression - CompressionMethod; how to compress the datapublic static final String removeTrailingZeros(String string)
string - String; string of numberCopyright © 2014–2019 Delft University of Technology. All rights reserved.