Promotic
WikipediaLinkedInYoutubeTwitterFacebook

PmOpcClientData - Deatiled object description

See: Object PmOpcClientData
 
No other PROMOTIC objects can be created in this object. The PmOpcClientData object can be created only in the PmOpcClient. There can be even more PmOpcClientData objects in the PmOpcClient object.

This object adds variables into the calculation of the application size, which influences the basic runtime license type/size (see: Price list of PROMOTIC system ).

 
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 PmOpcClientData 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, it must enable the update for the group (see the Parameters page and the Update property). If the update is enabled, 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 property: UpdateRate and Deadband property). This 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, it is advisable to disable the automatic update. It is possible otherwise to leave the automatic update switched on and whilst for example to write but it could happen on this combination that before the client writes the required value to the OPC server, this value is updated from the server and thus the value that is already on the OPC server, will be written to it.

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 PmOpcClientData 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: (they can be used only when 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 machine 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 PmOpcClientData object, the #vars identifier enables access to the data items of the Var type defined on the Data page. This identifier can be used in methods working with application object tree (e.g. for the Pm method), or for the PP binding in the application and in panels. For example the pMe.Pm("opcdata/#vars/aaa") method returns the aaa data item from the object named opcdata that is of the PmOpcClientData type.

 
Data extension:

The varibales in the PmData object can use ExtOpcClient and register themselves directly into the PmOpcClientData. Then, on the page PmOpcClientData > Data, 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 such data has to be received/sent as well, than the Data type configurator has to be set to Variant data type for the data item (enabled only with the development key or with the PmRtProf license).

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

Dim arr, val
arr = oOpcData.Item(x).Value
val = arr(y)

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

oOpcData.Item(x).Value = Pm.TransformValue(arr, 41)
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice