OPC Controls Data

The OPCControlsData component is used to read and write values to Open Automation Software Tag Parameters.

Reading and writing to both local and remote OAS Service Tags simplifies the task of reading and writing live data from each OAS data source.

If a Tag Parameter Source is defined other than Value or Calculation when a value is written to the value of the parameter the value is written to the data source defined.

View the .NET Realtime Data Access section in Programmatic Interface topic for examples of reading and writing data.

OPC Controls Data 354

To add an OPC Controls Data component select the OPCControlsData component from the ToolBox and place it on any Windows Form of your choice.  Add OPC Controls Components to Visual Studio.NET to add the OPC Controls Data component to the ToolBox.

OPC Controls Read Values

Refer to the Read Data Continuously example code for a full example on how to read data from Open Automation Software Tags.

To read values from the Open Automation Software involves one simple method to let the OAS Services which Tags you wish to read and one simple event receive all changes and updates to the Tags you wish to read.

Use the AddTag or AddTags as many times as you desire to subscribe to both local and remote OAS Services.

Dim Tags(2) As String
        Tags(0) = "Ramp.Value"
        Tags(1) = "Sine.Value"
        Tags(2) = "Random.Value"
        OpcControlsData.AddTags(Tags)

Use the ValuesChangedAll Event to receive the requested values continuously any time the values are requested or the values change.

Private Sub OpcControlsData_ValuesChangedAll(ByVal Tags() As String, ByVal Values() As Object, ByVal Qualities() As Boolean, ByVal TimeStamps() As Date) Handles OpcControlsData.ValuesChangedAll

Use the RemoveTag or RemoveTags as many times as you desire to unsubscribe to both local and remote OAS Services.

Dim Tags(2) As String
        Tags(0) = "Ramp.Value"
        Tags(1) = "Sine.Value"
        Tags(2) = "Random.Value"
        OpcControlsData.RemoveTags(Tags)

OPC Controls Write Values

Refer to the Write Data example code for a full example on how to write data to Open Automation Software.

To write values from the Open Automation Software involves one simple method to write the values, one simple method to let the OAS Services which Tags you wish to read to confirm the value was successful, and one simple event receive all changes and updates to the Tags you wish to read.

Use the WriteTag or WriteTags to send the desired values to the tags.

OpcControlsData.WriteTag("Write OPC Output.Value", 1.23)