Description: This function sets an item value in the VTS OPC Server.
Returns: Boolean
Usage: Script
Format: SetOPCData(BranchHandle, ItemName, Value, Quality, Timestamp)
Parameters: BranchHandle { handle } { required } { no default: }
A handle returned from an OPCServer call.
ItemName { text } { required } { no default: }
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 { varies } { required } { no default: }
The new value of the item (numeric or text).
Quality { numeric (hex) } { required } { no default: }
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 { numeric } { required } { default: current time }
The UTC timestamp corresponding to the value. Will default to the current time if Invalid.
Comments: It 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.
See Also:
Warning: For use by advanced programmers only