AnsweredAssumed Answered

PI-AF writing past values for PI tags in AF attributes failure

Question asked by JF.URBIETA on Jan 29, 2018
Latest reply on Feb 6, 2018 by JF.URBIETA

Dear all, I need to backfill some values from years ago (2011) and it appears that my code doesn't return any failure or exception but the tag is not updated.

In fact we have recently created some tags which are supposed to be used to replay a dedicated situation. We have a C# executable which calculate the values and it is supposed to update them in the past.

 

Note that we are using AF attributes pointing to PI Points, and the PI Points are the ones which need to be backfilled.

 

This code works fine when past period is quite recent (executable is used since 2015 and writing regularly some days or pair of monthes backwards), but when data are more far in the past (here period is end of 2011), it seems that we reached the 90 days limit(??). However the PI Data archive is not on a devpt environment so normally the (-12222 Error) may not apply..

 

Source code is simple (may be too??) recovered from existing executable

 

public bool writeValue(DateTime dtTime, double dblValueToWrite)
{
OSIsoft.AF.Time.AFTime afTime = new OSIsoft.AF.Time.AFTime(dtTime);
OSIsoft.AF.Asset.AFValue oAFValue = new OSIsoft.AF.Asset.AFValue(dblValueToWrite, afTime);
Type myType = oAFValue.Value.GetType();
if (myType != typeof(double))
{
throw new ApplicationException("writeValue | Erreur Type d'attribut : " + _AFAttribute.Name + " de type " + _AFAttribute.Type.ToString() + " Expected double");
}
//20171120 Managing writing errors
try
{
oAFValue.Status = OSIsoft.AF.Asset.AFValueStatus.Good;
_AFAttribute.SetValue(oAFValue);
}
catch
{
throw new ApplicationException("writeValue | Erreur écriture attribut AF " + _AFAttribute.Name);
}
return true;
}

 

As it is getting on my nerves, I'm pretty sure that someone may have already known such situation, so any relevant idea is welcome!

 

Message was edited by: Rick Davin Added C# Syntax Highlighting

Outcomes