Value Converters

Decimal device entities can have value converters attached, for example to convert a read analog voltage sensor value to the equivalent temperature.

A value converter is simply a procedure defined in a normal SeqZap scripts, but which is linked to the value converter model.

The value converter model is defined in the [SeqZap]\Framework\ValueConverterFramework.szs file which is shipped with SeqZap, the file is automatically referenced when a new project is created, but SeqZap will also suggest adding it when a Virtual Tool is added to a script file.

Value converters are identified by a name, but also contain a description and the units it converts from and to.

Value converts can convert both “from” and “to” a value, for instance both “from” a voltage sensor “to” a temperature and “from” a temperature “to” a voltage sensor – this is referred to a converting “in the opposite direction”.

Writing a value converter

  1. Create a procedure and give it an appropriate name and description.
  2. Link the procedure to the value converter model.
  3. The procedure will now have a series of parameters and custom properties defined.
  4. The FromUnit and ToUnit custom properties can be overridden and assigned to something useful, for instance for a value converter from voltage to celcius.
  5. The value converter can now be used, for example, on a Simple Decimal Data input entity.

The ValueConverterFramework.szs file contains a number of value converter procedures which can be used for inspiration.