Siemens SCL Arithmetic expressions, operators and operation with Examples

Published on Jun11, 2025 | Category: tia
Share this article:

Arithmetic expressions in Siemens Structured Control Language (SCL) are used to perform calculations by either representing a single numeric value or by combining two values or expressions using arithmetic operators. These operators can handle various data types supported by the specific CPU being used in the PLC system.
When an operation involves two operands, the resulting data type is determined according to the CPU’s rules and the types of the operands. It's important to use compatible data types (such as INT, DINT, or REAL) to ensure accurate calculation and avoid data conversion issues.
SCL offers robust arithmetic capabilities for implementing essential operations such as addition, subtraction, multiplication, division, and power calculations. These functions are widely used in industrial automation scenarios including analog input processing, flow and level calculations, and real-time data monitoring.
This article provides a set of practical and easy-to-follow examples to help you implement arithmetic expressions effectively in your SCL programs using the Siemens TIA Portal.

scl arithmatic operator

In Siemens SCL (Structured Control Language), an operator is a symbol such as +, -, or * that instructs the program to perform a specific mathematical operation between two or more variables or constant values. These operators help simplify complex mathematical calculations, making programming easier and more efficient.


In Siemens SCL, arithmetic operators are used to perform mathematical operations on variables or constant values. These operators help simplify complex calculations in automation logic.

SCL Arithmetic Expressions

An arithmetic expression in Siemens SCL (Structured Control Language) is a combination of variables, constants, and operators used to perform mathematical calculations. These expressions help process values in automation programs, such as calculating totals, averages, or performing conversions.


For example, to calculate the average of four values, you can write an expression that adds all the values together and then divides by 4.


Siemens SCL Power Expression ( ** )

In Siemens SCL (Structured Control Language), the power operator ( ** ) is used to raise a number to the power of another number. It is similar to the mathematical exponentiation operation.

The power operator works with both integer and floating-point numbers, and the result is typically a floating-point value. This is useful in calculations involving areas, volumes, scaling, and more in industrial automation.

Example 1: Raising a value to a power

In this example, a value is raised to the fourth power:

"power_1" := "value3" ** 4;
This means the value stored in value3 is multiplied by itself 4 times.

Example 2: Volume Calculation Using Power

This formula calculates the volume of a cylindrical tank:

volume := 3.1416 * "radius" ** 2 * "height" * 1000;
In this case, #radius ** 2 squares the radius (i.e., radius × radius), which is a common operation in geometric formulas. The result is then multiplied by the height and other constants to get the total volume in liters.

The power operator is an essential part of SCL arithmetic, especially when working with scientific or engineering formulas.

img/scl-arithmetic-expressions/siemens-scl-power-expression.webp

Siemens SCL Addition Expression

In Siemens SCL (Structured Control Language), the + operator is used to perform addition operations. It can be used to add constants, variables, tag values, time durations, and other data types. The addition expression is essential for performing calculations involving numerical values or time-based parameters in automation programming.

Below are some common examples of how the addition operator is used in SCL:

img/scl-arithmetic-expressions/siemens-scl-addition-expression.webp

Siemens SCL Subtraction Expression

In Siemens Structured Control Language (SCL), the - operator is used to perform subtraction. It subtracts one value from another and supports different data types such as integers, real numbers, and time values. This operation is useful in automation programming for calculating differences, time delays, and adjustments.

Here are simple examples of subtraction operations in SCL:

img/scl-arithmetic-expressions/siemens-scl-subtraction-expression.webp

Siemens SCL Division Expression

In Siemens Structured Control Language (SCL), the / operator is used to perform division between two values. The operands can be integers, real numbers, or other numeric data types. However, it is important to note that you cannot divide a time value by another time value. A time value can only be divided by an integer or real number to get a reduced time duration.

Below are examples demonstrating the use of the division operator:

img/scl-arithmetic-expressions/siemens-scl-division-expression.webp

Siemens SCL Multiplication Expression

In Siemens Structured Control Language (SCL), the * operator is used to perform multiplication between two or more values. It supports integer, real, and time data types where applicable. This operator is commonly used in calculations such as volume, scaling analog values, or adjusting time durations.

Below are examples of multiplication operations in SCL:

img/scl-arithmetic-expressions/siemens-scl-multiplication-expression.webp

Modulo Function (MOD) in Siemens SCL

The MOD operator in Siemens Structured Control Language (SCL) is used to calculate the remainder of a division between two integer values. It returns an integer result.

Function Syntax:

Result := A MOD B
Where A and B are integer values, and the result is the remainder when A is divided by B.

Example:

Suppose you want to find the remainder when a value is divided by 5:

This is helpful when determining even/odd numbers, cycling counters, or applying conditions based on step groups.

img/scl-arithmetic-expressions/modulo-function-in-siemens-scl-programming.webp

Result Data Type Rules for Arithmetic Operations in Siemens SCL

In Siemens Structured Control Language (SCL), arithmetic operations between operands of different data types follow specific rules based on CPU-supported types. These rules determine the resulting data type of an operation.

General Rules for Result Data Type:

IEC Check Limitation:

Some arithmetic operations with mixed or complex data types can only be performed if the IEC type check is not enabled. When IEC check is active, data type restrictions are stricter, especially for time and date types.