回复:wincc报警控件问题

金华山

  • 帖子

    73
  • 精华

    10
  • 被关注

    22

论坛等级:侠士

注册时间:2006-07-30

普通 普通 如何晋级?

发布于 2017-08-15 15:11:05

1楼

使用C脚本GMsgFunction,可以根据消息编号及状态做一些事情:

现在报警中勾选:

然后打开全局C动作,标准函数--Alarm--双击“GMsgFunction”,修改为:

BOOL GMsgFunction( char* pszMsgData)
{
  MSG_RTDATA_STRUCT mRT;
  memset( &mRT, 0, sizeof( MSG_RTDATA_STRUCT ) );

 
  if( pszMsgData != NULL )
  {
     printf( "Meldung : %s \r\n", pszMsgData );

    // Meldungsdaten einlesen
     sscanf( pszMsgData,  "%ld,%ld,%04d.%02d.%02d,%02d:%02d:%02d:%03d,%ld, %ld, %ld, %d,%d",
 &mRT.dwMsgNr,    // Meldungsnummer
 &mRT.dwMsgState,     // Status MSG_STATE_COME, .._GO, .._QUIT, .._QUIT_SYSTEM
 &mRT.stMsgTime.wYear,   // Jahr
 &mRT.stMsgTime.wMonth,   // Monat
 &mRT.stMsgTime.wDay,  // Tag
 &mRT.stMsgTime.wHour,   // Stunde
 &mRT.stMsgTime.wMinute,  // Minute
 &mRT.stMsgTime.wSecond,   // Sekunde
 &mRT.stMsgTime.wMilliseconds, // Millisekunde
 &mRT.dwTimeDiff,   // Zeitdauer der anstehenden Meldung
 &mRT.dwCounter,   // Interner Meldungsz?hler
 &mRT.dwFlags,   // Flags( intern )
 &mRT.wPValueUsed,
 &mRT.wTextValueUsed );
 
 
    }

  printf("Nr : %d, St: %x, %d-%d-%d %d:%d:%d.%d, Dur: %d, Cnt %d, Fl %d\r\n" ,
  mRT.dwMsgNr, mRT.dwMsgState, mRT.stMsgTime.wDay, mRT.stMsgTime.wMonth, mRT.stMsgTime.wYear,
  mRT.stMsgTime.wHour, mRT.stMsgTime.wMinute, mRT.stMsgTime.wSecond, mRT.stMsgTime.wMilliseconds, mRT.dwTimeDiff,
  mRT.dwCounter, mRT.dwFlags ) ;
 if (mRT.dwMsgState==1)//如果报警状态为到来
 {
      if (mRT.dwMsgNr==1) //如果报警编号为1
      {
      SetTagBit("Tag1",1); //执行置位操作
      }
 }
   return( TRUE );
}

其中Tag1即为需要置位的变量,注意在WinCC启动选项里勾选“全局脚本运行系统”。

请点击以下链接:
https://support.industry.siemens.com/cs/cn/zh/view/15350783
参考《当运行时消息出现时,如何在用户指定的"GMsgFunction()"动作中确定消息文本和过程值?》 

评论
编辑推荐: 关闭

请填写推广理由:

本版热门话题

SIMATIC WinCC / Panel

共有32567条技术帖

相关推荐

热门标签

相关帖子推荐

guzhang

恭喜,你发布的帖子

评为精华帖!

快扫描右侧二维码晒一晒吧!

再发帖或跟帖交流2条,就能晋升VIP啦!开启更多专属权限!

  • 分享

  • 只看
    楼主

top
您收到0封站内信:
×
×
信息提示
很抱歉!您所访问的页面不存在,或网址发生了变化,请稍后再试。