org.openuat.sensors
Class TimeSeriesAggregator

java.lang.Object
  extended by org.openuat.sensors.TimeSeriesAggregator

public class TimeSeriesAggregator
extends java.lang.Object

This class implements an aggregation of multiple time series into one. To do so, it calculates the magnitude of the multi-dimensional vector for each sample and uses this magnitude as the new (single-dimensional) sample value. Forwarding this single-dimensional time series to the next step can be done either as single samples during active periods or as complete segments from the start of an active period to its end. For the former, this class can send to SamplesSink objects, for the latter, it can send to SegmentsSink objects. It keeps the time series of the first step, i.e. the pre-processing that does a linear transformation to [-1;1] and detects active/quiescent segments, internally. Using the getSinks() method, these internally managed TimeSeries objects can be registered with the samples source. After an active segment ends, this class emits the aggregated segment.

Version:
1.0
Author:
Rene Mayrhofer

Constructor Summary
TimeSeriesAggregator(int numSeries, int windowSize, int minSegmentSize, int maxSegmentSize)
          Constructs all internal buffers and the time series.
 
Method Summary
 void addNextStageSamplesSink(SamplesSink sink)
          Registers a sink which will receive all samples within active segments immediately after they have been aggregated into one dimension.
 void addNextStageSegmentsSink(SegmentsSink sink)
          Registers a sink which will receive all active segments when they are complete.
 SamplesSink[] getInitialSinks()
          Returns the first stage sink objects that can be registered with the samples source.
 boolean removeNextStageSamplesSink(SamplesSink sink)
          Removes a previously registered sink.
 boolean removeNextStageSegmentsSink(SegmentsSink sink)
          Removes a previously registered sink.
 void reset()
          Resets the time series to the state as created when freshly constructing it.
 void setActiveVarianceThreshold(double activeVarianceThreshold)
          Sets the activeVarianceThreshold for all internally kept time series.
 void setMultiplicator(double multiplicator)
          Sets the multiplicator for all internally kept time series.
 void setOffset(double offset)
          Sets the offset for all internally kept time series.
 void setSubtractTotalMean(boolean subtractTotalMean)
          Sets the subtractTotalMean for all internally kept time series.
 void setSubtractWindowMean(boolean subtractWindowMean)
          Sets the subtractWindowMean for all internally kept time series.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeSeriesAggregator

public TimeSeriesAggregator(int numSeries,
                            int windowSize,
                            int minSegmentSize,
                            int maxSegmentSize)
Constructs all internal buffers and the time series.

Parameters:
numSeries - The number of time series to use, i.e. the dimensionality of the input space.
windowSize - The time window size to use for detecting active/quiescent segments. This is specified as the number of samples in the window.
minSegmentSize - The minimum size of an active segment to be regarded significant enough to be sent to listeners.
maxSegmentSize - If set to something other than -1, specifies the maximum size of an active segments. If an active segment is longer than this number of samples, it will be sent to the listeners as soon as it reaches this length. The remainders of longer segments will be discarded. Set to -1 to disable this functionality, otherwise must be >=minSegmentSize.
Method Detail

reset

public void reset()
Resets the time series to the state as created when freshly constructing it.


getInitialSinks

public SamplesSink[] getInitialSinks()
Returns the first stage sink objects that can be registered with the samples source.

Returns:
The sink objects to be registered.

setOffset

public void setOffset(double offset)
Sets the offset for all internally kept time series.

See Also:
TimeSeries.setOffset(double)

setMultiplicator

public void setMultiplicator(double multiplicator)
Sets the multiplicator for all internally kept time series.

See Also:
TimeSeries.setMultiplicator(double)

setSubtractWindowMean

public void setSubtractWindowMean(boolean subtractWindowMean)
Sets the subtractWindowMean for all internally kept time series.

See Also:
TimeSeries.setSubtractWindowMean(boolean)

setSubtractTotalMean

public void setSubtractTotalMean(boolean subtractTotalMean)
Sets the subtractTotalMean for all internally kept time series.

See Also:
TimeSeries.setSubtractTotalMean(boolean)

setActiveVarianceThreshold

public void setActiveVarianceThreshold(double activeVarianceThreshold)
Sets the activeVarianceThreshold for all internally kept time series.

See Also:
TimeSeries.setActiveVarianceThreshold(double)

addNextStageSegmentsSink

public void addNextStageSegmentsSink(SegmentsSink sink)
Registers a sink which will receive all active segments when they are complete.

Parameters:
sink - The sink to push new aggregated segments to.

removeNextStageSegmentsSink

public boolean removeNextStageSegmentsSink(SegmentsSink sink)
Removes a previously registered sink.

Parameters:
sink - The sink to stop pushing segments to.
Returns:
true if removed, false if not (i.e. if it has not been added previously).

addNextStageSamplesSink

public void addNextStageSamplesSink(SamplesSink sink)
Registers a sink which will receive all samples within active segments immediately after they have been aggregated into one dimension.

Parameters:
sink - The sink to push new aggregated segments to.

removeNextStageSamplesSink

public boolean removeNextStageSamplesSink(SamplesSink sink)
Removes a previously registered sink.

Parameters:
sink - The sink to stop pushing segments to.
Returns:
true if removed, false if not (i.e. if it has not been added previously).


2005-2006, Rene Mayrhofer.