07-26-2009 12:06 PM
altenbach wrote:For the reverse you could use the explicit formula as e.g. given here or simply do some a quick newton-raphson on the forward eqaution.
Yes, I posted that link already at 06:26!
So I can be faster than Altenbach ![]()
Back on topic.......
Can we be realistic on some figures please.
I don't know your process but I think that reading a temperature every 300us is irrealistic.
Also tree digits after decimal point? Are you sure about the significance of the last digit. Is it real temperature or is it noise?
And further, you may have 16 bits resolution but how many bits represents the noise.
So to get ride of the noise you have to average the data from the µcontroller.
How many samples will you average?
Let say 100, that will result in a calculation every 30ms. No problem with the code provided by Altenbach!
Just some thoughts 🙂
Forget the look up table 🙂
07-26-2009 12:15 PM
Alain S wrote:Yes, I posted that link already at 06:26!
So I can be faster than Altenbach
If you look in detail, I posted the link to the reverse equation, so it's not quite the same. 😉
Anyway, my second formula takes about 100nanoseconds (the first formula with the poly eval is about 10x slower), so you are well within specs. 🙂
07-26-2009 12:23 PM - edited 07-26-2009 12:27 PM
07-26-2009 02:18 PM
Hi, altenbach,
Thank you for your help. It's really useful. But how did you test the speed of the program by the way, you said the calculation takes 100ns, how did you see that? Sorry, I'm really new to labview.
07-26-2009 02:38 PM
Hi, Alain,
Actually I have a multi-channel temperature measurement system, and they are measured one by one. Each of the measurement takes around 300us,so as a result, the meaurement interval is about 2ms. I think it is possible.
I think the last digit is still temperature, since I have low pass filters in front of the ADC, and the simulation result shows that the noise level is below this value by about 5-10times.
What is more, apart from measuring the temperature, the system will also apply control based on the measured temperature. And the control scheme is a simple ON/OFF control. That is, when the temperature is higher than the set-point, switch on the heater. WHen the temperature is lower, swich off the heater. Therefore, in order to make sure the temperature ripples caused by the ON/OFF control is small enough, I hope the time between two measurements as short as possible, that's why I only assigned 300us to each of the channel. Do you think it is realistic?
If you have any comments or suggetions, please let me know. THank you .
07-26-2009 02:48 PM - edited 07-26-2009 02:49 PM
Reliable benchmarking can be difficult, but here's the typical approach:
The details are tricky. You need to use an array of inputs, you cannot simply use a scalar resistance and wire the number of iterations to N and expect the same results. Because of constant folding by the compiler, the contents of the loop would be calculated only once, making it look much faster than it really is (~8ns in this case). Make sure the iteration count it high enough so the time is at least 100-1000ms, else you get unreliable results. You might also want to disable debugging.
Note, as I said, you can delete the FOR loop here and the result will be the same. The FOR loop seems very slightly faster, but it's not worth bothering.

07-27-2009 11:31 AM
tingxuejh wrote:Hi, Alain,
Actually I have a multi-channel temperature measurement system, and they are measured one by one. Each of the measurement takes around 300us,so as a result, the meaurement interval is about 2ms. I think it is possible.
You mean you measure each channel every 2ms? What temperature change do you expect in those 2ms?
I mean, temperature changes are generally slow processes, so unless you have a very specific process to control, I think measuring every 2ms is overkill.
tingxuejh wrote:
And the control scheme is a simple ON/OFF control. That is, when the temperature is higher than the set-point, switch on the heater. WHen the temperature is lower, swich off the heater. Therefore, in order to make sure the temperature ripples caused by the ON/OFF control is small enough, I hope the time between two measurements as short as possible, that's why I only assigned 300us to each of the channel. Do you think it is realistic?
Be sure to foresee a hysteresis or your heater (resistors with relay or SSR?) will switch On/Off every 2ms when your process is at setpoint.
This is also a reason to measure at slower rate 🙂