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.

OP5142EX1 Encoder In

Block

Mask

Description

The OP5142EX1 Encoder In block is used to retrieve Angle and Rate values from quadrature signals (A, B, and the index signal Z) connected to digital input lines of an OP525x carrier connected to an OP5142 card.

The angle value is transferred from the bitstream to the RT-LAB model through the DataOut port allocated to the OP5142EX1 Encoder In, via the PCIe bus of the target computer; the rate is processed by the OP5142EX1 Encoder In block through differentiation.

Each OP5142 bitstream using digital input channels comes with a configuration file; this file lists the Data port number and their corresponding OP525x location in the system. The configuration file name is the same as the bitstream file name entered in the OpCtrl OP5142EX1 block, with the extension .conf instead of .bin.

This configuration file uses three parameters to describe the selection of the OP525x channels:

  • the Slot number (in the range 1 to 4) is the slot of the backplane connected to the OP5142 in which the OP525x is installed,
  • the Section A or B is a subset of 32 lines of the OP525x carrier. For example, with the 32 In/32Out OP5251 carriers, section A refers to the 32 input lines and section B to the 32 output lines,
  • the Sub-Section, 1 to 4, is a subset of 8 data values connected to the port: subset 1 returns values for the 8 first channels of one section of the OP5251, subset 2 returns values for the 8 next channels, etc.

The user must refer to the configuration file for selecting the port number for the desired digital input channels. The OP5142EX1 Encoder In block then parses the configuration file and displays the Slot, Section and Sub-section values corresponding to the port number in the 'Slot info' parameter.

The DataOut ports connected to Quadrature Encoder input signals are identified by the acronym 'QEI' in the configuration file.

The maximum number of digital input channels controlled by one OP5142EX1 Encoder In is limited by the size of the subset of channels in one sub-section, which is fixed to 2 in the current implementation.

Parameters

Controller NameBind this block to an OpCtrl OP5142EX1 block by entering the same 'Controller Name' as specified in the OpCtrl OP5142EX1 block The OpCtrl OP5142EX1 block controls initialization of the settings of one specific OP5142 card in the system.
DataOut port numberSet the number of the DataOut port to be controlled by this block, in the range [1:32].
Slot infoThis non-editable parameter displays the physical location of the digital input channels related to the selected DataOut port, as obtained from the parsing of the configuration file.
Available channelsThis non-editable parameter specifies the maximum number of quadrature encoder input values returned by the DataOut port as defined in the RT-XSG bitstream. Each quadrature encoder input value comes from the decoding of a set of A, B and Z input signals.
Number of Encoder SignalsSet the number of quadrature encoder input values to be returned by the block. The value must be less than or equal to the value of the 'Available channels' parameter.
Auxiliary Output typeSelect the type of the second output. Raw stands for raw data received from FPGA and Angle for the current angle value.
Rate UnitSelect between Hz and RPM (Revolution per Minute).
Angle UnitWhen the 'Auxiliary output' parameter is set to 'Angle', this parameter is editable. Three units are available for angle: degree, radian, and revolution.
Sample time (s)This parameter allows the user to specify the block sample time in seconds. The default value is 0, which specifies a continuous sample time (note that the sample time is borrowed from the separated subsystem) while -1 specifies an inherited sample time. A functionality block and its associated controller block must execute at the same sample time.
ResolutionThis parameter stands for the number of cycles of the A and B signals per revolution. It is necessary to set this parameter to the right value to get a good estimation of rate.
Clockwise rotationhis parameter is used to decode the direction of rotation.
Minimal rateThis parameter is used to detect the null rate. Under this value, Rate is assumed to be null. This parameter uses the unit specified by 'Rate Unit'.

Inputs

This block has no inputs.

Outputs

The block has three (3) outports.

Rate: This outport returns the rate of the quadrature input signals decoded by the RT-XSG bitstream. The unit (Hz or RPM) is determined by the setting of the 'Rate unit' parameter.

Data: This outport is the 'Auxiliary Output' mentioned in the parameters list. It returns either the raw 16bit data which is the result of the decoding of the quadrature input signals in the RT-XSG bitstream, or the Angle values derived from these raw data. The Angle unit is determined by the setting of the 'Angle Unit' parameter.

Status: The Status output returns the following values:

Direction The Direction output returns 0 for null rate, +1 for positive rate and -1 for negative rate.

ValueDescription
0No error.
-1

Block could not be matched with an OpCtrl OP5142EX1 block (check the 'controller Name' value), or OP5142 card initialization problem.

-2Data reception timeout. This error can be caused by model synchronization errors,
-3

Data reception error: the block received fewer data from the OP5142 card than the value specified in the 'Data outport width' parameter. Missing data were replaced by 0.

-4

Data reception error: the block received more data from the OP5142 card than the value specified in the 'Data outport width' parameter. Extra data were discarded.

Characteristics and Limitations

Rate precision: The rate precision depends on the version of RT-XSG used to generate the bitstream. With a bitstream generated with a version before 2.2.0, the precision of the Rate values returned by the block is limited by the sampling rate of the model. This is due to the fact that the RT-XSG bitstream returns one Angle value per calculation step, and the Rate calculation is derived from the variation of the Angle value between consecutive steps.

Since RT-XSG 2.2.0, the speed is calculated as a number of events on signals A and B, between two consecutive timestamps. From with bitstreams generated with version of RT-XSG 2.2.0 or later versions, the rate precision is 10 nanoseconds.

The version of RT-XSG used to generate the bitstream is part of the bitstream name.

Direct FeedthroughNo
Discrete sample timeYes
XHP supportYes
Work offlineNo

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