Real time waveform graph in while loop

Hi
I have a VI which includes a subVI that reads data from an oscilloscope and presents the output in the form of a cluster made up of the initial time t(0), a time interval delta t and an array of voltage readings.
This cluster can then be wired to a waveform graph in the usual way. All of this is situated within a while loop in my VI and on each iteration of the loop I obtain a waveform graph of the voltage readings starting at the same time t(0) and ending at the same time t. However I want my graph to begin at a time t(0) when I set my VI running and then continuously acquire and build up the data on each iteration of the while loop so after my VI has finished executing I have a complete graph of all the voltage readings acquired after the set number of iterations of the loop. I know on the Express X-Y Graph VI you can double-click the node and deselect the box that says 'clear data on each call' - if I could do this in my case that would be great but I can't use an x-y graph because I have an array of y-values to plot on each iteration.
If anyone can help me out it would be much appreciated - I'm sure there must be an easy solution to this but I'm going out of my mind trying to find out what it is!
Many thanks,
Bex.

As usual, you have several options.
You can use an XY Graph by generating the X values yourself. This will ensure that you place the data exactly where you want it on the X axis. This is fast, but does involve a memory cost.
You can use a Waveform Graph with a waveform input instead of the cluster you are using. Use the Build Waveform primitive instead of the bundler to make your waveform. Set the t0 values to the appropriate values (negatives do work, as do small numbers - time is in seconds, use the To Time Stamp primitive to convert from DBL to timestamp). Finally, you need to set the Waveform Graph to use the t0 values. Pop up on the Waveform Graph and make sure Ignore Time Stamp is not checked. Depending on your version of LabVIEW, you may have to pop up on the graph or the axis. When you unselect Ignore Time Stamp, you will probably want to reformat the X-axis again. The Waveform Graph clears data at each iteration, so you will need to replot all your data each time. Just create an array of waveforms and keep adding to it. The t0s will put the waveforms in the right places. Yes, this may cause memory problems.
Finally, you can use the Waveform Chart, which does have memory. Create the waveforms like you did for the Waveform Graph and send them to the chart. It will remember what was sent to it from run to run. Make sure you set the Chart History Length (pop up on chart and select Chart History Length...) to long enough to hold your entire data. You can use a property node to get the data back at the end, if you need to.
Good luck!
This account is no longer active. Contact ShadesOfGray for current posts and information.

Similar Messages

  • Use the LabView time delay in a while loop instead of using the instrument inherent time loop.

    I have a zes lmg500 that I use. It has the option of continues measuring data, with a user control cycle loop (still using a while loop but the delay is coming from the instrument). The problem is that the loop time is not constant. Can I use a very short time (100ms) as the instrument cycle time but use a longer time delay in the while loop that collect the data?
    I know many instrument offer the same abilities, so the question is relevant to all of them.
    Thanks for any help
    Solved!
    Go to Solution.

    Does that measurement VI have built-in wait functionality and a timeout?
    If not, then you are simply polling the VI at 1 kHz, but I suspect that this is not the case or your Waveform Chart probably wouldn't look as you expect (getting 0's put in everytime measurement data is not available).
    I expect that if you have the instrument set up to send data at a fixed time interval (i.e. 100 ms), all the data that it is sending you will end up residing in your serial buffer (or the instrument driver will have taken it out and put it in another internal buffer), so if you come back to read it 1 sec later, then you will have 10 data points to go through.  Whether you can read them all at once with the read VI or have to call it a whole bunch of times until empty I can't say.
    What is your objective?

  • 3D real time voltage graph

    Hi I'm a beginner at Labview.
    I'd like to plot a real time contour graph from voltage readings from 4 diodes which is obtained via the DAQ. The x-y coordinates are the coordinates of the locations of the diodes while the z coordinate is the (current) voltage measurement of each diode.
    I've already splitted up my location coordinates into x-vector and y-vector. I've tried to wire my latest readings values into the z matrix, however I received an error about the different data types.
    Any idea how can I plot a 3D real time contour graph?
    Ps. With the exception of the 3D graph, everything else works prefectly.
    Attachments:
    voltage array 2 - Copy.vi ‏122 KB

    jsp6 wrote:
    Hello,
    I'm trying to view the voltage measurements in real-time chart. (Labview2012 and I've connected 2400 sourcemeter with my laptop by using GPIB-USB-HS)
    My question is, how can I increase the chart update rate? Say, how can I increase samples/second rate?
    Here is the screenshot of my chart -> . Its update rate is quite slow and I dont know why the voltage measurement takes time to settle back 0V (notice the descending slop after the voltage pulse).
    I'm using labview to measure a voltage pulses. So I need fast-response chart that looks like this -> .
    I'm very new to Labview. Please help 
    I'm attaching the vi
    Are you sure they're the same timescale?  The LabVIEW shot sure looks like a time-stretched version of the display photo...
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • How to set real time waveform chart

    I would like to record voltage signal from built-in microphone. My block diagram is attached.
    I would to like record 1second data every 10min and then take an average of that 1s data so that I have 1 data point about every 10min. The time of the origin of the chart must be kept at start date and time all the time and the program need to run until I stop it. 
    But I cannot set the date and time to be real time. How can I make it?
    Thank you very much.
    Attachments:
    1.vi ‏41 KB

    Hello
    answers are in blue
    phx wrote:
    Freelance_LV, Thank you very much for your editing, I am testing the program. I have some questions.
    1. Why can't I just using continuously running to run my program to make to run continuously? it is a good practice to use a while loop and run the code, than use the run continuously button. my understanding is that the run continuously button will cause the code to run at the highest possible processor speed and will use up the entire load on the processor. by using a while loop and placing a small delay, we can ensure that the cpu is not loaded by our program. But, i hope our seniors could provide the correct explanation to it.
    2. From your diagram, what I realise is that in 3600s, the signal of time sends data to "elapsed time" every 0.1s until the elapesd time is the same as target time so the the "True/False" Loop" can run. My question is, once the the "True/False loop" start runnig, how long does it run? 1second? Or is my understanding about the flow wrong? check the attached code. i made some additions, to answers your question.
    3. The minimum sample rate of the "acquire sound" is set to 11025Hz which is also the sample length of the "Mean". Does it mean that the mean it takes is the mean of the amplitude of latest 11025 samples? would suggest you use Mean vi than the Mean Pt to Pt vi. logically, the mean vi should read the input array of data, calculate the mean of the values. there is no 'latest' here. the mean vi gives the mean value of the array at its input. the acquire sound vi will read the data from the microphone at the sample rate mentioned. you said the min sample rate if 11025 Hz. but your code shows 8000 Hz as input!
    4. Why isn't the x-axis the current time if I just put the diagram inside the True/False Loop out to a new VI? you will need to set the start time of the X-axis using the property node X-axis range minimum value. Else, the chart/graph will take the standard start time as 1/1/1981 and 0.00 time + or _ the GMT zone.
    Thank you very much!!
    Attachments:
    1_edit.vi ‏68 KB

  • Plot XY graph from while loop

    I am trying to make a curve tracer with a DC power supply, DAQ, and Labview 7.1. Everything is ok, until I want to plot an x-y plot from a while loop. I can do this function fine using a for loop and cluster cells, but I need the while loop for the interruption function. When I change to the while loop, it had data formating issues, but I believe I have it to something that should work. It seems like my xy plots want to graph (the auto scale moves the axis respectively) but I do not get a line. I'm not sure if Labview is seing this as just one point and not an array, or if there is a labview bug. Attached is my code with a few different trials to make an xy plot. If anyone can be of help I would be very thankful.
    -Jon
    Attachments:
    Curve_trace_w_relays_while.vi ‏122 KB

    If it works in a FOR loop, but nor in a while loop, most likely your output tunnels are not autoindexing (FOR: on by default, WHILE: off by default). Right-click on the output tunnels and select "enable indexing".
    If you want to watch your graph update during the while loop, you could accumulate your x and y data in a shift register and graph it. (See attached modification).
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Curve_trace_w_relays_whileMOD.vi ‏74 KB

  • Why the execution time increases with a while loop, but not with "Run continuously" ?

    Hi all,
    I have a serious time problem that I don't know how to solve because I don't know exactly where it comes from.
    I command two RF switches via a DAQ card (NI USB-6008). Only one position at the same time can be selected on each switch. Basically, the VI created for this functionnality (by a co-worker) resets all the DAQ outputs, and then activates the desired ones. It has three inputs, two simp0le string controls, and an array of cluster, which contains the list of all the outputs and some informations to know what is connected (specific to my application).
    I use this VI in a complex application, and I get some problems with the execution time, which increased each time I callled the VI, so I made a test VI (TimeTesting.vi) to figure out where the problem came from. In this special VI I record the execution time in a csv file to analyse then with excel.
    After several tests, I found that if I run this test VI with the while loop, the execution time increases at each cycle, but if I remove the while loop and use the "Run continuously" funtionnality, the execution time remains the same. In my top level application I have while loops and events, and so the execution time increases too.
    Could someone explain me why the execution time increases, and how can I avoid that? I attached my test VI and the necessary subVIs, as well as a picture of a graph which shows the execution time with a while loop and with the "run continuously".
    Thanks a lot for your help!
    Solved!
    Go to Solution.
    Attachments:
    TimeTesting.zip ‏70 KB
    Graph.PNG ‏20 KB

    jul7290 wrote:
    Thank you very much for your help! I added the "Clear task" vi and now it works properly.
    If you are still using the RUn Continuously you should stop. That is meant strictly for debugging. In fact, I can't even tell you the last time I ever used it. If you want your code to repeat you should use loops and control the behavior of the code.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • How can I display a .csv file as a real time waveform using labview

    Hi folks.
    As stated, Im looking to display a .CSV file (obtained via RS-232, example; 100,101,102,102,102,103...) as a waveform in real-time. What is the best way to approach this? Im thinking LabVIEW. I have version 7.1 but am not really experienced in using it. I'll give anything a go though. Also, I have Visual Studio 2005, so I was thinking VB???
    Thanks in advance!
    Simon.
    Message Edited by simonious on 10-26-2007 04:13 AM

    Have a look at this VI.
    Add a convert string to number function behind it.
    André
    Message Edited by andre.buurman@carya on 10-26-2007 01:08 PM
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)
    Attachments:
    convert csvars 2 array of vars.vi ‏16 KB

  • Capturing of time taken by a while loop in bpm

    Hi ,
    I have a busniess process ,and my receive step is defined in a while loop.
    so it starts with a while loop.
    I want to keep a condition on the while loop that it should receive the messages only for a period of 1 hour ,and if it exceeds this period it should end up the process triggeringa mail.
    I mean to say if there are 12 records to be processed through the while loop ...and if I receive only 11 records ..it will be waiting for that final record in an infinite loop ..so I dont want that ...instead if the total no of records are reached then it should move forward ..If it is waiting for the missing records for an hour ..I should stop the process and trigger a mail to the queue monitor saying that record is missing...I have finished the process without this processing time condition successfully..
    I am new to XI and I dont have any idea on how to capture this processing time of while loop.
    can some one please help me out in this issue...
    Thank you in advance...

    Hi Latika,
    Yeah I understand we can go with fork but why I am going with this is ,I have already designed a Payload dependent loop ,by using while loop.so it makes my job simple ...
    Now I am converting it to time dependent loop,so only the final question I have is...In the time dependent loop documentation ..they have taken it as infinite loop and only kept the time limit in the deadline branch...so when the deadline reaches they trigger something.
    If you go to the documentation of time dependent loop(http://help.sap.com/saphelp_erp2005vp/helpdata/en/08/16163ff8519a06e10000000a114084/content.htm) ..they took the infinite loop...in this loop if I mention the counter ..and if this record count triggers before the time limit...it should come out of the block...would it work this way ?
    Thanks a lot...

  • Time not stopping with while loop

    Hello,
    I've attached my VI.  I am having trouble with while loops.
    I want to turn on LEDs. The first LED should turn on after 3s.  The second LED should turn on after 5s.  The third LED will turn on later. 
    The LEDs turn on based on the following conditions:
    Case 0: numeric control > 10 then led_1 off, led_2 off, led_3 off
    Case 1: numeric control <= 10 then led_1 on, led_2 on, led_3 on
    Case 2: numeric control <=5 then led_3 on
    Because of the way I'm delaying time, I have the following problems
    Case 1 --> case 2: led_3 doesn't come on right away
    Case 2 --> case 1: led_3 doesn't turn off right away
    Putting probes in certain areas leads me to believe that these problems are due to the way the time delay is being generated.
    Thanks in advance.
    EDIT: Looking at it more...it seems to be that when the stop condition is true, the loop runs one more iteration. Is there a way to keep it from running that "one more iteration."
    Attachments:
    timing.vi ‏15 KB

    One of the problems is that your VI is not able to "breathe" because it is sometimes trapped inside inner loops that consume all CPU and step on each others toes. All you need is an single outer loop and a few shift registers.
    May of your specifications are still not clear, for example what should happen to LED 1&2 in case #3? Should they remain in the state they are in, or should they turn off, for example.
    Here is a simple rewrite that spins the outer loop at a regular rate, has no inner loop, and does not need any local variables or value property nodes. See if it makes sense. Also note that your code can be simplified dramatically by using arrays. Since the stop button is read with each of the regular interations, we don't need to worry about sequencing.
    Most likely you need to do a few simple modofications, because your specs are not clear.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    timingMODCA.vi ‏15 KB

  • Time Measurement in a While-Loop

    Greetings gentleman;
    I am a little bit new at Labview, and though i searched for an answer without posting, i was not able to find one.
    So here is my question, i would like to know how can i measure time of a loop sequence, in other words, how much time does my VI take to execute the whole main loop ?.
    A little explanation, the attached VI tries to be a Markov Chain, it takes some values in the first case structure depending of the previus loop, then, if the values are correct, it goes to the next step and so on. It is quite simple, yet, my issue lies with the time measurement. Since this is a probability "distribution" it could take infinite time to execute one single loop if it does not meet the requierements, but is programmed to meet them so an average timing should work.
    So, if you look at the While loop, the big one, that i would like to measure how much time does it take to do one round.
    Thanks for the help, i would be glad to read some ideas on how to measure that.
    Kind regards,
    Stgo.
    Solved!
    Go to Solution.
    Attachments:
    Markov Chain.vi ‏30 KB

    You can find a few examples in the NI Example Finder by searching for 'speed test' or 'benchmark'.
    Essentially, you create a flat sequence structure inside your while loop. In the first frame, you measure the current tick count. In the middle frame, you run your code. In the final frame, you measure the tick count again, and subtract the first count from this. This gives you the execution time to run the code.
    You can see a community page on it here.
    There's a high resolution tick/time count VI hanging around somewhere which is excellent for benchmarking and improving efficiency, used in place of the Tick Count (ms) primitive.
    Edit - remembered where it was
    https://decibel.ni.com/content/blogs/EvanP/2010/10/04/tick-count-us--microsecond-timing-granularity-...
    CLD

  • Keeping data on graph once while loop exits

    Hi, I have the attached vi where I am reading in Bluetooth data, plotting and saving the data. My inner while loop is the one performing the plotting, where I have the error out of the Bluetooth Read function wired to the boolean control of the loop. If for some reason the connection gets distrupted, the loop exits and the BT automatically reconnects.  The problem here is that one the inner loop stops, the graph plotting the data clears.  I am looking for a way to keep the data plotted on the graph, so once the connection is lost and reconneted again, the data continues plotting from where the connection was lost.  I cannot figure out how to do this, I tried to use local variables to plot the data outside the graph while the loop is running but that didn't work. Can somene provide me assistance?
    Attachments:
    test.vi ‏55 KB

    moderator1983 wrote:
    My bad...!!
    I was working late night and misinterpretate "Write to File" express VI with "Build XY Graph" express VI..!!
    Anyways the attached code should work fine.
    Here, I took care of some of your Rube Goldbergs.
    I'll try to get something written up to show a Queued Message Handler...
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    I love clean code more.vi ‏53 KB

  • Real time intensity graphs

    Hi,
    Can somone tell me if it is possible to make intensity plots real time.
    I am currently
    filling a 256 by 256 array one row at a time with data from a counter. I
    would like to
    plot each row as it comes out without replotting any old rows nor any new
    rows of the
    array currently empty of data. Using the command PlotIntensity forces me
    to replot
    the entire 256 by 256 array each time which tremendously slows down the program.
    If anyone can help this would be much appreciated
    thanks
    ken

    > Can somone tell me if it is possible to make intensity plots real time.
    I solved this problem rather nicely by using a canvas and the CanvasScroll
    function. You can draw line or blocks of color (after having scaled them
    properly, but that is easy) on the right side and then scroll to the left by
    the same amount of pixel.
    Guillaume Dargaud
    CNR/IFA
    http://sung3.ifsi.rm.cnr.it/~dargaud/Hack/LabWindo​ws.html
    http://sung3.ifsi.rm.cnr.it/~domec/
    http://sung3.ifsi.rm.cnr.it/~chooyu/
    1. When computing, whatever happens, behave as though you meant it to
    happen.
    2. When you get to the point where you really understand your computer, it's
    probably obsolete.
    3. The first place to look for information is in the section of the manual
    where you least expect to find
    it.
    4. When the going gets tough, upgrade.
    5. For every action, there is an equal and opposite malfunction.
    6. To err is human... to blame your computer for your mistakes is even more
    human, it is downright natural.
    7. He who laughs last probably made a back-up.
    8. If at first you do not succeed, blame your computer.
    9. A complex system that does not work is invariably found to have evolved
    from a simpler system that worked just fine.
    10. The number one cause of computer problems is computer solutions.
    11. A computer program will always do what you tell it to do, but rarely
    what you want to do.
    - Murphy's Laws of Computing.

  • Time delay separate to while loop

    How would I be able to obtain data (pressure read in by DAQmx) that happened 2 seconds previous?
    I need to obtain the pressure difference from 2 seconds ago hence need the previous pressure with a 2 second time delay. When I try and do this the whole program delays by 2 seconds, even when I try separate the time delay through use of another time loop. 
    Any suggestions?

  • Display multiple channels on waveform graph

    Hello,
    I would like to display multiple channels of acoustic data on one waveform graph. I currently have them separated and controlled by tabs inside a case Structure. I sometimes have run into DAQ error because I'm looking at 10 channels of 1/3 Octave data real-time. I woundering if I display all the channels on one waveform graph would I elimnate this error.
    can anyone help?

    Philip,
    I'm acquiring data at 44KHz sample rate and my frequency range is 0-20kHz (2 ni-4472 DAQ cards). Since I been using LV (off and on now for about a year) my application is still in the development stage. I tried including pics but could only include 1 at a time, so heres a copy of my vi for you. There is several things I'd like to figure out, I'm viewing data real-time and writing data to file. However, as I'm writing data to file I don't want the data to display in real-time (I think this is where my problem is). The other issued is when I've stopped writing data to file, the case structure outside the while loop opens the file and processed the data, however I'd like to see the data in the same display (waveform graph in while loop). Take look and give me thoughts.
    R/Scott
    Attachments:
    Submarine DAQ_writing reading OFFLINE_Rev2.vi ‏829 KB

  • How to stop a while loop after certain time using Elapsed time vi

    how to stop a while loop after certain time using Elapsed time vi.

    Hi Frankie,
    Just place the Elapsed Time VI inside the WHILE loop, and wire the 'Time Has Elapsed' output to the conditional terminal in the lower right corner (which should be set to 'stop if true' by default).
    In the future, please post your LabVIEW questions to the LabVIEW Forum.  You have a much better chance of getting your questions answered sooner, and those answers can then help others who are searching the LabVIEW forums.  Thanks!
    Justin M
    National Instruments

Maybe you are looking for