Counting Occurances of a State

Discussion created by rdube02 Champion on Aug 8, 2012
Latest reply on Aug 10, 2012 by andreas



This seems like a fairly simply thing to do, but for the life of me I just can't figure it out. I've reviewed a few other threads in here, but none of the suggestions seem to work for my case.


I have a tag that has about 100 states, each representing a certain alarm condition. I was able to get the following to work, which tells me the percentage of time that each state has been true over a certain period of time.

  Set myPIValues = myIPICalc.PercentTrue(myStartTime, _
    myEndTime, _
    "", _
    myFilterExpression, _
    fstExpRecValwithMinSampTime, _

 What I also need to do is to find out how many occurances of each state took place between a start and an end time.  So for example if I the state changed from something else to "Overtemp", that would count as 1.  Later if it changed from something else to "Overtemp" again, my Overtemp state count would be 2.


I've tried to use myIPICalc.Calculate to do this, but can't seem to get it to work.  Can any of you pros give me a hint as to how this can be done?