| Volume pwrb | |
| Attributes: Runtime | Development | System | Template | Detail C Binding: Struct | Class | Code  ClassTree | INDEX NO INDEX |
Class DArithm
|
||
|---|---|---|
| Version | 1.0 | |
| Modified | 15-JAN-2025 13:23:34.00 | |
| Code | rt_plc_macro_logic.h | |
User-defined logical expression.

Optional programmable logical expression in the C programming language. The expression is edited by means of the Attribute Editor at the object's Expression attribute. The expression, that 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 could be inverted either by means of the Attribute Editor or by the logical operator '!' in the Expression attribute. Note! If an arithmetic 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 will be used as a constant quantity it is suitable to make the input invisible by marking Unused. We prefer to write the constant value 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 be able to adjust the constant in run time it is a good idea to use an Av or Dv object, as this will make it easier to get access from the object display. Unused inputs make compilation errors.Example
1 Combinational circuit. In the following example '&&' means logical and, '||' means logical or and '!' means not. Expression: (d1 && d2 || !d3) && d4

is equivalent with

2 Maximum one of d1 - d5 is TRUE or d6
Expression: ((d1 + d2 + d3 + d4 + d5) < 2) || d6
3 Comparison.
Expression: (A1 + 3.5 * A2) < A3
See Also| RtBody attributes pwr_sClass_darithm | |||
|---|---|---|---|
| Boolean | DIn1 | d1 | Digital quantities included in the Expression |
| Boolean | DIn2 | d2 | |
| Boolean | DIn3 | d3 | |
| Boolean | DIn4 | d4 | |
| Boolean | DIn5 | d5 | |
| Boolean | DIn6 | d6 | |
| Boolean | DIn7 | d7 | |
| Boolean | DIn8 | d8 | |
| Float32 | AIn1 | A1 | Analog quantities included in the Expression attribute. |
| Float32 | AIn2 | A2 | |
| Float32 | AIn3 | A3 | |
| Float32 | AIn4 | A4 | |
| Float32 | AIn5 | A5 | |
| Float32 | AIn6 | A6 | |
| Float32 | AIn7 | A7 | |
| Float32 | AIn8 | A8 | |
| Boolean | Status | sts | The result of the latest Expression evaluation. |
| DevBody attributes | |||
|---|---|---|---|
| String80 | Expression | expr | Logical expression in the C programming language. The expression is edited by means of the Attribute Editor and can not be changed in the target environment. |
| PlcNode | PlcNode | ||
| GraphPlcNode | |
|---|---|
| object_type | 133 |
| parameters[0] | 16 |
| parameters[1] | 0 |
| parameters[2] | 1 |
| parameters[3] | 0 |
| subwindows | 1 |
| graphmethod | 2 (standard, two textfield) |
| graphindex | 0 |
| default_mask[0] | 3 |
| default_mask[1] | 1 |
| segname_annotation | 3 |
| devbody_annotation | 1 |
| compmethod | 22 |
| compindex | 0 |
| tracemethod | 0 |
| traceindex | 0 |
| executeordermethod | 2 |
| objname | DArit |
| graphname | DArithm |
| debugpar | |
| DIn1 Input | ||
|---|---|---|
| Class | Input | |
| Type | Boolean | |
| Flags | NOINVERT | REDUTRANSFER | |
| GraphName | d1 | |
| Body | RtBody | |
Digital quantities included in the Expression
| DIn2 Input | ||
|---|---|---|
| Class | Input | |
| Type | Boolean | |
| Flags | NOINVERT | REDUTRANSFER | |
| GraphName | d2 | |
| Body | RtBody | |
| DIn3 Input | ||
|---|---|---|
| Class | Input | |
| Type | Boolean | |
| Flags | NOINVERT | REDUTRANSFER | |
| GraphName | d3 | |
| Body | RtBody | |
| DIn4 Input | ||
|---|---|---|
| Class | Input | |
| Type | Boolean | |
| Flags | NOINVERT | REDUTRANSFER | |
| GraphName | d4 | |
| Body | RtBody | |
| DIn5 Input | ||
|---|---|---|
| Class | Input | |
| Type | Boolean | |
| Flags | NOINVERT | REDUTRANSFER | |
| GraphName | d5 | |
| Body | RtBody | |
| DIn6 Input | ||
|---|---|---|
| Class | Input | |
| Type | Boolean | |
| Flags | NOINVERT | REDUTRANSFER | |
| GraphName | d6 | |
| Body | RtBody | |
| DIn7 Input | ||
|---|---|---|
| Class | Input | |
| Type | Boolean | |
| Flags | NOINVERT | REDUTRANSFER | |
| GraphName | d7 | |
| Body | RtBody | |
| DIn8 Input | ||
|---|---|---|
| Class | Input | |
| Type | Boolean | |
| Flags | NOINVERT | REDUTRANSFER | |
| GraphName | d8 | |
| Body | RtBody | |
| AIn1 Input | ||
|---|---|---|
| Class | Input | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | A1 | |
| Body | RtBody | |
Analog quantities included in the Expression attribute.
| AIn2 Input | ||
|---|---|---|
| Class | Input | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | A2 | |
| Body | RtBody | |
| AIn3 Input | ||
|---|---|---|
| Class | Input | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | A3 | |
| Body | RtBody | |
| AIn4 Input | ||
|---|---|---|
| Class | Input | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | A4 | |
| Body | RtBody | |
| AIn5 Input | ||
|---|---|---|
| Class | Input | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | A5 | |
| Body | RtBody | |
| AIn6 Input | ||
|---|---|---|
| Class | Input | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | A6 | |
| Body | RtBody | |
| AIn7 Input | ||
|---|---|---|
| Class | Input | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | A7 | |
| Body | RtBody | |
| AIn8 Input | ||
|---|---|---|
| Class | Input | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | A8 | |
| Body | RtBody | |
| Status Output | ||
|---|---|---|
| Class | Output | |
| Type | Boolean | |
| Flags | STATE | NOEDIT | REDUTRANSFER | |
| GraphName | sts | |
| Body | RtBody | |
The result of the latest Expression evaluation.
| Expression Intern | ||
|---|---|---|
| Class | Intern | |
| Type | String80 | |
| Flags | ||
| GraphName | expr | |
| Body | DevBody | |
Logical expression in the C programming language. The expression is edited by means of the Attribute Editor and can not be changed in the target environment.
| PlcNode Buffer | ||
|---|---|---|
| Class | Buffer | |
| Type | PlcNode | |
| Flags | INVISIBLE | |
| Body | DevBody | |