1. Problem Description
Bidirectional OPC Data Exchange (OPC DX) configurations between SIMATIC NET OPC DX Server and a third-party OPC DX server co-located on the same industrial PC fail to re-establish when the workstation recovers from an uncontrolled power loss, even though:
- Auto-logon successfully logs the operator back into Windows.
- The third-party OPC DX server is configured to run as a Windows service and is fully started before the SIMATIC NET components launch.
- The same configuration recovers cleanly after a graceful shutdown and restart.
The end-state after a hard reboot is consistent and reproducible:
| Indicator | Observed Value | Expected Value |
|---|---|---|
DX\Source Servers\<3rd Party OPC>\Status\ConnectionStatus |
disconnected |
connected |
DX\Source Servers\<3rd Party OPC>\Status\SourceServerConnected |
TRUE (stale) |
TRUE (fresh handshake) |
| Bidirectional item updates | Frozen at last good value | Live |
Manual toggle of SourceServerConnected FALSE→TRUE |
Reconnects immediately | — |
The error reported inside the SIMATIC NET log file OPC_DX.err is:
*** SIMATIC NET OPC-Server DataAccess-V1.0A/2.05 DataExchange-V1.0 (C) SIEMENS AG 2004: Start [V01.03.00.6 release]
*** Instance: C:\Program Files\SIEMENS\SIMATIC.NET\opc2\bin\opcdxserver.dll
*** Date: 15. 8.2006
6:27:36,991|009C* >DllMain DLL_PROCESS_ATTACH
6:27:36,991|009C* <DllMain DLL_PROCESS_ATTACH
6:27:37,862|009C* -> DXInit
6:27:37,862|009C* > GlobalInitialize
6:27:37,862|009C* < GlobalInitialize
6:27:38,142|009C* <- DXInit [hr=0]
6:28:22,259|009C* -> DXStart
6:28:22,259|009C* <- DXStart [hr=0]
6:28:22,259|0120* FAILED ConnectIVar2: no connect since the RT Status is DOWN
Note the misleading [hr=0] on DXStart: the DX server returns success from DXStart(), but the internal connection attempt ConnectIVar2 still fails because the SIMATIC NET runtime (the S7DOS / PC Station subsystem) is not yet in the RUN state. The error code is the internal SIMATIC NET runtime state, not an HRESULT.
2. Reference Environment
The reported failure occurs on the following configuration, which is representative of legacy Windows XP/2003 industrial PC installations still in service:
| Component | Specification |
|---|---|
| Hardware | Siemens BoxPC 420, PIII 933 MHz, 512 MB RAM, 40 GB HDD |
| Operating System | Windows XP Professional SP1 (not XP Embedded) |
| SIMATIC NET version | 2005, V6.3 SPx, build 3228 (S7 OPC + OPC DX enabled) |
| Third-party OPC DX server | KEPServerEX V4.190.341 (Modbus-TCP OPC + DX) |
| PLC side | SIMATIC S7-300, CPU 315-2 with CP 343-1 IT/IE-ISO |
| PC network | NIC-1 → Siemens S7 subnet; NIC-2 → KEPwareEX field network |
| Power-loss recovery | BIOS Power-On After AC Fail = ON, Windows auto-logon enabled |
Equivalent configurations on Windows 7 Embedded / Windows 10 IoT with SIMATIC NET V14 SP1 (or later) exhibit the same defect if the SIMATIC NET service is allowed to start in parallel with other OPC services without an explicit dependency.
3. Architecture of the Failure
OPC DX on SIMATIC NET relies on three coordinated components that are started in sequence by the PC Station:
-
SIMATIC NET Configuration Console (loaded configuration from
PCStation.xml). -
S7DOS / PC Station runtime (the
S7OUCIAx/SIMATIC NET Configuration Serverservice) which brings the configured S7 connections to the CPU intoRUN. -
OPC DX Server (opcdxserver.dll), which only attempts
ConnectIVar2to a peer DX source server once the runtime is inRUN.
When the third-party DX service starts faster than the SIMATIC NET runtime, the OPC DX server receives a request to handshake with a peer whose underlying S7 transport is not yet up. The handshake fails once, DXStart returns hr=0, and the DX source connection is never retried until the operator toggles SourceServerConnected.
4. Root Cause Analysis
Three independent conditions must all be true to reproduce the fault:
- No service dependency declared. The Windows service for the third-party DX server does not depend on the SIMATIC NET service (or vice versa), so the Windows Service Control Manager starts them in parallel.
-
SIMATIC NET PC Station is not in
RUNwhenConnectIVar2is issued. The runtime has loaded the project but the S7 connection establishment is still in progress (typically 5–25 s after logon on legacy hardware). -
OPC DX does not internally retry on
RT Status is DOWN. OnceConnectIVar2fails, the source connection transitions todisconnectedand remains so until a manual trigger forces a re-handshake.
On graceful shutdown/restart the third-party service either does not start early enough or the SIMATIC NET Configuration Console times the DX start to coincide with the S7 connection being up; the race condition is masked. On hard power-loss recovery, both services come up in parallel, the race is exposed, and the DX server loses the only chance it takes to complete ConnectIVar2.
DependOnService entries. See the Microsoft recovery guidance at learn.microsoft.com — Auto restart normally without recovery after power outage for the related (but distinct) WinRE behaviour.5. Diagnostic Checklist
Before changing configuration, confirm the diagnosis with the following sequence:
- Open Start → Programs → Siemens Automation → SIMATIC → SIMATIC NET → Commissioning PC Station and read the status of the S7 connection to the CPU 315-2. It should report
Connectedwith a validStatus of the S7 connectionbefore proceeding. - Capture the timestamp of the
S7DOSservice reachingRUNNINGfrom the Windows Event Log (Application log, sourceS7DOS, event id 1). - Open
C:\Program Files\Siemens\SIMATIC.NET\opc2\bin\OPC_DX.errand confirm the presence ofFAILED ConnectIVar2: no connect since the RT Status is DOWNon every cold boot. - Read the third-party DX service start time (Event Log → source
Service Control Manager→ event id 7036). The two events should be less than ~1 s apart for the race condition to occur. - In the OPC Scout (or any DA client), navigate to
DX\Source Servers\<3rd Party>\Statusand confirmConnectionStatus=disconnectedwhileSourceServerConnected=TRUE.
If all five items match, the root cause is service ordering and the resolution in §6 applies directly.
6. Resolution — Service Dependency Configuration
Force the third-party DX service to start only after the SIMATIC NET runtime is in RUNNING, and force the OPC DX server to start only after the third-party service is up. This eliminates the race entirely.
6.1 Identify the exact service names
sc queryex type= service state= all | findstr /i "simatic kepware"
Typical results on a SIMATIC NET 2005 V6.3 install with KEPwareEX:
| Service Display Name | Internal Name | Startup Type |
|---|---|---|
| SIMATIC NET Configuration Server | S7OUCIAx |
Automatic |
| SIMATIC NET OPC Server | OPCServer |
Automatic (trigger start) |
| KEPware ServerEx | KEPwareServerEx |
Automatic |
6.2 Add explicit dependencies
Open an elevated command prompt and execute:
REM KEPwareEx must wait for the SIMATIC NET runtime
sc config "KEPwareServerEx" depend= "S7OUCIAx/OPCServer"
REM Optional: the SIMATIC NET OPC DX server must wait for KEPwareEx
sc config "OPCServer" depend= "S7OUCIAx/KEPwareServerEx"
depend= is mandatory. A single space will be interpreted as "clear all dependencies". Use a forward slash to separate multiple dependencies, not a backslash or a comma.Verify with:
sc qc "KEPwareServerEx"
[DEPENDENCIES]
: depends on S7OUCIAx
: depends on OPCServer
6.3 Reorder the OPC DX start delay (alternative)
If you cannot modify the third-party service (for example, on a supported vendor build), insert a 30-second delay before the SIMATIC NET OPC DX component. This is done by editing the SIMATIC NET PC Station project and changing the OPC DX module's start-up time from 0 to 30 seconds under Properties → Startup:
- Open Station Configuration Editor.
- Select the OPC DX index.
- Open Properties → Startup Parameters and set
Delay [s] = 30. - Save the station and re-download to the PC Station.
7. Resolution — Manual Re-Handshake Workaround
If a service restart is impossible in the field, the operator can restore the DX connection with a single tag toggle from any OPC DA client, including the SIMATIC NET OPC Scout:
Item path : DX\Source Servers\<3rd Party>\Status\SourceServerConnected
Action : Write FALSE (forces disconnect)
Wait : 500 ms
Action : Write TRUE (forces re-handshake)
Verify : Read ConnectionStatus → must be "connected" within 3 s
Scripted equivalents are straightforward in VBScript, PowerShell, or C# using the OPC Automation wrapper. Sample PowerShell:
$opc = New-Object -ComObject OPC.Automation
$server = $opc.Connect("OPC.SimaticNET", "<host>")
$server.OPCGroups.Add("DXFix").IsActive = $true
$item = $server.OPCGroups.Item("DXFix").OPCItems.AddItem(
"DX\Source Servers\KEPwareEx\Status\SourceServerConnected", 1)
$item.Write(0) # FALSE
Start-Sleep -Milliseconds 500
$item.Write(1) # TRUE
8. Resolution — Hardening the Configuration
| Hardening Item | Action | Rationale |
|---|---|---|
| BIOS Power-On After AC Fail | Set to Power On
|
Allows auto-recovery |
| Windows auto-logon | Enable with a dedicated service user, not Administrator | Reduces attack surface |
| UPS instead of mains | Add a 5-minute line-interactive UPS and shut down gracefully on battery low | Eliminates the entire failure class |
| PC Station project | Use the SIMATIC NET Station Configuration Editor to download after every change; never edit PCStation.xml by hand |
Prevents silent corruption |
| KEPwareEx / other DX server | Configure for Auto-restart on failure with retry count ≥ 5, retry interval 5 s | Covers transient runtime blips |
| SIMATIC NET V6.3 | Apply latest hotfix via SIOS entry 27013570 — SIMATIC NET PC Software V6.3 SP3 | Includes several DX-runtime fixes |
9. Verification Procedure
- Reboot the PC by pulling the mains plug while the OS is running. Allow the BIOS to power-on after AC restore.
- Log in via auto-logon. Do not interact with the desktop.
- From a remote terminal, read the Event Log Application entries for
S7DOS(event id 1,PC Station is in RUN) and for the KEPwareEx service (event id 7036, stateRUNNING). The KEPwareEx start must be after the S7DOSRUNentry. - Open OPC Scout and verify
DX\Source Servers\KEPwareEx\Status\ConnectionStatus=connected. - Read three process values from the CPU 315-2 via DX; values must update within the configured poll rate.
- Repeat steps 1–5 three consecutive times. A stable fix will pass all three cycles.
10. Field-Commissioning Notes
- Different network adapters: the bidirectional DX uses NIC-1 to reach the S7-300 and NIC-2 to reach the KEPwareEx field network. The Service Control Manager dependency is independent of the network adapter, so the same fix applies.
- Firewall: the SIMATIC NET runtime uses UDP port 102 (ISO-on-TCP) to the CP 343-1 and TCP ports 38410–38413 for DX peer traffic. Confirm Windows Firewall allows these on both NICs after each patch Tuesday.
-
Anti-virus: exclude
C:\Program Files\Siemens\SIMATIC.NETand the third-party OPC server installation folder from real-time scanning. AV-induced service start jitter has been observed to re-introduce the race even after dependencies are configured. -
Virtualization: if the runtime is moved to a VM, configure the VM to start before user logon (Automatic start, not Manual) and replicate the same
DependOnServicechain inside the guest.
For additional background on the OPC DX specification itself, see the OPC Foundation — OPC Data Exchange (DX) overview, and the SIMATIC NET OPC DX Programming Interface manual distributed with the SIMATIC NET PC Software DVD.
What does "RT Status is DOWN" mean in the OPC_DX.err log?
It is the internal SIMATIC NET runtime state, not a Windows or HRESULT error. It indicates that the OPC DX server attempted ConnectIVar2 to a peer DX source server before the SIMATIC NET PC Station runtime (S7DOS / S7OUCIAx) had finished bringing its S7 connections to the RUN state. The peer handshake is therefore aborted and never retried automatically.
Why does a graceful restart work but a hard reboot fail?
Graceful shutdown gives Windows and the SIMATIC NET Configuration Console time to sequence service shutdowns, and the next start is paced by user-driven logon. After a power loss, the Service Control Manager starts S7OUCIAx, OPCServer and the third-party DX service in parallel; the race window is large enough on legacy hardware (PIII 933 MHz) for ConnectIVar2 to fire while the runtime is still in STARTING.
How do I add a service dependency between SIMATIC NET and a third-party OPC server?
Use sc config "<ThirdPartyService>" depend= "S7OUCIAx/OPCServer" from an elevated command prompt. Verify with sc qc "<ThirdPartyService>" and look for the [DEPENDENCIES] block. The space after the = is mandatory, and dependencies are separated by a forward slash.
Can I recover without restarting the PC?
Yes. From any OPC DA client, write FALSE to DX\Source Servers\<3rd Party>\Status\SourceServerConnected, wait 500 ms, then write TRUE. The DX server forces a fresh ConnectIVar2 against the now-running runtime and ConnectionStatus returns to connected within ~3 s.
Is the same defect present in modern SIMATIC NET versions?
The defect is a service-ordering race and exists in every SIMATIC NET version that uses the PC Station concept. Modern releases (V14 SP1 and later) add an internal retry on RT Status is DOWN, but the safe and recommended fix on every version remains the explicit DependOnService chain plus a small UPS to avoid hard power-loss restarts.