STD (Standard Deviation) Ladder Logic Instruction

Definition

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.

 

XPY (X To The Power Of Y) Ladder Logic Instruction

Definition

The XPY instruction is a ladder logic rung output instruction that takes the Source X to the power of Source Y and places the result in the destination. The instruction is enabled when the preceding logic is true and disabled otherwise. The values can be constants, tags or any combination.

Example:

X to the power of  Y Where X = 2 and Y = 4

= X * X * X * X

= 2 * 2 * 2 * 2

= 16

List of possible arguments

SOURCE X,Y and the DESTINATION can be any combination of the following data types.

  • CONSTANT             Can’t be the DESTINATION obviously
  • SINT              
  • INT
  • DINT
  • REAL

Note: Arithmetic status flags are affected (S:V, S:Z, S:N, S:C). Overflow, Zero, Negative, and Carry. If Source X is negative and Source Y is not an integer value a minor fault will occur.

 

RAD (Degrees To Radians) Ladder Logic Instruction

Definition

The Radians instruction is a ladder logic rung output instruction that converts the Source from degrees to radians and places the value in the Destination. The instruction is enabled when the preceding logic is true and disabled otherwise. The values can be constants, tags or any combination.

The following formula is used:    Source * π/180

π = 3.141593

List of possible arguments

SOURCE and DESTINATION can be any combination of the following data types.

  • CONSTANT             Can’t be the DESTINATION obviously
  • SINT              
  • INT
  • DINT
  • REAL

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

 

LOG (Log Base 10) Ladder Logic Instruction

Definition

The Natural Log instruction is a ladder logic rung output instruction that takes the log base 10 of the Source value and places the result in the Destination tag. The instruction is enabled when the preceding logic is true and disabled otherwise. The values can be constants, tags or any combination.

The Source value should be greater than zero. If the Source value is not greater than zero the overflow status flag is set S:V. The result will be greater than or equal to -37.92978 and less than or equal to 38.53184.

List of possible arguments

SOURCE and DESTINATION can be any combination of the following data types.

  • CONSTANT             Can’t be the DESTINATION obviously
  • SINT              
  • INT
  • DINT
  • REAL

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

 

LN (Natural Log) Ladder Logic Instruction

Definition

The Natural Log instruction is a ladder logic rung output instruction that takes the natural log of the Source value and places the result in the Destination tag. The instruction is enabled when the preceding logic is true and disabled otherwise. The values can be constants, tags or any combination.

The Source value should be greater than zero. If the Source value is not greater than zero the overflow status flag is set S:V. The result will be greater than or equal to -87.33655 and less than or equal to 88.72284.

List of possible arguments

SOURCE and DESTINATION can be any combination of the following data types.

  • CONSTANT             Can’t be the DESTINATION obviously
  • SINT              
  • INT
  • DINT
  • REAL

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

FAL (File Arithmetic and Logic) Ladder Logic Instruction

Definition

The File Arithmetic and Logic instruction is a ladder logic instruction that can perform copy, arithmetic and logic functions on data in an array. The instruction uses a Control data type in conjunction with a user defined expression. The instruction is enabled when the preceding logic is true and disabled otherwise.

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

List of possible arguments

CONTROL Must be a Control Data Type

LENGTH Number of elements in the array to be manipulated. Constant type no tags.

POSITION The current element in the array. Is an element of the control tag and can be used in the expression to step through arrays.

MODE Can be ALL or INCREMENTAL. Selecting ALL will enable the instruction to execute from the first element in an array to the last element in an array on a false to true transition. INCREMENTAL will enable the instruction to execute one element in an array for every false to true transition.

DESTINATION can be one of the following data types

  • SINT
  • INT
  • DINT
  • REAL

EXPRESSION can contain one or more of the following data types

  • SINT
  • INT
  • DINT
  • REAL
  • CONSTANT

Note: The REAL data type is supported for safety routines on the 1756-L7xS series of controllers.

The expression is defined using tags, math operators, and constants. Parentheses () are used to give priority to sections of an expression. Here is a list of logical operands.

Expressions are executed in a predetermined order of operation, not the order they are written in. The operation order may be changed by placing sections of the expression in parentheses as an expression enclosed in parentheses will execute first.

Order                                           Operation

  • 1                                            () Parentheses
  • 2                                            ABS, ACS, ASN, ATN, COS, DEG, FRD, LN, LOG, RAD,                                                         SIN, SQR, TAN, TOD, TRN
  • 3                                            **
  • 4                                            –(negate), NOT
  • 5                                            *, /, MOD
  • 6                                            –(subtract), +(add)
  • 7                                            AND
  • 8                                            XOR
  • 9                                            OR

Expression and Destination examples: The result of the expression is placed in the tag referenced in the Destination part of the instruction.

           Expression                                                         Destination

  • My_Array[Control_Tag.POS]+3       Value_1
  • Value_1                                                       My_Array[Control_Tag.POS]
  • My_Array[Control_Tag.POS]            Your_Array[Control_Tag.POS]

 

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

 

DEG (Degrees) Ladder Logic Instruction

Definition

The Degrees instruction is a ladder logic rung output instruction that converts the Source from radians to degrees and places the value in the Destination. The instruction is enabled when the preceding logic is true and disabled otherwise. The values can be constants, tags or any combination.

The following formula is used:

Source * 180/π

π = 3.141593

List of possible arguments

SOURCE and DESTINATION can be any combination of the following data types.

  • CONSTANT             Can’t be the DESTINATION obviously
  • SINT       
  • INT
  • DINT
  • REAL

 

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

AVE (Average) Ladder Logic Instruction

Definition

The Average instruction is a ladder logic rung instruction that calculates the average 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.

The Average ladder instruction uses the Control data type to calculate the average.

Insure the Length and Position does not travel outside the array boundaries. [click to continue…]

ATN (Arc Tangent) Ladder Logic Instruction

Definition and Video

The Arc Tangent instruction is a ladder logic rung output instruction that takes the arc tangent of the Source value and places the result in the Destination tag. The instruction is enabled when the preceding logic is true and disabled otherwise. The values can be constants, tags or any combination.

The result will be between -π/2 and π/2.

List of possible arguments

SOURCE and DESTINATION can be any combination of the following data types.

  • CONSTANT             Can’t be the DESTINATION obviously
  • SINT              
  • INT
  • DINT
  • REAL

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

ACS (Arc Cosine) Ladder Logic Instruction

Definition & Video

The Arc Cosine instruction is a ladder logic rung output instruction that takes the arc cosine of the Source value and places the result in the Destination tag. The instruction is enabled when the preceding logic is true and disabled otherwise. The values can be constants, tags or any combination.

The Source must be between -1 and 1. The result will be between 0 and π.

List of possible arguments

SOURCE and DESTINATION can be any combination of the following data types.

  • CONSTANT             Can’t be the DESTINATION obviously
  • SINT              
  • INT
  • DINT
  • REAL

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