回复:没有CP1613,利用WINCC自带的(创建软冗余)的方式能否实现上位机,冗余切换?

gslyx

  • 帖子

    19
  • 精华

    0
  • 被关注

    0

论坛等级:游民

注册时间:2003-06-06

普通 普通 如何晋级?

发布于 2009-02-26 13:31:19

0楼

一台计算机读RACK0的CPMAC地址,另两台计算机读RACK1的CPMAC地址,这样CPU0出现故障时其他计算机还在通信,不会造成由于切换造成的数据丢失,其实有的时候有些问题就是一个计算机任务分配和自己使用习惯的问题,我认为能够有一个捷径解决问题就行,追求这些东西是没用的。1号计算机脚本:
#include "apdefap.h"
int gscAction( void )
{
#define TAG_0 "@sg@AlternateConnectionAddress"
#define TAG_1 "@sg@ConnectionEstablishMode"
#define TAG_2 "@sg@ConnectionState"
#define TAG_3 "@sg@ForceConnectionAddress"
#pragma code("msrtcli.dll")
#include "msrtapi.h"
#pragma code()
#pragma code( "kernel32.dll" )
VOID GetLocalTime(LPSYSTEMTIME lpSystemTime);
#pragma code()
static int Mld_Main = 0;
static int Mld_Res = 0;
DWORD ServiceID = 0;
static BOOL InitFirst = TRUE;
static MSG_RTCREATE_STRUCT MsgCreate;
CMN_ERROR Error;
if ( InitFirst == TRUE )
{ memset( &MsgCreate, 0, sizeof (MSG_RTCREATE_STRUCT) );
MsgCreate.dwMsgState = MSG_STATE_COME;
MsgCreate.wTextValueUsed = 1;
sprintf( MsgCreate.mtTextValue[0].szText, "sg" );
SetTagChar( TAG_0, "H1,08 00 06 71 88 06,,0,3,02" );//1号计算机脚本(SetTagChar( TAG_0, "H1,08 00 06 71 88 07,,1,3,02" );//2号计算机脚本
)
InitFirst = FALSE;
}

if ( GetTagDWordWait( TAG_1 ) == 0 )
{
Mld_Main = 0;
Mld_Res = 0;
return 0;
}
else
{
GetLocalTime( &MsgCreate.stMsgTime );
MSRTStartMsgService ( &ServiceID, NULL, NULL, MSG_NOTIFY_MASK_ARCHIV, NULL, &Error );

if ( GetTagDWordWait( TAG_2 ) == 0 )
{
if ( GetTagDWordWait( TAG_3 ) == 0 )
{
if ( Mld_Main == 0 )
{
MsgCreate.dwMsgNr = 1012222;
MSRTCreateMsg( ServiceID, &MsgCreate, &Error );
Mld_Main = 1;
SetTagBit("10KA",1);
}
}
else
{
if ( Mld_Res == 0 )
{
MsgCreate.dwMsgNr = 1012224;
MSRTCreateMsg( ServiceID, &MsgCreate, &Error );
Mld_Res = 1;
SetTagBit("10KA",1);
}
}

if ( GetTagDWordWait( TAG_2 ) == 0 )
{
if ( GetTagDWordWait( TAG_3 ) == 0 )
{
SetTagDWord( TAG_3, 1 );
}
else
{
SetTagDWord( TAG_3, 0 );
}
}
}
else
{
if ( ( Mld_Main != 0 ) ( Mld_Res != 0 ) )
{
Mld_Main = 0;
Mld_Res = 0;

if ( GetTagDWordWait( TAG_3 ) == 0 )
{
MsgCreate.dwMsgNr = 1012223;
MSRTCreateMsg( ServiceID, &MsgCreate, &Error );
}
else
{
MsgCreate.dwMsgNr = 1012225;
MSRTCreateMsg( ServiceID, &MsgCreate, &Error );
}
}
}
if ( ServiceID != 0 )
{
MSRTStopMsgService ( ServiceID, &Error );
}
return 1;
}
}
评论
编辑推荐: 关闭

请填写推广理由:

本版热门话题

SIMATIC S7-300/400

共有54756条技术帖

相关推荐

热门标签

相关帖子推荐

guzhang

恭喜,你发布的帖子

评为精华帖!

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

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

  • 分享

  • 只看
    楼主

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