gregorvilkner

aPiPoint.Data.InterpolatedValues(t1,t2,ptcount,f1,f2,asynch) returns inconsistent results for different point counts

Discussion created by gregorvilkner on Oct 27, 2011
Latest reply on Oct 28, 2011 by andreas

Hi there,

 

we're running into some weird behavior of the InterpolatedValues function - using the function to retrieve points to toss into a custom windows.forms.chart control.

 

Depending on how many samples we request (this example is data between 2/1 and 5/1, requesting between 100 and 2000 samples, note: the pi archive has a good 35k of happy points available for this time span) our charts start to flat-line at various points (image attached, point count is top right above the charts). We've used the function without the last three arguments and also tried to use the asynchronous way, simply using a Thread.Sleep and not going overboard with event handling yet.

 

Any explaination or pointers to proper usage of the asynch usage would be greatly appreciated.

 

Kind regards,

 

Gregor

 

code sample:

 

                 

 
  PISDKCommon.PIAsynchStatus mPIAsync = new PISDKCommon.PIAsynchStatus();

                    PIValues aPiPointValues = aPiPoint.Data.InterpolatedValues(dateStartDate.Value, dateEndDate.Value, int.Parse(txtPointCount.Text), "", FilteredViewConstants.fvRemoveFiltered, mPIAsync);

                    int counter = 0;

                    while (mPIAsync.ProgressPercent < 100)

                    {

                        System.Threading.Thread.Sleep(1);

                        counter++;

                    }

                    for (int piCounter = 1; piCounter <= aPiPointValues.Count; piCounter++)

                    {

                        PIValue aPiValue = aPiPointValues[piCounter];

                        PIValue aPiValue2 = ((PIValues)mPIAsync.Result)[piCounter];

                        if (aPiValue.IsGood())

                        {

                            chartKpiHistory.Series[0].Points.AddXY(aPiValue.TimeStamp.LocalDate, aPiValue.Value);

                            chartKpiHistory.Series[2].Points.AddXY(aPiValue2.TimeStamp.LocalDate, aPiValue.Value);

                        }

                    }

 

Attachments

Outcomes