logo资料库

OPC Toolbox User's Guide_Matlab.pdf

第1页 / 共602页
第2页 / 共602页
第3页 / 共602页
第4页 / 共602页
第5页 / 共602页
第6页 / 共602页
第7页 / 共602页
第8页 / 共602页
资料共602页,剩余部分请下载后查看
OPC Toolbox™ User's Guide R2016b
How to Contact MathWorks Latest news: Sales and services: User community: Technical support: Phone: www.mathworks.com www.mathworks.com/sales_and_services www.mathworks.com/matlabcentral www.mathworks.com/support/contact_us 508-647-7000 The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098 OPC Toolbox™ User's Guide © COPYRIGHT 2004–2016 by The MathWorks, Inc. The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form without prior written consent from The MathWorks, Inc. FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through the federal government of the United States. By accepting delivery of the Program or Documentation, the government hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and Documentation by the federal government (or other entity acquiring for or through the federal government) and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the government's needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to The MathWorks, Inc. Trademarks MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders. Patents MathWorks products are protected by one or more U.S. patents. Please see www.mathworks.com/patents for more information.
Revision History Online only June 2004 Online only August 2004 Online only October 2004 Online only March 2005 April 2005 Online only September 2005 Online only March 2006 Online only September 2006 Online only March 2007 Online only September 2007 Online only Online only March 2008 October 2008 Online only March 2009 Online only September 2009 Online only March 2010 Online only September 2010 Online only April 2011 Online only September 2011 Online only March 2012 Online only September 2012 Online only March 2013 Online only September 2013 Online only Online only March 2014 Online only October 2014 March 2015 Online only September 2015 Online only March 2016 Online only September 2016 Online only New for Version 1.0 (Release 14) Revised for Version 1.1 (Release 14+) Revised for Version 1.1.1 (Release 14SP1) Revised for Version 1.1.2 (Release 14SP2) Revised for Version 2.0 (Release 14SP2+) Revised for Version 2.0.1 (Release 14SP3) Revised for Version 2.0.2 (Release 2006a) Revised for Version 2.0.3 (Release 2006b) Revised for Version 2.0.4 (Release 2007a) Revised for Version 2.1 (Release 2007b) Revised for Version 2.1.1 (Release 2008a) Revised for Version 2.1.2 (Release 2008b) Revised for Version 2.1.3 (Release 2009a) Revised for Version 2.1.4 (Release 2009b) Revised for Version 2.1.5 (Release 2010a) Revised for Version 2.1.6 (Release 2010b) Revised for Version 3.0 (Release 2011a) Revised for Version 3.1 (Release 2011b) Revised for Version 3.1.1 (Release 2012a) Revised for Version 3.1.2 (Release 2012b) Revised for Version 3.2 (Release 2013a) Revised for Version 3.3 (Release 2013b) Revised for Version 3.3.1 (Release 2014a) Revised for Version 3.3.2 (Release 2014b) Revised for Version 3.3.3 (Release 2015a) Revised for Version 4.0 (Release 2015b) Revised for Version 4.0.1 (Release 2016a) Revised for Version 4.0.2 (Release 2016b)
Contents Introduction Getting Started 1 OPC Toolbox Product Description . . . . . . . . . . . . . . . . . Key Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Overview of OPC, Servers, and the Toolbox . . . . . . . . . About OPC Toolbox Software . . . . . . . . . . . . . . . . . . . . About OPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . OPC Servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . Get Command-Line Function Help . . . . . . . . . . . . . . . . . Set Up for OPC Toolbox Software . . . . . . . . . . . . . . . . . . Preparation Overview . . . . . . . . . . . . . . . . . . . . . . . . . . Set Up for Communicating with OPC DA and OPC HDA Servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Set Up for Communicating with OPC UA Servers . . . . Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Troubleshooting Introduction . . . . . . . . . . . . . . . . . . . Unable to Find an OPC Server . . . . . . . . . . . . . . . . . . “Class not registered” Error . . . . . . . . . . . . . . . . . . . . Unable to Query the Server . . . . . . . . . . . . . . . . . . . . Unable to Connect to Server . . . . . . . . . . . . . . . . . . . . Unable to Create a Group . . . . . . . . . . . . . . . . . . . . . . Error While Querying Interface . . . . . . . . . . . . . . . . . . 1-2 1-2 1-3 1-3 1-4 1-4 1-6 1-7 1-9 1-9 1-9 1-20 1-21 1-21 1-21 1-21 1-22 1-22 1-22 1-22 v
2 3 Quick Start: Using OPC Data Access Functions Access Data at Command Line . . . . . . . . . . . . . . . . . . . . DA Programming Overview . . . . . . . . . . . . . . . . . . . . . . Step 1: Locate Your OPC Data Access Server . . . . . . . . Step 2: Create an OPC Data Access Client Object . . . . . Step 3: Connect to the OPC Data Access Server . . . . . . Step 4: Create an OPC Data Access Group Object . . . . . Step 5: Browse the Server Name Space . . . . . . . . . . . . . Step 6: Add OPC Data Access Items to the Group . . . . . Step 7: View All Item Values . . . . . . . . . . . . . . . . . . . . Step 8: Configure Group Properties for Logging . . . . . . Step 9: Log OPC Server Data . . . . . . . . . . . . . . . . . . . . Step 10: Plot the Data . . . . . . . . . . . . . . . . . . . . . . . . . Step 11: Clean Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 2-2 2-2 2-4 2-4 2-4 2-5 2-6 2-7 2-8 2-9 2-9 2-9 Quick Start: Using the OPC Data Access Explorer Access Data with OPC Data Access Explorer . . . . . . . . . Precedure Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 1: Open the OPC Data Access Explorer . . . . . . . . . Step 2: Locate Your OPC Server . . . . . . . . . . . . . . . . . . Step 3: Create an OPC Data Access Client Object . . . . . Step 4: Connect to the OPC Server . . . . . . . . . . . . . . . . Step 5: Create an OPC Data Access Group Object . . . . Step 6: Browse the Server Name Space . . . . . . . . . . . . Step 7: Add OPC Data Access Items to the Group . . . . Step 8: View All Item Values . . . . . . . . . . . . . . . . . . . Step 9: Configure Group Properties for Logging . . . . . . Step 10: Log OPC Server Data . . . . . . . . . . . . . . . . . . Step 11: Plot the Data . . . . . . . . . . . . . . . . . . . . . . . . . Step 12: Clean Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 3-2 3-3 3-3 3-6 3-8 3-10 3-12 3-15 3-18 3-19 3-21 3-22 3-24 vi Contents
Quick Start: Using OPC Historical Data Access Functions 4 Access Historical Data . . . . . . . . . . . . . . . . . . . . . . . . . . . HDA Programming Overview . . . . . . . . . . . . . . . . . . . . Step 1: Locate Your OPC Historical Data Access Server . Step 2: Create an OPC Historical Data Access Client Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 3: Connect to the OPC Historical Data Access Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 4: Retrieve Historical Data . . . . . . . . . . . . . . . . . . Step 5: Plot the Data . . . . . . . . . . . . . . . . . . . . . . . . . . Step 6: Clean Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 4-2 4-2 4-3 4-4 4-4 4-5 4-5 Data Access User's Guide Introduction to OPC Data Access (DA) 5 Discover Available Data Access Servers . . . . . . . . . . . . . Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Determine Server IDs for a Host . . . . . . . . . . . . . . . . . . Connect to OPC Data Access Servers . . . . . . . . . . . . . . . Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Create a DA Client Object . . . . . . . . . . . . . . . . . . . . . . Connect a Client to the DA Server . . . . . . . . . . . . . . . . Browse the OPC DA Server Name Space . . . . . . . . . . . 5-2 5-2 5-2 5-4 5-4 5-4 5-5 5-6 vii
6 7 Using OPC Toolbox Data Access Objects Create OPC Toolbox Data Access Objects . . . . . . . . . . . Overview to Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . Toolbox Object Hierarchy for the Data Access Standard . How Toolbox Objects Relate to OPC DA Servers . . . . . . Create Data Access Group Objects . . . . . . . . . . . . . . . . Create Data Access Item Objects . . . . . . . . . . . . . . . . . Build an Object Hierarchy with a Disconnected Client . Create OPC Toolbox Data Access Object Vectors . . . . . Work with Public Groups . . . . . . . . . . . . . . . . . . . . . . Configure OPC Toolbox Data Access Object Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Purpose of Object Properties . . . . . . . . . . . . . . . . . . . . View the Values of Object Properties . . . . . . . . . . . . . . View the Value of a Particular Property . . . . . . . . . . . Get Information About Object Properties . . . . . . . . . . Set the Value of an Object Property . . . . . . . . . . . . . . View a List of All Settable Object Properties . . . . . . . . Delete Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Save and Load Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 6-2 6-2 6-4 6-5 6-7 6-10 6-11 6-14 6-18 6-18 6-19 6-20 6-20 6-21 6-22 6-24 6-26 Reading, Writing, and Logging OPC Data Read and Write Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction to Reading and Writing . . . . . . . . . . . . . . . Read Data from an Item . . . . . . . . . . . . . . . . . . . . . . . . Write Data to an Item . . . . . . . . . . . . . . . . . . . . . . . . . Read and Write Multiple Values . . . . . . . . . . . . . . . . . . Data Change Events and Subscription . . . . . . . . . . . . . Introduction to Data Change Events . . . . . . . . . . . . . . Configure OPC Toolbox Objects for Data Change Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 7-2 7-2 7-5 7-7 7-11 7-11 7-11 viii Contents
分享到:
收藏