StreamInsight Extensions for QuickOPC
The StreamInsight Extensions for QuickOPC allow you to bring in streaming data from OPC sources into StreamInsight, analyze them and process them further, and even feed the results back to OPC servers. With OPC StreamInsight, data from OPC can be combined with data from multiple other sources. You can monitor the data for meaningful patterns, trends and exceptions. Streaming OPC data can be analyzed and correlated while they are in-flight.
Microsoft StreamInsight is a platform for writing and running complex event processing (CEP) applications. Such application can e.g.:
- Acquire events from multiple data streams, process them, search for correlations, and pinpoint important conditions in the monitored processes.
- Provide centralized means for processing of high volume, real-time data.
- Make complex analysis of the data in the time domain.
- Aggregate data streams originating in different sources.
- Gain continuous operations performance insight.
The StreamInsight Extensions for QuickOPC support connections to OPC servers with following specifications:
- OPC Data Access
- OPC XML-DA
- OPC Alarms and Events
- OPC Unified Architecture (data access)
The StreamInsight support in QuickOPC is not separate from its other parts. Instead, the OPC streaming data layer builds on top of many features and components already available in QuickOPC. Specifically, the StreamInsight Extensions make ideal usage of the connection-less approach in QuickOPC, and the reactive programming model (OPC Reactive Extensions, Rx/OPC). This means that you can also easily combine the StreamInsight development with all other features and extensions provided by QuickOPC.
For more information:
StreamInsight Extensions (in QuickOPC User's Guide) (online)
StreamInsight Code Example
The code snippet below will define and deploy a StreamInsight input source. In this example, the data is a simple temporal stream of point events generated by an OPC Data Access server.
// DEFINE a simple SOURCE (returns a point event every second) const string machineName = ""; const string serverClass = "OPCLabs.KitServer.2"; const string itemId = "Simulation.Incrementing (1 s)"; var observable = DAItemChangedObservable.Create<int>(machineName, serverClass, itemId, 100); var mySource = myApp .DefineObservable(() => observable) .ToPointStreamable( eventArgs => PointEvent.CreateInsert(DateTimeOffset.Now, (DAItemChangedPayload<int>)eventArgs), AdvanceTimeSettings.StrictlyIncreasingStartTime);
Next, we will compose a query over the input source. The query uses LINQ as the query specification language. In this example, the query returns the events where the value of the OPC item is an even number.
// Compose a QUERY over the source (return every event carrying even data value) var myQuery = from e in mySource where e.VtqPayload.Value % 2 == 0 select e;
Technically, this definition translates to a filter operator that drops all events from the sequence that do not fulfill the filter predicate (where e.VtqPayload.Value % 2 == 0) and returns the event value.
Useful links: Documentation / Examples / Knowledge Base
Footnote & required disclosure: QuickOPC (including its Options) is a software development kit (SDK) for development of OPC clients. Installing QuickOPC or its Options does not change system settings.