Class Ccol
java.lang.Object
org.djutils.event.LocalEventProducer
org.opentrafficsim.trafficcontrol.ccol.Ccol
- All Implemented Interfaces:
Serializable,Remote,EventListener,org.djutils.event.EventListener,org.djutils.event.EventProducer,org.opentrafficsim.base.Identifiable,org.opentrafficsim.core.animation.Drawable,org.opentrafficsim.core.object.NonLocatedObject,ActuatedTrafficController,TrafficController
Communication link with a CCOL traffic control program.
Copyright (c) 2013-2023 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
FieldsModifier and TypeFieldDescription(package private) static final DurationThe evaluation interval of a CCOL controller.Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITIONFields 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
ConstructorsConstructorDescriptionCcol(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) SocketRetrieve 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.voidnotify(org.djutils.event.Event event) (package private) voidsetClientSocket(Socket socket) Set the client socket (called from the accept thread).voidupdateDetector(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, removeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
The 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, 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 programSimRuntimeException- 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:
notifyin interfaceorg.djutils.event.EventListener- Throws:
RemoteException
-
getId
Retrieve the Id of the traffic light controller.- Specified by:
getIdin interfaceorg.opentrafficsim.base.Identifiable- Specified by:
getIdin interfaceTrafficController- Returns:
- String; the id of the traffic light controller
-
getFullId
- Specified by:
getFullIdin interfaceorg.opentrafficsim.core.object.NonLocatedObject
-
updateDetector
Tell the traffic controller that the state of a detector has changed.- Specified by:
updateDetectorin 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:
getDisplayContainerin interfaceActuatedTrafficController- Returns:
- Container; the display of the current state; may return null!
-