Configuring WinCC User Archive Read and Write Managers in SIMATIC PCS 7 APF: Connection ID Parameterization

Configuring WinCC User Archive Read and Write Managers in SIMATIC PCS 7 APF: Connection ID Parameterization

In SIMATIC PCS 7 Advanced Process Functions (APF), configuring the User Archive Read Manager (FB_UA_RM) and Write Manager (FB_UA_WM) requires coordinating the S7 connection parameter ID with the channel identifier R_ID. The parameter ID must match the exact hexadecimal connection ID defined in NetPro for the S7 connection between the Automation Station and the WinCC OS application. Every manager block sharing the same connection must be assigned a unique R_ID (1 to 65535) to multiplex transactions. In addition, parameter UA_NO must match the target User Archive ID, and the data buffer DB must be sized to accommodate the complete archive field structure.

Table of Contents

Architecture of User Archive Manager Blocks (FB_UA_RM / FB_UA_WM)

SIMATIC PCS 7 Advanced Process Functions (APF) delivers standardized technological modules for material management, recipe execution, and tracking in process manufacturing. The core interface bridging the PLC runtime program with the WinCC SQL database consists of two standard function blocks:

  1. FB_UA_RM (User Archive Read Manager - FB1102): Reads complete data records (or single fields) from a WinCC User Archive table and populates an S7 Data Block (DB) in the controller.
  2. FB_UA_WM (User Archive Write Manager - FB1101): Takes process data, actual batch quantities, and material IDs from an S7 Data Block and writes or updates records in the WinCC User Archive table.

Both blocks execute asynchronous data transfers using the underlying system communication blocks BSEND and BRCV. Proper parameterization of connection pointers is mandatory to prevent communication deadlocks.

NetPro S7 Connection Configuration and Hexadecimal ID Assignment

The parameter ID on both FB_UA_RM and FB_UA_WM specifies the logical communication link between the AS and the OS:

  • Configuring in NetPro: In NetPro, select the CPU and insert a new connection to the WinCC Application. The connection type must be S7 Connection (or S7 Named Connection in PCS 7 multiprojects).
  • The Hexadecimal Connection ID: Open the connection properties dialog in NetPro. Note the value displayed in the field 'Block parameters: Local ID' (for example, W#16#0001 or 16#000A).
  • Assigning in CFC: In the Continuous Function Chart, set the input parameter ID of FB_UA_RM and FB_UA_WM to this exact hexadecimal value (16#0001). If ID is parameterized with an invalid or un-downloaded connection number, the block immediately halts with error QBS1_ERR = 1.

Multiplexing Transactions via the R_ID Channel Identifier

Because an automated plant may contain dozens of silos, material transfer lines, and dosing stations, multiple Read and Write managers frequently communicate across a single shared S7 connection:

  • Role of R_ID: The input parameter R_ID (DWORD) defines the unique transaction channel identifier for that specific block instance.
  • Strict Uniqueness Rule: Every instance of FB_UA_RM and FB_UA_WM sharing the same connection ID must have a unique R_ID (e.g., R_ID = DW#16#00000001 for Silo 1 Write, DW#16#00000002 for Silo 1 Read, DW#16#00000003 for Silo 2 Write).
  • Telegram Collision: If two blocks share identical ID and R_ID parameters, incoming BRCV telegrams cannot be demultiplexed, causing corrupt buffer overwrites and communication timeouts.

Data Buffer Data Block (DB) Structuring and Length Alignment

Data read from or written to the User Archive is staged in a dedicated S7 Data Block:

  • Archive Number (UA_NO): Parameter UA_NO (INT) must match the numeric ID assigned to the target User Archive table in WinCC User Archive Editor (e.g., Archive ID 1 for Material Master, 2 for Silo Inventory).
  • Data Buffer Pointer (ANY Pointer): Input parameter DB_NO and DB_OFF (or ANY_DATA) points to the memory area where records are mapped.
  • Byte-Length Alignment: The byte size of the S7 Data Block structure must match the field definitions in WinCC User Archive exactly. If the User Archive contains 5 fields totaling 64 bytes, but the S7 Data Block only allocates 48 bytes, the read/write transaction fails with length mismatch error QERR_LEN = 1.

Comparative Parameter Schedule: FB_UA_RM vs FB_UA_WM Configuration

The following table summarizes the mandatory block parameters across both managers:

Parameter NameData TypeDescription and Configuration RequirementIDWORDHexadecimal Local Connection ID from NetPro (e.g. 16#0001)R_IDDWORDUnique transaction channel ID (e.g. DW#16#00000001)UA_NOINTUser Archive Table ID from WinCC User Archive EditorFIELD_NOINTField number (0 = Entire record; >0 = Specific field ID)REC_NODINTTarget Record Number in the archive tableDB_NOINTS7 Data Block number holding the staging bufferDB_OFFINTStarting byte offset within the Data BlockSTARTBOOLRising-edge trigger initiating the read or write transactionQBUSYBOOLStatus output: 1 while asynchronous transaction is in progressQERRBOOLStatus output: 1 if transaction aborted with error

Step-by-Step Commissioning and Error Handling Workflow

Follow this sequence to commission APF User Archive communication:

  1. Configure NetPro S7 Connection: Insert an S7 connection between AS and WinCC OS. Download connection tables to AS and compile NetPro.
  2. Build Staging Data Block: Create an S7 DB matching the User Archive field schema (matching INT, REAL, STRING, and BYTE datatypes).
  3. Parameterize CFC Blocks: On FB_UA_WM, set ID, unique R_ID, UA_NO, DB_NO, and DB_OFF.
  4. Trigger Transaction: Set REC_NO = 1, populate data in the DB, and generate a positive edge pulse on input START.
  5. Monitor Outputs: Verify that QBUSY transitions to 1 and then returns to 0 with QERR = 0 and QDONE = 1.
  6. If QERR = 1, inspect diagnostic output QSTATUS to identify the specific error code (e.g. invalid connection ID, timeout, or archive lock).

Verification

Confirm that APF User Archive transactions execute reliably:

  1. Trigger a write transaction from FB_UA_WM by pulsing START.
  2. Open WinCC User Archive Control in WinCC Runtime; confirm that the target record row updates immediately with the newly transmitted values.
  3. Modify a value in the User Archive row from the WinCC faceplate.
  4. Trigger a read transaction on FB_UA_RM; confirm in S7 DB monitoring that the modified value is transferred into controller RAM.
  5. Verify that QBS1_ERR remains 0 across repeated cyclic operations.

Limitations and Operational Precautions

Adhere to the following operational precautions:

  • Never Pulse START While QBUSY is True: The manager blocks execute asynchronous multi-cycle transactions; pulsing START while QBUSY == 1 aborts the active transaction and corrupts SQL communication buffers.
  • User Archive Concurrency Locks: WinCC User Archives locks records during active SQL updates; ensure multiple PLCs do not attempt to write the same REC_NO simultaneously.
  • SCL Source Integrity: Do not modify internal APF manager block logic; use wrapper charts if custom signal pre-processing is required.

Engineer FAQ

Can FB_UA_RM read a single field from a User Archive record instead of the whole row?

Yes. By setting parameter FIELD_NO to a specific field number (>0), the block reads only that individual field into the staging buffer.

How do I know when an APF read or write transaction has finished?

Monitor output QBUSY. While QBUSY is 1, the transaction is executing. When QBUSY returns to 0, QDONE = 1 indicates success and QERR = 1 indicates failure.

What happens if the communication cable is unplugged during an APF User Archive transaction?

The block attempts communication retries until internal BSEND/BRCV timeouts expire, then sets QBS1_ERR = 1 and QERR = 1 with a timeout diagnostic code.

Technical References

Related Articles

Related Tags

  • Advanced Process Functions (APF)
  • FB_UA_RM Read Manager
  • FB_UA_WM Write Manager
  • User Archives
  • NetPro Connection ID
  • R_ID Channel Identifier
6 respuestas