Task / Technology > Measurement & Sensors
software low-pass filter in STEP 7 V5.x
QUESTION:
How can I generate a software signal filter with low-pass filter behavior?
ANSWER:
The following sample program contains a low-pass filter of the first order. You can cascade this filter
to achieve filters of a higher order. You can use this filter to filter out high-frequency noise from
signals.
The low-pass filter is implemented in function block FB200.
The filter rate can be set via the delay time "F_tau" and the sampling time "Sample_T":
The formula for the low-pass filter in the time-discrete case is defined as follows:
The function block has been programmed based on this formula. The parameters are given in the
table below.
Parameters of the function block FB200:
Parameter Declaration Data type Description
RawValue INPUT REAL Process value as real number
F_tau INPUT REAL Delay time (e.g. every 1.0s)
as real number
Sample_T INPUT REAL Sampling time (e.g. 0.1s)
as real number
ZRError OUTPUT BOOL Equal to 1 if F_tau = 0
FiltOut OUTPUT REAL The filtered output value
as real number
Since the function block can only be used for the time-discrete case, you must call this block in a
cyclic interval. For this you can use the time interrupt organization block OB35. Take the call time of
this organization block on the parameter "Sample_T". If necessary, you can change the call time of
the time interrupt organization block OB35. In this case you must also adapt the parameter
"Sample_T".
The example contains the above-described application case as a STEP 7 V5.0 library and is available
as STL and SCL source. You can adapt the block as you wish to suit your requirements.
lowpass2.exe
Copy the "lowpass2.exe" file into a separate directory and then start it with a double-click. The project
is now unpacked with all the associated subdirectories. You can then open and process the unpacked
project with the SIMATIC Manager.
Search terms:
PT1, Time-delay element
Filter criteria:
Hardware platform: SIMATIC S7-300/S7-400
Software: STEP 7 up to V5.x
Entry contents: Function blocks/tools
Entry ID:6170416 Date:2001-01-04
My tags : Create new bookmark/tag
© Siemens AG 2014 - Corporate Information - Privacy Policy - Terms of Use