Author Topic: 4th order polynomial coefficients for pressure at temperature readings, Help!!!  (Read 7777 times)

0 Members and 1 Guest are viewing this topic.

Offline itsbiodiversityTopic starter

  • Regular Contributor
  • *
  • Posts: 99
  • Country: us
I am working with an instrument that contains an RTD to account for temperature in precise pressure measurements. The designer used a fourth order polynomial to calculate correction factors a0, a1, a2, a3, and a4. Pressure readings of a standard (STD) versus a unit under test (UUT) are taken at multiple temperatures (3 temperatures) related to an ADC Count Value (3 count settings, directly correlating to temperature). Pressure readings are taken from a low range to a high range at each temperature. Can anyone help direct me to how to calculate these coefficients? I can provide an excel sheet with data if it helps. Thanks so much.  Data presented below for copy/paste, but an excel sheet is shared below.  Any help would be appreciated.

psi   °C   Counts  uut
-15   15   5485   -15.017
-13   15   5485   -13.014
-11   15   5485   -11.011
-9   15   5485   -9.01
-7   15   5485   -7.008
-5   15   5485   -5.006
-3   15   5485   -3.004
-2   15   5485   -2.002
0   15   5485   0
2   15   5485   2.001
3   15   5485   3.002
5   15   5485   5.004
7   15   5485   7.006
9   15   5485   9.007
11   15   5485   11.008
13   15   5485   13.008
15   15   5485   15.008
-15   21   7386   -15
-13   21   7386   -13
-11   21   7386   -11
-9   21   7386   -9
-7   21   7386   -7
-5   21   7386   -5
-3   21   7386   -3
-2   21   7386   -2
0   21   7386   0
2   21   7386   2
3   21   7386   3
5   21   7386   5
7   21   7386   7
9   21   7386   9
11   21   7386   11
13   21   7386   13
15   21   7386   15
-15   28   9471   -14.99
-13   28   9471   -12.991
-11   28   9471   -10.993
-9   28   9471   -8.994
-7   28   9471   -6.996
-5   28   9471   -4.997
-3   28   9471   -2.998
-2   28   9471   -1.999
0   28   9471   0
2   28   9471   1.999
3   28   9471   2.998
5   28   9471   4.997
7   28   9471   6.996
9   28   9471   8.996
11   28   9471   10.996
13   28   9471   12.996
15   28   9471   14.996
 

Offline ahbushnell

  • Frequent Contributor
  • **
  • Posts: 738
  • Country: us
You can calculate the polynomial or use a lookup table.  Is it a PT100 RTD?  That means it's a nominal 100 ohm resistance.  There is also PT1000 but not common.


I would suggest a lookup table unless floating point is not a problem. 


Omega has information on RTD's.  Here are some links.
https://www.omega.com/en-us/resources/rtd-resistance-elements-principles
https://www.omega.com/en-us/resources/temperature-transmitter-scaling-methodologies
https://www.omega.com/en-us/resources/rtd-hub
European table (more common)
https://assets.omega.com/pdf/tables_and_graphs/thermistor-resistance-europe.pdf
USA table
https://assets.omega.com/pdf/tables_and_graphs/thermistor-resistance-us.pdf


 

Offline itsbiodiversityTopic starter

  • Regular Contributor
  • *
  • Posts: 99
  • Country: us
It is a pt100 rtd.  I corrected the actual RTD measurement already.  This is specifically a correction for the pressure at the multiple temperatures across the range of pressure.  I am not looking to calibrate the RTD, I am looking to use the variation in pressure at temperatures not standard to develop a correction curve.  If the unit reads -15.036 psi at 0 °C, -15 at 20 °C, and -15.001 and 28 °C, for instance, to correct for those values.  The problem I have is that I have data points where the variation differs (see attached excel file).  I hope any of this makes sense.
 

Offline itsbiodiversityTopic starter

  • Regular Contributor
  • *
  • Posts: 99
  • Country: us
You know that is how I'm confused as well.  I am starting to think someone left a vital piece of the puzzle out to make this difficult for future discoverers. 

I hope this helps,
but I am trying to develop the coefficients by comparing the Standard psi to the UUT psi at multiple temperatures. At Standard temperature the coefficient is 1 (a2), it has to be.  I am trying to calculate the other correction coefficients for the cold and warm temperature pressure corrections.

End result, correlation coefficients for psi corrections to the uut at applied ADC temperature and applied PSI to pressure sensor.
 

Offline itsbiodiversityTopic starter

  • Regular Contributor
  • *
  • Posts: 99
  • Country: us
I believe x is (column a) and y is (column d), but at said Temperature (column b) and adc counts (column c).
 

Offline b_force

  • Super Contributor
  • ***
  • Posts: 1381
  • Country: 00
    • One World Concepts
I am missing context and error analyses here. (i am reading the word "precise")
Without you can't say much about any value and therefore formula anyway  :-//

Offline b_force

  • Super Contributor
  • ***
  • Posts: 1381
  • Country: 00
    • One World Concepts
I am missing context and error analyses here. (i am reading the word "precise")
Without you can't say much about any value and therefore formula anyway  :-//

You have a point of course, but there is some assumption here that something was done to pressure to make it more accurate across varying temperatures. At least that is what it sounds like to me. So, you can discuss the validity of whatever was done for sure, I am just trying to explain, as I see it, how you can calculate the coefficients to use the 4th degree polynomial across any temperature (or pressure) that you encounter.

Those three temp values are nearly identical. As I have shown, the resulting coefficients are basically the same, at least to 3-4 places to the right of the decimal point in the two comparisons. But, it is different depending upon the direction you are going,

Col4 to Col1 yields
Curve 1:
STD Pressure psi   column 1:
Coefficients:
b[0]   2.9172413156e-4
b[1]   0.9998722529
b[2]   -3.7115635776e-6
b[3]   3.0792040459e-8
b[4]   1.9850325958e-8
r ²   0.9999996465

I guess what I am saying is which two comparisons are you going to use to calculate the coefficients and, in which "direction" are you going to go - which is X and which is Y.
Isn't that the only point to make?
Context is everything, the rest is just a matter of putting in numbers, getting a trend line and fit what should be according physics?
If it doesn't fit, there is something strange happening, or you should apply for a Nobel Price since you bumped into something out of the ordinary?

Offline b_force

  • Super Contributor
  • ***
  • Posts: 1381
  • Country: 00
    • One World Concepts
/--/
Isn't that the only point to make?
/--

I don't think that it is the only point to make. The point I was trying to make was to help the OP with his question and, specifically, how to calculate what he wanted to calculate...and I hope it helped.
I just even told what to do, see what relation is being expected from a physics point of view.
If that doesn't fit, you either have a serious problem, or some kind of error in your system.
So next step is to figure out what that error is.
 
The following users thanked this post: itsbiodiversity

Offline itsbiodiversityTopic starter

  • Regular Contributor
  • *
  • Posts: 99
  • Country: us
you are correct.  I find now the correction factors "go into a programmed" 4th degree polynomial.  I was very confused.  I am looking for correction factors for the uut to match std psi at any temperature.  I apologize for any miscommunication.
 

Offline itsbiodiversityTopic starter

  • Regular Contributor
  • *
  • Posts: 99
  • Country: us
the only file i have is an old quattro file... any way to share that?
 

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2734
  • Country: ca
Hi,

I am not sure that you have enough data.

If am reading the data that you provided correctly:

1) at 21C the device reads the nominal pressure and no correction is required.

2) at 0 pressure the device reads 0 at all three temperatures.

If I plot the error, that is the difference between the nominal reading and the measured reading, on a surface plot I get a shape which is twisted like a propeller:





I am not sure how you correct for this with a single polynomial.

Jay_Diddy_B
« Last Edit: August 19, 2020, 03:02:19 am by Jay_Diddy_B »
 
The following users thanked this post: itsbiodiversity

Online IanB

  • Super Contributor
  • ***
  • Posts: 11926
  • Country: us
I am working with an instrument that contains an RTD to account for temperature in precise pressure measurements. The designer used a fourth order polynomial to calculate correction factors a0, a1, a2, a3, and a4. Pressure readings of a standard (STD) versus a unit under test (UUT) are taken at multiple temperatures (3 temperatures) related to an ADC Count Value (3 count settings, directly correlating to temperature). Pressure readings are taken from a low range to a high range at each temperature. Can anyone help direct me to how to calculate these coefficients? I can provide an excel sheet with data if it helps. Thanks so much.  Data presented below for copy/paste, but an excel sheet is shared below.  Any help would be appreciated.

This is a regression problem.

You have a measurement value compared to a standard (known) value.

Therefore your measurement error is:

   error = standard value − measurement value

Over the range of measurements you have an error function:

   error = f(T, P)

You want to fit a polynomial that best represents this error so you can apply it as a correction to the measured values.

You say the correction factors are a0, a1, a2, a3, a4, but you need to know the form of the polynomial before you can do anything.

I did a bit of experimenting in Excel and found a correction polynomial of this form was able to fit the error quite well:

   correction = (T-21) * (A + B*P + C*P*(T-21) + D*P^2)

However, this may not be the correction polynomial you have to work with. You need to know what it is.

Here is a chart showing the measurement error (blue bars) and the calculated correction (orange bars) that I obtained:

(A = 5.177e-5, B = -1.131e-4, C = 5.213e-6, D = 1.565e-6)


« Last Edit: August 19, 2020, 05:00:23 am by IanB »
 
The following users thanked this post: itsbiodiversity

Offline itsbiodiversityTopic starter

  • Regular Contributor
  • *
  • Posts: 99
  • Country: us
you are correct.  I find now the correction factors "go into a programmed" 4th degree polynomial.  I was very confused.  I am looking for correction factors for the uut to match std psi at any temperature.  I apologize for any miscommunication.

If I am understanding you, this is what you want to do.... You will collect UUT temperatures and you want to express them as STD temperatures. In order to do that, you will determine the function between the UUT temperatures and the STD temperatures based on the data that has already been collected [what is in the spread sheet], using a 4th degree polynomial. When you have determined that function, you will have the coefficients for the polynomial. With those, you can translate a UUT temperature to a STD temperature.


Now, when you have any UUT temperature, you can derive a STD temperature based upon the calculated relationship between the two using the sample points that were provided. (Please stop saying correction, but I know what you mean and you are not completely wrong)

So that I don't feel like I am, literally, doing homework for you, you should be able to figure out which coefficients go where  :)  I don't know where/how you enter the coefficients into whatever spreadsheet or quattro file or whatever, but you can run a number of sample point with a decent calculator or program and see if you are doing it correctly.

I understand the urgency, but I hope that you will give it more thought to get it straight what you are doing and why. Good luck and hope it helps.


Condescend much?  Especially while answering incorrectly. 

I am not looking for help with temperature information.  If you think I cannot calculate RTD coefficients then please pack it up.  And yes, I am using a previous manual that used the term "correction factor" - I spoke to the inventor yesterday who called it such.  I'm going to say I'm safe using the term as they invented and designed it to use "correction factors".  Please do not tell people how to speak - it's extremely condescending as well.


I am looking to correct the PRESSURE readings across the temperature spectrum.  I AM NOT LOOKING TO CORRECT THE RTD READING!  I am only looking to correct for pressure at the given temperatures.  There may be a specific formula used by the author of the unit that gave these "coefficients" a0 to a4 - I am going off of available information.  I've had three or four engineers look at this today and we all were lacking an answer.
« Last Edit: August 19, 2020, 08:22:05 am by itsbiodiversity »
 

Offline itsbiodiversityTopic starter

  • Regular Contributor
  • *
  • Posts: 99
  • Country: us
Is this for the pressure readings over temperature?  The temperature and it's accuracy does not matter in this case - I am trying to tie factors to the pressure so that readings taken by a module at say 20 C are the same as measurements taken at 28 C.  I do know the data I presented was used by the original programmer to do the statistics.  I have attached an example with the columns and regression analysis.  Any help figuring out what a0 through a4 would be in a scenario like this would be appreciated.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6304
  • Country: fi
    • My home page and email address
I am using a previous manual that used the term "correction factor" - I spoke to the inventor yesterday who called it such.
The naming depends on approach.

Because the device behaviour is almost linear (and often modeled as linear), it makes sense to call the adjustments necessary as correction factors.  This is the device-based approach.

When the behaviour is modeled using a polynomial (a quartic one, in this case: \$f(x) = F_0 + F_1 x + F_2 x^2 + F_3 x^3 + F_4 x^4\$), the parameters to be fitted are the polynomial coefficients (\$F_0\$, \$F_1\$, \$F_2\$, \$F_3\$, and \$F_4\$).  This is the measurement-based approach.

No need for anyone to get snippy, just because they're looking at the situation from different angles, and using different nomenclature because of that.



As a computational materials physicist, I do believe that in this particular case, it would be better to use a bivariate polynomial, rather than two separate polynomials (one for the RTD resistance-to-temperature curve, the other for pressure reading compensation as a function of temperature).  Essentially, you would have $$f(x, y) = \sum_{i=0, j=0} F_{i j} x^i y^j$$ where \$F_{i j}\$ are the coefficients fitted to sample data (via least-squares fitting; one of the easiest tools for this is Gnuplot), \$x\$ being e.g. the ADC reading for the RTD, and \$y\$ the ADC reading for the pressure sensor, and \$f(x,y)\$ yielding the normalized pressure.

Yes, I know: the original inventor didn't do it this way.  It does not matter.  It is a sensor combination whose behaviour is continuous and almost-but-not-exactly linear, and for this, the best model is a bivariate polynomial fitted to measured parameters, then verified that the fit looks sane (\$F(x, C)\$ and \$F(C, y)\$ look sane and predictable for all constants \$C\$), i.e. have the form predicted in literature.  This is very, very common in physics, and indeed in my own field, non-QM (AKA traditional potential model) molecular dynamics with millions of atoms and more, where the potential function has a form based upon theory and mathematical approximation, but the individual coefficients are fitted from real-world measurements.  (In particular, it is very common to use one set of coefficients when modeling surfaces, and another when modeling bulk properties.)
« Last Edit: August 19, 2020, 12:05:22 pm by Nominal Animal »
 
The following users thanked this post: itsbiodiversity

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6304
  • Country: fi
    • My home page and email address
If you provide a table with three entries – temperature count, pressure count, normalized pressure – with as many samples as you can muster, I'd be happy to provide you with a reasonable bivariate approximation, that takes in the temperature and pressure counts, and spits out normalized pressure.

Or, if you want, four entries – temperature count, pressure count, actual temperature, normalized pressure – and I'll provide you with two bivariate polynomials: one spits out the actual temperature, and the other normalized pressure, when given just the temperature and pressure counts.

I'll even show how I do that with Gnuplot.  (Why gnuplot?  It's free, takes in simple tabulated data, and can produce publication-quality graphs, making it quite popular among computational scientists.)
 
The following users thanked this post: itsbiodiversity

Offline ETITsynthesizer

  • Contributor
  • Posts: 48
I think Nominal Animal had the best response in this whole thread. I don't know if this is helpful but I would have tried the polynomial regression tool in excel. this gives the answer in the standard polynomial form. let the computer do the math. I have never worked with a bivariate polynomial in math before but I can dig it. I will trust that he/she knows what they are talking about since they have experience with this kind of regression.
 
The following users thanked this post: itsbiodiversity

Offline itsbiodiversityTopic starter

  • Regular Contributor
  • *
  • Posts: 99
  • Country: us
I believe you've got the answer here.  My apologies for any explanation errors - I am working "backwards" from available knowledge in many aspects. Did you happen to look at the spreadsheet I attached on the last post?  The only data that they used for this product was taking PSI readings from the Low to High Range at 3 different Temperatures. Looking at the spreadsheet it appears they have a Zero: Regression Output with x coefficients.  These x coefficients are used in the formula +$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). 

Applied line by line the formula does a great job of correcting for temperature area. The author of the instrument stated the following:
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>  (THESE ARE WHAT I AM TRYING TO IDENTIFY) :)
The operator specifies five coefficients, which are used in a fourth order polynomial that corrects temperature readings for the ambient temperature at the sensor.
The currently effective temperature compensation coefficients can be viewed using the coef command, which is described in the user’s manual.
default is 0 0 1 0 0.

Does this make sense?  I feel like this is close to what you were describing.  I'm attaching another spreadsheet here, and I'm also downloading the program you mentioned.  Thank you so much.
 

Offline itsbiodiversityTopic starter

  • Regular Contributor
  • *
  • Posts: 99
  • Country: us
Pretty sure this is the first time I've encountered anyone rude like this on here.  I usually hang in the Metrology forum, which is what my career is (Chemist/Metrologist).  I'm not sure if him saying "good luck with your homework" is supposed to make me feel inferior, but an answer surely would've been respected.  I'm positing that if you knew the answer you'd have provided it, and if you do have the answer I'd still be appreciative. 

I truly appreciate those of you that have spent time and thought towards helping with this question.
 

Offline DrG

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: us
Pretty sure this is the first time I've encountered anyone rude like this on here.  I usually hang in the Metrology forum, which is what my career is (Chemist/Metrologist).  I'm not sure if him saying "good luck with your homework" is supposed to make me feel inferior, but an answer surely would've been respected.  I'm positing that if you knew the answer you'd have provided it, and if you do have the answer I'd still be appreciative. 

I truly appreciate those of you that have spent time and thought towards helping with this question.

Read me carefully...I spent plenty of time with your problem last night...repeatedly presenting graphs and coefficients and trying to help you. Trying, in fact, to understand what it is that you were trying to do. It was clearly a mistake for me to have even tried to help you and I regret spending anytime on it at all. Obviously you did not appreciate the effort and, equally obvious, is that it did not help you. I did, however. learn from the experience.

I don't think you explained yourself very well and I believe you when you said how confused you were about some things about the task. You can certainly understand that it is difficult to ascertain what someone else knows or does not know on a forum.

I am glad that you seem to have found your answer. I do think it is some kind of homework problem and I don't think that you explained what you were trying to do very well. I am saying good luck with your homework (or whatever it is you are trying to do) in just exactly as it says. Beyond that, I don't much care what you think or how you feel.


- Invest in science - it pays big dividends. -
 
The following users thanked this post: Someone

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6304
  • Country: fi
    • My home page and email address
I don't like the idea of someone believing me because I sound trustworthy, so let me waffle on a bit about the differences between two consecutive single-variable polynomial fits, versus a single bi-variate polynomial fit.  For simplicity, I'll limit to cubic (third degree) polynomials, only because it keeps the number of coefficients down.

Let's say \$x\$ is the pressure reading, and \$y\$ is the temperature reading, directly from the hardware (ADC).

RTDs are almost linear, but not quite.  Their resistance as a function of temperature is given by Callendar–Van Dusen equation,
$$R(T) = R(0) \biggr( 1 + A T + B T^2 + (T - 100) C T^3 \biggr) = R_0 + R_1 T + R_2 T^2 + R_3 T^3 + R_4 T_4$$
where \$R_0 = R(0)\$, \$R_1 = R(0) A\$, \$R_2 = R(0) B\$, \$R_3 = -100 R(0) C\$, and \$R_4 = R(0) C\$; and the three coefficients, \$A\$, \$B\$, and \$C\$, are dependent on the actual sensor (material).

The above equation can be solved algebraically for \$T\$ when \$R(T)\$ is known, but the expression is absolutely horrible: nobody uses it.  The three coefficients are very close to zero, so \$R(T)\$ is almost linear, \$R(T) \approx R_C (T - T_0)\$.  Therefore, \$T(R)\$ is almost linear too, and we can approximate it using a polynomial also.  Typically, a quartic (fourth degree) polynomial is used.

To measure the resistance, we use an analog to digital converter, ADC, which converts either voltage or current to a reading.  Typically – for example in the ubiquitous MAX31865 RTD-to-digital converter –, the RTD is fed from a precise current source, and the voltage (difference, in four-terminal configuration) converted to a reading using a linear ADC.

To measure the pressure, there are a number of completely different types of sensors.  Piezoresistive strain gauges and metal strain gauges have a pretty linear response in their stable measurement region, so we can assume the pressure reading is more or less linear function of the actual pressure.  Depending on the actual sensor, some compensation due to nonlinearity may be needed, so often a polynomial fit (with zeroth and first degree terms being "large", and the higher degree terms very small; so "almost linear") is used.

Every one of these is an approximation, fitted to the measured parameters.  We don't have any specific model, except for, uh, "this is almost linear".  (We do know that for RTDs, second and higher-degree terms are all negative for most common materials used in RTDs, for physical reasons actually.)  So, the sanity check for the models is to examine a few (say, two to five) different temperatures, and see how it affects a specific (constant) pressure; and a few different pressures, to see how temperature variation affects the pressure reading.  If they look to be within expected values, the overall approximation is valid.

So, what's the difference between applying consecutive polynomial fits, and a single multi-variate fit?  Cross terms.

Consider the situation when you have two different readings, \$x\$ and \$y\$, and you have a function \$f(x, y)\$ to evaluate, but both \$x\$ and \$y\$ are only almost linear.  You can calculate \$f\bigr(X(x), Y(y)\bigr)\$ where \$X(x)\$ is the compensated \$x\$ and \$Y(y)\$ is the compensated \$y\$.  This is perfectly okay to do, if you have a reason and reliable fits for \$X(x)\$ and \$Y(y)\$.

In this case, \$f(x, y) = x + g(y)\$, i.e. temperature \$y\$ is only used to give a correction \$g(y)\$ to the pressure \$x\$, to estimate the actual pressure.  The pressure compensation is only dependent on temperature, not pressure. In fact, we could write
$$f(x, y) = x + G_1 (y - y_0) + G_2 (y - y_0)^2 + G_3 (y - y_0)^3 + G_4 (y - y_0)^4$$
where \$y_0\$ is the temperature at which the pressure readings are correct with zero compensation.  See how there are no terms multiplying both \$x\$ and \$y\$?  It means this model cannot vary the pressure compensation based on pressure and temperature, only on temperature.  I do not believe this is physically sound.

Consider the case where the estimated actual pressure \$f(x, y)\$ is a bivariate (temperature reading \$y\$, pressure reading \$x\$) polynomial of degree four:
$$\begin{aligned}
f(x,y) &= F_{0 0} + F_{0 1} y + F_{0 2} y^2 + F_{0 3} y^3 + F_{0 4} y^4 + \\
 ~ & ~ ~ F_{1 0} x + F_{1 1} x y + F_{1 2} x y^2 + F_{1 3} x y^3 + F_{1 4} x y^4 + \\
 ~ & ~ ~ F_{2 0} x^2 + F_{2 1} x^2 y + F_{2 2} x^2 y^2 + F_{2 3} x^2 y^3 + F_{2 4} x^2 y^4 + \\
 ~ & ~ ~ F_{3 0} x^3 + F_{3 1} x^3 y + F_{3 2} x^3 y^2 + F_{3 3} x^3 y^3 + F_{3 4} x^3 y^4 + \\
 ~ & ~ ~ F_{4 0} x^4 + F_{4 1} x^4 y + F_{4 2} x^4 y^2 + F_{4 3} x^4 y^3 + F_{4 4} x^4 y^4 \\
\end{aligned}$$
Many of the cross terms (\$F_{i j}\$ where \$i \ne 0\$, \$j \ne 0\$) are zero or very close to zero.  They describe the change in the pressure compensation as a function of both pressure and temperature.

I believe these cross terms are needed, because we do not know exactly the pressure sensor behaviour as a function of temperature at different pressures (i.e, \$f(x, y)\$ in exact form!), but there is reason to believe that while it is likely small, there is some, due to mechanical reasons alone.  (For example, thermal expansion of the strain gauge, and the fixture where the strain gauge is located, if the pressure sensor uses the strain gauge.)
If mechanical, these dependencies are complex, but small.  We have about zero hope of deriving a numerical description from first principles – we can compute it, it is just way too complicated to be worth the effort.

Instead, we do a set of measurements at known temperatures and pressures.  If we draw a diagram with pressure on one axis, and temperature on the other axis, using a polynomial fit to a number of samples gives us an interpolated estimate within the convex hull of the samples, and handwavy extrapolated estimate outside the convex hull.  (Outside the convex hull we are basically extrapolating the system behaviour, that's the hand-waving bit.)  The denser the samples, the more reliable the estimate in that region.

If we only do measurements along each axis (i.e., one set of samples roughly horizontally in one line, and another set of samples roughly vertically on one line), we have no information for the cross terms, and fitting the measurements separately in their single-variate polynomials makes more sense.

(I like to use Gnuplot for fitting, because it allows/requires one to provide the function used for the fit, and the variables and coefficients used in the fitting.  I haven't used Excel/LibreOffice Calc for this, but that does not mean it's not a valid tool also; I'm just unfamiliar with that one.  I do know others use it, although Matlab/Octave is even more popular among scientists doing numerical work.)
« Last Edit: August 19, 2020, 02:32:14 pm by Nominal Animal »
 
The following users thanked this post: itsbiodiversity

Offline itsbiodiversityTopic starter

  • Regular Contributor
  • *
  • Posts: 99
  • Country: us
Thank you for such a detailed explanation, and I can clearly see how that technique would be superior.  Would employing that technique produce similarly effective temperature coefficients?  Is there any way to help me identify what those a0-a4 coefficients would be in both of these scenarios.  I can apply this to the unit and report back the effects.   
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 2306
  • Country: gb
In the first post the OP gave

psi   °C   Counts  uut
-15   15   5485   -15.017
-13   15   5485   -13.014
-11   15   5485   -11.011
...

which are:

reference-pressure (psi)
reference-temperature (degc)
reference-temperature (counts)
uut-calibrated-output (psi)

Do you have uut-counts (i.e. counts input to the uut-psi-calibration which is currently wrong)?
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11926
  • Country: us
Thank you for such a detailed explanation, and I can clearly see how that technique would be superior.  Would employing that technique produce similarly effective temperature coefficients?  Is there any way to help me identify what those a0-a4 coefficients would be in both of these scenarios.  I can apply this to the unit and report back the effects.

The way I did it in my post above was using Excel.

I created two columns, one with the deviation and one with the correction. The correction is calculated by the correction polynomial. Then I created a third column containing (correction − deviation)^2 containing the square of the error for each measurement. By summing the error squared column I obtained a single cell containing the sum of squared errors.

This is the setup phase. In the solve phase I used the Excel solver add-in to minimize the sum of squared errors by varying the polynomial coefficients.
 
The following users thanked this post: itsbiodiversity

Offline itsbiodiversityTopic starter

  • Regular Contributor
  • *
  • Posts: 99
  • Country: us
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.  Thanks for the reply.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf