AnsweredAssumed Answered

Catch value change event using PI SDK

Question asked by mimimomu on May 6, 2015
Latest reply on May 14, 2015 by mimimomu

Hi,

 

I was trying to use PI SDK in a .NET application (C#) to monitor and catch 4 PI tags' value. Once new value is written, then process some business logic...

I was trying to use the following code to get it working, but seems to have no luck getting the new value.

 

PISDK.PIPoint piPoint = piServer.PIPoints["XXXXXXX"];

piEventPipe = piPoint.Data.EventPipe;

      

_DEventPipeEvents_Event piPipeEvents = (_DEventPipeEvents_Event)piEventPipe;

piPipeEvents.OnNewValue += new _DEventPipeEvents_OnNewValueEventHandler(PI_Monitor_OnNewValue);

 

private void PI_Monitor_OnNewValue()

{

    What shoud I write here to retrieve the new value?

}

 

The above code did catch the value change event, but how do I get the new value from the callback method "PI_Monitor_OnNewValue"? Also, it seems that it only catches the value change once.

Can anyone point me to the right direction or show me a working example?

 

Much appreciated.

Outcomes