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-2022 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 Summary
Constructors Constructor Description TypedEGTF()
Constructor using cCong = -18km/h, cFree = 80km/h, deltaV = 10km/h and vc = 80km/h.TypedEGTF(Speed cCong, Speed cFree, Speed deltaV, Speed vc)
Constructor defining global settings.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <U extends Unit<U>,Z extends AbstractScalar<U,Z>>
voidaddGridData(DataStream<Z> dataStream, LengthVector location, DurationVector time, DoubleMatrixInterface<U,?,?,?> values)
Adds grid data.<U extends Unit<U>,Z extends AbstractScalar<U,Z>>
voidaddGridData(Quantity<Z,?> quantity, LengthVector location, DurationVector time, DoubleMatrixInterface<U,?,?,?> values)
Adds grid data.<U extends Unit<U>,Z extends AbstractScalar<U,Z>>
voidaddPointData(DataStream<Z> dataStream, Length location, Duration time, Z value)
Adds point data.<U extends Unit<U>,Z extends AbstractScalar<U,Z>>
voidaddPointData(Quantity<Z,?> quantity, Length location, Duration time, Z value)
Adds point data.<U extends Unit<U>,Z extends AbstractScalar<U,Z>>
voidaddVectorData(DataStream<Z> dataStream, LengthVector location, DurationVector time, DoubleVectorInterface<U,?,?> values)
Adds vector data.<U extends Unit<U>,Z extends AbstractScalar<U,Z>>
voidaddVectorData(Quantity<Z,?> quantity, LengthVector location, DurationVector time, DoubleVectorInterface<U,?,?> values)
Adds vector data.void
clearDataBefore(Duration time)
Removes all data from before the given time.TypedFilter
filter(LengthVector location, DurationVector time, Quantity<?,?>... quantities)
Returns filtered data.void
setGaussKernel(Length sigma, Duration tau)
Sets a Gaussian kernel with infinite range.void
setGaussKernel(Length sigma, Duration tau, Length xMax, Duration tMax)
Returns a Gaussian kernel with limited range.void
setKernel(Length sigma, Duration tau)
Sets an exponential kernel with infinite range.void
setKernel(Length sigma, Duration tau, Length xMax, Duration tMax)
Returns an exponential kernel with limited range.void
setKernel(Length xMax, Duration tMax, KernelShape shape)
Sets a kernel with limited range and provided shape.String
toString()
-
Methods inherited from class org.opentrafficsim.core.egtf.EGTF
addGridDataSI, addGridDataSI, addListener, addPointDataSI, addPointDataSI, addVectorDataSI, addVectorDataSI, clearDataBefore, filterFastSI, filterParallelFastSI, filterParallelSI, filterSI, getDataSource, interrupt, removeListener, setGaussKernelSI, setGaussKernelSI, setKernel, setKernelSI, setKernelSI, setKernelSI
-
-
-
-
Constructor Detail
-
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 congestioncFree
- Speed; shock wave speed in free flowdeltaV
- Speed; speed range between congestion and free flowvc
- 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 congestioncFree
- Speed; shock wave speed in free flowdeltaV
- Speed; speed range between congestion and free flowvc
- Speed; flip-over speed below which we have congestionsigma
- Length; spatial kernel sizetau
- Duration; temporal kernel sizexMax
- Length; maximum spatial rangetMax
- Duration; maximum temporal range
-
-
Method Detail
-
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 typeZ
- value type- Parameters:
quantity
- Quantity<Z, ?>; quantity of the datalocation
- Length; locationtime
- Duration; timevalue
- 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 typeZ
- value type- Parameters:
dataStream
- DataStream<Z>; data stream of the datalocation
- Length; locationtime
- Duration; timevalue
- 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 typeZ
- value type- Parameters:
quantity
- Quantity<Z, ?>; quantity of the datalocation
- LengthVector; locationstime
- DurationVector; timesvalues
- 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 typeZ
- value type- Parameters:
dataStream
- DataStream<Z>; data stream of the datalocation
- LengthVector; locationstime
- DurationVector; timesvalues
- 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 typeZ
- value type- Parameters:
quantity
- Quantity<Z, ?>; quantity of the datalocation
- LengthVector; locationstime
- DurationVector; timesvalues
- 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 typeZ
- value type- Parameters:
dataStream
- DataStream<Z>; data stream of the datalocation
- LengthVector; locationstime
- DurationVector; timesvalues
- 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 sizetau
- 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 sizetau
- 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 rangetMax
- Duration; maximum temporal rangeshape
- KernelShape; shape of the kernel
-
filter
public TypedFilter filter(LengthVector location, DurationVector time, Quantity<?,?>... quantities)
Returns filtered data.- Parameters:
location
- LengthVector; location of output gridtime
- DurationVector; time of output gridquantities
- Quantity<?, ?>...; quantities to calculate filtered data of- Returns:
- Filter; filtered data,
null
when interrupted
-
-