SWDataMonitor:
Filter:
SenseWorld/Classes (extension) | Plotting | Logging

SWDataMonitor
ExtensionExtension

Monitor data by evaluating a function regularly

Description

SWDataMonitor evaluates a function regularly and keeps track of the data that is output by the function. This class is primarily used underneath SWPlotterMonitor but can be useful for other applications as well.

Class Methods

.new

Creates a new instance of SWDataMonitor.

Arguments:

updater

The Function to evaluate to generate new data. This Function should either return a SimpleNumber, or an Array of numbers.

length

The amount of points to plot.

plotter

The function to plot or otherwise use the data obtained from the update function.

nc

The number of channels in the data - this should match what the updater function returns.

dt

The deltatime with which to evaluate the function.

skip

How often to plot, in multiples of dt. So if you set this to 5, the updater function will be evaluated 5 times at a time interval of dt, and then update the plot.

Instance Methods

.dt

The time interval for evaluating the function.

.updateFunction

The function to obtain the data to be monitored.

.plotFunction

The function that uses the data, e.g. to plot it in a Plotter window.

.skip

The amount of updates to skip before executing the plotFunction.

.data

The gathered data.

.length

The maximum length of the data.

.numChan

The number of channels of the data.

.reset

Resets all data points with the value 0, and resets the skip counter.

.start

Starts the SWDataMonitor.

.isPlaying

Boolean to indicate whether the SWDataMonitor is currently running.

.stop

Stop the SWDataMonitor

.watcher

The SkipJack that executes the updateFunction, and every skip times the plotFunction

Returns:

an instance of SkipJack.