1 Reply Latest reply on Mar 4, 2014 4:01 PM by Gregor

    Getting state change over time as Integer value

    bpolaski

      What I have is an excel sheet that a user  enters a tag, start time and end time.

       

      This tag is a digital tag with two states ON/OFF. I would like to be able to write to an excel cell how many times the state changed to ON in the defined period but I have been having trouble implementing this functionality in VBA.

       

      I was using this post as a reference: http://vcampus.osisoft.com/discussion_hall/add_in_microsoft_development/f/11/p/3301/17876.aspx#17876

       

      but have not been able to adapt it for my purposes.

        • Re: Getting state change over time as Integer value

          Hello Brian,

           

          What you are trying to do is possible using PI DataLink -> Archive Value method. Instead of referring a PI Tag you select "Expression" and use EventCount(tag, starttime, endtime [, pctgood]), where pctgood is an optional parameter that allows you to specify the requested amount of good events for the given time range (starttime -> endtime).

           

          For additional information on Eventcount() or other Performance Equation functions, please refer to PI Performance Equation Reference Manual (%PIHOME%\Help\PEReference.chm)