sys::Obj sys::Virtual sys::Component math::TimeAvg
public class TimeAvg
[niagaraIcon="module://icons/x16/control/math/average.png"]
TimeAvg object averages "in" over the configured time.
Note that this is NOT a running or moving average - this object caches the average over the previous time as the out value, and updates out every "time" ms.
Until the first full cycle has elapsed, out is set to average of all samples so far.
The average may be reset/restarted at any time using the "reset" action.
public property float in
The value to average
public property float out [readonly]
Value averaged over last "time" period
public property int time [summary, config, unit="millisecond"]
The time period over which to average the in value to get the out value
public virtual override void execute()
calculate the average. If not enough samples collected, then average the ones we have.
public action void reset()
Reset the average computation
public virtual override void start()
Override start to initialize averaging variables