matt.inglis

DataPipes madness?

Discussion created by matt.inglis on Feb 28, 2013
Latest reply on Mar 26, 2013 by andreas

Hi,

 

Im Starting out working with DataPipes, im a bit confused with the results though

 

My code is bellow:

 

 

 
PointList Points = new PointList();
            Points.Add(MyPIServer.PIPoints["cdt158"]);
            Points.Add(MyPIServer.PIPoints["sinusoid"]);
            SnapshotEventPipe = Points.Data.EventPipe as IEventPipe2;
            SnapshotEventPipe.NotifyThreshold = 2;
            Array T = null;
            Array T2 = null;
            SnapshotEventPipe.ListSignUps(out T,out T2);
            foreach (var v in T)
            {
                Console.WriteLine("Monitoring Points: ");
                PointList PL = v as PointList;
                foreach (PIPoint P in PL)
                {
                    Console.WriteLine(P.Name);
                }
            }

            _DEventPipeEvents_Event SnapshotEvent;
            try
            {
                SnapshotEvent = SnapshotEventPipe as _DEventPipeEvents_Event;
                SnapshotEvent.OnNewValue += new _DEventPipeEvents_OnNewValueEventHandler(SnapshotEvent_OnNewValue);
            }
            catch
            {
                Console.WriteLine("Event Pipe Failed!");
            }
        }

        public void SnapshotEvent_OnNewValue()
        {
                if (SnapshotEventPipe.Count == 0)
                {
                    return;
                }
                Console.WriteLine("Event Fired...");
                    Array PIEvents = SnapshotEventPipe.TakeAll();
                    foreach (PIEventObject Obj in PIEvents)
                    {
                        PointValue PV = Obj.EventData as PointValue;
                        Console.WriteLine(PV.PIPoint.Name + " : " + PV.PIValue.Value + " @ "+ PV.PIValue.TimeStamp.LocalDate);
                    }
                
        }

 That should give me every new event for those points in batches of 2 however what i get back is the same point in batches of 4, two of which results are duplicates.

 

It also strangely only shows one point per event fired.

 

So i get results like below:

 

 

 

nt Fired...
sinusoid : 83.03262 @ 28/02/2013 13:22:42
sinusoid : 83.19608 @ 28/02/2013 13:23:12
sinusoid : 83.03262 @ 28/02/2013 13:22:42
sinusoid : 83.19608 @ 28/02/2013 13:23:12
Event Fired...
cdt158 : 78.06689 @ 28/02/2013 13:23:42
cdt158 : 78.70989 @ 28/02/2013 13:24:12
cdt158 : 78.06689 @ 28/02/2013 13:23:42
cdt158 : 78.70989 @ 28/02/2013 13:24:12

Outcomes