Up/Down Accumulator (UPDN)

This information applies to the
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370,
GuardLogix
5570,
CompactLogix
5380,
CompactLogix
5480, and
ControlLogix
5580 controllers.
The UPDN instruction adds and subtracts two inputs into an accumulated value.
Available Languages
Ladder Diagram
This instruction is not available for ladder diagram diagram.
Function Block
RSL5K_UPDN Function Block_v31
Structured Text
UPDN(UPDN_tag)
Operands
Function Block
Operand
Type
Format
Description
UPDN tag
UP_DOWN_ACCUM
Structure
UPDN structure
UPDN 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.
Initialize
BOOL
The initialize input request for the instruction. When Initialize is set, the instruction sets Out and the internal accumulator to InitialValue.
Default is cleared.
InitialValue
REAL
The initialize value of the instruction.
Valid = any float
Default = 0.0
InPlus
REAL
The input added to the accumulator.
Valid = any float
Default = 0.0
InMinus
REAL
The input subtracted from the accumulator.
Valid = any float
Default = 0.0
Hold
BOOL
The hold input request for the instruction. When Hold is set and Initialize is cleared, Out is held.
Default is cleared.
Output Parameter
Data Type
Description
EnableOut
BOOL
Indicates if instruction is enabled. Cleared to false if Out overflows.
Out
REAL
The output of the instruction.
Structured Text
Operand
Type
Format
Description
UPDN tag
UP_DOWN_ACCUM
Structure
UPDN structure
See Structured Text Syntax for more information of the syntax of expressions within structured text.
Description
The UPDN instruction follows these algorithms.
Condition
Action
Hold is cleared and
Initialize is cleared
AccumValue
n
= AccumValue
n-1
+ InPlus - InMinus
Out = AccumValue
n
Hold is set and
Initialize is cleared
AccumValue
n
= AccumValue
n-1
Out = AccumValue
n
Initialize is set
AccumValue
n
= InitialValue
Out = AccumValue
n
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
Internal accumulator is set to zero.
Instruction first scan
N/A
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 UPDN instruction integrates counts from one scan to the next. This instruction can be used for simple positioning applications or for other types of applications where simple integration is required to create an accumulated value from a process’s differentiated feedback signal. In the example below, Initial_Position is set to zero, while Differential_Position_Plus and Differential_Position_Minus take varying values over a period of time. With this instruction, InPlus and InMinus could also accept negative values.
UPDN Example
Function Block
The derivative instruction calculates the amount of change of a signal over time in per-second units. This instruction is often used in closed loop control to create a feed forward path in the regulator to compensate for processes that have a high degree of inertia.
RSL5K_UPDN Example 2_v31
Structured Text
UPDN_01.Initialize := Initialize_Position;
UPDN_01.InitialValue := Initial_Position;
UPDN_01.InPlus := Differential_Position_Plus;
UPDN_01.InMinus := Differential_Position_Minus;
UPDN(UPDN_01);
Position_Integrated := UPDN_01.Out;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.