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

# RTE Conversion

## Description

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

The **RTE Conversion** block, located in the **RT-EVENTS/Signal Attributes** library, converts an input signal to the data type selected by the Output Data Type parameter.

The block supports the following conversions and behaviors:

* **Double**: Converts the input to a Double. The output is Low when the input is less than 0.5; otherwise, the output is High. Changes in the input cause transitions only at the beginning of the calculation step, and at most one transition can occur per calculation step.
* **Double with Compensation**: Converts the input to a Double. The output equals the average of the input signal.
* **RTE Boolean**: Converts the input to an RTE Boolean. The output is Low when the input is less than 0.5; otherwise, the output is High. Changes in the input cause transitions only at the beginning of the calculation step, and at most one transition can occur per calculation step.
* **RTE Boolean with Compensation**:
  * If the input is a Double, the output is Low when the input is less than 0.5; otherwise, the output is High. The transition between High and Low depends on the input level so that the average output over a calculation step equals the input signal.
  * If the input is an RTE Double, the output is Low when the input is less than 0.5; otherwise, the output is High. Events during the calculation step are supported.
* **RTE Double**: Converts the input to an RTE Double. The output equals the input signal at the end of the last event. Changes in the input cause transitions only at the beginning of the calculation step, and at most one transition can occur per calculation step.
* **RTE Double with Compensation**:
  * If the input is a Double, the output equals the input signal at the end of the last step. Changes in the input cause transitions only at the beginning of the calculation step, and at most one transition can occur per calculation step.
  * If the input is an RTE Boolean, the output is 1 when the input is High; otherwise, the output is Low. Events during the calculation step are supported.

## Mask parameters

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

<table><thead><tr><th width="250">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Input Data Type</strong></td><td>Specifies the input data type: Double, RTE Boolean, or RTE Double.</td></tr><tr><td><strong>Output Data Type</strong></td><td>Specifies the output data type: Double, RTE Boolean, or RTE Double.</td></tr><tr><td><strong>RT-EVENTS Compensation</strong></td><td>Enables or disables RT-EVENTS compensation. When enabled, an event can occur between two calculation steps.</td></tr><tr><td><strong>Maximum number of events</strong></td><td>Maximum number of events or transitions that can occur during a single step. Beyond this number, events are ignored and not output.</td></tr><tr><td><strong>Sample Time [s]</strong></td><td>Time interval between samples in seconds. Available only when the input data type is Double.</td></tr></tbody></table>

## Inputs

| Input     | Description                                                                      |
| --------- | -------------------------------------------------------------------------------- |
| **Input** | The signal to convert. Its data type must be Double, RTE Boolean, or RTE Double. |

## Outputs

| Output     | Description                                                                 |
| ---------- | --------------------------------------------------------------------------- |
| **Output** | The converted signal. Its data type matches the Output Data Type parameter. |

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