Skip to content

Event types in OTS

Below is a complete list of all event types in OTS. For these events we have the following contract:

  1. 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>());.
  2. 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.

ClassEvent fieldListeners (excluding test code)Used
NetworkGTU_ADD_EVENTDefaultAnimationFactory, NetworkAnimation1, AbstractLaneBasedMoveChecker, Publisher2, NetworkModel, StochasticDistractionModel, RampMeteringDemo, OtsAnimationPanelyes
GTU_REMOVE_EVENTDefaultAnimationFactory, NetworkAnimation1, AbstractLaneBasedMoveChecker, Publisher2, NetworkModel, StochasticDistractionModel, RampMeteringDemo, OtsAnimationPanelyes
NONLOCATED_OBJECT_ADD_EVENTNetworkAnimation1yes
NONLOCATED_OBJECT_REMOVE_EVENTNetworkAnimation1yes
LINK_ADD_EVENTNetworkAnimation1, Publisher2yes
LINK_REMOVE_EVENTNetworkAnimation1, Publisher2yes
NODE_ADD_EVENTNetworkAnimation1, Publisher2yes
NODE_REMOVE_EVENTNetworkAnimation1, Publisher2yes
OBJECT_ADD_EVENTDefaultAnimationFactory, NetworkAnimation1yes
OBJECT_REMOVE_EVENTDefaultAnimationFactory, NetworkAnimation1yes
ROUTE_ADD_EVENTNetworkAnimation1yes
ROUTE_REMOVE_EVENTNetworkAnimation1yes
LinkGTU_ADD_EVENTPublisher2yes
GTU_REMOVE_EVENTPublisher2yes
CrossSectionLinkLANE_ADD_EVENTPublisher2yes
LANE_REMOVE_EVENTPublisher2yes
GtuMOVE_EVENTPublisher2, GtuTransceiver2yes
DESTROY_EVENTno
LaneBasedGtuLANEBASED_MOVE_EVENTAbstractLaneBasedMoveChecker, RoadSampleryes
LANEBASED_DESTROY_EVENTno
LANE_CHANGE_EVENTConflict, StrategiesDemoyes
LANE_ENTER_EVENTnot thrownno
LANE_EXIT_EVENTnot thrownno
LaneGTU_ADD_EVENTRoadSampler, TrafficLightDetectoryes
GTU_REMOVE_EVENTRoadSampler, TrafficLightDetectoryes
OBJECT_ADD_EVENTno
OBJECT_REMOVE_EVENTno
DETECTOR_ADD_EVENTno
DETECTOR_REMOVE_EVENTno
LaneBasedGtuGeneratorGTU_GENERATED_EVENTno
DetectorDETECTOR_TRIGGER_EVENTno
LoopDetectorLOOP_DETECTOR_TRIGGEREDno
LOOP_DETECTOR_AGGREGATEno
TrafficLightDetectorTRAFFIC_LIGHT_DETECTOR_ TRIGGER_ENTRY_EVENTTrafficLightDetector, TrafCod, DetectrorImage, Variableyes
TRAFFIC_LIGHT_DETECTOR_ TRIGGER_EXIT_EVENTTrafficLightDetector, TrafCod, DetectrorImage, Variableyes
DirectionalOccupancyDetectorDIRECTIONAL_OCCUPANCY_DETECTOR_ TRIGGER_ENTRY_EVENTnot thrownno
DIRECTIONAL_OCCUPANCY_DETECTOR_ TRIGGER_EXIT_EVENTnot thrownno
TrafficControllerTRAFFICCONTROL_CONTROLLER_CREATEDno
TRAFFICCONTROL_CONTROLLER_EVALUATINGTrafCodModelyes
TRAFFICCONTROL_CONTROLLER_WARNINGTrafCodModelyes
TRAFFICCONTROL_STATE_CHANGEDnot thrownno
TRAFFIC_LIGHT_CHANGEDno
TRAFFICCONTROL_VARIABLE_CREATEDno
TRAFFICCONTROL_SET_TRACINGnot thrown, TrafCodyes
TRAFFICCONTROL_TRACED_VARIABLE_UPDATEDTrafCodModelyes
TRAFFICCONTROL_CONFLICT_GROUP_CHANGEDTrafCodModelyes
TrafficLightTRAFFICLIGHT_CHANGE_EVENTno
AbstractPlotGRAPH_ADD_EVENTnot thrownno
GRAPH_REMOVE_EVENTnot thrownno

1) Registers as listener, but does (effectively) nothing with it in notify().
2) Part of ots-sim0mq.