> 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/automation-api-and-scripting/orchestra-api-reference.md).

# Orchestra API

## Overview

The **RT-LAB Orchestra Application Programming Interface (RTAPI)** enables C-based external components to exchange data with a domain defined within an RT-LAB framework. Data exchange in an Orchestra co-simulation follows a **publish/subscribe model**, where communication is organized around data items. A domain represents the union of these named data items.

Data is transmitted to the RT-LAB framework using **RTPublish()** and received from it using **RTSubscribe()**. Depending on the configuration defined in the **Data Description File (DDF)**, exchanges can be either **synchronous** or **asynchronous**. For synchronous communication, calls to **RTPublish()** and **RTSubscribe()** must be enclosed within locking mechanisms to ensure proper data consistency.

Before any data exchange can occur, a connection to the target domain must be established using **RTConnect()**. Once communication is complete, the connection is terminated using **RTDisconnect()**.

The functions are invoked from within a **C/C++ application** to enable communication and interaction with RT-LAB executing on a target processor.

{% hint style="info" %}
The RTAPI assumes that the client code invoking it is single-threaded.\
Any error encountered during publishing or subscribing within a domain will cause the C-code External Component to disconnect from the RT-LAB Orchestra co-simulation.
{% endhint %}

## **Library and Header**

|                 | Windows                                                                                        | OPAL-RTLinux        |
| --------------- | ---------------------------------------------------------------------------------------------- | ------------------- |
| Static Library  | N/A                                                                                            | N/A                 |
| Dynamic Library | <ul><li>OpalOchestra.dll</li><li>OpalOrchestra\_64.dll</li><li>OpalOrchestraVISA.dll</li></ul> | libOpalOrchestra.so |
| Header File     | RTAPI.h                                                                                        | RTAPI.h             |

## Example

The example **Orchestra C-code** is available in the folder C:\OPAL-RT\RT-LAB\\\<version>\Examples\Features\Orchestra\\, where \<version> is the currently installed version of RT-LAB.


---

# 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/automation-api-and-scripting/orchestra-api-reference.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.
