public class TrafCOD extends nl.tudelft.simulation.event.EventProducer implements TrafficController
Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
TrafCOD.ParserState
States of the rule parser.
|
(package private) static class |
TrafCOD.Token
Types of TrafCOD tokens.
|
Modifier and Type | Field and Description |
---|---|
(package private) static String |
COMMENT_START
Comment starter in TrafCOD.
|
(package private) String |
controllerName
Name of this TrafCod controller.
|
(package private) Map<String,Variable> |
detectors
The detectors.
|
(package private) static org.djunits.value.vdouble.scalar.Duration |
EVALUATION_INTERVAL
The evaluation interval of TrafCOD.
|
(package private) List<Object[]> |
tokenisedRules
The tokenised rules.
|
(package private) static int |
TRAFCOD_VERSION
Version of the supported TrafCOD files.
|
(package private) List<String> |
trafcodRules
The original rules.
|
static nl.tudelft.simulation.event.EventType |
TRAFFIC_LIGHT_CHANGED
Event that is fired whenever a traffic light changes state.
|
(package private) Map<String,Variable> |
variables
The TrafCOD variables.
|
Constructor and Description |
---|
TrafCOD(String controllerName,
String trafCodURL,
Set<org.opentrafficsim.road.network.lane.object.trafficlight.TrafficLight> trafficLights,
Set<org.opentrafficsim.road.network.lane.object.sensor.Sensor> 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) |
Modifier and Type | Method and Description |
---|---|
protected nl.tudelft.simulation.dsol.simulators.SimulatorInterface<org.djunits.value.vdouble.scalar.Time,org.djunits.value.vdouble.scalar.Duration,org.opentrafficsim.core.dsol.OTSSimTimeDouble> |
getSimulator()
Retrieve the simulator.
|
int |
getStructureNumber()
Retrieve the structure number.
|
static void |
main(String[] args)
Test code
|
void |
setStructureNumber(int structureNumber)
Set the structure number.
|
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, removeListener
final String controllerName
static final int TRAFCOD_VERSION
static final org.djunits.value.vdouble.scalar.Duration EVALUATION_INTERVAL
static final String COMMENT_START
public static final nl.tudelft.simulation.event.EventType TRAFFIC_LIGHT_CHANGED
public TrafCOD(String controllerName, String trafCodURL, Set<org.opentrafficsim.road.network.lane.object.trafficlight.TrafficLight> trafficLights, Set<org.opentrafficsim.road.network.lane.object.sensor.Sensor> 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 Exception
controllerName
- String; name of this traffic light controllertrafCodURL
- String; the URL of the TrafCOD rulestrafficLights
- 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<Sensor>; 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 engineException
- when a rule cannot be parsedpublic static void main(String[] args) throws Exception
args
- String; the command line arguments (not used)Exception
- when network cannot be createdprotected nl.tudelft.simulation.dsol.simulators.SimulatorInterface<org.djunits.value.vdouble.scalar.Time,org.djunits.value.vdouble.scalar.Duration,org.opentrafficsim.core.dsol.OTSSimTimeDouble> getSimulator()
public int getStructureNumber()
public void setStructureNumber(int structureNumber)
structureNumber
- int; the new structureNumber.public void updateDetector(String detectorId, boolean detectingGTU)
updateDetector
in interface TrafficController
detectorId
- String; id of the detectordetectingGTU
- boolean;Copyright © 2014–2016 Delft University of Technology. All rights reserved.