Rockwell Automation Publication 1756-RM003N-EN-P - October 2011 391
Array (File)/Misc. Instructions (FAL, FSC, COP, CPS, FLL, AVE, SRT, STD, SIZE) Chapter 8
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
for information on the syntax of constructs
within structured text.