Simulating SIMATIC PCS 7 Advanced Process Functions (APF) with S7-PLCSIM: Named Connections and User Archive Handshakes

Simulating SIMATIC PCS 7 Advanced Process Functions (APF) with S7-PLCSIM: Named Connections and User Archive Handshakes

Simulating SIMATIC PCS 7 Advanced Process Functions (APF V2.1 / V9.0) with classic S7-PLCSIM (V5.4) is not directly supported because APF utilizes blocks FB_UA_RM and FB_UA_WM which communicate with WinCC User Archives via BSEND/BRCV over S7 Named Connections, which classic S7-PLCSIM cannot process. Attempting this causes communication error QBS1_ERR = 1 and status QBS1_STA = 1 (connection cannot be established). To simulate APF material and storage management without physical controllers, use S7-PLCSIM Advanced (V2.0+) with its virtual Ethernet network adapter, or configure a simulated S7 TCP connection with explicit TSAPs as outlined in specialized APF simulation workarounds.

Table of Contents

Advanced Process Functions (APF) Architecture and WinCC User Archive Handshakes

SIMATIC PCS 7 Advanced Process Functions (APF) is the specialized engineering add-on designed for hybrid industries (food & beverage, pharmaceuticals, bulk chemicals) requiring granular material tracking, silo storage management, dosing automation, and parameter set management. APF bridges the controller execution layer with relational database tables in WinCC User Archives.

When tracking material quantities in silos or executing recipe parameter sets, controller function blocks—specifically FB_UA_RM (User Archive Read Manager) and FB_UA_WM (User Archive Write Manager)—execute transactional handshakes with WinCC User Archives. These handshakes transfer structured data records bidirectionally to ensure that inventory levels and dosing parameters remain strictly synchronized between the AS and SQL Server.

The BSEND/BRCV S7 Named Connection Communication Channel

The core mechanism underlying APF data transmission relies on Siemens high-volume communication blocks:

  • BSEND (SFB12) and BRCV (SFB13): Unlike standard cyclic tag polling, APF utilizes block-oriented, acknowledged data transfers to send complex data structures (material IDs, lot numbers, actual weights, timestamps) in single transactional frames.
  • S7 Named Connections: To ensure symbolic routing and avoid hardcoded communication IDs, PCS 7 binds these blocks to S7 Named Connections configured in NetPro between the AS controller and the WinCC OS Application. Each manager block (FB_UA_RM/FB_UA_WM) is assigned a local connection ID (ID) and channel identifier (R_ID).

Why Classic S7-PLCSIM (V5.4) Rejects APF Block Communication

When an engineer attempts to simulate APF using standard classic S7-PLCSIM (V5.4), the simulation fails immediately:

  1. No Named Connection Routing: Classic S7-PLCSIM is a localized memory emulator that supports basic MPI, PROFIBUS, and elementary TCP/IP connections. It lacks the internal communication protocol stack required to resolve and route S7 Named Connections.
  2. Communication Abort: When FB_UA_RM or FB_UA_WM executes its initial handshake in PLCSIM, the internal BSEND call fails. The block immediately asserts:
    - QBS1_ERR = 1 (Communication error asserted)
    - QBS1_STA = 1 (Connection cannot be established / partner unavailable)
    Because the User Archive manager blocks cannot establish communication, material tracking tables remain empty, and silo management logic stalls.

S7-PLCSIM Advanced (V2.0+) as the Modern Virtual Simulation Solution

With the introduction of S7-PLCSIM Advanced (V2.0 and later), Siemens resolved the virtualization gap for complex communication protocols:

  • Full Virtual Ethernet Stack: S7-PLCSIM Advanced incorporates a dedicated virtual network adapter (Siemens PLCSIM Virtual Ethernet Adapter), allowing simulated controllers to operate with full IP stack functionality on the host network.
  • S7 Communication Support: PLCSIM Advanced supports S7 communication protocols, allowing virtual AS instances to establish authentic S7 connections with WinCC Runtime, enabling BSEND/BRCV handshakes to complete successfully without hardware controllers.
  • Alternative Workaround for Training Labs: For engineers restricted to classic PLCSIM, specialized APF training workarounds involve reconfiguring NetPro to replace the Named Connection with a standard configured S7 connection over TCP/IP with matching TSAP endpoints.

Comparative Simulation Matrix: Classic PLCSIM vs PLCSIM Advanced for APF

The following table compares simulation capabilities for SIMATIC PCS 7 APF:

Simulation CapabilityClassic S7-PLCSIM (V5.4)S7-PLCSIM Advanced (V2.0+)Physical S7-400 / CPU 410 ASAPF Execution in ASAlgorithmic logic runsAlgorithmic logic runs100% native executionS7 Named ConnectionsUNSUPPORTED (Fails)Supported via Virtual NICFully SupportedBSEND / BRCV HandshakeFails (QBS1_STA = 1)SucceedsSucceedsWinCC User Archive SyncBlockedFully functionalFully functionalMaterial / Silo TrackingInoperativeValidated virtuallyValidated in productionRequired LicenseStandard S7-PLCSIM licenseS7-PLCSIM Advanced licensePhysical controller hardware

Step-by-Step Configuration Workflow for APF Virtual Testing

Follow this sequence to validate APF material tracking using advanced virtualization:

  1. Deploy S7-PLCSIM Advanced: Launch S7-PLCSIM Advanced, select 'PLCSIM Virtual Ethernet Adapter', and start a virtual S7-400/1500 instance.
  2. Configure IP Networking: Assign the virtual controller an IP address residing on the same subnet as the WinCC Engineering Station.
  3. Configure S7 Connection in NetPro: In NetPro, verify that the S7 connection between the AS and the OS WinCC Application is compiled and downloaded.
  4. Parameterize APF Blocks: In CFC, ensure FB_UA_RM and FB_UA_WM have parameter ID set to the exact hexadecimal connection ID from NetPro, and R_ID set to a unique channel number.
  5. Activate WinCC Runtime: Launch WinCC Runtime with User Archives active.
  6. Verify that FB_UA_WM.QBS1_ERR = 0 and that data records written from CFC populate the WinCC User Archive database tables.

Verification

Confirm that APF communication and material tracking operate cleanly in simulation:

  1. In CFC test mode, inspect FB_UA_WM and FB_UA_RM; confirm that QBS1_ERR = 0 and QBS1_STA = 0 (Healthy connection).
  2. Simulate a material transfer into Silo 1 by pulsing the write trigger START on FB_UA_WM.
  3. Open the WinCC User Archive table in WinCC Explorer or runtime faceplate; verify that a new row appears with the correct Material ID and weight.
  4. Modify a setpoint in the User Archive; pulse START on FB_UA_RM and confirm that the updated value is read into controller RAM.

Limitations and Operational Precautions

Adhere to the following operational precautions:

  • APF Prerequisite Training: Siemens restricts delivery of APF software licenses to personnel who have completed certified Siemens APF training; consult your Siemens representative prior to procurement.
  • Unique Channel IDs (R_ID): Every instance of FB_UA_RM and FB_UA_WM sharing the same S7 connection must possess a unique R_ID parameter; duplicate R_ID values cause telegram collision and data corruption.
  • Memory Allocation: APF buffer structures require dedicated DB data areas; ensure controller work memory is sized appropriately.

Engineer FAQ

Why does APF use BSEND/BRCV instead of standard WinCC tag polling?

BSEND/BRCV enables transactional, block-oriented data transfer of complete material records and recipes in a single atomic transmission, preventing partial data writes.

What is the role of parameter R_ID on APF User Archive blocks?

R_ID defines a unique communication channel identifier on the S7 connection, allowing multiple Read and Write managers to multiplex over a single connection.

Can APF User Archives be queried directly using SQL Server Management Studio?

Yes. WinCC User Archives are stored in standard Microsoft SQL Server relational database tables and can be audited or backed up using standard SQL tools.

Technical References

Related Articles

Related Tags

  • Advanced Process Functions (APF)
  • S7-PLCSIM Simulation
  • WinCC User Archives
  • FB_UA_WM / FB_UA_RM
  • BSEND / BRCV
  • S7 Named Connections
6 respuestas