LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS File starts recording data at 20Hz, but after a short time drops to <10Hz as VI slows, why?

One option that I have done before was write a FIFO buffer as an action engine.  I stored about 1/2 hour of data in the buffer always, with  "Add Data", "Read New Data", and "Read Historic Data" commands.    I could then have my data save loop run at a very slow rate with automatic bunching, with the added option of recovering / saving 1/2 hour worth of data if ever needed.

0 Kudos
Message 11 of 34
(2,334 Views)

@crossrulz wrote:

If you are using a Producer/Consumer, it is very easy.  One way is to recieve multiple elements in your queue and then write all of them in a single TDMS write.


Aren't I doing that now in the code I posted? I have a cluster of elements the queue, are you saying lose the other two writes, and recmombine them later? This is the code i posted earlier that is slowing down: 

 

 

 

 

0 Kudos
Message 12 of 34
(2,326 Views)

Yes.  So with your top loop, put the dequeue inside of a FOR loop that can stop when there is a timeout.  The reason for the FOR loop is to log multiple instances at once.  I would set N to be something like 10 (or more if you can afford to wait longer between writes).


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
Message 13 of 34
(2,318 Views)

And looking at this code again, we should combine the two string writes into a single write, like we are doing with the numerics.


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 14 of 34
(2,314 Views)

@crossrulz wrote:

And looking at this code again, we should combine the two string writes into a single write, like we are doing with the numerics.


How do I combine them but keep them appearing in the right columns like they are now? I made them separate since I needed the headers to appear in excel a certain way when I opened the TDMS in excel.

 

Also am I doing a best practice by having double queues, one for VISA and one for data? Should I move the VISA just into the main loop with all the graphing? would that save memory/prevent slow downs?

 

And did i implement the array preallocation correctly in the main graph?

0 Kudos
Message 15 of 34
(2,305 Views)

@superomario wrote:

How do I combine them but keep them appearing in the right columns like they are now? I made them separate since I needed the headers to appear in excel a certain way when I opened the TDMS in excel.


Well, if that is a requirement, then nevermind.

 


@superomario wrote:

Also am I doing a best practice by having double queues, one for VISA and one for data? Should I move the VISA just into the main loop with all the graphing? would that save memory/prevent slow downs?


That is what I do.


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 16 of 34
(2,291 Views)

Thanks, I will give the for loop a try and run the program again, if it still does not result in 20sample/sec data recording/display am I just SOL?

 

And when you say that is what you do, do you mean keep two queues or VISA in main loop?

0 Kudos
Message 17 of 34
(2,285 Views)

@superomario wrote:

And when you say that is what you do, do you mean keep two queues or VISA in main loop?


I have what I call "modules".  In your case, there is an instrument module, a processing module, and a logging module.  Communication between loops is done with queues, just like what you have now.


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 18 of 34
(2,279 Views)

@crossrulz wrote:

Yes.  So with your top loop, put the dequeue inside of a FOR loop that can stop when there is a timeout.  The reason for the FOR loop is to log multiple instances at once.  I would set N to be something like 10 (or more if you can afford to wait longer between writes).


How did you get the stop sign in the for loop? Nvm I got that.

 

I am getting the error REfnum became invalid while the node waited for it. if the for loop is in the code and i hit the stop button. what does that mean?

0 Kudos
Message 19 of 34
(2,246 Views)

@superomario wrote:

I am getting the error REfnum became invalid while the node waited for it. if the for loop is in the code and i hit the stop button. what does that mean?


Well, you are trying to stop this loop by destroying the queue.  So that makes sense to me.


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 20 of 34
(2,234 Views)