|
|
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.
|
|
|
|
|
|
|
|
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
|
|
|
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 SpecialistsPI consultancy on PI Systems, PISDK, AFSDK, OLEDB etc and PI custom developments. Well pretty much anything to do with PI!
|
|
|
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!
|
|
|
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
|
|
|
|
Guest
|