Class LinkGTUTransceiver

java.lang.Object
nl.tudelft.simulation.event.EventProducer
org.opentrafficsim.imb.transceiver.AbstractTransceiver
org.opentrafficsim.imb.transceiver.urbanstrategy.LinkGTUTransceiver
All Implemented Interfaces:
Serializable, EventListener, nl.tudelft.simulation.event.EventListenerInterface, nl.tudelft.simulation.event.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.

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 class nl.tudelft.simulation.event.EventProducer

    listeners

    Fields inherited from interface nl.tudelft.simulation.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
    void notify​(nl.tudelft.simulation.event.EventInterface event)
    Object[] transformChange​(nl.tudelft.simulation.event.EventInterface event)
    Transform the GTU added or removed event content to a corresponding IMB message.
    Object[] transformDelete​(nl.tudelft.simulation.event.EventInterface event)
    Transform the removal of a link to the network to a corresponding IMB message.
    Object[] transformNew​(nl.tudelft.simulation.event.EventInterface event)
    Transform the addition of a link to the network to a corresponding IMB message.

    Methods inherited from class nl.tudelft.simulation.event.EventProducer

    addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListener

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface nl.tudelft.simulation.event.EventProducerInterface

    addListener, addListener, addListener, addListener, removeListener
  • Constructor Details

    • LinkGTUTransceiver

      public LinkGTUTransceiver​(org.opentrafficsim.imb.connector.Connector connector, DEVSSimulatorInterface.TimeDoubleUnit simulator, OTSNetwork network) throws org.opentrafficsim.imb.IMBException
      Construct a new LinkGTUTransceiver.
      Parameters:
      connector - Connector; the IMB connector through which this transceiver communicates
      simulator - DEVSSimulatorInterface.TimeDoubleUnit; the simulator to schedule the incoming notifications on
      network - OTSNetwork; the OTS network on which Links are registered
      Throws:
      org.opentrafficsim.imb.IMBException - when the registration of one of the channels fails
      NullPointerException - in case one of the arguments is null.
  • Method Details

    • notify

      public void notify​(nl.tudelft.simulation.event.EventInterface event) throws RemoteException
      Specified by:
      notify in interface nl.tudelft.simulation.event.EventListenerInterface
      Overrides:
      notify in class AbstractTransceiver
      Throws:
      RemoteException
    • transformNew

      public Object[] transformNew​(nl.tudelft.simulation.event.EventInterface event)
      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

      public Object[] transformChange​(nl.tudelft.simulation.event.EventInterface event)
      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

      public Object[] transformDelete​(nl.tudelft.simulation.event.EventInterface event)
      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