BryanG
Member
I don't think I have the +/-1 oscillation problem as the interrupt is caused by a high speed counter reaching a set value so there can't be part pulses. It might count 20-20-20-21-20-20-20-20-21-20-20-20-20-21 but the time at the interrupt would be different for a 20 or 21 count. The time used in the flow calculation is the Actual Time caught by the interrupt not the Ideal Time, it won't be perfect and will depend on the speed of the PLC and the resolution of the quickest timer.BryanG kind of has a phase locked loop between the 'Ideal Sample Time' and the 'Actual Sample Time' adjusting the internal counter's setpoint until they agree (the setpoint being the 'measured count for the sample period'). Though he would still have the +/- 1 oscillation problem.
It happened because of the circumstances I was given. A customer wanted to compare two liquid flows and raise an alarm within a set period if the ratio went out of band. The speed at which the alarm must occur had to stay the same no matter how fast the product was flowing. The range of flow was large so time between pulses was OK at slow speed but no good a high speed and counting and how many pulses within a set time was no good at the slow speed as the alarm wouldn't have happened quickly enough. Finally they had to use their 'standard' flowmeters so I couldn't boost the pulse count to avoid the +/- I problem.That is a very elegant solution. Of course, it's also rather advanced, lol. Were you a computer programmer at one point, because that sounds like an answer a computer programmer would come up with. Or do you just happen to be damn good with PLCs?
Bryan