Class IMBSampler

    • Field Detail

      • nodes

        protected final java.util.Map<java.lang.String,​NodeData> nodes
        the nodes.
      • links

        protected final java.util.Map<java.lang.String,​LinkData> links
        the links.
      • lanes

        protected final java.util.Map<java.lang.String,​LaneData> lanes
        the lanes.
      • gtus

        protected final java.util.Map<java.lang.String,​GtuData> gtus
        the gtus.
      • lastLanes

        protected final java.util.Map<java.lang.String,​KpiLaneDirection> lastLanes
        last lane of gtus.
      • defaultGtuType

        protected final GtuTypeData defaultGtuType
        the default gtu type (for now).
      • defaultRoute

        protected final RouteData defaultRoute
        the default route (for now).
    • Constructor Detail

      • IMBSampler

        public IMBSampler​(org.opentrafficsim.imb.connector.IMBConnector imbConnector)
                   throws org.opentrafficsim.imb.IMBException
        Constructor with listeners for nodes, links, lanes and gtu's.
        Parameters:
        imbConnector - IMBConnector; IMB connection
        Throws:
        org.opentrafficsim.imb.IMBException - on connection error
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws org.opentrafficsim.imb.IMBException
        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
      • sample

        protected void sample​(double timeStamp,
                              java.lang.String gtuId,
                              java.lang.String laneId,
                              boolean forward,
                              double longitudinalPosition,
                              double speed,
                              double acceleration)
        Sample the data received from a GTU.
        Parameters:
        timeStamp - double; time of the sampling
        gtuId - String; gtu
        laneId - String; lane
        forward - boolean; driving direction
        longitudinalPosition - double; position
        speed - double; speed
        acceleration - double; acceleration
      • addImbKpiTransceiver

        public void addImbKpiTransceiver​(ImbKpiTransceiver<GtuData> imbKpiTransceiver)
        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