show the entry list
WinCC -- Configuring alarms and messages -- Operating alarms and messages
What options are there in WinCC for read and write access to TagLogging/AlarmLogging archives?
How do you acknowledge alarm messages?
Why can locked alarms not be unlocked in SIMATIC WinCC, even though the logged-in user has the rights to free the alarms?
When a message is acknowledged, how can you trigger an additional operator input message that shows the text of the acknowledged message?
How can you generate user-defined operator input messages in WinCC?
What options are there for resetting the acknowledge bit?
How can you create operator inputs through user-specific actions in up to and including WinCC V6.0 SP4?
OS - WinCC -- Configuring Alarm Logging -- Configuring alarms and messages
How can you create operator inputs through user-specific actions in up to and including WinCC V6.0 SP4?
How do you display and operate alarms in Runtime?
What do you do if alarms are not displayed at Runtime?
How can you change the column width of the message blocks with the mouse in WinCC Alarm Control when configuring in the Graphics Designer or in Runtime?
Configuring the system block "PLC/CPU number" in messages
Why are measuring-point-specific messages not displayed in the faceplate (PCS 7 V4.x / V5.x)?
What can you do if no messages are displayed in the overview area of WinCC?
Generating a new time stamp despite identical operator messages
Triggering of the horn with messages that are blocked for specific users
Why are the time stamps of messages struck through or replaced by asterisks in PCS 7?
SIMATIC PCS 7 V5/V6 - non-acknowledgable messages on the message new page
What are the priorities for the display of faults, warnings etc. in the group display?
How can you have a block comment displayed in an operator message?
Why are operator messages shown only on the OS server and not on the OS client?
Why after upgrading from PCS 7 V6.0 SP2 to SP3 isn't the operator who acknowledges a message entered in the operator message?
Why doesn't the operator prompt flash in the group display?
Modification of the printing color in the tag logging
How can I make messages for a certain operator be displayed in WinCC Runtime but cannot be acknowledged?
How can you reconfigure the alarm acknowledgment behavior?
Why isn't the process message displayed in my PCS 7 project?
How do you suppress the process control group messages?
What is the meaning of the process control group messages created during OS compilation?
Which process control group messages are created in the OS?
How can you create operator inputs through user-specific actions in up to and including WinCC V6.0 SP4?
Part number:

Instructions:
Operator inputs are generated automatically in WinCC by using the I/O fields if you have set the "Operator Input Yes" property when configuring the I/O field.
However, there are often requests that operator inputs should be able to be set by pressing a button or another object. This is possible using some of the functions of the WinCC Open Development Kit (WinCC ODK).

This entry shows how to use the ODK functions "MSRTCreateMsg()" and "MSRTSetComment()" to generate operator inputs at runtime. You can use these functions in up to and including WinCC V6.0 SP4. From WinCC V6.2, you must use the ODK function "MSRTCreateMsgInstanceWithComment()" (see Entry ID 24325381).

Warning!
When you migrate an old project, you might have to replace the function calls of "MSRTCreateMsg()" and "MSRTSetComment()" with "MSRTCreateMsgInstanceWithComment()".

The structure of the operator input in this example is predefined by the system. At runtime, the C script of this entry generates an operator input with message number 12508141, which displays the old value and new value in process value_2 and process value_3 respectively as well as a message comment.

These API calls have been grouped together and supplied in the function "OpInputB" such that the same functionality as the operator input of an I/O field is achieved.

1. Supplying the "OpInputB" function
If the function is called by a "mouse-click" event on a button or other object, then it can be supplied as follows:

double value_old=0;
double value_new=1;
char* comment="Operation of button33";
OpInputB(comment,value_old,value_new);

or
char* comment="Operation of button10";
OpInputB(comment,0,0);

The function must be supplied with the comment string and the new value and old value, where these values can also be transferred simply with 0 if no tags are written.

Transfer of the tag ID as used for the I/O field is not provided for, since it cannot be determined.
No entry is made in the logbook for this function.

2. The "BedienMeldB" function

#pragma code ("Kernel32.DLL");
BOOL GetComputerNameA(LPSTR Computername, LPDWORD size);
BOOL GetLocalTime(SYSTEMTIME* stTime);
#pragma code();
#include "M_GLOBAL.H"
#include "msrtapi.h"
// =======================================================
// Function: BedienMeldB()
// =======================================================
// Description: Function to create user specific operator messages
// Call e.g. released by a button: BedienMeldB(CommentText,W_old,W_new);
// =======================================================
void BedienMeldB( char* CommentText,double doValueOld, double doValueNew)
{
CMN_ERROR g_sErr;
LPCMN_ERROR pError = &g_sErr; /* Global Error Block */
BOOL fRet = TRUE;
DWORD dwBufSize;
static DWORD l_svID = 0;
//Connection ID to Alarmlogging

DWORD dwVarID=0;
// Tag-ID set to 0
MSG_RTCREATE_STRUCT MsgCreate;
MSG_COMMENT_STRUCT MsgComment;
SYSTEMTIME stTime;
GetLocalTime( &stTime );
// Get time/date

MsgCreate.dwMsgNr = MSG_SINGLE_OPERATION;
// Operator Message Number
MsgComment.dwMsgNr = MSG_SINGLE_OPERATION;
// Operator Message Number
MsgCreate.stMsgTime = stTime;
MsgComment.stTime = stTime;
MsgCreate.wPValueUsed = 7;
// 3 Process Tags( 0..2 )
MsgCreate.dPValue[0] = dwVarID;
// Tag-ID
MsgCreate.dPValue[1] = doValueOld;
// previous value
MsgCreate.dPValue[2] = doValueNew;
// current value
MsgCreate.dwMsgState = MSG_STATE_COME;
// state "COME"

strcpy( MsgComment.szText, CommentText );
strcpy( MsgComment.szUser, GetTagChar("@CurrentUser"));
// assign logged user
// get computer name
dwBufSize = sizeof( MsgComment.szComputerName );
GetComputerNameA( MsgComment.szComputerName, &dwBufSize );
printf("ComputerName: %s \r\n",MsgComment.szComputerName);
do {
if( l_svID==0) {
fRet= MSRTStartMsgService( &l_svID, NULL, NULL, 0, NULL, pError );
// activate service
if(!fRet) break;
printf( "Alarm Connected %d \r\n", l_svID );
}
fRet = MSRTCreateMsg( l_svID, &MsgCreate, pError ) ;
// create message
// Create comment
if(fRet == FALSE ){
printf("MSRTCreateMsg_Error %s \r\n",pError->szErrorText);
}
else {
MSRTSetComment( l_svID, &MsgComment, pError );
}

break;
} while(TRUE);

fRet=MSRTStopMsgService(l_svID,pError);
// cancel service
printf("StopMsgService %d %s \r\n",fRet,pError->szErrorText);
if (fRet==TRUE)
l_svID=0;
}

Note:
There is a function in the WinCC ODK which permits the server to be transferred as call parameter. The default server is used in the example above.
Information on the ODK is available in Entry ID 9652128.
Also refer to Entry ID 24325381.

 Entry ID:218555   Date:2008-08-05 
I regard this article....as helpfulas not helpful                                 
mySupport
My Documentation Manager 
Newsletter 
CAx-Download-Manager 
Support Request
To this entry
Print
Create PDF 
Send to a friend
QuickLinks
Compatibility tool 
Help
Online Help
Guided Tour