What is the OPCChannel component intended for?
SharpShooter Gauges provides the capability to exchange data with OPC-servers. OPC is the industry standard for
interacting with real time devices. Utilizing the PerpetuumSoft OPCConnection and OPCChannel components, one can
perform data exchange without the need to use complicated COM interfaces.
OPCConnection
The OPCConnection component () is intended for producer-supplied device
COM-server connection setup. The design time adjusting is conducted by means of a convenient standard interface. It
is enough to place the component onto the form and call the connection setup window in a corresponding property
grid:
The window displays local OPC-servers and enables to connect to any server available within a local network
(requires necessary permissions including DCOM permissions – please, consult your system administrator).
OPCChannel
The OPCChannel component () is intended for adjusting the selected connection
data transmission channel. Please, note that it is necessary to set the required OPCConnection for the corresponding
component by means of the OPCConnection property in the property grid before adjusting data transmission channel.
The connection to an OPC-server takes place when the OPCConnection is being set up at design time or by user demand
at run-time (the EstablishConnection method).
After connection setup, a user can select any number of positions available on a server with the help of the Item
property in the property grid:
After a position is selected, this position’s properties such as ID, access rights and canonical data type are
displayed.
The canonical data type is the standard CLS-compatible .NET type:
Reading/writing from/into a data channel is handled by the corresponding OPCChannel public methods:
AsynchronousRead – asynchronous data slice read;
AsynchronousSubscription – asynchronous subscription to a data slice (s) with the assigned frequency and the number
of slices in one event;
Write – write;
The results of any operation are returned asynchronously; in this case OPCChannel generates an event. During the
transmission of data received by asynchronous read or subscription (AsynchronousRead and AsynchronousSubscription
correspondingly), a DataTransmission event the arguments of which contain the requested data together with the
ITransaction transaction descriptor is generated. The WriteStatus event is used to return the Write operation
results.
In order to handle events, it is necessary to specify a corresponding event handler:
opcChannel1.DataTransmission += new
PerpetuumSoft.Framework.Connectivity.DataTransmissionEventHandler(this.handler);
Please, look up in the ClassReference and utilization examples included in the delivery package for more
information. For proper sample operation installation of Matrikon OPC Simulation Server is required.
Step-by-step Example of Application Creation
Run Visual Studio and launch a WindowsForms application with one form. Then place the IndicatorWidget component
which will display the derivable values and the OPCConnection onto the form.
Select an OPC-server to connect to with the help of the Server property in the property grid. In the dialog window
select one of OPC-servers installed on your local host or local network.
-->
|