Jump to content

Component: Modified Moving Average 16-bit (Calculation): Difference between revisions

From Flowcode Help
No edit summary
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead""
 
(3 intermediate revisions by the same user not shown)
Line 26: Line 26:


===Filter===
===Filter===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Filter'''
| width="90%" class="mtx-class-macrohead" | '''Filter'''
|-
|-
| colspan="2" | Performs the filtering function, passing in the latest sampled value and outputting the latest filtered value. 
| colspan="2" | Performs the filtering function, passing in the latest sampled value and outputting the latest filtered value. 
Line 45: Line 45:


===InitialiseFilter===
===InitialiseFilter===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''InitialiseFilter'''
| width="90%" class="mtx-class-macrohead" | '''InitialiseFilter'''
|-
|-
| colspan="2" | Preload the filter with the specified value and sets the number of samples to average over. Must be called before calling the filter macro. 
| colspan="2" | Preload the filter with the specified value and sets the number of samples to average over. Must be called before calling the filter macro. 
Line 70: Line 70:
==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|}
|}

Latest revision as of 14:23, 13 July 2026

Author Matrix TSL
Version 1.0
Category Calculation


Modified Moving Average 16-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

Filter
Performs the filtering function, passing in the latest sampled value and outputting the latest filtered value. 
- INT Value
Latest sample to add to the filter 
- INT Return


InitialiseFilter

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. 
- INT FilterValue
Initial value to load into the filter, e.g. 0 
- UINT NumSamples
Specifies the number of samples to average over. 
- VOID Return


Property reference

Properties

Component Source Code

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

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