2

I'm an automotive hobbyist and an intermediate coder. I seem to lack a fundamental understanding of the arithmetic when working with the exponent formula in excel or the math.exp() method in c++.

I have a vendor datasheet which describes a formula to resolve the resistance of a thermistor for any given temperature.

Trying to solve for x, the datasheet gives this: x = exp{A + B/T + C/T2 + D/T3} where T is the temperature in Kelvin. note the brackets as opposed to parenthesis.

The datasheet provides values for A, B, & C at various Kelvin ranges

For instance, at 283.15K (50 F), per the datasheet chart; A is -16.2931 B is 6061.2476 C is -460567.9092 D is 30338541.7656

It doesn't look like a simple matter of (A + B/T + C/T2 + D/T3). Excel's EXP() formula rejects this as too big of a number, running it to a consol.output(result) in C++ calls it infinity. (The brackets {} must mean something other than what parenthesis mean, right?), but what?

How should x be resolved? Thanks

edit: snapshot of datasheet enter image description here

Steve H
  • 195
  • 5
    What are T2,T3,T4? are they $T^2,T^3,T^4$? – user619894 Jul 15 '22 at 21:36
  • Without the original formula we can't tell if that you have for $x$ is even correct. I doubt the ${ \cdot }$ means fractional part, but it's a guess. – Sean Roberson Jul 15 '22 at 21:36
  • We normally ask people to type in equations here (it generally makes the web site better), but this might be one case where a photo of the data sheet would help. – JonathanZ Jul 15 '22 at 21:45
  • 2
    It looks like the original equation came from the Steinhart-Hart formula for 4 variables: $$\frac{1}{T} = A+B(\ln(R))+C(\ln(R))^2+D(\ln(R))^3$$ This was then incorrectly solved for $R$ (which is $x$ in your case). To actually solve it for $R$, you'll need to use the Cubic formula for $\ln(R)$.

    Alternatively, use the 3-variable formula recommended on Wikipedia. It also shows a solution for $R$ there.

    – Daniel P Jul 15 '22 at 21:49
  • @DanielP - That's a heck of a screw-up for a data sheet. Presumably lots of people have used numbers from it before. I agree that that's the thermistor-related equation that most resembles what the OP wrote, which is why I'd love to see the original. – JonathanZ Jul 15 '22 at 21:55
  • @JonathanZsupportsMonicaC You're right, that would be a huge messup. But I couldn't find any other equation to calculate / estimate the resistance of a thermistor that resembles the original one this much. – Daniel P Jul 15 '22 at 21:57

2 Answers2

3

When I perform the numerical calculation with the proposed coefficients, the result is $2.024$ which is not at all out of range, so the formula may well be the correct one.

My guess would rather be a typo in your written code ?

Example C++ code

zwim
  • 28,563
  • This might be it. I did not associate T2 with T squared and T3 with T cubed. I was simply multiplying them (T * 2, etc.) I'll work it out and if it matches the few temps on the datasheet they give, Ill mark this as the answer. – Steve H Jul 16 '22 at 00:36
  • This works. thanks – Steve H Jul 16 '22 at 00:54
1

If the vendor gives for a given range of $T$ the formula $$x=\exp\Bigg[A+\frac{B}{T}+\frac{C}{T^2}+\frac{D}{T^3}\Bigg]\qquad \text{for} \quad T_1\leq T \leq T_2$$ I stronly suppose that for a given $T$, there is only one $x$.

So, each formula can be analytically inversed for the given range and this has to be done only once. So, at each equation corresponds an analytical inverse in the form $$T=f(x)\qquad \text{for} \quad x_1\leq x \leq x_2$$

Using the second curve as @zwim did, there are three roots but only one is acceptable. Using the trigonometric method with whole numbers and defining $$p=\frac{29257638226710183955}{1917556492631365761132}$$ $$q=-\frac{1250 }{37923177207}\log (x)-\frac{33865607624057288640109707563}{4363190080469560409150476 13509944}$$ we have $$ T=\frac 1{2 \sqrt{\frac{p}{3}} \cos \left(\frac{1}{3} \cos ^{-1}\left(-\frac{3 \sqrt{3} q}{2 p\sqrt p}\right)\right)+\frac{383806591}{75846354414}}$$ for $0.35072 \leq x \leq 3.36287$