Component: Modified Moving Average 32-bit (Calculation)

From Flowcode Help
Jump to navigationJump to search
Author Matrix TSL
Version 1.0
Category Calculation


Modified Moving Average 32-bit component

Allows a value from a sensor to be averaged out filtering out high frequencies and removing noise. Modified moving average means we maintain a sum of the last n number of samples. On each new sample we subtract the previous result and then add in the latest raw sample.

Detailed description

No detailed description exists yet for this component

Examples

No additional examples

Macro reference

Filter

Fc9-comp-macro.png Filter
Performs the filtering function, passing in the latest sampled value and outputting the latest filtered value. 
Fc9-s32-icon.png - LONG Value
Latest sample to add to the filter 
Fc9-s32-icon.png - LONG Return


InitialiseFilter

Fc9-comp-macro.png InitialiseFilter
Preload the filter with the specified value and sets the number of samples to average over. Must be called before calling the filter macro. 
Fc9-s32-icon.png - LONG FilterValue
Initial value to load into the filter, e.g. 0 
Fc9-u16-icon.png - UINT NumSamples
Specifies the number of samples to average over. 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties

Component Source Code

Please click here to download the component source project: FC_Comp_Source_ModifiedMovingAverage32.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_ModifiedMovingAverage32.fcfx