LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Number of Data Samples

Highlighted

Hi All,

 

I am new to Labview and I am trying to develope one new application. I am using Labview 2012 in windows 10. Here I want to capture number of analog values/second as per my wish. (i.e; varying from 100 to 1000/sec) and I want to plot them as XY Graph. When I use sampling rate and number of samples 10000 and 100 respectively, I am getting 100 datas per second. But When I increase the sampling rate or decrease the number of samples to get more number of data( i.e; sample rate = 20000, number of samples =100 / 50), I am getting not more than 200 datas and My XY plot works very slow i.e; taking more time to plot. But I want to plot in realtime. i.e; When I capture the data it needs to plotted. Here I am attaching my program..

0 Kudos
Message 1 of 19
(1,611 Views)

Hi Arul,

 

what a mess…

 

- Why is your BD so big? Why do you use so many local variables?

- There are a lot of missing subVIs.

- There is some weird stuff in your VI:

check.png

What are you trying to achieve here? Why measure 16 channels as waveform and convert the data to a 1D array? Why convert this array to a cluster?

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 2 of 19
(1,596 Views)

We can tell that you are new to LabVIEW:

  • You use Sequence structures, suggesting that you don't understand the Principle of Data Flow, a core concept of LabVIEW Programming.
  • Your VI requires about 10 by 8 "screens" (size 1280 x 1024) to "see everything".  Even your main While loop takes about 5 x 3 "screens".  One virtue of LabVIEW's Graphical Programming is the ability to "see the code as a picture", but this breaks down if you can't see "the Whole Picture".
  • You seem to know about sub-VIs (there were several "missing" from the VI you attached).  These are an excellent way of saving Screen Space -- a sub-VI takes only 32x32 pixels, and if you give it an Icon (which can be as simple as three lines of text saying "Analog In" or "Angle Cal"), you make the code almost self-documenting.
  • You use Local Variables, suggesting you don't know about using Shift Registers to hold values.

I don't have the patience to schlep through your code trying to find what you do where, so I'll make some guesses and assumptions based on what you've written.  I suspect that part of your problem may be related to two issues:  the difference between a Chart (points are added to the plot, which evolves over time) and a Graph (everything is plotted "all at once" -- to get the plot to change, you have to "replot everything"), and how data acquisition works.

 

For a discussion of Plots vs Graphs, the LabVIEW Help should provide you with useful information.  Based on what you write, you want a Chart.

 

As for sampling, if you ask for Continuous Sampling at 1KHz, and ask for 1000 points at a time, you will get no data for 999 milliseconds, then you'll get 1000 points all-at-once.  You can plot them on a Chart, and you'll see the Chart "jump" once per second as the data get plotted.  You'll also see the millisecond-to-millisecond variation of your data (think about looking at an oscilloscope with a sweep rate of 100 Hz at a signal -- it's going to zip by too fast for you eye to see any detail.

 

You could choose to sample 50 points at 1KHz, so every 20 milliseconds you'd get a new sample of 50 points.  If you really want to see what your data is doing, plot the average of these 50 points.  You'll get a plot that now updates at a comfortable 20 points/second, so it will scroll slowly across the screen.  Note you can also plot the 50 points on a second Chart which will update at the same 20 Hz rate, except it will show all 50 points and, I dare say, you will have a much harder time "seeing anything useful" in the data (unless you are interested in the "noise").

 

Here's a suggestion to get you started on understanding what I'm saying:  build a little VI that has a For loop with a 1 msec Wait inside and a random number generator.  This is your Signal Source, generating data at 1 KHz.  To simulate DAQmx sampling 50 points from a single channel, wire 50 to the "N" terminal of the For loop.  Bring the output of the Random Number Generator out through an Indexing Tunnel (the default for a For loop) and you have your simulated DAQmx Read function.  Now wire this to a Chart.  Also average these data (there is an Average function on the Mathematics Palette) and wire this to a second Chart.  Play with this simple example until you understand Charts, then redo your XY Mode code.

 

Bob Schor

0 Kudos
Message 3 of 19
(1,590 Views)

Dear GerdW,

 

My application is to read 16 channels and plot them to XY graph based on my client requirement. that is they can vary the X axis and Y axis data according to their requirement. So I need to read all. 

 

My request is to guide me how to plot the data in realtime with the reuired number of data as per client requirement. i.e; If they require 100 data per second I need to capture 100 data and plot them as Graph. If they need 1000 data per second, I need to capture 1000 data and so on.

I think they wont go more than 1000 data per second. 

 

My problem is to plot them in realtime. That is it has to be plotted while capturing..

0 Kudos
Message 4 of 19
(1,556 Views)

Hi Arul,

 

My problem is to plot them in realtime. That is it has to be plotted while capturing..

Did you check the example VIs coming with LabVIEW? They explain most DAQmx stuff very well - including plotting data read from several AI channels!

 

based on my client requirement. … I think they wont go more than 1000 data per second.

Do you have an explicite client requirement - or do you need to guess what your clients may ask for?

 

When you have a client, you get paid for your work: so either do your work (and learn LabVIEW) or hire/pay a consultant and let him/her do your work…

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 5 of 19
(1,547 Views)

Dear Bob,

 

Thanks for your reply.

 

I have tried using charts as per your suggection. Here I got one doubt. Is it possible to use an analog value in chart as X axis data? If yes, pls guide me how to do ?

 

Thanks in Advance

0 Kudos
Message 6 of 19
(1,535 Views)

Hi Arul,

 

Is it possible to use an analog value in chart as X axis data?

No, charts only take Y data…

When you want to have arbitrary data on the X axis you should use XY graphs.

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 7 of 19
(1,529 Views)

Thank You GerdW.

 

I trying XY now.

 

When I use sampling rate 10000 and number of samples 1000, I am getting 10 data per second and

When I use sampling rate 10000  and number of samples 100, I am getting 100 data per second.

In both the cases, its get plot  as soon as possible while I am capturing the same.

 

But When I use sampling rate 10000 and number of samples 10(To get 1000 data per second),

I am getting nearly 200  data per second and my graph even not gets start to plot..

 

I want to know how to  overcome this issue..

 

As Bob told XY graph collects all the required data and then starts to plots, which one will satisfy my application requirement?

that is to plot in realtime..

 

Thanks in Advance..

0 Kudos
Message 8 of 19
(1,523 Views)

Hi Arul,

 

When I use sampling rate 10000 and number of samples 1000, I am getting 10 data per second and

When I use sampling rate 10000  and number of samples 100, I am getting 100 data per second.

In both the cases, its get plot  as soon as possible while I am capturing the same.

 But When I use sampling rate 10000 and number of samples 10(To get 1000 data per second),

In all the cases you described you should get 10k samples per channel per second - as all three cases use the very same samplerate of 10kS/s!

If you get different results from my expectation the problem is within your VI(s) as Bob and I tried to explain before. Remove those silly data conversions, clean up your code, show us your subVIs…

 

As Bob told XY graph collects all the required data and then starts to plots,

Where did he say so? He was talking about charts!

 

which one will satisfy my application requirement?

What exactly is your requirement?

Can you start over with a simple (and small!) VI, basically one of those example VIs coming with LabVIEW, to understand the basics of DAQmx usage? Once you understand the example VIs you can build your own VI based on those examples to fulfill your requirements…

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 9 of 19
(1,520 Views)

Hi GerdW,

 

I am saving the captured data in excel while plotting the same. When I run the VI for 30 seconds I need to get 30k data.

Currently I am getting 3k data for 30 seconds. i.e; 100 data per second.

Thats what I mean in the above messages. 

 

 

0 Kudos
Message 10 of 19
(1,491 Views)