|
|
Rank: Administration
 Groups: Administration
Joined: 6/20/2008 Posts: 612 Location: Cheshire, United Kingdom.
|
In the previous example we showed you how to query the PI archives for values: Get Snapshot and Archive values
Following on from that example, we will switch our attention to the PI ODBC table "PIinterp" where we will retrieve an interpolated value for the passed timestamp - this is the same as PI-Datalink Archive Value function with retrieval mode set to Interpolated or PISDK.PIPoint.Data.ArcValue using PISDK.RetrievalTypeConstants.rtInterpolated.
Our only change to the previous example is to switch tables to PIinterp:
Previous SQL query: SELECT value FROM PIcomp WHERE TAG='SINUSOID' AND time =DATE('18-Nov-08 09:00') New SQL Query: SELECT value FROM PIinterp WHERE TAG='SINUSOID' AND time =DATE('18-Nov-08 09:00')
To implement:
Code:Sub RetrieveValues()
If PIODBC_Connection Then Dim RS As ADODB.Recordset Set RS = New ADODB.Recordset Set RS = Conn.Execute("SELECT value FROM PIinterp WHERE TAG='SINUSOID' AND time =DATE('18-Nov-08 09:00')") On Error Resume Next Debug.Print RS.Fields("VALUE").Value If Err.Number <> 0 Then Debug.Print "No archive value exists at this time." On Error GoTo 0 Set RS = Nothing Else
End If
End Sub
Providing there are good values in the archives for the PI tag you will retrieve the interpolated value at the passed time.
Principal Consultant Real-Time Data Management @ Wipro Technologies
|
|
|
|
|
OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System. We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ or contact OSIsoft vCampus for more details.
|
|
|
|
Guest
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.