9-5
IM 04L42B01-01E
Computation and Report Functions (/M1 and /PM1 Options)
9
9.2 WritingExpressions
This section explains the meaning and how to write expressions.
Common Items
Follow the rules below when writing expressions.
• Useupto120characterstowriteexpressions.
• Theprecedenceofcomputingtermscanbespecifiedusingparentheses.
• Specifythechannelsintheexpressionusingchannelnumbers.
Example: 1, 12, 101, and 201
• Theone-digitnumberofconstants(K),communicationinputdata(C),remoteinput
terminal status (D), pulse input (P, Q), internal switch (S), alarm output relay status
(I), flag (F), and recording (memory sampling) status (M) in the expression can be
denoted as in “01” and “1.”
Example: K01, K1, C01, C1, D01, D1, P01, P1, Q01, Q1, S01, S1, I01, I1, F01, and F1.
• Thedataofthepreviousscanisusedinthecomputationforitsownchannelnumber
and channel numbers greater than its own channel number in the expression.
• Specialcomputation(HOLD,RESET,andCARRY)andconditionalexpressionsare
written at the beginning of the expression.
OrderofPrecedenceinComputations
The order of precedence of computation in expressions is as follows:
Type ComputingElement
(high order of precedence)
Function ABS(), SQR(), LOG(), LN(), EXP(),
TLOG.MAX(), TLOG.MIN(), TLOG.
AVE(), TLOG.SUM(), TLOG.P-P(),
CLOG.MAX(), CLOG.MIN(), CLOG.
AVE(), CLOG.SUM(), CLOG.P-P()
Special computation and conditional expression PRE, HOLD, RESET, CARRY, [a?b:c]
Power **
Logical negation NOT
Multiplication and division *, /
Addition and subtraction +, –
Greater than and less than .GT., .LT., GE., LE.
Equal and not equal .EQ., .NE.
Logical product AND
Logical sum and exclusive logical sum OR, XOR
(low order of precedence)
Limitations
The following limitations exists in writing expressions.
Type Limitations
TLOG computation A computing element cannot be written inside the parentheses.
Only one TLOG computation can be specified in a single expression.
CLOG computation
Number of channels that can be written in the parentheses is 30 channels or less.
A computing element cannot be written inside the parentheses.
Only one CLOG computation can be specified in a single expression.
PRE A computing element cannot be written inside the parentheses.
HOLD(a):b Can only be written at the beginning of an expression.
Only one HOLD computation can be specified in a single expression.
RESET(a):b Can only be written at the beginning of an expression.
Only one RESET computation can be specified in a single expression.
CARRY(a):b Can only be written at the beginning of an expression.
Only one CARRY computation can be specified in a single expression.
Only TLOG.SUM can be written in “b.”
Conditional equation
[a?b:c]
RESET, CARRY, or HOLD cannot be written to “a,” “b,” or “c.” Other computing
elements cannot be combined (example: [a?b:c]+001). However, conditional
equations can be specified for a, b, and c.