> 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/hypersim/configure-ios/communication-protocol-ios/modbus-master/configure-modbus-master.md).

# Configure Modbus Master

When working with communication protocols, it is recommended to begin by configuring the protocol through the **I/O Interfaces** section in <code class="expression">space.vars.Software</code> before proceeding with other steps.

## Configure the Modbus master I/O interface

{% stepper %}
{% step %}

### Add a new I/O interface

1. In the **HYPERSIM** tab, click **I/O Interface** in the **Sensors & I/Os** section to open the **I/O Interface Configuration** window.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-881ca3164b1b5fa2d589ecb145163b15e7af8f64%2FDR-hyp-io-interface.png?alt=media" alt=""><figcaption></figcaption></figure>

2. Right‑click **Modbus Master** and select **Add**. Keep the default name or enter a custom one. If multiple **Modbus Master** are added, each one must have a unique name.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-4badacf09a19b8a3969bdf53d4445718600e1470%2FDR-hyp-modm-add.png?alt=media" alt="" width="358"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Configure the general settings

Click the newly added **Modbus Master** in the **I/O Interface Configuration** window and configure the general settings.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-ebf30797e6efbae913d42b9ab19cfdc3808aa774%2FDR-hyp-modm-gen.png?alt=media" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="165">Parameter</th><th>Value (Description)</th></tr></thead><tbody><tr><td><strong>Use an RT core for asynchronous computation</strong></td><td><strong>Checked:</strong> The driver reserves a dedicated real‑time CPU core for its communication tasks, allowing it to handle a larger number of Modbus slaves efficiently.<br><strong>Unchecked:</strong> The communication system runs on core 0 alongside the operating system.</td></tr><tr><td><strong>Enable verbose mode</strong></td><td><strong>Checked:</strong> Displays the full configuration during model loading for debugging.<br><strong>Unchecked:</strong> Only standard log messages are shown.</td></tr><tr><td><strong>Enable virtual mode</strong></td><td><strong>Checked:</strong> Allows the model to execute even if the I/O interface does not match the hardware configuration. All connections are initialized, but the interface performs no communication. Useful for troubleshooting without hardware or preparing models for future systems.<br><strong>Unchecked:</strong> The interface operates normally and requires compatible hardware.</td></tr></tbody></table>
{% endstep %}

{% step %}

### Manage slaves: add, remove, rename, or reorder

Click **Slaves** and use:

* **+** icon to add slaves
* **–** icon to remove slaves
* **Arrow** icons to reorder slaves

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-7739a66b7ad6a187a7081148e35120bf6b8bd0a5%2FDR-hyp-modm-slave.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Configure the slave(s) settings

Click a slave under the **Slaves** folder to configure its settings. Repeat this step for each additional device that needs to be reached.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-db16db1879da232353784c449cf0dc8644aab8e0%2Fdr-hyp-modbusmaster-slaves.jpg?alt=media" alt=""><figcaption></figcaption></figure>

{% tabs %}
{% tab title="TCP mode" %}

<table><thead><tr><th width="140">Parameter</th><th>Value (Description)</th></tr></thead><tbody><tr><td><strong>Mode</strong></td><td>Select the Modbus communication mode: <strong>TCP</strong> or <strong>RTU</strong>.</td></tr><tr><td><strong>Modbus slave ID</strong></td><td>ID of the Modbus slave.</td></tr><tr><td><strong>NIC name</strong></td><td>Network interface name. Select the correct interface based on your <strong>System Description Document</strong> or Linux <code>ifconfig</code> command. For local testing on the same simulator, use the loopback interface <strong>lo</strong>.</td></tr><tr><td><strong>IP address</strong></td><td>IP address assigned to the Modbus slave. For local testing on the same simulator, use <strong>127.0.0.1</strong>.</td></tr><tr><td><strong>TCP port</strong></td><td>TCP port on which the Modbus slave listens for incoming connections from the master.</td></tr><tr><td><strong>Cycle rate (ms)</strong></td><td>Interval (in milliseconds) at which the model writes data to the slave’s outputs (coils and holding registers). When both the model and the master may modify outputs, this value must be <strong>greater than the model time step</strong>, otherwise master write operations will not be reflected in the model.</td></tr><tr><td><strong>Byte ordering</strong></td><td>Defines how 32‑bit values are encoded across two Modbus registers. For <strong>FLOAT32</strong>, the default <strong>ABCD</strong> ordering corresponds to IEEE‑754. Supported orders include <strong>ABCD</strong>, <strong>BADC</strong>, <strong>CDAB</strong>, and <strong>DCBA</strong>.</td></tr></tbody></table>
{% endtab %}

{% tab title="RTU mode" %}

<table><thead><tr><th width="125">Parameter</th><th>Value (Description)</th></tr></thead><tbody><tr><td><strong>Modbus slave ID</strong></td><td>Unique identifier assigned to the Modbus slave. In RTU mode, multiple slaves may share the same serial bus (RS‑232/422/485); therefore, each slave must have a <strong>unique slave ID</strong> to avoid address conflicts.</td></tr><tr><td><strong>Serial port</strong></td><td>Path to the serial interface used for Modbus RTU communication. On OPAL‑RT systems with SuperMicro motherboards, the first serial port typically appears as <strong><code>/dev/ttyS0</code></strong>.</td></tr><tr><td><strong>Serial baudrate</strong></td><td>Communication speed of the Modbus RTU link (e.g., 9 600, 19 200, 38 400, 115 200 bps). All devices on the bus must use the <strong>same baudrate</strong>.</td></tr><tr><td><strong>Serial data bits</strong></td><td>Number of data bits used in each character frame. Common values include <strong>7</strong> or <strong>8</strong>, with <strong>8</strong> being typical for Modbus RTU.</td></tr><tr><td><strong>Serial stop bits</strong></td><td>Number of stop bits appended to each character frame. Standard configurations are <strong>1</strong> or <strong>2</strong> stop bits; all devices must match.</td></tr><tr><td><strong>Serial parity</strong></td><td>Parity scheme used by the Modbus RTU slave: <strong>None</strong>, <strong>Odd</strong>, or <strong>Even</strong>. When Odd or Even is selected, the parity bit is set so that the total number of “1” bits in the 8‑bit data field is <strong>even</strong> (Even parity) or <strong>odd</strong> (Odd parity). This parity bit is added to each transmitted character.</td></tr><tr><td><strong>Cycle rate (ms)</strong></td><td>Interval (in milliseconds) at which the model writes data to the slave’s outputs (coils and holding registers). When both the model and the master may modify outputs, this value must be <strong>greater than the model time step</strong>, otherwise master write operations will not be reflected in the model.</td></tr><tr><td><strong>Byte ordering</strong></td><td>Defines how 32‑bit values are encoded across two Modbus registers. For <strong>FLOAT32</strong>, the default <strong>ABCD</strong> ordering corresponds to IEEE‑754. Supported orders include <strong>ABCD</strong>, <strong>BADC</strong>, <strong>CDAB</strong>, and <strong>DCBA</strong>.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

### Configure the slave(s) data points

1. Expand a slave to reveal its operations.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-42eafdffaed9abfa1e1f0acb4e14a006590452bb%2FDR-hyp-modm-data.png?alt=media" alt=""><figcaption></figcaption></figure>

2. Click **Operations** and use:

* **+** icon to add data points
* **–** icon to remove data points
* **Arrow** icons to reorder data points

3. Change operations parameters as desired:

<table data-header-hidden><thead><tr><th width="150">Parameter</th><th>Value (Description)</th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>Name used to identify the signal associated with the read or write operation. Each operation must have a unique name.</td></tr><tr><td><strong>Operation type</strong></td><td>Type of Modbus operation to perform. Refer to the list of supported operations in the <strong>Supported features</strong> section (e.g., reading coils, writing holding registers).</td></tr><tr><td><strong>Operation code</strong></td><td>Read‑only field displaying the hexadecimal function code corresponding to the selected Modbus operation.</td></tr><tr><td><strong>Start address</strong></td><td>Starting address of the Modbus data point(s) involved in the read or write operation.</td></tr><tr><td><strong>Item number</strong></td><td>Number of coils or registers to read or write, starting at the specified address.</td></tr><tr><td><strong>Interpreted as</strong></td><td>Defines how the Modbus point values will be interpreted:<br>• <strong>Coils and discrete inputs:</strong> Single‑bit values only.<br>• <strong>Registers:</strong> Supports unsigned 16‑bit and 32‑bit integers, signed 16‑bit and 32‑bit integers, and 32‑bit single‑precision floating‑point values.</td></tr><tr><td><strong>Triggered operation</strong></td><td>Enables triggering of read or write operations that are not executed cyclically. Useful for on‑demand or event‑based communication.</td></tr></tbody></table>
{% endstep %}

{% step %}

### Save the configuration

{% 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/hypersim/configure-ios/communication-protocol-ios/modbus-master/configure-modbus-master.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.
