Electronics > Metrology

A dive into K-Type Thermocouple Maths

(1/3) > >>

mendip_discovery:
There I was looking at an uncertainty budget and a calculator used by my predecessor to convert all the measurements into a single format, °C in this case. But I didn’t like it as I didn’t understand it, so I pulled it out and tried to pull it apart to work out how and why it works. This is why documentation on how things work is so important and shouldn’t just be assumed that people will know what it does and how it does it.

This is what I managed to figure out. This takes two points and draws a straight line between them and then converts the measurement to the °C. This is totally wrong for thermocouples because the line isn’t straight. Though over short distances it would be ok if you used values that were close together. Otherwise, you get errors like the ones below.

I believe this is what some thermometers do, they look up the nearest mV/temp in a table and do some basic maths to fill in the blanks. Because in most cases the regular k-type thermometer display has only got a resolution of 0.1 or 0.01°C the rest is just noise. There are many other things that make k-type thermocouples a nightmare to the regular voltnut as the quality of the metals can cause dramatic differences in the specifications. I am interested only because part of my job as Head of Lab (HoL) doing 17025 calibrations for temperature simulation is that I want to reduce the UoM I have, which currently is quite high, and so gives me a challenge when you look at Decision Rules (like TUR).

This lead me down the path of looking at the NIST Temperature Tables which are based on ITS-90, the International Temperature Standard from 1990. There is plenty of information about that on the internet and the agreements they made. I still feel it needs work but there is not a lot of money for exciting futures in the subject so it's
possibly off to the side until someone can do something clever with reflected-sound-of-underground-spirits. I tried to look for online calculators for this, but I couldn’t find any and that annoyed me, so I looked at the Coefficients stated by NIST and in the Monograph 175 and tried to do the maths. I wasn’t prepared for the madness that is mathematics, I did some at school, but I am no way an expert at it. But through a few sources on the internet, I managed to get one to work that converts mV into °C which I was proud of myself until I spotted that the calculation has a massive amount of error compared to the NIST tables, 0.054°C at its worst but enough to annoy me.

Side notes if you see T90 and t90 they referred to K and °C respectively,

mV to °C

The above is the formula for calculating mV to °C. In basic terms is,
D0+D1*E+D2*E2+D3*E3+D4*E4+D5*E5+D6*E6+D7*E7+D8*E8+D9*E9

************************************
* This section contains coefficients of approximate inverse
* functions for type K thermocouples for the subranges of
* temperature and voltage listed below. The range of errors of
* the approximate inverse function for each subrange is also given.
* The coefficients are in units of °C and mV and are listed in
* the order of constant term up to the highest order.
* The equation is of the form t_90 = d_0 + d_1*E + d_2*E^2 + ...
*     + d_n*E^n,
* where E is in mV and t_90 is in °C.
*
*    Temperature        Voltage            Error
*      range              range            range
*      (°C)               (mV)             (° C)
*    -200. to 0.      -5.891 to 0.000    -0.02 to 0.04
*     0. to 500.      0.000 to 20.644    -0.05 to 0.04
*     500. to 1372.   20.644 to 54.886   -0.05 to 0.06
********************************************************
Inverse coefficients for type K:

Temperature  -200.             0.           500.
Range:        0.           500.          1372.

Voltage   -5.891          0.000         20.644
Range:     0.000         20.644         54.886

0.0000000E+00  0.000000E+00 -1.318058E+02
2.5173462E+01  2.508355E+01  4.830222E+01
-1.1662878E+00  7.860106E-02 -1.646031E+00
-1.0833638E+00 -2.503131E-01  5.464731E-02
-8.9773540E-01  8.315270E-02 -9.650715E-04
-3.7342377E-01 -1.228034E-02  8.802193E-06
-8.6632643E-02  9.804036E-04 -3.110810E-08
-1.0450598E-02 -4.413030E-05  0.000000E+00
-5.1920577E-04  1.057734E-06  0.000000E+00
0.0000000E+00 -1.052755E-08  0.000000E+00

Error      -0.02          -0.05          -0.05
Range:      0.04           0.04           0.06

If you want to copy the formulas, I will attach the excel file for you.

While looking for the above information I found Mosaic Industries else had published their calculator for reverse calculating the mV to °C and that is better as it has got the error down to 0.02°C. I also got this formula to work and it's okay but still, the ppb (parts per butterfly) voltnut in me doesn’t like it.

http://www.mosaic-industries.com/embedded-systems/microcontroller-projects/temperature-measurement/thermocouple/type-k-calibration-table

By now I was starting to question the idea of why I was doing this to myself but as with many of the rabbit holes that voltnuts/timenuts etc end up going down we don’t really know why we just go mad with the experience. I was starting to wonder which should be seen as the master mV to °C or °C to mV, this meant to truly know it I must solve the formula.
Looking at the °C to mV formula it’s a big old SUM thing with a small e thing that just makes me cry.

But thanks to the snake charmers I was able to find the formula in an accessible format,

--- Quote ---E = sum(i=0 to n) c_i t^i
--- End quote ---

While still confusing there were hints,

--- Quote ---Alternative form: C0 + C1*internalTemp + C2*internalTemp^2 + C3*internalTemp^3 + ... + C10*internaltemp^10 + A0*e^(A1*(internalTemp - A2)^2)

--- End quote ---
Now using the data from NIST,
************************************
* This section contains coefficients for type K thermocouples for
* the two subranges of temperature listed below.  The coefficients
* are in units of °C and mV and are listed in the order of constant
* term up to the highest order.  The equation below 0 °C is of the form
* E = sum(i=0 to n) c_i t^i.
*
* The equation above 0 °C is of the form
* E = sum(i=0 to n) c_i t^i + a0 exp(a1 (t - a2)^2).
*
*     Temperature Range (°C)
*        -270.000 to 0.000
*         0.000 to 1372.000
************************************
name: reference function on ITS-90
type: K
temperature units: °C
emf units: mV
range: -270.000, 0.000, 10
0.000000000000E+00
0.394501280250E-01
0.236223735980E-04
-0.328589067840E-06
-0.499048287770E-08
-0.675090591730E-10
-0.574103274280E-12
-0.310888728940E-14
-0.104516093650E-16
-0.198892668780E-19
-0.163226974860E-22
range: 0.000, 1372.000, 9
-0.176004136860E-01
0.389212049750E-01
0.185587700320E-04
-0.994575928740E-07
0.318409457190E-09
-0.560728448890E-12
0.560750590590E-15
-0.320207200030E-18
0.971511471520E-22
-0.121047212750E-25
exponential:
a0 =  0.118597600000E+00
a1 = -0.118343200000E-03
a2 =  0.126968600000E+03

I started work and got the basics working for negative numbers, and thanks to the Monograph 175 I was able to confirm my maths as that document has the temperature tables in µV rather than mV and to a few extra decimal places. I started on the next one, and for some reason the maths was wrong, and I couldn't get it right, then I went and had a cup of tea and then looked at it again and did a quick google for “natural logarithm constant” aka 2.718281828459 and that e started to make more sense. Got it working and decided to generate myself a table with all the voltages calculated in 0.01°C this I plan to use to make some sort of look-up table and select the nearest mV to the 0.01°C, I might even take it to 0.001°C

From -200 to 0°C
C0+(C1*t90)+(C2*t902)+(C3*t903)+(C4*t904)+(C5*t905)+(C6*t906)+(C7*t907)+(C8*t908)+(C9*t909)+(C10*t9010)

And the 0 to 1372°C is more complicated due to magnetic issues.
It’s the same as the above but you don’t need the C10 instead, you add

(A0*2.718281828459^(A1*(t90-A2)2))

I still must work out how I am going to use this in my calculations, but I feel I at least have a chance to get it right. It might be worth noting that I haven’t gone down the route of calculating the CJC (Cold Junction Correction) that is because the bit, I have for work is using a simulated CJC or 0°C. I hope this helps the next person that gets the itch and falls down the rabbit hole.

binary01:
Yes, thermocouples and EMF is quite a rabbit hole for the electrical metrologist!   I have recently been through a similar journey to gain accreditation for calibration of thermocouple scales by electrical simulation (mV EMF <> temperature conversion).
I certainly avoided any consideration of linearly interpolating between tabled values (as you note, the scale is non-linear and this approach will introduce error). Instead I only consider conversion using the ITS-90 functions published by NIST (Monograph 175), or actually in my case I refer to EN 60584:2013, which based on the same coefficients.  The functions are high-order, but once you have them established and validated in your code, they are not so bad  :D

In my calculation of results and uncertainties, I need to be able to easily determine EMF for a given temperature (forward direction), temperature for a given EMF (inverse direction), and Seebeck coefficient, and do so interchangeably without loss of fidelity.  As stated in the reference documents, the inverse direction functions are imperfect and there are additional errors to consider - these can add up and compound, so you should take care to minimise the number of times the inverse direction functions are used in any single chain of calculations.
Personally I don't use the inverse functions, and instead I calculate the inverse direction by solving the forward direction functions iteratively until I converge on the result with insignificant residual.  I wouldn't enjoy doing it manually, but it's not hard for a computer to do the number crunching  8)

I believe you are correct that different digital indicators use different qualities/methods of EMF > temp conversion, and this can contribute to their stated accuracy specifications.
Developing a method and uncertainty budget for low uncertainty with ACJC enabled was the real battle!
Best of luck on your journey.  And yes, I encourage you to document your journey/findings for the time when someone else needs to take up your role!

BTW - Fluke provide some online calculators which can be handy for verifying your own calculations, and can handle CJ <> 0.  However, I have noticed a few errors in their calculator (i.e. E type at -200C looks incorrect to me), so take some care.
https://au.flukecal.com/Thermocouple-Table-Voltage-Calculator
https://au.flukecal.com/Thermocouple-Temperature-Calculator

Overall, I much prefer working with the RTD <> resistance conversions.  No CJ to consider :)

Henrik_V:
25a ago I did my master thesis in a cal lab building a temperature calibration system ...
One of my favorite source of knowledge at that time :
Manual on the Use of Thermocouples in Temperature Measurement,
Fourth Edition, Sponsored by ASTM Committee E20 on Temperature Measurement

Cite of Chapter 1 :
Regadless of how many facts are presented herein and regadless of the percentage retained, all will be for naught unless one simple important fact is kept firmly in mind. The thermocouple reports only what it "feels." This may or may not be the temperature of interest.

For an ideal TC the tables provided (in standards, ITS90 (at that time, don't know what the actual scale is ;), NIST, ..) are the reference, the interpolation math are validated interpolation but still interpolations :)  and the material effects on TCs are so high, that even a 0.1K uncertainty in the interpolation is sufficient (in my opinion) . If you need low absolut incertainties with TCs calibrate them build in.... and estinate an individual interpolation. Doing so at higher temperatures (>400°C ) is not an easy task .. and interpolation errors will be buried in other uncertainties ;)

Cite:"
Personally I don't use the inverse functions, and instead I calculate the inverse direction by solving the forward direction functions iteratively until I converge on the result with insignificant residual.  I wouldn't enjoy doing it manually, but it's not hard for a computer to do the number crunching  8) "

Did the same thing ..95 in Excel on WIN NT for TCs and PT100s   8)

Edit:
I remember calling our NMI (PTB) at  that time, asking about standards/formats for digital calibration certificates ....
Now +25 years later they come up with something  ;D
https://www.ptb.de/cms/en/research-development/into-the-future-with-metrology/the-challenges-of-digital-transformation/kernziel1einheitlichkeitim/digital-calibration-certificate-dcc.html

mendip_discovery:
One of the things I have to do is convert the mV to C for a few elements so it can go into the uncertainty budget.

Another is that I have to do regular checks on the unit to verify it's not drifting out. I would like to measure this with the agilent and make use of the 6.5digits to check the unit.

I dont have to any maths with the unit I use as it does it all for me. Problem is that my uncertainties are high becuase they used a rtd for the CJC and that has a spec of 2C and a imported uncertainty of 2C, and that is where a lot of my error is from another is the resolution of the CJC which is 0.1C. If I could ditch the CJC and diy that then I could get a better rtd for measuring it and work in 0.01. It's all ideas swimming about my head. I wanted to get the whole coefficients down and noted, then though I might as well share that so that others can also learn from it. This is just temperature simulation.

RYcal: