Promotic
WikipediaLinkedInYoutubeTwitterFacebook

onDataReceive - event of object PmOpcClientData

Description:
The event fires after the data receipt from the OPC server.

The calling procedure of this event depends on the setup of "onDataReceive" event configurator. It is recommended to use the "A = call the event for all registered variables (in this object and also in other PmData objects)" setting.

Parameters:
pMe(Object) Reference to the PROMOTIC object where the event rises.
pEvent(Object) A referrence to object describing detailed information about the specific event.
pEvent.Items - (Array) The property is set only if the "onDataReceive" event configurator is set to:
- "A = call the event for all registered variables (in this object and also in other PmData objects)".

Then each item of this array represents the "data extension ExtOpcClient object" of the variable that is defined either in this PmOpcClientData object or in another PmData object.

- "B = calling for the whole group of received variables - only for variables defined in this object (obsolete)".

Then each item of this array represents the "variable Var object" that is defined in this PmOpcClientData. Variables in other PmData objects (that have the ExtOpcClient data extension) are not processed here.

In both cases, if for example 10 data items are simultaneously received from the OPC server then the event is fired only once and there are these 10 items in this array.

pEvent.VarName - (String) Data item name. The property is set only if the "onDataReceive" event configurator is set to "C = calling for each variable separately - only for variables defined in this object (obsolete)".

For example if 10 data items are received from the OPC server, then the event is fired for each item of the array and the name of the item is in pEvent.VarName.

pEvent.Reason - (Long) Reason of the receipt.
0 - Receipt from the automatic update (only if the Update from server at server change configurator is checked).
1 - After calling the Read method.
2 - After calling the Refresh method.
Note:
Calling this event can also be emulated in the INFO system when this object is being viewed and the "Actions" button is pressed. See permission PmRoot > Permissions > InfoEdit.
Example:
The "onDataReceive" event configurator is set to "A = call the event for all registered variables (in this object and also in other PmData objects)". We will report following information about the received data items into the Debug_info item of the INFO system:
VBScriptSelect and copy to clipboard

Dim i, u
u = UBound(pEvent.Items)
Pm.Debug "OPC onDataReceive: Count=" & (u + 1) & ", Reason=" & pEvent.Reason

For i = 0 To u
  Pm.Debug " Name = " & pEvent.Items(i).Var.Name
  Pm.Debug " Value = " & pEvent.Items(i).Var.Value
  Pm.Debug " Quality = " & pEvent.Items(i).Var.Quality
  Pm.Debug " ItemId = " & pEvent.Items(i).ItemId
Next
PROMOTIC 9.0.0 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice