# Auto-zero/Auto-calibration

(Difference between revisions)
 Revision as of 09:53, 12 September 2010 (edit) (→Mathematical Formulation)← Previous diff Revision as of 10:28, 12 September 2010 (edit) (undo) (→Biochemical temperature control)Next diff → Line 51: Line 51: ** $V_x \,$ is the corresponding voltage read: $V_c\,$ or $V_t\,$ ** $V_x \,$ is the corresponding voltage read: $V_c\,$ or $V_t\,$ ** $v_{off} \,$ is the reading offset value, an error ** $v_{off} \,$ is the reading offset value, an error + ** $\overline{v_{off}}\,$ the PDF of $v_{off} \,$ ** $V_{ref}, e_{ref} \,$ the nominal bias voltage and bias voltage error ** $V_{ref}, e_{ref} \,$ the nominal bias voltage and bias voltage error + ** $\overline{e_{ref}}\,$ the PDF of $e_{ref} \,$ ** $R_b, e_b \,$ the nominal bias resistor and bias resistor error ** $R_b, e_b \,$ the nominal bias resistor and bias resistor error + ** $\overline{e_b}\,$ the PDF of $e_b\,$ ** $e_{com} \,$ an unknown constant resistance in series with $R_c, R_t \,$ for all readings ** $e_{com} \,$ an unknown constant resistance in series with $R_c, R_t \,$ for all readings + ** $\overline{e_{com}}\,$ the PDF of $e_{com} \,$ * With errors * With errors ** $V_x=v_{off}+\frac{(V_{ref} +e_{ref})(R_x +e_{com})}{(R_x+e_{com} + R_b+e_b)}$ ** $V_x=v_{off}+\frac{(V_{ref} +e_{ref})(R_x +e_{com})}{(R_x+e_{com} + R_b+e_b)}$ Line 66: Line 70: ** Inversion in terms of estimates ** Inversion in terms of estimates ***$\widehat{R_t}=\frac{(V_t-\widehat{v_{off}}) (\widehat{e_{com}}+R_b+\widehat{e_b})-\widehat{e_{com}}(V_{ref}+\widehat{e_{ref}})}{V_{ref}-\widehat{v_{off}}-V_{t}-\widehat{e_{ref}}} ***[itex]\widehat{R_t}=\frac{(V_t-\widehat{v_{off}}) (\widehat{e_{com}}+R_b+\widehat{e_b})-\widehat{e_{com}}(V_{ref}+\widehat{e_{ref}})}{V_{ref}-\widehat{v_{off}}-V_{t}-\widehat{e_{ref}}} +$ + * Representation of Inversion in terms of PDF's. The real calculation requires convolution with respect to: +, -, *, and \ . Furthermore the convolutions can't be done with ''simple'' Fourier and Mellin transforms since terms appear in multiple places. + ***$\overline{R_t}=\frac{(V_t-\overline{v_{off}}) (\overline{e_{com}}+R_b+\overline{e_b})-\overline{e_{com}}(V_{ref}+\overline{e_{ref}})}{V_{ref}-\overline{v_{off}}-V_{t}-\overline{e_{ref}}}$ [/itex] ** Mode estimate: Maximize the probability of an estimate treating the calibration measurement $V_c \,$ as a constraint hypersurface in the error space; requiring a defined PDF function. This can done via KKT; and also extended to more calibration readings. In polynomial cases this can theoretically be solved via Groebner basis; but even given the "exact" solutions, one is forced into sub-optimal/approximate estimates. ** Mode estimate: Maximize the probability of an estimate treating the calibration measurement $V_c \,$ as a constraint hypersurface in the error space; requiring a defined PDF function. This can done via KKT; and also extended to more calibration readings. In polynomial cases this can theoretically be solved via Groebner basis; but even given the "exact" solutions, one is forced into sub-optimal/approximate estimates.

## Motivation

In instrumentation, both in a supporting role and as a prime objective, measurements are taken that are subject to systematic errors. Routes to minimizing the effects of these errors are:

• Spend more money on the hardware. This is valid but hits areas of diminishing returns; the price rises disproportionately with respect to increased accuracy.
• Apparently, in the industrial processing industry, various measurement points are implemented and regressed to find "subspaces" that the process has to be operating on. Due to lack of experience I (RR) will not be covering that here; although others are welcome to (and replace this statement). This is apparently called "data reconciliation".
• Calibrations are done and incorporated into the instrument. This can be done by analog adjustments or written into storage mediums for subsequent use by operators or software.
• Runtime Auto-calibrations done at regular intervals. These are done at a variety of time intervals: every .01 seconds to 30 minutes. I can speak to these most directly; but I consider the "Calibrations" to be a special case.

## Mathematical Formulation

Nomenclature: It will be presumed, unless otherwise stated, that collected variables compose a (topological) manifold; i.e. a collection designated by single symbol and id. Not necessarily possessing a differential geometry metric. The means that there is no intrinsic two dimensional tensor, $LaTeX: g_{ij} \,$, allowing a identification of contravarient vectors with covarient ones. These terms are presented to provide a mathematically precise context to distinguish: contravarient and covariant vectors, tangent spaces and underlying coordinate spaces. Typically they can be ignored.

• The quintessential example of covariant tensor is the differential of a scaler, although the vector space formed by differentials is more extensive than differentials of scalars.
• The quintessental contravariant vector is the derivative of a path $LaTeX: p \,$ with component values $LaTeX: e^i =f_i(s) \,$ on the manifold. With $LaTeX: (p)^j=\frac{\partial e^j}{\partial s}\cdot \frac {\partial}{\partial e^j} \,$ being a component of the contravariant vector along $LaTeX: p \,$ parametrized by "s".
• Using $LaTeX: e \,$ (see directly below) as an example
• $LaTeX: e_{id} \,$ refers to collection of variables identified by "id"
• Although a collection does not have the properties of a vector space; in some cases we will assume (restrict) it have those properties. In particular this seems to be needed to state that the Q() functions are convex.
• $LaTeX: e_{id}^i \,$ refers to the $LaTeX: i'th \,$ component of $LaTeX: e_{id} \,$
• $LaTeX: (e_{id})_j^i\,$ refers to the tangent/cotangent bundle with $LaTeX: i \,$ selecting a contravariant component and $LaTeX: j \,$ selecting a covariant component
• $LaTeX: (expr)_{|x\leftarrow c} \,$ refers to an expression, "expr", where $LaTeX: (expr)$ is evaluated with $LaTeX: x=c$
• $LaTeX: (expr)_{|x\rightarrow c} \,$ refers to an expression, "expr", where $LaTeX: (expr)$ is evaluated as the limit of "x" as it approaches value "c"

Definitions:

• $LaTeX: x\,$ a collection of some environmental or control variables that need to be estimated
• $LaTeX: x_c\,$ a collection of calibration points
• $LaTeX: \bar{x}\,$ the PDF of $LaTeX: x\,$ when subject to probabilistic constraints.
• $LaTeX: \hat{x}$ be the estimate of $LaTeX: x\,$
• $LaTeX: p \,$ a collection of parameters that are constant during operations but selected at design time. The system "real" values during operation are typically $LaTeX: p+e \,$; although other modifications are possible.
• $LaTeX: e\,$ be errors: assumed to vary, but constant during intervals between calibrations and real measurements
• $LaTeX: \bar{e}\,$ the PDF of $LaTeX: e\,$ .
• $LaTeX: y\,$ be the results of a measurement processes attempting to measure $LaTeX: x\,$
• $LaTeX: y=Y(x;p,e)\,$ where $LaTeX: e\,$ might be additive, multiplicative, or some other form.
• $LaTeX: y_c=Y(x_c;p,e)\,$ the reading values at the calibration points for an instantiation of $LaTeX: e\,$
• $LaTeX: \hat{e}$ be estimates of $LaTeX: e\,$ derived from $LaTeX: x, y\,$
• $LaTeX: \hat{e}=Est(x_c,y_c)\,$
• $LaTeX: Q(x,\hat{x})$ be a quality measure of resulting estimation; for example $LaTeX: \sum{(x_i-\hat{x_i})^2}$
• Where $LaTeX: x\,$ is allowed to vary over a domain for fixed $LaTeX: \hat{x}$
• The example is oversimplified as will be demonstrated below.
• $LaTeX: \hat{x} \,$ is typically decomposed into a chain using $LaTeX: \hat{e}\,$

Then the problem can be formulated as:

• Given $LaTeX: x_c,y_c\,$
• Find a formula or process $LaTeX: \hat{X}\,$ to select $LaTeX: \left(x_c,y_c\right)\xrightarrow{\hat{X}}\hat{x} \,$ so as to minimize $LaTeX: Q(x,\hat{x})$
• The reason for the process term $LaTeX: \hat{X} \,$ is that many correction schemes are feedback controlled; $LaTeX: \hat{X} \,$ is never computed, internally, although it might be necessary in design or analysis.

## Examples

### Biochemical temperature control

where multiple temperature sensors are multiplexed into a data stream and one or more channels are set aside for Auto-calibration. Expected final systems accuracies of .05 degC are needed because mammalian temperature regulation has resulting in processes and diseases that are "tuned" to particular temperatures.

• A simplified example, evaluating one calibration channel and one reading channel. In order to be more obvious the unknown and calibration readings are designated separately; instead of the convention given above. This is more obvious in a simple case, but in more complicated cases is unsystematic.
• $LaTeX: V_x=v_{off}+\frac{V_{ref}R_x}{R_x + R_b}$
• $LaTeX: R_x \,$ can be either the calibration resistor $LaTeX: R_c \,$ or the unknown resistance $LaTeX: R_t \,$ of the thermistor
• $LaTeX: V_x \,$ is the corresponding voltage read: $LaTeX: V_c\,$ or $LaTeX: V_t\,$
• $LaTeX: v_{off} \,$ is the reading offset value, an error
• $LaTeX: \overline{v_{off}}\,$ the PDF of $LaTeX: v_{off} \,$
• $LaTeX: V_{ref}, e_{ref} \,$ the nominal bias voltage and bias voltage error
• $LaTeX: \overline{e_{ref}}\,$ the PDF of $LaTeX: e_{ref} \,$
• $LaTeX: R_b, e_b \,$ the nominal bias resistor and bias resistor error
• $LaTeX: \overline{e_b}\,$ the PDF of $LaTeX: e_b\,$
• $LaTeX: e_{com} \,$ an unknown constant resistance in series with $LaTeX: R_c, R_t \,$ for all readings
• $LaTeX: \overline{e_{com}}\,$ the PDF of $LaTeX: e_{com} \,$
• With errors
• $LaTeX: V_x=v_{off}+\frac{(V_{ref} +e_{ref})(R_x +e_{com})}{(R_x+e_{com} + R_b+e_b)}$
• $LaTeX: V_c=\left.V_x\right|_{x\leftarrow c}$
• $LaTeX: V_t=\left.V_x\right|_{x\leftarrow t}$
• The problem is to optimally estimate $LaTeX: R_t\,$ based upon $LaTeX: V_t \,$ and $LaTeX: V_c \,$
• The direct inversion formula illustrates the utility of mathematically using the error space $LaTeX: [V_{off}\,,e_{com}\,,e_b\,,e_{ref}] \,$ during design and analysis. The direct inversion of $LaTeX: V_t \,$ for $LaTeX: R_t \,$ naturally invokes the error space as a link to $LaTeX: V_c \,$.
• Inversion for $LaTeX: R_t \,$
• $LaTeX: R_t=\frac{(V_t-v_{off})(e_{com}+R_b+e_b)-e_{com}(V_{ref}+e_{ref})}{V_{ref}-v_{off}-V_t-e_{ref}}$
• Inversion in terms of estimates
• $LaTeX: \widehat{R_t}=\frac{(V_t-\widehat{v_{off}}) (\widehat{e_{com}}+R_b+\widehat{e_b})-\widehat{e_{com}}(V_{ref}+\widehat{e_{ref}})}{V_{ref}-\widehat{v_{off}}-V_{t}-\widehat{e_{ref}}}
$
• Representation of Inversion in terms of PDF's. The real calculation requires convolution with respect to: +, -, *, and \ . Furthermore the convolutions can't be done with simple Fourier and Mellin transforms since terms appear in multiple places.
• $LaTeX: \overline{R_t}=\frac{(V_t-\overline{v_{off}}) (\overline{e_{com}}+R_b+\overline{e_b})-\overline{e_{com}}(V_{ref}+\overline{e_{ref}})}{V_{ref}-\overline{v_{off}}-V_{t}-\overline{e_{ref}}}
$
• Mode estimate: Maximize the probability of an estimate treating the calibration measurement $LaTeX: V_c \,$ as a constraint hypersurface in the error space; requiring a defined PDF function. This can done via KKT; and also extended to more calibration readings. In polynomial cases this can theoretically be solved via Groebner basis; but even given the "exact" solutions, one is forced into sub-optimal/approximate estimates.
• Mean estimate: Using the same model the expected error of a estimate given all possible values on the constraint surface weighted by a PDF distribution on the constraint surface; is minimized. The projection of the original PDF on n-space, to the constraint surface can be done via differential geometry. There are probably statistical methods, but the statistics descriptions seem to take a cavalier attitude towards some transformations involving integrals.
• Worst case: where points considered where the constraint meets some boundary; say +- .01%
• Any of the above extended to cover a range of $LaTeX: R_t \,$ as well as the range of errors.
• It should be mentioned that, in this case $LaTeX: (R_t - \widehat{R_t})$ is not a good (or natural) function. A better function for both results and calculations is $LaTeX: (1-\frac{\widehat{R_t}}{R_t})\,$. The form of errors to be a natural variation from problem to problem and should be accommodated in any organized procedure.
• Sensitivities are needed during design in order to determine which errors are tight and find out how much improvement can be had by spending more money on individual parts; and during analysis to determine the most likely cause of failures.

#### Optimization Format

• The setpoint case with a full optimzer available at runtime. The purpose is to choose error space values that minimize some likelihood. The selected error values can then be reused to calculate $LaTeX: \widehat{R_t} \,$ for different values of $LaTeX: V_t \,$. It is presumed that we choose likelihoods such that surfaces of constant likelihood form a series of nested n-1 dimensional convex sets/shells around a center. Note the weighting so that the equal likelihood rectangles are the same shape as the boundaries. In addition the $LaTeX: e_{com-center}$ is mathematically centered. In real situations this variable might not be numerically centered in the allowed range. Given the above assumptions this just leads to more complicated weighting but still a boundary around a convex set. In addition, while this finds the most likely values of the errors it is not obvious that these values will give the most likely values $LaTeX: \widehat{R_t}\,$ .
minimize   $LaTeX: \frac{|\widehat{v_{off}}|}{L_{off}}\,+\frac{|\widehat{e_{com}}\,-e_{com-center}|}{L_{com}}+\frac{|\widehat{e_{ref}}|}{L_{ref}}\,+\frac{| \widehat{e_b}\,|}{L_b}$

w.r.t.     $LaTeX: \widehat{v_{off}}\,,\widehat{e_{com}}\,,\widehat{e_{ref}}\,,\widehat{e_b}\,$

subject to $LaTeX: [|\widehat{v_{off}}|\,,\widehat{e_{com}}\,,-\widehat{e_{com}}\,,|\widehat{e_{ref}}|\,,|\widehat{e_b}|]\,\leq\,[L_{off},L_{com},0,L_{ref}\,,L_{b}]$
$LaTeX: V_c=\widehat{v_{off}}+\frac{(V_{ref} +\widehat{e_{ref}})(R_c +\widehat{e_{com}})}{(R_c+\widehat{e_{com}} + R_b+\widehat{e_b})}$

• Ignore This until repairs are done on first example: Proposed: Change the w.r.t. to coefficients like so. This corresponds to the case where the run time processor is limited and linear corrections are to be used. This is unfinished since $LaTeX: V_c \,$ needs to be moved to a range; i.e. robust approximation.
minimize   $LaTeX: \left(1-\frac{\widehat{R_t}}{R_t}\right)^2\,$
w.r.t.     $LaTeX: [\widehat{a_{off}},\widehat{a_{com}},\widehat{a_{ref}},\widehat{a_b}],[\widehat{b_{off}},\widehat{b_{com}},\widehat{b_{ref}},\widehat{b_b}] \,$
subject to $LaTeX: [|\widehat{v_{off}}|\,,\widehat{e_{com}}\,,-\widehat{e_{com}}\,,|\widehat{e_{ref}}|\,,|\widehat{e_b}|]\leq [.001,.001,0,.0001V_{ref}\,,.001R_b]\,$
$LaTeX: [V_{ref},R_b]=[2,1] \,$
$LaTeX: [V_c,R_c]=[.998,1] \,$
$LaTeX: V_c=\widehat{v_{off}}+\frac{(V_{ref} +\widehat{e_{ref}})(R_c +\widehat{e_{com}})}{(R_c+\widehat{e_{com}} + R_b+\widehat{e_b})}\,$
$LaTeX: [\widehat{v_{off}},\widehat{e_{com}},\widehat{e_{ref}},\widehat{e_b}]=[\widehat{a_{off}},\widehat{a_{com}},\widehat{a_{ref}},\widehat{a_b}]+V_c[\widehat{b_{off}},\widehat{b_{com}},\widehat{b_{ref}},\widehat{b_b}] \,$


### Infrared Gas analysers

With either multiple stationary filters or a rotating filter wheel. In either case the components, sensors, and physical structures are subject to significant variation.

## Various forms of $LaTeX: Q()\,$

• Weighted least squares of $LaTeX: Q()\,$ over the range of $LaTeX: x\,$
• Minimize mode of $LaTeX: \hat{e}$ with respect to the range of $LaTeX: e\,$ and the measurements $LaTeX: \bar{y}=Y(\bar{x};p,e)$
• Minimize the mean of $LaTeX: \hat{e}$ with respect to the range of $LaTeX: e\,$ and the measurements $LaTeX: \bar{y}=Y(\bar{x};p,e)$
• Minimize the worst case of $LaTeX: Q()\,$ over the range of $LaTeX: x\,$
• Some weighting of the error interval with respect to $LaTeX: Q()\,$

## Areas of optimization

Design

Runtime

Calibration usage