Main Content

addgroup

(To be removed) Add data access group to opcda object

Support for the OPC Data Access (DA) standard will be removed in a future release. Instead use OPC Unified Architecture (UA). See Compatibility Considerations.

Description

example

GrpObj = addgroup(DAObj) adds a group to the opcda object DAObj. A group is a container for a client to organize and manipulate data items. Typically, you create different groups to support different update rates, activation status, callbacks, etc.

If DAObj is already connected to the server when addgroup is called, a group name is requested from the server. If the server does not supply a group name, or the object is not connected to a server, a unique name is automatically assigned to GrpObj. The unique name follows the convention 'groupN' where N is an integer. You can change this name by modifying the group's Name property.

GrpObj = addgroup(DAObj,GName) adds a group to the OPC data access object DAObj with the group name given by GName. The group name must be unique among other group names within DAObj.

GrpObj = addgroup(DAObj,GName,GrpType) adds a group to the opcda object DAObj with the group type specified by GrpType, either 'private' or 'public'.

You can add items to GrpObj using the additem function, if the group type is 'private'. For a public group, the items are already defined, and are automatically created when you connect to the public group using addgroup.

Examples

collapse all

Create an OPC DA client and add groups to it.

Create an opcda client.

da = opcda('localhost','Matrikon.OPC.Simulation');

Create a group using a default group name.

grp1 = addgroup(da);

Add another group, providing its name.

grp2 = addgroup(da,'AddgroupEx');

Input Arguments

collapse all

OPC DA client , specified as an OPC DA client object. You create the client object with the opcda function.

Example: DAObj = opcda()

Group name, specified as a character vector or string. The group name must be unique within the OPC DA client object.

Example: 'group1'

Data Types: char | string

Group type, specified as 'private' or 'public'. If GrpType is 'private' (the default), the group is configured to be private to DAObj, and no other client connected to the OPC server can access that group. If GrpType is 'public', a connection is made to the server’s public group named GName. To make a connection to a public group named GName, that group must exist on the server as a public group. You create public groups on the server using the makepublic function. Note that some servers do not support public groups; you can verify whether a server supports public groups by using opcserverinfo(DAObj) and checking the SupportedInterfaces field for the IOPCServerPublicGroups interface.

Example: 'public'

Data Types: char | string

Output Arguments

collapse all

Data access group, returned as a dagroup object, with properties described in dagroup Properties.

By default, GrpObj has its Active property set to 'on', GroupType set to 'private', and the Subscription property set to 'on'.

Version History

Introduced before R2006a

expand all

See Also

Functions

Properties