PIDataPipe Class
- Last UpdatedJan 12, 2026
- 6 minute read
- PI System
- AF SDK 3.2.0
- Developer
The PIDataPipe is used to subscribe for data change events on a list of PIPoint instances.
The PIPoint instances do not have to be associated with the same PIServer.
PIDataPipe instances can sign up for archive, snapshot or timeseries events. The pipe type is
specified when the data pipe object is constructed.
Inheritance Hierarchy
SystemObject
OSIsoft.AF.PIPIDataPipe
OSIsoft.AF.PIPIDataPipe
Namespace: OSIsoft.AF.PI
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.2.0.7
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); } }
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); }