Electronics > Projects, Designs, and Technical Stuff

4th order polynomial coefficients for pressure at temperature readings, Help!!!

<< < (8/12) > >>

Jay_Diddy_B:
Hi,

It make intuitive sense.

You have a two second order polynomials, one for temperature and one for pressure.

The constant term A4 is the sum of the constant terms in each of the second order polynomials.

On the surface plot that i shared no correction is needed at Temp = 21 (all pressures) or pressure = 0 (all temperatures)

Jay_Diddy_B

Nominal Animal:
Let's recap.  We have five coefficients that can be defined in the device.  Let's call these a0 a1 a2 a3 a4 .
We do not know what these coefficients are, exactly, but we want to find out.  Because of the default, we can be almost certain that a1 is the first-degree coefficient for the pressure.

Let's assume the internal compensation function is P(p, c) = P2 p2 + P1 p + C2 c2 + C1 c + Oo.  Then, we can assume that a1 = P1, i.e. P1 is always the second one.  The simplest option, then, would be to try the most likely possibilities, and see if they make sense.  Here's the ones I would try:

* 0.000000669808265654805  0.999876931661194  -0.0000000000881848278027671  0.000000710797927540773  0
This corresponds to P2 P1 C2 C1 Oo, but we already know this didn't work.
* 0  0.999876931661194  0.000000669808265654805  0.000000710797927540773  -0.0000000000881848278027671
This corresponds to Oo P1 P2 C1 C2 .
* 0  0.999876931661194  0.000000710797927540773  0.000000669808265654805  -0.0000000000881848278027671
This corresponds to Oo P1 C1 P2 C2 .
* 0.000000669808265654805  0.999876931661194  0  -0.0000000000881848278027671  0.000000710797927540773
This corresponds to P2 P1 Oo C2 C1 .
* 0.000000669808265654805  0.999876931661194  0  0.000000710797927540773  -0.0000000000881848278027671
This corresponds to P2 P1 Oo C1 C2 .
* 0.000000710797927540773  0.999876931661194  -0.0000000000881848278027671  0.000000669808265654805  0
This corresponds to C1 P1 C2 P2 O0 .There are a total of 24 possible combinations with P1 in the second position, but I think there has to be some kind of logic in them, not just a random jumble, and the above ones are the ones I would test.

If anyone has additional suggestions I didn't immediately see, please pipe up!  Me err often, me be uncle bumblespork.
(I don't just like peer review; my output requires it.)


Another option is to do ten sets of samples at different temperatures and pressures, each set with a specific coefficient set:

--- Code: ---0 1 0 0 0
+0.00000001  0  0  0  0
-0.00000001  0  0  0  0
0 0 +0.00000001 0 0
0 0 -0.00000001 0 0
0 0 0 +0.00000001 0
0 0 0 -0.00000001 0
0 0 0 0 +0.00000001
0 0 0 0 -0.00000001

--- End code ---
Instead of ±0.00000001, it would be better to use as large value in magnitude as possible, without error in the reported pressure.

Note that each of the ten sets are independent: they don't need to have samples at the same temperature and pressure, as long as there are at least five measurements, at at least three different pressures and three different temperatures.  You can either do a sweep of temperature or pressure, or measure a specific pressure and temperature using each of the ten sets of parameters.

The idea is that when we have a table with eight columns – the five coefficients used, the temperature (count) and pressure received, and the actual pressure being measured –, we can deduce the exact algebraic form of the compensation function the device uses.  For each set of five coefficients, we do need samples at at least three different temperatures and three different pressures, so that we can differentiate between linear terms and quadratic terms.  (If we suspect there are third degree terms, or higher, we need correspondingly more samples to deduce the exponent/power.)

IanB:

--- Quote from: Nominal Animal on August 20, 2020, 06:58:10 pm ---Let's recap.  We have five coefficients that can be defined in the device.  Let's call these a0 a1 a2 a3 a4 .
We do not know what these coefficients are, exactly, but we want to find out.  Because of the default, we can be almost certain that a1 is the first-degree coefficient for the pressure.
--- End quote ---

Unfortunately, it doesn't seem like the meaning of a0..a4 should be unknown. If we look at the OP's earlier posts, there is apparently access to the inventor of the device, and there is access to a manual. This should not be a mystery. Either the inventor or the manual should be able to say, "This is the form of the correction polynomial programmed into the device."

I am perplexed that not once has the OP provided this information in plain text. It would be simple to answer if only that information were given.


--- Quote from: itsbiodiversity on August 19, 2020, 08:10:52 am ---I am using a previous manual that used the term "correction factor" - I spoke to the inventor yesterday
--- End quote ---


--- Quote from: itsbiodiversity on August 19, 2020, 03:48:09 pm ---The UUT counts is used to calibrate to engineering units of psi.  The Counts of PSI wasn't used in the author's formula, just the counts for temperature at varying pressures.

--- End quote ---

itsbiodiversity:
My apologies having issues quoting.  But to answer a few questions.  First off the person I spoke to initially isn't responding anymore.  Here is verbiage concerning the coefficients from the admin manual.

Enter Temperature Coefficients
This command provides for the entry of temperature coefficients that will compensate the sensor for ambient temperature conditions. The
coefficients are determined during the factory calibration process.
tcomp <a0> <a1> <a2> <a3> <a4>
The operator specifies five coefficients, which are used in a fourth order polynomial that corrects temperature readings for the ambient temperature at the sensor.

From the cal procedure:
"Take your recorded readings from the 3 temperatures and enter them into the polynomial linearization program to get your coefficients."

The "linearization program" I am told is a Quattro spreadsheet that I have access to.  I am not able to upload the spreadsheet here or I would.  I am attaching that pasted in excel to this comment.  In Quattro I can see the following is used, and to great effect actually, to normalize the pressure readings on the UUT to match the standard.
+$A:$N$11*C7+$A:$O$11*D7+$A:$P$11*E7+$A:$Q$11*F7

where N11 is an x coefficient, C7 is the temperature counts, O11 is another x coefficient, D7 is the UUT PSI reading, P11 is the third x coefficient, E7 is Temperature Counts (C7) x UUT PSI reading (D7), Q11 is the fourth x coefficient, and F7 is temperature counts squared (C7 x C7) multiplied by UUT PSI reading (D7).

The x coefficients referenced above are the four x coefficients in ZERO regression output left to right.

This is all of the information I have - as it appears this team abandoned the project at some point and I'm working off of what they did.  My apologies for not having further information - it has been frustrating trying to get information from them.  You've all helped more than you know already.

In the attached file I went ahead and wrote the equation for correction to column G labeled CORRECTED so that one can see what is going on.  The confusion I am having is what within the simple formula is considered a0 through a4.  Does this help at all?

itsbiodiversity:
I just received this info and I hope this helps.

Here is how the unit uses the coefficients:

"/* 3.2 - Function to Apply Temperature Compensation */
float ApplyCompensation (float rdg, int tempAdc)
    {
    float tmp = (float)tempAdc;
    float tmp2 = tmp * tmp;
    float limit, result;

    /* Limit the result to comform to the linearization table */
    limit = tblCnt ? fabs(calTbl[tblCnt-1].value) * 1.5 : 17.0;
   
    /* Adjust the pressure reading using temperture polynomial */
    result = coefTbl[0]
            + (coefTbl[1] * tmp)
            + (rdg * (coefTbl[2] + (coefTbl[3] * tmp) + (coefTbl[4] * tmp2)));

    /* Don't allow the result to stray too far from the table's limits */
    if (result < -limit)
        result = -limit;
    else if (result > limit)
        result = limit;

    /* Provide the temperature compensated pressure reading */
    return (result);
    }

You may not be a connoisseur of the C language, so the distilled version is:

result = a0 + (a1 * tmp) + X * (a2 + (a3 * tmp) + (a4 * tmp2 ))

   where: tmp is temperature ADC and X is the pressure reading

I seem to recall that A0 was usually zero". 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod