public class EGTF extends Object
To allow flexible usage the EGTF works with DataSource
, DataStream
and Quantity
.
A DataSource
, such as "loop detectors", "floating-car data" or "camera" is mostly an identifier, but can be requested
to provide several data streams.
A DataStream
is one DataSource
supplying one Quantity
. For instance "loop detectors" supplying
"flow". In a DataStream
, supplied by the DataSource
, standard deviation of measurements in congestion and
free flow are defined. These determine the reliability of the Quantity
data from the given DataSource
, and
thus ultimately the weight of the data in the estimation of the quantity.
A Quantity
, such as "flow" or "density" defines what is measured and what is requested as output. The output can be
in typed format using a Converter
. Default quantities are available under SPEED_SI
, FLOW_SI
and
DENSITY_SI
, all under Quantity
.
Data can be added using several methods for point data, vector data (multiple independent location-time combinations) and
grid data (data in a grid pattern). Data is added for a particular DataStream
.
For simple use-cases where a single data source is used, data can be added directly with a Quantity
, in which case a
default DataSource
, and default DataStream
for each Quantity
is internally used. All data should
either be added using Quantity
's, or it should all be added using DataSource
's. Otherwise relative data
reliability is undefined.
Output can be requested from the EGTF using a Kernel
, a spatiotemporal pattern determining measurement weights. The
Kernel
defines an optional maximum spatial and temporal range for measurements to consider, and uses a Shape
to determine the weight for a given distance and time from the estimated point. By default this is an exponential function. A
Gaussian kernel is also available, while any other shape could be also be implemented.
Parameters from the EGTF are found in the following places:
EGTF
: cCong, cFree, deltaV and vc, defining the overall traffic flow properties.Kernel
: tMax and xMax, defining the maximum range to consider.KernelShape
: sigma and tau, determining the decay of weights for further measurements in space and
time.DataStream
: thetaCong and thetaFree, defining the reliability by the standard deviation of measured
data in free flow and congestion from a particular data stream.
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.
Constructor and Description |
---|
EGTF()
Constructor using cCong = -18km/h, cFree = 80km/h, deltaV = 10km/h and vc = 80km/h.
|
EGTF(double cCong,
double cFree,
double deltaV,
double vc)
Constructor defining global settings.
|
EGTF(double cCong,
double cFree,
double deltaV,
double vc,
double sigma,
double tau,
double xMax,
double tMax)
Convenience constructor that also sets a specified kernel.
|
Modifier and Type | Method and Description |
---|---|
void |
addGridDataSI(DataStream<?> dataStream,
double[] location,
double[] time,
double[][] values)
Adds grid data.
|
void |
addGridDataSI(Quantity<?,?> quantity,
double[] location,
double[] time,
double[][] values)
Adds grid data.
|
void |
addListener(EgtfListener listener)
Add listener.
|
void |
addPointDataSI(DataStream<?> dataStream,
double location,
double time,
double value)
Adds point data.
|
void |
addPointDataSI(Quantity<?,?> quantity,
double location,
double time,
double value)
Adds point data.
|
void |
addVectorDataSI(DataStream<?> dataStream,
double[] location,
double[] time,
double[] values)
Adds vector data.
|
void |
addVectorDataSI(Quantity<?,?> quantity,
double[] location,
double[] time,
double[] values)
Adds vector data.
|
void |
clearDataBefore(double time)
Removes all data from before the given time.
|
Filter |
filterFastSI(double xMin,
double xStep,
double xMax,
double tMin,
double tStep,
double tMax,
Quantity<?,?>... quantities)
Returns filtered data that is processed using fast fourier transformation.
|
EgtfParallelListener |
filterParallelFastSI(double xMin,
double xStep,
double xMax,
double tMin,
double tStep,
double tMax,
Quantity<?,?>... quantities)
Executes fast filtering in parallel.
|
EgtfParallelListener |
filterParallelSI(double[] location,
double[] time,
Quantity<?,?>... quantities)
Executes filtering in parallel.
|
Filter |
filterSI(double[] location,
double[] time,
Quantity<?,?>... quantities)
Returns filtered data.
|
DataSource |
getDataSource(String name)
Return a data source, which is created if necessary.
|
void |
interrupt()
Interrupt the calculation.
|
void |
removeListener(EgtfListener listener)
Remove listener.
|
void |
setGaussKernelSI(double sigma,
double tau)
Sets a Gaussian kernel with infinite range.
|
void |
setGaussKernelSI(double sigma,
double tau,
double xMax,
double tMax)
Sets a Gaussian kernel with limited range.
|
void |
setKernel()
Sets a default exponential kernel with infinite range, sigma = 300m, and tau = 30s.
|
void |
setKernelSI(double sigma,
double tau)
Sets an exponential kernel with infinite range.
|
void |
setKernelSI(double sigma,
double tau,
double xMax,
double tMax)
Sets an exponential kernel with limited range.
|
void |
setKernelSI(double xMax,
double tMax,
KernelShape shape)
Sets a kernel with limited range and provided shape.
|
String |
toString() |
public EGTF()
public EGTF(double cCong, double cFree, double deltaV, double vc)
cCong
- double; shock wave speed in congestion [km/h]cFree
- double; shock wave speed in free flow [km/h]deltaV
- double; speed range between congestion and free flow [km/h]vc
- double; flip-over speed below which we have congestion [km/h]public EGTF(double cCong, double cFree, double deltaV, double vc, double sigma, double tau, double xMax, double tMax)
cCong
- double; shock wave speed in congestion [km/h]cFree
- double; shock wave speed in free flow [km/h]deltaV
- double; speed range between congestion and free flow [km/h]vc
- double; flip-over speed below which we have congestion [km/h]sigma
- double; spatial kernel size in [m]tau
- double; temporal kernel size in [s]xMax
- double; maximum spatial range in [m]tMax
- double; maximum temporal range in [s]public DataSource getDataSource(String name)
name
- String; unique name for the data sourceIllegalStateException
- when data has been added without a data sourcepublic void clearDataBefore(double time)
time
- double; time before which all data can be removedpublic void addPointDataSI(Quantity<?,?> quantity, double location, double time, double value)
quantity
- Quantity<?, ?>; quantity of the datalocation
- double; location in [m]time
- double; time in [s]value
- double; data valueIllegalStateException
- if data was added with a data stream previouslypublic void addPointDataSI(DataStream<?> dataStream, double location, double time, double value)
dataStream
- DataStream<?>; data stream of the datalocation
- double; location in [m]time
- double; time in [s]value
- double; data valueIllegalStateException
- if data was added with a quantity previouslypublic void addVectorDataSI(Quantity<?,?> quantity, double[] location, double[] time, double[] values)
quantity
- Quantity<?, ?>; quantity of the datalocation
- double[]; locations in [m]time
- double[]; times in [s]values
- double[]; data values in SI unitIllegalStateException
- if data was added with a data stream previouslypublic void addVectorDataSI(DataStream<?> dataStream, double[] location, double[] time, double[] values)
dataStream
- DataStream<?>; data stream of the datalocation
- double[]; locations in [m]time
- double[]; times in [s]values
- double[]; data values in SI unitIllegalStateException
- if data was added with a quantity previouslypublic void addGridDataSI(Quantity<?,?> quantity, double[] location, double[] time, double[][] values)
quantity
- Quantity<?, ?>; quantity of the datalocation
- double[]; locations in [m]time
- double[]; times in [s]values
- double[][]; data values in SI unitIllegalStateException
- if data was added with a data stream previouslypublic void addGridDataSI(DataStream<?> dataStream, double[] location, double[] time, double[][] values)
dataStream
- DataStream<?>; data stream of the datalocation
- double[]; locations in [m]time
- double[]; times in [s]values
- double[][]; data values in SI unitIllegalStateException
- if data was added with a quantity previouslypublic void setKernel()
public void setKernelSI(double sigma, double tau)
sigma
- double; spatial kernel sizetau
- double; temporal kernel sizepublic void setKernelSI(double sigma, double tau, double xMax, double tMax)
sigma
- double; spatial kernel size in [m]tau
- double; temporal kernel size in [s]xMax
- double; maximum spatial range in [m]tMax
- double; maximum temporal range in [s]public void setGaussKernelSI(double sigma, double tau)
sigma
- double; spatial kernel sizetau
- double; temporal kernel sizepublic void setGaussKernelSI(double sigma, double tau, double xMax, double tMax)
sigma
- double; spatial kernel size in [m]tau
- double; temporal kernel size in [s]xMax
- double; maximum spatial range in [m]tMax
- double; maximum temporal range in [s]public void setKernelSI(double xMax, double tMax, KernelShape shape)
xMax
- double; maximum spatial rangetMax
- double; maximum temporal rangeshape
- KernelShape; shape of the kernelpublic EgtfParallelListener filterParallelSI(double[] location, double[] time, Quantity<?,?>... quantities)
location
- double[]; location of output grid in [m]time
- double[]; time of output grid in [s]quantities
- Quantity<?, ?>...; quantities to calculate filtered data ofpublic EgtfParallelListener filterParallelFastSI(double xMin, double xStep, double xMax, double tMin, double tStep, double tMax, Quantity<?,?>... quantities)
xMin
- double; minimum location value of output grid [m]xStep
- double; location step of output grid [m]xMax
- double; maximum location value of output grid [m]tMin
- double; minimum time value of output grid [s]tStep
- double; time step of output grid [s]tMax
- double; maximum time value of output grid [s]quantities
- Quantity<?, ?>...; quantities to calculate filtered data ofpublic Filter filterSI(double[] location, double[] time, Quantity<?,?>... quantities)
location
- double[]; location of output grid in [m]time
- double[]; time of output grid in [s]quantities
- Quantity<?, ?>...; quantities to calculate filtered data ofnull
when interruptedpublic Filter filterFastSI(double xMin, double xStep, double xMax, double tMin, double tStep, double tMax, Quantity<?,?>... quantities)
More than being a fast implementation of the Adaptive Smoothing Method, this implementation includes all data source like the Extended Generalized Treiber-Helbing Filter.
xMin
- double; minimum location value of output grid [m]xStep
- double; location step of output grid [m]xMax
- double; maximum location value of output grid [m]tMin
- double; minimum time value of output grid [s]tStep
- double; time step of output grid [s]tMax
- double; maximum time value of output grid [s]quantities
- Quantity<?, ?>...; quantities to calculate filtered data ofnull
when interruptedpublic final void interrupt()
public final void addListener(EgtfListener listener)
listener
- EgtfListener; listenerpublic final void removeListener(EgtfListener listener)
listener
- EgtfListener; listenerCopyright © 2014–2019 Delft University of Technology. All rights reserved.