Class Ccol
java.lang.Object
org.djutils.event.LocalEventProducer
org.opentrafficsim.trafficcontrol.ccol.Ccol
- All Implemented Interfaces:
Serializable
,Remote
,EventListener
,org.djutils.base.Identifiable
,org.djutils.event.EventListener
,org.djutils.event.EventProducer
,org.opentrafficsim.core.animation.Drawable
,org.opentrafficsim.core.object.NonLocatedObject
,ActuatedTrafficController
,TrafficController
Communication link with a CCOL traffic control program.
Copyright (c) 2013-2024 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
- See Also:
-
Field Summary
Modifier and TypeFieldDescription(package private) static final org.djunits.value.vdouble.scalar.Duration
The evaluation interval of a CCOL controller.Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITION
Fields inherited from interface org.opentrafficsim.trafficcontrol.TrafficController
BEING_CLONED, NO_STREAM, OFF, RUNNING, SHUTTING_DOWN, STARTING_UP, TRAFFIC_LIGHT_CHANGED, TRAFFICCONTROL_CONFLICT_GROUP_CHANGED, TRAFFICCONTROL_CONTROLLER_CREATED, TRAFFICCONTROL_CONTROLLER_EVALUATING, TRAFFICCONTROL_CONTROLLER_WARNING, TRAFFICCONTROL_SET_TRACING, TRAFFICCONTROL_STATE_CHANGED, TRAFFICCONTROL_TRACED_VARIABLE_UPDATED, TRAFFICCONTROL_VARIABLE_CREATED
-
Constructor Summary
ConstructorDescriptionCcol
(String id, String controlProgram, Set<TrafficLight> trafficLights, Set<TrafficLightDetector> sensors, org.opentrafficsim.core.dsol.OtsSimulator simulator) Construct a new CCOL communication link. -
Method Summary
Modifier and TypeMethodDescription(package private) Socket
Retrieve the client socket for shutdown.Retrieve the Swing (for now) container in which the controller displays its current state.getId()
Retrieve the Id of the traffic light controller.void
notify
(org.djutils.event.Event event) (package private) void
setClientSocket
(Socket socket) Set the client socket (called from the accept thread).void
updateDetector
(String detectorId, boolean detectingGTU) Tell the traffic controller that the state of a detector has changed.Methods inherited from class org.djutils.event.LocalEventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventListenerMap, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventListenerMap, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
Field Details
-
EVALUATION_INTERVAL
static final org.djunits.value.vdouble.scalar.Duration EVALUATION_INTERVALThe evaluation interval of a CCOL controller.
-
-
Constructor Details
-
Ccol
public Ccol(String id, String controlProgram, Set<TrafficLight> trafficLights, Set<TrafficLightDetector> sensors, org.opentrafficsim.core.dsol.OtsSimulator simulator) throws TrafficControlException, nl.tudelft.simulation.dsol.SimRuntimeException Construct a new CCOL communication link.- Parameters:
id
- String; id of the traffic controllercontrolProgram
- String; name of the CCOL program that this CCOL link must communicate withtrafficLights
- 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 programsensors
- 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 programsimulator
- DevsSimulator<Time, Duration, SimTimeDoubleUnit>; the simulation engine- Throws:
TrafficControlException
- on failure to initialize the connection to the external CCOL programnl.tudelft.simulation.dsol.SimRuntimeException
- on failure to schedule the first evaluation event
-
-
Method Details
-
setClientSocket
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
-
notify
- Specified by:
notify
in interfaceorg.djutils.event.EventListener
- Throws:
RemoteException
-
getId
Retrieve the Id of the traffic light controller.- Specified by:
getId
in interfaceorg.djutils.base.Identifiable
- Specified by:
getId
in interfaceTrafficController
- Returns:
- String; the id of the traffic light controller
-
getFullId
- Specified by:
getFullId
in interfaceorg.opentrafficsim.core.object.NonLocatedObject
-
updateDetector
Tell the traffic controller that the state of a detector has changed.- Specified by:
updateDetector
in interfaceActuatedTrafficController
- Parameters:
detectorId
- String; id of the detectordetectingGTU
- boolean;
-
getDisplayContainer
Retrieve the Swing (for now) container in which the controller displays its current state.- Specified by:
getDisplayContainer
in interfaceActuatedTrafficController
- Returns:
- Container; the display of the current state; may return null!
-