04-18-2023 07:02 AM
Hey everybody!
I'm currently trying to make a SubVI that can convert voltage from a VFS 2-40 QT vortex flow sensor to a temp and flow. I have it connected to NI myDAQ, to acquire the voltage through both AI0 (Temp) and AI1 (Flow). I will be using DAQ assist, in the block diagram to read the inputs.
So my question is, how would I go about making such a program? I'm kinda stuck on how to start, as I have never tried it before or gotten any lectures on this specifically.
I have attached a picture of both graphs, that show what the temperature or flow is at a specific voltage.
I have also attached the data sheet for the flow sensor.
Solved! Go to Solution.
04-18-2023 07:19 AM
Don't use express VIs. They obscure a lot of details and force you to use dynamic data wires, which are discouraged to use. Instead you just needs a few DAQmx functions:
Now you just need to make 2 subVIs, one for each data reading. The conversion is simple, just solve the linear function from the graph in the form y = ax+b. Be sure to swap the axes, since voltage is on the y-axis in your example.
Then make your subVI like this:
Repeat for flow rate.
04-18-2023 07:27 AM
Hi,
the charts are linear for Flow vs Voltage and Temp vs Voltage so you simply have two y = mx + c type relationships . . .
Flow: 3v for 11L so m = 3.666 with a c of -0.8333
Flow = Voltage * 3.666 -0.8333
Temp: 3V for 100C so m = 33.333 with a c of -16.6666
Temp = Voltage * 33.3333 -16.6666
Double check these for yourself against the charts in the PDF
04-18-2023 07:34 AM
A custom scale would be a nice option to add in here . . .
04-18-2023 07:34 AM
Wow seems easy, why didn't I think of that in the first place hahaha? Thank you so much for the help, I will try to make the program, and then report back when it's working.
04-18-2023 07:49 AM - edited 04-18-2023 07:57 AM
Ooh I guess I have just one more question, how do you get flow: 3v for 11L to be m = 3.666 with a c of -0.8333 and the same for temp?
04-18-2023 07:57 AM
Hi Tomas,
@TomasMathe wrote:
how do you get flow: 3v for 11L to be m = 3.666 with a cof -0.8333 and the same for temp?
From your datasheet.
There are graphs showing the relation between signal (temp/flow) and output voltage…
04-18-2023 08:11 AM
My question is more on how can m=3.666 and c=-0.8333. How do 3v and 11L result in m being 3.666 and c in being -0.8333. I dont see those numbers for c and m on the graph, or am I’m missing something.
Thanks for the replies so far, really appreciate them.
04-18-2023 08:33 AM
The values SimonGn are wrong. Not sure where he got 11L/min at 3V (at 3V, flow rate is ~34 L/min).
In the formula y = mx + c, m is the slope, c the offset on the y-axis (i.e. the value at x=0). The slope is (3.5-0.4) / (40 - 0) ~= 0.077. and offset is ~0.4.
Since y = voltage and x = flow, you get voltage = 0.077*flow + 0.4. Solve for flow. Flow = voltage/0.077 - (0.4/0.077). i.e. m = 1/0.077 = 12.9 and c = -0.4/0.077 = -5.2.
Now do the same for temperature.
04-18-2023 08:46 AM
Hi,
sorry, I was looking at the charts for the VFS 1-12 QT, the principle holds though . . . 😉