07-26-2009 10:19 AM
Hi, all,
I am doing a temperature measurement at this moment, and I use Labview to receive the meaured data from a microcontroller. However, the measured data is voltage, so I want to convert them into temperature. To do this, I have two ways, the first one is to insert a formula node, while the other one is to build a lookup table. But I don't know which one is better in terms of speed.
If making a lookup table, I would have around 70000 data, which makes this table very big. I don't know whether it is okay? If inserting a formula, the relationship between the voltage and temperature is very non-linear, I'm afraid it will also take a long time to calculate. So which one is better? Please give me some hints or instructions. Thank you in advance.
By the way, to make a look up table, I was trying to use scaling and mapping.vi. I wanted to define an interpolated table to do the job, however I don't know how to insert my lookup table into this sub-vi. Could anyone tell me?
Solved! Go to Solution.
07-26-2009 11:02 AM
You definitely don't want to use a formula node, just use plain G. In the case of a lookup table, you would just use "index array" after linearly scaling the index. Create the lookup table once with a FOR loop based on all diagram constants, and it will be folded at compile time into a constant.
What is the formula? I seriously doubt you need 70000 points. How many decimal digits do you need for the temperature?
07-26-2009 11:13 AM
Thank you for your reply. The formula is the typical Steinhart-Hart equation. Because the dynamic range of my measurement is 16-bit, so in the complete temperature range, there will be 65536 data points. The minimum temperautre should be in mK range, so at least 5 decimal digits are needed.
By the way, I tried to use the sub-vi: scaling and mapping.vi to work as a look up table. Because this sub-vi has a interpolated table, which can be used as the look up table. Is it okay?
07-26-2009 11:23 AM
OK, this is a simple equation that can be calculated near instantly. Do you really have performance problems? How many times per second do you need to recalculate it?
Can you give some typical data?
07-26-2009 11:26 AM
tingxuejh wrote:The minimum temperautre should be in mK range, so at least 5 decimal digits are needed.
mKelvin with 5 decimals
Are you looking for the absolute zero temperature, -273.15 Kelvin, or did you mean something else?
If this is your formula, I would go for plain G like altenbach suggested.
07-26-2009 11:40 AM
Hi, altenback,
My microcontroller will send one data per 300us. Of course the calculation process can be much slower, however, we may need a very large I/O buffer to store the unprocessed data. Therefore, I hope this process can be as fast as possible, in order to relax the requirment of the buffer size. Do you think it is right?
Also, I need to set a target temperature in labview, and this temperature has to be translated into digital code and sent to the microcontroller. In this case, the formular can be very complicated (we have to calculate from T to V. But fortunately, this is one time only). I guess lookup table is still a better solution. What is your opinion?
07-26-2009 11:43 AM
Hi, Alain,
What I mean by the 5 decimals is, for example T=23.115oC, I'm sorry for the confusing.
07-26-2009 11:44 AM - edited 07-26-2009 11:45 AM
You can use the polynominal evaluation, e g. as follows:
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.
07-26-2009 11:51 AM
07-26-2009 11:58 AM - edited 07-26-2009 11:59 AM
tingxuejh wrote:
But which one do you think is better? The formula? or the lookup table?
It does not matter what I think. Code a few alternatives and do a benchmark. 😄
The formula is so simple that I think a lookup table would not be of great benefit. Instead of the polynomial evaluation, I would code it explicitly, e.g. as follows.