> 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/connect-a-simulink-model-with-orchestra.md).

# Connect an External Simulink Model with Orchestra

## Introduction

Use this procedure to connect an independently compiled Simulink model to an RT-LAB Orchestra Framework.

Make sure that:

* the Framework contains the required Orchestra domain;
* the DDF defines the signals exchanged with the Simulink model; and
* the External Component uses the same domain and data-item definitions.

## Procedure

{% stepper %}
{% step %}

### Add a Controller block

In the external Simulink model, add an [**Orchestra External Controller**](https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/rt-lab-library/orchestra_external_controller.md) block.

The **Orchestra External Controller** establishes the External Component's connection to the Orchestra domain. This is the first integration step for an external Simulink model.
{% endstep %}

{% step %}

### Configure the domain

Configure the **Orchestra External Controller** to use the DDF and select the domain associated with the model.
{% endstep %}

{% step %}

### Add Publish blocks

Add [**Orchestra External Publish**](https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/rt-lab-library/orchestra_external_publish.md) blocks for signals produced by the External Component and sent to RT-LAB.

Remember that these signals appear in the **Subscribe set of the DDF**, because the DDF is written from the Framework's point of view.
{% endstep %}

{% step %}

### Add Subscribe blocks

Add [**Orchestra External Subscribe**](https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/rt-lab-library/orchestra_external_subscribe.md) blocks for signals received by the External Component from RT-LAB.

These correspond to items in the **Publish set of the DDF**.
{% endstep %}

{% step %}

### Map the data items

Associate the Publish and Subscribe blocks with their corresponding domain data items.
{% endstep %}

{% step %}

### Build the Simulink model

Build the external Simulink model using the supported Simulink code-generation workflow.
{% endstep %}

{% step %}

### Run the co-simulation

Start the RT-LAB Framework first.

Then start the External Component.
{% endstep %}
{% endstepper %}


---

# 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/connect-a-simulink-model-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.
