Configuring APL OperationLog and Resolving Alarm Logging MSRTCreateMsgInstance Exceptions in PCS 7

Configuring APL OperationLog and Resolving Alarm Logging MSRTCreateMsgInstance Exceptions in PCS 7

In SIMATIC PCS 7, the C-script function APL_OperationLog is the built-in Advanced Process Library utility that records operator interventions—such as setpoint modifications, manual commands, and mode changes—into WinCC Alarm Logging as Operation Messages. The runtime exception 'APL_OperationLog: MSRTCreateMsgInstanceWithComment szErrorText = Exception in MSG-API (pIAlarmData->Create(...) failed)' occurs when the preconfigured APL operation message templates are missing from the WinCC Alarm Logging database. To resolve the exception, run the OS Project Editor in WinCC Explorer, ensure the 'Create/update message configuration' option is checked under Message Configuration, and execute generation to populate the required message numbers.

Table of Contents

Executive Summary

Regulatory guidelines (such as FDA 21 CFR Part 11 and ISA-18.2) mandate strict audit trail logging of all operator actions affecting industrial process execution. In SIMATIC PCS 7, the Advanced Process Library (APL) provides native audit trail capability through the internal function APL_OperationLog. When an operator modifies a setpoint on an APL faceplate, this function captures the old value, new value, user identity, and station name, transmitting them to WinCC Alarm Logging. During commissioning or following project migrations, engineers frequently observe runtime exceptions in the WinCC Diagnose window indicating that MSRTCreateMsgInstanceWithComment failed. This article details the message routing architecture of APL_OperationLog, identifies the root cause of the API exception, and provides the verified configuration procedure.

Architecture and Fundamental Mechanics

APL Operator Logging Architecture, Message API Functions, and OS Project Editor Templates:

  • Architecture of APL_OperationLog:
  • Whenever an operator alters an analog setpoint (e.g. SP_Int in PidConL), toggles a motor (MotL), or switches operating modes on an APL faceplate, the internal faceplate script invokes APL_OperationLog().
  • The function packages metadata:
    • Tag Name (e.g. TIC_101)
    • Parameter Name (SP_Int)
    • Old Value vs. New Value
    • Logged-in Operator Name and Workstation Hostname (@CurrentUser, @LocalMachineName)
  • It routes this packet to the WinCC Message System using the lower-level API function MSRTCreateMsgInstanceWithComment().

  • The Mechanism of the MSRTCreateMsgInstance Exception:

  • In WinCC Alarm Logging, messages are identified by unique 32-bit integer Message Numbers.
  • APL operation messages require specific reserved message categories (Message Class: Operation Message / Bedienmeldung, Class ID 12 or 13, and reserved Message Numbers between 11000 and 11999 or pre-allocated ranges).
  • When APL_OperationLog calls MSRTCreateMsgInstanceWithComment(dwMsgNr, ...), the WinCC Alarm Logging API queries the runtime database for the message template definition.
  • The Failure: If the project was migrated from an older PCS 7 release, or if the OS Project Editor was never run with 'Message Configuration' selected, the required message template numbers do not exist in the database. The API throws an exception: pIAlarmData->Create(...) failed.

  • Resolution Architecture:

  • Executing the OS Project Editor with Message Configuration enabled injects the standardized Siemens APL message types, message classes, and audit log schemas into the WinCC Alarm Logging SQL database.

Step-by-Step Implementation Procedure

  1. Close WinCC Runtime on the Engineering / Testing Station:
    * Deactivate WinCC Runtime to release database write locks.

  2. Open and Configure the OS Project Editor in WinCC Explorer:
    * In WinCC Explorer, double-click OS Project Editor in the navigation tree.
    * Switch to the Message Configuration tab.
    * Ensure that the option Create/update message configuration is selected.
    * Verify that APL Operator Messages (or standard PCS 7 message templates) are checked.
    * Switch to the General tab; ensure that your chosen screen resolution is preserved.
    * Click OK to execute configuration generation.

  3. Verify Message Classes in Alarm Logging:
    * In WinCC Explorer, open Alarm Logging.
    * In the navigation tree, expand Message Classes.
    * Confirm that the class Operation Message (or Bedienmeldung) exists with active message templates.
    * Verify that message columns (Old value, New value, User, Computer) are mapped to process value blocks.

  4. Test Operation Logging in WinCC Runtime:
    * Launch WinCC Runtime.
    * Open an APL faceplate (e.g. PidConL or OpAnL).
    * Change a setpoint value and confirm the change.
    * Open the Operation List (Bedienliste) on the operator screen; confirm that the setpoint change appears with old value, new value, and operator name.

  5. Verify Diagnostics Window:
    * Open the WinCC Diagnose window (or check WinCC_sys.log); confirm that zero MSRTCreateMsgInstanceWithComment exceptions are logged.

Verification

  1. In WinCC Runtime, open the Operation Message list in the alarm banner.
  2. Execute an operator command (e.g. toggle a valve open/close or enter a new setpoint).
  3. Confirm that an operation event is logged immediately displaying: Timestamp, Tag Name, Parameter, Old Value, New Value, and User ID.
  4. Verify that pIAlarmData->Create errors no longer appear in the diagnostic output.

Limitations and Operational Precautions

Custom script modifications to APL_OperationLog are overwritten whenever the Advanced Process Library is updated. Always rely on standard OS Project Editor template regeneration rather than editing internal C scripts manually.

Engineer FAQ

What does APL_OperationLog do in PCS 7?

It is an internal APL C function that logs operator interventions (setpoint changes, mode changes) to WinCC Alarm Logging.

Why did MSRTCreateMsgInstanceWithComment fail with an exception?

The standard APL operation message templates were missing from the WinCC Alarm Logging database.

How do I restore missing APL operation message templates?

Open the OS Project Editor in WinCC Explorer, select 'Create/update message configuration' under the Message Configuration tab, and click OK.

Where can I see the logged operator actions in runtime?

In the 'Operation List' (Bedienliste) window accessible from the standard PCS 7 alarm toolbar.

Does APL_OperationLog record the Windows user name?

Yes, it captures both the authenticated user name (@CurrentUser) and the physical client machine name (@LocalMachineName).

Technical References

Related Articles

Related Tags

  • APL_OperationLog
  • Alarm Logging
  • Operation Messages
  • OS Project Editor
  • MSRTCreateMsgInstance
  • Audit Trail
  • Operator Interventions
  • PCS 7 V9.0
20 respuestas