public class TrafCOD extends AbstractTrafficController implements ActuatedTrafficController, nl.tudelft.simulation.event.EventListenerInterface
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
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 |
---|
TrafCOD(String controllerName,
URL trafCodURL,
OTSSimulatorInterface simulator,
Container display)
Construct a new TrafCOD traffic light controller.
|
Modifier and Type | Method and Description |
---|---|
void |
checkConsistency()
Check the consistency of the traffic control program.
|
InvisibleObjectInterface |
clone(OTSSimulatorInterface newSimulator,
Network newNetwork) |
String |
getFullId() |
SimulatorInterface<Time,Duration,SimTimeDoubleUnit> |
getSimulator()
Retrieve the simulator.
|
int |
getStructureNumber()
Retrieve the structure number.
|
void |
notify(nl.tudelft.simulation.event.EventInterface event) |
void |
traceVariable(String variableName,
int stream,
boolean trace)
Switch tracing of one variable on or off.
|
void |
traceVariablesOfStream(int stream,
boolean trace)
Switch tracing of all variables of a particular traffic stream, or all variables that do not have an associated traffic
stream on or off.
|
void |
updateDetector(String detectorId,
boolean detectingGTU)
Tell the traffic controller that the state of a detector has changed.
|
getId
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getId
public TrafCOD(String controllerName, URL trafCodURL, OTSSimulatorInterface simulator, Container display) throws TrafficControlException, SimRuntimeException
controllerName
- String; name of this TrafCOD traffic light controllertrafCodURL
- URL; the URL of the TrafCOD rulessimulator
- OTSSimulatorInterface; the simulation enginedisplay
- Container; if non-null, a controller display is constructed and shown in the supplied containerTrafficControlException
- when a rule cannot be parsedSimRuntimeException
- when scheduling the first evaluation event failspublic void checkConsistency() throws SimRuntimeException, TrafficControlException
SimRuntimeException
- when the simulation model is not an OTSModelInterfaceTrafficControlException
- when a required traffic light or sensor is not present in the networkpublic SimulatorInterface<Time,Duration,SimTimeDoubleUnit> getSimulator()
public int getStructureNumber()
public void updateDetector(String detectorId, boolean detectingGTU)
updateDetector
in interface ActuatedTrafficController
detectorId
- String; id of the detectordetectingGTU
- boolean;public void traceVariablesOfStream(int stream, boolean trace)
stream
- int; the traffic stream number, or TrafCOD.NO_STREAM
to affect all variables that do not have
an associated traffic streamtrace
- boolean; if true; switch on tracing; if false; switch off tracingpublic void traceVariable(String variableName, int stream, boolean trace)
variableName
- String; name of the variablestream
- int; traffic stream of the variable, or TrafCOD.NO_STREAM
to select a variable that does not
have an associated traffic streamtrace
- boolean; if true; switch on tracing; if false; switch off tracingpublic void notify(nl.tudelft.simulation.event.EventInterface event) throws RemoteException
notify
in interface nl.tudelft.simulation.event.EventListenerInterface
RemoteException
public String getFullId()
getFullId
in interface InvisibleObjectInterface
public final InvisibleObjectInterface clone(OTSSimulatorInterface newSimulator, Network newNetwork) throws NetworkException
clone
in interface InvisibleObjectInterface
NetworkException
Copyright © 2014–2019 Delft University of Technology. All rights reserved.