> 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-queue.md).

# RTE Queue

## Description

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

The **RTE Queue** block, located in the **RT-EVENTS/Math Operations** library, stores in memory the times and states of all events detected on the RTE Boolean-type input signal. It can also store values of Double-type input signals at event times. The queue capacity is set by the Queue Size parameter.

When the Pop input is 1, the block pops all elements from the queue at the next simulation step and holds the outputs at those values until the next pop trigger.

A value of 1 at the optional Clr input (enabled by the Clear queue input parameter) clears the queue at the next simulation step.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-d6648ada59da19a7f64382652466ec689b7eed8d%2FRTE_queue_concept.png?alt=media" alt="" width="420"><figcaption><p>Concept of the queue</p></figcaption></figure>

{% hint style="info" %}
When two or more control inputs are triggered at the same time step, operations execute in the following order: Push, Clr, Pop.
{% endhint %}

The block can output queue status signals:

* when Empty Queue Output is selected, the block outputs 1 when the queue is empty;
* when Full QueueOutput is selected, it outputs 1 when the queue is full;
* when Number of queued events is selected, it outputs the number of stored events.

When Number of Inputs is greater than 0, the block stores Double-type input values when events occur. If Interpolate Inputs is selected, the block interpolates the inputs at the event times; otherwise, it stores the input values at the beginning of the time step.

## Mask parameters

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

<table><thead><tr><th width="240.4000244140625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Queue Size</strong></td><td>The size of the queue.</td></tr><tr><td><strong>Empty Queue Output</strong></td><td>When selected, outputs the empty state of the queue.</td></tr><tr><td><strong>Full QueueOutput</strong></td><td>When selected, outputs the full state of the queue.</td></tr><tr><td><strong>Number of queued events</strong></td><td>When selected, outputs the number of events stored in the queue.</td></tr><tr><td><strong>Clear queue input</strong></td><td>When selected, adds a port to clear the queue.</td></tr><tr><td><strong>Number of Inputs</strong></td><td>Number of Double-type signals to store in the queue with event properties.</td></tr><tr><td><strong>Interpolate Inputs</strong></td><td>When selected, interpolates the inputs at the time of each event.</td></tr></tbody></table>

## Inputs

<table><thead><tr><th width="244.39996337890625">Input</th><th>Description</th></tr></thead><tbody><tr><td><strong>RTE (RTE Boolean)</strong></td><td>RTE Boolean signal to store in the queue.</td></tr><tr><td><strong>Pop (Double)</strong></td><td>Trigger used to pop all events from the queue (1 = Pop, 0 = No effect).</td></tr><tr><td><strong>Clr (Double)</strong></td><td>Trigger used to clear all events from the queue (1 = Clear, 0 = No effect). Available when Clear queue input is selected.</td></tr><tr><td><strong>Signal N (Double)</strong></td><td>Input signal N to store in the queue when events occur.</td></tr></tbody></table>

## Outputs

<table><thead><tr><th width="240.4000244140625">Output</th><th>Description</th></tr></thead><tbody><tr><td><strong>Times (Double)</strong></td><td>Event times stored in the queue.</td></tr><tr><td><strong>States (Double)</strong></td><td>Event states stored in the queue.</td></tr><tr><td><strong>Empty (Double)</strong></td><td>Empty state of the queue.</td></tr><tr><td><strong>Full (Double)</strong></td><td>Full state of the queue.</td></tr><tr><td><strong>Num (Double)</strong></td><td>Number of events stored in the queue.</td></tr><tr><td><strong>Signal N (Double)</strong></td><td>Values of input signal N stored in the queue.</td></tr></tbody></table>

## Characteristics and limitations

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


---

# 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-queue.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.
