How exclude snapshot value in PIData recover methods

Discussion created by retetes on Aug 12, 2010
Latest reply on Aug 13, 2010 by retetes
 I need to know how to exclude values that are not actually been Recorded in a PI Archive when I recover PIValues from a PIPoint. I am using methods of the object PIData for recover recorded values from a PIPoint (property 'Data').

When I try it, we find an error: This is the code (C# without error handling):

PIPoint p = GetPIPointToEvaluate(); //

PITime start = GetMoment(); // From LastCalculatedPeriod property in module
PITime end = GetPITimeFromUTCSeconds(start.UTCSeconds + 600); // 10 minutes

PIValue v1 = GetFirstElementOfPIValuesList(
                    null) );// Previous valueto end

// ...

ArchiveSummariesTypeConstants ast = ArchiveSummariesTypeConstants.asAverage;//AVERAGE
CalculationBasisConstants cb = CalculationBasisConstants.cbEventWeightedExcludeMostRecentEvent; // [start, end[
NamedValues nvs = p.Data.Summaries(start, end, BoundaryTypeConstants.btAuto, ast, cb, 1, null);
object str_aux = "Average";
NamedValue nv = nvs.get_Item(ref str_aux);
PIValues values = (PIValues)(nv.Value);
PIValue v2 = values[1];// 1based list

// ....

If we execute this code at the time 'end'+45s we get:

    TimeStamp: time in interval [start, end[
    Value: a numeric value
    TimeStamp: end
    Value:  a numeric correct value (normally v2.Value == v1.Value)

If we execute this code at the time 'end' + 20m we get:

    TimeStamp: time previous to start
    Value: a numeric correct value
    TimeStamp: end
    Value: Not enought values for calculation (and no recorded values in period [start - end[ for this point quering with SMT)

Maybe, this appears because the value taken from PI in the first execution is the snapshot value and PI Server doesnt record it (compression, ...), instead of the recorded one. We need to get only the recorded values. How can we do that? Is there any datasheet with information about those functions and how to exclude this snapshot values?




 PI SDK Programming Course:


The RecordedValues method returns compressed values for the requested time range from the archive as a PIValues collection. Compressed==(recorded in PI Archive)?




 Thanks in advance