Class CCOL

    • Field Detail

      • EVALUATION_INTERVAL

        static final Duration EVALUATION_INTERVAL
        The evaluation interval of a CCOL controller.
    • Constructor Detail

      • CCOL

        public CCOL​(String id,
                    String controlProgram,
                    Set<TrafficLight> trafficLights,
                    Set<TrafficLightSensor> sensors,
                    org.opentrafficsim.core.dsol.OTSSimulator simulator)
             throws TrafficControlException,
                    SimRuntimeException
        Construct a new CCOL communication link.
        Parameters:
        id - String; id of the traffic controller
        controlProgram - String; name of the CCOL program that this CCOL link must communicate with
        trafficLights - Set<TrafficLight>; the traffic lights. The ids of the traffic lights must end with two digits that match the stream numbers as used in the traffic control program
        sensors - Set<TrafficLightSensor>; the traffic sensors. The ids of the traffic sensors must end with three digits; the first two of those must match the stream and sensor numbers used in the traffic control program
        simulator - DEVSSimulator<Time, Duration, SimTimeDoubleUnit>; the simulation engine
        Throws:
        TrafficControlException - on failure to initialize the connection to the external CCOL program
        SimRuntimeException - on failure to schedule the first evaluation event
    • Method Detail

      • setClientSocket

        void setClientSocket​(Socket socket)
        Set the client socket (called from the accept thread).
        Parameters:
        socket - Socket; the socket returned by accept
      • getClientSocket

        Socket getClientSocket()
        Retrieve the client socket for shutdown.
        Returns:
        Socket; the socket for communication with the CCOL client
      • getId

        public String getId()
        Retrieve the Id of the traffic light controller.
        Specified by:
        getId in interface org.opentrafficsim.base.Identifiable
        Specified by:
        getId in interface TrafficController
        Returns:
        String; the id of the traffic light controller
      • getFullId

        public String getFullId()
        Specified by:
        getFullId in interface org.opentrafficsim.core.object.InvisibleObjectInterface
      • updateDetector

        public void updateDetector​(String detectorId,
                                   boolean detectingGTU)
        Tell the traffic controller that the state of a detector has changed.
        Specified by:
        updateDetector in interface ActuatedTrafficController
        Parameters:
        detectorId - String; id of the detector
        detectingGTU - boolean;
      • clone

        public org.opentrafficsim.core.object.InvisibleObjectInterface clone​(org.opentrafficsim.core.dsol.OTSSimulatorInterface newSimulator,
                                                                             org.opentrafficsim.core.network.Network newNetwork)
                                                                      throws org.opentrafficsim.core.network.NetworkException
        Specified by:
        clone in interface org.opentrafficsim.core.object.InvisibleObjectInterface
        Throws:
        org.opentrafficsim.core.network.NetworkException
      • getDisplayContainer

        public Container getDisplayContainer()
        Retrieve the Swing (for now) container in which the controller displays its current state.
        Specified by:
        getDisplayContainer in interface ActuatedTrafficController
        Returns:
        Container; the display of the current state; may return null!