public class CCOL extends nl.tudelft.simulation.event.EventProducer implements TrafficController
Copyright (c) 2013-2017 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
| Modifier and Type | Field and Description |
|---|---|
(package private) Thread |
acceptThread
Thread that blocks until accept returns.
|
(package private) static org.djunits.value.vdouble.scalar.Duration |
EVALUATION_INTERVAL
The evaluation interval of a CCOL controller.
|
(package private) String |
id
Name of this CCOL traffic controller.
|
(package private) static int |
PORT
TCP port for incoming connection.
|
(package private) ServerSocket |
serverSocket
Socket used to listen for the incoming connection from the CCOL controller.
|
(package private) nl.tudelft.simulation.dsol.simulators.DEVSSimulator<org.djunits.value.vdouble.scalar.Time,org.djunits.value.vdouble.scalar.Duration,org.opentrafficsim.core.dsol.OTSSimTimeDouble> |
simulator
The simulator.
|
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 and Description |
|---|
CCOL(String id,
String controlProgram,
Set<org.opentrafficsim.road.network.lane.object.trafficlight.TrafficLight> trafficLights,
Set<org.opentrafficsim.road.network.lane.object.sensor.TrafficLightSensor> sensors,
nl.tudelft.simulation.dsol.simulators.DEVSSimulator<org.djunits.value.vdouble.scalar.Time,org.djunits.value.vdouble.scalar.Duration,org.opentrafficsim.core.dsol.OTSSimTimeDouble> simulator)
Construct a new CCOL communication link.
|
| Modifier and Type | Method and Description |
|---|---|
org.opentrafficsim.core.object.InvisibleObjectInterface |
clone(org.opentrafficsim.core.dsol.OTSSimulatorInterface newSimulator,
org.opentrafficsim.core.network.Network newNetwork) |
(package private) Socket |
getClientSocket()
Retrieve the client socket for shutdown.
|
String |
getId()
Retrieve the Id of the traffic light controller.
|
void |
notify(nl.tudelft.simulation.event.EventInterface 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.
|
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListenerfinal String id
final nl.tudelft.simulation.dsol.simulators.DEVSSimulator<org.djunits.value.vdouble.scalar.Time,org.djunits.value.vdouble.scalar.Duration,org.opentrafficsim.core.dsol.OTSSimTimeDouble> simulator
static int PORT
static final org.djunits.value.vdouble.scalar.Duration EVALUATION_INTERVAL
ServerSocket serverSocket
Thread acceptThread
public CCOL(String id, String controlProgram, Set<org.opentrafficsim.road.network.lane.object.trafficlight.TrafficLight> trafficLights, Set<org.opentrafficsim.road.network.lane.object.sensor.TrafficLightSensor> sensors, nl.tudelft.simulation.dsol.simulators.DEVSSimulator<org.djunits.value.vdouble.scalar.Time,org.djunits.value.vdouble.scalar.Duration,org.opentrafficsim.core.dsol.OTSSimTimeDouble> simulator) throws TrafficControlException, nl.tudelft.simulation.dsol.SimRuntimeException
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, OTSSimTimeDouble>; the simulation engineTrafficControlException - on failure to initialize the connection to the external CCOL programnl.tudelft.simulation.dsol.SimRuntimeException - on failure to schedule the first evaluation eventvoid setClientSocket(Socket socket)
socket - Socket; the socket returned by acceptSocket getClientSocket()
public void notify(nl.tudelft.simulation.event.EventInterface event)
throws RemoteException
notify in interface nl.tudelft.simulation.event.EventListenerInterfaceRemoteExceptionpublic String getId()
getId in interface org.opentrafficsim.base.IdentifyablegetId in interface TrafficControllerpublic void updateDetector(String detectorId, boolean detectingGTU)
updateDetector in interface TrafficControllerdetectorId - String; id of the detectordetectingGTU - boolean;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
clone in interface org.opentrafficsim.core.object.InvisibleObjectInterfaceorg.opentrafficsim.core.network.NetworkExceptionCopyright © 2014–2017 Delft University of Technology. All rights reserved.