Wincc 脚本问题,请高手指教!
根据6个料斗处的定位极限,小车移动对准料斗。Wincc动画脚本,帮忙修改下,在线急等。staticinta=140;a=300;a=460;a=620;a=780;a=9...
根据6个料斗处的定位极限,小车移动对准料斗。Wincc动画脚本,帮忙修改下,在线急等。
static int a=140;a=300;a=460;a=620;a=780;a=940;
if (GetTagBit("Car1") && (a<=150)) {
a+=20;
if (a>=130) (a=140);
}
return a;
if (GetTagBit("Car2") && (a<=310)) {
a+=20;
if (a>=290) (a=300);
}
return a;
if (GetTagBit("Car3") && (a<=470)) {
a+=20;
if (a>=450) (a=450);
}
return a;
if (GetTagBit("Car4") && (a<=630)) {
a+=20;
if (a>=610) (a=620);
}
return a;
if (GetTagBit("Car5") && (a<=790)) {
a+=20;
if (a>=770) (a=780);
}
return a;
if (GetTagBit("Car6") && (a<=950)) {
a+=20;
if (a>=930) (a=940);
}
return a;
} 展开
static int a=140;a=300;a=460;a=620;a=780;a=940;
if (GetTagBit("Car1") && (a<=150)) {
a+=20;
if (a>=130) (a=140);
}
return a;
if (GetTagBit("Car2") && (a<=310)) {
a+=20;
if (a>=290) (a=300);
}
return a;
if (GetTagBit("Car3") && (a<=470)) {
a+=20;
if (a>=450) (a=450);
}
return a;
if (GetTagBit("Car4") && (a<=630)) {
a+=20;
if (a>=610) (a=620);
}
return a;
if (GetTagBit("Car5") && (a<=790)) {
a+=20;
if (a>=770) (a=780);
}
return a;
if (GetTagBit("Car6") && (a<=950)) {
a+=20;
if (a>=930) (a=940);
}
return a;
} 展开
2个回答
展开全部
WinCC的VBS虽可以生命Public变量,但作用域仅限于腔庆本画面。
如果你的WinCC版本>=V6.0 SP3,则可以使慎槐用Dataset对象,该对象可以在不同的VBS脚本中进行访问。下面是个简单的宽圆友例子:
1、连接
Dim objConnection,strConnectionString
strConnectionString ="Driver=;Server=.\WINCC;uid=;pass=;database=guowincc"
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = strConnectionString
objConnection.open
HMIRuntime.DataSet.Add "objConnection",objConnection
2、全局动作中引用
Dim objConnection
objConnection= HMIRuntime.DataSet("objConnection").Value
with objCommand
.ActiveConnection = objConnection
xxxxxxxx
3、关闭连接:
Dim objConnection
objConnection= HMIRuntime.DataSet("objConnection").Value
objConnection.Close
Set objConnection = Nothing
如果你的WinCC版本>=V6.0 SP3,则可以使慎槐用Dataset对象,该对象可以在不同的VBS脚本中进行访问。下面是个简单的宽圆友例子:
1、连接
Dim objConnection,strConnectionString
strConnectionString ="Driver=;Server=.\WINCC;uid=;pass=;database=guowincc"
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = strConnectionString
objConnection.open
HMIRuntime.DataSet.Add "objConnection",objConnection
2、全局动作中引用
Dim objConnection
objConnection= HMIRuntime.DataSet("objConnection").Value
with objCommand
.ActiveConnection = objConnection
xxxxxxxx
3、关闭连接:
Dim objConnection
objConnection= HMIRuntime.DataSet("objConnection").Value
objConnection.Close
Set objConnection = Nothing
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询