LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

wrong execution time for while loop

Hello everyone!!! I'm a beginner for Labview.

Now we are using labview to monitor the discharging process for a lead acid battery which require to time current with time (I*t) to get power used for the battery.

But our time counter has a problem that it counts from 0 to 1,2,3,4 then jump to 6 directly. And followed by 7,8,9,10,11 and jump to 13... When run the time counting part individually it runs well that follow 5 by 6 then 7...

 

I attached our program inside and can someone help us with this problem???

Millions of Thanks!!!!!!!

0 Kudos
Message 1 of 7
(3,044 Views)

Your DAQ assistant is set to collect exactly 1 seconds worth of data.  The code after that is going to take some fraction o ftime to run, thus your overall loop iteration time is going to be something longer than 1 second.  Once your VI has run long enough, you are going to come to some time interval that the iteration starts right before a second ends, and ends right after another second starts, more than a second later.  That will look like your missing second.

0 Kudos
Message 2 of 7
(3,038 Views)

Try changing your DAQ Assistant configuration to be "Continuous Samples" instead of "N Samples".  This way the DAQ can still be collecting samples even after you read the data and while you process what you have.

 

You do realize that you are taking 25,000 samples per channel and only using 1 of them, right?  You may want to rethink what you are doing here.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 7
(2,996 Views)

so I need to decrease my time to collect data. Less than 1s???

0 Kudos
Message 4 of 7
(2,969 Views)

OKAY I will try it!!!

thank you!!!

0 Kudos
Message 5 of 7
(2,968 Views)

Yes.  Follow Crossrulz's advice.  The first iteration will take longer than a second, but with continuous samples, the next second's worth of samples will begin filling the buffer while the VI takes the fraction of a second it needs to do the math after it grabs the data.

 

But I would also still reduce the amount of samples to grab at a time.  Collecting about 1/10th of a second of data is usually a good compromise between have a decent sample set vs.a responsive application.  Even setting the amount of data to grab to be 1/4 or 1/2 second would be good.

0 Kudos
Message 6 of 7
(2,965 Views)

okay  okay!!!

Thanksssss!!!!

0 Kudos
Message 7 of 7
(2,927 Views)