Rockwell Automation Publication 1756-RM006K-EN-P - November 2018 387
Initializing the Averaging Algorithm
Certain conditions, such as instruction first scan and instruction first run, require
the instruction to initialize the moving average algorithm. When this occurs, the
instruction considers the sample StorageArray empty and incrementally averages
samples from 1 to the NumberOfSamples value. For example:
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 Request re-initialization of Storage array the next time the instruction executes.
Tag.EnableIn is true EnableIn and EnableOut bits are set to true.
The instruction executes.
Instruction first run N/A
Instruction first scan Initialize Out to zero.
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.