OPC .Net client server toolkits for OPC DA, HDA, AE, XML-DA      Advanced
OPC
Solutions    
         OPC .Net client server toolkits for OPC DA, HDA, AE, XML-DA
Online Tools
- OPC Error Lookup
Search  
   
* privacy and security Guaranteed  
OPCDA.NET Display Subscriptions Login  

OPCDA.NET Client Component

Data Binding Subscriptions

OPCDA.NET version 4 added support for Data Binding Subscriptions that transfer item values directly into properties of application objects. If an object is a Windows control then the item values are displayed without need for any user callback handlers. Server items bound to a property of any class cause the property Set accessor to be executed as the callback handler.

The application shown below in code and in a screenshot displays and updates the OPC server item values, with only the few lines of VB.NET code. No other OPC related code is required.

This simplicity does not come at the cost of performance or flexibilty. OPCDA.NET is structured into layers and the multi-threaded implementation allows the user application to access all layers. While the data binding subscriptions handle some items, the application can access these or other items synchronously or asynchronously and execute any other OPC server functions.
Multiple OPC servers can be simultanously accessed by instantiating multiple access objects.

   Private Sub btnConnect_Click(ByVal sender As System.Object, _
                  ByVal e As System.EventArgs) Handles btnConnect.Click
      ListView1.Items.Clear()
      ListView1.Items.Add("")
      ListView1.Items.Add("")
      Try
         tbStatus.Text = "Connected"
         OpcBind = New OpcDataBind(Me, cbOPCServers.Text)

         OpcBind.Subscribe("SimulatedData.Signal", CheckBox1)
         OpcBind.Subscribe("SimulatedData.Ramp", ProgressBar1)
         OpcBind.Subscribe("Dynamic.Analog Types.Double[]", _
                              ListView1.Items(1).SubItems, 0)
      Catch ex As OPCException
         tbStatus.Text = ex.Message
      End Try
   End Sub
   Private Sub btnDisconnect_Click(ByVal sender As System.Object, _
           ByVal e As System.EventArgs) Handles btnDisconnect.Click
      OpcBind.Disconnect()
      tbStatus.Text = "Disconnected"
   End Sub

The OPCDA.NET DataBind Subscriptions handle data type conversions, value transformations and formatting according the property data type and the subscription definitions. Properties of data type DataBindEventData get all callback item data including quality and timestamp.

The following Windows control objects are handled specially to even further simplify usage:

  • CheckBox
    The item value is converted to a boolean and the checkBox is checked if the value is true.
  • TextBox ( single or multi-line)
    The item value is converted to a string and copied to the textBox.Text property.
    In a multi-line textBox array item values are displayed with one value per line.
  • ComboBox ( Text Field)
    The item value is converted to a string and copied to the comboBox.Text property.
  • ComboBox.ObjectCollection
    The item value is converted to a string and copied to the comboBox.Item[0]. If an index is specified in the Subscribe call then this index is used instead of 0. Array item values are stored in consecutive comboBox.Item elements, starting at the specified index. Item elements are added if necessary.
  • ListBox or ListBox.ObjectCollection
    The item value is converted to a string and copied to the listBox.Item[0]. If an index is specified in the Subscribe call then this index is used instead of 0. Array item values are stored in consecutive listBox.Item elements, starting at the specified index. Item elements are added if necessary.
  • ListView or ListViewItemCollection
    The item value is converted to a string and copied to the listView.Item[0]. If an index is specified in the Subscribe call then this index is used instead of 0. Array item values are stored in consecutive listView.Item elements, starting at the specified index. Item elements are added if necessary.
  • ListViewItem.ListViewSubItemCollection
    The ListView must be configured for Detail view. The item value is converted to a string and copied to the listView.Item[x].SubItem[0]. The item[x] must be added by the caller. If an index is specified in the Subscribe call then this index is used instead of 0. Array item values are stored in consecutive listView.Item.SubItem elements, starting at the specified index. SubItem elements are added if necessary.
  • ProgressBar
    The item value is converted to an integer and copied to the progressBar.Value property. The progressBar control must be configured for the maximal possible item value or the item value must be transformed to match the progressBar maximal value.
  • TrackBar
    The item value is converted to an integer and copied to the trackBar.Value property. The trackBar control must be configured for the maximal possible item value or the item value must be transformed to match the trackBar maximal value.

 

The following screenshot shows the provided sample application that updates simple and array item values in many different types of controls.

OPCDA.NET client component Display Subscriptions


The user can control how the items values are displayed by assigning a formatting object to the subscription. Formatting includes features such as:

  • string conversion format for numeric values
  • string conversion format for DateTime values
  • linear transformation of numeric values
  • definition of the data type requested from the server
  • display of quality and error information

 

home | contact us | return policy | privacy policy | security policy | Copyright © 2018 Advosol Inc. All Rights Reserved.