Greg LaPolla
04-02-2009, 05:38 AM
I found this code in another thread for Steinhart Hart
PRI Calc_StHart (A,B,C,Resistance) : Kelvin | B_x_Rlog , C_x_Rlog , Rcubed, Rlog, Addit
G.start ' Start math32
Rlog := G.log(Resistance) ' Take the log of the Resistance
B_x_Rlog := G.FMul(B,Rlog) ' Multiply B to log of R
RCubed := G.FMul(Rlog,Rlog) ' Cube the log of R by R * R * R
RCubed := G.FMul(Rlog,RCubed) ' Finish the Cube
C_x_Rlog := G.FMul(RCubed,C) ' Multiply C to log the cubed log R
Addit := G.Fadd(C_x_Rlog,B_x_Rlog)
Addit := G.Fadd(Addit, A) ' Add all A,B,C together
Kelvin := G.Fdiv(one,addit) ' Kelvin = 1/ all added
G.stop
It always returns a negative number.
I put the above problem in mathcad(see attachment) and it calculates properly. Using the same numbers in the prop yields an answer of
-9.549217
Edit - Forgot to attach picture
Post Edited (Greg LaPolla) : 4/2/2009 2:54:06 AM GMT
PRI Calc_StHart (A,B,C,Resistance) : Kelvin | B_x_Rlog , C_x_Rlog , Rcubed, Rlog, Addit
G.start ' Start math32
Rlog := G.log(Resistance) ' Take the log of the Resistance
B_x_Rlog := G.FMul(B,Rlog) ' Multiply B to log of R
RCubed := G.FMul(Rlog,Rlog) ' Cube the log of R by R * R * R
RCubed := G.FMul(Rlog,RCubed) ' Finish the Cube
C_x_Rlog := G.FMul(RCubed,C) ' Multiply C to log the cubed log R
Addit := G.Fadd(C_x_Rlog,B_x_Rlog)
Addit := G.Fadd(Addit, A) ' Add all A,B,C together
Kelvin := G.Fdiv(one,addit) ' Kelvin = 1/ all added
G.stop
It always returns a negative number.
I put the above problem in mathcad(see attachment) and it calculates properly. Using the same numbers in the prop yields an answer of
-9.549217
Edit - Forgot to attach picture
Post Edited (Greg LaPolla) : 4/2/2009 2:54:06 AM GMT