11-25-2015 04:19 AM
Hello ,
I am using LabVIEW 2013 version. In my program, I have used DAQmx Create Scale (Linear). vi before the DAQmx Create Channel.vi
I have a 4 to 20mA current signal to be converted to pressure. That is I want whatever current value is coming put of DAQmx Read to be subtracted by 4mA and then multiplied by 0.375.
If we see equation y-=mx+c, then my x value will be data coming out of DAQ Read, m will be 0.375 and y intercept will be -0.0015
If I feed these values into Create Scale , I am not getting correct data. That is I gave slope as 0.375 and y intercept as -0.0015 to Create Scale.vi
Is this not the correct way.
If I try the regular way of reading DAQmx output , then subtracting 4mA and then multiplying 0.375, I get correct pressure value.
So should I stick to the regular way or what I have to do in Create Scale to handle this calculation. Let me know. Thanks
Solved! Go to Solution.
11-25-2015 04:29 AM - edited 11-25-2015 04:38 AM
Apologies - replied to the wrong thread.
11-25-2015 05:34 AM
(Since I accidentally posted, I suppose I had better assist!)
The value is wrong because of the order of operations. You have an equation that is y = (x - c)*m, you need to convert the parameters so that it is in the form y = mx + c. If you expand out the brackets, your equation is y = mx - cm - so you need to multiply the y-intercept by your slope to get the right value.
If you want to use the maths palette to do the conversion that's fine - it's sometimes easier to understand than DAQmx scales but DAQmx scales give you some extra functionality - e.g. the ability to set the units (e.g. when it's displayed in a graph or when logging the data).
11-25-2015 05:39 AM
You need to find the correct m and c values for the function to work.
Else calculate the max pressure and use a table to create the scale.
The table will have to points, 4mA = 0bar and 20mA = max pressure.
11-25-2015 06:25 AM
What is your max pressure? I somehow doubt it is (0.02-0.004)*0.375=0.006.
11-25-2015 06:30 AM
11-25-2015 06:33 AM
@Hemagopal wrote:
I have 6 bars as Max pressure for 4 to 20 mA. Create scale can be used ?
So you are off by a factor of 1000. Your scale should be y=375x-1.5
11-25-2015 10:09 PM
Thanks..If I put slope (m) as 375 and y intercept as -1.5,, I get the correct pressure in bars.
One info, If I have another signal which requires a slope of 0.67 and y intercept zero, I was not getting correct scaled value.
If I simply multiply the DQA read output by 0.67, I get correct value. Instead of multiplying, If I use slope of 0.67, I was getting incorrect data.
Does slope (m) works only for values greater than 1 ?