See: The PmaOpcDaClientGroup
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 PmaOpcDaClientGroup
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
" tab 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
" tab 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
property and Deadband
property). It means that the OPC server will not sent the data to the client faster that it is defined in the minimum update rate and it will not 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 server. This means that the value being written to 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 PmaOpcDaClientGroup
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)
- reading all values of the data group from the OPC server
- reading the defined block in the data group from the OPC server
- writing the defined block in the data group to the OPC server
At the Refresh
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.
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
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.
In the PmaOpcDaClientGroup
object, the #vars
identifier enables access to the variables (of the PmVar
type) defined on the "Data
" tab. This identifier can be used e.g. in the Pm
method, or for the PP data binding in the application
and in panels
. For example the method pMe
returns the aaa
variable from the object named "opcdata
" that is of the PmaOpcDaClientGroup
The variables in the PmaData
object can use ExtOpcDa
and register themselves directly into the PmaOpcDaClientGroup
object. Then, on the "PmaOpcDaClientGroup > Data
" tab, it is not necessary to define any variables.
Data vector transfer
Some OPC servers (for Simatic
...) 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 licence
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.
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