Skip to content

Connecting a PLC

For virtual commissioning the digital twin takes the place of the machine: the PLC runs its real program, and instead of motors, valves and sensors it is wired to the twin. realvirtual CONNECT is the link between the two. It runs on a PC in the controller network, talks to the PLC in its own protocol and exchanges the signals with realvirtual in the browser.

In virtual commissioning signals flow in both directions:

DirectionSignal typeExample
PLC → twinPLC Output — the PLC writes, the twin readsA valve command moves a cylinder, a motor output starts a conveyor, a lamp output lights the stack light
Twin → PLCPLC Input — the twin writes, the PLC readsA sensor detects a part, a cylinder reports its end position, an operator button is pressed

Monitoring a running machine only needs the first direction. Virtual commissioning needs both — the PLC only gets through its sequence when the twin’s sensors answer it. The second direction is therefore what distinguishes a commissioning set-up, and it has to be enabled explicitly (step 5 below).

Both directions in the CONNECT signal list: inputs written by realvirtual above, outputs written by the PLC below

  • realvirtual CONNECT on a Windows PC that reaches the PLC over the network — or, for PLCSIM Advanced, on the PC where PLCSIM Advanced is installed. See Installation.
  • A model with PLC signals named like the PLC tags. The Laser Welding Assembly Station is an example: its 193 signals carry the names of the station’s TIA tag list.
  • A license for the signal count. The free tier serves up to 20 signals; a real machine usually needs a commercial license. See Licensing.
  1. Open the viewer through CONNECT. Open http://localhost:5100 on the CONNECT PC, or use Open realvirtual WEB in the tray menu. A hosted viewer can use the local gateway as well — see where the viewer comes from.
  2. Load the model and switch to the Commissioning workspace.
  3. Add an interface for your controller in the CONNECT panel — for example Siemens PLCSIM Advanced (native API), Siemens S7, TwinCAT ADS or OPC UA — and enter its connection parameters. The card shows Connected once the controller answers. Parameters per controller: Supported protocols.
  4. Add the signals. Use Browse on the live connection or on a symbol table (for example a TIA .sdf export), or import a tag table. Keep the tag names as signal names: the twin binds by name, so FG04_Y_AxisZ_WorkPos in the PLC meets FG04_Y_AxisZ_WorkPos in the model. Check the direction of each signal — PLC inputs as PLCInput, PLC outputs as PLCOutput. Most browsers derive it from the memory area. See Configuring interfaces.
  5. Allow write access. Turn on Allow web to PLC on the interface. It is off by default; without it the twin’s sensor values and operator buttons stay in the gateway and never reach the PLC. See Write access.
  6. Let the PLC take over. As soon as the PLC writes the first of the model’s outputs, the model changes to PLC — the button in the top bar turns green and locks, and the model’s logic steps stop. Plant behaviour such as doors or an E-stop chain keeps running. A Structured Text program that reads RV_SimulationMode steps aside as well and its outputs go back to their start values; one that does not keeps writing — Stop it in the PLC editor before you connect the controller. See Simulation or PLC.
  7. Check the loop. Signals that are bound show a link icon in the CONNECT panel and a green dot when values arrive. Press a button on the Operator Panel and watch the PLC react; force a sensor to test a single reaction.

When the interface disconnects, the model returns to its saved mode and the virtual PLC — logic steps and mode-following ST programs — takes over again.

ControllerWhat to prepareDetails
Siemens PLCSIM Advanced (native API)PLCSIM Advanced V4–V7 installed on the CONNECT PC and the instance running. No PUT/GET, no absolute addresses, Softbus works. Tags are addressed by symbol namePLCSIM Advanced
Siemens S7-1200/1500 (real CPU)PUT/GET allowed in the CPU protection settings; optimized block access disabled for the data blocks you addressSiemens S7
Beckhoff TwinCATAn AMS route from the PLC back to the CONNECT PC. TwinCAT does not need to be installed on the CONNECT PCTwinCAT ADS
OPC UA serverThe endpoint of the server; the nodes the twin writes must be writableOPC UA

Further controllers and robot controllers — Modbus, EtherNet/IP, MELSEC, ctrlX, KUKA, FANUC, ABB RobotStudio and others — are listed under Supported protocols.

One model serves both: without a controller it runs on its own logic steps, with a controller connected the PLC takes over automatically. Nothing has to be edited in the model between the two uses.

To alternate between several set-ups — for example PLCSIM Advanced in the office and the real CPU on site — save each interface configuration as a CONNECT profile and switch profiles in the CONNECT settings or the tray menu. A profile can also be bound to the model’s document, so opening the document brings up the right configuration. See Profiles.

SymptomFirst thing to check
The interface does not connectNetwork, address and the controller-specific requirements above
The model does not moveThe signal names on both sides, and the direction of the PLC outputs
The PLC does not see sensors or buttonsAllow web to PLC, the direction of the PLC inputs, and on a real CPU the hardware configuration of the inputs
Outputs jump between two valuesA Structured Text program that does not read RV_SimulationMode is still running — stop it in the PLC editor
Only some signals updateThe license limit — signals beyond it are listed in the license status

More: Troubleshooting.