Documentation Center

  • 評価版
  • 製品アップデート

opchda

Create OPC historical data access client

Syntax

  • hdaObj = opchda(SIObj) example
  • hdaObj = opchda(Hostname,ServerID) example
  • hdaObj = opchda(Hostname,ServerID,Name,Value)
  • hdaObj = opchda(SIObj,Name,Value)

Description

example

hdaObj = opchda(SIObj) constructs an OPC HDA client object, hdaObj, for the information provided in the OPC HDA ServerInfo object, SIObj, obtained from an opchdaserverinfo function call.

example

hdaObj = opchda(Hostname,ServerID) constructs hdaObj for the host specified by Hostname and the OPC server ID specified by ServerID.

When you construct hdaObj, its initial Status property value is 'disconnected'. To communicate with the server, connect hdaObj to the server using the connect function.

hdaObj = opchda(Hostname,ServerID,Name,Value) 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 = opchda(SIObj,Name,Value) 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.

Examples

expand all

Create Client Object for a Specific Server

Create an OPC HDA client object for a specific client on the local host.

hdaObj = opchda('localhost','MyHDAServer.1');

Create Client Objects for All Servers

Create OPC HDA client objects for all clients on the local host.

SIObj  = opchdaserverinfo('localhost');
hdaObj = opchda(SIObj);

Input Arguments

expand all

SIObj — OPC HDA server informationOPC HDA ServerInfo object

OPC HDA server information, specified as an OPC HDA ServerInfo object. This object is returned from the function opchdaserverinfo.

Example: SIOjb = opchdaserverinfo

Hostname — OPC HDA server host namestring

OPC HDA server host name specified as a string.

Example: 'host-name'

Data Types: char

ServerID — Identifier of OPC HDA serverstring

Identifier of OPC HDA server, specified as a string.

Example: 'MyHDAServer.1'

Data Types: char

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Timeout',60

The argument name identifies a property of the created OPC HDA client object. Note that the name-value pairs can be any format that the set function supports, i.e., name-value string pairs, structures, and name-value cell array pairs.

'Timeout' — Maximum time to wait for completion of instruction to server10 (default)

Maximum time to wait for completion of instruction to server, specified in seconds.

Example:

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

'UserData' — Data to associate with objectany MATLAB data type

Data to associate with object, specified as any MATLAB data type. UserData stores any data that you want to associate with the object. The object does not use this data directly, but you can use the data for identification or other purposes.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | char | struct | cell

Output Arguments

expand all

hdaObj — OPC HDA clientOPC HDA client object

OPC HDA client, returned as an OPC HDA client object.

See Also

Was this topic helpful?