Skip to content

Units for Function-Block Developers

To provide information to the user in which unit the input should be, Function-Block Developers can use the unit field. The unit field is only only used for primitive paramters as those are the only paramters containing values directly. When setting the unit field on any other parameter the set unit will not be displayed to the user.

How to add a unit to a parameter

Units can be added in the JSON-Editor. Add a new field unit to the paramter and assign the desired unit.

    "availableOptions": [],
    "paramId": "b78a25e9-e276-528e-158f-ee3fbe87b591",
    "displayTitle": "Distance",
    "title": "distance",
    "description": "Set the distance between point a and b",
    "value": null,
    "type": "primitve",
    "parameters": [],
    "dataType": "float",
    "reference": null,
    "constraints": [],
    "unit": "m"

Unit conversion

Supported units

Base Units
Length m, mm, inch
Angle deg, rad


For units listed in the supported unit table it is possible to display and enter values in a different unit of the same base if the user wants to. Given the example above the user could change to mm when entering the value. The value will still be saved in the unit defined in the parameter (in this case m).

During Execution

For units listed in the supported unit table the executor can perform unit conversion during runtime if the other unit is of the same base. E.g. an output with the unit 'mm' is linked to an input with the unit 'm'. During runtime the output will be converted and passed to the input parameter in 'm'.

Input parameters with units

Adding a unit field to an input parameter can ensure the user is inputing the value in the correct unit. The unit depends on which values are expected in the script of the function block.

Output parameters with units

Units in output parameters can be defined during function block creation or in the script during function block execution. For blocks with a consistent output, it is advisable to set the unit in the JSON during function block development. This way the user can see the information when bulding a program. If this is not possible because the unit is not known until runtime you can also set the unit during program execution. This way you can still benefit from the executor unit conversion.

output_parameters[0]['unit'] = 'm'