> 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/model-and-simulation/co-simulation/co-simulation-with-orchestra.md).

# Co-Simulation with Orchestra

## Introduction

RT-LAB Orchestra lets you connect independently developed simulation components and exchange data between them as part of a coordinated co-simulation.

Use Orchestra when different parts of a system are developed as separate models or applications and cannot, or should not, be combined into a single RT-LAB model. The components can use different modeling environments or programming languages while Orchestra provides the communication layer between them. Orchestra describes this as heterogeneous co-simulation and identifies the ability to develop and test components independently before integrating them as a key advantage of Orchestra.

For example, you can use Orchestra to connect:

* an RT-LAB model with another Simulink model;
* an RT-LAB model with a C/C++ application;
* multiple independently developed simulation components;
* simulations running at different rates;
* components executing on the same real-time target; or
* simulations running on different systems connected through Ethernet or Dolphin.

Orchestra connects **independent simulation components**.&#x20;

## How Orchestra works

An Orchestra co-simulation contains two main types of components:

* **Framework**
* **External Components**

The RT-LAB model acts as the **Framework**. It provides the central communication layer through which the other simulation components exchange data.

The simulations connected to this Framework are called **External Components**.&#x20;

### Orchestra domains

The Framework is organized into **domains**.

A domain is an independent space in which named data items are exchanged between participating simulation components. Each domain has a unique name and its own communication and synchronization configuration.

You can use:

* one domain for one component;
* one domain for several components, where supported; or
* several domains to separate different parts of a larger co-simulation.

Using multiple domains is particularly useful when components operate independently or exchange data at different rates.

### Data exchange

Orchestra uses a publish/subscribe mechanism.

Each data item is identified by name. Components therefore exchange named data through Orchestra rather than establishing direct signal-to-signal connections between every simulation application.

From the **Framework's point of view**:

* **Publish** means the RT-LAB Framework sends data to the External Component.
* **Subscribe** means the RT-LAB Framework receives data from the External Component.&#x20;

This is particularly important because the terminology appears reversed when viewed from the External Component.

For example:

| Direction                   | Framework | External Component |
| --------------------------- | --------- | ------------------ |
| RT-LAB → External Component | Publish   | Subscribe          |
| External Component → RT-LAB | Subscribe | Publish            |

### Data description file

The communication contract is defined in a **Data Description File (DDF)**.

The DDF is an XML file that describes:

* domains;
* connection type;
* synchronization behavior;
* Publish and Subscribe sets;
* data-item names;
* data types;
* array lengths; and
* optional default values and descriptions.

The DDF therefore defines **what is exchanged, in which direction, and how the domain communicates**.

### Synchronous and asynchronous co-simulation

An Orchestra domain can exchange data synchronously or asynchronously. The mode is configured per domain in the DDF.&#x20;

Use **synchronous communication** when the simulation components need to advance together and data exchange is part of the synchronization between them.

Use **asynchronous communication** when the components do not need to wait for each other at every exchange.

The Orchestra architecture supports both modes as part of its producer/consumer synchronization design.

### Connection types

Depending on where the components execute, Orchestra can exchange data using different communication mechanisms.

| Deployment                                 | Communication             |
| ------------------------------------------ | ------------------------- |
| Components on the same system              | Shared memory             |
| Components on different systems            | Ethernet using TCP or UDP |
| Compatible systems directly interconnected | Dolphin                   |
| Legacy remote architecture                 | Reflective memory         |

## Typical workflow

To set up an Orchestra co-simulation:

1. Identify the simulations or applications to connect.
2. Determine which RT-LAB model acts as the Framework.
3. Define the domains.
4. Define the data exchanged through each domain.
5. Configure synchronization.
6. Select the connection type.
7. Create the DDF.
8. Configure the Framework.
9. Configure each External Component.
10. Build the components.
11. Start the Framework.
12. Start the External Components.


---

# 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/model-and-simulation/co-simulation/co-simulation-with-orchestra.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.
