> For the complete documentation index, see [llms.txt](https://doc.realvirtual.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.realvirtual.io/components-and-scripts/interfaces/plcsim-advanced-native.md).

# PLCSIM Advanced Native (Pro)

Connecting Siemens PLCSIM Advanced in-process through the native Siemens runtime API (preview)

{% hint style="warning" %}
**Preview.** The PLCSIM Advanced Native interface is part of realvirtual **6.3.6** (Professional) as a preview. It is built on the Siemens runtime API 6.0 and contains the complete connection to PLCSIM Advanced, but it has not yet been released for production projects. Use the [PLCSIM Advanced](/components-and-scripts/interfaces/plcsim-advanced.md) interface (coupler) for production projects, and send us your feedback if you try the native interface.
{% endhint %}

## Overview

The **PLCSIM Advanced Native** interface connects your realvirtual simulation to a running Siemens PLCSIM Advanced instance **inside the Unity process**. It uses the official native Siemens runtime API through the realvirtual plugin *rv\_plcsim.dll* — there is no external coupler process, no shared memory and no coupler download. The Siemens API DLL is loaded from your PLCSIM Advanced installation at runtime and is never shipped with realvirtual.

The interface is built on the realvirtual FastInterface standard: it reconnects automatically, shows the connection state in the Inspector and exchanges all signals once per communication cycle as one batch. It works in the Unity Editor and in Windows x64 builds (Mono and IL2CPP).

It exists **next to** the [PLCSIM Advanced](/components-and-scripts/interfaces/plcsim-advanced.md) coupler interface, which stays fully supported for existing projects. See [Which interface?](#which-interface) below.

{% hint style="danger" %}
**In-process trade-off.** Because the Siemens runtime library runs inside the Unity process, a crash inside that library ends Unity. The coupler interface isolates the Siemens API in a separate process and does not have this risk.
{% endhint %}

## Requirements

* Windows x64, Unity Editor or Windows Standalone build
* Siemens PLCSIM Advanced installed on the **same** computer, including the **API folder matching the plugin** (*API\6.0*; PLCSIM Advanced V6, V7 and V8 install it). The Siemens API interfaces are not compatible between major versions, so the plugin only uses the API version it was built for. If only other versions are installed, the Inspector names the required and the found versions.
* A running PLCSIM Advanced instance (started from the PLCSIM Advanced Control Panel or by a TIA Portal download)

## Quick Start

1. Select **Tools > realvirtual > Add Interface > PLCSIM Advanced Native (Pro)**, or add the component **realvirtual > Interfaces > PLCSIM Advanced (Native)** to an empty GameObject.
2. Check the setup box. The interface detects the Siemens API automatically; click **Detect Siemens API** to search again or **Select DLL...** to pick *Siemens.Simatic.Simulation.Runtime.Api.x64.dll* manually.
3. Enter the **Instance Name** exactly as shown in the PLCSIM Advanced Control Panel.
4. Click **⬇️ Import Signals**. One signal GameObject is created per supported PLC tag.
5. Connect the signals to your Drives, Sensors and Behaviors and press Play.

## Key Properties

**Instance Name** (string) The name of the PLCSIM Advanced instance the interface attaches to.

**Siemens API DLL** (string) Path to the Siemens runtime API DLL (x64). It is filled automatically from the PLCSIM Advanced installation. Before loading, the plugin checks that the file is a 64-bit DLL with the expected Siemens entry points and a valid digital signature by Siemens AG.

**Detected API Version** (string, read-only) The API version folder that matches the native plugin.

**Import Hmi Tags Only** (boolean) Imports only tags marked as HMI-visible in TIA Portal. Keep this on for large programs to limit the number of signals.

**Import Data Blocks** (boolean) Also imports tags from data blocks. Data blocks can contain very many tags, so enable this only when you need them.

**Start Stop With Unity** (boolean) Sets the PLC instance to RUN when play mode starts and to STOP when it ends.

**Pause With Unity** (boolean) Freezes the virtual time of the PLC while Unity is paused (Editor pause button or application pause). The PLC stays in RUN and continues exactly where it stopped when you resume. The interface stays connected during the pause. When the interface disconnects, the PLC returns to its normal operating mode and keeps running on its own.

**Update Cycle Ms** (integer) The communication cycle in milliseconds (default 10).

**Setup Status**, **PLC Status**, **Disabled Signals**, **Tag Errors**, **Resync Count** (read-only) Show the plugin and Siemens API status, the connection and PLC operating state, signals whose binding was disabled after a TIA change, tags that currently report an error, and how often the interface re-synchronized after a PLC change.

**Test Connection** (button) Attaches to the instance once in Edit Mode, reports the operating state and detaches again.

## Signals

Tags are addressed **by name**, never by absolute address, so recompiling the TIA project does not break the connection. The direction is decided by the memory area of the tag:

| PLC tag                            | realvirtual signal                                  | Direction   |
| ---------------------------------- | --------------------------------------------------- | ----------- |
| Input (I)                          | `PLCInputBool` / `PLCInputInt` / `PLCInputFloat`    | Scene → PLC |
| Output (Q), marker (M), data block | `PLCOutputBool` / `PLCOutputInt` / `PLCOutputFloat` | PLC → scene |

Supported data types are Bool, Byte, Word, Int, DWord, DInt and Real. Tags of other types are skipped with a warning. Values that do not fit the tag type (for example 70000 for an Int) are not written and produce one warning instead of a wrapped value.

## Downloads from TIA Portal

When you download a changed program while the simulation runs, the interface re-synchronizes automatically without reconnecting:

* **New tags** get new signals.
* **Unchanged tags** keep running, and all inputs are written once completely so the PLC has the current scene values after the download.
* **Tags that changed type or direction** are *disabled*: the signal keeps its component and its last value, is listed under **Disabled Signals** and produces a warning. Components that reference the signal stay valid. Run **Import Signals** in Edit Mode to update such signals.
* **Removed tags** are disabled the same way and marked as *tag missing*.

In Edit Mode, **Import Signals** replaces a signal whose type or direction changed. If other components reference that signal, the import lists these references and asks before replacing it, because the references become invalid.

If a single tag reports an error, only that signal is marked under **Tag Errors** and a warning is logged; all other signals keep running.

## Common Use Cases

* **Virtual commissioning without the coupler** – Connect S7-1500 programs in PLCSIM Advanced where the external coupler process is blocked by virus scanner or firewall policies.
* **Pause and step through a scenario** – Pause Unity to freeze the PLC time together with the scene and resume without a RUN/STOP change.
* **Iterative TIA development** – Download program changes while the simulation runs; new tags appear automatically.

## Which interface?

|                 | [PLCSIM Advanced](/components-and-scripts/interfaces/plcsim-advanced.md) (coupler) | PLCSIM Advanced Native (preview)          | [realvirtual CONNECT](https://realvirtual.io/doc/web/connect/interfaces/protocols/) |
| --------------- | ---------------------------------------------------------------------------------- | ----------------------------------------- | ----------------------------------------------------------------------------------- |
| Runs in         | Unity, via the external coupler process                                            | Unity process                             | CONNECT gateway                                                                     |
| Setup           | Siemens DLL detection + coupler download                                           | Siemens API detection only                | CONNECT configuration                                                               |
| Crash isolation | Siemens API isolated in the coupler                                                | a crash in the Siemens library ends Unity | separate process                                                                    |
| Status          | supported                                                                          | preview                                   | supported                                                                           |

Never connect the coupler interface and the native interface to the **same** PLCSIM Advanced instance at the same time.

## See Also

* [PLCSIM Advanced (coupler interface)](/components-and-scripts/interfaces/plcsim-advanced.md)
* [Custom Interfaces (FastInterface)](/components-and-scripts/interfaces/custom-interfaces.md)
* [FMI / FMU](/components-and-scripts/interfaces/fmi.md)


---

# 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://doc.realvirtual.io/components-and-scripts/interfaces/plcsim-advanced-native.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.
