Formula options
Formulas allow mathematical pre-processing on all numeric, analog, and hex inputs, and post-processing on numeric and hex outputs on Modbus type I/O modules.
The tables below describe the options that are available to create a formula.
Formula reference
Formulas are developed using a stack calculator. The calculator mechanism uses postfix notation, a mathematical notation in which every operator follows all of its operands.
For example, to find the sum of 2 plus 2:
Infix Notation: 2 [+] 2 result 4
Postfix Notation: 2 [Ent] 2 [+] result 4
Controller Formula Screen: [constant value=] 2 [Ent] [constant value=] 2 [Add] result 4
Unless otherwise directed, the result of a formula calculation will be placed on the input or output pin invoking the formula.
Constants formulas
| Formula | Description |
|---|---|
| Current Pin | Allows the use of the current value of the input invoking the formula. |
| Input Pin |
Allows the use of the current value of an input pin other than the one invoking the formula. You are required enter the number of the input pin or, if a list box is available, to select the name of a configured and enabled input pin on In-line Parameters
Using the Reference Device field This field is used only if the following conditions are met:
If you selected a device from the Reference Device field, the parameter field is a list box with options are limited to the input pins configured for the selected reference device. You can select an appropriate input pin that works for your formula. If you didn't select a device from the Reference Device field, you must manually enter the an input pin number. |
| Output Pin |
Allows the use of the current value of the output pin invoking the formula. You are required enter the number of the output pin or, if a list box is available, to select the name of a configured and enabled output pin on In-line Parameters
Using the Reference Device field This field is used only if the following conditions are met:
If you selected a device from the Reference Device field, the parameter field is a list box with options are limited to the output pins configured for the selected reference device. You can select an appropriate output pin that works for your formula. If you didn't select a device from the Reference Device field, you must manually enter the an output pin number. |
| Constant Value |
Allows a user defined numeric value to be used in the formula. You are required to enter a numeric value. In-line Parameters
When a constant value has more than 9 decimal value precision, the full value is stored, but only a maximum of 9 places will be displayed back on return. After a constant value is defined within a formula, it is not updated unless the Update option is checked before clicking Save. |
| PI |
The constant pi. |
| Constant Hex Value |
Allows a user defined hex value to be used in the formula. You are required to enter the hex value. In-line Parameters
|
| Correction |
Allows the use of the correction value that is defined for the input or output pin invoking the formula. |
| Min Range | Allows the use of the minimum range value of the analog input invoking the formula. |
| Max Range |
Allows the use of the maximum range value of the analog input pin invoking the formula. |
| Min Units |
Allows the use of the minumum units value of the input or output pin invoking the formula. |
| Max Units |
Allows the use of the maximum units value of the input or output pin invoking the formula. |
Device Schedule Values
| Formula | Description |
|---|---|
| Read Interval | Sets the interval between readings. The value can be set in minutes or hours. Readings are saved on the device until the report interval is reached.. |
| Report Interval | Determines the amount of readings taken until the device reports the readings to Digi Axess. This number must be set so the device will report at least once per day. |
Calculated Values formulas
| Formula | Description |
|---|---|
| [Max-Min] Range |
Allows the use of the value of the difference between the Max Range and Min Range of the analog input pin invoking the formula. |
| [Max-Min] Units |
Allows the use of the value of the difference between the Max Units and Min Units of the input or output pin invoking the formula. |
| Fn Trim Below |
Returns the Trim Below Value when the sample is below that value. You are required to enter a numeric value. In-line Parameters
|
| Fn Trim Over |
Return the Trim Above Value when the sample is above that value. You are required to enter a numeric value. In-line Parameters
|
Hex Functions
| Formula | Description |
|---|---|
| Fn Swap Words |
Performs a 16 bit swap on 32-bit MODBUS register reads when necessary. Example: ABCD1234 becomes 1234ABCD. [Current Input] [Ent] [Fn Swap Words] |
| Fn Swap Bytes |
Performs 8 bit swap on 16 or 32-bit MODBUS register reads when necessary. Example: ABCD1234 becomes CDAB3412. [Current Input] [Ent] [Fn Swap Bytes] |
| Fn Reg16 to Signed |
Performs the conversion of a 16 bit hex value to a signed integer value. The value to be converted is taken from the last value in the calculator’s stack. Example: Assume the invoking pin is an input of a MODBUS module configured as hex and the source is a 16-bit Holding register. Use the register value as a signed integer. [Current Input] [Ent] [Fn Reg16 to Signed] |
| Fn Reg32 to Signed |
Performs the conversion of a 32 bit hex value to a signed integer value. The value to be converted is taken from the last value in the calculator’s stack. Example: Assume the invoking pin is the input of a MODBUS module configured as hex and the source is a 32-bit Holding register. Use the register value as a signed integer. [Current Input] [Ent] [Fn Reg32 to Signed] |
| Fn Reg32 to Float |
Performs the conversion of a 32 bit hex value to a float value. The value to be converted is taken from the last value in the calculator’s stack. Example 1: Assume the invoking pin is an input of a MODBUS module configured as hex and the source is a 32-bit Holding register. Use the register value as a float. [Current Input] [Ent] [Fn Reg32 to Float] |
Trigonometric Functions
| Formula | Description |
|---|---|
| Radians to Degrees | Performs the conversion of a numeric value in radians to degrees. |
| Degrees to Radians | Performs the conversion of a numeric value in degrees to radians. |
| Sin - Radians | Performs sin function on numeric value in radians. |
| Cos - Radians | Performs cosine function on numeric value in radians. |
| Tan - Radians | Performs tangent function on numeric value in radians. |
| Asin - Radians | Performs arc sin function on numeric value and returns radians |
| Acos - Radians | Performs arc cosine function on numeric value and returns radians |
| Atan - Radians | Performs arc tangent function on numeric value and returns radians. |
Mathematical Functions
| Formula | Description |
|---|---|
| Square Root | Performs square root function on numeric value. |
PDF
