How-to
Simulating an S7 PLC for SCADA OPC server testing
Short answer
Plain PLCSIM accepts connections only from applications on the same PC, so an OPC server on another machine never sees it. Bridge classic STEP 7 PLCSIM to TCP/IP with NetToPLCSim, or run a virtual S7-1500 in S7-PLCSIM Advanced with its built-in OPC UA server, and the SCADA connects as if to real hardware.
On this page
- Can STEP 7 act as the PLC simulator for my OPC server?
- Why does plain PLCSIM refuse an OPC server on another PC?
- How do I bridge PLCSIM to TCP/IP with NetToPLCSim?
- Which rack and slot does my OPC server use for the bridged CPU?
- Which versions do I need for S7-PLCSIM Advanced?
- How do I publish OPC UA data from a virtual S7-1500?
- How do I prove the simulated SCADA link end to end?
- Why does the OPC connection still fail when everything looks right?
- Questions asked
Plain PLCSIM cannot feed your OPC server by itself: it listens only to applications on the same PC, so a server anywhere else times out. STEP 7 is the engineering tool; the data comes from a simulated CPU, and that CPU must sit where the server can reach it. Two routes cover every case. A classic STEP 7 V5.5 project with an S7-300 runs PLCSIM behind NetToPLCSim, and the server dials the PC's adapter on TCP port 102 as if the CPU were rack-mounted. A TIA Portal project runs a virtual S7-1500 in S7-PLCSIM Advanced, and the SCADA reads the CPU's built-in OPC UA server over the network. Below: the decision per project, the steps for both routes, and the tests that prove the link.
Can STEP 7 act as the PLC simulator for my OPC server? #
STEP 7 is the engineering tool, so the program has to run in a simulated CPU first: bridge PLCSIM to the network with NetToPLCSim for a classic S7-300 project, or run a virtual S7-1500 in S7-PLCSIM Advanced and let the SCADA read its built-in OPC UA server.
| Situation | Route |
|---|---|
| STEP 7 V5.5 project, S7-300 target, OPC server speaking S7 communication | PLCSIM plus the NetToPLCSim bridge |
| TIA Portal project, S7-1500 target, SCADA with an OPC UA client | S7-PLCSIM Advanced with the CPU's built-in OPC UA server |
| OPC server and SCADA on the same PC as PLCSIM | Plain PLCSIM, no bridge |
The table settles the decision most benches face. If the SCADA has no OPC UA client and you control the protocol at both ends, a one-PC Modbus TCP SCADA simulation takes the same bench idea down a simpler path. Everything below walks the two S7 routes in the order a bench meets them.
Why does plain PLCSIM refuse an OPC server on another PC? #
Standard PLCSIM opens no real network interface: it accepts connections only from applications on the same host through the PLCSIM interface, so an OPC server on another PC, or any driver that dials a plain TCP/IP address, never reaches the simulated CPU.
The simulated instance answers on an internal address, but behind it sit no network functions — the traffic never touches an adapter. The same-host limit holds across the PLCSIM variants for S7-300, S7-400, S7-1200 and S7-1500 targets, which is why a local HMI connects while the remote OPC server times out on the CPU address. If the server shows no route, a refused session or a timeout against the address you typed, the interface is not exposed, and that is the whole reason old tutorials appear broken: they configured the project correctly but never put anything on the network side, because plain PLCSIM has nothing there to configure.
How do I bridge PLCSIM to TCP/IP with NetToPLCSim? #
For a STEP 7 V5.5 project, download the blocks to PLCSIM and let NetToPLCSim forward Iso-on-TCP traffic from the PC's network adapter onto the simulator, so the OPC server connects on TCP port 102 as it would to a physical S7-300.
NetToPLCSim is the open-source network extension for PLCSim on SourceForge: it takes Iso-on-TCP sessions arriving on a real adapter and hands them to the simulator's internal interface.
- Open the project in STEP 7 V5.5, start PLCSIM, download OB1 and the data blocks, and switch the simulated CPU to RUN.
- Stop the S7OIEHSX service for the session with
net stop s7oiehsx, which frees TCP port 102 for the bridge, and bring the service back when the bench is done. - Start NetToPLCSim, create a station bound to the PC network adapter whose address the OPC server will dial, and map a rack and slot entry to the running PLCSIM instance.
- In the OPC server, define the device with that adapter address and the rack and slot from the hardware configuration, and address the items as DB number plus byte offset.
- Force a value in PLCSIM and confirm the matching OPC item follows it.
A tutorial on an S7-PLCSIM OPC connection over NetToPLCSim walks this same chain step by step. The pairing reported working is STEP 7 V5.5 with an S7-300 in PLCSIM; newer release combinations are unproven, and a ten-minute test on your own station settles them. Decision: any classic S7-300 bench that must serve an external OPC server runs this bridge — plain PLCSIM has no settings-only alternative.
Which rack and slot does my OPC server use for the bridged CPU? #
Use the rack and slot your hardware configuration already declares — rack 0, slot 2 for a CPU in a single-rack S7-300 — because the OPC server addresses the simulated CPU exactly like a rack-mounted one and any mismatch is refused.
An S7 session names the CPU by rack and slot inside the connection, so the bridge passes through whatever mapping you gave it and the server's device entry must repeat it character for character. In the setups reported working, the PG/PC interface access point sits on the PLCSIM TCP/IP entry, and the PC adapter address and the address configured for the CPU are the same, because the bridged CPU answers on that PC address. A wrong slot rarely produces a clean error: the address is right, the session opens, and the CPU still reads as absent — the same stuck-by-slot pattern described in why an Ignition S7-400 device stays disconnected by CPU slot. Decision: read the slot from the hardware configuration, map it once in the bridge, and copy it unchanged into the OPC server.
Which versions do I need for S7-PLCSIM Advanced? #
The combination reported working is STEP 7 Professional V14 SP1 with updates and SIMATIC S7-PLCSIM Advanced V1.0 SP1, and Siemens' support portal carries trial installations of both that run for 21 days.
Treat that pair as the floor: on a TIA release older than V14 SP1 this route is not established, so take the bridge route or update the engineering station. Before you pick exact builds, match your TIA release against the compatibility list in the manufacturer's support portal, because the virtual CPU and the portal are version-locked. The trials download from that same portal under your account, and continued use past evaluation calls for a license from the vendor. Decision: TIA Portal V14 SP1 or newer with an S7-1500 that supports OPC UA in its firmware — S7-PLCSIM Advanced; anything older — the bridge route with a classic target.
How do I publish OPC UA data from a virtual S7-1500? #
Enable the CPU's OPC UA server in TIA Portal, expose the tags or server interfaces you want, then download the project to a PLCSIM Advanced instance bound to a network adapter so the SCADA's OPC UA client can browse it like a real S7-1500 endpoint.
- Create the S7-1500 as the project target, or migrate a classic project first — migrating S7-300 projects from STEP 7 V5.5 to TIA Portal covers that conversion.
- In the CPU properties, enable the OPC UA server and activate it, select the tags or server interfaces to expose, and compile — the same settings drive the physical-CPU case described in connecting an S7-1500 to SCADA over OPC UA from TIA Portal.
- If the project is set to run only when the hardware part number and firmware match exactly, relax that check for the virtual CPU.
- Start S7-PLCSIM Advanced, enable TCP/IP on a single adapter, point it at the local network adapter, and enter an IP address and subnet mask for the instance.
- Download the project to the instance and switch it to RUN.
- Point the SCADA's OPC UA client at the instance address and the CPU's UA endpoint — for example opc.tcp://192.168.10.20:4840, with 4840 the OPC UA default unless the CPU properties changed it — and accept the server certificate on first connect.
Worked example — keeping the instance reachable. Give the adapter 192.168.10.1 with mask 255.255.255.0, the instance 192.168.10.20, and the SCADA PC 192.168.10.5. AND each address with the mask: the instance gives 20 AND 0 = 0, so 192.168.10.0; the adapter gives 1 AND 0 = 0, so 192.168.10.0; the SCADA PC gives 5 AND 0 = 0, so 192.168.10.0. Three identical results mean one /24 network and no gateway needed. Set the instance to 192.168.11.20 instead and its result reads 192.168.11.0 against 192.168.10.0 — different networks, and the client cannot reach the endpoint without a router.
How do I prove the simulated SCADA link end to end? #
Force values out of the simulator, write one back from the SCADA, then cut the link: a good test proves the read path, the write path and the bad-quality and communication-loss alarm behavior inside one session.
- Confirm the simulated CPU is in RUN: indicator lit, OB1 cycling in a watch table.
- From the OPC server's host, ping the address the server will dial, then run the server's own connection test; expect replies and a good session.
- Force a bit and a word in the simulator and expect both on screen within one update period — on a 1000 ms subscription the deadline is 1000 ms.
- Write a value from a SCADA faceplate and expect it in the CPU watch table; that closes the write path.
- Stop the CPU or drop the adapter and expect the tags to go to bad quality and the communication-loss alarms to fire.
Safety note: a SCADA trained against the simulator will push writes just as eagerly at a real CPU, so re-point or write-protect every output before the tested project touches live equipment.
When the bench graduates into the station that runs the SCADA client at the machine for FAT or commissioning, that client belongs on an industrial panel PC rather than a desktop tower.
Why does the OPC connection still fail when everything looks right? #
Almost every stubborn failure here is one of five things: the S7OIEHSX service still holding the port, a firewall on the adapter, a rack or slot mismatch, the OPC server bound to a different adapter, or an expired 21-day trial that has stopped the simulator.
- The service still holds the port. Until S7OIEHSX stops, the bridge cannot bind TCP port 102;
net stop s7oiehsxclears it for the session. - A firewall on the adapter. The bridge route needs inbound access to that port open on the adapter, and the OPC UA route needs its endpoint port — 4840 by default.
- Rack or slot mismatch. Compare the mapping in the bridge with the OPC server's device entry; the failure is quiet — right address, refused session.
- Wrong adapter. The bridge binds exactly one adapter, and a server dialing the PC's other address finds nothing.
- Expired evaluation. After 21 days the simulator stops; the fix is a fresh trial from the manufacturer's portal or a license, never a workaround.
Work the list top down; each item either clears the fault or names the layer that broke. Decision, restated for each case: classic S7-300 project — PLCSIM plus the NetToPLCSim bridge; TIA Portal project with an OPC UA SCADA — S7-PLCSIM Advanced with the CPU's OPC UA server; SCADA without OPC UA — the bridge with an S7 driver, or the Modbus TCP bench from the first section.
Questions asked
Can I skip the bridge by running the OPC server on the same PC as PLCSIM?
Yes. PLCSIM accepts connections from applications on its own host through the PLCSIM interface, so an OPC server installed on that same PC reaches the simulated CPU without NetToPLCSim. Point the server's connection at the local PLCSIM route and test it. The bridge becomes necessary only when a second machine, or a driver that dials a plain TCP/IP address, must join the bench.
Why does the OPC UA client reject the virtual CPU on first connect?
The client is handed the simulated CPU's server certificate and closes the session because it does not trust that certificate yet. Import it into the client's trust list, then confirm both sides share a security policy. Relaxing the policy is acceptable on a bench, but put signing or encryption back before the project goes near a production system.
Why does an OPC UA browse return an empty address space?
The CPU's OPC UA server is running, but nothing was exposed to it. The server publishes only the tags or server interfaces selected in the CPU properties, so reopen those settings, mark the data the SCADA needs, compile, and download again. The address space appears on the client once it reconnects after the download.
Is a simulated CPU good enough for final SCADA acceptance testing?
For screens, alarms, trends, addressing and communication-loss behavior, yes — those are what a simulated link tests well. Keep the final acceptance run on the physical CPU, because scan times, response behavior, I/O faults and network loading on real hardware differ from a simulator, and a SCADA that has only seen PLCSIM has seen none of them.