Supported platforms: CODESYS 2.3, CODESYS 3.5
This mean filter function calculates mean value (running mean) from the given amount of samples of a ring buffer. Sample values are given to the function as pointer to Array of values (ring buffer).
i_FirstIndex tells the starting index of the given table, so e.g. Samples:ARRAY [0..9] and Samples:ARRAY [1..10] can be used.
Input variable name |
Data type |
Range |
Description |
i_LatestBufferIndex |
BYTE |
i_FirstIndex..i_FirstIndex+i_SizeOfBuffer-1 |
Table index of last measured value |
i_pBuffer |
POINTER TO WORD |
|
Address of used sample buffer |
i_FirstIndex |
BYTE |
0..255 |
Starting index of given sample buffer |
i_SizeOfBuffer |
BYTE |
1..255 |
Maximum number of samples in buffer i.e. size of buffer |
i_Samples |
BYTE |
1..i_SizeOfBuffer |
Number of values to count in mean value |
Return value |
Data type |
Range |
Description |
|
WORD |
0..65535 |
Calculated mean value |
-
Source file topic000231.htm
Last updated 21-Feb-2025