Class TypedEGTF

java.lang.Object
org.opentrafficsim.core.egtf.EGTF
org.opentrafficsim.core.egtf.typed.TypedEGTF

public class TypedEGTF
extends EGTF
Typed version of the EGTF.

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 26 okt. 2018
Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Constructor Details

    • TypedEGTF

      public TypedEGTF()
      Constructor using cCong = -18km/h, cFree = 80km/h, deltaV = 10km/h and vc = 80km/h. A default kernel is set.
    • TypedEGTF

      public TypedEGTF​(Speed cCong, Speed cFree, Speed deltaV, Speed vc)
      Constructor defining global settings. A default kernel is set.
      Parameters:
      cCong - Speed; shock wave speed in congestion
      cFree - Speed; shock wave speed in free flow
      deltaV - Speed; speed range between congestion and free flow
      vc - Speed; flip-over speed below which we have congestion
    • TypedEGTF

      public TypedEGTF​(Speed cCong, Speed cFree, Speed deltaV, Speed vc, Length sigma, Duration tau, Length xMax, Duration tMax)
      Convenience constructor that also sets a specified kernel.
      Parameters:
      cCong - Speed; shock wave speed in congestion
      cFree - Speed; shock wave speed in free flow
      deltaV - Speed; speed range between congestion and free flow
      vc - Speed; flip-over speed below which we have congestion
      sigma - Length; spatial kernel size
      tau - Duration; temporal kernel size
      xMax - Length; maximum spatial range
      tMax - Duration; maximum temporal range
  • Method Details

    • addPointData

      public <U extends Unit<U>,​ Z extends AbstractScalar<U,​ Z>> void addPointData​(Quantity<Z,​?> quantity, Length location, Duration time, Z value)
      Adds point data.
      Type Parameters:
      U - unit of type
      Z - value type
      Parameters:
      quantity - Quantity<Z, ?>; quantity of the data
      location - Length; location
      time - Duration; time
      value - Z; data value
      Throws:
      IllegalStateException - if data was added with a data stream previously
    • addPointData

      public <U extends Unit<U>,​ Z extends AbstractScalar<U,​ Z>> void addPointData​(DataStream<Z> dataStream, Length location, Duration time, Z value)
      Adds point data.
      Type Parameters:
      U - unit of type
      Z - value type
      Parameters:
      dataStream - DataStream<Z>; data stream of the data
      location - Length; location
      time - Duration; time
      value - Z; data value
      Throws:
      IllegalStateException - if data was added with a quantity previously
    • addVectorData

      public <U extends Unit<U>,​ Z extends AbstractScalar<U,​ Z>> void addVectorData​(Quantity<Z,​?> quantity, LengthVector location, DurationVector time, DoubleVectorInterface<U,​?,​?> values)
      Adds vector data.
      Type Parameters:
      U - unit of type
      Z - value type
      Parameters:
      quantity - Quantity<Z, ?>; quantity of the data
      location - LengthVector; locations
      time - DurationVector; times
      values - DoubleVectorInterface<U>; data values
      Throws:
      IllegalStateException - if data was added with a data stream previously
    • addVectorData

      public <U extends Unit<U>,​ Z extends AbstractScalar<U,​ Z>> void addVectorData​(DataStream<Z> dataStream, LengthVector location, DurationVector time, DoubleVectorInterface<U,​?,​?> values)
      Adds vector data.
      Type Parameters:
      U - unit of type
      Z - value type
      Parameters:
      dataStream - DataStream<Z>; data stream of the data
      location - LengthVector; locations
      time - DurationVector; times
      values - DoubleVectorInterface<U>; data values
      Throws:
      IllegalStateException - if data was added with a quantity previously
    • addGridData

      public <U extends Unit<U>,​ Z extends AbstractScalar<U,​ Z>> void addGridData​(Quantity<Z,​?> quantity, LengthVector location, DurationVector time, DoubleMatrixInterface<U,​?,​?,​?> values)
      Adds grid data.
      Type Parameters:
      U - unit of type
      Z - value type
      Parameters:
      quantity - Quantity<Z, ?>; quantity of the data
      location - LengthVector; locations
      time - DurationVector; times
      values - DoubleMatrixInterface<U>; data values
      Throws:
      IllegalStateException - if data was added with a data stream previously
    • addGridData

      public <U extends Unit<U>,​ Z extends AbstractScalar<U,​ Z>> void addGridData​(DataStream<Z> dataStream, LengthVector location, DurationVector time, DoubleMatrixInterface<U,​?,​?,​?> values)
      Adds grid data.
      Type Parameters:
      U - unit of type
      Z - value type
      Parameters:
      dataStream - DataStream<Z>; data stream of the data
      location - LengthVector; locations
      time - DurationVector; times
      values - DoubleMatrixInterface<U>; data values
      Throws:
      IllegalStateException - if data was added with a quantity previously
    • clearDataBefore

      public void clearDataBefore​(Duration time)
      Removes all data from before the given time. This is useful in live usages of this class, where older data is no longer required.
      Parameters:
      time - Duration; time before which all data can be removed
    • setKernel

      public void setKernel​(Length sigma, Duration tau)
      Sets an exponential kernel with infinite range.
      Parameters:
      sigma - Length; spatial kernel size
      tau - Duration; temporal kernel size
    • setKernel

      public void setKernel​(Length sigma, Duration tau, Length xMax, Duration tMax)
      Returns an exponential kernel with limited range.
      Parameters:
      sigma - Length; spatial kernel size in [m]
      tau - Duration; temporal kernel size in [s]
      xMax - Length; maximum spatial range in [m]
      tMax - Duration; maximum temporal range in [s]
    • setGaussKernel

      public void setGaussKernel​(Length sigma, Duration tau)
      Sets a Gaussian kernel with infinite range.
      Parameters:
      sigma - Length; spatial kernel size
      tau - Duration; temporal kernel size
    • setGaussKernel

      public void setGaussKernel​(Length sigma, Duration tau, Length xMax, Duration tMax)
      Returns a Gaussian kernel with limited range.
      Parameters:
      sigma - Length; spatial kernel size in [m]
      tau - Duration; temporal kernel size in [s]
      xMax - Length; maximum spatial range in [m]
      tMax - Duration; maximum temporal range in [s]
    • setKernel

      public void setKernel​(Length xMax, Duration tMax, KernelShape shape)
      Sets a kernel with limited range and provided shape. The shape allows using non-exponential kernels.
      Parameters:
      xMax - Length; maximum spatial range
      tMax - Duration; maximum temporal range
      shape - KernelShape; shape of the kernel
    • filter

      public TypedFilter filter​(LengthVector location, DurationVector time, Quantity<?,​?>... quantities)
      Returns filtered data.
      Parameters:
      location - LengthVector; location of output grid
      time - DurationVector; time of output grid
      quantities - Quantity<?, ?>...; quantities to calculate filtered data of
      Returns:
      Filter; filtered data, null when interrupted
    • toString

      public String toString()
      Overrides:
      toString in class EGTF