sricharan.m

Need help in ACE Code

Discussion created by sricharan.m on Sep 13, 2013
Latest reply on Sep 13, 2013 by michaelh

Dear Experts,

 

I’m framing ACE code for the below logic.

 

2630.codde.PNG

 

I will explain in more detail..We have tag say sinusoid, it has data for past 24 hours. it also has a high limit say 50..if the value of sinusoid crosses high limit then we will check for the next value when it is within the limit.

 

So far I’m here

 
        Dim PIVALS As PISDK.PIValues
        Dim PIVAL As PISDK.PIValue
        PIVALS = sinusoid.Values("*-24h", "*")
        For Each PIVAL In PIVALS
            If PIVAL.Value > 50 Then

            End If
        Next

So 1st loop is complete now 2nd part where I need to check when it comes back to within limit so need to run a loop again but not able to code it. 

 

In the case below, need to capture timestamp of index 2 (crosses high limit) and index 4 (within limit) so that time difference could be calculated and we could find the total time and number of deviation.

 

5756.table.PNG

 

Looking forward for your valuable inputs.

Outcomes