Skip to content

Connecting a PLC

For virtual commissioning, the digital twin takes the place of the machine. The PLC runs its real program, connected to the twin instead of motors, valves and sensors. realvirtual CONNECT links the two. It runs on a PC in the controller network and communicates with the PLC using its protocol. It 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, because the PLC can only complete its sequence when the twin’s sensors respond. This return path distinguishes a commissioning set-up and must be enabled explicitly (step 5 below).

The signal loop PLC outputs flow from the controller through CONNECT to the twin and move valves, motors and lamps. PLC inputs flow back from the twin's sensors and buttons through CONNECT to the controller, but only when Allow web to PLC is switched on. PLC real or simulated, e.g. PLCSIM Advanced CONNECT binds signals by name Digital twin in the browser PLC Output valve, motor, lamp sensor, end position, button Allow web to PLC PLC Input only with the switch on (off by default)
Monitoring needs the upper path only. Virtual commissioning needs both.

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. If the model already carries the signals, Fill addresses from controller or Import address table on the interface card adds all addresses in one step. 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. The virtual PLC, including 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

See Supported protocols for further controllers and robot controllers, including Modbus, EtherNet/IP, MELSEC, ctrlX, KUKA, FANUC and ABB RobotStudio.

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 set-ups, save each interface configuration as a CONNECT profile. For example, use one for PLCSIM Advanced in the office and another for the real CPU on site. Switch profiles in the CONNECT settings or the tray menu. You can also bind a profile to the model’s document, so opening the document loads 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.