High Pass Filter (HPF)
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 HPF instruction provides a filter to attenuate input frequencies that are below the cutoff frequency.
Available Languages
Ladder Diagram
This instruction is not available in ladder diagram logic.
Function Block
Structured Text
HPF(HPF_tag);
Operands
Function Block
Operand | Type | Format | Description |
---|---|---|---|
HPF tag | FILTER_HIGH_PASS | structure | HPF 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. |
WLead | REAL | The lead frequency in radians/second. If WLead < minimum or WLead > maximum, the instruction sets the appropriate bit in Status and limits WLead.
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 |
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. |
WLeadInv (Status.1) | BOOL | WLead < minimum value or WLead > maximum value. |
OrderInv (Status.2) | BOOL | Invalid Order value. |
TimingModeInv (Status.27) | BOOL | Invalid TimingMode value.
For more information about timing modes, see Function Block Attributes. |
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 |
---|---|---|---|
HPF tag | FILTER_HIGH_PASS | Structure | HPF structure |
See Structured Text Syntax for more information on the syntax of expressions within structured text.
Description
The HPF instruction uses the Order parameter to control the sharpness of the cutoff. The HPF instruction is designed to execute in a task where the scan rate remains constant.
The HPF instruction uses these equations:
When: | The instruction uses this transfer function: |
---|---|
Order = 1 | |
Order = 2 | |
Order = 3 |
with these parameter limits (where DeltaT is in seconds):
Parameter | Limitations |
---|---|
WLead first order
LowLimit | |
WLead second order
LowLimit | |
WLead third order
LowLimit | |
HighLimit |
Whenever the value computed for the output is invalid, NAN, or 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
No
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 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 HPF instruction attenuates signals that occur below the configured cutoff frequency. This instruction is typically used to filter low 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 filter 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 HPF 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 | |
2nd order filter | |
3rd order filter |
Function Block
Structured Text
HPF_01.In := Velocity_Feedback;
HPF_01.WLead := Cutoff_frequency;
HPF_01.Order := 2;
HPF(HPF_01);
filtered_velocity_output := HPF_01.Out
Provide Feedback