> 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/configure-ios/communication-protocol-ios/iec-61850-8-1-mms/adapt-the-simulink-model.md).

# Adapt the Simulink Model

When working with communication protocols, it is recommended to adapt the Simulink model after configuring the driver through the **I/O Interfaces** section in RT-LAB.

{% stepper %}
{% step %}

### Add **OpInput and OpOutput** blocks to the model

Although most blocks in the model can be mapped to the communication protocol driver, OPAL-RT recommends using **OpInput** and **OpOutput** blocks for protocol I/Os.

From the [RT-LAB](https://github.com/Opal-RT-Technologies/product-docs-rt-lab/tree/main/.gitbook/simulink-blocks-reference/rt-lab-library/README.md) library, add **OpInput** and/or **OpOutput** blocks to the real-time subsystem (**SM\_** or **SS\_**). Although each block can handle a vector of up to 256 signals, **it is recommended to use one block per data type** in your communication protocol. This simplifies mapping model signals to the protocol driver later in **Dashboards** and improves organization and maintainability.

To further streamline this process, clearly name each block based on its function. This naming convention will make configuration much easier.

**Tip:** You can open **Dashboards** and select the protocol interface to review all channels enabled in the protocol driver configuration. This helps ensure you add the correct **OpInput** and **OpOutput** blocks to the model. See the example below:
{% endstep %}

{% step %}

### Connect the **OpInput** **and OpOutput** blocks

By default, the **OpInput** block outputs a **1-element vector**. To configure multiple channels for **OpInput** blocks, set the **Default Value** parameter to a vector (e.g. `zeros(1,10)` for an 10-element vector). If needed, use a **Demux** block to split the vector into individual signals.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-882077c7498a837f2e9db3f743ab67053c1a4c8e%2FDR-opinput-default-value.png?alt=media" alt="" width="317"><figcaption></figcaption></figure>

\
The **OpOutput** block accepts a vector of any size (up to 256 scalar values). You can use a **Mux** block to combine individual signals into a single input vector.
{% endstep %}

{% step %}

### Save and build the model

1. Save and run the Simulink model to confirm that everything works as expected.
2. In RT-LAB, build the model.
   {% 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/configure-ios/communication-protocol-ios/iec-61850-8-1-mms/adapt-the-simulink-model.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.
