Package org.opentrafficsim.imb.kpi
Class IMBSampler
public class IMBSampler extends Sampler<GtuData>
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.
- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 12 okt. 2016
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opentrafficsim.kpi.sampling.Sampler
Sampler.CompressionMethod -
Field Summary
Fields Modifier and Type Field Description protected GtuTypeDatadefaultGtuTypethe default gtu type (for now).protected RouteDatadefaultRoutethe default route (for now).protected Map<String,GtuData>gtusthe gtus.protected Map<String,LaneData>lanesthe lanes.protected Map<String,KpiLaneDirection>lastLaneslast lane of gtus.protected Map<String,LinkData>linksthe links.protected Map<String,NodeData>nodesthe nodes. -
Constructor Summary
Constructors Constructor Description IMBSampler(org.opentrafficsim.imb.connector.IMBConnector imbConnector)Constructor with listeners for nodes, links, lanes and gtu's. -
Method Summary
Modifier and Type Method Description voidaddImbKpiTransceiver(ImbKpiTransceiver<GtuData> imbKpiTransceiver)voidfinalizeRecording(KpiLaneDirection kpiLaneDirection)voidinitRecording(KpiLaneDirection kpiLaneDirection)static voidmain(String[] args)Main program for IMBSampler.Timenow()protected voidsample(double timeStamp, String gtuId, String laneId, boolean forward, double longitudinalPosition, double speed, double acceleration)Sample the data received from a GTU.voidscheduleStartRecording(Time time, KpiLaneDirection kpiLaneDirection)voidscheduleStopRecording(Time time, KpiLaneDirection kpiLaneDirection)protected voidupdateClock(double timeStamp)Updates clock and triggers timed events.Methods inherited from class org.opentrafficsim.kpi.sampling.Sampler
contains, contains, equals, getTrajectoryGroup, hashCode, processGtuAddEvent, processGtuMoveEvent, processGtuRemoveEvent, processGtuRemoveEvent, registerExtendedDataType, registerMetaDataTypes, registerSpaceTimeRegion, startRecording, stopRecording, writeToFile, writeToFile
-
Field Details
-
nodes
the nodes. -
links
the links. -
lanes
the lanes. -
gtus
the gtus. -
lastLanes
last lane of gtus. -
defaultGtuType
the default gtu type (for now). -
defaultRoute
the default route (for now).
-
-
Constructor Details
-
IMBSampler
public IMBSampler(org.opentrafficsim.imb.connector.IMBConnector imbConnector) throws org.opentrafficsim.imb.IMBExceptionConstructor with listeners for nodes, links, lanes and gtu's.- Parameters:
imbConnector- IMBConnector; IMB connection- Throws:
org.opentrafficsim.imb.IMBException- on connection error
-
-
Method Details
-
main
Main program for IMBSampler. Listens to events on the IMB bus and calculates and publishes statistics.- Parameters:
args- String[]; the arguments with [0]=IP address, [1]=port- Throws:
org.opentrafficsim.imb.IMBException- in case of invalid arguments
-
now
-
scheduleStartRecording
- Specified by:
scheduleStartRecordingin classSampler<GtuData>
-
scheduleStopRecording
- Specified by:
scheduleStopRecordingin classSampler<GtuData>
-
initRecording
- Specified by:
initRecordingin classSampler<GtuData>
-
finalizeRecording
- Specified by:
finalizeRecordingin classSampler<GtuData>
-
sample
protected void sample(double timeStamp, String gtuId, String laneId, boolean forward, double longitudinalPosition, double speed, double acceleration)Sample the data received from a GTU.- Parameters:
timeStamp- double; time of the samplinggtuId- String; gtulaneId- String; laneforward- boolean; driving directionlongitudinalPosition- double; positionspeed- double; speedacceleration- double; acceleration
-
addImbKpiTransceiver
- Parameters:
imbKpiTransceiver- ImbKpiTransceiver<GtuData>; add imbKpiTransceiver.
-
updateClock
protected void updateClock(double timeStamp)Updates clock and triggers timed events.- Parameters:
timeStamp- double; most recent time stamp
-