Class Detector.PlatoonSizes
- java.lang.Object
-
- org.opentrafficsim.road.network.lane.object.sensor.Detector.PlatoonSizes
-
- All Implemented Interfaces:
Detector.DetectorMeasurement<Detector.PlatoonMeasurement,List<Integer>>
- Enclosing class:
- Detector
public static class Detector.PlatoonSizes extends Object implements Detector.DetectorMeasurement<Detector.PlatoonMeasurement,List<Integer>>
Measurement of platoon sizes based on time between previous GTU exit and GTU entry.Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 15 mrt. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Constructor Summary
Constructors Constructor Description PlatoonSizes(Duration threshold)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Detector.PlatoonMeasurement
accumulateEntry(Detector.PlatoonMeasurement cumulative, LaneBasedGTU gtu, Detector loopDetector)
Returns an accumulated value for when the front reaches the detector.Detector.PlatoonMeasurement
accumulateExit(Detector.PlatoonMeasurement cumulative, LaneBasedGTU gtu, Detector loopDetector)
Returns an accumulated value for when the rear leaves the detector.List<Integer>
aggregate(Detector.PlatoonMeasurement cumulative, int count, Duration aggregation)
Returns an aggregated value.String
getName()
Returns the value name.Detector.PlatoonMeasurement
identity()
Returns the initial value before accumulation.boolean
isPeriodic()
Returns whether the measurement aggregates every aggregation period (or only over the entire simulation).String
stringValue(List<Integer> aggregate, String format)
Returns a string representation of the aggregate result.String
toString()
-
-
-
Constructor Detail
-
PlatoonSizes
public PlatoonSizes(Duration threshold)
Constructor.- Parameters:
threshold
- Duration; maximum time between two vehicles that are considered to be in the same platoon
-
-
Method Detail
-
identity
public Detector.PlatoonMeasurement identity()
Returns the initial value before accumulation.- Specified by:
identity
in interfaceDetector.DetectorMeasurement<Detector.PlatoonMeasurement,List<Integer>>
- Returns:
- C; initial value before accumulation
-
accumulateEntry
public Detector.PlatoonMeasurement accumulateEntry(Detector.PlatoonMeasurement cumulative, LaneBasedGTU gtu, Detector loopDetector)
Returns an accumulated value for when the front reaches the detector. GTU's may trigger an exit without having triggered an entry due to a lane change. Reversely, GTU's may not trigger an exit while they did trigger an entry.- Specified by:
accumulateEntry
in interfaceDetector.DetectorMeasurement<Detector.PlatoonMeasurement,List<Integer>>
- Parameters:
cumulative
- C; accumulated valuegtu
- LaneBasedGTU; gtuloopDetector
- Detector; loop detector- Returns:
- C; accumulated value
-
accumulateExit
public Detector.PlatoonMeasurement accumulateExit(Detector.PlatoonMeasurement cumulative, LaneBasedGTU gtu, Detector loopDetector)
Returns an accumulated value for when the rear leaves the detector. GTU's may trigger an exit without having triggered an entry due to a lane change. Reversely, GTU's may not trigger an exit while they did trigger an entry.- Specified by:
accumulateExit
in interfaceDetector.DetectorMeasurement<Detector.PlatoonMeasurement,List<Integer>>
- Parameters:
cumulative
- C; accumulated valuegtu
- LaneBasedGTU; gtuloopDetector
- Detector; loop detector- Returns:
- C; accumulated value
-
isPeriodic
public boolean isPeriodic()
Returns whether the measurement aggregates every aggregation period (or only over the entire simulation).- Specified by:
isPeriodic
in interfaceDetector.DetectorMeasurement<Detector.PlatoonMeasurement,List<Integer>>
- Returns:
- boolean; whether the measurement aggregates every aggregation period (or only over the entire simulation)
-
aggregate
public List<Integer> aggregate(Detector.PlatoonMeasurement cumulative, int count, Duration aggregation)
Returns an aggregated value.- Specified by:
aggregate
in interfaceDetector.DetectorMeasurement<Detector.PlatoonMeasurement,List<Integer>>
- Parameters:
cumulative
- C; accumulated valuecount
- int; GTU countaggregation
- Duration; aggregation period- Returns:
- A; aggregated value
-
getName
public String getName()
Returns the value name.- Specified by:
getName
in interfaceDetector.DetectorMeasurement<Detector.PlatoonMeasurement,List<Integer>>
- Returns:
- String; value name
-
stringValue
public String stringValue(List<Integer> aggregate, String format)
Returns a string representation of the aggregate result.- Specified by:
stringValue
in interfaceDetector.DetectorMeasurement<Detector.PlatoonMeasurement,List<Integer>>
- Parameters:
aggregate
- A; aggregate resultformat
- String; format string- Returns:
- String; string representation of the aggregate result
-
-