1 Reply Latest reply on Jan 20, 2014 10:34 AM by lZheng

    Calculate Conditional Time Duration

    rickark

      Sorry if I have not given a very accurate description in the subject but I'm trying to figure out how to best make a tag accumulate in time when certain other tag values are met.

       

      Basically what I am trying to do is when one digital tag is TRUE and another float32 tag is between say 5 and 10 I want the calculation to store the total time this condition has been met.  Would this be best done as a totalizer tag or as a perfromance equation tag or something else?

       

      Thanks,
      Karl 

        • Re: Calculate Conditional Time Duration
          lZheng

          Hi Karl,

           

          I think this can be done by the combination of a PE tag and a Totalizer Tag.  First I would create a PE tag call it "Fliptag1s", this tag is suppose to change value every second, and it will be used as the source tag for Totalizer tag later. Attributes for the PE tag:

           

          exdesc: If 'Fliptag1s'=1 then 0 else 1

           

          Pointsource: C

           

          Scanclass: 1s

           

          Then I will create a Totalizer tag to count the time of the condition when Digital tag A is True and Float32 tag B is between 5 and 10. Following are some important tag attributes for this totalizer tag:

           

          Calcmode: Timeweighted

           

          EventExpr: ('A'=="True") And ('B'>5) And ('B<10')

           

          Function: Total

           

          ReportMode: Ramping

           

          SourceTag: FlipTag1s

           

          RateSampleMode: Scan1

           

          Period2: +1s

           

          Offset2: +0s

           

          TotalCloseMode: EventTrue

           

          Above totalizer configuration is not complete, you still need to specify the conversion factor, period, and offset. All these settings depend on the time unit you would like to have for the Totalizer tag. If you need some reference manual for configuring totalizer tag, please check the

           

          "PI Server Application User Guide" in our TechSupport download center.