I'm trying to use Matlab to download time-averaged data from PI server and found PIPoint.Summaries may do the job for me.
Below is the very simple testing example.
NET.addAssembly('OSIsoft.AFSDK'); import OSIsoft.AF.* import OSIsoft.AF.Asset.*; import OSIsoft.AF.Time.*; import OSIsoft.AF.Data.*; import OSIsoft.AF.PI.*; piservers = OSIsoft.AF.PI.PIServers; pisrv = piservers.DefaultPIServer; point = PIPoint.FindPIPoint(pisrv,'sinusoid'); % timerg = AFTimeRange('*-1d','*'); inter = AFTimeSpan(0,0,0,1); % 1hr interval summarizedVals = point.Summaries(timerg, inter, AFSummaryTypes.Average, AFCalculationBasis.TimeWeighted, AFTimestampCalculation.Auto);
The summarizedVals returns a dictionary object: 1x1 Dictionary<OSIsoft*AF*Data*AFSummaryTypes,OSIsoft*AF*Asset*AFValues>
I'm not familiar with .NET syntax. I tried to use summarizedVals.TryGetValue, but I don't know what shall be the (TKey, Tvalue) in the method TryGetValue(TKey, TValue). I would like to have an array (length of 24, that is 1d with 1h interval) with values and times, but don't know how to realize that.
My question is: how can I retrieve values from summarizedVals and store them in an array in Matlab? Thank you.