DSPRelated.com
Forums

signal processing: adjust for settling time of instrument.

Started by Charlie January 20, 2007
Andor wrote:
> > Charlie wrote: >> Hello everyone, >> >> I have a problem I'm trying to solve and I would appreciate any input >> that may be available. I am not so much looking for the exact solution, >> as I am looking for ideas on how to go about solving it. I can workout >> the details after, I just need to figure out exactly what it is I'm >> trying to do. >> >> The Equipment: >> >> I have a sensor moving through the ocean from surface to 200m depth in >> a saw-tooth pattern. As it moves, it records its depth every 4 seconds, >> it also records values for dissolved oxygen. >> >> The Problem: >> >> The oxygen sensor has a "settling time (63%)" of ~25seconds. So when I >> look at the depth measurements, the corresponding oxygen measurements >> are not from that depth, they are from some depth before hand. >> >> I would like to correct for this, so I know exactly what depth my >> oxygen measurements correspond to. >> >> Someone suggested something about fourier transforms, or modelling it >> with e^-t/tau where tau is my 25seconds... but I am unsure of what they >> actually meant. >> >> If someone could provide either an outline of what it is im trying to >> do, or some keywords that I could google, it would be greatly >> appreciated! >> >> thanks for your time, > > Seems doable. From the description of the manufacturer, it seems like > the sensor behaves like a first order lowpass, ie. its step response is > > s(t) = 1 - exp(-t / tau), > > and tau = 25 seconds. If the sensor really is such a simple linear (in > the operating range) and time-invariant system (this hypothesis might > need verification via system identification), then you can just apply > an inverse filter to retrieve the input (O2 concentration). > > Specifically: > > You have a series of measurements > > (k T, mo_k, d_k), > > where k = 0, 1, ... (the sampling indeces), T = 4 seconds (the sampling > period), mo_k = measured O2 concentration and d_k = measured depth of > the sensor. If the above hypothesis holds, ie. the O2-sensor transfer > function can for example be approximated by > > H(z) = alpha / (1 - beta z^-1), beta = tau/(T+tau) and alpha = > T/(T+tau), > > then you can retrieve the O2 concentration o_k at depth d_k by the > simple inverse filter > > o_k = 1/alpha (mo_k - beta mo_{k-1}). The approximation of the transfer > function improves if you reduce T with respect to tau (you measure > faster).
What you say. Even if the sensor's behavior is more complex than first-order, finding the inverse filter can be done deconvolution. Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
You have all been very helpful! thank you..

in the line:

H(z) = alpha / (1 - beta z^-1), beta = tau/(T+tau) and alpha =
T/(T+tau),

what is "z" refering to?

cheers,

- Charlie

On Jan 22, 5:15 am, "Andor" <andor.bari...@gmail.com> wrote:
> Charlie wrote: > > Hello everyone, > > > I have a problem I'm trying to solve and I would appreciate any input > > that may be available. I am not so much looking for the exact solution, > > as I am looking for ideas on how to go about solving it. I can workout > > the details after, I just need to figure out exactly what it is I'm > > trying to do. > > > The Equipment: > > > I have a sensor moving through the ocean from surface to 200m depth in > > a saw-tooth pattern. As it moves, it records its depth every 4 seconds, > > it also records values for dissolved oxygen. > > > The Problem: > > > The oxygen sensor has a "settling time (63%)" of ~25seconds. So when I > > look at the depth measurements, the corresponding oxygen measurements > > are not from that depth, they are from some depth before hand. > > > I would like to correct for this, so I know exactly what depth my > > oxygen measurements correspond to. > > > Someone suggested something about fourier transforms, or modelling it > > with e^-t/tau where tau is my 25seconds... but I am unsure of what they > > actually meant. > > > If someone could provide either an outline of what it is im trying to > > do, or some keywords that I could google, it would be greatly > > appreciated! > > > thanks for your time,Seems doable. From the description of the manufacturer, it seems like > the sensor behaves like a first order lowpass, ie. its step response is > > s(t) = 1 - exp(-t / tau), > > and tau = 25 seconds. If the sensor really is such a simple linear (in > the operating range) and time-invariant system (this hypothesis might > need verification via system identification), then you can just apply > an inverse filter to retrieve the input (O2 concentration). > > Specifically: > > You have a series of measurements > > (k T, mo_k, d_k), > > where k = 0, 1, ... (the sampling indeces), T = 4 seconds (the sampling > period), mo_k = measured O2 concentration and d_k = measured depth of > the sensor. If the above hypothesis holds, ie. the O2-sensor transfer > function can for example be approximated by > > H(z) = alpha / (1 - beta z^-1), beta = tau/(T+tau) and alpha = > T/(T+tau), > > then you can retrieve the O2 concentration o_k at depth d_k by the > simple inverse filter > > o_k = 1/alpha (mo_k - beta mo_{k-1}). The approximation of the transfer > function improves if you reduce T with respect to tau (you measure > faster). > > Regards, > Andor
Charlie wrote:
> > The Problem: > > The oxygen sensor has a "settling time (63%)" of ~25seconds.
i would call that your "time constant" (Tau) and your "settling time" is about 5 times that (2 minutes).
> So when I > look at the depth measurements, the corresponding oxygen measurements > are not from that depth, they are from some depth before hand.
dunno if this is useful but about 27 years ago i was working on this same sort of problem (the application was regarding the use of osmosis to measure the level of colloid in a blood serum sample. it was a 1st order system (at least modeled that way) and we wanted to know what the osmotic equilibrium pressure was without waiting 5 minutes (this was a time constant of 1 minute) to get to that equilibrium pressure. if i recall correctly: SUM{ P[n]^2 } - SUM{ P[n] }*(P[N]+P[0])/2 Peq = ------------------------------------------- SUM{ P[n] } - N*(P[N]+P[0])/2 (SUMming from 0 <= n <= N) since the signal was so slow, we could do the DSP with a Mot 6800 that we had available at the time (this old "D2 kit" that universities could get and we train on it). i wrote everything in 6800 assembly and had, in some cases, chained together 5 bytes for a long word (it was the numerator before the division). i had to write my own multiword add/subtract, multiplication, division, binary-to-decimal-to-7segment code. Peq is the equilibrium quantity predicted by earlier readings of P[n]. eventually, for n large, P[n] should be around Peq. try to check this out with MATLAB or similar. i don't know if i can derive it again. r b-j
Tim Wescott wrote:
(snip)

> But your system isn't excited by a Gaussian process (triangle != > Gaussian), and I'll bet you don't know the O2 sensor dynamics perfectly > either (they may even change with varying O2 concentrations). So you > probably want an H-infinity filter, or you at least want to know enough > to verify that a Kalman filter assuming ideal conditions is good enough.
My thought would be that it is diffusion limited, where O2 diffuses in our out depending on the concentration. It should, then, be pretty close to exponential. That is, the sensor reading corresponds to Integral from -Infinity to zero Concentration(t) exp(-t/25s) dt/e -- glen
Charlie,

I guess if one assumes a sink rate of 1ft/sec then you will get to 200' in 
200 seconds and will have 50 samples.  It's rather important to relate the 
sampling rate to the rate of change of the input and to the system 
characteristics.

I don't have a proof but I can guess that the sample rate at the output in 
this case will have to be more than adequate to sample the *input* - since, 
the input will be calcuated from the output samples.

In this case, the system is an integrator so the inverse system is a 
differentiator.  Differentiators are noisy and sampled data differentiators 
are probably even more challenging.

I'll think some more on it but the rates, as above, are important.

Fred 


Fred Marshall wrote:
> Charlie, > > I guess if one assumes a sink rate of 1ft/sec then you will get to 200' in > 200 seconds and will have 50 samples. It's rather important to relate the > sampling rate to the rate of change of the input and to the system > characteristics. > > I don't have a proof but I can guess that the sample rate at the output in > this case will have to be more than adequate to sample the *input* - since, > the input will be calcuated from the output samples. > > In this case, the system is an integrator so the inverse system is a > differentiator. Differentiators are noisy and sampled data differentiators > are probably even more challenging. > > I'll think some more on it but the rates, as above, are important.
The sensor's time constant does some low-pass filtering -- if it didn't, there'd be no difficulty to overcome -- but very imperfectly for alias suppression. The scintillation deconvolution example in Smith's book that I cited above is an almost perfect match to this problem. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
"Jerry Avins" <jya@ieee.org> wrote in message 
news:XpGdnZKpWL4I5lLYnZ2dnUVZ_oOonZ2d@rcn.net...
> Fred Marshall wrote: >> Charlie, >> >> I guess if one assumes a sink rate of 1ft/sec then you will get to 200' >> in 200 seconds and will have 50 samples. It's rather important to relate >> the sampling rate to the rate of change of the input and to the system >> characteristics. >> >> I don't have a proof but I can guess that the sample rate at the output >> in this case will have to be more than adequate to sample the *input* - >> since, the input will be calcuated from the output samples. >> >> In this case, the system is an integrator so the inverse system is a >> differentiator. Differentiators are noisy and sampled data >> differentiators are probably even more challenging. >> >> I'll think some more on it but the rates, as above, are important. > > The sensor's time constant does some low-pass filtering -- if it didn't, > there'd be no difficulty to overcome -- but very imperfectly for alias > suppression. The scintillation deconvolution example in Smith's book that > I cited above is an almost perfect match to this problem. > > Jerry
Jerry, Well .... Smith treats a continuous signal situation and that's not what we have here. What we have here is a continuous signal that passes through a lowpass system and is then sampled. There's no antialiasing filtering going on it appears. What's more, the sample rate relative to the important signal bandwidth is unknown. Because the lowpass is imperfect for alias suppression then I'd want to know that the chosen sample rate is at least reasonable. As Smith points out, if the data is already removed then no amount of boosting effort is going to help. All you get is noise. Jerry, I know that you know more than I about selection of sample rates for control systems. This seems to be one of those situations *if* any viable compensator is to be implemented. Also, simply recreating a version of the input isn't enough as I understand it. There has to be a registration of the constructed input in time so there can be alignment with depth (which I assume is already aligned with time). It's similar to a situation where the output is a delayed version of the input and the input *and* the delay are unknown. In this case, I don't know how well the system is modeled by a 25-second time constant. So, that's a concern in addition to the concern related to the output having been sampled and a desire to reconstruct the input from those samples with good temporal resolution. If I did it correctly, a simple simulation shows that the 0.25Hz sample rate is maybe OK if 40dB down is OK and if the input is a ramp. It's pretty marginal if the input is a step - doesn't get to the 40dB down point at fs/2. But that's just for sampling purposes and not for the purposes of meeting the objective here.... Fred
Fred Marshall wrote:
> "Jerry Avins" <jya@ieee.org> wrote in message > news:XpGdnZKpWL4I5lLYnZ2dnUVZ_oOonZ2d@rcn.net... >> Fred Marshall wrote: >>> Charlie, >>> >>> I guess if one assumes a sink rate of 1ft/sec then you will get to 200' >>> in 200 seconds and will have 50 samples. It's rather important to relate >>> the sampling rate to the rate of change of the input and to the system >>> characteristics. >>> >>> I don't have a proof but I can guess that the sample rate at the output >>> in this case will have to be more than adequate to sample the *input* - >>> since, the input will be calcuated from the output samples. >>> >>> In this case, the system is an integrator so the inverse system is a >>> differentiator. Differentiators are noisy and sampled data >>> differentiators are probably even more challenging. >>> >>> I'll think some more on it but the rates, as above, are important. >> The sensor's time constant does some low-pass filtering -- if it didn't, >> there'd be no difficulty to overcome -- but very imperfectly for alias >> suppression. The scintillation deconvolution example in Smith's book that >> I cited above is an almost perfect match to this problem. >> >> Jerry > > Jerry, > > Well .... Smith treats a continuous signal situation and that's not what we > have here.
Smith's signal is sampled. He designs a digital deconvolver.
> What we have here is a continuous signal that passes through a lowpass > system and is then sampled. There's no antialiasing filtering going on it > appears. What's more, the sample rate relative to the important signal > bandwidth is unknown.
The OP wants to design a system that works. I presume he is willing to choose a reasonable sample rate and include an anti-alias filter if it's needed.
> Because the lowpass is imperfect for alias suppression then I'd want to know > that the chosen sample rate is at least reasonable.
Absolutely. The time -- predominantly a single exponential decay -- constant is known. After three time constants, old signal will have decayed to 5%, and after seven, to 1%. We ought to be able to deduce a suitable sample rate even without an anti alias filter from those numbers, but my thinker is stuck right now. Does a sample period of 1/14th of the time constant do it? I believe it does. 14/25 seconds is .56 seconds. Be generous: sample twice a second. Maybe even 5 times.
> As Smith points out, if the data is already removed then no amount of > boosting effort is going to help. All you get is noise.
That's why one shoots for impulse in, narrow spike out instead of impulse out. If the spike is narrow enough compared to the data's rate of change, that's a practical system.
> Jerry, I know that you know more than I about selection of sample rates for > control systems. This seems to be one of those situations *if* any viable > compensator is to be implemented.
All I know about digital control systems is that one need to sample a lot faster than one might at first think. That's for two primary reasons: anti-alias filters add delay that one can ill afford, and a one-sample delay at Fs/2 is a pi/2 phase shift; disaster.
> Also, simply recreating a version of the input isn't enough as I understand > it. There has to be a registration of the constructed input in time so > there can be alignment with depth (which I assume is already aligned with > time). It's similar to a situation where the output is a delayed version of > the input and the input *and* the delay are unknown. In this case, I don't > know how well the system is modeled by a 25-second time constant. So, > that's a concern in addition to the concern related to the output having > been sampled and a desire to reconstruct the input from those samples with > good temporal resolution.
The delay of the system as a whole, sensor and filter included, can be determined empirically along with the quality of the deconvolver. Allow the sensor to settle to steady state in a bucket of deoxygenated water, then transfer to to well aerated water at a known time while plotting the deconvolver's output. The result should look like a decent step, with a rise time small enough to make the OP happy. The delay will be evident. Once the system is tuned to reproduce a step well, all the unknowns will have become clear.
> If I did it correctly, a simple simulation shows that the 0.25Hz sample rate > is maybe OK if 40dB down is OK and if the input is a ramp. It's pretty > marginal if the input is a step - doesn't get to the 40dB down point at > fs/2. But that's just for sampling purposes and not for the purposes of > meeting the objective here.... > > Fred
My back-of-the-envelope treatment above indicates a .5 Hz sample rate based on general principles. 40 dB down is the 1% that 7 time constants buys. When it's feasible, I like the .01234% that 9 time constants buys, not only because it's an easy number to remember. (-78 dB) Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
And the OP is taking samples every 4 seconds..... 


Fred Marshall wrote:
> And the OP is taking samples every 4 seconds.....
I think we showed him he needs to change that in order to solve his problem. a sample every 4 seconds is fast enough to sample the water, but he needs to go at least 8 times as fast in order to sample the DO meter. Sampling the DO meter could be done with a separate system that reports a deconvolved (and delayed) reading every 4 seconds. Call it part of the DO measuring system if that makes management happy. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;