Add Event Action — Math

Topic: CM011

The math instruction solves a user-defined formula when the condition defined in event type transitions to TRUE. Develop the formula in the math dialog using the on-screen keypad, the computer keyboard, and Tag Name Database.

Configure an Action

The basic steps are the same for adding any Event Action to an Event. See Adding Event Actions - The Basics.

  1. In the Result Tag field, click the drop-down arrow or browse to the tag you want to assign.
  • The result value is adjusted to the Data type of the Result Tag.
  1. In the Formula text box, enter a formula or alternately select Keypad to open a more comprehensive keypad window. Enter tags into the formula using the Tag Browse button.
  2. Using the key descriptions in this table, develop your formula. See the formula example at the end of this topic.


You can nest parenthetical expressions up to eight levels deep.

If Floating Point Data Type is used in any operation, then all operations are based on floating point math. The solution is stored in the Data format selected for the result.

Error Flags: These internal system tags are provided to programmatically react to an unexpected condition.

  • SYS MATH ERROR
  • SYS MATH DIVISION ERROR
  • SYS MATH OUT OF RANGE
  • SYS MATH ERROR EVENT NUM

See System Tags for more information.

Note: Maximum Embedded Tags = 8.
Maximum Formula String Length = 512 characters.
When a math error is True, the result tag isn't updated.

Math Action Formula
Key Name Definition Usage Example

Left and Right Parentheses Used for grouping terms. Must be used in pairs. (DF1 + 5)
Sine Sine Θ = opposite / hypotenuse Θ = Radian SIN(DF1) SIN(RAD(DF1))
Cosine Cosine Θ = adjacent / hypotenuse Θ = Radian COS(DF1) COS((RAD(DF1))
Tangent Tangent Θ = sine / cosine Θ = Radian TAN(DF1)
Arc Sine Inverse Sine ASIN(DF1)
Arc Cosine Inverse Cosine ACOS(DF1)
Arc Tangent Inverse Tangent ATAN(DF1)
Power (Exponent) a ^ b = a raised to the power b. DF1^DF2
Log (Base 10) If x = b ^ y, y = log_bx LOG(DF1)
Square Root The Square Root of b is the number a if a * a = b. SQRT(DF1)
Log (Natural) If x = e ^ y, y = ln_bx LN(DF1)
Radians Converts degrees to radians. radians = degrees * (pi/180) RAD(DF1)
Degrees Converts radians to degrees. degrees = radians * (180/pi) DEG(DF1)
Pi Constant that equals the ratio of a circle's circumference to its diameter. 3.1415927

to
Number Keys The numbers 0 to 9. 0123456789
Decimal Decimal notation, "." 1.234



Arithmetic Operators Divide, Multiply, Subtract, Add DF1 / DF2
DF1 * DF2
DF1 – DF2
DF1 + DF2
Modulo a MOD b refers to the arithmetic remainder after a is divided by b. DF1 MOD DF2