I'm looking to put together a report on our tags and their associated scan times but i need to first be able to pull a list of interfaces (point sources) and all their associated scan times.
Is there a way to programatically do this?
Using AFSDK, PIWebAPI, PowerShell Tools for the PI System, or our other developer technologies, you can get a list of PI points and the tag attributes for these tags. In your case, you would probably be just interested in the PI Point name, pointsource, location1 and location4 attributes. Typically, for most PI Interfaces, the location1 point attribute refers to the interface ID the point is registered with and the location4 attribute refers to the scan class # on that interface. This is half of the puzzle and is pretty straight-forward.
EX: for PowerShell see "get-pipoint" cmd-let, for AFSDK, see "OSIsoft.AF.PI.PIPoint" class
Unfortunately, there is no way to programmatically access the actual scan class times from the PI Server. These scan times are written in the interface batch file and not actually stored on the PI Server... to get this information you would probably need the application to remotely read the contents of the interface batch file into memory, then do some sort of regular expression parsing and some logic (using the tag attributes above) to determine the actual scan class timing for each point. This could get tricky, but is definitely possible.
Hope this helps, interested to see if anyone else jumps in with other ideas!
- Adam Fink
Consider searching this site for "Excel Is Our Friend" or "Treasure Island".
I wrote a blog series a few years back that included getting interface metadata from the PI Server modular database. I am sure there will be others that respond with simpler, less elaborate methods here, but thought this worth mentioning.
Hi Al and Richard,
Great idea Richard Koonce! And I agree it is definitely worth checking out the Excel is our Friend blog post, lot's of good stuff. The contents of the interface batch files are, in fact, stored in the module database.
Unfortunately, the AFSDK and PIWebAPI do not support reading from the module database. However, you should be able to programmatically access the module database and the scan class time values using the PISDK with the PIModule and PIProperty objects. Some documentation for this is listed below:
These links also provide some examples for getting property values from the module database.
Retrieving data ...