Accsense VersaLog Data Loggers User’s Manual Page 29
double rtst;
double tindex;
int loop = 0;
tindex = (TMAX - TMIN) / 4;
t = (TMAX + TMIN) / 2;
rtst = T2R(t);
while (0.999999999 * r > rtst || rtst > 1.000000001 * r)
{
if (rtst < r) t += tindex;
if (rtst > r) t -= tindex;
tindex /= 2;
rtst = T2R(t);//call helping function for resistance in OHM
//make sure no infinite loop if the value is out of the range
if (loop++ > 40)
break;
}
return t; //always return value in degree C
}
//helping function
double T2R(double t)
{
double r;
// if t < 0
if (t < 0)
r = R0 * (1 + A * t + B * Math.Pow(t, 2) + C * (t - 100) * Math.Pow(t, 3));
// if t >= 0
else
r = R0 * (1 + A * t + B * Math.Pow(t, 2));
return r;
}
4
4
B
B
a
a
s
s
i
i
c
c
F
F
u
u
n
n
c
c
t
t
i
i
o
o
n
n
s
s
Built-In Equations
Equation and Channel Type are two essential parameters to make sure the physical
measurement can be converted correctly.
An equation is a software functionality identified by its name of up to 16 characters. A built-in
equation is an equation provided by VersaLog SiteView software to convert a measurement for
a specific channel type.
A channel must have an equation assigned to it in order to make the measurement conversion.
“Digit” built-in equation can be assigned to any channel type. If you assign “Digit” equation to
a channel the physical measurement will be the original digital value measured by ADC
(Analog-to-digital converter) hardware.