beautypg.com

Math package for w, T3833) – Rockwell Automation T3833 ICS Regent Math Package for Winterpret User Manual

Page 13

background image

Math Package for W

INTERPRET

(T3833)


P D - 6 0 4 3 M a r c h , 0 6

13

Table 9 shows a general example of how the error variables
can be used in a floating point function block to check for error
conditions and conditionally execute alternate equations that
calculate a more appropriate result than leaving the value at
its last valid value. For example, if our analog output
equation, AO = 300 + AI, was the equation in line 3, we could
use the equation, AO = 4095, in line 5 to always produce a
maximum value for the analog output when AI > 3795.

Table 9. Using Error Variables.

Line Equation

Comments

1

LINE = 0

Reset line number variable to 0 to clear
status each scan.

2

ERROR = 0

Reset error code variable to 0 to clear status
each scan.

3

A = EQUATION 1

Equation that generates an error, a better
answer is predictable:

4

IF (ERROR <> 0 AND LINE = 3)

If line 3 produces an error, a better value for
A should be determined.

5

A = BETTER VALUE

Equation that sets A to a better value than
calculated in line 3.

6

ENDIF

7

B = EQUATION 2

Equation not requiring special error handling.

8

C = EQUATION 3

Equation not requiring special error handling.

9

D = EQUATION 4

Equations not requiring special error
handling.

10

E = EQUATION 5

Next equation requiring better error handling.

11

IF (ERROR <> 0 AND LINE = 10)

If line 10 produces an error, a better value
for E should be determined.

12

E = BETTER VALUE

Equation that sets A to a better value than
calculated in line 10.

13

ENDIF

When multiple lines in the function block have math errors,
the error code variable and line number variable will change
during the execution of the function block. For each equation
that you identify a potential for a math error, you must test
for errors before executing any other equations which may
also generate errors. At the end of the scan, the error
variables will have the value of the last math error.