Skip to content

value-converter

Description

The value-converter block performs a linear conversion of a numeric value from one range to another. It has one input and one output. The input may be connected to multiple blocks.

The block accepts only numeric values. Non-numeric values and numeric values outside the configured input range are ignored.

The block supports both ascending and descending ranges. This means that configurations such as 0 -> 100 and 100 -> 0 are both valid.

Configuration parameters

Parameter name Value
input_range_begin Required parameter specifying the beginning of the input range. The allowed range is from -1500000.000 to 1500000.000. The fractional part must not have greater precision than the value specified by the precision parameter.
input_range_end Required parameter specifying the end of the input range. The allowed range is from -1500000.000 to 1500000.000. The fractional part must not have greater precision than the value specified by the precision parameter. The value must be different from input_range_begin.
output_range_begin Required parameter specifying the beginning of the output range. The allowed range is from -1500000.000 to 1500000.000. The fractional part must not have greater precision than the value specified by the precision parameter.
output_range_end Required parameter specifying the end of the output range. The allowed range is from -1500000.000 to 1500000.000. The fractional part must not have greater precision than the value specified by the precision parameter. The value must be different from output_range_begin.
precision Required parameter specifying the number of decimal places at the output. Allowed values are 0, 1, 2, 3. The same precision also limits the maximum allowed number of digits after the decimal point in the range parameters.

Input handling

The block reacts only to numeric values that are inside the input range.

Operating rules:

  • For the input_range_begin value, the output is exactly output_range_begin.
  • For the input_range_end value, the output is exactly output_range_end.
  • For all other values from the input range, a linear rescaling to the output range is performed.
  • The result is rounded to the number of decimal places specified by precision.
  • Half values are rounded away from zero, so for example 1.235 becomes 1.24, and -1.235 becomes -1.24.

The block does not require the use of inputs labeled using the tag block.

Block outputs

Output number and name Output description
1. Rescaled value. Returns the numeric value calculated based on the current input and output ranges. The result type is automatically set to either an integer or a floating-point number depending on the final value after rounding.

Block status description

After each successful conversion, the description field takes the form <left> -> <right>, where:

  • left is the input value without a unit,
  • right is the converted output value, also without a unit.

If the textual representation of either side cannot be obtained, unknown appears in its place.

Errors returned by the block

The block can return the following errors:

Error code Error description
Invalid precision configuration. The precision parameter was not provided or has a value other than 0, 1, 2, or 3.
Invalid input_range_begin configuration. The input_range_begin parameter is invalid, has a value outside the allowed range, or has too much precision relative to precision.
Invalid input_range_end configuration. The input_range_end parameter is invalid, has a value outside the allowed range, or has too much precision relative to precision.
Invalid output_range_begin configuration. The output_range_begin parameter is invalid, has a value outside the allowed range, or has too much precision relative to precision.
Invalid output_range_end configuration. The output_range_end parameter is invalid, has a value outside the allowed range, or has too much precision relative to precision.
Invalid input range configuration. The beginning and the end of the input range have the same value.
Invalid output range configuration. The beginning and the end of the output range have the same value.
Input disconnected. No other block is connected to the block input.