Class FundamentalDiagram

All Implemented Interfaces:
org.djutils.base.Identifiable, org.jfree.data.general.Dataset, org.jfree.data.general.SeriesDataset, org.jfree.data.xy.XYDataset

public class FundamentalDiagram extends AbstractBoundedPlot implements org.jfree.data.xy.XYDataset
Fundamental diagram from various sources.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Field Details

    • DEFAULT_PERIODS

      public static final double[] DEFAULT_PERIODS
      Aggregation periods.
    • DEFAULT_UPDATE_FREQUENCIES

      public static final int[] DEFAULT_UPDATE_FREQUENCIES
      Update frequencies (n * 1/period).
  • Constructor Details

  • Method Details

    • increaseTime

      protected void increaseTime(org.djunits.value.vdouble.scalar.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 org.jfree.data.general.SeriesDataset
    • getSeriesKey

      public Comparable<String> getSeriesKey(int series)
      Specified by:
      getSeriesKey in interface org.jfree.data.general.SeriesDataset
    • indexOf

      public int indexOf(Comparable seriesKey)
      Specified by:
      indexOf in interface org.jfree.data.general.SeriesDataset
    • getDomainOrder

      public org.jfree.data.DomainOrder getDomainOrder()
      Specified by:
      getDomainOrder in interface org.jfree.data.xy.XYDataset
    • getItemCount

      public int getItemCount(int series)
      Specified by:
      getItemCount in interface org.jfree.data.xy.XYDataset
    • getX

      public Number getX(int series, int item)
      Specified by:
      getX in interface org.jfree.data.xy.XYDataset
    • getXValue

      public double getXValue(int series, int item)
      Specified by:
      getXValue in interface org.jfree.data.xy.XYDataset
    • getY

      public Number getY(int series, int item)
      Specified by:
      getY in interface org.jfree.data.xy.XYDataset
    • getYValue

      public double getYValue(int series, int item)
      Specified by:
      getYValue in interface org.jfree.data.xy.XYDataset
    • getGraphType

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

      public 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 <L extends LaneData<L>> FundamentalDiagram.FdSource sourceFromSampler(Sampler<?,L> sampler, GraphCrossSection<L> crossSection, boolean aggregateLanes, org.djunits.value.vdouble.scalar.Duration aggregationTime, boolean harmonic)
      Creates a Source from a sampler and positions.
      Type Parameters:
      L - LaneData
      Parameters:
      sampler - Sampler<?, L>; sampler
      crossSection - GraphCrossSection<LaneData>; 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 <L extends LaneData<L>> FundamentalDiagram.FdSource sourceFromSampler(Sampler<?,L> sampler, GraphPath<L> path, boolean aggregateLanes, org.djunits.value.vdouble.scalar.Duration aggregationTime)
      Creates a Source from a sampler and positions.
      Type Parameters:
      L - LaneData
      Parameters:
      sampler - Sampler<?, L>; sampler
      path - GraphPath<LaneData>; 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
    • combinedSource

      public static FundamentalDiagram.FdSource combinedSource(Map<String,FundamentalDiagram.FdSource> sources)
      Combines multiple sources in to one source.
      Parameters:
      sources - Map<String, FdSource>; sources coupled to their names for in the legend
      Returns:
      FdSource; combined source
    • toString

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

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

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

      public List<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 String getTimeInfo()
      Retrieve the time info.
      Returns:
      String; the time info
    • setTimeInfo

      public void setTimeInfo(String timeInfo)
      Set the time info.
      Parameters:
      timeInfo - String; the new time info
    • hasLineFD

      public boolean hasLineFD()
      Return whether the plot has a fundamental diagram line.
      Returns:
      boolean; whether the plot has a fundamental diagram line