Variable transformation, configuration of analogue inputs

Each HW data point has value transformation properties. They are used to recalculate the raw value read over the I/O bus to a value which represents the corresponding physical value or written from variable to I/O.

If a transform has to be applied on the client side, for example a value of 1236 to 12.36, the raw value must be divided by 100. The coeficient K of a linear transformation is then 0,01. If this value is read, it is simple and logical. This logic needs to be applied for the writing process as well. If you have value of 12.36 in a program and you want to transform it to 1236 on a communication bus, the value must be divided by 100, and the coeficient is again 0,01. There is no difference between reading and writing here.

For example, a temperature measured by a passive Pt1000 sensor is communicated from the I/O module RCIO as resistance, multiplied by 10 to obtain higher resolution when communicated as INTEGER: for a Pt1000 sensor at 22 °C the communicated value on the I/O bus is 10857, which represents the sensor resistance of 1085.7 Ohm. This value is linearised in the Pt1000 specific linearisation table „resistancetotemperature“, and the output is temperature in °C.

These are the predefined transforms:

    Identity - the value is not transformed, it is written as is

    Resistance to temperature - linearisation curve for Pt100, Pt500, Pt1000, Ni1000-5000, Ni1000-6180 sensors. The       transform has following parameters:
      Kind - sensor type which determines the predefined linearisation curve
      Pre_K - first linear pre-linearisation transform y = Kx + Q coefficient
      Pre_Q - first linear pre-linearisation transform y = Kx + Q coefficient (used for sensor cable resistance compensation)
      Post_K - second linear post-linearisation transform y = Kx + Q coefficient
      Post_Q - second linear post-linearisation transform y = Kx + Q coefficient (used for compensation of absolute sensor measuring error in °C)

    Threshold - detector for transform of an analogue value into binary value (if an AI is used as a DI). The transform has following parameters:
      Threshold - a limit to switch from True to False and back
      Invert - inverts the function: if Invert = True, the transform output is False if the input value is higher than the Threshold.

    Window - if the input value is between predefined limits, the output is True, otherwise False. Example: damaged sensor detection - if the measured value is lower than -40 °C or higher than 150 °C, the sensor is damaged and the output value is True (using the Invert function)
      Low - lower limit
      High - higher limit
      Invert - inverts the function: if Invert = True then if the value is within limits, the output is False, otherwise it is True.

    LinearByTable- linearisaton curve with max. 8 points. The curve is defined using pairs of values - coordinates of the points in X and Y vectors.
      XValues - vector with X coordinates of the linearisation curve points
      YValues - vector with Y coordinates of the linearisation curve points
      Active points - number of points used, max. 8, taken from the left of the vector
      Pre_K - first linear pre-linearisation transform y = Kx + Q coefficient
      Pre_Q - first linear pre-linearisation transform y = Kx + Q coefficient
      Post_K - second linear post-linearisation transform y = Kx + Q coefficient
      Post_Q - second linear post-linearisation transform y = Kx + Q coefficient

    Negate - for bool type values, negates the input value

    LinearByTwoPoints - a simple linear transform defined by two points
      X1 - X coordinate of the first point
      Y1 - Y coordinate of the first point
      X2 - X coordinate of the second point
      Y2 - Y coordinate of the second point

    Linear - a simple linear transform defined by y = Kx + Q
      K - multiplication coefficient
      Q - addition coefficient

A transform is defined „from the physical inputs to the program (structured text)“, IO→ST - if there is a global variable mapped on a HW variable for writing (hardware analogue output), and a value multiplied by 100 shall be written, e.g. a HVAC integer, a constant of k=0,01 must be entered in the linear transform. This rule is used in other transformations as well. Transformations “LinearByTable” and “LinearByTwoPoints” have parameters X and Y. X stands for values, that are written to output. Y values are values visible in our project.

Configuration of AI - analog input for Pt1000 sensor using on Domat I/O module

If a resistance temperature sensor is connected to a physical analogue input of a module, we need to be sure that the correct physical value is measured, and that the correct type of transformation is used.

At first, the correct physical value must be chosen on the AI. This can be done by changing “Analog Type - MMIO/MCIO2” property in AI properties. We have three options how to measure temperature with Pt1000 sensor. The first one is to use “Temperature Pt1000 -50..150°C” option. In this case, the linearization would be done in I/O module. However, a recommended solution is to use “Resistance 0..1600Ohm” or “Resistance 0..5000Ohm” option. In this case, the linearization will be done in PLC, on the runtime level.


Uploading of a program to a PLC]]. PLC must be then started in Commissioning mode. In this mode, the IDE is able to communicate directly with I/O modules and change their settings. Settings of Domat modules can be changed by clicking on "Domat - Configure module" option in the context menu of an I/O module.\\ \\ {{:en:mervis-ide:35-help:ai_2.png

This change will be shown immediately and I/O module does not need to be restarted manually.
The transformation is uploaded with the solution in the process of deployment. If we switch the PLC run mode to “Full run” or “Only communication” mode, all AIs should show correct measured temperature immediately. Remember to restart the PLC as Cold restart.

If a transform is used on a data point, such as Lib.Core.v1_0.ResistanceToTemperature, new variables with namespace “hw_hidden” are visible in the Variable Browser after compilation. These variables are not available until the project has been compiled.

Unwrap a “HW hidden” variable to display the parameters of  the transformation in “Channel name”.“Device Name”.“Data Point”.“transformation” (e.g. channel.MCIO2.AI1.transformation). Start debug to watch the real values in the “PLC Value” column, while in the “Initial Value” the preset value in the controller is displayed.


1) Change of analog type

If analog type is changed on a data point, reconfigure the Domat modules accordingly by right click on the device - Domat module configuration. The modules must be online. It is not necessary to deploy the solution to apply the configuration in the module(s).


Successfull module reconfiguration is indicated by a dialog.

2) Change of data point transformation

A mere change of data point trasformation parameters does not require reconfiguration of the I/O module. To apply changes, just upload the solution to a PLC, and run PLC with warm restart. The change of parameters can be verified in Debug mode, in Variable Browser at the datapoint with hw_hidden namespace. 

a) Change the transform e.g. from ResistanceToTemperature to another transform, e.g. Linear, upload the solution, and run the PLC with warm restart. Then, change the transform to its original value (from Linear to  ResistanceToTemperature) and configure the temperature sensor type and parameters. After solution upload and warm restart, the new parameters are applied. This way does not require cold restart.
b) In case the project is allowed to be rerun with cold restart, change the parameter, upload the solution, and run the PLC with cold restart. 

Hints and tips when configuring the data points
1. To configure a data point, it is not necessary to rerun the project with cold restart.
2. Reconfiguration of a data point is only required if an analog type has been changed..
3. After changing a transform, only solution upload and warm restart are necessary.
4. In case the project must not be rerun with cold restart (technological reasons) and a parameter change is necessary, proceed according to a) above.