Hello all,
I have a C# code which reads PI point average values with PI SDK API. I have no skills on Web API... how could I do it with PI Web API ? Thanks.
private static void GetfromPI(DateTime starttime, DateTime endtime, string pi_tag, string pi_server, out int ierror)
{
ierror = 0;
double value = new double();
string tag = @"\\" + pi_server + @"\" + pi_tag;
PISDK.PISDK uPISDK = new PISDK.PISDK();
PISDK.PIPoint pipoint = uPISDK.GetPoint(tag);
try
{
pipoint = uPISDK.GetPoint(tag);
if (pipoint.PointType == PISDK.PointTypeConstants.pttypDigital)
{
PISDK.DigitalState digstate = pipoint.Data.ArcValue(starttime, PISDK.RetrievalTypeConstants.rtAuto).Value;
value = digstate.Code;
}
else
{ value = pipoint.Data.Summary(starttime, endtime, PISDK.ArchiveSummaryTypeConstants.astAverage).Value; }
}
catch (Exception)
{
ierror = 3;
return;
}