YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Sampled Data. Options · View
dinoken
#1 Posted : Wednesday, December 30, 2009 12:47:20 AM
Rank: Member

Groups: Member

Joined: 11/25/2009
Posts: 11
Location: Aberdeen
Merry Xmas and Happy new year all!



Argh. I am throughly stuck, how can i use the SDK to pull out a sampled range of data? (As in the sampled data in PI Datalink)

For example, i want to input start/end time, then the interval, and i want it to return an array of data.

Sponsor  
 
dinoken
#2 Posted : Wednesday, December 30, 2009 1:52:48 AM
Rank: Member

Groups: Member

Joined: 11/25/2009
Posts: 11
Location: Aberdeen
So for example,

I have the Start Time, End Time and interval (1m/1hr/1d)

How can i get all the values in one command?

cheers.

Ken
RJK Solutions
#3 Posted : Wednesday, December 30, 2009 11:05:35 AM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 458
Location: Cheshire, United Kingdom.
Hi Ken,

Merry christmas and happy new year.

You need to use the secondary interface "IPIData2", this then gives you the "InterpolatedValues2" method where you can specify an interval.

For IPIData2 you need to set it to the Data of your PIPoint that you want the sampled data then you can specify a start/end time with an interval - the interval uses normal PI time syntax.

Code example (VBA) where "srv" is a PISDK.Server variable:
Code:

Dim dat As PISDK.IPIData2
Set dat = srv.PIPoints("sinusoid").Data

Dim PIVals As PISDK.PIValues
Set PIVals = dat.InterpolatedValues2("*-1d", "*", "1h")
    Dim PIVal As PISDK.PIValue
    For Each PIVal In PIVals
        Debug.Print PIVal.TimeStamp.LocalDate & " " & PIVal.Value
    Next PIVal
Set PIVals = Nothing


Enjoy!
Rhys.


OSIsoft PI System Specialists
PI consultancy on PI Systems, PISDK, AFSDK, OLEDB etc and PI custom developments. Well pretty much anything to do with PI!


dinoken
#4 Posted : Wednesday, December 30, 2009 7:39:23 PM
Rank: Member

Groups: Member

Joined: 11/25/2009
Posts: 11
Location: Aberdeen
I suspected it was something like that.

Didn't realise it was the Interpolated values2, what is the difference between IPIData and IPIData2?

What is dat.InterpolatedValues for then?

You're a great PI man....thanks again for all your help!
Michael
#5 Posted : Monday, January 04, 2010 3:44:42 AM
Rank: Advanced Member
Groups: Member

Joined: 12/3/2009
Posts: 71
Location: Germany/Pennsylvania
Ken,

the difference between PIData.InterpolatedValues and IPIData2.InterpolatedValues2 is how you specify the interval.

Using PIData.InterpolatedValues you set the number of intervals
using IPIData2.InterpolatedValues2 you set the interval length as string
Users browsing this topic
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.