Class FundamentalDiagram

java.lang.Object
All Implemented Interfaces:
Dataset, SeriesDataset, XYDataset, Identifiable

public class FundamentalDiagram
extends AbstractBoundedPlot
implements XYDataset
Fundamental diagram from various sources.

Copyright (c) 2013-2019 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 14 okt. 2018
Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Field Details

  • Constructor Details

    • FundamentalDiagram

      public FundamentalDiagram​(java.lang.String caption, FundamentalDiagram.Quantity domainQuantity, FundamentalDiagram.Quantity rangeQuantity, OTSSimulatorInterface simulator, FundamentalDiagram.FdSource source)
      Constructor.
      Parameters:
      caption - String; caption
      domainQuantity - Quantity; initial quantity on the domain axis
      rangeQuantity - Quantity; initial quantity on the range axis
      simulator - OTSSimulatorInterface; simulator
      source - FdSource; source providing the data
    • FundamentalDiagram

      public FundamentalDiagram​(java.lang.String caption, FundamentalDiagram.Quantity domainQuantity, FundamentalDiagram.Quantity rangeQuantity, OTSSimulatorInterface simulator, Sampler<?> sampler, GraphCrossSection<KpiLaneDirection> crossSection, boolean aggregateLanes, Duration aggregationTime, boolean harmonic)
      Constructor using a sampler as source.
      Parameters:
      caption - String; caption
      domainQuantity - Quantity; initial quantity on the domain axis
      rangeQuantity - Quantity; initial quantity on the range axis
      simulator - OTSSimulatorInterface; simulator
      sampler - Sampler<?>; sampler
      crossSection - GraphCrossSection<KpiLaneDirection>; lanes
      aggregateLanes - boolean; whether to aggregate the positions
      aggregationTime - Duration; aggregation time (and update time)
      harmonic - boolean; harmonic mean
    • FundamentalDiagram

      public FundamentalDiagram​(java.lang.String caption, FundamentalDiagram.Quantity domainQuantity, FundamentalDiagram.Quantity rangeQuantity, OTSSimulatorInterface simulator, Sampler<?> sampler, GraphPath<KpiLaneDirection> path, boolean aggregateLanes, Duration aggregationTime)
      Constructor using a sampler as source.
      Parameters:
      caption - String; caption
      domainQuantity - Quantity; initial quantity on the domain axis
      rangeQuantity - Quantity; initial quantity on the range axis
      simulator - OTSSimulatorInterface; simulator
      sampler - Sampler<?>; sampler
      path - GraphPath<KpiLaneDirection>; lanes
      aggregateLanes - boolean; whether to aggregate the positions
      aggregationTime - Duration; aggregation time (and update time)
  • Method Details

    • increaseTime

      protected void increaseTime​(Time time)
      Increase the simulated time span.
      Specified by:
      increaseTime in class AbstractPlot
      Parameters:
      time - Time; time to increase to
    • getSeriesCount

      public int getSeriesCount()
      Specified by:
      getSeriesCount in interface SeriesDataset
    • getSeriesKey

      public java.lang.Comparable<java.lang.String> getSeriesKey​(int series)
      Specified by:
      getSeriesKey in interface SeriesDataset
    • indexOf

      public int indexOf​(java.lang.Comparable seriesKey)
      Specified by:
      indexOf in interface SeriesDataset
    • getDomainOrder

      public DomainOrder getDomainOrder()
      Specified by:
      getDomainOrder in interface XYDataset
    • getItemCount

      public int getItemCount​(int series)
      Specified by:
      getItemCount in interface XYDataset
    • getX

      public java.lang.Number getX​(int series, int item)
      Specified by:
      getX in interface XYDataset
    • getXValue

      public double getXValue​(int series, int item)
      Specified by:
      getXValue in interface XYDataset
    • getY

      public java.lang.Number getY​(int series, int item)
      Specified by:
      getY in interface XYDataset
    • getYValue

      public double getYValue​(int series, int item)
      Specified by:
      getYValue in interface XYDataset
    • getGraphType

      public GraphType getGraphType()
      Return the graph type for transceiver.
      Specified by:
      getGraphType in class AbstractPlot
      Returns:
      GraphType; the graph type.
    • getStatusLabel

      public java.lang.String getStatusLabel​(double domainValue, double rangeValue)
      Returns the status label when the mouse is over the given location.
      Specified by:
      getStatusLabel in class AbstractPlot
      Parameters:
      domainValue - double; domain value (x-axis)
      rangeValue - double; range value (y-axis)
      Returns:
      String; status label when the mouse is over the given location
    • sourceFromSampler

      public static FundamentalDiagram.FdSource sourceFromSampler​(Sampler<?> sampler, GraphCrossSection<KpiLaneDirection> crossSection, boolean aggregateLanes, Duration aggregationTime, boolean harmonic)
      Creates a Source from a sampler and positions.
      Parameters:
      sampler - Sampler<?>; sampler
      crossSection - GraphCrossSection<KpiLaneDirection>; cross section
      aggregateLanes - boolean; whether to aggregate the positions
      aggregationTime - Duration; aggregation time (and update time)
      harmonic - boolean; harmonic mean
      Returns:
      Source; source for a fundamental diagram from a sampler and positions
    • sourceFromSampler

      public static FundamentalDiagram.FdSource sourceFromSampler​(Sampler<?> sampler, GraphPath<KpiLaneDirection> path, boolean aggregateLanes, Duration aggregationTime)
      Creates a Source from a sampler and positions.
      Parameters:
      sampler - Sampler<?>; sampler
      path - GraphPath<KpiLaneDirection>; cross section
      aggregateLanes - boolean; whether to aggregate the positions
      aggregationTime - Duration; aggregation time (and update time)
      Returns:
      Source; source for a fundamental diagram from a sampler and positions
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • getSource

      public FundamentalDiagram.FdSource getSource()
      Get the data source.
      Returns:
      FdSource; the data source
    • getLegend

      public LegendItemCollection getLegend()
      Retrievee the legend of this FundamentalDiagram.
      Returns:
      LegendItemCollection; the legend
    • getLaneVisible

      public java.util.List<java.lang.Boolean> getLaneVisible()
      Return the list of lane visibility flags.
      Returns:
      List<Boolean>; the list of lane visibility flags
    • getDomainQuantity

      public FundamentalDiagram.Quantity getDomainQuantity()
      Return the domain quantity.
      Returns:
      Quantity; the domain quantity
    • setDomainQuantity

      public void setDomainQuantity​(FundamentalDiagram.Quantity domainQuantity)
      Set the domain quantity.
      Parameters:
      domainQuantity - Quantity; the new domain quantity
    • getOtherQuantity

      public FundamentalDiagram.Quantity getOtherQuantity()
      Get the other (non domain; vertical axis) quantity.
      Returns:
      Quantity; the quantity for the vertical axis
    • setOtherQuantity

      public void setOtherQuantity​(FundamentalDiagram.Quantity otherQuantity)
      Set the other (non domain; vertical axis) quantity.
      Parameters:
      otherQuantity - Quantity; the quantity for the vertical axis
    • getRangeQuantity

      public FundamentalDiagram.Quantity getRangeQuantity()
      Get the range quantity.
      Returns:
      Quantity; the range quantity
    • setRangeQuantity

      public void setRangeQuantity​(FundamentalDiagram.Quantity rangeQuantity)
      Set the range quantity.
      Parameters:
      rangeQuantity - Quantity; the new range quantity
    • getTimeInfo

      public java.lang.String getTimeInfo()
      Retrieve the time info.
      Returns:
      String; the time info
    • setTimeInfo

      public void setTimeInfo​(java.lang.String timeInfo)
      Set the time info.
      Parameters:
      timeInfo - String; the new time info