Class AArithm
Version 1.0
Modified 15-JAN-2025 13:23:34.00
Code rt_plc_macro_logic.h
 Arithmetical expression in the C programming language.


 Optional programmable arithmetical expression in the C
 programming language. The expression is edited by means
 of the Attribute Editor at the object's Expression
 attribute. The expression, which does not include '=' ,
 is translated at the compilation.
 The Expression attribute is shown in the object.

 Up to 8 analog ( A1, ..., A8) and 8 digital ( d1, ...,d8)
 inputs.
 Digital inputs may be inverted either by means of the
 Attribute Editor, or by the logical operator '!' in the
 Expression attribute.

 Note! If an arithmetical operator is followed by a graph
 name, e.g. A1, the operator and the graph name have to
 be separated by a space or a left parenthesis.

 If an input is used as a constant quantity it is
 suitable to make the input invisible by marking Unused.
 We prefer to write the constant direct into the Expression
 if it is not supposed to be changed. In this case no
 input is used. On the other hand, if we have to adjust
 the constant in run time it is a good idea to make use
 of an Av or Dv object, as this will make it easier to
 get access to the constant from the object display.
 Unused inputs give compilation errors.
 Mathematical functions in the C programming language
 can be used, for instance:

 - exp(A1)       exponential function
 - log10(A1)     base-10 logarithm of A1
 - sin(A1)       sine of A1
 - (1.2E3 + A1) * ( A2 + 3.7 )   arithmetic, note the constants.
 - fabs( A1)     absolute value
 - pow(A1, A2)   A1 rasied to the A2-th power.
 - there is an often used conditional operator, '?', in
   the C programming language used to evaluate
   alternatives. In the following example '&&' means
   logical AND,
   (d1 && d2) ? A1 + A2 : A3, means that VAL = A1+ A2,
   if d1 and d2 are TRUE , otherwise VAL = A3

Example

 This example shows how digital signals can be counted. Some signals
 are counted if they are TRUE others if they are FALSE and then the
 sum is stored. Note that Di3 is included in the sum if it is FALSE.
 See Also



RtBody attributes pwr_sClass_aarithm
Float32 AIn1 A1 Analog quantity that can be included in the
Float32 AIn2 A2 Analog quantity that can be included in the
Float32 AIn3 A3 Analog quantity that can be included in the
Float32 AIn4 A4 Analog quantity that can be included in the
Float32 AIn5 A5 Analog quantity that can be included in the
Float32 AIn6 A6 Analog quantity that can be included in the
Float32 AIn7 A7 Analog quantity that can be included in the
Float32 AIn8 A8 Analog quantity that can be included in the
Boolean DIn1 d1 Digital quantity that can be included in the
Boolean DIn2 d2 Digital quantity that can be included in the
Boolean DIn3 d3 Digital quantity that can be included in the
Boolean DIn4 d4 Digital quantity that can be included in the
Boolean DIn5 d5 Digital quantity that can be included in the
Boolean DIn6 d6 Digital quantity that can be included in the
Boolean DIn7 d7 Digital quantity that can be included in the
Boolean DIn8 d8 Digital quantity that can be included in the
Float32 ActVal VAL The result of the latest Expression evaluation.

DevBody attributes 
String80 Expression expr Arithmetic expression in the C programming language.
The expression is edited by means of the Attribute
Editor and cannot be changed in the target environment.
PlcNode PlcNode  


GraphPlcNode
object_type 132
parameters[0] 16
parameters[1] 0
parameters[2] 1
parameters[3] 0
subwindows 1
graphmethod 2 (standard, two textfield)
graphindex 0
default_mask[0] 1
default_mask[1] 1
segname_annotation 3
devbody_annotation 1
compmethod 22
compindex 0
tracemethod 0
traceindex 0
executeordermethod 2
objname AArit
graphname AArithm
debugpar


Attributes detail


AIn1 Input
Class Input
Type Float32
Flags REDUTRANSFER
GraphName A1
Body RtBody
 Analog quantity that can be included in the
 Expression attribute. If A1 is
 connected, the external signal is used, otherwise the
 internal attribute AIn1. Changes in AIn1, ..., AIn8 in
 the run time system are taken into consideration.

AIn2 Input
Class Input
Type Float32
Flags REDUTRANSFER
GraphName A2
Body RtBody
 Analog quantity that can be included in the
 Expression attribute. If A2 is
 connected, the external signal is used, otherwise the
 internal attribute AIn2. Changes in AIn1, ..., AIn8 in
 the run time system are taken into consideration.

AIn3 Input
Class Input
Type Float32
Flags REDUTRANSFER
GraphName A3
Body RtBody
 Analog quantity that can be included in the
 Expression attribute. If A3 is
 connected, the external signal is used, otherwise the
 internal attribute AIn3. Changes in AIn1, ..., AIn8 in
 the run time system are taken into consideration.

AIn4 Input
Class Input
Type Float32
Flags REDUTRANSFER
GraphName A4
Body RtBody
 Analog quantity that can be included in the
 Expression attribute. If A4 is
 connected, the external signal is used, otherwise the
 internal attribute AIn4. Changes in AIn1, ..., AIn8 in
 the run time system are taken into consideration.

AIn5 Input
Class Input
Type Float32
Flags REDUTRANSFER
GraphName A5
Body RtBody
 Analog quantity that can be included in the
 Expression attribute. If A5 is
 connected, the external signal is used, otherwise the
 internal attribute AIn5. Changes in AIn1, ..., AIn8 in
 the run time system are taken into consideration.

AIn6 Input
Class Input
Type Float32
Flags REDUTRANSFER
GraphName A6
Body RtBody
 Analog quantity that can be included in the
 Expression attribute. If A6 is
 connected, the external signal is used, otherwise the
 internal attribute AIn6. Changes in AIn1, ..., AIn8 in
 the run time system are taken into consideration.

AIn7 Input
Class Input
Type Float32
Flags REDUTRANSFER
GraphName A7
Body RtBody
 Analog quantity that can be included in the
 Expression attribute. If A7 is
 connected, the external signal is used, otherwise the
 internal attribute AIn7. Changes in AIn1, ..., AIn8 in
 the run time system are taken into consideration.

AIn8 Input
Class Input
Type Float32
Flags REDUTRANSFER
GraphName A8
Body RtBody
 Analog quantity that can be included in the
 Expression attribute. If A8 is
 connected, the external signal is used, otherwise the
 internal attribute AIn8. Changes in AIn1, ..., AIn8 in
 the run time system are taken into consideration.

DIn1 Input
Class Input
Type Boolean
Flags NOINVERT | REDUTRANSFER
GraphName d1
Body RtBody
 Digital quantity that can be included in the
 Expression attribute. If d1 is
 connected, the external signal is used, otherwise the
 internal attribute DIn1. Changes in DIn1, ..., DIn8 in
 the run time system are taken into consideration.

DIn2 Input
Class Input
Type Boolean
Flags NOINVERT | REDUTRANSFER
GraphName d2
Body RtBody
 Digital quantity that can be included in the
 Expression attribute. If d2 is
 connected, the external signal is used, otherwise the
 internal attribute DIn2. Changes in DIn1, ..., DIn8 in
 the run time system are taken into consideration.

DIn3 Input
Class Input
Type Boolean
Flags NOINVERT | REDUTRANSFER
GraphName d3
Body RtBody
 Digital quantity that can be included in the
 Expression attribute. If d3 is
 connected, the external signal is used, otherwise the
 internal attribute DIn3. Changes in DIn1, ..., DIn8 in
 the run time system are taken into consideration.

DIn4 Input
Class Input
Type Boolean
Flags NOINVERT | REDUTRANSFER
GraphName d4
Body RtBody
 Digital quantity that can be included in the
 Expression attribute. If d4 is
 connected, the external signal is used, otherwise the
 internal attribute DIn4. Changes in DIn1, ..., DIn8 in
 the run time system are taken into consideration.

DIn5 Input
Class Input
Type Boolean
Flags NOINVERT | REDUTRANSFER
GraphName d5
Body RtBody
 Digital quantity that can be included in the
 Expression attribute. If d5 is
 connected, the external signal is used, otherwise the
 internal attribute DIn5. Changes in DIn1, ..., DIn8 in
 the run time system are taken into consideration.

DIn6 Input
Class Input
Type Boolean
Flags NOINVERT | REDUTRANSFER
GraphName d6
Body RtBody
 Digital quantity that can be included in the
 Expression attribute. If d6 is
 connected, the external signal is used, otherwise the
 internal attribute DIn6. Changes in DIn1, ..., DIn8 in
 the run time system are taken into consideration.

DIn7 Input
Class Input
Type Boolean
Flags NOINVERT | REDUTRANSFER
GraphName d7
Body RtBody
 Digital quantity that can be included in the
 Expression attribute. If d7 is
 connected, the external signal is used, otherwise the
 internal attribute DIn7. Changes in DIn1, ..., DIn8 in
 the run time system are taken into consideration.

DIn8 Input
Class Input
Type Boolean
Flags NOINVERT | REDUTRANSFER
GraphName d8
Body RtBody
 Digital quantity that can be included in the
 Expression attribute. If d8 is
 connected, the external signal is used, otherwise the
 internal attribute DIn8. Changes in DIn1, ..., DIn8 in
 the run time system are taken into consideration.

ActVal Output
Class Output
Type Float32
Flags STATE | NOEDIT | REDUTRANSFER
GraphName VAL
Body RtBody
 The result of the latest Expression evaluation.

Expression Intern
Class Intern
Type String80
Flags
GraphName expr
Body DevBody
 Arithmetic expression in the C programming language.
 The expression is edited by means of the Attribute
 Editor and cannot be changed in the target environment.

PlcNode Buffer
Class Buffer
Type PlcNode
Flags INVISIBLE
Body DevBody