Class LinkGTUTransceiver
java.lang.Object
org.djutils.event.EventProducer
org.opentrafficsim.imb.transceiver.AbstractTransceiver
org.opentrafficsim.imb.transceiver.urbanstrategy.LinkGTUTransceiver
- All Implemented Interfaces:
Serializable,EventListener,EventListenerInterface,EventProducerInterface,Identifiable,org.opentrafficsim.imb.transceiver.EventTransceiver,org.opentrafficsim.imb.transceiver.Transceiver
public class LinkGTUTransceiver extends AbstractTransceiver
OTS publishes events about the links to IMB, e.g. to know about the number of vehicles on a link.
At the start of the OTS simulation, or when a Link is added later, a NEW message is sent to IMB to identify the link, the coordinates of its design 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 and Node NEW messages are posted.
At the start of the OTS simulation, or when a Link is added later, a NEW message is sent to IMB to identify the link, the coordinates of its design 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 and Node 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 |
| startNodeId | String | id of the start node, provided in a Node NEW message |
| endNodeId | String | id of the end node, provided in a Node NEW message |
| designLine.numberOfPoints | int | number of points for the design line of the Link. The number of doubles that follow is 3 times this number |
| designLine.x1 | double | x-coordinate of the first point of the design line |
| designLine.y1 | double | y-coordinate of the first point of the design line |
| designLine.z1 | double | z-coordinate of the first point of the design line |
| ... | ||
| designLine.xn | double | x-coordinate of the last point of the design line |
| designLine.yn | double | y-coordinate of the last point of the design line |
| designLine.zn | double | z-coordinate of the last point of the design line |
CHANGE
| 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 |
| isVehicleAdded | boolean | true if vehicle added, false if vehicle removed |
| gtuId | String | id of the gtu that was added or removed from the Link |
| countAfterEvent | int | the number of vehicles on the link 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 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 LinkGTUTransceiver(org.opentrafficsim.imb.connector.Connector connector, DEVSSimulatorInterface.TimeDoubleUnit simulator, OTSNetwork network)Construct a new LinkGTUTransceiver. -
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 link to the network to a corresponding IMB message.Object[]transformNew(EventInterface event)Transform the addition of a link 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
-
LinkGTUTransceiver
public LinkGTUTransceiver(org.opentrafficsim.imb.connector.Connector connector, DEVSSimulatorInterface.TimeDoubleUnit simulator, OTSNetwork network) throws org.opentrafficsim.imb.IMBExceptionConstruct a new LinkGTUTransceiver.- 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 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 link 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 link to 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
-