Because the program v2t has become very long with all the tables in it, I have put everything on the ftp server: ftp://panteltje.com/pub/v2t.c ftp://panteltje.com/pub/t2v.c
This is voltage to temperature -, and temperature to voltage conversion for type E, J, K, R, S, and T thermocouples.
There are many other ways to do it, but this gives the correct answers, and is not even slow. Hopefully it will be of use, and if you find an eror fix it, and let me know.
Programs compile with gcc > 4, have not tried the older gcc versions.
Type R gets used regularly higher than this, around 1300C is common (Heat treatment of high speed steels), even higher in steel melting. Type R is commoner than Type S.
"Degrees K" should be just "K", or "Kelvins".
"Rodium" should be spelled "Rhodium".
--
"For a successful technology, reality must take precedence
over public relations, for nature cannot be fooled."
(Richard Feynman)
On a sunny day (Wed, 22 Sep 2010 10:50:43 -0700) it happened Fred Abse wrote in :
Yes, this is the limit for v2t, but t2v (temp to voltage) goes to 1768 °C
I am working on a new version of v2t, that uses the t2v polynomials, and successive approximation to do the reverse. That allows arbitrary precision (I tried 32 iterations, and that works, but I had other things to do so did not do much coding, and only tried that for type T). Using successive approximation is something I really like for problem solving. Of course other will perhaps have better ways to to the reverse? But this gets rid of the tables. I think it is also more accurate than interpolation.
Yes, so the range will be extended if I get that stuff working correctly,
Yes, I was wondering about that, will change that.
All programs have been superceeded by this one: ftp://panteltje.com/pub/th.c
I think this is a nice piece of work (boast boast). voltage to temperature and temperature to voltage, for type E, J, K, R, S, or T thermocouples. And temperature to voltage for these too, for Celsius, Kelvin, and Fahrenheit. I use the NIST polynomials for temperature to voltage conversion, and use successive approximation for voltage to temperature conversion. The number of iterations is set in the source to 32. It is a define, if you need more accuracy just change the #define 32. There is a limit to the size of type double though :-)
I have used the standard getopt() Unix command line parameter processing, so this can easily be used from a script too.
On a sunny day (Fri, 24 Sep 2010 10:43:55 -0700) it happened Fred Abse wrote in :
Thank you, fixed that for version 4, version 3 (now on the site) also has the correct Kelvin to Celsius conversion, I accidently wrote '+= 270.15' while it should have been '-= 273.15', line 841. Dunno why, sort of a brain switched of moment after doing the difficult part, in an other place I did it right. That is why all that stuff needs testing. I tried many values so far all seems OK.
On a sunny day (4 Oct 2010 09:17:59 GMT) it happened Jasen Betts wrote in :
32 rounds.
This is true, and you made me read up on it. However in Newton's method you need to calculate the derivative each step, so say for a type K thermocuple the derivative of 'sum(i=0 to n) c_i t^i + a0 exp(a1 (t - a2)^2)'.
formatting link
's_method see 'Practical considerations'.
The Secant method would avoid this:
formatting link
See 'Convergence'.
Both methods do not always converge.
As I am not a mathemagician, I fall back on my old true successive approximation method, it always converges. The code is much simpler, and the number of iterations is the number of bits accuracy in the result.
interpolation.
I will have to use a hex editor to decode that? C2 A1 73 70 75 C9 90 C9 A5 20 6F 75 20 27 C9 90 EA 9F BD 20 CA 9E 6F 6F EA 9E 80 ?
so we have v = sum(i=0 to n)[ c_i t^i ] + a0 exp(a1 (t - a2)^2) and given v are trying to find t ?
that doesn't look particularly hard to differentiqate
dv/dt = sum(i=1 to n)[ i c_i t^(i-1) ] + a0 exp(a1 (t - a2)^2) a1 ( 2 t - 2 a2 )
if I applied the chain rule correctly
This is true, but only for really warty functions, the nice sweeping curves of the thermocouple models should not be a problem. If you start with a good guess (eg: a linear approximation) they will converge quickly
Detecting non-convergeance is as simple as counting rounds.
EA 9E 80
No, you just need better unicode support.
It's some text in the spirit of "umop apisdn" but exploting some of the turned glyphs available in unicode.
On a sunny day (5 Oct 2010 10:16:11 GMT) it happened Jasen Betts wrote in :
32 rounds.
)
mm
This is true, and my method of successive approximation will also find only one minimum for a curve with many, so I was cheating a bit. But indeed for the thermocouple function it will always converge. OTOH the polynomial routines are already there, I just call the same routines.
Oh yes, and for a more 'bad' function I could do that too, and start at a different point each time, use the same iteration method. Even Newton's is known as the 'nearest'.
EA 9E 80
I have thought about adding Unicode support to my newsreader some times. I will probably have to wait until xforms support it, maybe it already does. They asked my to test some new versions, but I have so much stuff using the older versions that it caused too many problems. Does not seem to work in joe editor either... it is started from xforms. The world changes so fast :-) trying to keep the latest version of the web browser or flash, or whatever, going on an old system is really taking too much time. I think you suggested a chroot environment, maybe I will have to try that. We need to freeze standards for a while, will not happen I am sure. Maybe when I buy a new PC for this, this one is now 10 years old.. still a great server, will I upgrade to the latest kernel and libs. Well I have that on an other disk, but why break this system, it has everything, TV, satellite, video, servers, Usenet, home control, what not.
Actually why should we have hat Unicode, to support all those retarded (political statement) languages, hell why not just use gif images for the Chinese things LOL. Maybe Internet will die because of politics, just like NASA [manned space missions] did. OK, let's see: escape character, image code length, picture type.. there you have it.
After going a couple of times back and forward it seems to change :-)
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.