> 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-logical-operator.md).

# RTE Logical Operator

## Description

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

The **RTE Logical Operator** block, located in the **RT-EVENTS/Math Operations** library, performs logical operations (AND, OR, NOT, NAND, NOR, XOR) on its inputs with compensation for transitions occurring between time steps. The number of input ports is specified with the Number of input ports parameters.

If the block has more than one input, any non-scalar inputs must have identical dimensions. The output then has the same dimensions, and each element results from applying the selected operator element-wise to the corresponding input elements.

With a single vector input, the block applies the operator (except NOT) across all elements of the vector and outputs a scalar.

The NOT operator accepts only one input, scalar or vector. For a vector input, the output is a vector of the same size containing the logical complements of the input elements.

Use the Maximum Number of events parameter to set the maximum number of transitions that can occur within one calculation step and be stored in the outputs. For example, when both inputs contain two events during one step: specifying a maximum of four events outputs all transitions; specifying a maximum of three events outputs only the first three transitions, and the block adds or removes a transition at the next step to keep the output valid.

## Mask parameters

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

| Parameter                    | Description                                                                                                                                                                               |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Logical operator**         | The logical operator applied to the inputs. Valid choices are AND, OR, NOT, NAND, NOR, XOR.                                                                                               |
| **Number of input ports**    | Number of block inputs. The value must be appropriate for the selected operator.                                                                                                          |
| **Maximum Number of events** | Maximum number of events (transitions) that can occur during a single step. Over this number, events are skipped and the block tries to resolve the conflict at the next simulation step. |

## Inputs

| Input                    | Description                                                         |
| ------------------------ | ------------------------------------------------------------------- |
| **Inputs (RTE Boolean)** | Signals on which the block performs the selected logical operation. |

## Outputs

| Output                    | Description                               |
| ------------------------- | ----------------------------------------- |
| **Outputs (RTE Boolean)** | Result of the selected logical operation. |

## 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-logical-operator.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.
