LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating histograms for multiple channels of data from a single analog task

Solved!
Go to solution

Hello again!

 

I am currently working on creating a data acquisition software for a mobile cart in a test lab. For our uses, I need to be able to accommodate a wide range and number of sensors based on the test we are performing. As such, I'm trying to create a software that adapts to the number of selected physical channels and separately graphs each type of input (Thermocouple, 0-10V, 4-20mA) on it's own histogram. I am able to correctly detect the number of selected channels and separate out the signals with the index array function. However, I cant seem to figure out how to plot multiple channels on a histogram for each data type. I'm attempting to use the 'build waveform' function, wiring each sensor to a Y value. (See images below for a simplified example of what I'm trying to do.) However, the output waveform seems to combine all the data into a single channel, rather than graphing each Y value as a separate channel. 

 

Is there a better way to graph data acquired from multiple analog sources? Am I just missing something that will allow me to graph multiple channels from multiple sources on a histogram? 

 

Thanks for reading!

 

Overview of inputs:

 1. 0-64 TC inputs on 4x 9214 modules

2. 0-32 10V inputs on a 9205

3. 0-8 20mA inputs on a 9203

Backplane is a cDAQ-9189

Software is LabVIEW 2017

 

Example of how I am trying to create a waveform from data (5x TCs in this case)Example of how I am trying to create a waveform from data (5x TCs in this case)The waveform created from the example. As we see, there is a single channel, rather than the 5 desired.The waveform created from the example. As we see, there is a single channel, rather than the 5 desired.

 

 

Dylan Howard
Lab Technologist, Alto-Shaam Inc.
0 Kudos
Message 1 of 7
(4,593 Views)

There are several issues with the picture you showed us.

 

1.  The waveform wire that comes out of the unbundle by name runs behind the DAQmx Read.  At first I thought it was coming from the DAQmx Read.  Clean up the wiring.  Wires shouldn't run behind other objects.  Use block diagram cleanup tool if you need to.

2.   Index Array is resizable.  No need to split the array and make multiple copies with constants wired to each one for the index.  Take one Index Array and drag the bottom border downwards.  The outputs will automatically be 0, 1, 2, 3, ...  without wiring up any constants for the indices.

3.  You have a single waveform, and you are bundling into that an array.  But you are doing it over and over and over into the Y input of Build Waveform Components.  The later Y arrays overwrite the earlier ones.  Only the last Y array has any effect, and that is just a single element int hat waveform.

4.  You say you are using a histogram, but I don't see any code that generates a histogram.  That will either be a built-in LabVIEW subVI, or your own code that accumulates and bins values.  All you are plotting now is the time waveform channel index 4.

0 Kudos
Message 2 of 7
(4,577 Views)

Thanks for the reply!

 

1. You are correct, I did not notice that when I was throwing together the example. 

2. I actually was unaware that the index array could be resized. Good tip to know. Definitely makes the VI cleaner. 

3. Ahh, that's what I did not understand, then. It looked to me like I could input multiple Y values and have it graph each of them as in individual channel. This explains why that failed to work as expected.

4. As to building the histogram, that's exactly the kind of code I'm trying to figure out. Honestly, I could be using the term 'histogram' incorrectly in reference to labVIEW. Basically I just want to graph the data of each individual channel in real time as it is acquired. I've plotted a graph of just temperature data directly from the DAQmx read, as that can output a waveform. I would just do that again, except that I now have to take one task and separate it into three separate types of data, and then graph multiple channels within each those three sets. That's why I have chosen to output as an array of DBLs and then build a graph from that. (Because I can only have one analog task per chassis, correct?) Hence my mess of code. Is there any reference material that might be of assistance in accomplishing this? I feel like I'm over-complicating what should be simple code.

Dylan Howard
Lab Technologist, Alto-Shaam Inc.
0 Kudos
Message 3 of 7
(4,571 Views)
Solution
Accepted by topic author Dylanh

Use N channels N samples Waveform with your DAQmx Read.  You'll have a 1-D array of waveforms where each one represents a channel.  Use array Waveform Subset a few times to pick out what waveforms belong together and send each of those 1-D array of waveforms to their respective Waveform Chart.

 

A histogram is a count of how many of some type of item falls into a particular bin.  For example, how many students got A's vs. B's vs. C's.  It is strictly a count and has nothing to do with time.

Message 4 of 7
(4,563 Views)

I'm think RavensFan has the right idea with the Waveform Chart.  Remember to right click the chart to set its history length. (The default is only 1024 points)

---------------------
Patrick Allen: FunctionalityUnlimited.ca
Message 5 of 7
(4,558 Views)

Perfect. Thank you both. This works. I re-created the example above with the suggested solution. Now all I need to do is use additional Index Array blocks to separate out the other data types. For anyone looking into similar issues, here is what I did: 

 

Capture.JPGCapture2.JPG

 

Thanks again!

Dylan Howard
Lab Technologist, Alto-Shaam Inc.
0 Kudos
Message 6 of 7
(4,549 Views)

OR, if the ones you want to group are adjacent in the array, you can use array subset.  This example shows how to get the first 3, the next 4, the next 5.

 

 Example_VI_BD

0 Kudos
Message 7 of 7
(4,543 Views)