Methods for querying large volumes of pi tags?

Discussion created by shubert on Dec 1, 2014
Latest reply on Dec 4, 2014 by shubert



I want to be able to (in a reasonable query time) run through our 500,000 odd meters and show days in the last 30 days where we did not get a read (one a day recorded value in pi) for them.


Using extracts from Mathieu Hamel's posts, I have started to go down the path of doing it with powershell and he has told me I could consider AF SDK & Powershell together.


This is what i have so far (just returning values for one tag and counting a number of tags as a start on the next stage). Can someone suggest a good way of achieving this? Thanks




# Add a reference to the PI SDK assembly. [reflection.assembly]::loadwithpartialname("OSIsoft.PISDK") | Out-Null [reflection.assembly]::loadwithpartialname("OSIsoft.PISDKCommon") | Out-Null


# Create a new PI SDK object. $_PISDK = New-Object PISDK.PISDKClass $_Asynch = New-Object PISDKCommon.PIAsynchStatusClass


$_ModeEnum = [PISDK.RetrievalTypeConstants]::rtAtOrBefore


# Open a connection with the PI Server specified. $_PIServer = $_PISDK.Servers.Item("--------------")


$_MyPoint = $_PIServer.PIPoints.Item("UnityPH3_--------------------------------.Input001._Summation_Forward_Gas___(CubicMeters).Value")


$_TagList = @() $_WhereClause = "Tag='*UnityPh3_E6*_Summation_Forward_Gas___(CubicMeters).Value'"


 $_TagList = $_PIServer.GetPoints($_WhereClause, $_Asynch)


 Start-Sleep -m 109999


 $_TagCount = [int32]$_TagList.Count


 "UnityPh3 count:" + $_TagCount


$_date = get-date -format "dd-MMM-yyyy"


 $i = 0


do {


  $_date = ((get-date).AddDays($i)).ToString("dd-MMM-yyyy")


  $_PIValues = $_MyPoint.Data.ArcValue($_date,$_ModeEnum, $_Asynch)








$i-- } while ($i -ge -30)