PI for StreamInsight Samples - Starting with Spike Counter

Discussion created by kchudnovskiy Employee on Dec 6, 2011

New PI for StreamInsight samples are now available in the Download Center!. These samples were designed to demonstrate integration with the PI system and highlight various features of StreamInsight. 


- Spike Counter: Identifies a number of tags with the greatest number of events over a specified threshold for a specified interval.


- Wall Clock CTIs: Adds CTIs from an additional external stream in order to make the PI data stream be processed at a regular time interval.


- Replaced Values: Uses AF SDK to bring in parameters stored in an AF database and clips input values to within a specified range.


- Data Gap: Finds data gaps of a specified size in a group of tags.


While most of the samples are new, Spike Counter is an updated version of a sample already posted. This is a good sample to start with since it clearly shows the steps followed in the development process. While the PI input and output adapters are used in the end, the SimpleTextFileReader and OutputTracer adapters are used in intermediate steps. This allows for development independent of any PI system with strictly controlled input and output written to console. Connection to the PI server is only included once the calculation behaves as expected. Blocks of code marked with "#if false" may be toggled to switch between adapters.


Nine input tags, configured for the Random interface, are taken as input. The values are filtered and only those passing a defined threshold are accepted. A tumbling window is applied to the stream of events. This window counts the number of events for each tag and ranks the top three tags.


This type of summary calculation is a natural fit for Linq and StreamInsight!