Author Topic: A dive into K-Type Thermocouple Maths  (Read 2220 times)

0 Members and 1 Guest are viewing this topic.

Offline mendip_discoveryTopic starter

  • Frequent Contributor
  • **
  • Posts: 845
  • Country: gb
A dive into K-Type Thermocouple Maths
« on: June 22, 2022, 08:22:39 pm »
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

Using the information from NIST, https://srdata.nist.gov/its90/download/type_k.tab

************************************
* 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,
https://learn.adafruit.com/calibrating-sensors?view=all

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

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)
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.


« Last Edit: June 22, 2022, 08:31:17 pm by mendip_discovery »
Motorcyclist, Nerd, and I work in a Calibration Lab :-)
--
So everyone is clear, Calibration = Taking Measurement against a known source, Verification = Checking Calibration against Specification, Adjustment = Adjusting the unit to be within specifications.
 

Offline binary01

  • Contributor
  • Posts: 37
  • Country: au
Re: A dive into K-Type Thermocouple Maths
« Reply #1 on: June 23, 2022, 11:00:14 am »
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 :)
« Last Edit: June 23, 2022, 11:02:35 am by binary01 »
 

Offline Henrik_V

  • Regular Contributor
  • *
  • Posts: 156
  • Country: de
  • “ground” is a convenient fantasy
Re: A dive into K-Type Thermocouple Maths
« Reply #2 on: June 23, 2022, 12:08:31 pm »
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 
   
« Last Edit: June 23, 2022, 12:21:04 pm by Henrik_V »
Greetings from Germany
Henrik

The number you have dialed is imaginary, please turn your phone 90° and dial again!
 

Offline mendip_discoveryTopic starter

  • Frequent Contributor
  • **
  • Posts: 845
  • Country: gb
Re: A dive into K-Type Thermocouple Maths
« Reply #3 on: June 23, 2022, 12:28:43 pm »
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.
Motorcyclist, Nerd, and I work in a Calibration Lab :-)
--
So everyone is clear, Calibration = Taking Measurement against a known source, Verification = Checking Calibration against Specification, Adjustment = Adjusting the unit to be within specifications.
 

Offline RYcal

  • Contributor
  • Posts: 31
  • Country: nz
Re: A dive into K-Type Thermocouple Maths
« Reply #4 on: June 23, 2022, 08:09:23 pm »
Having read your last post may I suggest the following instead of using your RTD swap the "lag bath" out for a well-made "ice point".

Typically if the unit under test specs are too much for my "calibrator" I will do all the tests with the internal ref junction set at 0 using ITS-90 scales and published data from "Traceable Temperatures" book then do a single ice point test using a characterized thermocouple probe with the internal junction set back to internal to prove its within specs.

 

Offline mendip_discoveryTopic starter

  • Frequent Contributor
  • **
  • Posts: 845
  • Country: gb
Re: A dive into K-Type Thermocouple Maths
« Reply #5 on: June 23, 2022, 08:16:00 pm »
It's an option it's not a great amount of our work but I always look to improve. I was just annoyed that I couldn't find much on the maths and it was just assumed that all of us know it.

Motorcyclist, Nerd, and I work in a Calibration Lab :-)
--
So everyone is clear, Calibration = Taking Measurement against a known source, Verification = Checking Calibration against Specification, Adjustment = Adjusting the unit to be within specifications.
 

Offline MK

  • Regular Contributor
  • *
  • Posts: 234
  • Country: gb
Re: A dive into K-Type Thermocouple Maths
« Reply #6 on: June 23, 2022, 08:24:09 pm »
the slope change between temperature breakpoints in the nist tables also gives problems in differential scanning calorimetry, you need to do some smoothing and use better than 1uV resolution in your temperature table, then use all the calibration points available over your temps of interest, then you have a fudge of the curie point in the k type that gives a shift of ~.06 degrees from memory? depending on whether you are going up or down. N type is supposed to be free of curie point issues, and has a tighter specification of the composition.
 

Offline mzzj

  • Super Contributor
  • ***
  • Posts: 1245
  • Country: fi
Re: A dive into K-Type Thermocouple Maths
« Reply #7 on: June 24, 2022, 02:24:54 pm »
the slope change between temperature breakpoints in the nist tables also gives problems in differential scanning calorimetry, you need to do some smoothing and use better than 1uV resolution in your temperature table, then use all the calibration points available over your temps of interest, then you have a fudge of the curie point in the k type that gives a shift of ~.06 degrees from memory? depending on whether you are going up or down. N type is supposed to be free of curie point issues, and has a tighter specification of the composition.
None of the base-metal thermocouples is good to 0.06 degrees at elevated temperatures. 0.6 degrees could be realistic with a pinch of salt and bag of disclaimers.

Latest EA guidelines also say it is more or less waste of time to recalibrate base-metal thermocouples:
https://www.euramet.org/download/?tx_eurametfiles_download%5Bfiles%5D=39999&tx_eurametfiles_download%5Bidentifier%5D=%252Fdocs%252FPublications%252Fcalguides%252FI-CAL-GUI-008_Calibration_Guideline_No._8_web.pdf&tx_eurametfiles_download%5Baction%5D=download&tx_eurametfiles_download%5Bcontroller%5D=File&cHash=23815e4817cde3d7cb63a5dc60589954

and New Zealand MSL:
https://www.measurement.govt.nz/download/23
"Calibration of thermocouples can be a waste of time as the
end user will seldom employ the thermocouple at the same
immersion depth as was used in calibration. To make matters
worse, if the wire is inhomogeneous, the thermocouple
voltage will change as a temperature gradient is moved to
different sections of wire (e.g., by changing the immersion
into an oil bath). Therefore, the calibration is only useful if
it is carried out with the same temperature profile along the
thermocouple as when the thermocouple is used. If any inhomogeneities,
left behind from the calibration or prior
use, lie somewhere near the new temperature gradient, a
significant error will result."

I'm waiting for the next 17025 audit with horror after the latest EURAMET Calibration Guide No. 8
 
The following users thanked this post: TUMEMBER

Offline mzzj

  • Super Contributor
  • ***
  • Posts: 1245
  • Country: fi
Re: A dive into K-Type Thermocouple Maths
« Reply #8 on: June 24, 2022, 02:36:35 pm »
This might be also interesting to anyone attempting precision measurements with thermocouples:
https://www.researchgate.net/publication/319875320_The_Type_N_Thermocouple_The_Good_the_Bad_and_the_Ugly
 
The following users thanked this post: TUMEMBER

Offline MK

  • Regular Contributor
  • *
  • Posts: 234
  • Country: gb
Re: A dive into K-Type Thermocouple Maths
« Reply #9 on: June 25, 2022, 08:22:49 am »
In differential scanning calorimetry we measure the temperature at two points on a NiCr plate to 0,0001C resolution, the sudden jump at the curie point stood out very badly, and the heating and cooling curves were different at that point.
 

Offline mendip_discoveryTopic starter

  • Frequent Contributor
  • **
  • Posts: 845
  • Country: gb
Re: A dive into K-Type Thermocouple Maths
« Reply #10 on: June 26, 2022, 07:55:27 pm »
Quote
Calibration of thermocouples can be a waste of time as the end user will seldom employ the thermocouple at the same immersion depth as was used in calibration.

I find this kind of statement very annoying. They are not the best thing in the world, but the industry has been using them happily for years. The real world use of many tools doesn't follow the way it is used in calibration or lab mode. Last week I was calibrating multimeters used by mechanics working on cars in a workshop that has the doors open most of the year so the temperature swing is massive. Anyone who calibrates torque wrenches will also understand how the calibration is massively different to the way they are actually used. Half the time its about picking a good practical tool for the work you are doing, Steel Rule, Vernier Caliper, Micrometer, sigma comparator etc etc. being ok for measurement and they all get calibrated even though they have their flaws.

One of the issues I do have is the manufacturers that skim around the specs of equipment, digital thermometers with 0.4C+0.1% specs[1] from -100 to +1300 but not saying they need to add an additional for the probe. I have been into engineering firms and food places where they are using a handheld k-type thermometer and the person in the quality office insists they measure a temperature to +/-2C, I have even had to explain asking a walk in oven to maintain a +/-2C throughout the whole oven space is asking a bit much. But that is down to a lack of understanding as with a lot of things these days.

For general purpose use I think the k-type is ok, having measured many against PRT and the dry block calibrators I have in the lab (not to 17025) we have had ok results and often within 0.5C for the points tested. I think that calibration of probes is a bit pointless mostly because I usually only see ones that work or are broken not much in the way of drifting. Though I do often suggest that customers that use them for testing stuff should have a method for calibrating them before use if only to make sure they are working as often its where the insulation breaks down and the wires touch that causes odd readings (taking a reading outside the door seal of the oven and not on the part.

My dive into the maths was to provide an example of the calculations to help the next person who has to go through the stress of working it all out. The C to mV seems to me as being the master as its what was used to generate the tables, the mV to C seems pointless as its got to much error to be of use.

I don't need to use it at the 0.001C level, I just want to be able to know the maths I am using for converting the standard deviation I have for some of the repeatability tests I have done are as good as I can get them.

I have at least added EN 60584:2013 to my shopping list of standards to get, I had a copy but that was the older one and I should have an up to date copy to hand in the laboratory if I ever get more than 1 day a month in the lab.


[1] https://thermometer.co.uk/industrial-thermometers/1313-therma-1-industrial-thermometer.html
Motorcyclist, Nerd, and I work in a Calibration Lab :-)
--
So everyone is clear, Calibration = Taking Measurement against a known source, Verification = Checking Calibration against Specification, Adjustment = Adjusting the unit to be within specifications.
 

Offline Pip

  • Contributor
  • Posts: 11
  • Country: au
Re: A dive into K-Type Thermocouple Maths
« Reply #11 on: July 14, 2022, 06:52:27 am »
As you have already worked out, the temperature to emf conversion using polynomial coefficients will provide exact values. The "inverse polynomial" emf to temperature conversion will only provide approximate values, although the error is relatively small. The standard publications ASTM E230 and IEC 60584 and 62460 provide the approximate equations because most people will want to convert a thermocouple emf into an equivalent temperature rather than the other way around. This can be sufficient for lower accuracy applications, uncertainty calculations, or for finding a starting value to plug into the temperature to emf calculator with subsequent manual iterations to find the exact value.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf