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

# RTE Switch

## Description

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

The **RTE Switch** block, located in the **RT-EVENTS/Signal Routing** library, passes either the first input or the third input based on the value of the second input (the control input). When the control input is an RTE signal, the block compensates for events that occur during the calculation step.

Use the Criteria for passing first input parameter to define when the first input is selected. The block can test whether the control input is greater than or equal to the threshold, strictly greater than the threshold, or nonzero. If the specified condition is met, the block passes the first input; otherwise, it passes the third input.

## Mask parameters

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

<table><thead><tr><th width="273.20001220703125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Port data types</strong></td><td>Select the port data type.</td></tr><tr><td><strong>Criteria for passing first input</strong></td><td>Select the condition under which the first input is passed: control input greater than or equal to the threshold, strictly greater than the threshold, or nonzero. If the condition is met, the first input is passed; otherwise, the third input is passed.</td></tr><tr><td><strong>Threshold</strong></td><td>Set the threshold that determines which input is passed to the output.</td></tr><tr><td><strong>Interpolate</strong></td><td>When enabled, interpolates the output value.</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 ignored and not output.</td></tr></tbody></table>

## Inputs

<table><thead><tr><th width="259.5999755859375">Input</th><th>Description</th></tr></thead><tbody><tr><td><strong>u1</strong></td><td>Output when the second input meets the criteria.</td></tr><tr><td><strong>u2</strong></td><td>Control input that selects which input is output.</td></tr><tr><td><strong>u3</strong></td><td>Output when the second input doesn’t meet the criteria.</td></tr></tbody></table>

## Outputs

<table><thead><tr><th width="259.5999755859375">Output</th><th>Description</th></tr></thead><tbody><tr><td><strong>Output</strong></td><td>Output 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-switch.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.
