Class FdDataSource

All Implemented Interfaces:
EventProducer

public abstract class FdDataSource extends PlotDelegate<FundamentalDiagram.FdPaintState,FundamentalDiagram>
Data source for a fundamental diagram.

Copyright (c) 2026-2026 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

    • UPDATES_PER_PERIOD

      public static final EventType UPDATES_PER_PERIOD
      Updates per period.
    • AGGREGATION_PERIOD

      public static final EventType AGGREGATION_PERIOD
      Aggregation period.
  • Constructor Details

    • FdDataSource

      public FdDataSource(org.djunits.value.vdouble.scalar.Duration aggregationInterval, org.djunits.value.vdouble.scalar.Duration delay, PlotScheduler plotScheduler)
      Constructor.
      Parameters:
      aggregationInterval - aggregation interval
      delay - delay
      plotScheduler - plot scheduler
    • FdDataSource

      public FdDataSource(org.djunits.value.vdouble.scalar.Duration aggregationInterval, org.djunits.value.vdouble.scalar.Duration delay, PlotScheduler plotScheduler, PlotSetting<org.djunits.value.vdouble.scalar.Duration> aggregationPeriodSetting, PlotSetting<Integer> updatesPerPeriodSetting)
      Constructor.
      Parameters:
      aggregationInterval - aggregation interval
      delay - delay
      plotScheduler - plot scheduler
      aggregationPeriodSetting - setting for aggregation period
      updatesPerPeriodSetting - setting for updates per period
  • Method Details

    • getAggregationPeriodSetting

      public PlotSetting<org.djunits.value.vdouble.scalar.Duration> getAggregationPeriodSetting()
      Returns the aggregation period setting.
      Returns:
      aggregation period setting
    • getUpdatesPerPeriodSetting

      public PlotSetting<Integer> getUpdatesPerPeriodSetting()
      Returns the updates per period setting.
      Returns:
      updates per period setting
    • getUpdatesPerPeriod

      public int getUpdatesPerPeriod()
      The updates per period.
      Returns:
      updates per period
    • setUpdatesPerPeriod

      public void setUpdatesPerPeriod(int n)
      Changes the updates per period.
      Parameters:
      n - updates per period
    • getAggregationPeriod

      public org.djunits.value.vdouble.scalar.Duration getAggregationPeriod()
      The aggregation period.
      Returns:
      aggregation period
    • setAggregationPeriod

      public void setAggregationPeriod(org.djunits.value.vdouble.scalar.Duration aggregationPeriod)
      Changes the aggregation period.
      Parameters:
      aggregationPeriod - aggregation period
    • getUpdateInterval

      public org.djunits.value.vdouble.scalar.Duration getUpdateInterval()
      Returns the update interval.
      Returns:
      update interval
    • calculatePaintStateUnsafe

      public void calculatePaintStateUnsafe(org.djunits.value.vdouble.scalar.Duration time)
      Description copied from class: PlotDelegate
      Calculates paint state and offers it to the coupled plots. This method should only be invoked by PlotDelegate.calculatePaintStateSafe(org.djunits.value.vdouble.scalar.Duration) which makes sure that setting changes from different plots (with different working threads) do not cause parallel calculations on the same delegate. This makes sure that internal data gathering can occur consistently.
      Specified by:
      calculatePaintStateUnsafe in class PlotDelegate<FundamentalDiagram.FdPaintState,FundamentalDiagram>
      Parameters:
      time - current time
    • setAggregateName

      public abstract void setAggregateName(String aggregateName)
      Sets the name of the series when aggregated, e.g. for legend. Default is "Aggregate".
      Parameters:
      aggregateName - name of the series when aggregated
    • sourceFromSampler

      public static <L extends LaneData<L>> FdDataSource sourceFromSampler(Sampler<?,L> sampler, PlotScheduler plotScheduler, GraphCrossSection<L> crossSection, boolean aggregateLanes, org.djunits.value.vdouble.scalar.Duration aggregationTime, boolean harmonic)
      Creates a FdDataSource from a sampler and positions.
      Type Parameters:
      L - LaneData
      Parameters:
      sampler - sampler
      plotScheduler - plot scheduler
      crossSection - cross section
      aggregateLanes - whether to aggregate the positions
      aggregationTime - aggregation time (and update time)
      harmonic - harmonic mean
      Returns:
      source for a fundamental diagram from a sampler and positions
    • sourceFromSampler

      public static <L extends LaneData<L>> FdDataSource sourceFromSampler(Sampler<?,L> sampler, PlotScheduler plotScheduler, GraphPath<L> path, boolean aggregateLanes, org.djunits.value.vdouble.scalar.Duration aggregationTime)
      Creates a FdDataSource from a sampler and positions.
      Type Parameters:
      L - LaneData
      Parameters:
      sampler - sampler
      plotScheduler - plot scheduler
      path - cross section
      aggregateLanes - whether to aggregate the positions
      aggregationTime - aggregation time (and update time)
      Returns:
      source for a fundamental diagram from a sampler and positions
    • combinedSource

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