LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

performance read from file vs variable

It's already posted, look at the 4:th message...
0 Kudos
Message 11 of 16
(888 Views)

Could you please help us figure out what is different between those two programs?

 

They look the same to me, I don't see a GUI Dialog nor do I see any locals.

 

I am at a loss as to any suggestions I can offer.

 

Maybe some one can spot something.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 12 of 16
(877 Views)

In the first frame the program reads a sequence with a number of 8-bit numbers from a file. This sequence is then connected to a NIDAQMX box in the second frame that sets up that these will be writen to the first digital port. If I replace the loaded sequence with a sequence that you can set from the gui the program runs a lot faster and does not slowing down Windows as well. Why?

0 Kudos
Message 13 of 16
(858 Views)

patrac wrote:

In the first frame the program reads a sequence with a number of 8-bit numbers from a file. This sequence is then connected to a NIDAQMX box in the second frame that sets up that these will be writen to the first digital port. If I replace the loaded sequence with a sequence that you can set from the gui the program runs a lot faster and does not slowing down Windows as well. Why?


Lacking that version of the code I am forced to assume you are trying to read your data from a FP object.

 

So it sounds like you have discovered that reading from FP objects is not that fast and often forces data copies etc.

 

Still working from that assumption...

 

Put your data in an Action Engine and read from rather than the GUI.

 

You can also browse the set of of LabVIEW_Performance tags or these releated links.

 

Just trying to help,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 14 of 16
(839 Views)

There are several ways you could improve this code:

  1. The method you have used to read in the data, Read From Spreadsheet File.vi, is extremely inefficient (but also very easy).  It will also starve the GUI while running because it is a tight loop with no delays.  However, this should not effect your run-time performance, only a hit at the beginning.  If you are reading a huge file (hundreds of thousands to millions of points) there may be memory fragmentation issues. You may get better performance from the corresponding Express VI.
  2. You really need to create some subVIs.  I would suggest you start by making the initialization of each of your acquisitions into a subVI.  Then pick blocks of functionality and do the same.  It will make your code easier to read and maintain.  Don't forget to put custom icons on the subVIs and at mark required inputs as required.
  3. You should split up your acquisition and storage functions into separate loops.  This allows the simple multi-threading nature of LabVIEW to be utilized.  Search the examples for producer-consumer loop architectures.  Use a queue to pass data from the acquisition VI to the storage VI.
  4. You can format data directly into text with a period decimal separator by using "%.;" at the beginning of your format specifier.  This will eliminate the search and replace you currently have.  You can specify a comma decimal separator by using "%,;". See the LabVIEW help for details.
  5. If at all possible, store your data as binary.  As has been said previously, the text conversion is very slow.  TDMS is particularly easy to use and you can find utilities to use it with most major analysis packages on the NI website.
Your major problem appears to be that you are taking data, converting it, and then storing it in a serial fashion.  This is inefficient.  Taking the data in one loop and storing it in another should solve your issue.  Good luck and let us know if you have any more questions.  Please include the size of your input data files if you have further questions.  This can make a huge difference in performance and how you write the code.
0 Kudos
Message 15 of 16
(830 Views)

Ok!

It seams like the numbers that i read from file is'nt buffered even if the "read from file box" is in the first frame. Now I'm trying to read the numbers to a shift-register and i'm two loops: one for reading and one for buffering. The program runs faster now but I have now checked if it does what it's supposed to do yet.

Thanks for helping me out.

Message Edited by patrac on 05-08-2009 05:31 AM
0 Kudos
Message 16 of 16
(818 Views)