Notch Filter (NTCH)

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 NTCH instruction provides a filter to attenuate input frequencies that are at the notch frequency.
Available Languages
Ladder Diagram
This instruction is not available in ladder diagram logic.
Function Block
RSL5K_NTCH Function Block_v31
Structured Text
NTCH(NTCH_tag);
Operands
Function Block
Operand
Type
Format
Description
NTCH tag
FILTER_NOTCH
Structure
NTCH structure
FILTER_NOTCH 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.
WNotch
REAL
The filter center frequency in radians/second. If WNotch < minimum or WNotch > maximum, the instruction sets the appropriate bit in status and limits WNotch.
Valid = see Description section below for valid ranges
Default = maximum positive float
QFactor
REAL
Controls the width and depth ratio. Set QFactor = 1 / (2*desired damping factor). If QFactor < minimum or QFactor > maximum value, the instruction sets the appropriate bit in Status and limits QFactor.
Valid = 0.5 to 100.0
Default = 0.5
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 = 2.
Valid = 2 or 4
Default = 2
TimingMode
DINT
Selects timing execution mode.
0 = Periodic mode
1 = Oversample mode
2 = Real time sampling mode2
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.
WNotchInv (Status.1)
BOOL
WNotch < minimum or WNotch > maximum
QFactorInv (Status.2)
BOOL
QFactor < minimum or QFactor > maximum
OrderInv (Status.3)
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
NTCH tag
FILTER_NOTCH
structure
NTCH structure
See Structured Text Syntax for more information on the syntax of expressions within structured text.
Description
The NTCH instruction uses the Order parameter to control the sharpness of the cutoff. The QFactor parameter controls the width and the depth ratio of the notch. The NTCH instruction is designed to execute in a task where the scan rate remains constant.
The NTCH instruction uses this equation:
NTCH Equation
where i is the Order operator with these parameters limits (where DeltaT is in seconds):
Parameter
Limitations
WNotch second order
LowLimit
NTCH Second order LowLimit
WNotch fourth order
LowLimit
NTCH fourth order LowLimit
HighLimit
NTCH HighLimit
QFactor
LowLimit = 0.5
HighLimit = 100.0
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
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 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 NTCH instruction attenuates a specific resonance frequency. Typically, these resonance frequencies are directly in the range of response being regulated by the closed loop control system. Often, they are generated by loose mechanical linkages that cause backlash and vibration in the system. Although the best solution is to correct the mechanical compliance in the machinery, the notch filter can be used to soften the effects of these signals in the closed loop regulating scheme.
The following diagram shows the ideal gain curve over a frequency range for a specific center frequency and Q factor. As increases, the notch becomes wider and shallower. As decreases; the notch becomes deeper and narrower. The instruction may be set for an order of 2 or an order of 4. Higher orders take more execution time.
This example is the minimal legal programming of the NTCH 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.
NTCH Example
Function Block
RSL5K_NTCH FBDExample_v31
Structured Text
NTCH_01.In := frequency_input;
NTCH_01.WNotch := center_frequency;
NTCH_01.QFactor := Notch_width_depth;
NTCH(NTCH_01);
Notch_output := NTCH_01.Out;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.