Class GraphTransceiver

java.lang.Object
nl.tudelft.simulation.event.EventProducer
org.opentrafficsim.imb.transceiver.AbstractTransceiver
org.opentrafficsim.core.graphs.imb.GraphTransceiver
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 GraphTransceiver
extends AbstractTransceiver
OTS can publish graphs to IMB, e.g. trajectory graphs, flow graphs and density graphs.
When a graph is published for the first time, a NEW message is sent to IMB to identify the graph, the image resolution, and the lane(s) for which the graph is created. The CHANGE message is posted whenever an updated graph is posted. When a Graph is no longer published, a DELETE event is posted. The Graph NEW messages are posted after the Network NEW, Node NEW, Link NEW, and Lane NEW messages are posted, as it has to be able to identify Lanes.

NEW

 
Variable Type Comments
timestamp double time of the event, in simulation time seconds
graphId String a unique id for the graph, e.g. a UUID string
width int width of the graph in pixels
height int height of the graph in pixels
description String textual description of the graph
graphType String type of graph; one of TRAJECTORY, SPEED_CONTOUR, ACCELERATION_CONTOUR, DENSITY_CONTOUR, FLOW_CONTOUR, FUNDAMENTAL_DIAGRAM
time_resolution double For the four types of contour graphs, and the trajectory graph, it provides the aggregation in seconds. 0.0 for other types of graphs. When the value is 0.0 for the trajectory graph, the graph is updated on the basis of events from the GTU.
value_resolution double For the four types of contour graphs, it provides the aggregation in the SI unit of the value. 0.0 for other types of graphs
networkId String id of the Network for which the Graph is made
numberOfLanes int number of Link-Lane combinations for this Graph
linkId_1 String id of the first Link; unique within the Network
laneId_1 String id of the first Lane, unique within the Link
...    
linkId_n String id of the last Link; unique within the Network
laneId_n String id of the last Lane, unique within the Link
transmissionInterval double transmission interval of the graph in seconds

CHANGE

 
Variable Type Comments
timestamp double time of the event, in simulation time seconds
graphId String the unique id for the graph, e.g. a UUID string
width int width of the graph in pixels
height int height of the graph in pixels
image data byte[] image in PNG format; starts with the standard 8-byte signature 89 50 4E 47 0D 0A 1A 0A.

DELETE

 
Variable Type Comments
timestamp double time of the event, in simulation time seconds
graphId String the unique id for the graph that is removed
width int width of the graph in pixels
height int height of the graph in pixels

Note: when two resolutions for the same graph are sent over the network, they have the same graphId but a different width and/or height. This means that the combination of graphId, width, and height creates a unique key for the graph.

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 16, 2016
Author:
Alexander Verbraeck, Peter Knoppers
See Also:
Serialized Form
  • Constructor Details

    • GraphTransceiver

      public GraphTransceiver​(org.opentrafficsim.imb.connector.Connector connector, OTSSimulatorInterface simulator, Network network, int width, int height, AbstractPlot plot, Duration transmissionInterval) throws org.opentrafficsim.imb.IMBException
      Construct a new GraphTransceiver.
      Parameters:
      connector - Connector; the IMB connector
      simulator - OTSSimulatorInterface; the simulator
      network - Network; the network
      width - int; the width of the graph, in pixels
      height - int; the height of the graph, in pixels
      plot - AbstractPlot; the graph
      transmissionInterval - Duration; the interval between generation of graphs
      Throws:
      org.opentrafficsim.imb.IMBException - when the message cannot be posted, or the scheduling of the publish event fails
  • Method Details

    • makePNG

      public void makePNG​(AbstractPlot plot) throws IOException, org.opentrafficsim.imb.IMBException, SimRuntimeException
      Parameters:
      plot - AbstractPlot; the plot to generate the PNG for
      Throws:
      IOException - when the creation of the PNG has failed
      org.opentrafficsim.imb.IMBException - when the transmission of the IMB message fails
      SimRuntimeException - when the scheduling of the next publish event fails