LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to display signal for long duratons on waveform graph

Hey! I.m new to LabView , I want to know how can i display these signals for long duration. Like for 5 sec .

I'm using a while loop and simulate signal express vi . Later, I want to replace express vi with DAQ.

Thanks !!

0 Kudos
Message 1 of 9
(404 Views)

You can use a chart and calculate the required chart history length based on the acquisition timing and number of points to show data for the last five seconds.

 

We cannot debug videos, so to get better help, start with attaching your VI.

0 Kudos
Message 2 of 9
(385 Views)

 

 

 

 

here it is. I have done some tweaking with the "multiplier" and I Have achieved the desired behavior but the scale have been messed up. 

0 Kudos
Message 3 of 9
(327 Views)

It's not giving continuous data , actually I'm trying to mimic a oscilloscope.

0 Kudos
Message 4 of 9
(311 Views)

Hi Ashi,

 


@Ashi1078 wrote:

I Have achieved the desired behavior but the scale have been messed up. 


So it is "desired behavior" when the scales are "messed up"?

 


@Ashi1078 wrote:
It's not giving continuous data , actually I'm trying to mimic a oscilloscope.

You still use graphs even though you got the suggestion to use charts instead…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 9
(299 Views)

I tried using charts but that didn't give desired result or may be i didn't know how to use it.

0 Kudos
Message 6 of 9
(288 Views)

I'm currently using a Graph to make an "oscilloscope-like" Sweep Display, which is possibly what you are trying to do.  You need to take into effect the sampling rate, the plot update rate, and the plot width (in seconds).

 

Based on your Video and description, you are sampling (maybe) at 1 kHz (looks like about 100 points in 0.1"), and want to show (continuous?) data (sweeping across the screen) with a plot width of 5" (so the first screen is 0" to 5", the plot after that starts at 5" and gradually overwrites the old plot until 10", then 10" to 15", etc.).

 

I'll assume a plot update rate of 1 kHz (though if the data are as "noisy" as shown in the video, it will just be a "white blur" across the screen).  You ideally want to be looking at a signal where the "mean" level changes on-the-order of the plot width (i.e. the "signal" (without noise) is clearly visible in your 5" plot window -- you may need to filter (pt-by-pt) the incoming signal using a low-pass filter of, say, 50 Hz).  So I'm going to revise the first sentence of this paragraph -- your Plot Update rate should be, say, a few time (5?) the low-pass filter, or 200 Hz, which we can approximate by plotting the average of every 5 points.  Note that this reduces the number of points to plot from 5 *1000 to 5 * 200 = 1000 points. 

 

Here's the basic idea.

  1. Initialize everything.  Create a "Box-Car" array of 5 points.,  Clear the Plot (by writing an Array of 1000 "NaN" to its Value property), and create a "Box-Car" array of 5 Dbls.
  2. Start Sampling, 5 samples at a time.  You might want to use a Producer/Consumer design to send the Array of Samples to the Plot Routine, which I'll describe now:
    1. The Plot routine gets 5 samples, and takes an Average (which is the point to plot).  The Plot routine needs to keep track of the "Plot X" value (which starts at 0", but after the first 5 ", it needs to be reset to 5", see below).
    2. Put the Average into the Plot at the current "Plot X" value (so the first Average goes into X = 0, the 499th goes into X = 499, the right-most of the current 500-point graph, and the 500th point goes into X = 500, which (before you plot it) is now the new Left-most X value of the Graph.  Note that doing this effectively "overwrites" the old X value from the previous "Sweep", exactly as an oscilloscope would.
    3. If you are saving these (averaged, or even "raw") data, this would be a fine place to do the file I/O, as well.
  3. When the Producer loop decides to finish (because you pushed the "Stop" button, say), you need to tell the Consumer that it can safely exit.  The Stream Channel Wire is ideal for Producer/Consumer communication, as it incorporates a "Sentinel" feature.  When the Producer decides to exit, it sends one final "Stream" to the Consumer, specifying "valid data?" as False, and "last data?" as True.  The Consumer uses the "valid data" input to control a Case Statement (where the False Case is "Do Nothing", or whatever end-of-data thing you want to do) and the "last data?" signal is wired to the Consumer's Stop indicator.

About a decade ago, I came across a description of something I called a "Flexi-Graph" that expanded on this technique to keep multiple graphs with different time bases running simultaneously.  I can probably dig this up if you are interested.

 

Bob Schor

0 Kudos
Message 7 of 9
(276 Views)

hey! First of all thanks for your response.

 

I'm not able to get few things

why are we averaging out the data? My goal is to record EEG and EMG signals.

 

I want to show the data for 5 sec on the screen and then make then the 6th second should be the end point(1 being the starting point) and then 7th(2 being the starting point) and so on ... this is what I meant by continous data.

 

And also number of samples and sample rate will vary according to the frequency.

 

 

Thanks

 

 

0 Kudos
Message 8 of 9
(257 Views)

You ask why I was "averaging out the data".  It goes back to "what is the frequency range of your input signal?"  You are sampling at 1 KHz, so you should be low-pass filtering your signal at 500 Hz or lower (why?  Suppose I sample a pure sinusoid of 1 KHz at exactly 1 KHz -- what do I get?  Hint -- the letters D and C  are prominent in the answer).  What is the highest frequency of interest in the data your are acquiring?  If you sample with a 5-point moving Box Car (which you could do), it would effectively lower the highest signal frequency from 500 Hz down to 500/5 = 100 Hz.  Doing a "jumping Box Car" (as I suggested) does more-or-less the same thing -- the differences are subtle.  I used to do the former ("moving Box Car") and now largely do the latter ("jumping Box Car").

 

But how do you make a Moving Box Car?  You need a Ring Buffer, something of length 5 that ypu put numbers in, it stores it in a "ring" of 5 (with the sixth replacing the first, the seventh the second, etc.).  LabVIEW provides this to you -- a Queue of fixed length (5).  You create such a Queue.  Each time you get a number to "filter", you add it to the Queue using "Lossy Enqueue Element" (which puts the New on the Queue and discards the Old).  Now you Obtain Queue Status, which (among other things) gives you an Array that has the elements (all 5 of them) in the Queue.  Average it, and you have a Moving Box Car Averager.  Neat?

 

Bob Schor

0 Kudos
Message 9 of 9
(241 Views)