YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Time-out-of-range problem Options · View
tompkins
#1 Posted : Thursday, January 06, 2011 10:27:50 AM
Rank: Member
Groups: Member

Joined: 12/29/2010
Posts: 10
Hello,

I try to determine the total-time a value is out of a specific range like followed:

Code:

Dim srv As Server

    Set srv = Servers.DefaultServer
    srv.Open


Dim ipiCalc As IPICalculation
Dim pv As PIValues

    Set ipiCalc = srv
    Set pv = ipiCalc.PercentTrue(Me.StartTime, Me.EndTime, VT_NULL, "'sinusoid' > 80", fstExpRecordedValues)

Dim sTime, eTime As Long

    sTime = pv.Item(1).ValueAttributes("EarliestTime").Value
    eTime = pv.Item(1).ValueAttributes("MostRecentTime").Value

'Return Time out of Range
    TimeOutofRange = ((eTime - sTime) * (pv.Item(1) / 100) / 60)
   



The time returned matches not to the real time above the value.
What do I wrong?

Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
RJK Solutions
#2 Posted : Monday, January 10, 2011 8:20:51 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Hello,

Shouldn't you be using the time range that you used in the PercentTrue method rather than "EarliestTime" and "MostRecentTime"?
Also, you may need to use a smaller sample time if you are looking over a larger time range. There is a good explanation in the PISDK help file...e.g.

Quote:

The PercentTrue result is computed by summing up intervals where the passed expression is evaluated to true. The arguments SampleType and SampleInterval are used to determine expression evaluation intervals as discussed in the table below. More frequent expression evaluations leads to more accurate result but increases server load. Therefore, care must be taken to avoid overloading the server by specifying too fine a calculation granularity.

...

fstExpRecValWithMinSampTime

This option allows the user to get more accurate answer than the fstExpRecordedValues option by evaluating the expression more frequently. Normally, this option is only necessary if the expression involves comparison of analog tag values. Also, the PI 3 server limits SampleInterval to between 1/100 and 1/10000 of the calculation period. PIAPI uses this option for PI 3.x servers.



Principal Consultant
Real-Time Data Management @ Wipro Technologies
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.