Showing results for 
Search instead for 
Did you mean: 

scale in Measurement and Automation

I have 50 load cells. When loaded, they give Voltage values. But I want the results directly in load values( i.e., in kilo Newtons). I have 50 different conversion factors (one for each load cell) written in a text file. How do I use the "Scale" option in Measurement and Automation Explorer to convert voltages to loads so I get load values directly ? Below is the step-by-step description of my problem.
My problem:   I am getting 50 voltage values ( V1, V2, V3...........V50)
                       But I want them in terms of kilo Newtons (kN1, kN2, kN3......kN50)
                       I have 50 multipliers that can do this conversion (m1, m2, m3.....m50). They are in a text file.
                       All I need is kN1 = V1  * m1, kN2 = V2 * m2 and so on.
How do I this scaling operation ?
Thank you very much in advance for your kind help.
0 Kudos
Message 1 of 4
Hi tmalik,

Because there are 50 different scaling values for 50 different channels, a separate scale would need to be made for each channel that you are acquiring from if you used a custom MAX scale.  I think an easier solution would be do post-aquisition scaling of the values in the software itself.  I have attached a VI that shows how you would read in a text file of the format:

etc. proper conversions of the strings, and scale your voltage values that are contained in a 1D array.  Let us know if this works for you.

Andrew W
National Instruments

Message 2 of 4
Thanks very much for the reply.
Attached is my code. It measures votages (upper left side of the code) and it also reads the multiplying constants from a text file (lower left side of the code). Then using the 'for loop' at the center, it converts the voltages to loads and finally it writes the load values in a file (middle left of the code, path labled as SC1).
Is my code efficient ?
Someone told me such code will slow down the entire process because of the loop. He suggested that I use "DAQmx create scale" and "scale node" to write a more efficient code. I don't know how to do that.
Can someone help me on this, please?
0 Kudos
Message 3 of 4
Hi tmalik,

The way you are implementing it is the approach I would use.  You are only sampling at 100Hz, so at that rate you shouldn't run into any problems with the calculations taking too long that a buffer overflow is encountered.  However, I do want to comment on your use of the "Write to Spreadsheet".  I would not recommend using this in your loop because this VI will open the file, write to it, and close it all in the same iteration of the loop.  This file will get larger the longer your acquisition goes, and each iteration of the loop will take longer to open and close the file.  It would be better to use some of the lower-level file I/O functions that you can use to explicitly open the file before the loop, write to the file within the loop, and then close the file once loop iteration is done.  It will require more string manipulation but will be much more efficient.  The shipping example "Write to Text" would be a good one to look at for seeing the programming flow for this kind of application.

Andrew W
National Instruments
0 Kudos
Message 4 of 4