欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    组态王与AB PLC通过OPC的连接-精品文档资料.doc

    • 资源ID:73281387       资源大小:2.65MB        全文页数:9页
    • 资源格式: DOC        下载积分:15.88金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要15.88金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    组态王与AB PLC通过OPC的连接-精品文档资料.doc

    组态王与AB PLC的连接。Rockwell Automation 的A-B PLC是一个著名的可编程控制器产品。其产品体系基本上涵盖了工业控制产品的各个领域,并以产品的可靠而著称。在国内的PLC市场的占有率将近30%。由于A-B的PLC的种类繁多,且各种类型的PLC支持的通信协议不尽相同,使得第三方的HMI软件都不能很好的与A-B PLC进行连接。RSLinx软件是A-B PLC通用的通信配置软件(2.2以上的版本支持对以太网的网关配置),目前主要有以下几个版本:RSLinx OEM、 RSLinx Professional 、RSLinx Gateway、 RSLinx SDK四个版本。且均支持OPC服务(2.3版以上支持OPC2.0版)。组态王软件已内嵌了OPC服务功能,支持OPC客户端和OPC服务器的工作方式。这样组态王就可以很方便的与A-B PLC进行通信。具体的配置方法如下:在组态王与A-B PLC进行OPC的配置是必须要有A-B PLC及相关的通讯附件。1、 安装A-B PLC 、通讯卡、相关的软件,并作物理连接2、 使用RSLinx连接A-B PLC的通讯网络。配置通讯卡(参加图-1),选择ConFigure Drivers。图-1弹出入下的配置窗口(参见图-2)。图-2选择对应的通讯卡,并进行端口配置(可参照附带的安装手册),配置成功后将显示所配置的设备的运行状态。使用RSWho命令查找连接的PLC设备(参见图-3)。参见图-3RSWho命令成功的执行后,将在设备列表中列出与本机连接的所有硬设备。使用Topic Configoration来进行OPC服务的配置(参见图-4)。图-4在Date Source配置框中配置Topic,选择一个物理设备(PLC),按New按钮即可建立一个Topic,单击Done即可(参见图-5)。图-53、 在组态王中建立y与OPC设备的连接。添加OPC设备。在组态王的工程器中选择设备àOPC服务器à新建,则弹出如下的窗口(参见图-6)。在OPC服务器列表中选择RSLinx OPC Serverà选择确定即可。参见图-6在数据字典里加入IO点(参见图-7)在组态王的工程器中选择数据库à数据字典à新建。确定变量名、变量类型等变量属性,在连接设备中选择RSLinx OPC Server ;手工键入寄存器地址,地址的格式为:”Topic名变量别名”或”Topic名:变量寄存器地址”。单击确认即可。图-74、 附加的文档,A-B提供的说明文件。Public GroupsRSLinx does not support public groups. Public groups are an optional part of the OPC specifications. However, behind the scenes, if two clients request the same information from a single instance of RSLinx, RSLinx will not read the data twice from the target processor. It will provide the same data to both clients, which is similar in effect to public groups.As of v2.31, RSLinx does not support OPC within the .NET framework. The current Automation Interface conforms to the Visual Basic automation interface standards used in previous versions of Visual Basic. VB.NET uses different underlying technology. Future development is planned, but Rockwell Automation, like other OPC servers, must wait for an OPC .NET interface specification from the OPC Foundation.This document will provide a comparison between RSData and the RSLinx OPC Automation interface and is intended to provide guidelines for converting an existing application. For the purpose of this document, the PokeNRequest example was converted from an RSData application to an RSLinx OPC Automation Application. Both applications are attached to this technote for your review and are provided as-is for demonstration purposes only.This document applies to the following software versions. There may be slight differences in functionality with other revisions. · RSData 1.60.01 · RSJunctionBox 1.60.01 · RSLinx SDK 2.30.02 (Build 79) · VisualBASIC 6.0 with Service Pack 5PLEASE NOTE: RSLinx SDK (9355WABCENE) provides documentation on how to use the Automation Interface, development support, and samples. All other flavors of RSLinx provide the Automation interface as-is (no documentation, no support, no samples).A key difference between the two is that RSData (and the other RSTools) is an ActiveX control, which provides a user interface, properties, methods and events. The RSLinx OPC Automation Interface is an Object Interface which provides properties, methods and events but no user interface. The RSTools ActiveX controls are also data-bound controls which enable you to link directly to a database with little or no additional code. The OPC Automation Interface does not have this capability. You will need to write code to link to a database.The following RSData Properties are NOT SUPPORTED with the RSLinx OPC Automation Interface. Display Related PropertiesAutoColumnsCaptionTransparentGridOnScrollTopRowBackColorCaptionXGridWidthTabIndexBackStyleCaptionYHeightTabStopBevelHeightCausesValidationHelpContextIDTagBevelHighlightDecimalPlacesIndexToolTipTextBevelShadowDisplayCaptionLeftTopBevelStyleDisplayCaptionVerticalLeftBorderTopBordersBevelWidthDisplayPictureLinkTipTrailingZerosBorderColorDisplayValueLinkTipBackColorValueBackColorBorderInnerDragIconLinkTipForeColorValueColorBorderInnerColorDragModeLinkTipTextValuePadDownloadBorderStyleDrawDisabledShadowPictureValueShadowBorderWidthEnabledPicturePathValueShadowColorBottomBorderFlashEnabledPictureStretchValueTransparentCaptionFlashOnRightBorderValueXCaptionBackColorFlashSpeedScreenPriorityValueYCaptionColorFlashTimeScrollColumnHeightVisibleCaptionShadowFontScrollColumnWidthWhatsThisHelpIDCaptionShadowColorGridColorScrollFirstColumnWidthDatabase Related PropertiesDataBindingsDataFormatDataSourceDataFieldDataMemberDataUpdateOther Unsupported PropertiesEndValueExpressionForReadWriteValueLinkErrorDisplayStartValueExpressionForWritePokeTypeSymbolUseStartEndValueThe following RSData Events are NOT SUPPORTED with the RSLinx OPC Automation Interface. Display Related EventsClickGotFocusLostFocusScrollPosChangedDblClickKeyDownMouseDownValidateDragDropKeyPressMouseMoveDragOverKeyUpMouseUpOther Unsupported EventsLinkErrorLinkItemSupportedLinkOutOfMemoryLinkItemNotSupportedLinkNotifyLinkServerDisconnectedLinkUnableToConnectToServerThe following RSData Methods are NOT SUPPORTED with the RSLinx OPC Automation Interface. Display Related MethodsAboutBoxMoveShowValuePadDragSetFocusShowWhatsThisThe following tables list the RSData Properties, Events and Methods that have an equivalent in the RSLinx OPC Automation Interface. In the following table, the information in italics is a code sample of the Property, Event or Method.RSDataRSLinx OPC Automation Interface EquivalentPropertiesLinkServerMyRSData.LinkServer = "RSLinx"OPCServer.ConnectOpcServer.Connect "RSLinx OPC Server"LinkTopicMyRSData.LinkTopic = "MyTopic"These two properties are combined in the AddItems Method of the OPCGroup object.OpcGroup.OPCItems.AddItem "PLCS:23", 1LinkItemMyRSData.LinkItem = "S:23"LinkModeMyRSData.LinkMode = 1, 2, or 3These three properties are combined in the IsSubscribed Property of the OPCGroup object.OPCGroup.IsSubscribedOpcGroup.IsSubscribed = TrueThe IsSubscribed property must be set to true to enable callbacks and thus events for the OPCGroup object.The OPCGroup Object must be declared "WithEvents" as well.IsSubscribed = True is equivalent to LinkMode = 1, CommunicationMode = Asynchronous and AllowChangeEvent = True.IsSubscribed = False is equivalent to LinkMode = 2, CommunicationMode = Synchronous and AllowChangeEvent = False.NOTE: LinkMode = 3 (LinkNotify) is not supported with the RSLinx OPC Automation Interface. Also, you can perform Synchronous I/O when IsSubscribed is set to True.CommunicationModeMyRSData.CommunicationMode = Synchronous, AsynchronousAllowChangeEventMyRSdata.AllowChangeEvent = True, FalseRequestLengthMyRSData.RequestLength = 6There is no equivalent of these properties in the RSLinx OPC Automation Interface but some parameters of the OPCGroup's SyncRead and AsyncRead Methods can be used to replicate this behavior.Specifically:RequestLength = lNumItems parameterRequestStartIndex and UseInRequest = arHandles (an Array containing the Item Handles for all Items you wish to Read)NOTE: With the RSLinx OPC Automation Interface you must read and write all items within the group. The code snippets below demonstrate this.RequestStartIndexMyRSData.RequestStartIndex = 0UseInRequestMyRSData.UseInRequest = True, FalsePokeLengthMyRSData.PokeLength = 6There is no equivalent of these properties in the RSLinx OPC Automation Interface but some parameters of the OPCGroup's SyncWrite and AsyncWrite Methods can be used to replicate this behavior.Specifically:PokeLength = lNumItems parameterPokeStartIndex and UseInPoke = arHandles (an Array containing the Item Handles for all Items you wish to Write)NOTE: With the RSLinx OPC Automation Interface you must read and write all items within the group. The code snippets below demonstrate this.PokeStartIndexMyRSData.PokeStartIndex = 0UseInPokeMyRSData.UseInPoke = True, FalseMethodsLinkPokeMyRSData.LinkPokeThe Write method of the OPCItem ObjectMyOPCItem.Write valueDoPokeMyRSData(0).PokeStartIndex = 0MyRSData(0).PokeLength = 6For i% = 0 To 5MyRSData(i%).UseInPoke = TrueNext i%MyRSData(0).DoPokeThe SyncWrite Method of the OPCGroup Object(Use this method if you have the RSData.CommunicationMode property set to Synchronous)lNumitems = MyOPCGroup.OPCItems.CountReDim arHandles(1 To lNumitems)ReDim arValues(1 To lNumitems)For i = 1 To lNumitemsarHandles(i) = MyOPCGroup.OPCItems(i).ServerHandlearValues(i) = txtData(MyOPCGroup.OPCItems(i).ClientHandle).TextNextMyOPCGroup.SyncWrite lNumitems, arHandles, arValues, arErrorsThe AsyncWriteMethod of the OPCGroup Object(Use this method if you have the RSData.CommunicationMode property set to Asynchronous)lNumitems = MyOPCGroup.OPCItems.CountReDim arHandles(1 To lNumitems)ReDim arData(1 To lNumitems)For i = 1 To lNumitemsarHandles(i) = MyOPCGroup.OPCItems(i).ServerHandlearData(i) = txtData(MyOPCGroup.OPCItems(i).ClientHandle).TextNext 'iMyOPCGroup.AsyncWrite lNumitems, arHandles, arData, arErrors, lTransID, lCancelIDLinkRequestMyRSData.LinkRequestThe Read method of the OPCItem ObjectMyOPCItem.Read OPC_DS_CACHE, vValue, vQuality, vTimeStampDoRequestMyRSData(0).RequestStartIndex = 0MyRSData(0).RequestLength = 6For i% = 0 To 5MyRSData(i%).UseInRequest = TrueNext i%MyRSData(0).DoRequestThe SyncRead method of the OPCGroup Object(Use this method if you have the RSData.CommunicationMode property set to Synchronous)lNumitems = MyOPCGroup.OPCItems.CountReDim arHandles(1 To lNumitems)For i = 1 To lNumitemsarHandles(i) = MyOPCGroup.OPCItems(i).ServerHandleNext 'i'/* Read Group data from CacheMyOPCGroup.SyncRead OPC_DS_CACHE, lNumitems, arHandles, arValues,arErrors, arQualities, arTimeStampsThe AsyncRead Method of the OPCGroup Object(Use this method if you have the RSData.CommunicationMode property set to Asynchronous)lNumitems = MyOPCGroup.OPCItems.CountReDim arHandles(1 To lNumitems)For i = 1 To lNumitems'pass in server handlesarHandles(i) = MyOPCGroup.OPCItems(i).ServerHandleNext 'iMyOPCGroup.AsyncRead lNumitems, arHandles, arErrors, lTransID, lCancelIDEventsChangePrivate Sub MyRSData_Change(ByVal sValue As String, ByVal iIndex As Integer)'You would write code here to parse the valuesEnd SubDataChange Event of the OPCGroup ObjectPrivate Sub MyOPCGroup_DataChange(ByVal TransactionID As Long, ByVal NumItems As Long, ClientHandles() As Long, ItemValues() As Variant, Qualities() As Long, TimeStamps() As Date)'You would write code here to evaluate and display the values, qualities, and timestamps of the dataEnd SubPokeCompletedPrivate Sub MyRSData_PokeCompleted(ByVal iRet As Integer)'You would write code here that was dependant on the poke completing.End SubAsyncWriteComplete Event of the OPCGroup ObjectPrivate Sub MyOPCGroup_AsyncWriteComplete (TransactionID As Long, NumItems As Long, ClientHandles() As Long, Errors() As Long)'You would write code here to handle any errors that occured during the write processEnd SubNOTE: Since Errors() are returned in the AsyncWriteComplete Event, you no longer need to monitor a LinkError event separately. Any code in the RSData LinkError Event could be moved to these events when using Asynchronous Group communications. When using Synchronous Communications, the Method returns the errors which would need to be processed in the same routine following the call to the method.RequestCompletedPrivate Sub MyRSData_RequestCompleted(ByVal iRet As Integer)'You would write code here to evalueate the values returned by the read.End SubAsyncReadComplete Event of the OPCGroup ObjectPrivate Sub MyOPCGroup_AsyncReadComplete (TransactionID As Long, NumItems As Long, ClientHandles() As Long, ItemValues() As Variant, Qualities() As Long, TimeStamps() As Date, Errors() As Long)'You would write code here to evaluate and display the values, qualities, timestamps and errorsEnd SubNOTE: Since Errors() are returned in the AsyncReadComplete Event, you no longer need to monitor a LinkError event separately. Any code in the RSData LinkError Event could be moved to these events when using Asynchronous Group communications. When using Synchronous Communications, the Method returns the errors which would need to be processed in the same routine following the call to the method.

    注意事项

    本文(组态王与AB PLC通过OPC的连接-精品文档资料.doc)为本站会员(安***)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开