Promotic
WikipediaLinkedInYoutubeTwitterFacebook

PmaOpcClientGroup - Deatiled object description

See: The PmaOpcClientGroup object
 
The standard OPC server (providing data) receives the data from a data source (e.g. the PLC machine - further we'll call it DEVICE), stores them into its temporary cache memory (further we'll call it CACHE) and provides them then to the connected clients.

For the optimization of the data transfer rate each data client (in this case the PmaOpcClientGroup object) informs the OPC server how it wants to share the specified data. By one of these optimizing parameters it is possible for the data group to set if the group is active (see the "Parameters" page and the ActiveGroup property). If the group is not active (nor other clients require these data), then the OPC server needn't update these data in its CACHE memory and thus it can update other data more often.

Another optimization is the selection of the data receipt mode. The OPC client can decide if it'll receive the data automatically (and thus it wants the OPC server to sent it the data values that were changed) or if it wants to control the data itself (read and write to the OPC server on a request).

If the OPC client is to receive the data automatically, then it must enable the update for the group (see the "Parameters" page and the Update property). If the update is enabled, then the OPC server sends changed data values of this group automatically to the client. The update can be further optimized by setting the parameters: the minimum update rate and the dead band (see UpdateRate property and Deadband property). It means that the OPC server won't sent the data to the client faster that it is defined in the minimum update rate and it won't sent the data if the change of the value is less than the dead band (the change from the last sent value to the client is meant).

If the OPC client is to read and write to the OPC server itself, then it is advisable to disable the automatic update. It is possible to leave the automatic update activated while writing, but this combination may cause that before the client writes the required value to the OPC server, this value is updated from the server. This means that the value being written into the OPC server is already there.

For similar reasons it is often desirable - if you want to read the items and to write into them at the same time - rather to create two OPC groups (two PmaOpcClientGroup objects). One group will be determined for reading and the other for writing. Thus the real value states can be better controlled.

 
The following methods serve for reading and writing the OPC server values: (can be used only if automated receipt or writing is not switched on)
Refresh - reading all values of the data group from the OPC server
Read - reading the defined block in the data group from the OPC server
Write - writing the defined block in the data group to the OPC server
 
At the Refresh and Read methods it is possible to set if the values have to be read from the CACHE or the DEVICE. It is presumed that most clients will read the data from the CACHE. The direct access to the data from the DEVICE is slower in general and it should be used only for diagnostic purposes or critical operations.

The Write method writes the data always into the DEVICE (thereby it is ensured that the data are always written for example into the PLC device and not only into the cache of the OPC server).

 
At the 3 above-mentioned methods it is possible to set if the operation has to be performed asynchronously or synchronously. By calling the method in the asynchronous mode the transfer is only started but after calling the method it is not ensured that the physical transfer has terminated. This mode is suitable if it is necessary to write/read into/from the DEVICE because the data transfer into the DEVICE is slower in general (a few seconds) and in case of the synchronous mode the algorithms of the PROMOTIC application would be halted all the time. Calling the methods in the synchronous mode is advisable for reading from the CACHE of the OPC server (located on the same computer as the client) because reading from the CACHE is very fast and after the successful termination of the method it is certain that the data values have been updated. Writing algorithms for the synchronous mode is therefore simpler.
 
#vars identifier:

In the PmaOpcClientGroup object, the #vars identifier enables access to the variables (of the PmVar type) defined on the "Data" page. This identifier can be used e.g. for the Pm method, or for the PP data binding in the application and in panels. For example the method pMe.Pm("opcdata/#vars/aaa") returns the aaa variable from the object named opcdata that is of the PmaOpcClientGroup type.

 
Data extension:

The variables in the PmaData object can use ExtOpcClient and register themselves directly into the PmaOpcClientGroup object. Then, on the "PmaOpcClientGroup > Data" page, it is not necessary to define any variables.

 
Data vector transfer:

Some OPC servers (for Simatic, Schneider, Bernecker&Reiner ..) can transfer a data array (Array) in one data item (the common limitation is that all data array items must be of the same data type). If it is necessary to receive/send such data as well, then the "Data type" configurator has to be set to Variant data type for the variable (this is disabled in PmRtFree - Free runtime license).

When receiving data containing item of the Array type, the PROMOTIC system modifies this item into the standard form (e.g. the Integer values array is transformed into the Variant values array of the Integer type). Then one item from this array can be read e.g.

JavaScriptVBScriptSelect and copy to clipboard

var arr = oOpcData.Item(x).Value;
var val = arr.GetItem(y);
 

When sending the data containing the item of the Array type it is necessary to save a vector, that is not in the standard form, into this item. It can be done e.g. by the Pm.TransformValue method with parameter 41 e.g.

JavaScriptVBScriptSelect and copy to clipboard

oOpcData.Item(x).Value = Pm.TransformValue(arr, 41);
PROMOTIC 9.0.6 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