This project has moved and is read-only. For the latest updates, please go here.

How to access the input stream statistics from an action adapter?

Mar 10, 2016 at 9:43 PM
Hi there,

I am trying to access the input stream statistics (connected, min/max/ave latency, etc. ) from an action adapter. I traced it to the TVA.PhasorProtocols.CommonPhasorServices but I am stuck there... Help please~~~

Mar 10, 2016 at 10:03 PM
Hi Frankie,

It sounds like you are using an older version of the openPDC so I hope my information is relevant. You should be able to control the measurements processed by your action adapter using the InputMeasurementKeys parameter in the connection string. Try adding the following to your connection string.

InputMeasurementKeys={ FILTER ActiveMeasurements WHERE SignalReference LIKE '%!IS-ST%' }

Mar 11, 2016 at 2:49 PM
Hi Stephen,

I am using the code set 97664, I guess I traced it back to an old piece of code. I am programming an action adapter that could take the latest input stream statuses and send out an email if something went wrong. What would be the best way to get that real-time status? Are there any sample code I can refer to? I looked into the CommonPhasorServices class and found all the methods there were private static, so not sure how to use them. Maybe like you said, that's old school.

Mar 11, 2016 at 3:04 PM
I think you're on the right track. An action adapter extending from FacileActionAdapterBase with a set of input measurement keys defined as I stated above would receive all the input stream statistics via the QueueMeasurementsForProcessing method. You will probably need to do some lookups in the DataSource object to find the signal reference of each measurement in order to determine which statistic is which. Then, whenever anything goes wrong with one of your input stream statistics, you can send out an email describing the problem.

There are a couple alternate strategies as well, which you may find a little easier. You can write a separate application which uses GEP to subscribe to the input stream statistics. This would allow you to write your email app in C++ or Java, and the GEP Subscriber APIs are pretty well documented. The other alternative would be to poll the STAT historian on a timer for changes to the input stream statistics. This may be a little harder since the historian API is not as well documented. You can look at the code for the Historian Trending Tool as an example of how to use that API.

Mar 11, 2016 at 3:11 PM
Cool. Thanks a lot! I'll look into it.
Apr 1, 2016 at 4:07 PM
Still curious about the private static methods in the CommonPhasorServices like GetInputStreamStatistic_MinimumLatency, which has 0 reference. How are they used or just sample codes?
Apr 1, 2016 at 4:11 PM
The system uses reflection to call the code - the code "definition" to call can be found the Statistic table.

Hidden or not, you can call any code you want if you know where it is and what it is called.

Apr 1, 2016 at 10:46 PM
Thanks! So, going back to what Stephen has taught me, if I make a class that's derived from the FacileActionAdapterBase, I should use the QueueMeasurementsForProcessing method to get various statistics. Is there anything I should do to enable the adapter? Any service to attach to? I'm also not sure where to specify the input measurement filter. Sorry, still a C# newbie. Thanks!