Main Content

opc.hda.Client

Namespace: opc.hda

Create OPC historical data access client

Syntax

hdaObj = opc.hda.Client(SIObj)
hdaObj = opc.hda.Client(Host, ServerID)
hdaObj = opc.hda.Client(Host, ServerID, 'P1', V1, 'P2', V2, ...)
hdaObj = opc.hda.Client(SIObj, 'P1', V1, 'P2', V2, ...)

Description

hdaObj = opc.hda.Client(SIObj) constructs an OPC HDA client object hdaObj for the information provided in the OPC HDA ServerInfo object SIObj obtained from a getServerInfo function call.

hdaObj = opc.hda.Client(Host, ServerID) constructs an OPC HDA client object, hdaObj, for the host specified by Host and the OPC server ID specified by ServerID. When you construct hdaObj, its initial Status property value is 'disconnected'. To communicate with the server, you must connect hdaObj to the server with the connect function.

hdaObj = opc.hda.Client(Host, ServerID, 'P1', V1, 'P2', V2, ...) applies the specified property values to the client created with the Host and ServerID parameters. If you specify an invalid property name or value, the function does not create an object.

hdaObj = opc.hda.Client(SIObj, 'P1', V1, 'P2', V2, ...) applies the specified property values to the client created with the ServerInfo object SIObj. If you specify an invalid property name or value, the function does not create an object. Note that the property name/property value pairs can be any format that the set function supports, i.e., name-value pairs, structures, and name-value cell array pairs.

The OPC HDA client class is responsible for managing connections to an OPC Historical Data Access server. Using the client, you can browse the server's name space, read attributes of items, and read raw or processed data from items on the server.

Examples

Create an HDA client for the Matrikon™ Simulation Server:

hdaObj = opc.hda.Client('localhost', 'Matrikon.OPC.Simulation');

Browse the local host for OPC HDA servers and create a client from the first server found:

siObj = opc.getServerInfo('localhost');
hdaObj = opc.hda.Client(siObj(1));

Version History

Introduced in R2011a