Skip to main content

Applying Formulas

This is also called a Formula.

Use it when you want to convert units, zero-adjust, or scale the raw value from the PLC instead of using it as-is.

Common cases:

  • A pressure sensor sends an 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 to Enter It​

Enter the formula in the [Formula] field of the tag registration/modification form. Immediately after registration, the converted value will appear on the screen in the next collection cycle.

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

Basic Usage​

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

What you want to doFormulaInput → Output
Use as-is(leave blank)100 → 100
Multiply by 10${VALUE}*105 → 50
Divide by 10 (integer → decimal)${VALUE}*0.11638 → 163.8
Divide by 1000 (mV → V)${VALUE}/10003300 → 3.3
Add (Celsius → Kelvin)${VALUE}+273.1525 → 298.15
Subtract (zero adjustment)${VALUE}-1001024 → 924
Fahrenheit conversion${VALUE}*1.8+3225 → 77.0
Square${VALUE}*${VALUE} or ${VALUE}^25 → 25
Square rootsqrt(${VALUE})144 → 12.0
RPM → Hz${VALUE}/601800 → 30.0

Referencing Other Tags' Values​

You can fetch the latest value of another tag using the ${태그ID} format. This is useful when you manage a zero-offset value in a separate tag or want to keep a calibration factor separate.

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

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

If the referenced tag does not exist yet

If you write ${TAG_ZERO} but that tag has never been collected, the calculation will fail (an error like "No formula variable value" will appear in that tag's status). It will automatically return to normal once the gateway runs one cycle, so please wait a moment.


Available Functions​

In addition to arithmetic, you can use frequently used mathematical functions.

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

To convert 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 used as-is.
  • If the corrected result exceeds the integer range, change the data type to Float or Double.

Common Mistakes​

Incorrect patternWhy it's a problemCorrect pattern
VALUE * 0.1Missing ${...} notation${VALUE}*0.1
${VALUE}*0,1Comma used (Korean keyboard mistake)${VALUE}*0.1 (use a period)
if(${VALUE}>0, ...)No conditional statementsUse a separate system if conditions are needed
${VALUE} & 0xFFNo bitwise operationsConvert to an arithmetic approach

Frequently Asked Questions​

Q. How do I verify that the formula is applied?​

The value shown in the tag's [Current Value] field is the converted value. To see the raw value, register a separate tag at the same address without a formula and compare them.

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

Create two tags pointing to the same PLC address: one without a formula, and the other with a conversion formula like ${VALUE}*1.8+32.

Q. The result comes out as NaN / Infinity​

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

The raw value range from the PLC is likely different 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 post-processing stage of the PlantPulse platform or a separate data processing tool (such as Node-RED). See the Node-RED section on the Application Management page.

For a complete function/variable reference, see the Advanced — Formula Reference page.