Low Pass Filter (LPF)

This information applies to the
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370,
GuardLogix
5570,
Compact GuardLogix
5380,
CompactLogix
5380,
CompactLogix
5480,
ControlLogix
5580, and
GuardLogix
5580 controllers.
The LPF instruction provides a filter to attenuate input frequencies that are above the cutoff frequency.
Available Languages
Ladder Diagram
This instruction is not available in ladder diagram logic.
Function Block
RSL5K_LPF Function Block
Structured Text
LPF(LPF_tag);
Operands
Function Block
Operand
Type
Format
Description
LPF tag
FILTER_LOW_PASS
Structure
LPF structure
FILTER_LOW_PASS Structure
Input Parameter
Data Type
Description
EnableIn
BOOL
Enable input. If false, the instruction does not execute and outputs are not updated.
Default is true.
In
REAL
The analog signal input to the instruction.
Valid = any float
Default = 0.0
Initialize
BOOL
Request to initialize filter control algorithm. When true, the instruction sets Out = In.
Default is false.
WLag
REAL
The lag frequency in radians/second. If WLag < minimum or WLag > maximum, the instruction sets the appropriate bit in Status and limits WLag.
Valid = see Description section below for valid ranges
Default = 0.0
Order
REAL
Order of the filter. Order controls the sharpness of the cutoff. If Order is invalid, the instruction sets the appropriate bit in Status and uses Order = 1.
Valid = 1 to 3
Default = 1
TimingMode
DINT
Selects timing execution mode.
0 = Period mode
1 = Oversample mode
2 = Real-time sampling mode
For more information about timing modes, see Function Block Attributes.
Valid = 0 to 2
Default = 0
OversampleDT
REAL
Execution time for oversample mode.
Valid = 0 to 4194.303 seconds
Default = 0
RTSTime
DINT
Module update period for real time sampling mode
Valid = 1 to 32,767ms
Default = 1
RTSTimeStamp
DINT
Module time stamp value for real time sampling mode.
Valid = 0 to 32,767ms
Default = 0
Output Parameter
Data Type
Description
EnableOut
BOOL
Indicates if instruction is enabled Cleared to false if Out overflows.
Out
REAL
The calculated output of the algorithm.
DeltaT
REAL
Elapsed time between updates. This is the elapsed time in seconds used by the control algorithm to calculate the process output.
Status
DINT
Status of the function block.
InstructFault (Status.0)
BOOL
The instruction detected one of the following execution errors. This is not a minor or major controller error. Check the remaining status bits to determine what occurred.
WLagInv (Status.1)
BOOL
WLag < minimum value or WLag > maximum value.
OrderInv (Status.2)
BOOL
Invalid Order value.
TimingModeInv (Status.27)
BOOL
Invalid TimingMode value.
RTSMissed (Status.28)
BOOL
Only used in real time sampling mode. Set to true when
ABS(DeltaT – RTSTime) > 1 millisecond.
RTSTimeInv (Status.29)
BOOL
Invalid RTSTime value.
RTSTimeStampInv (Status.30)
BOOL
Invalid RTSTimeStamp value.
DeltaTInv (Status.31)
BOOL
Invalid DeltaT value.
Structured Text
Operand
Type
Format
Description
LPF tag
FILTER_LOW_PASS
structure
LPF structure
See Structured Text Syntax for more information on the syntax of expressions within structured text.
Description
The LPF instruction uses the Order parameter to control the sharpness of the cutoff. The LPF instruction is designed to execute in a task where the scan rate remains constant.
The LPF instruction uses these equations:
When:
The instruction uses this Laplace transfer function:
Order = 1
LPF Order 1
Order = 2
LPF Order 2
Order = 3
LPF Order 3
with these parameters limits (where DeltaT is in seconds):
Parameter
Limitations
WLag first order
LowLimit
LPF First order
WLag second order
LowLimit
LDL2 WLead second order
WLag third order
LowLimit
LPF WLag third order
HighLimit
LPF HighLimit
Whenever the value computed for the output is invalid, NAN, or Plus or Minus sign INF, the instruction sets Out = the invalid value. When the value computed for the output becomes valid, the instruction initializes the internal parameters and sets Out = In.
Affects Math Status Flags
Controllers
Affects Math Status Flags
ControlLogix
5580
No
CompactLogix
5370,
ControlLogix
5570
Yes for the output
Major/Minor Faults
None specific to this instruction. See Common Attributes for operand-related faults.
Execution
Function Block
Condition/State
Action Taken
Prescan
EnableIn and EnableOut bits are cleared to false.
Tag.EnableIn is false
EnableIn and EnableOut bits are cleared to false.
Tag.EnableIn is true
EnableIn and EnableOut bits are set to true.
The instruction executes.
Instruction first run
N/A
Instruction first scan
Recalculate coefficients.
Postscan
EnableIn and EnableOut bits are cleared to false.
Structured Text
Condition/State
Action Taken
Prescan
See Prescan in the Function Block table.
Normal Execution
See Tag.EnableIn is true in the Function Block table.
Postscan
See Postscan in the Function Block table.
Example
The LPF instruction attenuates signals that occur above the configured cutoff frequency. This instruction is typically used to filter out high frequency "noise" or disturbances that originate from either electrical or mechanical sources. You can select a specific order of the filter to achieve various degrees of attenuation. Note that higher orders increase the execution time for the instruction.
The following graphs illustrate the effect of the various orders of the filter for a given cutoff frequency. For each graph, ideal asymptotic approximations are given with gain and frequency in logarithmic scales. The actual response of the filter approaches these curves but does not exactly match these curves.
This example is the minimal legal programming of the LPF function block and is only used to show the neutral text and generated code for this instruction. This is for internal purposes only and is not a testable case.
Filter
Graph
1st order filter
LPF First order filter
2nd order filter
LPF Second order filter
3rd order filter
LPF Third order filter
Function Block
RSL5K_LPF Function Block Example_v31
Structured Text
LPF_01.In := Velocity_Feedback;
LPF_01.WLag := Cutoff_frequency;
LPF(LPF_01);
filtered_velocity_output := LPF_01.Out;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.