LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plotting data after conversion

Hi,

 

I'm a pretty new user (first day with labview and this new data logging equipment).

I have data coming in the form of voltage for several sensors, as well as data coming in the form of thermocouple readings.

I won't talk about temperatures as no conversion is needed since the DAQ assistant outputs temperatures directly.

However, out of the voltage input device, I am reading 3 inputs:

 

swiftmoun_1-1702338213347.png

for now, I am running everything nice and slow.

I am trying to do relatively basic conversion for the pressure transducers, probably overkill I am using a formula node. I was doing it with operators directly on the signal when I first had one test signal. However, now that I have 3 signals, I am using the index array with 0, 1 and 2 for the 3 channels to get the voltage and convert it.

Note that for the third signals (encoder with voltage output) the conversion is pretty significant as I converting this directly into a calculated volume. Anyway that part is correct as the numerical output checks out.

 

swiftmoun_0-1702337940352.png

The issue I am facing is getting this converted data back into a form that the waveform will digest. I don't really care for plotting the volume data but ideally I would want to get both pressure plots on the same wareform. All my attempts at merging the data put them in the same "column" instead of 2 separate columns.

0 Kudos
Message 1 of 5
(662 Views)

Ah, you've been learning LabVIEW from an NI Sales Rep who goes around saying "LabVIEW is so easy, look, we have these Express VIs that do data acquisition for you" (I've actually heard this pitch, but are there any NI Sales Reps going around to Universities anymore?).

 

You should learn the basics of LabVIEW.  With a decent mentor (or a Good Book, there are several, including "LabVIEW for Everyone" and "LabVIEW Graphical Programming", or best, references + a mentor/professor/experienced colleague), you can do away with the Dreaded DAQ Assistant (DDA) and its evil twin, the Dynamic Data Wire, and use a few functions in DAQmx to handle your Data Acquisition application.  There's even a White Paper, "Learn 10 Functions in NI-DAQmx and Handle 80% of your Data Acquisition Applications" (I hope I typed that 100% correctly -- I didn't "look it up" because I've found it in Google so many times in the past few years that it almost "flows off my fingers").  Ignore Chapter 1 (which talks about the DDA).

 

You should definitely not use formula nodes.  If you've done your DAQmx correctly, you'll get out a 2D array of Dbls, 1000 rows of 3 columns (assuming 1000 samples and 3 channels of A/D) that you need to change to "real-world values".  You know (I hope) how For Loops work with Arrays -- when you put a 2D Array into a For Loop, by default, the For Loop puts an Indexing Tunnel (one with a pair of square brackets, [], suggesting an Array) in place of the solid square Tunnel, indexing through the first Index (i.e. processing a Row at a time).  OK, you've got a Row inside the For Loop, now you want to do a different computation for each of the columns.  How do you get each of the (3) columns?  Use another ________ (fill in the blank), which will give you each of the three columns.  But you want to do different things for each column.  What lets you choose among alternatives?  In "case" you haven't learned about the Case structure ...  What do you wire to the Case "selector" (the "?" terminal)?  The Index (i), which for three columns, will be 0, 1, and 2.  Inside each Case, you put the code (not a formula, program the arithmetic!) to change the A/D value into Pressure or Angle.  But what's with that Broken Arrow?  If you have a Case Statement, you must tell it what to do with every argument it can see.  Here, it is any I32 value (that's a lot of number!), so you want to handle "all the rest", which is where "Default" (spelled with the quotation marks) comes in.  Simply add a "Default" case (or combine "Default" with one of the other cases, such as making the first case read 0, "Default").  Presto, done-O.

 

Now you just need 3 or 4 DAQmx commands.  Read the "Learn 10 Functions" and if you need a clue/hint/pseudo-mentor, come back here with your VI and questions.  Note -- many of the "Old Timers" with the most experience probably don't have LabVIEW 2023 on their computers.  Before attaching your code, do a "Save for Previous Version" and specify LabVIEW 2019 or 2021, and attach your code.  If you are working inside a LabVIEW Project (and if not, why not?), right-click the File holding the .lvproj file and (I hope) all your VIs, "Send to", "Compressed (zipped) Folder".  [Skip this step if you only have a single VI].

 

Bob Schor

0 Kudos
Message 2 of 5
(630 Views)

Thank you for the response.

I was expecting this kind of answers. I can't understand all the hatred toward the DAQ assistant yet but I'm willing to go straight to the DAQmx tasks instead. So I'll do that.

 

I am not exactly sure why the formula node isn't a good option, but I wish it was as there are quite a few operations that are needed for that one more complex conversion I need to do. Are you suggesting I need to wire up all these operations in a discreet manner? That's a lot of wires!

 

 

If I may ask a couple more questions:

The project involves 4 devices: a 9213, a 9201, a 9221 and a 9421.

 

The 9201 will be sampling at a much higher rate than the 9213 and 9221.

 

Currently I am planning to run 3 tasks for the first 3 devices (I am not sure yet how the counter will be implemented yet).

Should these 3 tasks be running on independent loops with different priorities or should I run a loop within a loop?

 

Of course the goal of the project is to get some visual indications of what's going on, but also log data. From my standpoint what I "need" is to get continuous logging on the 9213 and 9221, and only log the 9201 (high speed) "on demand". In other words, have 2 output files.

 

As for the visual indication, if the various graphs get refreshed a few times per seconds I would be more than happy.

 

Does it sound like a reasonable plan?

0 Kudos
Message 3 of 5
(598 Views)

Sorry, I've been busy.  Let me ask you a few questions:

  • What are you trying to do?  You mention the NI devices you'll be using (I was unfamiliar with all those "numbered" devices -- it would have been clearer to say "cDAQ" (or were they cRIO?) Thermocouple, A/D (you have two different ones, describe what and why), and Digital Input.  Describe the signals you are trying to measure, including such details as the desired sampling rate for each signal type, the DAQ device you plan to use, something about the timing of the acquisition (e.g. "Continuous sampling at 5 kHz for up to 24 hours on two channels").  Please help us by associating the signal type to the DAQ device.
  • What do you plan (immediately) to do with the data?  Do you want to visualize it as it comes in (such as a Waveform Chart), with or without processing?  Do you need to save it all for later analysis?
  • How many types of data are you handling?  How are the Digital and Analog signals related to each other?  Have you thought about how you will save your data?
  • Are there colleagues with LabVIEW experience available to help you?

Bob Schor

0 Kudos
Message 4 of 5
(552 Views)

@swiftmoun wrote:

the pressure transducers, probably overkill I am using a formula node. I was doing it with operators directly on the signal when I first had one test signal.


you cannot inline a sub.vi containing a formula node, therefore you are meant to avoid formula nodes

also, formula nodes turn out to be significantly slower in comparison to LabViews operators.

 

in terms of math formulas, formula nodes are often easier to read, therefore formula nodes are good for prototyping.

 

 


@swiftmoun wrote:

 

The issue I am facing is getting this converted data back into a form that the waveform will digest. 


does it work before conversion? if yes, then you need the opposite of "index array" which is "build array"

Spoiler
alexderjuengere_0-1702716881182.png

 

 

0 Kudos
Message 5 of 5
(538 Views)