07-06-2009 07:22 PM
How can I set up a PID vi on the CompactRio FPGA so that I can control a process temperature? I would like to convert the temperature from the voltage readings taken by 9211 and 9213 modules, and feed that temperature as the process value into the FPGA PID vi. The CompactRio should then only need to update the target value periodically, possibly only on changes. Is there a vi anywhere that runs on the FPGA and converts the thermocouple voltages to temperatures?
Figaro
07-23-2009 01:35 PM
Figaro,
The issue involved in calculating thermocouple temperature on the FPGA involves the conversion of the CJC voltage to its temperature value. This calculation requires a nonlinear equation which makes use of a natural log, which is not currently allowed on the FPGA.
A workaround to this would be to use a lookup table containing discrete solutions for specific values, but the problem with this is it starts to take a large amount of space to store a large number of solutions for the entire possible CJC range. If you expect your CJC to vary within a subset of the entire range though then you can truncate the lookup table around this expected range and save most of this space. Since the lookup table only provides discrete values this may also effect accuracy of the conversion. Linear interpolation may improve this and also depends on the resolution of the table itself.
Beyond this, the RT VIs that do the conversion to temperature use floating point variables. FPGA only supports fixed point, so this conversion would also have to be made.
This is something I have been thinking about creating on the side, but haven't managed to get around to. I'd also be interested in the effect on accuracy of the conversion vs. the floating point VIs if this code was created.
-James
09-24-2009 04:46 AM
Hi,
This is also something I have been thinking about trying. Have either of you got anywhere with the approach?
Steve.