#include "nist_poly.h" #include #include /* Array with NIST coefficients */ /* See: https://srdata.nist.gov/its90/main/ */ double NIST_J_d[] = { 0.000000E+00, 1.978425E+01, -2.001204E-01, 1.036969E-02, -2.549687E-04, 3.585153E-06, -5.344285E-08, 5.099890E-10, 0.000000E+00 }; /* Order of NIST polynomial */ const int count=9; /* * Computes temperature by a polynomial */ double NIST_J_inv_poly(double voltage) { double Theta=0; size_t i; for (i = 0; i < count; i++) { Theta += NIST_J_d[i]*pow(voltage,i); } return Theta; } /* * Computes temperature by a product factorization. */ double NIST_J_inv_fact(double voltage) { double Theta=0; double temp = 0; int i; for (i = 8; i >= 0; i--) { temp = NIST_J_d[i] +voltage*temp; } Theta = temp; return Theta; }