Filter Moving Average Demo

Overview

There is an example implementation of the Filter Moving Average Demo application available in the apps folder. In this implementation, it contains all the API functions and demos for how to use them.

Features

  • This application The structure is initialised, input is added, calculation and averages get retrieved from the structure, data is obtained from the structure, and all filter structure elements are flushed.

  • In every API for this driver, the Structure input argument is provided by the user.

  • The sample application includes Test Suite APIs. The test suite API was used to test the filter moving average driver API functions in a single shot with custom input.

Example Usecase

 * Select the filter type to find the average. Initialise the moving average module. To find the average, get input data and window size for the sliding window method and forgetting factor for the exponential weighting method from the user. The average value will be calculated by adding the input values.  * Below is the use case for finding the average of the data using a sliding window method and exponential weighting method.

Example input data:

****** MENU ******
1. Moving Average Init --(Must)
2.To add input
3.To get average
4.To get data
5.To Flush all the elements(Flush)
6.Validate Filter
7.Quit

Enter the filter type : (Sliding Window Method - 1 , Exponential Weighting Method - 2)
Sliding Window Method
Enter the window size : 4
Enter the number of elements : 4
Enter integer values
1
2
3
4
Successfully got the average value 3.80

Enter the filter type : (Sliding Window Method - 1 , Exponential Weighting Method - 2)
Exponential Weighting Method
Enter the forgetting factor(lambda)[0 to 1] : 0.9
Enter the number of elements : 4
Enter integer values
1
2
3
4
Successfully got the average value 2.63

The Output data is

Sample average Data output:
Average value is 2.50 for sliding window method
Average value is 2.63 for exponential weighting method

Filter Moving Average Module Driver

Please refer below section,