# Analogue correlation circuit to measure water flow in a pipe?

#### TCSC47

Mar 7, 2016
148
I think about 45 years ago I attended an Open University Summer School where one of the lecturers had made a circuit that measured the flow of water through a pipe. It did this by placing two microphones about a metre apart on a water pipe and then used some form of analogue circuitry to "cross correlate" the sound of the water turbulence as it travelled along the pipe between the two microphones. Believe it or not, the noise frequency content of the turbulence at a particular point in the flow is apparently pretty much the same as it travels a short distance down the pipe. So you can compare the noise at the first microphone with the noise at the second microphone and use cross correlation to determine that the noise is the same and using the delay in time between them you can get a measure of fluid velocity. All I can remember about the circuit was that it used a phase locked loop.

It actually worked and I was quite impressed. I have tried to find some reference to this analogue method of measuring fluid flow but have found nothing (well nothing I can gain access to anyway!). I have found a few papers on digital correlation but nothing that shows how to do it analogue.

If what I have described makes any sense to anybody I would be really chuffed if they could explain the system or point me in some direction for a reference. I have been fascinated with the concept ever since.
Cheers

Apologies. I have tried to attach a sketch of the system but I can not make it work at the moment. The diagram is very simplistic anyway,

#### Nanren888

Nov 8, 2015
622
I would have thought that it would be more common to use an active source and measure the time of flight in each direction as witrh some anemometers .

For such, I'd guess for simplicity one might use a sinusoidal signal, if one wanted to avoid pulse waveforms for some reason. Then time of flight might be well measured by phase and your phases-locked-loop. Sporry, pure speculation.
Interestingly, as I google for an example I hit
https://asa.scitation.org/doi/10.1121/1.4862885
which is actually passive as you suggest but in air and predictably, digital.
Can't see why a locked loop shouldn't be used to find the point of maximum correlation between two signals, with some assumptions of whatever the equivalent of the phase detector being sufficiently monotonic, so it generally heads towards the peak.
If analogue phase detectors are basically just products, then it probably works unaltered for some waveforms.
Any links to the papers of interest that you found?

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
13,648
Here f(t) would be the signal from the ´second microphone and g(t) the signal of the first microphone. τ is a parameter that shifts the signal from the first microphone in time. Max. correleation is achieved when the shifted signal g(t-τ) matches the first signal f(t) best.
Starting from this math an analog circuit could be constructed from
1. an analog delay line with adjustable delay τ
2. an analog multiplier
3. an integrator (which I assume should pe periodically reset to achieve a constant integration time interval T. With T = constant there is no need to actually perform the multiplication by 1/T.)
4. an indicator for the integrated product
By varying the delay τ and looking for a maximum on the indicator one gets the speed of the flow by v = l / τ with
v = speed
l = distance between microphones
τ = delay
As for varying the delay one could use a manual approach, e.g. a potentiometer, or an automatic approach using e.g. a sawtooth generator.
One could also add a peak detector and store the output from the sawtooth generator and the integrator each e.g. in an anlog sample-and-hold circuit whenever the integrator generates a new max. value. The max. last max. value is used by the peak detector to detect a new maximum. The last max. value should be leaky, not too leaky, to allow for a downward change in speed, too.

#### TCSC47

Mar 7, 2016
148
Cheers Harald. I will take time to absorb this.

#### Nanren888

Nov 8, 2015
622
As above, the phase comparator in a phase-locked loop is frequently a multiplier. Such often has an integrator attached or allowed for. Primarily, the time delay is what needs to be added.
By varying the delay τ
As Harald Kapp says, the time delay has to change in order to scan the delay, usually to peak up the response, the correlation: the peak usually corresponding to the delay between the two sensor points.
A variable time delay in analogue is not so obvious how to implement simply.
Some of this depends on the expected useful bandwidth of the system.

#### Bluejets

Oct 5, 2014
6,862
Water Resources Qld used to use anubars placed in the flow to measure up and downstream pressure difference, then the meter would calculate flow. These were later replaced by ( minute in comparison) external ultrasonic transducer unit, not much bigger than a cigarette packet. The latter was over 30 years ago.
Not only for flowrate but volume over time as well.

#### TCSC47

Mar 7, 2016
148
As above, the phase comparator in a phase-locked loop is frequently a multiplier. Such often has an integrator attached or allowed for. Primarily, the time delay is what needs to be added.

As Harald Kapp says, the time delay has to change in order to scan the delay, usually to peak up the response, the correlation: the peak usually corresponding to the delay between the two sensor points.
A variable time delay in analogue is not so obvious how to implement simply.
Some of this depends on the expected useful bandwidth of the system.
Thanks Nanren. Still in the process of getting my head around it all.

#### TCSC47

Mar 7, 2016
148
Water Resources Qld used to use anubars placed in the flow to measure up and downstream pressure difference, then the meter would calculate flow. These were later replaced by ( minute in comparison) external ultrasonic transducer unit, not much bigger than a cigarette packet. The latter was over 30 years ago.
Not only for flowrate but volume over time as well.
On the matter of using pressure difference to measure flow, I remember back in the 70's having to set up a system to feed nutrients to a biostat growing bacteria for somebody's research project. I scratched my head not knowing where to start, to calculate what size pump and tubing I needed to use. Then, and I still chuckle when remembering this because it really wasn't rocket science, I realised that fluid pressure was voltage, tube diameter represented resistance and the fluid flow was current! I had sat in class many years before wondering why my teacher was going on and on about water flow to describe something as obvious (to me) as electricity and V=IR, and here I was turning the thing on its head!

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
13,648
I realised that fluid pressure was voltage, tube diameter represented resistance and the fluid flow was current!
My favorite analog for explaining electrical matters, too

#### TCSC47

Mar 7, 2016
148
Starting to reminisce now. My first job in 1970 after finishing my training was involved with the design of a sonar system for the Royal Navy. I was designing power supplies and amplifiers etc. Working along side me was a very clever kid who was designing a system using cross correlation (the first time I had heard the term) to recognise the active return and passive sounds of Russian subs. This was before the revolution and standardisation of IBM personal computers of course, so everybody pretty much designed their own computing power. PDP 11s minicomputers and such were about but I suspect they were too slow or not powerful enough to do the job.

One day he was playing with his slide rule and started chuckling. He had calculated that the power he would need for his equipment was pretty much the whole of that capable of being supplied by the electrical generators of the Nimrod maritime patrol aircraft that it was destined for, so wasn't going to be of much practical use.

The logic that was available at the time was TTL with LS TTL only just appearing. My colleague's design would manage with LS TTL but not TTL. The problem was that the Royal Navy, being the Royal Navy insisted that any components being used in their equipment had to have been around for at least 10 years to demonstrate its reliability to their satisfaction. Electronics at the time was just beginning to move so fast that this was a serious restriction on electronics development for naval equipment. We had to get special permission from the Royal Navy to use LS TTL but I don't think they were happy about it.

As I write, I have just been over to Wikipedia to look at logic families https://en.wikipedia.org/wiki/Logic_family and it says that LS TTL was introduced in 1976 but I'm sure I remember it from 1972.

To finish my reminiscing, I have to say that this job changed my life. The sonar system I was working on lost out in the competition for the Royal Navy and we were all worried about redundancy and such, Then my line manager comes in one day waving his arms in the air -- "It's all right lads! We've sold it to China!"

This was too much for me. Defence of my country and society is one thing but selling weapons to anybody who wants to buy them was beyond the pale for me. On top of that, I had recently bumped into the call girls who my company had hired to entertain its middle eastern customers. Our design offices and workshop were based in the grounds of a country manor which was posh enough to entertain foreign buyers. Half a dozen Rolls Royces pulled into the car park and out of them stepped a bunch of middle eastern guys clearly identifiable through their ghutras and bishts, and a bunch of call girls also clearly identifiable by their hot pants, thigh boots and makeup. I enquired and was told we had hired them. Just not the world I wanted to be part of.

And of course, this was at the time when China was supporting North Vietnam in the Vietnam (or as the Vietnamese call it, the American War). We in the UK were not officially involved, but of course America and Australia were and I had many friends and relations in both countries. So what the **** was I to do? I left that job, going through a number of engineering jobs until I finally became a teacher. Now nearing the end of my life I can at least look back and feel happy at the positive contributions I made to society rather than a track record of contributing to the deaths of many at the hands of the scummy politicians and arms dealers.

Oh dear, I had better finish here. I got up in quite positive mood today but I seem to have lost it!

Rock on All!

#### Nanren888

Nov 8, 2015
622
Dude, Look back and smile at what used to happen.
PDP11 & LSI11's and well, VMS are well worth reminiscing about. As are sonars of yesteryear.
.
BTW: What some fields call auto-correlation, others call cross-correlation, also no uniformity of correlation, versus correlation coefficient, while most seem to agree on covariance. All have the same concepts, just shift the boundaries of the names round.
For some, autocorrelation has a shift and cross measn between two signals. For others, if the offset is not zero, they call it cross correlation.

If you are a digital guy, the descrete time version of correltaion might be easier to grasp: no integerals; just a summation.
This one includes it.

It also has a section
Case 2: Identifying Signal Delays

If you like the stats way: Correlation is a second-order statistic. multiply things together while scanning over time, accumulate. It is a similarity measure. It's not the only one, but it's second order, simple.
If you normalise for power, then a bigger peak means more similar.
If you try if with a repetitive waveform, of course it will be periodic, it's also similar with itself later again. For random signals, with a reasonable bandwidth, not so much of a problem.
.
From another angle: The autocorrelation is the Fourier transform of the power spectral density. The cross correlation is the Fourier transform of the cross-spectral density. So the bandwidth of the signals affects the result you get from a correlation. As I said, though, power aside, or normalised by power, a peak means more similar.
.
In digital, doing this in the frequency domain can often get you a better answer than directly in time. Taking the Fourier spectrum, multiplying together to generate the cross-spectrum and then an inverse Fourier, can get you sub-sample resolution of the time delay.

https://www.dsprelated.com/showarticle/26.php
Has some of it.

Enjoy.

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
13,648
Anybody remember bucket brigade devices? Time discrete analog delay lines, delay adjustable by clock frequency.

#### TCSC47

Mar 7, 2016
148
Cheers for the reference Nanren.

#### TCSC47

Mar 7, 2016
148
Anybody remember bucket brigade devices? Time discrete analog delay lines, delay adjustable by clock frequency.
I certainly do. I was going to design and make an echo chamber (I bet we all were!) but never got around to it. I wonder if it was one of these that was used as the delay element in the flow measuring device in my original post?

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
13,648
You could also use a speaker and a microphone in an acoustically isolated chamber. By varying the distance between speaker and microphone you can adjust the delay.

#### Nanren888

Nov 8, 2015
622
I once looked at an old calculator that used an ultrasonic delay line as memory. It was a wire. If you have matching sorted out, multi-tap for mutliple delays, but maybe not the easiest to build.

#### TCSC47

Mar 7, 2016
148
I made a reverb spring unit that worked quite well as a guitar effect. Two telephone earphones. I soldered hooks onto the metal diaphragms and attached a 30cm or so spring between them. I never finished it properly and I never used it in performance because it kept falling apart.
The sound vibrations take time to travel up and down the spring and are picked up by the second phone acting a a magnetic microphone and then mixed back into the amp. They were quite popular before the modern electronic methods. I don't know if devices that are sold as spring reverb are genuine mechanical units or if they are electronic just using the name to describe the effect. At least some of them are genuine.
https://delicious-audio.com/best-spring-reverb-pedals-top-effects/

#### ratstar

Aug 20, 2018
485
Ive got my own version of those bucket brigade delay lines, Its a cap 2 cap based delay line memory, they are actually faster than ram if u directly link them to your logic, theres no caching delay, it all just pumps out the same register, and u process the input samples through the same logic, then u collect your outputs out the other end. goes really fast, i think if i finish it one day itll be a square faster than a gtx3080, i hate the technology these days im going to beat it all.

Ive got a crazy audio thing id like to do. (Im a mad techno musician as well.) I think if you put a microphone on an actuated stand, if you move the microphone physically around a speaker in movement patterns, youll get some strange morphing tones from the room echos/vibrato itself, real physical echos, i guess it would sound similar to a wah pedal, but have a nice gritty dimness to it or something.

#### TCSC47

Mar 7, 2016
148
Ive got my own version of those bucket brigade delay lines, Its a cap 2 cap based delay line memory, they are actually faster than ram if u directly link them to your logic, theres no caching delay, it all just pumps out the same register, and u process the input samples through the same logic, then u collect your outputs out the other end. goes really fast, i think if i finish it one day itll be a square faster than a gtx3080, i hate the technology these days im going to beat it all.

Ive got a crazy audio thing id like to do. (Im a mad techno musician as well.) I think if you put a microphone on an actuated stand, if you move the microphone physically around a speaker in movement patterns, youll get some strange morphing tones from the room echos/vibrato itself, real physical echos, i guess it would sound similar to a wah pedal, but have a nice gritty dimness to it or something.
There is a scene in the Queen movie where Queen are shown swinging a speaker about suspended from the ceiling to get some sort of phasing Leslie speaker effect. I'm not sure exactly where on the digital / analogue music sound effects debate I stand, but I must admit I was impressed by John Deacon's simplistic guitar effect unit used by Brian May and apparently consisted of nothing more than an overloading small speaker and microphone inside a box. Thinking about that reminds me how envious I was (still am) of May's huge stack of Vox AC30s!

#### Nanren888

Nov 8, 2015
622
A bit of a diversion:
One of the best I have heard is an assisted reverb system demo in a music venue, where a pitch shifter was included in each reverb path. So the room provided a sort of harmony to anything going on, Not really something to do long term, but interesting to hear.

Replies
17
Views
412
Replies
12
Views
545
Replies
19
Views
1K
Replies
1
Views
1K
Replies
4
Views
2K