Logarithm
08 Nov 2018 19:23 #120284
by yeepah
Hy
I feel dumb
I try to install this code as compoment file .comp:
float thermistor2temperature(float R) {
float T;
if (R<=0)
R=0.001; // avoid log(0)
T = 1.0/ ( 1.0/T0 + (1.0/ * log(R/R0) );
return T;
I do include #include <rtapi_math.h>
During compilation i get error : implicit declaration of function 'log'
What am I doing wrong???
thanks
I feel dumb
I try to install this code as compoment file .comp:
float thermistor2temperature(float R) {
float T;
if (R<=0)
R=0.001; // avoid log(0)
T = 1.0/ ( 1.0/T0 + (1.0/ * log(R/R0) );
return T;
I do include #include <rtapi_math.h>
During compilation i get error : implicit declaration of function 'log'
What am I doing wrong???
thanks
Please Log in or Create an account to join the conversation.
09 Nov 2018 12:07 #120325
by yeepah
I thought that also. And I try it again.
I even try with with a log alone like
double R = log(133)
but it return alway the same error
I'm a bit lost
Do you have an idea were can i find a log code function. I could write it but my mathematique skill are a bit poor.
I even try with with a log alone like
double R = log(133)
but it return alway the same error
I'm a bit lost
Do you have an idea were can i find a log code function. I could write it but my mathematique skill are a bit poor.
Please Log in or Create an account to join the conversation.
09 Nov 2018 13:17 #120328
by rodw
Hmm, log() is not included in rtapi_math.h github.com/LinuxCNC/linuxcnc/blob/master/src/rtapi/rtapi_math.h
I would search for the C code in the GCC compiler for the log function and add it to my component.
Or try and add it to the header file....
I would search for the C code in the GCC compiler for the log function and add it to my component.
Or try and add it to the header file....
Please Log in or Create an account to join the conversation.
09 Nov 2018 13:22 #120329
by andypugh
github.com/LinuxCNC/linuxcnc/blob/master/src/rtapi/rtapi_math.h
I don't see a log function in rtapi_math.
There is a simple (recursive) log2() function here:
www.geeksforgeeks.org/program-to-compute-log-n/
And log10(N) = log2(N)/log2(10)
I just noticed that the log2 above is calculated as an integer, so might not give the accuracy you need.
Why do you need a logarithm in HAL? Maybe there is another way?
I don't see a log function in rtapi_math.
There is a simple (recursive) log2() function here:
www.geeksforgeeks.org/program-to-compute-log-n/
And log10(N) = log2(N)/log2(10)
I just noticed that the log2 above is calculated as an integer, so might not give the accuracy you need.
Why do you need a logarithm in HAL? Maybe there is another way?
Please Log in or Create an account to join the conversation.
09 Nov 2018 14:00 #120330
by yeepah
thanks for your answers
I will work on that
I using linuxcnc to drive a reprap. I'm following and adapting the work of this guy.
www.anderswallin.net/2012/12/temperature-pid-control-part-deux/
Using hal encoder with NTC resistor and ne555 chip to control PID and pwmgen.
Thermistor change a frequency read by linuxcnc.....regulate extruder and hotbed temperature
To calcul the temperature with the frequency I need a log
I will work on the direction you give. And come back with the result
thanks
I will work on that
I using linuxcnc to drive a reprap. I'm following and adapting the work of this guy.
www.anderswallin.net/2012/12/temperature-pid-control-part-deux/
Using hal encoder with NTC resistor and ne555 chip to control PID and pwmgen.
Thermistor change a frequency read by linuxcnc.....regulate extruder and hotbed temperature
To calcul the temperature with the frequency I need a log
I will work on the direction you give. And come back with the result
thanks
Please Log in or Create an account to join the conversation.
09 Nov 2018 14:09 #120331
by andypugh
LinuxCNC 2.8 (development version) includes this:
linuxcnc.org/docs/devel/html/man/man1/thermistor.1.html
And also this:
linuxcnc.org/docs/devel/html/man/man9/max31855.9.html
But for 2.7 it might be simplest to use this:
linuxcnc.org/docs/devel/html/man/man9/lincurve.9.html
linuxcnc.org/docs/devel/html/man/man1/thermistor.1.html
And also this:
linuxcnc.org/docs/devel/html/man/man9/max31855.9.html
But for 2.7 it might be simplest to use this:
linuxcnc.org/docs/devel/html/man/man9/lincurve.9.html
Please Log in or Create an account to join the conversation.
Time to create page: 0.096 seconds