> 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/ehs/overview/introduction-to-ehs/understand-ehs-latency.md).

# Understand eHS Latency

## Overview

eHS introduces latency between an input event and the resulting output becoming available to the application. This latency depends on the interaction between the FPGA solvers and the synchronization mechanisms used to exchange data.

This page explains the latency from a **Digital Input (DIN)** transition to the resulting value becoming available at the **Analog Output Mapping and Rescaling (AOMR)** block.

{% hint style="info" %}
The latency values presented here do not include ADC, DAC, or other hardware I/O delays.
{% endhint %}

## Sources of latency and why it varies

Latency is not fixed because **digital input transitions**, **eHS execution cycles**, **machine solver execution cycles**, and **AOMR synchronization events** operate independently. As a result, an input transition may occur at any point within a solver time step.

The worst-case latency occurs when a transition arrives immediately after a solver begins a computation step, causing the update to wait until the next execution cycle. Similarly, AOMR may synchronize before updated results become available, requiring an additional synchronization period before the output is updated.

Consequently, the response time varies between a minimum and maximum value even when the model configuration and operating conditions remain unchanged.

## DIN **>** eHS **>** AOMR latency

When a **Digital Input (DIN)** transition propagates through **eHS** and **AOMR**, the latency depends on:

* **Ts\_eHS**: the DIN transition may occur while eHS is already processing a time step.
* **T\_AOMR**: AOMR may synchronize before the updated eHS results become available.

### Minimum latency situation

The DIN transition is captured in the next eHS computation cycle, making the updated output available after **2 × Ts\_eHS**, with AOMR synchronizing immediately before the updated data is transmitted.

<figure><img src="https://3212678799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABuoXNYgvaoO7wIe3bfO%2Fuploads%2Fgit-blob-8a269a3241f312662b0c513d26471ad38ef1745e%2Fdin-ehs-aomr-minimum-latency.png?alt=media" alt=""><figcaption></figcaption></figure>

$$
L\_{\min}
=========

2,T\_{\mathrm{clk}}
\+
2,T\_{s\_{eHS}}
\+
32,T\_{\mathrm{clk}}\cdot N\_{\mathrm{channels}}
\+
18,T\_{\mathrm{clk}}
$$

### Maximum latency situation

The DIN transition misses the current eHS computation cycle and the current AOMR synchronization event, resulting in an additional **Ts\_eHS** delay and a wait for the next **AOMR Sync Period** before the updated output becomes available.

<figure><img src="https://3212678799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABuoXNYgvaoO7wIe3bfO%2Fuploads%2Fgit-blob-fbca98433064f78bac4ba641e781222d601cf16a%2Fdin-ehs-aome-maximum-latency.png?alt=media" alt=""><figcaption></figcaption></figure>

$$
L\_{\max}
=========

2,T\_{\mathrm{clk}}
\+
3,T\_{s\_{eHS}}
\+
32,T\_{\mathrm{clk}}\cdot N\_{\mathrm{channels}}
\+
18,T\_{\mathrm{clk}}
\+
T\_{\mathrm{AOMR}}
$$

## DIN **>** eHS **>** Motor **>** AOMR latency

When a machine model is included, an additional synchronization stage is introduced between the **eHS solver** and the **AOMR**. The latency depends on:

* **Ts\_eHS**: the DIN transition may occur while eHS is already processing a time step.
* **Ts\_Motor**: the machine solver may already be processing a time step when updated eHS data becomes available.
* **T\_AOMR**: AOMR may synchronize before updated machine results become available.

### Minimum latency situation

The DIN transition is captured by the next eHS computation cycle, making the updated eHS data available after **2 × Ts\_eHS**. The machine solver processes the updated eHS data immediately in its next computation cycle, and AOMR synchronizes just before the corresponding **Motor\_OUT** packet becomes available.

<figure><img src="https://3212678799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABuoXNYgvaoO7wIe3bfO%2Fuploads%2Fgit-blob-1f412140f6b318222b4a3f2e89dc522f47c12a22%2Fdin-ehs-motor-aomr-minimum-latency.png.png?alt=media" alt=""><figcaption></figcaption></figure>

$$
L\_{\min}
=========

2,T\_{\mathrm{clk}}
\+
2,T\_{s\_{eHS}}
\+
T\_{s\_{Motor}}
\+
32,T\_{\mathrm{clk}},N\_{\mathrm{channels}}
\+
18,T\_{\mathrm{clk}}
$$

### Maximum latency situation

The DIN transition misses both the current eHS and machine solver computation cycles, introducing additional **Ts\_eHS** and **Ts\_Motor** delays. Since AOMR synchronizes before the updated **Motor\_OUT** packet becomes available, the output must wait for the next **AOMR Sync Period** before reaching the analog output.

<figure><img src="https://3212678799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FABuoXNYgvaoO7wIe3bfO%2Fuploads%2Fgit-blob-4b483f0f9c30ac562915c2727fc3e16d09c41274%2Fdin-ehs-motor-aomr-maximum-latency.png.png?alt=media" alt=""><figcaption></figcaption></figure>

$$
L\_{\max}
=========

2,T\_{\mathrm{clk}}
\+
3,T\_{s\_{eHS}}
\+
2,T\_{s\_{Motor}}
\+
32,T\_{\mathrm{clk}},N\_{\mathrm{channels}}
\+
18,T\_{\mathrm{clk}}
\+
T\_{\mathrm{AOMR}}
$$


---

# 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/ehs/overview/introduction-to-ehs/understand-ehs-latency.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.
