EasyManuals Logo
Home>Allen-Bradley>Controller>Logix5000

Allen-Bradley Logix5000 Reference Manual

Allen-Bradley Logix5000
708 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #394 background imageLoading...
Page #394 background image
394 Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Chapter 8 Array (File)/Misc. Instructions (FAL, FSC, COP, CPS, FLL, AVE, SRT, STD, SIZE)
Example 1: Calculate the standard deviation of dint_array, which is DINT[4,5].
Relay Ladder
Structured Text
SIZE(dint_array,0,length);
sum := 0;
FOR position = 0 TO (length-1) DO
sum := sum + dint_array[position];
END_FOR;
average := sum / length;
sum := 0;
FOR position = 0 TO (length-1) DO
sum := sum + ((dint_array[position] - average)**2);
END_FOR;
real_std := SQRT(sum / (length-1));
Dimension 1
Dimension 0
0
20 19 18 17 16
15 14 13 12 11
10 9 8 7 6
54321
1
2
3
01234
STD
16 8.5–
2
11 8.5–
2
6 8.5–
2
1 8.5–
2
+++
41–
--------------------------------------------------------------------------------------------------------------------------- 6.454972==
AVE
16 11 6 1+++
4
-------------------------------------
34
4
------
8.5===
Su
b
scripts
real_std = 6.454972

Table of Contents

Other manuals for Allen-Bradley Logix5000

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Allen-Bradley Logix5000 and is the answer not in the manual?

Allen-Bradley Logix5000 Specifications

General IconGeneral
BrandAllen-Bradley
ModelLogix5000
CategoryController
LanguageEnglish

Related product manuals