At Runtime, how can you determine the message texts or process-associated values when a message appears in the associated, user-specific action "GMsgFunction()"?
If the property "This message triggers an action" is set when configuring a message, at Runtime an action is triggered for specific message events (message arrived, gone, acknowledged ...).
In this C-action you can program your user-defined instructions in order to respond to specific alarm events. "GMsgFunction()" is used as a default action.
You can find detailed information about the "GMsgFunction()"
- in the WinCC information system under "Working with WinCC > ANSI-C for Creating Functions and Actions > Function description > Standard Functions > Alarm > GMsgFunction"
- in Entry ID 24842903 - this entry describes the alarm events when this action is executed and the meaning of the numerical value "Status" ("St:") . The status permits you to evaluate the status of an alarm in the action. This can be important in certain situations if you wish to limit a user-specific action to particular alarm events (message received, acknowledge, message sent or block).
The "GMsgFunction()" function is available in the Global Script editor under "Standard functions > Alarm > GMsgFunction". The following download provides two examples for determining the message text and process-associated values in the "GMsgFunction()".
GMsgFunction.zip ( 8 KB )
- Make sure that you save the original before you change the file "gmsgfunc.fct" (../Siemens/WinCC/aplib/Alarm).
- Furthermore, you should also save the changed "gmsgfunc.fct" file, because if you reinstall SIMATIC WinCC this file will be overwritten.
- Note that the same function is always called for all messages. If different functions are to be run through for different messages or message events, you can process the current message number or current message status in the program according to your wishes.
- Please note that intensive use of this configuration version might affect performance. Try to keep this function as brief as possible.
- The function calls used in the download (e.g. MSRTGetMsgCSData ...) are functions from the SIMATIC WinCC ODK options package. Information on the ODK is available in Entry ID 9652128.
- If you do a "compile entire OS with memory reset" (e.g. when using PCS 7), the setting "This message triggers an action" is reset again in the Alarm Logging. Compilation of changes without memory reset does not affect this setting.