LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use custom scaling

Solved!
Go to solution

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

0 Kudos
Message 1 of 8
(4,471 Views)

Apologies - replied to the wrong thread.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 8
(4,464 Views)

(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).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 3 of 8
(4,444 Views)

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.

0 Kudos
Message 4 of 8
(4,437 Views)

What is your max pressure?  I somehow doubt it is (0.02-0.004)*0.375=0.006.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 8
(4,426 Views)
Yes ..exactly this is my equation..I have 6 bars as Max pressure for 4 to 20 mA. Create scale can be used ?
0 Kudos
Message 6 of 8
(4,419 Views)
Solution
Accepted by Hemagopal

@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


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 8
(4,413 Views)

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 ?

 

0 Kudos
Message 8 of 8
(4,383 Views)