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 Out


The Encoder Out functionality of the OPAL-RT Board driver provides the simulation with the possibility of outputting encoder signals through the digital output channels of the OP5354 or OP5360-2 modules installed in the simulator.

A B and Z encoder signals are generated based on the angular rate provided during the simulation. The final form of these signals depends on the frequency unit chosen, the resolution of the turning wheels, which channel leads, and finally on the polarity chosen.

These parameters are customizable for a group of 8 channels, which means they apply to both encoders in the group. A detailed description for them is given in the Channel group configuration section below. Individual configuration of encoders is not available.

The frequency unit can be revolutions-per-minute (RPM) or Hertz (Hz). The rates can be positive or negative to represent forward or backward movement. Therefore, their limits are between -166 to 166 Hz or -10000 RPM to 10000 RPM. The rate of each encoder is to be transmitted to the simulation at every step through its Input connection point within the channel group.


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

Channel group configuration

    • Enable: Checking this box enables the generation of encoder data for the channels in the group once the simulation has started, provided that the type of functionality is set to Encoder Out (see item below for more detail). Clicking Enable also adds the connection points for each encoder's (up to 2 per group) angular rate (or speed) in the Configuration panel of RT-LAB. In order to output data, connections must be made between points in the model (in the form of OpOutput blocks) and the encoder output connectable points. Connections with LabView panels are also possible. To create a connection, the user drags and drops the connectable items onto an appropriate OpOutput block in the Configuration panel of the RT-LAB project.
    • Digital type: Given that the encoder functionality cannot be selected dynamically (i.e. it is not part of the SDIO functionality), this field is always grayed out. For the sending of angular rate values, verify that the field displays Encoder Out.

    • Number of encoder signals: The value entered in this field represents how many encoders of the group are to be controlled. There are at most two encoders per group, therefore the user has the option of controlling just one encoder or both. An encoder is composed of a set of A, B and Z signals. Frequency values will be transmitted from the model to the FPGA at each calculation step for each encoder. This value is then used to compute the state of the A, B and Z signals. These signals are output on the physical module's channels 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 always output '0'. They are not controlled by any kind of functionality (such as PWM, static or time-stamped digital). When only one encoder is used, the second encoder's outputs are disabled. Therefore, the fourth up to the last channels of the group outputs '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. Its maximum is 32767 cycles per revolution. However, the maximum resolution combined with high rates leads to precision loss. The highest resolution at which the maximum speed of 10000 RPM (166.67 Hz) or negative values are achievable is 25000 PPR.

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

    • Polarity: This parameter allows the user to choose the polarity of the A, B and Z signals of the encoder(s). Is it presented as a drop-down list and the two choices the list offers are Active high (default) and Active low. Active high or Active low mean that the active part of the duty cycle is either low (low voltage) or high (high voltage). A signal configured to be Active high outputs a high voltage value for the active part of its duty cycle, whereas an Active low signal outputs a low voltage value for the active part of its duty cycle.

Signals configuration

Channels in encoder output 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 outputs translate to the physical channels of the digital output module.

Characteristics and Limitations

For the connector pin assignments, the user should refer to the carrier documentation.
The current version of the encoder digital output functionality of the OPAL-RT Board driver has the following limitations:

  • Currently not available on the OP4510 platform's expansion card
  • The maximum tested resolution is 25000
  • The rates supported are between -166 Hz and 166 Hz or -10000 RPM and 10000 RPM
  • The bitstreams containing the encoder out 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