Skip to main content

Applying Formulas

These are also referred to by the English term Formula.

Use this when you do not want to use the raw value sent by the PLC as-is, but instead need unit conversion / zero-point correction / scale adjustment.

Common cases:

  • A pressure sensor sends the integer 1638 but the actual value is 163.8 kPa${VALUE}*0.1
  • Celsius → Fahrenheit conversion → ${VALUE}*1.8+32
  • mV → V conversion → ${VALUE}/1000

Where do I enter it

Write the expression in the [Formula] field of the tag registration / edit form. Once registered, the converted value appears on screen at the next collection cycle.

  • If left empty, the raw value is used as-is.
  • Once entered, it is applied automatically on every subsequent collection.

Basic usage

${VALUE} refers to the raw value just read from the PLC.

What you want to doFormulaInput → Output
Use as-is(empty)100100
Multiply by 10${VALUE}*10550
Divide by 10 (integer→decimal)${VALUE}*0.11638163.8
Divide by 1000 (mV → V)${VALUE}/100033003.3
Addition (Celsius → Kelvin)${VALUE}+273.1525298.15
Subtraction (zero-point correction)${VALUE}-1001024924
Fahrenheit conversion${VALUE}*1.8+322577.0
Square${VALUE}*${VALUE} or ${VALUE}^2525
Square rootsqrt(${VALUE})14412.0
RPM → Hz${VALUE}/60180030.0

Referencing values from other tags

You can pull the last value of another tag using the ${태그ID} form. This is handy for patterns where the zero-point value is managed as a separate tag, or where correction coefficients are kept separately.

What you want to doFormula
Subtract another tag as the zero point${VALUE}-${TAG_ZERO}
Sum two tags${VALUE}+${TAG_OFFSET}
Correction (gain × x + offset)${VALUE}*${TAG_GAIN}+${TAG_OFFSET}

Here, TAG_ZERO, TAG_OFFSET, and TAG_GAIN are the tag IDs of other tags. They must already be registered as tags.

If the referenced tag does not exist yet

If you enter ${TAG_ZERO} but that tag has never been collected, the calculation fails (an error such as "formula variable value missing" appears in that tag's status). It resolves automatically once the gateway completes one cycle, so just wait a moment.


Available functions

In addition to arithmetic, you can use commonly needed mathematical functions.

TypeNotationExample
Arithmetic operators+, -, *, /${VALUE}+1
Exponentiation^${VALUE}^2 (= square)
Parentheses(, )(${VALUE}+10)*2
Square rootsqrt(...)sqrt(${VALUE})
Cube rootcbrt(...)cbrt(${VALUE})
Natural logarithmln(...)ln(${VALUE})
Common logarithm (base 10)log(...)log(${VALUE})
Sine/cosine/tangent (radians)sin, cos, tansin(${VALUE})
Inverse trigonometricasin, acos, atanatan(${VALUE})
Hyperbolicsinh, cosh, tanhtanh(${VALUE})
Constantspi, e${VALUE}*pi/180 (degrees → radians)

To convert a degree input to radians, multiply by *pi/180. Example: sin(${VALUE}*pi/180).


Applicable data types

Formulas apply only to numeric (Float, Double, Integer, Long) tags.

  • For String and Boolean tags, the formula is ignored and the raw value is output as-is.
  • If the corrected result exceeds the integer range, change the data type to Float or Double.

Easy mistakes to make

Wrong patternWhy it is a problemCorrect pattern
VALUE * 0.1Missing ${...} notation${VALUE}*0.1
${VALUE}*0,1Comma used (Korean keyboard slip)${VALUE}*0.1 (use a period)
if(${VALUE}>0, ...)Conditionals not supportedIf a condition is needed, handle it in a separate system
${VALUE} & 0xFFBitwise operations not supportedRewrite in a form achievable with arithmetic

Frequently asked questions

Q. How do I verify that the formula was applied?

The value shown in the tag's [Current Value] field is the converted value. If you want to see the raw value, register the same address as a separate tag without a formula and compare.

Q. I want to send two unit conversions at once (e.g., Celsius and Fahrenheit)

Create two tags pointing to the same PLC address — leave one as-is and enter a conversion expression such as ${VALUE}*1.8+32 in the other.

Q. The result comes out as NaN / Infinity

  • Division by zero → Infinity
  • Square root of a negative number → NaN

The PLC's raw value range most likely differs from what you expected. Check the raw value first without a formula.

Q. I need more complex processing (conditional branching / multiple variables / external data)

This is difficult with formulas alone. We recommend using the PlantPulse Platform post-processing stage or a separate data processing tool (such as Node-RED) alongside it. See the Node-RED entry on the Application Management page.

If you need the full function / variable reference, see the Advanced — Formula Reference page.