Relay Ladder; 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

Chapter 8
Array (File)/Misc. Instructions (FAL, FSC, COP, CPS, FLL, AVE, SRT, STD, SIZE)
16
+
11
+ +
6
------------------------------------ -
AVE
=
4
16 8.5
STD
=
-------------------------------------------------------------------------------------------------------------------------- -
real_std = 6.454972
394
Example 1:
Calculate the standard deviation of dint_array, which is DINT[4,5].
1
34
----- -
=
=
8.5
4
2
2
+
11 8.5
+
6 8.5
4 1

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));
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Dimension 0
2
2
+
1 8.5
=
6.454972
Dimension 1
0
1
2
3
20
19
18
17
0
15
14
13
12
1
10
9
8
7
2
5
4
3
2
3
4
16
11
6
1

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents