27 1 Vol.27 No.1 CEMENTED CARBIDE 2010 2 Feb.2010!"!!!!"!!!!"!" doi:10.3969/j.issn.1003-7292.2010.01.011 OPC 1 1 2 1 (1., 412008; 2., 518052), OPC, WinCC VB,,, OPC ; ;VB ;WinCC Application of OPC Technology in The Vacuum Sintering Furnace Monitoring System Wang Ying 1 Xiao Shen Ping 1 Wen Xin Gen 2 Zhou Jin Feng 1 (1. School of Electrical and Information Engineering, Hunan University of Technoligy, Zhuzhou Hunan 412008, China) (2. Shenzhen Lokee Technology Development Co. Ltd, Shenzhen Guangdong 518052, China) ABSTRACT Based on OPC interface technology, the method of the client accessing the field in time was proposed for enterprise management that having difficulty in real-time looking into on-site monitoring system. The dynamic data, exchanged between the WinCC configuration and VB application programs, is implemented by using the powerful function of Ethernet, so the on-site scene can be quickly and easily observed. And the method about application development of the client is introduced. It provides a new idea for the enterprise integrated automation and production management information. The experimental results show that the method achieves low cost and high reliability. KEY WORDS OPC interface technology; vacuum sintering furnace; VB application program; WinCC Configuration,,, :, :2009FJ3152 : (1984-),,,,2007, 9, : :wangying12-8@163.com; :13113015509,15200483024 (1965-),,,,, :xsph_519@163.com :13973321578 :, :412008
27 :OPC 45 [4] (Automation Interface Standard), (Costom Interface Standard), OPC 2,,, VB Delphi OPC, OPC C++, OPC OPC OPC, [1] 1 OPC 1.1 OPC OPC(OLE for Process Control) (OLE Object Linking and Embedding), OPC, OPC OPC 2 OPC,, / 1.4 OPC [1] [3], OPC,, 1.2 OPC OPC,,, OPC : (server) (group) (item),, OPC 1 :, OPC, 3, 1.3 OPC 1 OPC, 2 3 WinCC OPC WinCC, ODBC OLE DDE OPC OPC : [6]
46 27, PC Private Const ItemMax = 8, Dim WithEvents MyOPCserver As OPCServer WinCC OPC ' MyOPCServer DCOM, WinCC Dim WithEvents MyOPCGroups As OPCGroups, ' MyOPCGroups,WinCC OPC Dim WithEvents MyOPCGroup As OPCGroup WinCC OPC WinCC OPC, OPC OPC 3 OPC, OPC Dim MyOPCItem As OPCItem OPC 4 VB WinCC OPC Dim MyOPCItems As OPCItems Dim update As Integer ' MyOPCGroup ' MyOPCItems ' MyOPCItem WinCC OPC : Siemens OPC DAAutomation 2.0 (SOPC- DAAuto.dll), VB, OPC : OPC Automation 2.0 WinCC,VB OPC VB COM, OPC VB 4 : Option Base 1 Option Explicit 4
27 :OPC 47 Dim bconnect As Boolean ' Set MyOPCGroups = MyOPCServer.OPCGroups ' OPC ' Private Sub LoadOPCItem_Click( ) On Error GoTo LoadEnd Dim ItemName As String Dim i, Fno As Integer Set MyOPCGroup = MyOPCGroups.Add("Group1") ' MyOPCGroup.UpdateRate = Val(UpdateRateSet.Text) MsgBox " INI OPC ", vbinformation, " " Set MyOPCItems = MyOPCGroup.OPCItems For cnt = 1 To ItemMax Fno = 1 ' ***.INI 'OPC ***.INI Open "OPCItemLib.INI" For Input As #Fno i = 1 ClientHandles(1) = cnt OPCItemIDs(1) = FrmOPC.ItemName(cnt - 1). Do While Not EOF(1) ' Text Input #Fno, ItemName MyOPCItems.AddItems 1, OPCItemIDs, ClientHandles, FrmOPC.ItemName(i - 1).Text = ItemName If i > ItemMax Then Exit Do i = i + 1 Loop ItemServerHandles, Errors ' OPC If Errors(1) <> 0 Then FrmOPC.Value(cnt - 1) = "Error" Close #Fno bconnect = True ', LoadEnd: If Fno > 0 Then Close #Fno For i = 0 To ItemMax - 1 FrmOPC.ItemName(i).Text = " " + Format$(i) Next i ConnetServer.Caption = " " OPCRead_Button.Enabled = True OPCWrite_Button.Enabled = True AutoReadButton.Enabled = True MyOPCGroup.IsActive = False For cnt = ItemName.LBound To ItemName.UBound Private Sub ConnetServer_Click( ) ItemName(cnt).Enabled = False Dim ItemServerHandles( ) As Long Dim ClientHandles(1) As Long Dim OPCItemIDs(1) As String Dim Errors() As Long Else On Error Resume Next MyOPCGroup.IsActive = False ' Dim cnt As Integer MyOPCGroups.Remove MyOPCGroup.Server- Dim updateval As Integer If bconnect = False Then Handle Set MyOPCItems = Nothing On Error GoTo ConnectError ' Set MyOPCItem = Nothing ' updateval = InputBox$(" ( )") UpdateRateSet.Text = Val(updateval) Set MyOPCServer = New OPCServer ' MyOPCServer.Connect FrmOPC.ServerName.List (ServerName.ListIndex), "" Set MyOPCGroups = Nothing Set MyOPCGroup = Nothing MyOPCServer.Disconnect Set MyOPCServer = Nothing '
48 27 ' OPCWrite_Button_Click bconnect = False OPCRead_Button.Enabled = False OPCWrite_Button.Enabled = False AutoReadButton.Enabled = False 5 ConnetServer.Caption = " " For cnt = ItemName.LBound To ItemName. OPC UBound, ItemName(cnt).Enabled = True OPC, WinCC VB,, ConnectError: MsgBox " " For cnt = 0 To ItemMax - 1 FrmOPC.Value(cnt) = "Error" ' OPC Private Sub AutoReadButton_Click( ) MyOPCGroup.IsActive = Not MyOPCGroup.IsActive MyOPCGroup.IsSubscribed = MyOPCGroup.IsActive ', DataChange If MyOPCGroup.IsActive = False Then Else [1],,. Profibus [M]. :,2007,226-249 [2],,. OPC [J].,2008,27(11):42-44 [3],. OPC [J].,2002,8(4):229-231 [4],,.OPC [J].,2008,29(6):37-38 [5],. [J].,2005,22(1):36-39 [6]. WinCC V6[M]. :,2005,164-170 (2009-10-22 ;2009-12-21 )