AnsweredAssumed Answered

How to compute average when other condition exist ? (PE, Datalink)

Question asked by SPaquinAgro Champion on Feb 20, 2017
Latest reply on Feb 21, 2017 by Guilherme Ferreira

Hi, everyone

Sorry if I am in the wrong place.


Here is my question. Basically, I want to use Datalink to compute a temperature average when the production line is operating (average for each hour). I want to filter data only when the line is operating because the temperature WHEN operating is important to quality. Otherwise, not important therefore the report should display hourly averages of temperature when the line is operating. Since I want the TagTemperatureWhenOperating to be available to users in PB, my idea is to create a PE tag and then use Datalink to get the average every hour.


The PE would look like this: (tagnames are for example only)


TagLineIsOperating               Tag bool. True when line is operating

TagTemperature                     Temperature tag.

TagTemperatureWhenOperating  Output of the PE that should contain the temperature when the line is operating and some digital state to exclude it from calculation when not operating



TagTemperatureWhenOperating = if TagLineIsOperating then TagTemperature else DigState("State")


Question 1 : What Digital state should I use to turn off the tag when the value should not be part of the hourly average ?

        I have looked at System Digital State Set. Should I use Bad quality(199), No result(212), Scan off(238), Calc off(245), Shutdown(254) ?

Question 2: Is there any other (and better) way to achieve my result ?

Question 3: Is there a description of the effect of System Digital State values on later calculations (avg) ?