While loop and data acquisition timing worries

Hello everyone, 
I apologize in advance if this is a silly question, but I could not find the answer around here. 
I have made a VI to record continuously from 64 analog channels at a 5kHz sampling rate. I then stream this data to a tdms file. The data acquisition and write functions are in a while loop. 
I the same loop, I have a bunch of other loops, that each run on their own wait timers to help limit the amount of memory they take up. I am now worried that this may somehow affect my data acquisition timing.
If I put a bunch of timed loops within another loop, does the outer loop run at the same pace as the slowest of the inner loops? And could that mess up my sampling rate?
I have attached my VI, in case what I just wrote makes no sense at all. 
Thanks for any tips...
Attachments:
Record_M8viaDAQv3.vi ‏237 KB

Well, looking at your code you will only write to your TDMS file one time. You have multiple infinite loops within the main/outer loop. That means that the main loop will only run a single iteration because it cannot complete an iteration until all code within it completes. With at least two infinite loops inside the loop it will never complete. Not too mention the only way to stop your code is to hit the stop/abort button. NOt a very good way to stop your code. As someone once said using the abort to stop your code is like using a tree to stop your car. It will work but not advised.
As Ben mentioned try to understand data flow better. You have unnecessary sequence frames in your code where normal data flow will control the execution sequence.
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

Similar Messages

  • My daq 6008 wil not drop the 5V after the VI is stopped, i have a digital signal going from the error out on the daq in the while loop to the error in on the daq outside the while loop and a boolean going to the data of the daq outside

    my daq 6008 wil not drop the 5V on a digital output after the VI is stopped, i have a digital signal going from the error out on the daq in the while loop to the error in on the daq outside the while loop and a boolean going to the data of the daq outside, but i can t seemto get it to work

    i attached the block diagram so you can have a look
    Attachments:
    PID Temp control.docx ‏120 KB

  • I am using a timed while loop and am unable to get the loop to run at a speed of less than 1ms (I am currently using the Wait(ms) function). How can I get a faster response?

    I am trying to create a virtual engine within a timed while loop and am unable to get the loop to run at a speed of less than 1ms (I am currently using the Wait(ms) function). This does not however allow realistic engine speeds. How can I overcome this? I have access to a PCI-MIO-16E-4 board.

    andyt writes:
    > I am using a timed while loop and am unable to get the loop to run at
    > a speed of less than 1ms (I am currently using the Wait(ms) function).
    > How can I get a faster response?
    >
    > I am trying to create a virtual engine within a timed while loop and
    > am unable to get the loop to run at a speed of less than 1ms (I am
    > currently using the Wait(ms) function). This does not however allow
    > realistic engine speeds. How can I overcome this? I have access to
    > a PCI-MIO-16E-4 board.
    Andy,
    Unless you use a real time platform, getting extactly 1 ms loop rate
    (or even less) is impossible. It starts getting troublesome at about
    0.1 Hz for standard operating systems.
    I'd tackle your problem with "if i mod 10 == 0 then sleep 1 ms".
    Of
    course this is jerky by design.
    HTH,
    Johannes Nie?

  • Does anyone know how to display (in LabVIEW) the memory use during execution of an image and data acquisition VI to predict when it is time to cease the acquisition to prevent the program crashing?

    Does anyone know how to display (in LabVIEW) the memory use during execution of an image and data acquisition VI to predict when it is time to cease the acquisition to prevent the program crashing?
    I am acquiring images and data to a buffer on the edge of the while loop, and am finding that the crashing of the program is unpredictable, but almost always due to a memory saturation when the buffers gets too big.
    I have attached the VI.
    Thanks for the help
    Attachments:
    new_control_and_acquisition_program.vi ‏946 KB

    Take a look at this document that discusses how to monitor IMAQ memory usage:
    http://digital.ni.com/public.nsf/websearch/8C6E405861C60DE786256DB400755957
    Hope this helps -
    Julie

  • How to call sub VI and close the main VI in while loop and sequence condition

    Hiya,
    I have a problem with the while loop and the sequential condition in placed together i.e while loop as Global and sequential condition as local (i.e inside the Global loop). For example,when calling the sub vi from the main vi (main vi as main menu and sub vi as sub menu.)My problem is I can't run my sub menu when the particular icon is pressed through the main menu and only the front panel appears. My concerned was if possible the sub menu is activated in few second then jump back to the main menu again (analyze through the diagram).So, I don't know what should I need to do. If possible, please advice me how to encountered that particular problem.
    Thanks!

    Go to your block diagram of your main menu, then click on the "Hightlight Execution" it is something like a bulb. then you execute your vi. then LV will show you all your data flow.
    When you feel sad, laugh

  • While loop and for loop condition terminal

    Hello friends,
    I am using labview 8.6. The condition terminal of the while loop and conditional for loop is behaving in just the opposite way.
    When i wire a true to the condition terminal of my loop, the while loop continues to run when I click on run. when I wire a FALSE, it stops.
    Is there any setting change that I have to make it to get it work properly.
    Please suggest on this.
    Thanks and regards,
    Herok

    Please do NOT attach .bmp images with the extension changed to .jpg to circumvent the forum filters!
    Herok wrote:
    I am sending you the VI. I am not sure if this would help you because only in 2 computers this behaviour is seen. In others, it works as it is supposed to work.
    Whatever you are seeing must be due to some corruption or folding error. It all works fine here.
    To make sure there are no hidden objects, simply press the cleanup button which would reveal any extra stuff (which is obviously not there). Does it fix itself if you click the termination terminal an even number of times? What if you remove the bad loop and create a new one?
    Could it be you have some problems with the graphics card and the icon of the conditional terminal does not update correctly?
    Whay happens if you connect a control instead of a diagram constant?
    What is different on the computers where it acts incorrectly (different CPU (brand, model), #of cores, etc.) 
    LabVIEW Champion . Do more with less code and in less time .

  • How do I go about this? Creating table while looping through dates?

    How do I do this? Creating table while looping through dates?
    I have a table with information like:
    ID---Date---Status
    1-------04/23-----Open
    1-------04/25-----Open
    2-------04/24-----Closed
    3-------04/26-----Closed
    What I want to do is create another table based on this per ID, but have all the dates/statuses on the same line as that ID number (as additional columns). The problem is that the number of columns needed is to be dynamically decided by the number of dates.
    To illustrate my example, I'm looking to achieve the following:
    ID---04/23 Status---04/24--Status---04/25--Status---04/26--Status
    1----Open--------------<null>-------------Open---------------<null>
    2----<null>------------Closed-------------<null>-------------<null>
    3----<null>------------<null>-------------<null>-------------Closed
    What would be the best way to go about this?
    Can someone please point me in the right direction?
    Would I need to do some looping?
    Thanks in advance!

    thedunnyman wrote:
    How do I do this? Creating table while looping through dates?
    I have a table with information like:
    ID---Date---Status
    1-------04/23-----Open
    1-------04/25-----Open
    2-------04/24-----Closed
    3-------04/26-----Closed
    What I want to do is create another table based on this per ID, but have all the dates/statuses on the same line as that ID number (as additional columns). The problem is that the number of columns needed is to be dynamically decided by the number of dates.
    To illustrate my example, I'm looking to achieve the following:
    ID---04/23 Status---04/24--Status---04/25--Status---04/26--Status
    1----Open--------------<null>-------------Open---------------<null>
    2----<null>------------Closed-------------<null>-------------<null>
    3----<null>------------<null>-------------<null>-------------Closed
    What would be the best way to go about this?
    Can someone please point me in the right direction?
    Would I need to do some looping?
    Thanks in advance!I hope you are asking about writing a query to DISPLAY the data that way ... not to actually create such a massively denormalized table ....

  • Timing control signal and data acquisition

    I have a series of relays which when activated will close different elements of a circuit and I also have a sourcemeter(Keithley) sending a constant source current and reaing the voltage back.(But when no relays are closed the circuit is open and no source current flows )
    I have a microcontroller(pgmmed for 9600 baud rate) based hardware circuit which closes different relays sequentially based on the input it recieves from labview pgm passed on through a Rs232 cable(9600/8 bit/no flow control)
    So i made a sequence structure of sending signal to microcontroller signal then wait for the signal transmission and realy activation and then read the voltage value form keithley sourcemeter back to labview thro a GPIB cable.
    These three events are reapeated sequentially in a while loop. 
    A schematic picture is attached.
    BUt the problem I ma facing is the maximum speed of reading is limited to 200msec/reading even thought the relay activation time is as low as 30 msec.
    I tried with many different delay times (140-60 msec...but more or less each reading takes up 200msec irrespective of the delay time..) 
    What could be the bottle neck is it the Rs232 setting at 9600 baud rate..can changing that to higher baud rate/including flow control solve this problem?
    Attachments:
    daq_printscreen.GIF ‏45 KB

    siva0182 wrote:
    Find attached the picture of the vi where I tried to put in timers.one in each of the frame and at the end added one more frame just to measure the time elapsed .
    The last frame and the frame with sourcemeter measurment show adifference of about 140 msec.
    Is there any way to improve the speed of this portion?
    Probably not.  It sounds like the Keithly VI is taking 140 msec.  You can try opening that up to see if there is anything in there that could be causing an unnecessary slowdown.  But trying to tighten it up too much may cause occasional errors (such as timeouts) in trying to get a response back. 
    But surprisingly I tried displaying the actual timer value at the start and at the start of sourcemeter read function ..but the display of both indicators is almost equal with little difference of only 10 msec.?????  I'm not sure which of the several timers you are referring to here.  What is the value going into the wait function between the VISA write and the Keithly VI?
    When you do benchmarking, the timer functions should be in a frame all by themselves.  Having it mixed with another function or VI causes a bit of uncertainty as to when the time was taken.  For instance, you dont' really know if the Keithly VI was started before the time was taken or after.  (The time was probably taken first, but without a data flow or sequence structure dependency, you can't be sure.)

  • Problem with DAQ in while loop and Graphs

    Hello,
    I'm new here so I apologize if I posted this on the wrong board  
    This is my "situation":
    I need to make a simple PID controller which takes information (process variable) from an outside source (a NI's DAC connected through the USB port ) which is accomplished using NI-DAQ as an input, and the PID's output goes to the second NI-DAQ which is also connected using DAC to an actuator which in my case regulates the air pressure. (VI attached)
    My problem is the following.
    Both of the NI-DAQ I placed using DAQ Assist, require to be in a while loop.
    -If I place them in separate loops, I have the problem of passing information between the Input NI-DAQ and the PID, and also between the PID and the Output NI-DAQ.
    -If I place them both in one big loop, an error occurs saying that the selected buffer size is too small (Error -200609).
    The timing settings for the DAQ's N samples, 100 samples to read at the rate of 1k (I also tried with Continuous samples and many different combinations of Samples to Read an Rate but without success).
    Should I wire them with the same dt(s)?
    The other thing I need to do (I'm also writing it here in order not to open new topics) is show the following 3 signals on a Graph (process variable (dynamic data type)(range 4mA - 20mA), PID output (double)(range 4mA - 20mA), and the Set Point (double)(range 0 to inf))
    Firstly, is it possible to show the first two on a scale from 0 to 100 without changing the PID's output which needs to be 4-20?
    Secondly, which graph should I use if I have different data types? (I tried the Waveform Chart, and succeeded in showing the first two; the third just messes everything up)
    I would also have to make a legend explaining which signal is which (I see that this is possible with the Mixed Signal Graph).
    I know this is probably too much to ask, but I'd be grateful for any help
    Thank you in advance
    Attachments:
    PID while.vi ‏100 KB

    My problem is the following. Both of the NI-DAQ I placed using DAQ Assist, require to be in a while loop.
    -If
    I place them in separate loops, I have the problem of passing
    information between the Input NI-DAQ and the PID, and also between the
    PID and the Output NI-DAQ.
    This is the best option---Use QUEUE or Functional global or something else to tranfer the data to and fro
    How  do I make that QUEUE or Functional global?
    -If I place them both in one big loop, an error occurs saying that the selected buffer size is too small (Error -200609).
    Have
    you tried increasing the buffer? Is the acquisition happening
    parallelly (means to say the first DAQ not wired (error terminal) to
    second DAQ)
    Well the buffer is, at least how I understood it, the option Number of Samples when in Continuous Samples mode. Concerning the parallel acquisition, do you mean I should wire the error ports of both of the DAQs?

  • How to stop a while loop which contains a timed loop

    Hi,
    I'm a new hand to labview, and I'm using labviw 7.1, NOT 8.x.  I'm trying to do a measurement, in which the flow would look like the attached file (I have stipped all hardware related components to make it easy to read).  My questions are:
    1. In Loop 3, when the comparison (x>20.85) is true, Loop1, Loop2 and Loop3 are stopped, why it won't quit the while loop (I have wired it to  while loop stop)?
    2. When it is running, I click on stop button, why it won't stop?
    Thanks!
    Attachments:
    SyncTimedLoop32.vi ‏228 KB

    hwm wrote:
    2. When it is running, I click on stop button, why it won't stop?
    The stop button is read outside of the inner while loops.  So the inner while loops will continue to run until their stop conditions are met.
    hwm wrote:
    1. In Loop 3, when the comparison (x>20.85) is true, Loop1, Loop2 and Loop3 are stopped, why it won't quit the while loop (I have wired it to  while loop stop)?
    It seemed to me like it would, but sometimes it seemed like I had to set change the numeric value one more time before it would.  You have a very odd structure there by placing the event structre inside the while loop with the other loops.  I think you may be running into issues where events are getting queued up in the event structure, or race conditions between when the event structure might execute relative to the other loops.  It is all very odd and difficult to predict all the ways these structures might interact and relative timing.  Usually event structures would belong in their own parallel while loop.  I think you need to rethink exactly what you are trying to do here.  It probably isn't event necessary to use the stop timed structure functions.  A local variable or a notified to pass the "Stop status" from loop 3 to the other loops (or the separate event structure loop to the other 3) would probably be better.

  • Need help with while loop and shift registers

    I have a large data set and need to read in the data at maybe 200 samples at a time, process these samples through my VI, and have it append and concatenate a separate lvm file.  The part where I am confused is the shift registers. How do I limit the number of samples read in an iteration? How do I get the while loop to stop when all the data are read in?
    I've attached my diagram, maybe there is something wrong with my technique?
    Solved!
    Go to Solution.
    Attachments:
    shiftreg.JPG ‏56 KB

    This will give you an idea.  There are plenty of other (probably more efficient) methods.  This is a basic, quick and dirty solution to help you grasp the overall concept.
    Using LabVIEW: 7.1.1, 8.5.1 & 2013
    Attachments:
    ShiftRegLoop.JPG ‏54 KB

  • Agilent E4980A Measurement Speed and Data Acquisition Speed

    I am using E4980A LCR meter, I need very fast data aquisition unfortunately limited by device own speed with 5.6 ms per measurement which means nearly 178 Hz. I am using usb interface with the software provided by NI, in that program I made some modification taking the reading side of the programme in a while loop .
    To test my speed I start the program count 5s and stop saving the results to an excell file. If I plot the results in a graph while programme is working I have 60 Hz speed. If I don't, then it is 80 Hz which are far below the potential maximum speed of 178 Hz. If my lap top battery is very low then my speed is worse. But with no battery problem, my celeron laptop performance is the same as an i7 laptop.
    Here it is my programme, it is the same provided NI but some modification. What can I do to have higher data acquisiton speed ?
    Probably, USB's speed is not enough but I can not believe that while it can save gigabytes of data in a few min can't take 200 datapoint in 1s. Why can't I have 178 Hz speed now and how can I reach this limit ?
    Regards.
    Attachments:
    Read Measurement.PNG ‏44 KB
    Read Measurement.PNG ‏44 KB

    Instrument communications via serial, USB, Ethernet, GPIB, etc just tend to be slow.  The instrument has to interpret the data, react to it, and then send data back.  That takes time.  A few ms per measurement is quite normal.  One option you might have is you could tell the instrument to take several measurements and then request all of the measurements once it is done.  I haven't looked into the E4980A yet to see if it can do that.
    What exactly are you trying to measure.  There might be better ways to get "fast" readings.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions

  • Synchrosnised video and data acquisition

    I am a Labview user who would like to capture video and data (from one video
    camera and 4 strain gauges) simultaneously, then be able to play the video
    whilst being able to process the data streams. Is there a simple way to do
    this? - Thanks!

    I use Imaq for Labview to do the image acquisition, while using a traslation
    system. It works. The Motion controller is controlled by Labview too.
    (RS232)
    It doesnt seem u need syncronization from ur mail, maybe just a simultaneous
    acquisition. In this case it's very easy.
    Saint
    "Kevin Powell" ha scritto nel messaggio
    news:[email protected]..
    >
    > I am a Labview user who would like to capture video and data (from one
    video
    > camera and 4 strain gauges) simultaneously, then be able to play the video
    > whilst being able to process the data streams. Is there a simple way to do
    > this? - Thanks!

  • How to structure a control and its display in the same while loop and same display panel (instead of display panel and a seperate parameter-setting panel )

    As you can see, I need to adjust the Target position to certain value (like 1068.88), the actual position is showing 1066.99.  What kind of flow control structure will achive this goal?
    Notice the Labview example "Vibration analysis"  may shed some light on this issue.  Will someone give out a simpler code to show how it works?
    Attachments:
    Spectrometer Control V3.0.vi ‏113 KB

    lightblue,
    Just to make sure we are on the same page, you would like to set the position, then monitor it.  Is that correct?  In that case, you might have a few options.  You could have a sequence that would set the position, and then a while loop that would monitor the position, however this wouldn't allow you to update anything else.  The other option would be to use parallel while loops, which would be similar to the parallel sequence structure you have below.  The only issue with this would be that if you are calling the driver from both loops, you could run into errors.  The Vibration Analysis.vi takes the setpoint, then calculates the actual available position, so it won't serve as a very good example, code-wise. 
    Hope this helps!
    Andy F.
    National Instruments

  • Simultaneous analog output 1k sine wave and data acquisition

    Although many topics of simultaneous analog output and input can be found in NI Developer Zone, I have not found a case similar to my project. I'm trying to generate a 1kHz sine wave by using the analog output of NI DAQPad-6070E, and acquire one channel input signal simultaneously. I found most of the examples can not work properly above 100Hz. Any suggestions are welcome. Thank you.
    Jian

    I have sucessfully solve the problem when I observed the increase of
    scan backlog number. Simply increase the buffer size of AI/AO and you
    can make the 1kHz sine wave output and data acquired properly.
    On Tue, 3 Feb 2004 09:03:07 -0600 (CST), jujian wrote:
    >Although many topics of simultaneous analog output and input can be
    >found in NI Developer Zone, I have not found a case similar to my
    >project. I'm trying to generate a 1kHz sine wave by using the analog
    >output of NI DAQPad-6070E, and acquire one channel input signal
    >simultaneously. I found most of the examples can not work properly
    >above 100Hz. Any suggestions are welcome. Thank you.
    >
    >Jian

Maybe you are looking for

  • My macbook pro keeps disconnecting from my airport

    Hello Guys. So I am from Europe..Last summer i bought from America a Macbook Pro 13 mid 2014 and an Iphone 6. Two weeks ago i updated my products so i bought an Airport Express...(2)Everything was great(3) for one week...I was very happy(4) with my i

  • VS2013 / Team Explorer vsix - How to get the currently selected build definition?

    Greetings, My goal with a simple extension is to right-click any build definition and if my "Show Build Def Stats" menu item is selected, pop a message box with some summary details I plan to pull from the IBuildDefinition interface. I'm missing some

  • Error in Upload Cash Sales

    Hi, I am uploading External Sales Invoices through BAPI_BILLINGDOC_CREATEMULTIPLE which is working fine in normal sales process, but when I try to post Cash Sales Invoice it gets posted with zero value. I am using Item category TAD - Service as these

  • Authorization Objects in BI 7

    Hi PFGC>Role>Authorizations (Tab)>Change Authorization Data>Manually Enter Authorization Objects. Where can I Create the required Authorization Objects and view the definition of existing Authorization Objects in BI 7 Thanks

  • What update do I need to get Mac OS X Lion 10.7.5 (11G63b) to run Apple TV?

    What update do I need to get Mac OS X Lion 10.7.5 (11G63b) to run Apple TV? I have been told its about $19.95 aus can someone please give me a link so I can  get the correct update to run the Apple Tv through my Mac Thanks