LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert U16 to scaled data

Hello,
I'm using DAQmx Read  (Analog 2D U16 NChan NSamp) to read from USB 6009. However, i need to scale the voltage values and calculate the RMS values on each interation.
I must write it in I16. I've tried a lot of things but none worked!
Thanks
0 Kudos
Message 1 of 15
(5,159 Views)
You have a few problems, mostly stemming from not understanding some diagram structures:
  • You are passing the 2D array of integers into a for-loop that is wired to loop once. That's not much of a loop, now, is it?
  • Within the loop you're peeling off column zero (since the loop is only running once), and then multiplying the values by some constant. Not sure what that constant is, since its value is in case 0 of the case structure, which you don't show.
  • You're then creating a 2D array of this (not sure why), which you're feeding into a subVI that seems to have been written by you. Without seeing what this VI is doing, it's impossible to say if it's doing it right.
Given that, the question I have is: how many channels are you scanning? If I remember correctly, the DAQMX VI that you're usint spits out a 2D array of integers, with each column being a different channel. Are you scanning just one channel, and so only need one column? If so, you don't need a for-loop to get your samples. Just use an Index array to pull off the channel you need. If you're scanning multiple channels, you don't need a for loop at all. Just feed the 2D array into a multiply function. It's polymorphic:


Message Edited by smercurio_fc on 05-04-2007 09:05 AM

0 Kudos
Message 2 of 15
(5,130 Views)
I hope I did understand your problem: In LabView you find under the functions in "Programming\Numeric\Conversion" vis to convert a U16 to an I16 format.
 
I hope I could help you.
 
Andreas
0 Kudos
Message 3 of 15
(5,126 Views)

Sorry about the for-loop that is wired to loop once, I was just testing some ideas. It should be 8, because I’m trying to calibrate the 8 channels by multiplying them for those constants.

At the same program I have to write the values to a .bin file and show the RMS values as it writes but I can't make it work reading as U16.

Thank you very much for your help!

Download All
0 Kudos
Message 4 of 15
(5,123 Views)
You can still simplify your VI by using the for-loop correctly. Basically, you want to scale each channel, and get the RMS value for each channel. Well, use an auto-indexed for-loop to do that, as shown in this picture (Note: there is a built-in RMS function - you don't have to write your own):



It's not clear why you want to write integer values to file. Since you're scaling the data, you're going to get a floating point value unless your scaling factor is an integer. Is it? If not, you should be writing the floating point numbers. Otherwise, you're saving truncated data.

It's also not clear what your problem is. What, exactly, doesn't work? Is it that you're not getting the data saved, or you're only getting the data from the last iteration? Your loop writes data during each iteration, but I'm not sure about the function you're using to write the data. What version of LabVIEW are you using? Is that function set up to append data to the file, or does it overwrite each time?

Message Edited by smercurio_fc on 05-04-2007 09:59 AM

Message 5 of 15
(5,103 Views)
What are you using to scale your integer? Simply wiring the U16 into a To Single Precision Float does not work. You have to know the range of the A/D and the number of bits and calculte the bit value. Your USB-6009 is a 14 bit device so the bit value is the range divided by 16384.
Message 6 of 15
(5,097 Views)

Thanks agraf, but it's not that simple.
I need to show the real rms voltage, the one I’m capturing like a multimeter!
And the scaling factor is different for each channel!

By the way, where did you find this rms vi?
Thanks again.



0 Kudos
Message 7 of 15
(5,095 Views)

You can find the RMS vi under "Mathematics\Prob&Stats"

Andreas

0 Kudos
Message 8 of 15
(5,089 Views)

I'm using LabView 7.1.
I have to write it in I16 in order to get a small size .BIN file because it's going to write for a long time.
My main problem is that I'm reading as U16 and the rms showed values are like 3456, so I scale it to show the real value (1.5V for example). However, when I vary the voltage values it  doesn’t  move because I’m  multiplying it  by  very  small numbers (0.0004 for example).

Thanks again.



0 Kudos
Message 9 of 15
(5,085 Views)

I did what you said. The values of Vr2 and Vs2 on 300V are 48882, so I scaled Vr2.
I keep varying the voltage (from 0 to 500V) and Vr2 is still showing 303.
I've tried different ways to do it, but no success.
I appreciate the help.

0 Kudos
Message 10 of 15
(5,060 Views)