Class CCOL
java.lang.Object
nl.tudelft.simulation.event.EventProducer
org.opentrafficsim.trafficcontrol.ccol.CCOL
- All Implemented Interfaces:
java.io.Serializable
,java.util.EventListener
,nl.tudelft.simulation.event.EventListenerInterface
,nl.tudelft.simulation.event.EventProducerInterface
,Identifiable
,Drawable
,InvisibleObjectInterface
,ActuatedTrafficController
,TrafficController
public class CCOL extends nl.tudelft.simulation.event.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 interface nl.tudelft.simulation.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(java.lang.String id, java.lang.String controlProgram, java.util.Set<TrafficLight> trafficLights, java.util.Set<TrafficLightSensor> sensors, DEVSSimulator<Time,Duration,SimTimeDoubleUnit> simulator)
Construct a new CCOL communication link. -
Method Summary
Modifier and Type Method Description InvisibleObjectInterface
clone(OTSSimulatorInterface newSimulator, Network newNetwork)
java.lang.String
getFullId()
java.lang.String
getId()
Retrieve the Id of the traffic light controller.void
notify(nl.tudelft.simulation.event.EventInterface event)
void
updateDetector(java.lang.String detectorId, boolean detectingGTU)
Tell the traffic controller that the state of a detector has changed.Methods inherited from class nl.tudelft.simulation.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListener
-
Constructor Details
-
CCOL
public CCOL(java.lang.String id, java.lang.String controlProgram, java.util.Set<TrafficLight> trafficLights, java.util.Set<TrafficLightSensor> sensors, DEVSSimulator<Time,Duration,SimTimeDoubleUnit> simulator) throws TrafficControlException, SimRuntimeExceptionConstruct 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
-
notify
public void notify(nl.tudelft.simulation.event.EventInterface event) throws java.rmi.RemoteException- Specified by:
notify
in interfacenl.tudelft.simulation.event.EventListenerInterface
- Throws:
java.rmi.RemoteException
-
getId
public java.lang.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 java.lang.String getFullId()- Specified by:
getFullId
in interfaceInvisibleObjectInterface
-
updateDetector
public void updateDetector(java.lang.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
-