Accumulator Filter

A Filter is a Physlet that takes data from a data source, processes the data, and passes this processed data to a data listener.

 

 

Auto-replace False Auto-replace True

The Accumulator filter builds a data set from a data source.  In this example, the red ball sends its state (e.g., a sate datum for an Animator object contains the variables t, x, y, vx, vy, ax, ay, fx, fy, and m) to the filter at every clock tick.  The script takes the vx value and passes it to the Accumulator filter. The Accumulator stores the vx value in a data set whose size is set by the NumPts parateter.  (Default of 50.)

Notice how the Accumulator can be combined with a DataGraph to implement a strip chart recorder.

Accumulator has two modes of operation which are determined by the setAutoReplaceData flag. 

The setAutoReplaceData signature is setAutoReplaceData(int sid, boolean set).  The series identifier, sid, has no effect but has been included for consistency with other Physlets.  The set variable determines the value.

See also: A molecular dynamics example of how the Accumulator can be used to limit the number of data points in a graph.