
46
How equations are evaluated:
Calculations are performed from left-to-right until the end of the equation is reached. As the equation is parsed, each
token's value is pushed onto a stack until an operator is found. When an operator is found, the previous 2 values are
popped from the stack and are used to perform the operation (the first item popped is the SECOND operand). The
result of the operation is then pushed onto the stack. This repeats until the end of the equation is reached. An
equation is valid only if there is exactly ONE item left in the stack when the end of the equation is reached.
Example of how an equation is evaluated:
Equation: a8 a5 a6 + * a4 -
Input
Operation
Stack
Comment
a8
Push value
a8
a5
Push value
a5
a8
a6
Push value
a6
a5
a8
+
Add
(a5+a6)
a8
Pop a6 and a5, add them, push result to stack
*
Multiply
a8*(a5+a6)
Pop (a5+a6) and a8, multiply them, push result to stack
a4
Push value
a4
a8*(a5+a6)
-
Subtract
a8*(a5+a6) - a4 Pop a4 and a8*(a5+a6), subtract them, push result to stack
In this example, after the subtraction there is only ONE item left in the stack (which is the result of all of the
previous computations), mak ing this a valid equation.
Equation: d1 d2 + d3 * r1 =
Input
Operation
Stack
Comment
d1
Push value
d1
d2
Push value
d2
d1
+
OR
(d1+d2)
Pop d1 and d2, OR them, push result to stack
d3
Push value
d3
(d1+d2)
*
AND
(d1+d2)*d3
Pop (d1+d2) and d3, AND them, push result to stack
r1
Push value
r1
(d1+d2)*d3
=
Assign Value r1=(d1+d2)*d3
Pop (d1+d2)*d3 and r1and assign value to r1
In this example, after the assignment, there is only ONE item left in the stack (which is the result of all of the
previous computations), mak ing this a valid equation.
Содержание D-PK-TDFG2
Страница 5: ...SNMP FAQs 17 2 102 Technical Support 18 103 End User License Agreement 19 106...
Страница 6: ......
Страница 15: ...9 Temp Defender G2 Front Panel 6 TempDefender G2 Front Panel...
Страница 23: ...17 instructions on setting up your LAN connection...
Страница 59: ...53 11 12 2 Modbus Registers Provisioning Modbus Registers...
Страница 65: ...59 Welcome screen on a mobile...
Страница 110: ...104...
Страница 111: ...105...