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
- The BSEND/BRCV S7 Named Connection Communication Channel
- Why Classic S7-PLCSIM (V5.4) Rejects APF Block Communication
- S7-PLCSIM Advanced (V2.0+) as the Modern Virtual Simulation Solution
- Comparative Simulation Matrix: Classic PLCSIM vs PLCSIM Advanced for APF
- Step-by-Step Configuration Workflow for APF Virtual Testing
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
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) andBRCV(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:
- 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.
- Communication Abort: When
FB_UA_RMorFB_UA_WMexecutes its initial handshake in PLCSIM, the internalBSENDcall 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/BRCVhandshakes 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:
BSEND / BRCV HandshakeQBS1_STA = 1)Step-by-Step Configuration Workflow for APF Virtual Testing
Follow this sequence to validate APF material tracking using advanced virtualization:
- Deploy S7-PLCSIM Advanced: Launch S7-PLCSIM Advanced, select 'PLCSIM Virtual Ethernet Adapter', and start a virtual S7-400/1500 instance.
- Configure IP Networking: Assign the virtual controller an IP address residing on the same subnet as the WinCC Engineering Station.
- Configure S7 Connection in NetPro: In NetPro, verify that the S7 connection between the AS and the OS WinCC Application is compiled and downloaded.
- Parameterize APF Blocks: In CFC, ensure
FB_UA_RMandFB_UA_WMhave parameterIDset to the exact hexadecimal connection ID from NetPro, andR_IDset to a unique channel number. - Activate WinCC Runtime: Launch WinCC Runtime with User Archives active.
- Verify that
FB_UA_WM.QBS1_ERR = 0and 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:
- In CFC test mode, inspect
FB_UA_WMandFB_UA_RM; confirm thatQBS1_ERR = 0andQBS1_STA = 0(Healthy connection). - Simulate a material transfer into Silo 1 by pulsing the write trigger
STARTonFB_UA_WM. - 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.
- Modify a setpoint in the User Archive; pulse
STARTonFB_UA_RMand 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 ofFB_UA_RMandFB_UA_WMsharing the same S7 connection must possess a uniqueR_IDparameter; duplicateR_IDvalues 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
- SIMATIC PCS 7 Advanced Process Functions (APF) Manual (Entry ID: 109746516)
- S7-PLCSIM Advanced Function Manual (Entry ID: 109746517)
- WinCC V7.3 / V7.4 System Manual: User Archives
- Siemens Industry Online Support (SIOS) FAQ: APF Communication Architecture (Entry ID: 109740190)
Related Articles
- Configuring WinCC User Archive Read and Write Managers in SIMATIC PCS 7 APF
- Configuring WinCC User Archive Control Column Persistence and User Authorization
- SIMIT Simulation with S7-PLCSIM Advanced: HWCN-Export and Signal Mapping
Related Tags
- Advanced Process Functions (APF)
- S7-PLCSIM Simulation
- WinCC User Archives
- FB_UA_WM / FB_UA_RM
- BSEND / BRCV
- S7 Named Connections