PIDataPipe Class
- Last UpdatedNov 18, 2025
- 7 minute read
- PI System
- AF SDK 2024 R2
- Developer
Inheritance Hierarchy
OSIsoft.AF.PIPIDataPipe
Namespace: OSIsoft.AF.PI
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public sealed class PIDataPipe : IDisposable
Public NotInheritable Class PIDataPipe Implements IDisposable Dim instance As PIDataPipe
public ref class PIDataPipe sealed : IDisposable
[<SealedAttribute>] type PIDataPipe = class interface IDisposable end
The PIDataPipe type exposes the following members.
Constructors
| Name | Description | |
|---|---|---|
| PIDataPipe |
Constructs a new PIDataPipe used to sign up for events on a list of PIPoint objects
|
Properties
| Name | Description | |
|---|---|---|
| DataPipeStatistics |
Contains statistics for the most recent signup or event scan.
|
Methods
| Name | Description | |
|---|---|---|
| AddSignups |
Adds a list of PIPoint objects to be monitored by the data pipe.
The method returns server level and point level errors in AFErrorsTKey .
| |
| AddSignupsWithInitEvents |
Adds a list of PIPoint objects to be monitored by the data pipe and returns the
initial events for this list of new signup objects.
PIserver level and point level errors can be accessed in the AFListResultsTKey, TResult | |
| AsReadOnly |
Returns a read only list of PIPoint objects currently monitored by the data pipe.
| |
| Close | ||
| Dispose | ||
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
| GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
| GetObserverEvents |
Trigger retrieval of new events that occurred on the PIPoint objects monitored
by the data pipe. The new events will be sent to the IObserver objects registered with the data pipe.
| |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| GetUpdateEvents |
Retrieves new events that occurred on the PIPoint objects monitored by the data pipe.
| |
| ListSignUpsByServer | ||
| RemoveSignups |
Remove a list of PIPoint objects being monitored by the data pipe.
The method returns server level and point level errors in AFErrorsTKey .
| |
| Subscribe |
Register an IObserver for AFDataPipeEvent with the PIDataPipe. All the AFDataPipeEvents
received by the data pipe will be sent to the IObserver.
| |
| ToString | Returns a string that represents the current object. (Inherited from Object.) |
Remarks
There are two ways to get the data change events: a) direct GetUpdateEvents method to get events; b) through IObserver of AFDataPipeEvent. The IObserver pattern provides significant performance improvement over direct GetUpdateEvents method for high throughput scenario. Application will have to implement the IObserver and register the IObserver with the data pipe via the Subscribe(IObserverAFDataPipeEvent) method.
| This method, property, or class is not available in the legacy .NET 3.5 version of the SDK. |
Examples
// This example demonstrates how to create a PIDataPipe that receives // snapshot events for a list of PIPoint objects. // Get default PI Data Archive PIServer myServer = PIServers.GetPIServers().DefaultPIServer; // List to hold the PIPoint objects that we will sign up for updates on List<string> nameList = new List<string>(); List<string> ptattList = new List<string>(); // Add points we are interested in nameList.Add("sinusoid"); nameList.Add("sinusoidu"); nameList.Add("cdt158"); nameList.Add("cdm158"); ptattList.Add(PICommonPointAttributes.PointType); ptattList.Add(PICommonPointAttributes.Zero); ptattList.Add(PICommonPointAttributes.Span); IList<PIPoint> myList = PIPoint.FindPIPoints(myServer, nameList, ptattList); List<AFDataPipeEvent> pipeResults = new List<AFDataPipeEvent>(); // Create a new data pipe for snapshot events using (PIDataPipe myDataPipe = new PIDataPipe(AFDataPipeType.Snapshot)) { // Sign up for updates on the points myDataPipe.AddSignups(myList); // For the next 30 seconds... for (int secondsIndex = 0; secondsIndex < 30; secondsIndex++) { // Get events that have occurred in the last second AFListResults<PIPoint, AFDataPipeEvent> myResults = myDataPipe.GetUpdateEvents(10); // If there are some results if (myResults.Results.Count > 0) { // For each event... foreach (AFDataPipeEvent mySnapshotEvent in myResults.Results) { // If the event was added or updated in the snapshot... if (mySnapshotEvent.Action == AFDataPipeAction.Add || mySnapshotEvent.Action == AFDataPipeAction.Update) { // Display the new value DisplaySnapshot(mySnapshotEvent.Value.PIPoint.Name, mySnapshotEvent.Value.Value); } pipeResults.Add(mySnapshotEvent); } } // Wait one second System.Threading.Thread.Sleep(1000); } }
' This example demonstrates how to create a PIDataPipe that receives ' snapshot events for a list of PIPoint objects. ' Get default PI Data Archive Dim myServer As PIServer = PIServers.GetPIServers().DefaultPIServer ' List to hold the PIPoint objects that we will sign up for updates on Dim myList As List(Of PIPoint) = New List(Of PIPoint) ' Add points we are interested in myList.Add(PIPoint.FindPIPoint(myServer, "sinusoid")) myList.Add(PIPoint.FindPIPoint(myServer, "sinusoidu")) myList.Add(PIPoint.FindPIPoint(myServer, "cdt158")) myList.Add(PIPoint.FindPIPoint(myServer, "cdm158")) ' Create a new data pipe for snapshot events Dim myDataPipe As PIDataPipe = New PIDataPipe(AFDataPipeType.Snapshot) ' Sign up for updates on the points myDataPipe.AddSignups(myList) System.Threading.Thread.Sleep(2000) '//make sure no timing issue in testcase ' For the next 30 seconds... For secondsIndex As Integer = 1 To 30 'Get events that have occurred in the last second Dim myResults As AFListResults(Of PIPoint, AFDataPipeEvent) = myDataPipe.GetUpdateEvents(10) ' For each event... For Each mySnapshotEvent As AFDataPipeEvent In myResults.Results ' If the event was added or updated in the snapshot... If mySnapshotEvent.Action = AFDataPipeAction.Add OrElse mySnapshotEvent.Action = AFDataPipeAction.Update Then ' Display the new value DisplaySnapshot(mySnapshotEvent.Value.PIPoint.Name, mySnapshotEvent.Value.Value) End If Next System.Threading.Thread.Sleep(1000) Next ' Release resources myDataPipe.Dispose()
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
private static void DisplaySnapshot(string tagName, object value) { // Display the tag name along with the new snapshot value Console.WriteLine("PI Point: {0} Snapshot Value: {1}", tagName, value); }
Private Shared Sub DisplaySnapshot(tagName As String, value As Object) ' Display the tag name along with the new snapshot value Console.WriteLine("PI Point: {0} Snapshot Value: {1}", tagName, value) End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.