Class CCOL
- java.lang.Object
-
- org.djutils.event.EventProducer
-
- org.opentrafficsim.trafficcontrol.ccol.CCOL
-
- All Implemented Interfaces:
Serializable
,EventListener
,EventListenerInterface
,EventProducerInterface
,Identifiable
,Drawable
,InvisibleObjectInterface
,ActuatedTrafficController
,TrafficController
public class CCOL extends EventProducer implements ActuatedTrafficController
Communication link with a CCOL traffic control program.Copyright (c) 2013-2020 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 Jan 23, 2017
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.djutils.event.EventProducer
eventProducerImpl
-
Fields inherited from interface org.djutils.event.EventProducerInterface
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
Constructors Constructor Description CCOL(String id, String controlProgram, Set<TrafficLight> trafficLights, Set<TrafficLightSensor> sensors, DEVSSimulator<Time,Duration,SimTimeDoubleUnit> simulator)
Construct a new CCOL communication link.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InvisibleObjectInterface
clone(OTSSimulatorInterface newSimulator, Network newNetwork)
Container
getDisplayContainer()
Retrieve the Swing (for now) container in which the controller displays its current state.String
getFullId()
String
getId()
Retrieve the Id of the traffic light controller.Serializable
getSourceId()
void
notify(EventInterface event)
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.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, 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.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypesWithListeners, hasListeners, numberOfListeners, removeListener
-
-
-
-
Constructor Detail
-
CCOL
public CCOL(String id, String controlProgram, Set<TrafficLight> trafficLights, Set<TrafficLightSensor> sensors, DEVSSimulator<Time,Duration,SimTimeDoubleUnit> 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 Detail
-
notify
public void notify(EventInterface event) throws RemoteException
- Specified by:
notify
in interfaceEventListenerInterface
- Throws:
RemoteException
-
getId
public String getId()
Retrieve the Id of the traffic light controller.- Specified by:
getId
in interfaceIdentifiable
- Specified by:
getId
in interfaceTrafficController
- Returns:
- String; the id of the traffic light controller
-
getFullId
public String getFullId()
- Specified by:
getFullId
in interfaceInvisibleObjectInterface
-
updateDetector
public void updateDetector(String detectorId, boolean detectingGTU)
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;
-
clone
public InvisibleObjectInterface clone(OTSSimulatorInterface newSimulator, Network newNetwork) throws NetworkException
- Specified by:
clone
in interfaceInvisibleObjectInterface
- Throws:
NetworkException
-
getSourceId
public Serializable getSourceId()
- Specified by:
getSourceId
in interfaceEventProducerInterface
- Specified by:
getSourceId
in classEventProducer
-
getDisplayContainer
public Container 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!
-
-