Wincc 7.5SP2下VBA编程批量设置变量线性标定
继续学习wincc下面VBA编程,这个练习实现变量线性标定。
在前面练习基础上做,有REAL1至REAL10共10个变量,通过VBA脚本对Real1至Real5设置线性标定。
写下面的VBA脚本:
Sub SetTagScaleParameter()
Dim hmigo As hmigo
Dim strTagName As String
Dim i As Integer
Set hmigo = New hmigo
For i = 1 To 5
strTagName = "Real" & CStr(i)
hmigo.ListTag TAG_NAMES, Tags, strTagName
If (UBound(Tags) - LBound(Tags) + 1) > 0 Then '如果变量存在
hmigo.GetTag strTagName
hmigo.TagScaleValid = True
hmigo.TagScaleParam1 = 0#
hmigo.TagScaleParam2 = 100#
hmigo.TagScaleParam3 = 0#
hmigo.TagScaleParam4 = 10#
hmigo.CommitTag
End If
Next
Set hmigo = Nothing
保存,运行就自动的将5个变量做了线性标定。