I have a sensor that detects the speed of conveyor belt, by counting a pulse. On the assembly line come bottles at regular intervals and which are counted with other sensors, so that each time a bottle passes I got a pulse from the bottle and another from the assembly line. If there is a one missing bottle in the line I get a pulse from the assembly line, but not from a bottle detector, then I can calculate the percentage efficiency “Percentage x conveyor belts-pulse = bottle-pulse”
Tag_Average = (Tag_conveyor*100)/Tag_Bottle
No problem. But if I want to get the average of the last 100 pulse from the assembly line, every time, then things get worse, is there a simple solution to this.
This would be no problem if I could use the trend and trigger it "sample period" with conveyor belts detector and not by time, and the trend has to move at the same rate as the pulse from the assembly line, maybe it is possible, but I can’t find it.
Something like that I think:
REAL TrendTable1[100];
FUNCTION prufa()
TrnGetTable ("Trend_Tag_Average",0,2,10,TrendTable1[0],0);
REAL Average
Average=TableMath(TrendTable1,100,2,0);
Tag_Average = Average
Tag_Average = (Tag_conveyor*100)/Tag_Bottle
No problem. But if I want to get the average of the last 100 pulse from the assembly line, every time, then things get worse, is there a simple solution to this.
This would be no problem if I could use the trend and trigger it "sample period" with conveyor belts detector and not by time, and the trend has to move at the same rate as the pulse from the assembly line, maybe it is possible, but I can’t find it.
Something like that I think:
REAL TrendTable1[100];
FUNCTION prufa()
TrnGetTable ("Trend_Tag_Average",0,2,10,TrendTable1[0],0);
REAL Average
Average=TableMath(TrendTable1,100,2,0);
Tag_Average = Average