davidpti2006

PI tag avg depending on another pi tag

Discussion created by davidpti2006 on Nov 22, 2013
Latest reply on Nov 22, 2013 by hpaul

Someone please help.  I work at a plant and we run different products.  I am looking to get data based on the product and display the average to the operators.

 

So lets say that product A  ran 3 weeks ago and we ran it for 12 hours.  Before product A ran we ran product C for 24 hours then after product A ran we ran product B

 

I want to go back to the last time product A ran from start to finish and grab the values of 4 tags of data and display the average of these 4 tags for the length that product A ran last.  The 4 tags are taken at about a rate of every 10 seconds.   I also only want to take the value of the tags if the tag data is > 0 .   We change products up to every 6-12 hours. 

 

I need this to update the averages on its own based on product changes.  The product change is automatically recorded in pi via an OPC tag.  So when the product changes I need to display the following information

 

Example of what is needed with product A

 

Next Product change to product A which makes Product Tag   = A     I have this

 

When the product changes the system will need to find the start and end time below of that product.

 

Last  time Product A  Start Date and Time   = HELP  This needs to be done by an automatic search or VBA code is my guess.  (Product C changed to Product A  this would be the Start of product A)

Last time Product A  End Date and Time    = HELP   This needs to be done by an automatic search or VBA code is my guess.  (Product A changes to Product B  this would be the end of product A)  

 

Tag 1 = AVG of the values of Tag 1 while Line Running and Product = Product A with the value of Tag 1 > 0

Tag 2 = AVG of the values of Tag 2 while line running and  Product = Product A with value of Tag 2 >0

Tag 3 = AVG of the values of Tag 3 while line running and  Product = Product A with value of Tag 3 >0

Tag 4 = AVG of the values of Tag 4 while line running and  Product = Product A with value of Tag 4 >0

 

Please help me find out how to display the start time and end time that the next product on the line was run and the AVG of the 4 tags of data we need to be displayed.

 

 

Sorry if this is confusing I hope someone can help.

Outcomes