12.07.2015 Views

Logix5000 Controllers General Instructions - SLAC Confluence

Logix5000 Controllers General Instructions - SLAC Confluence

Logix5000 Controllers General Instructions - SLAC Confluence

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Array (File)/Misc. <strong>Instructions</strong> (FAL, FSC, COP, CPS, FLL, AVE, SRT, STD, SIZE) 379Structured TextStructured text does not have an STD instruction, but you can achievethe same results using a SIZE instruction and a FOR...DO or otherloop construct.SIZE(array,0,length);sum := 0;FOR position = 0 TO length-1 DOsum := sum + array[position];END_FOR;average := sum / length;sum := 0;FOR position = 0 TO length-1 DOsum := sum + ((array[position] - average)**2);END_FOR;destination := SQRT(sum /(length-1));See Appendix B for information on the syntax of constructs withinstructured text.Description:The standard deviation is calculated according to this formula:Standard Deviation =N⎛⎞⎜∑ [〈 X ( start + i)∠ AVE〉 2 ] ⎟⎜⎟⎝i = 1⎠---------------------------------------------------------------------( N ∠ 1)Where:• start = dimension-to-vary subscript of the array operand• x i = variable element in the array• N = number of specified elements in the array• AVE = N⎛⎞⎜ x ⎟⎜∑( start + i)⎟⎝i = 1⎠----------------------------------------NIMPORTANTMake sure the Length does not cause the instruction to exceed the specifiedDimension to vary. If this happens, the Destination will be incorrect.Publication 1756-RM003I-EN-P - January 2007

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!