Integrator (INTG)
This information applies to the
CompactLogix
5370, ControlLogix
5570, Compact GuardLogix
5370, GuardLogix
5570, CompactLogix
5380, CompactLogix
5480, and ControlLogix
5580 controllers.Available Languages
Ladder Diagram
This instruction is not available in ladder diagram logic.
Function Block
Structured Text
INTG(INTG_tag);
Operands
Function Block
Operand | Type | Format | Description |
---|---|---|---|
INTG tag | INTEGRATOR | Structure | INTG structure |
INTEGRATOR Structure
Input Parameter | Data Type | Description |
---|---|---|
EnableIn | BOOL | Enable input. If cleared, the instruction does not execute and outputs are not updated.
Default is set. |
In | REAL | The analog signal input to the instruction.
Valid = any float
Default = 0.0 |
Initialize | BOOL | Request to initialize control algorithm. Output = InitialValue as long as Initialize is set.
Valid = any float
Default = 0.0 |
InitialValue | REAL | The initial value for instruction. Output = InitialValue as long as Initialize is set.
Valid = any float
Default = 0.0 |
IGain | REAL | The integral gain multiplier. If IGain < 0; the instruction sets IGain = 0.0, sets the appropriate bit in Status, and leaves the Output unchanged.
Valid = 0.0 to maximum positive float
Default = 0.0 |
HighLimit | REAL | The high limit value for Out. If HighLimit LowLimit, the instruction sets HighAlarm and LowAlarm, sets the appropriate bit in Status, and sets Out = LowLimit.
Valid = any float
Default = maximum positive float |
LowLimit | REAL | The low limit value for Out. If HighLimit LowLimit, the instruction sets HighAlarm and LowAlarm, sets the appropriate bit in Status, and sets Out = LowLimit.
Valid = any float
Default = maximum negative float |
HoldHigh | BOOL | Hold output high request. When set, Out is not allowed to increase in value.
Default is cleared. |
HoldLow | BOOL | Hold output low request. When set, Out is not allowed to decrease in value.
Default is cleared. |
TimingMode | DINT | Selects timing execution mode. 0 = Periodic 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. |
HighAlarm | BOOL | High limit alarm indicator. When Out HighLimit, HighAlarm is set and the output is limited to the value of HighLimit. |
LowAlarm | BOOL | Low limit alarm indicator. When Out LowLimit, LowAlarm is set and the output is limited to the value of LowLimit. |
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. |
IGainInv (Status.1) | BOOL | IGain > maximum or IGain < minimum. |
HighLowLimsInv (Status.2) | BOOL | HighLimit LowLimit. |
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 when
ABS | DeltaT - RTSTime | > 1 (.001 second). |
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 |
---|---|---|---|
INTG tag | INTEGRATOR | Structure | INTG structure |
See Structured Text Syntax for more information on the syntax of expressions within structured text.
Description
The INTG instruction is designed to execute in a task where the scan rate remains constant.
The INTG instruction executes this control algorithm when Initialize is cleared and DeltaT > 0.
Whenever the value computed for the output is invalid, NAN, or INF, the instruction sets Out = the invalid value. The internal parameters are not updated. In each subsequent scan, the output is computed using the internal parameters from the last scan when the output was valid.
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 | The internal parameters and Out are set to 0. |
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. |
Examples
In many applications an integral gain component is included in the closed loop regulator design in order to eliminate or minimize error in the system being regulated. A straight proportional-only regulator will not tend to drive error in the system to zero. A regulator that uses proportional and integral gain, however, tends to drive the error signal to zero over a period of time. The INTG instruction uses the following equation to calculate its output.
In the chart below, the input to the block moves from 0 to +200 units. During this period, the output of the block integrates to 2800 units. As In changes from +200 units to 0 units, Out maintains at 2800 units. When In transitions from 0 to -300 units, Out slowly integrates down to -1400 units until In transitions back to 0. Finally, as In moves from 0 to +100, Out integrates back to 0 where In is set to 0 coincidentally with Out reaching 0.
This characteristic of the integrator - continually driving in a specific direction while any input to the function is present or holding at any level during the point where the input is at zero - is what causes a regulator using integral gain to drive toward zero error over a period of time.
The following example shows how the INTG instruction can be used. In many instances, the HighLimit and LowLimit inputs limit the total percentage of control that the integral gain element might have as a function of the regulator’s total output. The HoldHigh and HoldLow inputs, on the other hand, can be used to prevent the output from moving further in either the positive or negative direction. The HoldHigh and HoldLow inputs prevent the INTG instruction from "winding-up" in a direction which is already beyond the limits of the controlled variable.
Function Block
This example is the minimal legal programming of the INTG 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.
Structured Text
INTG_01.In := Input_Value;
INTG_01.Initialize := Initialize_flag;
INTG_01.InitialValue := Int_Init_Val;
INTG_01.IGain := I_Gain;
INTG_01.HighLimit := Int_saturate_high;
INTG_01.LowLimit := Int_saturate_low;
INTG_01.HoldHigh :=HAlarm_Status;
INTG_01.HoldLow := LAlarm_Status;
INTG(INTG_01);
Provide Feedback