STD (Standard Deviation) Ladder Logic Instruction

The Standard Deviation instruction is a ladder logic rung instruction that calculates the standard deviation of values in an array and places the calculated value in the Destination tag. The instruction is enabled when the preceding logic is true and disabled otherwise. Wikipedia has an excellent article detailing the theory and standard deviation formula.

The STD ladder instruction uses the Control data type to calculate the standard deviation.

Insure the Length and Position does not travel outside the array boundaries.

List of possible arguments

ARRAY TAG & DIMENSION TO VARY must be an array and the dimension of the array must be pointed out.

ARRAY can be one of the following data types

SINT              
INT
DINT
REAL

  • DIM TO VARY Must be a Constant with one of these values 0,1,2
  • DESTINATION can be one of the following data types
  • REAL
  • CONTROL Must be a Control Data Type
  • LENGTH The amount of elements in the array to average
  • POSITION Is the beginning position in the array to average

If the Position or Length is less than zero a major fault will occur. Make sure the length is less than or equal to the actual array size. If the Length value is set higher than the length of the array the destination value will be wrong.

Note: Arithmetic status flags are affected (S:V, S:Z, S:N, S:C). Overflow, Zero, Negative, and Carry.

 

1 thought on “STD (Standard Deviation) Ladder Logic Instruction”

  1. Can we have some more detail on how this works, and more importantly how it can be used in an industrial setting? I think this would be useful for determining the quality of an analog signal within a moving average array, but I’m not sure how to implement it.

    Reply

Leave a Comment