Thoughts about why the MSP430fr6047 works for flow rate and the problem we are having:
We have found that the routine USS_runAlgorithmsFixedPoint does not return an accurate time of flight, TOF. I believe that the system works as a flow rate meter because the inaccuracy in the upstream measurement is the same as the inaccuracy in the down stream measurement and the subtraction to get the difference has the same inaccuracy in both number so it is irrelevant.
We are wanting to get the accurate TOF for various fluid in various containers. The inaccuracies are a problem.
What we have tried to eliminate or compensate for the inaccuracies:
We have tried the following two setups. Both of them are on a pipe.
1. There is one transmitter transducer and two receiver transducers. One of the receivers is directly across from the transmitter and the other is some distance down the pipe on the same side as the first receiver. We alternately set the receivers to be input to ch1 on the MSP430FR6047 and process the USS_startLowPowerUltrasonicCapture and USS_runAlgorithmsFixedPoint. We get two times of flight one from the directly-across transducer TD and one form the transducer at angle TA. We subtract TA - TD To get the difference in time along the two paths. The result should be the time to travel the distance equal to the difference in the lengths of the two paths. The idea is that whatever inaccuracy there is in the TOF returned by USS_ runAlgorithmsFixedPoint will be the same in both paths and will subtract out. It doesn’t work. That is, the computed TOF for the difference in length is what is should be.
2. There is one transmitter transducer and one receiver transducer directly across from it. We alternately measure the TOF of the signal first received by the receiver TD and the signal received as an echo TE. The signal from the transmitter travels through pipe wall, across the fluid, and upon hitting the far side pipe wall both echoes toward the transmitter and proceeds through the pipe wall. The signal that goes through the pipe wall is received for determining TD. The signal that is echoed hits the transmitter-side wall and is echoed again back toward the receiver-side wall. When it hit the receiver-side wall again a portion passes through the all to be received for determining TE. The time for TE is exactly the time TD plus the time for the signal to travel twice across the pipe. The idea is that whatever inaccuracies there are in the values from USS_ runAlgorithmsFixedPoint will subtract out.
To make this work we reset the GAP (Gap between pulse start and ADC capture) between each transmission. More on this below.
The procedure doesn’t work. The times returned by USS_ runAlgorithmsFixedPointare not the times that we can see with an oscilloscope or that we can calculate from known properties of water which we are using as a test fluid. The error in the times is different for the direct TOF and the echo TOF.
How we reset the GAP:
Before starting the loop that alternately measures TD and TE, we do a calibration to determine a good value for the GAP and for the Capture Duration. We do this both because we want to capture the two different signals and because we want the procedure to work for various diameter containers (can, pipe, tanks, etc.). The procedure is the following.
· Set the GAP to a relatively small value and increment it until USS_ runAlgorithmsFixedPoint returns a nonzero TOF.
· Change to a tiny decrement instead of a small increment and repeatedly decrement the GAP until USS_ runAlgorithmsFixedPoint fails to return a nonzero TOF.
· Use the last GAP that returned a nonzero value.
· Multiply the GAP by 2.5. this will make sure that the time is passed the first signal for TD and before the time the echo will be received.
· Repeat the first two steps to set the GAP for the echo signal.
In an attempt to deal with the TOF dependence on the number of pulses, we have tried various number of pulses. We had the idea that the smallest number would provide the best results because the received signal would have the fewest oscillations and thus the narrowest range for the peak to occur.
With the 12” pipe and μs we are using we expect TD to be in the range of 210 and TE to be in the range of 620. If there were a constant error and the numbers were 230 and 640 everything would be fine. What we get is TD ranging from 218 to 235 depending on the number of pulses. The value of TE is around 684 independent of the number of pulses.
What do you think of the approach? What can we do to get accurate values?