AnsweredAssumed Answered

C# code snippet Needed to get starttime and number of hours unit went to certain digital state

Question asked by PJain on Dec 24, 2019
Latest reply on Jan 2, 2020 by gregor

Hello Team,


Greetings for the day!


Please refer to the below screen shot is there any possible way to code in C# using PI SDK or AF SDK. This code should return me 2 things 

1. DateTime when unit went in Standby Stage. (I cannot give start time and end time as I am not aware it is hours, days or month.

2. Number of hours unit is in StandBy Mode.


Note: I have 3 modes (Inservice, Standby and not available, I need to get datetime and number of hours unit not inService)  



I am using  below AF Analysis for the above purpose: 


TimeNE('GT STATUS', NextEvent('GT STATUS', FindEq('GT STATUS', FindNE('GT STATUS','*','*-365d',"INSERVICE"),'*-365d',"INSERVICE")),'*',"INSERVICE")/60/60


Thanks & Regards,

Paresh Jain