Class GTUTransceiver
- All Implemented Interfaces:
Serializable,EventListener,EventListenerInterface,EventProducerInterface,Identifiable,org.opentrafficsim.imb.transceiver.EventTransceiver,org.opentrafficsim.imb.transceiver.Transceiver
public class GTUTransceiver extends AbstractTransceiver
- LaneBasedGTU.LANEBASED_INIT_EVENT as an IMB NEW event for a GTU entering the network. This also is done for GTUs that have been registered at the start of the simulation.
- LaneBasedGTU.LANEBASED_MOVE_EVENT as an IMB CHANGE event for a GTU that moves on the network.
- LaneBasedGTU.LANEBASED_DESTROY_EVENT as an IMB DELETE event for a GTU that leaves the network.
OTS publishes events about GTUs (vehicles) to IMB, e.g. to calculate statistics or emissions from the vehicles or to display them in the US animation.
When a GTU is created, a NEW message is sent to IMB to identify the GTU and its initial characteristics, including the lane on which it resides with its reference point, and the position on the lane. The CHANGE message is posted whenever a vehicle initiates a new OperationalPlan, which coincides with a MOVE Event in OTS. When a GTU is removed from the network, a DELETE event is posted. The GTU NEW messages are posted after the Network NEW, Node NEW, Link NEW, and Lane NEW messages are posted to ensure the Lane on which the GTU resides is known.
The longitudinal position of a GTU on a lane is the (projected) position on the center line of the lane, in meters. The zero-point is chosen at the start of the center line of the lane that has been provided in the Lane_GTU NEW message.
NEW
| Variable | Type | Comments |
|---|---|---|
| timestamp | double | time of the event, in simulation time seconds |
| gtuId | String | id of the GTU that has been added to the simulation |
| position.x | double | x-coordinate of the gtu position in (gis) coordinates |
| position.y | double | y-coordinate of the gtu position in (gis) coordinates |
| position.z | double | z-coordinate of the gtu position in (gis) coordinates |
| position.rotZ | double | angle in the x-y plane of the gtu |
| networkId | String | Id of the Network where the gtu's reference point is |
| linkId | String | id of the Link; unique within the Network |
| laneId | String | id of the Lane, unique within the Link |
| longitudinalPosition | double | gtu position on the center line of the lane, in meters |
| length | double | length of the gtu, in meters |
| width | double | width of the gtu, in meters |
| baseColor.R | byte | R-component of the gtu's base color |
| baseColor.G | byte | G-component of the gtu's base color |
| baseColor.B | byte | B-component of the gtu's base color |
CHANGE
| Variable | Type | Comments |
|---|---|---|
| timestamp | double | time of the event, in simulation time seconds |
| gtuId | String | id of the vehicle that has a new position |
| position.x | double | x-coordinate of the gtu position at the timestamp |
| position.y | double | y-coordinate of the gtu position at the timestamp |
| position.z | double | z-coordinate of the gtu position at the timestamp |
| position.rotZ | double | angle in the x-y plane of the gtu |
| networkId | String | Id of the Network where the gtu's reference point is |
| linkId | String | id of the Link; unique within the Network |
| laneId | String | id of the Lane, unique within the Link |
| longitudinalPosition | double | gtu position on the center line of the lane, in meters |
| speed | double | current speed of the gtu, in m/s |
| acceleration | double | current acceleration of the gtu, in m/s2 |
| turnIndicatorStatus | String | one of {NONE, LEFT, RIGHT, HAZARD, NOTPRESENT} |
| brakingLights | boolean | braking lights on or off |
| odometer | double | odometer reading of the GTU, in meters |
DELETE
| Variable | Type | Comments |
|---|---|---|
| timestamp | double | time of the event, in simulation time seconds |
| gtuId | String | id of the GTU that that is removed from the simulation |
| lastPosition.x | double | x-coordinate of the gtu position at removal |
| lastPosition.y | double | y-coordinate of the gtu position at removal |
| lastPosition.z | double | z-coordinate of the gtu position at removal |
| position.rotZ | double | angle in the x-y plane of the gtu |
| lastNetworkId | String | Id of the Network where the Link resides |
| lastLinkId | String | id of the Link where the GTU was destroyed |
| lastLaneId | String | id of the Lane in the Link where the GTU was destroyed |
| lastLongitudinalPosition | double | gtu position on the center line of the lane, in meters |
| odometer | double | final odometer reading of the GTU, in meters |
Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION -
Constructor Summary
Constructors Constructor Description GTUTransceiver(org.opentrafficsim.imb.connector.Connector connector, DEVSSimulatorInterface.TimeDoubleUnit simulator, OTSNetwork network)Construct a new GTUTransceiver. -
Method Summary
Modifier and Type Method Description SerializablegetSourceId()voidnotify(EventInterface event)Methods inherited from class org.opentrafficsim.imb.transceiver.AbstractTransceiver
addIMBtoOTSChannel, addIMBtoOTSChannel, addOTSToIMBChannel, getConnector, getId, getSimulator, handleMessageFromIMB, removeOTSToIMBChannel, toStringMethods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djutils.event.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypesWithListeners, hasListeners, numberOfListeners, removeListener
-
Constructor Details
-
GTUTransceiver
public GTUTransceiver(org.opentrafficsim.imb.connector.Connector connector, DEVSSimulatorInterface.TimeDoubleUnit simulator, OTSNetwork network) throws org.opentrafficsim.imb.IMBExceptionConstruct a new GTUTransceiver.- Parameters:
connector- Connector; the IMB connector through which this transceiver communicatessimulator- DEVSSimulatorInterface.TimeDoubleUnit; the simulator to schedule the incoming notifications onnetwork- OTSNetwork; the OTS network on which GTUs are registered- Throws:
org.opentrafficsim.imb.IMBException- when the registration of one of the channels failsNullPointerException- in case one of the arguments is null.
-
-
Method Details
-
notify
- Specified by:
notifyin interfaceEventListenerInterface- Overrides:
notifyin classAbstractTransceiver- Throws:
RemoteException
-
getSourceId
- Specified by:
getSourceIdin interfaceEventProducerInterface- Specified by:
getSourceIdin classEventProducer
-