SetOPCData

(Engine-Level Function)

Description: Sets an item value in the VTScada OPC Server.
Warning: This function should be used only by advanced programmers.
Returns: Boolean
Usage: Script Only.
Function Groups: Network
Related to: OPCServer
Format: SetOPCData(BranchHandle, ItemName, Value, Quality, Timestamp)
Parameters:  
BranchHandle
Required. A handle returned from an OPCServer call.
ItemName
Required. The internal name for the OPC item being set. It does not necessarily correspond to the OPC item ID. It does correspond to what the OPCGetInternalName callback module returns for a given OPC item ID.
Value
Required. The new value of the item (numeric or text).
Quality
Required. The quality of the value. Should be one of the following:

Quality

Meaning

0x00

Bad

0x04

Bad - Configuration Error (The item has been deleted)       

0x40

Uncertain - Questionable quality

0xD8

Good but local override

0xC0

Good

0xC3

Good but constant value

Timestamp
Required. The UTC timestamp corresponding to the value. Will default to the current time if Invalid.
Comments: Returns TRUE if the item being updated is currently included in an OPC client group, or FALSE if not.

Example:

  SetOPCData(Handle    { Returned from an OPCServer call },
             "myitem1",
             23.1,
             0xC0,
             CurrentTime() + TimeZone(0));

This example updates the value of an OPC item with the internal name "myitem1" to be 23.1, with good quality and the current time as the timestamp.