> 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-events-library/rte-insert.md).

# RTE Insert

## Description

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

The **RTE Insert** block, located in the **RT-Events/Math Operations** library, inserts N pulses into an RTE Boolean signal. Pulses are inserted between N+1 consecutive pulses of the input. The offset sets the insertion position relative to the beginning of the cycle, and insertion repeats every cycle of M pulses. Pulse width and delay are expressed as a percentage of the last input period; delays are measured from the end of the last pulse.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-d316e8ca0b775aa1435d95aad6d340fcf44bf52f%2FRTE_insert_curve.png?alt=media" alt=""><figcaption><p>Example where the parameters N, M, width and delay are respectively 2,4,16% and 16%.</p></figcaption></figure>

Selecting a rising trigger inserts high pulses; selecting a falling trigger inserts low pulses. An external reset signal can restart the cycle by resetting the internal pulse counter on the selected edge (rising, falling, or either).

One of the limitations of this block occurs when the frequency of the input signal increases rapidly and the next rising edge of the input signal occurs before the new pulse was inserted. In this case, the input signal and the new pulse are combined with a logical AND.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-06a0574337b2b6a7b7167adf118fa9bd74cd8c16%2FRTE_insert_curve2.png?alt=media" alt=""><figcaption><p><em>Limitation of the RTE Insert Block when frequency increase rapidly</em></p></figcaption></figure>

In the extreme case where the time of the events of the new pulses exceeds the time of the falling edge of the next input pulse, the events are skipped.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-554b983ecbfd8c1cd27135098b223caf816fa7d4%2FRTE_insert_curve3.png?alt=media" alt=""><figcaption><p>Extrem case w<em>hen Frequency Increase Rapidly</em></p></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-8857d04a6b4ad4bcc2d26b621329fadf24d65d45%2FRTE_insert_mask.png?alt=media" alt="" width="314"><figcaption></figcaption></figure>

<table><thead><tr><th width="241.20001220703125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Trigger type</strong></td><td>Determines the edge used to count pulses (rising or falling).</td></tr><tr><td><strong>Number of pulses to insert</strong></td><td>Number of pulses to insert at each cycle.</td></tr><tr><td><strong>Number of pulses by cycle</strong></td><td>Number of input pulses that define one cycle.</td></tr><tr><td><strong>Offset</strong></td><td>Offset, in pulses from the beginning of the cycle, where pulses are inserted.</td></tr><tr><td><strong>Pulse width</strong></td><td>Pulse width as a percentage of the input signal period.</td></tr><tr><td><strong>Delay</strong></td><td>Pulse delay as a percentage of the input signal period, relative to the end of the pulse.</td></tr><tr><td><strong>External Reset</strong></td><td>Edge type used to reset the cycle (none, rising, falling, either).</td></tr><tr><td><strong>Maximum Number of events</strong></td><td>Maximum number of events or transitions allowed during a single step; events beyond this number are skipped.</td></tr></tbody></table>

## Inputs

<table><thead><tr><th width="240.39996337890625">Input</th><th>Description</th></tr></thead><tbody><tr><td><strong>Input (RTE Boolean)</strong></td><td>RTE Boolean signal (pulse waveform) to modify.</td></tr><tr><td><strong>External Reset (Double)</strong></td><td>Signal used to reset a cycle.</td></tr></tbody></table>

## Outputs

<table><thead><tr><th width="239.5999755859375">Output</th><th>Description</th></tr></thead><tbody><tr><td><strong>Output (RTE Boolean)</strong></td><td>Modified RTE Boolean signal.</td></tr></tbody></table>

## Characteristics and limitations

| Characteristic         | Value                         |
| ---------------------- | ----------------------------- |
| **Direct Feedthrough** | Yes                           |
| **Sample time**        | Inherited and fixed discrete. |
| **Work offline**       | Yes                           |
| **Dimensionalized**    | Yes                           |


---

# 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-events-library/rte-insert.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.
