×
Siemens Industry Online Support
Siemens AG
Entry type: Application example Entry ID: 6170416, Entry date: 01/04/2001
(9)
Rate

software low-pass filter in STEP 7 V5.x

  • Entry
  • Associated product(s)

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

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
https://www.siemens.com/cybersecurity#Ouraspiration.