|
|
Rank: Member Groups: Member
Joined: 8/23/2010 Posts: 12 Location: Portugal, Lisbon
|
Sorry to bother again with another question but is there a way to make a PI Equation (TagAvg) excluding the questionable values? Check if its questionable: Not(IsSet('sinusoid', "q")) Calculate Average: TagAvg('sinusoid', '24-AUG-2010 00:00:00', '24-AUG-2010 01:00:00') C# Code: Code:IPICalculation ipiCalc = (IPICalculation)g_srvPIServer; string filterExp = ?; ipiCalc.Calculate(startTime, endTime, filterExp, SampleTypeConstants.stInterval, "10m", null); where ? is the expression to calculate the TagAvg without the questionable variables. This is a very old problem of ours, not even sure if its possible to do it.(might not even be IPICalculation) Again, thanks for your time 
|
|
|
|
|
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.
|
|
|
Rank: Administration
 Groups: Administration
Joined: 6/20/2008 Posts: 612 Location: Cheshire, United Kingdom.
|
Sure, try "FilteredSummaries" of the PISDK.IPIData2 interface. Here is a quick example: Code: Dim _Point As PISDK.PIPoint = _PISDK.Servers.DefaultServer.PIPoints("sinusoid") Dim _Data2 As PISDK.IPIData2 = _Point.Data Dim _nvsFilSum As PISDKCommon.NamedValues = _Data2.FilteredSummaries("y", "t", "1d", "Not(IsSet('sinusoid', ""q""))", PISDK.ArchiveSummariesTypeConstants.asAverage) Dim _FilSumValues As PISDK.PIValues = _nvsFilSum("Average").Value For i As Integer = 1 To _FilSumValues.Count MsgBox(_FilSumValues(i).Value) Next
Combine this with some asynchronous calls and away you go. Enjoy! Principal Consultant Real-Time Data Management @ Wipro Technologies
|
|
|
Rank: Member Groups: Member
Joined: 8/23/2010 Posts: 12 Location: Portugal, Lisbon
|
Sorry for the delay took me some time to get this converted to C# seems i can't use indexes [] directly to NamedValues. Seems to be giving the expected results at first glance!
Just out of curiosity, any idea why they made this function different? It returns NamedValues instead of PIValues.. i guess they are trying to make future functions that give many results in one call?
Again thanks! Phil
|
|
|
Rank: Administration
 Groups: Administration
Joined: 6/20/2008 Posts: 612 Location: Cheshire, United Kingdom.
|
The reason NamedValues is used is because you can set the ArchiveSummariesTypeConstants enumeration to "asAll" i.e. return for the PI Point all of the summary types. To access the particular summar type, you fetch it from the NamedValues collection. I plan on upgrading the forum slightly so I can include VB.Net and C# code inline of the posts with a tab for each language. I did do some testing of FilteredSummaries setting some of the sinusoid values to questionable and they were ignored in the averaging so from what you said this should do what you need. Principal Consultant Real-Time Data Management @ Wipro Technologies
|
|
|
Rank: Member Groups: Member
Joined: 8/23/2010 Posts: 12 Location: Portugal, Lisbon
|
Quote:I plan on upgrading the forum slightly so I can include VB.Net and C# code inline of the posts with a tab for each language. That's actually good, most examples provided by OSISoft are made in VB.NET which isn't our main language here.. sometimes we face some language specific problems and take awhile to fix. hehe
|
|
|
|
Guest
|