Filter Example |
Topic: CL250
|
Two methods of creating an Analog Filter in Ladder Logic are shown here. These can be useful for filtering analog inputs. The following examples provide simple methods to create a filter and average. Be sure to change the addresses to unused memory addresses in your project.
Filter Example
This method provides the flexibility to adjust the sample time and percent change. At each sample time the difference is calculated between the Input and Output, then a percentage of this difference is applied to the new Output. A higher value in DS1 allows more change, or less filtering. A lower value in DS1 allows less change, or more filtering.
In this step response, the Input changes from 0 to 100.
Average Example
This method enables the flexibility to adjust the sample time and number of samples. At each sample time a new Raw Input is shifted into the group of 5 samples. A new Average is then calculated. In this example, it takes 5 sample times for the Input to reach the Output.
In this step response, the Input changes from 0 to 100.