Class LoopDetector.LoopDetectorMeasurement<C,A>
java.lang.Object
org.opentrafficsim.road.network.object.detector.LoopDetector.LoopDetectorMeasurement<C,A>
- Type Parameters:
C- accumulated typeA- aggregated type
- Direct Known Subclasses:
LoopDetector.PlatoonSizes
- Enclosing class:
- LoopDetector
Interface for what detectors measure.
Copyright (c) 2013-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract CaccumulateEntry(C cumulative, LaneBasedGtu gtu, LoopDetector loopDetector) Returns an accumulated value for when the front reaches the detector.protected abstract CaccumulateExit(C cumulative, LaneBasedGtu gtu, LoopDetector loopDetector) Returns an accumulated value for when the rear leaves the detector.protected abstract AReturns an aggregated value.Measurement description.getName()Returns the value name.getUnit()Returns the unit string, default isnull.Class<?>Returns the data type.identity()Returns the initial value before accumulation.booleanReturns whether the measurement aggregates every aggregation period (or only over the entire simulation).toString()
-
Constructor Details
-
LoopDetectorMeasurement
public LoopDetectorMeasurement(String name, String description, Supplier<C> identity, Class<?> valueType, boolean periodic) Constructor.- Parameters:
name- namedescription- descriptionidentity- identity suppliervalueType- value type, either same asA, or e.g.TwhenAisList<T>periodic- periodic measurement (or non-periodic)
-
-
Method Details
-
identity
Returns the initial value before accumulation.- Returns:
- initial value before accumulation
-
accumulateEntry
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.- Parameters:
cumulative- accumulated valuegtu- gtuloopDetector- loop detector- Returns:
- accumulated value
-
accumulateExit
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.- Parameters:
cumulative- accumulated valuegtu- gtuloopDetector- loop detector- Returns:
- accumulated value
-
isPeriodic
public boolean isPeriodic()Returns whether the measurement aggregates every aggregation period (or only over the entire simulation).- Returns:
- whether the measurement aggregates every aggregation period (or only over the entire simulation)
-
aggregate
protected abstract A aggregate(C cumulative, int gtuCount, org.djunits.value.vdouble.scalar.Duration aggregation) Returns an aggregated value.- Parameters:
cumulative- accumulated valuegtuCount- GTU gtuCountaggregation- aggregation period- Returns:
- aggregated value
-
getName
Returns the value name.- Returns:
- value name
-
getDescription
Measurement description.- Returns:
- measurement description.
-
getUnit
Returns the unit string, default isnull.- Returns:
- unit string.
-
getValueType
Returns the data type.- Returns:
- data type.
-
toString
-