Class Encoder block

The encoder changes an input field's representation to a Class representation.  

Return to Overview of blocks

Class Encoder block

Description

The Encoder block takes a state field (assume there are N states) and typically produces N + 1 outputs, one for each state as well as an unknown/error state (if configured.  Consider a system that can exist, at any one time, in one of 4 states; On, Off, Start-up, Shut-down. These states are exhaustive (there are no other possible states, except for an Error state) and mutually exclusive (at any one time the system can be in only one of these states, i.e. either On or Off or in Start-up mode or Shut-down mode).  What the block does is to make use of the value of an input tag to determine which of the states is true for the current execution.  The balance of the states are false for the current execution.  Thus the block provides a boolean indication of the system state.  

diagram showing the Class encoder block

Block Type

Data Transformation block

Input/Output ports

There may only be a single tag in the input port of any type.  The value of this tag will be used to determine the value of the configured output fields.

There will be an output field for every configured state, an error/unknown state may also be configured.  Thus if the input field can have a value of 0 (Off) or 1 (On) then the block will have 3 output fields; On, Off and Error (if configured).  If the input field has a value of 1; Off will be false (0), On will be true (1) and Error will be false (0).    

Functions performed on tags

  • On the values - The configured output fields can only have values of 0 (false) or 1 (true). If the value of the input tag indicates a particular configured state, the associated output field is set to 1 and all the other output fields are set to 0.  If no match is found, the output field for Unknown input values is made 1 and all the other output fields are set to 0. If there is no output defined for Unknown input values all the fields are set to 0.

  • On the timestamp - All the output fields have the execution time stamp

  • On the quality - The quality depends on the configuration and the quality of the input tag.  If the quality of the input tag is bad the quality of all the output tags is bad.  If the input value cannot be found in all the declared input values and the setting for Unknown input values is <none> then the outputs are bad.  Otherwise the outputs are good.

Example

Consider a plant that can be in only 1 of 3 possible states: Startup, Operational and Shutdown. A field, State, indicates the plant state as follows:

0 - Startup

1 - Operational

2 - Shutdown

Now assume that a boolean indication of the plant's state is required.  Thus the following fields are required:

  • A field called Startup that has a value of 1 when the plant is in a startup phase and 0 otherwise.

  • A field called Operational that has a value of 1 when the plant is in an operational phase and 0 otherwise.

  • A field called Shutdown that has a value of 1 when the plant is in a shutdown phase and 0 otherwise.

Furthermore, only 1 of these fields may have a value of 1 at any time. The others must be 0.

The encoder block takes the input field, State, and produces 3 outputs with the characteristics described above.

During configuration an output field, Unknown, may be defined for unknown input values. This output may also be hidden in the output port, so that other blocks downstream of this block will not be able to use the field.

A sample of the block's output for this example is shown below:

Return to top


Related topics:

  

CSense 2023- Last updated: June 24,2025