Description
It is often convenient to have a first order low pass filter to smooth out sensor readings or manual input. The Filter package provides filtering and can serve as an example regarding how to make other types of filters.
Using the Filter Software Package
The Filter Software Package can be understood by using it in the test scaffolding program "Filter.DSM" project. Select "File | Open Resources" from the main menu,
open the "Software Packages" directory, and choose "Filter.dsm". This project provides a scope and numeric display of a value that can be switched between 0 and 10:
Select the Filter package, Select the Blocks Tab, and click on "More Blocks" to see what is available:
The "Set Output_To" block can be used to preset the filter output to a condition. The "Set_Input_To" block is the filter input. The "Output" bubble is the filtered result.
The filter is implemented in text as this:
The "Set_KF_To" block establishes the coefficient of the filter. A value of "0" means the input has no influence on the filtered output. A "1" means that the output is entirely established on the next sample producing no filtering effect at all.
The Kf values must be between 0 and 1 with typical values being 0.001. The filter is calculated every controller sample period.