genslwrite

Generate Simulink OPC Write block from MATLAB group object

Syntax

BlkPath = genslwrite(GrpObj)
BlkPath = genslwrite(GrpObj,DestSys)

Description

BlkPath = genslwrite(GrpObj) generates an OPC Write block from the dagroup object GrpObj, and places the block in a new Simulink® model. The generated OPC Write block has the same name, update rate, and items as GrpObj. BlkPath indicates the full path to the new OPC Write block.

BlkPath = genslwrite(GrpObj,DestSys) generates the OPC Write block and places it into the system defined by DestSys. DestSys must be a model name or a path to a subsystem block. The OPC Write block automatically takes a location that attempts to minimize overlap of lines and blocks, however, the block might appear over an existing annotation.

Examples

Create a group object with two items, and then construct an OPC Write block from the group:

da = opcda('localhost','Matrikon.OPC.Simulation');
grp = addgroup(da,'ExOPCREAD');
itm1 = additem(grp,'Triangle Waves.Real8');
itm2 = additem(grp,'Saw-Toothed Waves.Int2');
% Set update rate to 2 seconds:
grp.UpdateRate = 2;
% Construct OPC Write block:
blkPath = genslwrite(grp)

See Also

Was this topic helpful?