3 Replies Latest reply on Feb 19, 2018 5:49 PM by Andrey.Novikov

    How to count starts of the machine using PE functions?

    Andrey.Novikov

      Hi all,

       

      Here in the company, we have an idea to do some maintenance based on the number of starts of the machine.

      I've found the solution but the problem is that our maintenance system doesn't support DataLink functions

       

      How can I get the result of

      PIAdvCalcExpVal("tagval('TAGNAME','*') = 1 and prevval('TAGNAME','*') = 0";"*";"*";"count";"event-weighted";"compressed";"10m";0;1;0;"SERVER")

      [the number of times the tag was equal to 1]

      using PE functions?

       

      Thank you in advance

           and sorry if this kind of problem was already solved by the community (I really tried to use the search )

        • Re: How to count starts of the machine using PE functions?
          Ikorablev

          Hello Andrey,


          Depends on the nature of your current source tag "TAGNAME" (Does it store 1 every time the system startups up and 0 when shutdown?). Can you give us an idea, what is stored in your tag currently?

           

          General implementation of such functionality can be performed using two PI PE tags.
          This article gives broad explanation on how to use different tools (incl. PI PE) to calculate the number of specific values of interest:
          https://techsupport.osisoft.com/Troubleshooting/KB/KB01637/

           

          Let us know if any of these solutions suits you? Or we can discuss further.

           

           

           

           

           

           

           

           

           

          1 of 1 people found this helpful
          • Re: How to count starts of the machine using PE functions?
            kfong

            Hi Andrey,

             

            If you're using the new Asset Analytics function, you can definitely achieve this.  You can get a quick video tutorial on Asset Analytics here if you've never used it before: OSIsoft: How to Setup Expression Analyses with PI AF [PI AF 2014- v2.6.0.5843] - YouTube

             

            Assumptions I've made:

            'Status' = 1 when the machine turns on. 

            'Status' = 0 when the machine turns off.

             

            If 'Tag' has a value of 1 ONLY when it the machine first starts (and not at any other time), you can just do this to get the event count.

            Variable1: TagAvg('Status', '*-10m', '*') * EventCount('Status', '*-10m', '*').  Outputs to 'NumOfRestarts'

            Have this as Event-Triggered on 'Status'

             

            Otherwise, as Igor suggested, you'll need two tags.

            Variable1: IF 'Status' = 1 AND PrevVal('Status', '*') = 0 THEN 1 ELSE NoOutput().  Outputs to 'RestartBool'

            Variable2: TagAvg('StatusSum', '*-10m', '*') * EventCount('StatusSum', '*-10m', '*').  Outputs to 'NumOfRestarts'

            Have this as Event-Triggered on 'Status'

             

            Hope that helps a bit! 

            1 of 1 people found this helpful