Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

Encoder In


The Encoder In functionality of the OPAL-RT Board driver provides the simulation with the encoder signal acquisition data obtained from the digital input channels of the OP5353 modules installed in the simulator.

The driver provides the simulation with each encoder's angular rate, the position of the wheel within the rotation, the direction of movement, and the functionality status after doing the quick processing of the A, B, and Z signals received by the physical modules.

The angular rate can be measured in Hertz (Hz) or revolutions-per-minute (RPM) while the position of the wheel can be seen as a raw value or as an angle.

The rates can be positive or negative to represent forward or backward movement. Therefore, their limits are between -166 to 166 Hz or -10000 RPMto 10000 RPM.

The direction of movement is '1' for forward movement, '-1' for backward movement, and '0' when the rate is 0.

The status values can be '-5' when there is a calculation error and the timestamp difference is negative or '0' when the functionality is working correctly.

All the values above are retrieved from the simulation at every step through each encoder's Rate, Position of the wheel, Direction, and Status connection points within the channel group.

When there is no physical input, the values reported in the model or in LabView panels are 0 for every input.


Once the bitstream configuration file has been parsed, the location of the digital input modules becomes visible to the user. The channels of the modules are grouped into bunches of 8. By clicking on each group of 8, the user has access to the configurable options of the group.

Channel Group Configuration


Checking this box will enable the acquisition of encoder data for the current group once the simulation has started, provided that the type of functionality is set to Encoder In (see item below for more detail).

Clicking on Enable also adds the connection points for each encoder's angular rate, the position of the wheel, direction, and the functionality's status in the Configuration panel of RT-LAB. This means that if the user wishes to monitor these values, connections must be made between points in the model (in the form of OpInput blocks) and the encoder input connectable points.

In order to achieve that, the connection points for each value have to be drag-and-dropped onto an appropriate OpInput block in the Configuration panel of the RT-LAB project.

Connections with LabView panels are also possible.

Digital Type

Given that the encoder functionality cannot be selected dynamically (i.e. it is not part of the SDIO functionality), this field will always be grayed-out. For receiving encoder input specific values, please verify that the field displays Encoder In.

Number of Encoder Signals

The value entered in this field represents how many encoders of the group are to be monitored. There are at most two encoders per group, therefore the user has the option of choosing to monitor just one encoder or both. An encoder is composed of a set of A, B and Z signals. These signals are used to compute the angular rate, position of wheel and direction of the encoder.

The state of these signals is retrieved from the physical modules as such:

Index in groupUsage
first channel of the groupchannel A of the first encoder
second channel of the groupchannel B of the first encoder
third channel of the groupchannel Z of the first encoder
fourth channel of the groupchannel A of the second encoder
fifth channel of the groupchannel B of the second encoder
sixth channel of the groupchannel Z of the second encoder
seventh channel of the groupnot used
eighth channel of the groupnot used

Regardless of how many encoders are used, the last two channels of the group will always input '0'. They are not attached to any kind of functionality (such as PWM, static or time-stamped digital).

When only one encoder is used, the second encoder's inputs are disabled. Therefore, the fourth up to the last channels of the group will input '0'.

Frequency Unit

The unit in which the angular rate provided in the model is to be interpreted. The user has the choice between revolutions-per-minute (RPM) or Hertz (Hz).

Resolution (# of Cycles per Revolution)

The resolution is also known as pulses-per-revolution (PPR) or count per revolution (CPR).

The value entered in this field represents the number of cycles of the A and B signals per revolution. The highest detectable resolution is 65535 PPR. This value is higher than the maximum resolution of the Encoder Out due to how the functionalities are implemented in the FPGA. It is necessary to set this parameter to the right value to get a good estimation of the rate.

Clockwise Rotation

This parameter determines whether the encoder signals are produced with signal A leading signal B (causing a clockwise rotation), or the reverse.

Auxiliary Output Type

The auxiliary output represents the position of the encoder wheel. This parameter sets the way this output is to be shown: either raw data or as an angle displacement. Selecting Angle will cause the Angle unit field to appear below.

Angle Unit

This field is only visible if the Auxiliary output type is set to Angle. The options are Degree, Radian or Revolution.

Minimal Rate

The minimal rate defines the lowest rate detectable by the current Encoder In. The lowest possible value is ±0.1 RPM (~±0.0017 Hz). Under this value, the rate is assumed to be zero. This parameter uses the unit specified in the Frequency unit field.

Signals Configuration

Channels in encoder input groups do not have any parameters to configure. Please refer to the table above (in the Number of encoder signals section) to see how the encoder inputs translate to the physical channels of the digital input module.

Characteristics and Limitations

For the connector pin assignments, the user should refer to the carrier documentation.

The current version of the encoder input functionality of the OPAL-RT Board driver has the following limitations:

  • Currently not available on the OP4510 platform's expansion card
  • The maximum detectable resolution is 65535
  • The minimum detectable rate value is ±0.1 RPM or ~±0.0017 Hz
  • The rates supported are between -166 Hz and 166 Hz or -10000 RPM and 10000 RPM
  • The bitstreams containing the encoder in functionality have to be compiled at 100 MHz

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | | +1 514-935-2323