Obsidean_VM/01-Documentation/Siemens/PLC Siemens/NetToPLCSim to use SNAP7 wi...

8.4 KiB


It is important that the order of loading the software:

  1. ==Start NetToPLCSim first== with administrator privileges
  2. Allow NetToPLCSim to capture port 102
  3. Start Simatic Manager and S7-PLCSIM
  4. Load your program into PLCSIM
  5. Configure and start NetToPLCSim server

SNAP7 with S7-PLCSIM V5.4: Real-World Configuration Guide

NetToPLCSim is absolutely essential for SNAP7 connectivity with S7-PLCSIM V5.4 - direct connections consistently fail across all user attempts. This comprehensive guide synthesizes real user experiences and technical documentation to provide practical solutions for S7-300 simulation projects using Simatic Manager.

Critical discovery: Direct SNAP7 connection impossible

Multiple user experiences confirm that direct SNAP7-to-PLCSIM connection never works with S7-PLCSIM V5.4 SP8 + Upd2. Users consistently encounter "TCP: Connection refused" and "ISO timeout" errors when attempting direct connections, even with correct IP addresses and port configurations. The SNAP7 developer Davide Nardella confirmed this limitation, making NetToPLCSim the only viable solution.

Real user success stories and configurations

Bernard Bussy's documented attempt provides the most detailed failure case study. Using Windows 7 64-bit with Python 2.7.14 and S7-PLCSIM V5.4, he configured an S7 417-4 CPU at rack 0, slot 3 with CP 443-1 (IP: 192.168.0.22). Despite trying both standard port 102 and alternative port 3389 (discovered via Wireshark analysis), all direct connection attempts failed with timeout errors.

PLCTalk.net user success came through a two-VM setup: VM1 running Windows 7 32-bit (IP 192.168.1.1) with Simatic Manager and NetToPLCSim, and VM2 running Windows 7 64-bit (IP 192.168.1.2) with the SCADA application. This configuration achieved full communication after proper network setup using host-only adapters on the same virtual network.

Stack Overflow community consensus across multiple discussions consistently recommends NetToPLCSim with the standard advice: "You need to install NetToPLCSim which allows you to connect to the PLC to test your application using the network interface of the PC running the simulation."

Working technical configuration details

NetToPLCSim bridge setup (required)

Standard configuration that works:

  • Network IP: Use your PC's actual network interface IP
  • PLCSIM IP: The virtual PLC IP configured in your S7 project
  • Rack/Slot: 0/2 (most common working configuration)
  • Connection Resource: 1=PG, 2=OP, 3=Step7Basic
  • TCP Port: 102 (standard S7 communication port)

SNAP7 connection code:

import snap7
plc = snap7.client.Client()
plc.connect('[NetToPLCSim_Network_IP]', 0, 2)  # Use NetToPLCSim's Network IP
print(plc.get_cpu_state())  # Test connection

Connection verification test:

C:\>telnet [PLCSIM_IP] 102

If successful, the screen goes blank. If failed, you'll see a connection error.

Hardware configuration requirements

For S7-300 simulation projects, your Step 7 configuration must include:

  • CPU: S7-300 CPU with Ethernet capability (PN-CPU recommended)
  • Communication module: CP-343-1 Ethernet card if using standard CPU
  • IP addressing: PLC and PC must be on same subnet (e.g., 192.168.1.x)
  • PG/PC interface: Configured for TCP/IP communication
  • Block access: Disable "optimized block access" for data block operations

Critical issues with S7-PLCSIM V5.4 SP8 Update 2

API access bug in Update 2 breaks COM object access with the error: "S7PROSIMLib.S7ProSimClass cannot be converted to S7PROSIMLib.IS7ProSim." This prevents PLC-Lab, Factory I/O, and other third-party tools from connecting properly.

Extremely slow loading times plague Update 2, with users reporting 10-15 minute loading times for larger projects. One SPS-Forum user described this as making the software "practically unusable."

Windows 11 compatibility issues existed in the original SP8 release, causing frequent crashes. While Update 2 addressed the crashes, it introduced the performance problems.

Recommended solution: Upgrade to S7-PLCSIM V5.4 SP8 Update 3, which resolves both the API bugs and loading time issues while maintaining Windows 11 compatibility.

Service management and startup procedures

Critical startup sequence for success:

  1. Restart your computer completely
  2. Start NetToPLCSim first with administrator privileges
  3. Allow NetToPLCSim to capture port 102
  4. Start Simatic Manager and S7-PLCSIM
  5. Load your program into PLCSIM
  6. Configure and start NetToPLCSim server

Essential service management:

  • Stop S7DOS Help Service: net stop s7oiehsx
  • Ensure port 102 is available for NetToPLCSim
  • Run NetToPLCSim as Administrator (non-negotiable requirement)
  • Allow NetToPLCSim through Windows Firewall

Differences from TIA Portal simulators

S7-PLCSIM V5.4 from Simatic Manager differs significantly from TIA Portal's integrated simulation:

Architecture limitations in V5.4 include no native TCP/IP communication support, requiring NetToPLCSim for all external connections. The simulator uses internal Softbus communication and lacks the virtual Ethernet adapters found in TIA Portal versions.

Programming compatibility issues mean TIA Portal programs cannot be directly uploaded to S7-PLCSIM V5.4, and the simulator is limited to S7-300/400 series PLCs only.

Network access methodology requires the NetToPLCSim bridge, while TIA Portal simulators have built-in virtual network adapters and native TCP/IP support with integrated web server simulation.

Step-by-step verified procedures

Basic SNAP7 + S7-PLCSIM connection procedure

  1. Install S7-PLCSIM V5.4 SP8 Update 3 for optimal stability
  2. Create your Step 7 project with S7-300 CPU and Ethernet capability
  3. Configure network addressing ensuring PC and PLC are on same subnet
  4. Set PG/PC interface to TCP/IP access point
  5. Download and test in PLCSIM to verify program functionality
  6. Download NetToPLCSim from SourceForge and run as Administrator
  7. Configure NetToPLCSim station with your PLCSIM IP and rack/slot settings
  8. Connect with SNAP7 using NetToPLCSim's Network IP address

Multiple instance setup (advanced)

Users have successfully run multiple PLCSIM instances by configuring multiple IP addresses on their network adapter. Each PLCSIM instance requires a unique IP address, and NetToPLCSim manages multiple stations simultaneously. This allows SNAP7 clients to connect to different simulation instances as needed.

Forum discussions and community resources

SourceForge SNAP7 forums contain extensive discussions about PLCSIM connectivity, with over 567 general discussion topics addressing various connection challenges.

SPS-Forum German automation community provides detailed troubleshooting for S7-PLCSIM V5.4 SP8 issues, particularly the performance problems in Update 2.

PLCTalk.net discussions document real-world integration experiences, especially multi-VM configurations and InTouch SCADA integrations.

Stack Overflow automation questions consistently point to NetToPLCSim as the solution, with multiple threads confirming this approach works across different programming languages and frameworks.

Version-specific compatibility requirements

S7-PLCSIM V5.4 compatibility matrix:

  • SP8: Works with NetToPLCSim but has occasional Windows 11 crashes
  • SP8 + Upd1: Improved stability
  • SP8 + Upd2: Windows 11 support but API bugs and severe performance issues
  • SP8 + Upd3: Recommended version - fixes all known issues

Service timing requirements are critical: NetToPLCSim must capture port 102 before any Siemens software starts, making the restart-and-sequence approach essential for reliable operation.

Multiple instance limitations exist in SP8, with users reporting successful operation limited to 2-3 stable instances simultaneously.

Conclusion

Successfully using SNAP7 with S7-PLCSIM V5.4 SP8 + Upd2 requires understanding that NetToPLCSim is not optional - it's the only method that works. The community has extensively documented that direct connections fail consistently, but the NetToPLCSim bridge approach provides reliable communication when properly configured. Users should upgrade to Update 3 to avoid the significant performance and API issues present in Update 2, and must follow the specific service management and startup procedures to ensure successful operation.