01-11-2012 03:55 PM - edited 01-11-2012 03:56 PM
hello
ok, i built a labview controlled machine for applying forces. The forces applied are controlled by a voltage differential sent from a PCI 6014 to a servo drive. Labview also records the applied load (From load cell) and displacement via analog inputs on the same card. Other than some serial initializations, data logging, and booking keeping, the program is fairly simple and works in a linear manner. The program has been working for around 2-3 years.
I now want to replicate this on a similar system. I have an identical computer (optiplex 360) the servo drives a little different but this only changes initializations and I don’t see how its possible it is causing the problem. The problem, I am finding that one of the plots from a load cell has approximately a 5-6 second delay in plotting data. So if I tap the load cell, it takes 4-6 seconds to show up. The first thing I did is remove all the unnecessary code and am finding there is still a little bit of a lag with just a minimal code in. I went as far as to run a version of the old code (except for initializations in serial port which are outside of main loop) and found that it has a lag on this new computer.
The program execution speed is governered by “simulate signal” vi which has a internal clock. In the older application, it was set to 3000hz, so each main loop would sample all the data in around 1/3000 times a second. But even when I half the execution speed on this new PC, the bottle neck in the plot is still there. I am also adjusting hte sampling clock to the new approximate time when halfing the speed.
thanks in advance for reading, im struggling
file attached which is the stripped down simplified version which has bottleneck.
01-11-2012 04:50 PM
update: i imaged the old working computer onto the new computer, NO luck.
the computers as identical as i bought them both at the same time
i tried lowering the iteration rate to half of what it hsould be, 1500, and forgot to mention i also lower the ADC clock too.
this just dosent make sense.,
what is bottlenecking the program?
01-12-2012 11:11 AM
ok, i think ive narrowed this down a little.
it seems it is something with the serial port
in the main loop, if i disconnect the serial port from passing through it, it starts to function without delays.
whats funny is that the serial port wires in this case are just passing through the main loop, the serial port is not even being used in the mainloopl.
althogh the serial port is not being used right now, i would like to be able to keep the wires there as i will eventually add some functionallity.
it should work, i was able to do this with the other servodrive, which was running at the same baud rate.
any help appreicated
01-12-2012 02:40 PM
Welcome to data flow you have coded a data dependancy bug.
with the VISA wired through the while loop there is a requirement that all the VISA initialization occurs before the loop starts (Data Dependancy). But when does the initialization code run? without data depandancy LabVIEW is free to pick any time like- just after you start the AI task so that the AI Buffer now contains old data when you enter the loop.
Force the initialization to finish before you start your tasks by running 1 error chain or merginging the error chain into the start tasks
01-12-2012 04:58 PM
i think serial errors are te key, the program that has the delay has some serial errors
so it must be causing that delay, lke you are saying.
i honstlely dont know what merging error chain into start task is, i only got a few hits on google
little help
thanks
01-12-2012 05:26 PM
i fixed the serial port errors that i could get in debug mode, there was one.
but there is still a lag in the the plotting if the serial port wires go through the mainloop
01-12-2012 06:11 PM
Hello, jimmyinct3!
It sounds to me like you're seeing a buffering issue, not entirely unlike this other forum post: http://forums.ni.com/t5/Multifunction-DAQ/Re-Software-in-labview-windows-lags/m-p/1708054?requireLog... There are, of course, elements of that issue that don't apply to your situation but I suspect the root cause is similar.
First, note that the PCI-6014 has a on-board memory (FIFO) size of only 512 samples, so you're buffer sizes (and in part, your Baud Rates) cannot exceed this. If LabVIEW is unable to retrieve the data from the FIFO fast enough, the next set of data will enter and you'll see what appears to be lag - this is essentially an overflow condition.
Below are two links which should help you eliminate this issue. The first is a general discussion on overflow, and the second is an example by which you can monitor buffer usage.
Understanding and Avoiding Overwrite and Overflow Errors with DAQmx: http://digital.ni.com/public.nsf/allkb/A224DA0551EEA073862574F60060AB6F
Read DAQmx Buffer Utilization: https://decibel.ni.com/content/docs/DOC-9887
This should help, but please let us know if not, or if you have further questions.
01-13-2012 08:06 AM
@jimmyinct3 wrote:
i think serial errors are te key, the program that has the delay has some serial errors
so it must be causing that delay, lke you are saying.
i honstlely dont know what merging error chain into start task is, i only got a few hits on google
little help
thanks
like so....with the merge errors wired as in this example the AI start will be the last vvi called befor the loop starts. Take a peek at the style guide too! and CTRL+U that mess
I saved this back to 9.0 You obviously not using 2011
01-13-2012 01:50 PM
Jeff,
I tried the merge error, implemented from what you provided.
It didnt change any of the performance / back log of data though
any other ideads?
01-13-2012 01:53 PM
will
the daq mx utlilization meter shows 100% usage.
im still not sure it is the problem though as the data is not over running the buffer,its just delayed 5-6 seconds.
i tried rewriting the program
according to "Understanding and Avoiding Overwrite and Overflow Errors with DAQmx"
so i should be able to have it sample 10 points at a time, right?
and since the samples are set by the acquistion time, it should work
the problem is that when i try this, nothing is showing up in my plot
im embarrassed but cant figure this out