Class LaneGTUTransceiver
java.lang.Object
org.djutils.event.EventProducer
org.opentrafficsim.imb.transceiver.AbstractTransceiver
org.opentrafficsim.imb.transceiver.urbanstrategy.LaneGTUTransceiver
- All Implemented Interfaces:
Serializable,EventListener,EventListenerInterface,EventProducerInterface,Identifiable,org.opentrafficsim.imb.transceiver.EventTransceiver,org.opentrafficsim.imb.transceiver.Transceiver
public class LaneGTUTransceiver extends AbstractTransceiver
OTS publishes events about the lanes to IMB, e.g. to know about the number of vehicles on a particular lane.
At the start of the OTS simulation, or when a Lane is added later, a NEW message is sent to IMB to identify the lane, the coordinates of its center line, and the start and end nodes of the link. The CHANGE message is posted whenever a vehicle enters or leaves a link. When a Link is removed from the network, a DELETE event is posted. The Link NEW messages are posted after the Network NEW, Node NEW and Link NEW messages are posted.
At the start of the OTS simulation, or when a Lane is added later, a NEW message is sent to IMB to identify the lane, the coordinates of its center line, and the start and end nodes of the link. The CHANGE message is posted whenever a vehicle enters or leaves a link. When a Link is removed from the network, a DELETE event is posted. The Link NEW messages are posted after the Network NEW, Node NEW and Link NEW messages are posted.
NEW
| Variable | Type | Comments |
|---|---|---|
| timestamp | double | time of the event, in simulation time seconds |
| networkId | String | Id of the Network where the Link resides |
| linkId | String | id of the Link; unique within the Network |
| laneId | String | id of the Lane, unique within the Link |
| laneNumber | int | identification of the lane number within the Link. |
| centerLine.numberOfPoints | int | number of points for the center line of the Lane. The number of doubles that follow is 3 times this number |
| centerLine.x1 | double | x-coordinate of the first point of the center line |
| centerLine.y1 | double | y-coordinate of the first point of the center line |
| centerLine.z1 | double | z-coordinate of the first point of the center line |
| ... | ||
| centerLine.xn | double | x-coordinate of the last point of the center line |
| centerLine.yn | double | y-coordinate of the last point of the center line |
| centerLine.zn | double | z-coordinate of the last point of the center line |
CHANGE
| Variable | Type | Comments |
|---|---|---|
| timestamp | double | time of the event, in simulation time seconds |
| networkId | String | Id of the Network where the Lane resides |
| linkId | String | id of the Link to which the lane belongs |
| laneId | String | id of the Lane, unique within the Link |
| isVehicleAdded | boolean | true if vehicle added, false if vehicle removed |
| gtuId | String | id of the gtu that was added or removed from the Lane |
| countAfterEvent | int | the number of vehicles on the Lane after the event |
DELETE
| Variable | Type | Comments |
|---|---|---|
| timestamp | double | time of the event, in simulation time seconds |
| networkId | String | Id of the Network where the Link resides |
| linkId | String | id of the Link |
| laneId | String | id of the Lane that is removed from the Network |
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.
- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version Sep 13, 2016
- 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 LaneGTUTransceiver(org.opentrafficsim.imb.connector.Connector connector, DEVSSimulatorInterface.TimeDoubleUnit simulator, OTSNetwork network)Construct a new LaneGTUTransceiver. -
Method Summary
Modifier and Type Method Description SerializablegetSourceId()voidnotify(EventInterface event)Object[]transformChange(EventInterface event)Transform the GTU added or removed event content to a corresponding IMB message.Object[]transformDelete(EventInterface event)Transform the removal of a Lane from the network to a corresponding IMB message.Object[]transformNew(EventInterface event)Transform the addition of a Lane to the network to a corresponding IMB message.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, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, getEventTypesWithListeners, 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
-
LaneGTUTransceiver
public LaneGTUTransceiver(org.opentrafficsim.imb.connector.Connector connector, DEVSSimulatorInterface.TimeDoubleUnit simulator, OTSNetwork network) throws org.opentrafficsim.imb.IMBExceptionConstruct a new LaneGTUTransceiver.- 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 Links for Lanes 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
-
transformNew
Transform the addition of a Lane to the network to a corresponding IMB message.- Parameters:
event- EventInterface; the event to transform to a NEW message.- Returns:
- the NEW payload
-
transformChange
Transform the GTU added or removed event content to a corresponding IMB message.- Parameters:
event- EventInterface; the event to transform to a CHANGE message.- Returns:
- the CHANGE payload
-
transformDelete
Transform the removal of a Lane from the network to a corresponding IMB message.- Parameters:
event- EventInterface; the event to transform to a DELETE message.- Returns:
- the DELETE payload
-
getSourceId
- Specified by:
getSourceIdin interfaceEventProducerInterface- Specified by:
getSourceIdin classEventProducer
-