Event types in OTS¶
Below is a complete list of all event types in OTS. For these events we have the following contract:
ADD
events make no guarantee whatsoever as to the state of the added object, other than it having an id. The object may be in a non-operable state during initialization. These events can be used to register listeners with the added object, and to allocate resources for the object (e.g.Map.put(gtuId, new ArrayList<Speed>());
.- Any other events, such as
MOVE
, must occur with the object in question in a complete state.
This contract means that in some cases, bookkeeping has to take place specifically for the first event of a certain type. For example, the RoadSampler
cannot start up a trajectory on an ADD
event, as the GTU is not yet able to report for example its route. Listeners are however added, and on the first MOVE
, the trajectory may be initiated.
In some cases it could be valuable during an ADD
to register as a listener to some other event, e.g. MOVE
, and to unregister as a listener on the first occurrence of that event.
Table 2.1: Overview of events in OTS.
Class | Event field | Listeners (excluding test code) | Used |
Network | GTU_ADD_EVENT | DefaultAnimationFactory, NetworkAnimation1, AbstractLaneBasedMoveChecker, Publisher2, NetworkModel, StochasticDistractionModel, RampMeteringDemo, OtsAnimationPanel | yes |
GTU_REMOVE_EVENT | DefaultAnimationFactory, NetworkAnimation1, AbstractLaneBasedMoveChecker, Publisher2, NetworkModel, StochasticDistractionModel, RampMeteringDemo, OtsAnimationPanel | yes | |
NONLOCATED_OBJECT_ADD_EVENT | NetworkAnimation1 | yes | |
NONLOCATED_OBJECT_REMOVE_EVENT | NetworkAnimation1 | yes | |
LINK_ADD_EVENT | NetworkAnimation1, Publisher2 | yes | |
LINK_REMOVE_EVENT | NetworkAnimation1, Publisher2 | yes | |
NODE_ADD_EVENT | NetworkAnimation1, Publisher2 | yes | |
NODE_REMOVE_EVENT | NetworkAnimation1, Publisher2 | yes | |
OBJECT_ADD_EVENT | DefaultAnimationFactory, NetworkAnimation1 | yes | |
OBJECT_REMOVE_EVENT | DefaultAnimationFactory, NetworkAnimation1 | yes | |
ROUTE_ADD_EVENT | NetworkAnimation1 | yes | |
ROUTE_REMOVE_EVENT | NetworkAnimation1 | yes | |
Link | GTU_ADD_EVENT | Publisher2 | yes |
GTU_REMOVE_EVENT | Publisher2 | yes | |
CrossSectionLink | LANE_ADD_EVENT | Publisher2 | yes |
LANE_REMOVE_EVENT | Publisher2 | yes | |
Gtu | MOVE_EVENT | Publisher2, GtuTransceiver2 | yes |
DESTROY_EVENT | no | ||
LaneBasedGtu | LANEBASED_MOVE_EVENT | AbstractLaneBasedMoveChecker, RoadSampler | yes |
LANEBASED_DESTROY_EVENT | no | ||
LANE_CHANGE_EVENT | Conflict, StrategiesDemo | yes | |
LANE_ENTER_EVENT | not thrown | no | |
LANE_EXIT_EVENT | not thrown | no | |
Lane | GTU_ADD_EVENT | RoadSampler, TrafficLightDetector | yes |
GTU_REMOVE_EVENT | RoadSampler, TrafficLightDetector | yes | |
OBJECT_ADD_EVENT | no | ||
OBJECT_REMOVE_EVENT | no | ||
DETECTOR_ADD_EVENT | no | ||
DETECTOR_REMOVE_EVENT | no | ||
LaneBasedGtuGenerator | GTU_GENERATED_EVENT | no | |
Detector | DETECTOR_TRIGGER_EVENT | no | |
LoopDetector | LOOP_DETECTOR_TRIGGERED | no | |
LOOP_DETECTOR_AGGREGATE | no | ||
TrafficLightDetector | TRAFFIC_LIGHT_DETECTOR_ TRIGGER_ENTRY_EVENT | TrafficLightDetector, TrafCod, DetectrorImage, Variable | yes |
TRAFFIC_LIGHT_DETECTOR_ TRIGGER_EXIT_EVENT | TrafficLightDetector, TrafCod, DetectrorImage, Variable | yes | |
DirectionalOccupancyDetector | DIRECTIONAL_OCCUPANCY_DETECTOR_ TRIGGER_ENTRY_EVENT | not thrown | no |
DIRECTIONAL_OCCUPANCY_DETECTOR_ TRIGGER_EXIT_EVENT | not thrown | no | |
TrafficController | TRAFFICCONTROL_CONTROLLER_CREATED | no | |
TRAFFICCONTROL_CONTROLLER_EVALUATING | TrafCodModel | yes | |
TRAFFICCONTROL_CONTROLLER_WARNING | TrafCodModel | yes | |
TRAFFICCONTROL_STATE_CHANGED | not thrown | no | |
TRAFFIC_LIGHT_CHANGED | no | ||
TRAFFICCONTROL_VARIABLE_CREATED | no | ||
TRAFFICCONTROL_SET_TRACING | not thrown, TrafCod | yes | |
TRAFFICCONTROL_TRACED_VARIABLE_UPDATED | TrafCodModel | yes | |
TRAFFICCONTROL_CONFLICT_GROUP_CHANGED | TrafCodModel | yes | |
TrafficLight | TRAFFICLIGHT_CHANGE_EVENT | no | |
AbstractPlot | GRAPH_ADD_EVENT | not thrown | no |
GRAPH_REMOVE_EVENT | not thrown | no |
1) Registers as listener, but does (effectively) nothing with it in notify()
.
2) Part of ots-sim0mq
.