AVEVA OMI Software Developer Kit
Using the RunTimeData SDK

The namespace of all APIs in the RunTimeData SDK is:

  • ArchestrA.Client.RuntimeData

The assembly name of the RunTimeData SDK is:

  • ArchestrA.Client.RuntimeData.dll

The general workflow for using the RuntimeData SDK is:

  1. Implement the IRuntimeDataClient interface in the control of the app. If you need to provide the ability to read or write any run-time data, you must implement the IRuntimeDataClient interface to receive the DataSubscription instance. Note that data subscription is automatically suspended when the app window is minimized, and resumes when the window is restored.
    Implement IRuntimeDataClient Interface
    Copy Code
    public partial class UserControl1, IRuntimeDataClient
    {
       public DataSubscription DataSubscription { get; set; }
          
    }
  2. Establish a subscription to a reference and read the value.
    Subscribe to a DataReferenceSource
    Copy Code
    DataReference[] references = this.DataSubscription.Subscribe(new []
    {
        new DataReferenceSource("GRNode.CPULoad", (r) =>
        {
           // The action is executed in a background thread, so do not operate the UI directly
           this.CPUUsage = r.VT.ValueAsDouble;
         }
    }

    The callback in the above sample is sent from a background thread. If the handler code in the App has any UI-specific logic, the handler must execute in its Dispatcher. The above value is received in an action that has been passed in. Alternatively, you can get the data by using references[0].VTQ.Value.

  3. Optional: Asynchronous read:
    Asynchronous Read
    Copy Code
    var vtqArray = await this.DataSubscription.ReadAsync
    {
        new [] {new DataReferenceSource("GRNode.CPULoad")} }
  4.  Write from subscription (see step 2 for subscription details). The following code sample shows how to write data to the subscription.
    Write to Subscription
    Copy Code
    references[0].Write(10, (r, s)=>{});
    /// Or to write to an element in array:
    references[0].Write(10, 0, (r, s)=>{});
  5. Optional: Asynchronous write:
    Asynchronous Write
    Copy Code
    var status = await this.DataSubscription.WriteAsync(new DataRefereceSource(“Tank1.SP”), 10);
See Also