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.

Event Detector


The Event Detector functionality of the OPAL-RT Board interface, also known as Time-Stamped Digital Input (TSD Input), is used to return information describing rising-edge and falling-edge transitions (or events) occurring on the digital input channels of an OP5353 module installed in the simulator.

Each transition is described by the ending state of the digital line (0 for a falling edge, and 1 for a rising edge), and the time, relative to the beginning of the calculation step, when the transition occurred.

The maximum number of events returned to the RT-LAB model for a subgroup of 8 channels is set to 250 in the current implementation.

Note: There can be more than one transition per event (meaning transitions on different channels occurred at the same time).

The number of expected transitions per calculation step for each channel is set with the use of the Number of events parameter.


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.

Bitstreams generated with an RT-XSG version 3.1.2 or later offer the selectable digital input-output feature (SDIO). The SDIO feature switches between the type of functionality (either static, PWM, or Event Detector) for a group of channels. The user will know if the bitstream offers the feature as soon as its configuration is loaded in the General section of the OPAL-RT Board configuration page.

Verifying that a bitstream is SDIO-capable is done in the channel group configuration section. If the feature is available then a drop-down list will be present. If it is not, the functionality will be displayed as a non-editable field (i.e. grayed out).

Channel Group Configuration


Checking this box enables the acquisition of data for the channels in the group once the simulation has started, provided that the type of functionality is set to Event Detector (see item below for more detail).

Clicking on Enable also adds the connection points for each of the 8 channels' Events and Timestamps in the Configuration panel of RT-LAB. This means that if the user wishes to monitor these two characteristics of the digital signals, connections must be made between points in the model (in the form of OpInput blocks) and the Event Detector input connectable points.

In order to achieve that, the connection points for each of the events and timestamps 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

In case the bitstream is SDIO-capable, this field takes the form of a drop-down list. This list provides the user with the choices for the type of functionality to be applied for the current group of8 digital input channels.

To receive event detection information, the option Event Detector must be chosen.

Otherwise, if the bitstream is not SDIO-capable, this field will be seen as non-editable. This means that the 8 channels in the current group can only operate with the functionality described in the grayed-out field. For receiving TSD inputs, please verify that the field displays Event Detector.

Time Unit

If 'Ratio' is selected, the information about the time when detected transitions occurred is a ratio of the transition time relative to the beginning of the calculation step.

If 'Second' is selected, the information received represents the delay from the beginning of the calculation step and the time of the occurrence of the transition, in seconds.

Signals Configuration

Number of Events

This parameter represents the number of expected transitions for each channel. It controls the amount of transition data transferred from the digital input modules to the RT-LAB model at each calculation step. This parameter is used to set the widths of the Events and Timestamps input connection point vectors.

The maximum number of transitions allowed per channel is 250. The maximum number of detectable events per subgroup of 8 channels is also 250.

The reason why this field allows up to 250 transitions when the maximum allowed per subgroup of 8 channels is also 250 is the following:

  • Transitions expected by different channels could be occurring as part of the same event (i.e. at the same time), effectively reducing the number of events reported.

As an example, let's say each one of the 8 channels of the subgroup is expecting 250 transitions. If these transitions happen at the same time (each channel's first transition occurring at the same time, then the second transition occurring at the same time, etc.) then the overall number of events detected would be 250. In this case, every event would contain transition information for all 8 channels in the subgroup.


The current functionality has one Event and one Timestamp vector for each channel, plus one global Status input.

The information about the transitions is returned in chronological order, i.e. the first value of each Events and Timestamps vector corresponds to the first transition that occurred on the digital input channel during the previous calculation step, the second value to the second transition, etc.

In case only 1 event is configured in the 'Number of events' parameter of a channel and no transitions are detected on that particular channel, then the channel enters 'static digital in' mode. This means that the data reported to the simulation is directly related to the physical value received by the simulator. In this scenario, the status code is set to -5 (a warning that the channel is in 'static digital in' mode) and the timestamp is set to 1 or Ts, depending on the display mode selected in the 'Time unit' parameter of the subgroup's configuration.

If, however, more than 1 event is actually received on that particular channel, only the first transition is reported and the status is set to -4 (more data received than expected).

The inputs can take the following values:


Possible ValuesDescription
1Rising edge transition detected; if only 1 event expected (as per 'Number of events' parameter), this value represents the digital input value
0Falling edge transition detected; if only 1 event expected (as per 'Number of events' parameter), this value represents the digital input value
-1No transition occurred


Possible Values (Ratio)Description
0 <= x < 1Ratio of the time of occurrence of the transition (Ttr) over the duration of the calculation step (Ts). Ttr is the time offset of the transition relative to the beginning of the calculation step where the transition occurred: Ttr = [0:Ts]; and x = Ttr / Ts
1No transition occurred
Possible Values (Second)Description
0 <= x < TsTime elapsed between the beginning of the calculation step and the occurrence of transition
TsNo transition occurred


0No error.

Data reception error: less data was received from the digital input module than the value expected according to the 'Number of events' parameter. Missing data were replaced by 0.


Data reception error: more data was received from the digital input module than the value expected according to the 'Number of events' parameter. Extra data were discarded.


Warning: at least one channel in the subgroup is in "static digital in" mode. This is due to having configured only 1 expected event in the 'Number of events' parameter.

Characteristics and Limitations

Processing time and amount of data transferred between the digital input module and the CPU increases with the number of events to decode.

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

The current version of the event detector functionality of the OPAL-RT Board driver has the following limitations:

  • Limitations will be added as they are found

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