> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/rt-lab-i-o-library/event-generator.md).

# Event Generator

## Description

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-478fb226f4da7331dc10c761c532eaeede478c28%2FRTLIO_event_generator_block.png?alt=media" alt="" width="329"><figcaption></figcaption></figure>

The **Event Generator** block, located in the **RT-LAB I/O/Opal-RT/Common** library, transmits up to 250 precisely timed PWM events per time step per channel to a Digital Output module installed in the simulator or expansion unit. The module outputs **0 V** for a logical low and **V**<sub>**user**</sub> volts for a logical high.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-fc675f38c9f4a536ebeb4d37aa67bdc436bbd95f%2Feventgenerator.png?alt=media" alt="" width="522"><figcaption></figcaption></figure>

## Mask parameters

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-134934b8ee45d03f97f90cd1c8796c68452d95be%2Faa0a6d16-e3b4-4387-aee5-9f299bf9f87c.jpg?alt=media" alt="" width="320"><figcaption></figcaption></figure>

<table><thead><tr><th width="194.333251953125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Controller Name</strong></td><td>Specifies the <strong>OpCtrl</strong> block this block is bound to. Enter the same <strong>Controller Name</strong> as defined in the corresponding <strong>OpCtrl</strong> block.</td></tr><tr><td><strong>DataIn port number</strong></td><td>Specifies the Digital Output module and subsection to which this block transmits signals. Subsection 1 corresponds to channels 0–7, subsection 2 corresponds to channels 8–15, and so on.<br>Configure the <strong>DataIn port number</strong> according to your <strong>System Description Document</strong> or <code>.conf</code> file.</td></tr><tr><td><strong>Slot infos</strong></td><td>Read‑only field displaying the expected physical location (Slot, Section, Subsection) of the Digital Output module derived from the selected <strong>DataIn port number</strong>. If the port number is invalid, <em>Slot 0 Module X Subsection 0</em> is displayed.</td></tr><tr><td><strong>Maximum number of channels controlled by this block</strong></td><td>Read‑only field displaying the maximum number of channels available in the selected subsection.</td></tr><tr><td><strong>Number of channels</strong></td><td>Specifies the size of the block input vector, corresponding to the number of channels to transmit at each calculation step. The value must be less than or equal to the <strong>Maximum number of channels</strong>. Due to the data transfer mechanism, channels cannot be individually selected; the block transmits data to the first N channels of the subsection, where <em>N</em> is this parameter.</td></tr><tr><td><strong>Number of events per channel</strong></td><td><p>Specifies the number of generated transitions per channel per calculation step. This parameter defines the width of the <strong>States</strong> and <strong>Times</strong> input vectors. Enter a single integer to apply the same value to all channels, or a vector where each element specifies the number of transitions for a given channel.</p><p>The maximum number of transitions is <strong>250 per channel</strong> and <strong>250 per subgroup of 8 channels</strong>. Increasing this value increases both processing time and the amount of data exchanged between the digital output module and the CPU.</p></td></tr><tr><td><strong>Time unit</strong></td><td><p>Specifies how transition timestamps are interpreted:</p><ul><li><strong>Time ratio</strong>: Transition time must be expressed as a ratio of the simulation time‑step (<code>0</code> to <code>1</code>).</li><li><strong>Seconds</strong>: Transition time must be expressed as a delay (in seconds) from the beginning of the calculation step. <code>Ts</code> means no transition.</li></ul></td></tr></tbody></table>

## Inputs

<table><thead><tr><th width="113.11114501953125">Input</th><th>Description</th></tr></thead><tbody><tr><td><strong>States </strong><em><strong>N</strong></em></td><td><p>Inputs state transition requests used to generate time‑stamped digital output signals for the <em>N</em>th channel in the selected channel subset:</p><ul><li><code>1</code>: Rising‑edge transition requested</li><li><code>0</code>: Falling‑edge transition requested</li><li><code>−1</code>: No transition</li></ul><p>Transitions must be defined <strong>in chronological order</strong>. The first vector element corresponds to the first transition occurring during the next calculation step, the second element to the second transition, and so on. The input vector size is determined by the <strong>Number of events per channels</strong> parameter. Use a <strong>Mux</strong> block to combine individual signals into a single input vector.</p></td></tr><tr><td><strong>Times </strong><em><strong>N</strong></em></td><td><p>Inputs the timing of state transition requests used to generate time‑stamped digital output signals for the <em>N</em>th channel in the selected channel subset.</p><ul><li>When the <strong>Time unit</strong> parameter is set to <strong>Time ratio</strong>, transition times are expressed as a ratio of the simulation time step (<code>0</code> to <code>1</code>).</li><li>When the <strong>Time unit</strong> parameter is set to <strong>Seconds</strong>, transition times are expressed as a delay (in seconds) from the beginning of the calculation step. A value of <code>Ts</code> indicates no transition.</li></ul><p>Transition times must be defined <strong>in chronological order</strong>. The first vector element corresponds to the first transition occurring during the next calculation step, the second element to the second transition, and so on. The input vector size is determined by the <strong>Number of events per channels</strong> parameter. Use a <strong>Mux</strong> block to combine individual signals into a single input vector.</p></td></tr></tbody></table>

## Outputs

<table><thead><tr><th width="148.6666259765625">Output</th><th>Description</th></tr></thead><tbody><tr><td><strong>Status</strong></td><td><p>Outputs the block status:</p><ul><li><code>0</code>: No error.</li><li><code>-1</code>: Block not associated with an <strong>OpCtrl</strong> block (check the <strong>Controller Name</strong> parameter), or FPGA initialization failure.</li><li><code>-2</code>: Internal memory initialization failure.</li></ul></td></tr></tbody></table>

## Characteristics and limitations

<table><thead><tr><th width="244.1112060546875">Characteristic</th><th>Value</th></tr></thead><tbody><tr><td><strong>Connector pin assignments</strong></td><td>Refer to the <strong>System Description Document</strong> provided with your order, or refer to the pin assignment of the <a href="https://opal-rt-technologies.gitbook.io/opal-rt-technologies-docs/op53xx/"><strong>OP53xx series I/O module</strong></a> associated with each subsection.</td></tr><tr><td><strong>PWM processing</strong></td><td>Processing time increases with the number of events to compute (thus with PWM frequency and number of channels). The data transferred per step also increases because transition times are sent each step.</td></tr><tr><td><strong>Direct feedthrough</strong></td><td>No</td></tr><tr><td><strong>Discrete sample time</strong></td><td>Inherited</td></tr><tr><td><strong>XHP support</strong></td><td>Yes</td></tr><tr><td><strong>Work offline</strong></td><td>No</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/rt-lab-i-o-library/event-generator.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
