VB_ADS通訊.ppt_第1頁
VB_ADS通訊.ppt_第2頁
VB_ADS通訊.ppt_第3頁
VB_ADS通訊.ppt_第4頁
VB_ADS通訊.ppt_第5頁
已閱讀5頁,還剩62頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、TwinCAT Total Windows Control and Automation TechnologyTwinCAT ADS,2020/8/1,Josef Papenfort,2,Definition Excursion: TwinCAT device concept a.) Identification of TwinCAT ADS devices b.) TwinCAT message router ADS a.) Introduction b.) Client-server relationship c.) Access types d.) Overview of methods

2、,Set values profiles,2020/8/1,Josef Papenfort,3,Definition ADS = Automation Device Specification - modular ADS devices e.g. PLC (each run time system), NC,. - message exchange by ADS via the message router,ADS (General),2020/8/1,Josef Papenfort,4,ADS server unambiguously identifiable by: AdsAmsServe

3、rPort Router unambiguously identifiable by: AdsAmsServerNetID,TwinCAT Device concept,2020/8/1,Josef Papenfort,5,- Every (TwinCAT) PC in the network can be uniquely identified by means of a TCP/IP address such as 172.1.2.16. - The AdsAmsServerNetID is an extension of the TCP/IP address, and identifie

4、s a message router, e.g. 172.1.2.16.1.1 - The last two figures can be freely selected.,Identification of ADS devices,2020/8/1,Josef Papenfort,6,The ADS servers of a message router are clearly identified by a number (- AdsAmsServerPort). The following AdsAmsServerPort numbers are already assigned: 80

5、1,811,821,831: TwinCAT PLC server, 1.-4. run-time system 500: TwinCAT NC server 100: TwinCAT logger,Identification of ADS devices,2020/8/1,Josef Papenfort,7,TwinCAT message router (I) Example: An ADS client sends an ADS message to an ADS server. The TwinCAT message router (transport layer 4) carries

6、 out: - acceptance of the request from the client - forwarding the message to an router if appropriate - provision of the messages to the ADS server,TwinCAT message router (I),2020/8/1,Josef Papenfort,8,Existing message router: On every TwinCAT PC On every Embedded PC CX1000, CX1001 On every bus con

7、troller BX1000 - On every bus controller (e.g. BC3100, BC8100, ., BCxxxx) Possible communication paths: - Network (TCP/IP) A PLC run-time system sends data to another PLC on another TwinCAT PC in the network. - Fieldbus (Lightbus / Profibus) A PLC run-time system sends data to another PLC on a bus c

8、ontroller in the fieldbus.,TwinCAT message router (II),2020/8/1,Josef Papenfort,9,The ADS interface permits: Standard: - communication with other ADS devices Client requests data or services, server answers automatically Special solutions: - implementation of an ADS server (device) PLC : Extension o

9、f the existing ADS server functions of the PLC with the PLC Library function blocks “Indication Response” Windows applications:TcSystem DLL (detailed information about ADS communication necessary,ADS - Interface,2020/8/1,Josef Papenfort,10,1.) Confirmed services 2.) Unconfirmed services ADS ClientAD

10、S Server RequestIndication ConfirmationResponse,Client-server relationship,2020/8/1,Josef Papenfort,11,Example (PLC runtime 1) requests data from PLC (runtime2) ADS-ClientPLC IADS-Server PLC II uses ADS FBProvides the data RequestIndication (FB call) ConfirmationResponse (Busy at FB),Client server r

11、elationship between 2 PLC devices,2020/8/1,Josef Papenfort,12,1.) By address Example: Read / write a total of 100 bytes starting from byte offset 20 of the input/output process image in the PLC server or of the flags area. (Often used in process visualisation) 2.) By name“ Example: Read / write the

12、PLC variable temperature.,Access types (I),2020/8/1,Josef Papenfort,13,Synchronous. - Client sends a request to server - Client waits until the result is existing - Synchronous to the program line“,Access types, time flow (I),2020/8/1,Josef Papenfort,14,Asynchronous - Client sends a query to the ser

13、ver - Client continues to work without waiting - Result of the server by callback Notification - Client registers itself at the server - Server serves the client autonomously by callback (until the client signs off from the server again),Access types, time flow (II),2020/8/1,Josef Papenfort,15,Defin

14、ition OCX: ActiveX-Control according to COM-(Component Object Model) Specification The OCX contains: - general ADS services - extended ADS services, that simplify the process (e.g. synchronous communication),ADS OCX Introduction,2020/8/1,Josef Papenfort,16,Asynchronous,ADS OCX Introduction methods (

15、I),Synchronous,AdsSyncxxyyReq - per Adresse,AdsSyncxxyyVarREQ -per Name,AdsReadIntegerReqAdsReadLongReqAdsReadSingleReqAdsReadDoubleReqAdsReadStringReq,Methods for request(= Req),AdsReadIntegerConfAdsReadLongConfAdsReadSingleConfAdsReadDoubleConfAdsReadStringConf,Events at data updating (= Conf),Ads

16、SyncReadBoolReqAdsSyncReadBoolVarReqAdsSyncReadIntegerReqAdsSyncReadIntegerVarReqAdsSyncReadLongReqAdsSyncReadLongVarReq,2020/8/1,Josef Papenfort,17,ADS OCX Introduction methods (II),Notification,ReadVarConnectExAdsReadConnectUpdateEx,AdsReadConnectUpdateEx,Method for apply Notification,Event after

17、data update,Method for sign off Notification,AdsDisconnectEx,Notification. Connect?. EX?,Notification is a term from the communication. Connect is a term of the ADS Ocx method. EX: means Extended. It is the extended method of the old connect method. The difference is the easier handling. (- connectE

18、x is recommended),2020/8/1,Josef Papenfort,18,Notification Refresh,2020/8/1,Josef Papenfort,19,ADS OCX methods overview,2020/8/1,Josef Papenfort,20,Before communicating with an ADS device, the following properties of the communication partner must be specified once: - AdsAmsServerNetID (e.g. 172.1.2

19、.16.1.1) and - AdsAmsServerPort (e.g. 801 PLC server, 1st run-time system) A separate ADS-OCX should be used for each ADS communication partner: e.g. ADS_OCX1 for PLC server 1st run-time system e.g. ADS_OCX2 for NC server e.g. ADS_OCX3 for PLC server 2nd run-time system For communication between one

20、 PC and several BC (9)000 Controllers one OCX and e.g. one additional I/O task can be used. The IO task “collects”all data from the BCs and the ADS OCX access to this area.,Specifying the ADS communication partner,2020/8/1,Josef Papenfort,21,ADS-OCX Examples: ADS-OCX in Visual Basic project ILinking

21、, simple data exchange IIExamples: Synchronous and Connect“ VBA IVBA with Graphworks synchronous data exchange VBA IIVBA with Graphworks data exchange with connect VBA IIIVAB with excel,ADS OCX Examples,2020/8/1,Josef Papenfort,22,TwinCAT.ADS.Dll Examples: TwinCAT.ADS.Dll with VisualS and C# Ads.Dll

22、 C# ILinking, simple data exchange Ads.Dll C# IIExamples: Synchronous and Connect“,TwinCAT.Ads.Dll Examples,2020/8/1,Josef Papenfort,23,5.1.b) Example Write a Variable Synchronously to the PLC,Example 1,2020/8/1,Josef Papenfort,24,Example 1,PLC: Create a PLC project, create the main program and decl

23、are a local variable iVbToPlc1,2020/8/1,Josef Papenfort,25,Example 1,Visual Basic: Create Visual Basic, (standard.exe), link ADSOCX,2020/8/1,Josef Papenfort,26,Example 1,Visual Basic: Create form, place control elements,2020/8/1,Josef Papenfort,27,Example 1,Visual Basic: Declare variable and handle

24、for the variable,2020/8/1,Josef Papenfort,28,MarketingMarketingULILAKERSchulungSchulungsfolienADSOCXscreenshots,Example 1,Visual Basic: In FORMLOAD event set PROPERTIES for ADSOCX1,2020/8/1,Josef Papenfort,29,Example I,At faulty completion of a message, a message dialog is generated automatically.In

25、 the development environment of VB can be jumped to the program line along with the cause.By using the VB instructions On Error Goto / Resume an own error handling can be programmed.C#: Try and Catch,2020/8/1,Josef Papenfort,30,Example 1,Visual Basic: Other possibility for error evaluation,2020/8/1,

26、Josef Papenfort,31,Example 1,Visual Basic: The handle is provided by the PLC and is known to the Visual Basic program. This handle can now be used to demand the variable from the PLC. The Click Event of the command button is selected as the trigger (event) for this action. First therefore read the t

27、ext field, and assign this value to the variable.,2020/8/1,Josef Papenfort,32,AdsOcx1.AdsSyncWriteIntegerVarReq, what is the meaning of this name?,As AdsOcx method is used,Synchronous writing (Synchronous is related to the processing of the Visual Basic program. Execution of the Visual Basic program

28、 only continues when execution of this method has been completed.),A value of type integer,This value is to be written via the name variable.,Example 1,Visual Basic: The handle is provided by the PLC and is known to the Visual Basic program. This handle can now be used to demand the variable from th

29、e PLC. The Click Event of the command button is selected as the trigger (event) for this action.,2020/8/1,Josef Papenfort,33,Example 1,Visual Basic: In the click event of the command button.,2020/8/1,Josef Papenfort,34,Example 1,Visual Basic: In the click event of the command button.,2020/8/1,Josef

30、Papenfort,35,Test: Start PLC, save Visual Basic application and start. If everything is in order, the value in the text window of the Visual Basic program can be changed (-32768.+32767). After clicking the command button, the variable in the PLC program must have taken on this value.,Example 1,Visua

31、l Basic: Summary: Click event,2020/8/1,Josef Papenfort,36,Synchronous access to bitlocated address, synchronous by name, by name and connect to several variables and write arrays synchronously. (Base project on training PC or disk) The controls are already placed on the form. A small editing possibi

32、lity has been programmed for the control Msflexgrid“. This example shows the pure using of the methods of ADS Ocx to access to the variables. The Enable Errorhandling“ is used to handle with errors.,Example 2,Visual Basic Example 2,2020/8/1,Josef Papenfort,37,Example 2,Visual Basic Example 2 Form,20

33、20/8/1,Josef Papenfort,38,Visual Basic Example 2 Form,Example 2,2020/8/1,Josef Papenfort,39,Example 2,Visual Basic Example 2 Form,2020/8/1,Josef Papenfort,40,Example 2,Visual Basic Example 2 Form,2020/8/1,Josef Papenfort,41,Example 2,Visual Basic Example 2 Form,2020/8/1,Josef Papenfort,42,Example 2,

34、Visual Basic Example 2 Form,2020/8/1,Josef Papenfort,43,Visual Basic Example 2 Form,Example 2,2020/8/1,Josef Papenfort,44,Example 2,Visual Basic Example 2 Form,2020/8/1,Josef Papenfort,45,Example 2,Visual Basic Example 2 Form,2020/8/1,Josef Papenfort,46,Example 2,Visual Basic Example 2 Form,2020/8/1

35、,Josef Papenfort,47,Visual Basic Example 2 Form,Example 2,2020/8/1,Josef Papenfort,48,Visual Basic Example 2 Form,Example 2,2020/8/1,Josef Papenfort,49,Example 2,Visual Basic Example 2 Form,2020/8/1,Josef Papenfort,50,Example AdsOcx with Genesis32 VBA Synchronous data exchange,Example VBA I,2020/8/1

36、,Josef Papenfort,51,Synchronized read,PLC program changes Poti1“,Synchronized write,Example VBA I: Synchronized write/read of PLC variables,2020/8/1,Josef Papenfort,52,Example VBA I: Graphworks32,2020/8/1,Josef Papenfort,53,Text,Example VBA I: Graphworks32,2020/8/1,Josef Papenfort,54,Process Point with located variable,Example VBA I: Graphworks32,2020/8/1,Josef Papenfort,55,Macros,GwxDemoReadByName_Main.DemoReadByName,Example VBA I: Graphworks32,2020/8/1,Josef Papenf

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論