Structured Text - Allen-Bradley Logix5000 Reference Manual

1756 controllogix, 1768 compactlogix, 1769 compactlogix, 1789 softlogix, 1794 flexlogix, powerflex 700s with drivelogix
Hide thumbs Also See for Logix5000:
Table of Contents

Advertisement

Array (File)/Misc. Instructions (FAL, FSC, COP, CPS, FLL, AVE, SRT, STD, SIZE)

Structured Text

Structured text does not have an STD instruction, but you can achieve the same
results by using a SIZE instruction and a FOR...DO or other loop construct.
SIZE(array,0,length);
sum := 0;
FOR position = 0 TO length-1 DO
sum := sum + array[position];
END_FOR;
average := sum / length;
sum := 0;
FOR position = 0 TO length-1 DO
sum := sum + ((array[position] - average)**2);
END_FOR;
destination := SQRT(sum /(length-1));
See
Structured Text Programming
within structured text.
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
for information on the syntax of constructs
Chapter 8
391

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents